1
$\begingroup$

Blender Wiki notes the following about bl_idname convention.

BlenderWikiAddon

"For headers, menus and panels, the bl_idname is expected to match the class name (automatic if none is specified).

Valid Examples:

class OBJECT_OT_fancy_tool (and bl_idname = "object.fancy_tool")
class MyFancyTool (and bl_idname = "MYADDON_MT_MyFancyTool")

" In other Blender Python documentation I noted also: PythonDocumentationPanel

class HelloWorldPanel(bpy.types.Panel): bl_idname = "OBJECT_PT_hello_world"

and

class PanelOne(View3DPanel, bpy.types.Panel): bl_idname = "VIEW3D_PT_test_1"

I struggle to grasp how all these are valid as the demand is "expected to match the class name".

Can you shade light on the convention or refer me to the right source, so I know how and when to use Upper, Lower, Mix case?

$\endgroup$
7
  • 1
    $\begingroup$ blender.stackexchange.com/questions/124095/… $\endgroup$
    – batFINGER
    Feb 24 at 10:45
  • $\begingroup$ Also this is the same but more direct: b3d.interplanety.org/en/… $\endgroup$
    – Psyonic
    Feb 24 at 10:47
  • $\begingroup$ the document states UPPER_CASE_{SEPARATOR}_mixed_case. Below in the valid exemples it shows: bl_idname = 'myaddon.my_operator' and bl_idname = 'MYADDON_MT_my_menu'... But how the lower case example is also valid? $\endgroup$
    – donbonbon
    Feb 24 at 14:34
  • $\begingroup$ @Psyonic the document states UPPER_CASE_{SEPARATOR}_mixed_case. Below in the valid exemples it shows: bl_idname = 'myaddon.my_operator' and bl_idname = 'MYADDON_MT_my_menu'... But how the lower case example is also valid? $\endgroup$
    – donbonbon
    Feb 24 at 19:01
  • 1
    $\begingroup$ Having a hard time to understand your question. MyFancyTool as well as MyFancyPanel is valid because of PEP8: python.org/dev/peps/pep-0008/#class-names However, the recommended way is the one you've already found in the release notes, CUSTOM_PT_myPanel or CUSTOM_OT_myOperator for the class name. When it comes to operators, the most important thing to note is that they can be called using bpy.ops.* ... bpy.ops + namespace + your name to classify whether it is an operator for meshes, lights, cameras or whatnot, bpy.ops.namespace.my_fancy_tool(). Does this help? $\endgroup$
    – brockmann
    Feb 25 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.