Page MenuHome

Warning: 'matlib.libs_menu' doesn't contain '_MT_' with prefix & suffix
Closed, ResolvedPublic

Description

System Information
Operating system and graphics card

Windows 7 64 Bit, 1060 gtx

Blender Version
Broken: (example: 2.69.7 4b206af, see splash screen)
Worked: (optional)

Latest buildbot version 2.79.4

Short description of error

Three name convention warnings when you switch the library in the materials library vx addon.

Materials Library VX addon comes with Blender and is activated by default.

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

Open Blender, switch to Materials tab, go to the Materials Library VX addon. Switch to another library. Watch the console.

There is one panel and two menus which doesn't follow the name convention so far. And the two menus had a unnecessary bl_idname, which gots used to display them in the panel. While you can display the menus with the classes names already.

I tried to fix it by myself, and so far the addon is working fine, and doesn't throw an error anymore. So my solution seems to follow the name convention now.

Diff:

 ### MENUS
-class matlibLibsMenu(Menu):
-  bl_idname = "matlib.libs_menu"
+class MATLIB_MT_LibsMenu(Menu):
+  #bl_idname = "matlib.libs_menu"
   bl_label = "Libraries Menu"
 
   def draw(self, context):
@@ -749,8 +749,8 @@ class matlibLibsMenu(Menu):
     for i, lib in enumerate(libs):
       layout.operator("matlib.operator", text=lib.shortname).cmd="lib"+str(i)
 
-class matlibCatsMenu(Menu):
-  bl_idname = "matlib.cats_menu"
+class MATLIB_MT_CatsMenu(Menu):
+  #bl_idname = "matlib.cats_menu"
   bl_label = "Categories Menu"
 
   def draw(self, context):
@@ -1115,7 +1115,7 @@ for mat in mats:
     return {'FINISHED'}
 
 
-class matlibvxPanel(Panel):
+class MATLIB_PT_vxPanel(Panel):
   bl_label = "Material Library VX"
   bl_space_type = "PROPERTIES"
   bl_region_type = "WINDOW"
@@ -1141,7 +1141,7 @@ class matlibvxPanel(Panel):
     else:
       text = "Select a Library"
 
-    row.menu("matlib.libs_menu",text=text)
+    row.menu("MATLIB_MT_LibsMenu",text=text)
     row.operator("matlib.operator", icon="ZOOMIN", text="").cmd = "LIBRARY_ADD"
     if matlib.active_material:
       row.label(matlib.active_material.category)
@@ -1179,7 +1179,7 @@ class matlibvxPanel(Panel):
     row = layout.row(align=True)
     text = "All"
     if matlib.current_category: text = matlib.current_category
-    row.menu("matlib.cats_menu",text=text)
+    row.menu("MATLIB_MT_CatsMenu",text=text)
     row.prop(matlib, "filter", icon="FILTER", text="")
     row.operator("matlib.operator", icon="FILE_PARENT", text="").cmd="FILTER_SET"
     row.operator("matlib.operator", icon="ZOOMIN", text="").cmd="FILTER_ADD"
@@ -1202,7 +1202,7 @@ class matlibvxPanel(Panel):
 #      else:
 #        row.label("Library not found!.")
 
-#classes = [matlibvxPanel, matlibOperator, matlibLibsMenu, matlibCatsMenu]
+#classes = [MATLIB_PT_vxPanel, matlibOperator, matlibLibsMenu, matlibCatsMenu]
 #print(bpy.context.scene)

Or if you want the whole __init__.py:

Event Timeline

Whoops, better check the init.py, i made some usability changes at it, and forgot to revert them for this report. I included the Preview element into the addon, and made the preview and assign buttons bigger and easier to access. Both has nothing to do with the error message reported here. But maybe you find it useful ...

Philipp Oeser (lichtwerk) claimed this task.
Philipp Oeser (lichtwerk) triaged this task as Normal priority.

thanx @Reiner Prokein (tiles) , will doublechk and commit (soonish)

Reiner Prokein (tiles) renamed this task from Warning: 'MAT_PT_matlib.libs_menu' doesn't contain '_MT_' with prefix & suffix to Warning: 'matlib.libs_menu' doesn't contain '_MT_' with prefix & suffix.Apr 25 2018, 9:38 AM

@Reiner Prokein (tiles) : fixed strict namings now, havent looked at other changes though, if desired, could you submit a diff and we go through this separately?

Not necessary. It was accidentally committed anyways. Thanks for the fix :)