Naming conventions, guidelines & restrictions


Where I can read more on how to properly name variables, classes, etc. so that it will conform to Blender scripting mechanisms?

For example, only by trial &error I discovered that I can’t register my operator like

bl_idname = "ops.ExportButton"

because it fails with

invalid bl_idname 'ops.ExportButton'

but if I change the idname to ops.export_button, it works.

Why are internal classes named like; MATERIAL_PT_, WORLD_PT_… Is this important? Do I have to follow it when naming my custom panels?

More generally; are there any papers that help to understand how is the whole scripting mechanism conceptually supposed to work? Maybe with a diagram or two. The simple code examples that you can find around, are fine and all, but I haven’t been able to connect all the dots and get the “big picture” yet.

I’m fairly experienced in Blender, but have only recently start to dive into scripting, so excuse my noobiness :smiley:

Yeah, there was an (annoying) change a while back where ops couldn’t contain capital letters.

Basically, if you don’t have a category (I imagine it’s called, eg ‘object’) and a (non-CamelCase) name separated by a ‘.’ then it’s invalid. Oh, and don’t get all fancy and add more than one ‘.’ either.

And of course none of this is written down anywhere…

1 Like

I’ve just found this today. Aaarg, a few hours lost because this wasn’t documented!

1 Like


Best Practice: