Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

Since anything before and after the dot is arbitrary, why bother?

Related error:

RuntimeError: Error: Registering operator class: 'abcdefg', invalid bl_idname 'abcdefg', must contain 1 '.' character
share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

This rule may seem arbitrary, but looks like there's already some structure in existing operator's names. All registered operators will end up within bpy.ops module, and we can see that identifiers directly under it is reserved for modules/namespaces further categorizing the operators:

When we need an operator to quit Blender, it's available, grouped with other window management operators.

At first I, too, didn't bother with naming, putting everything under bpy.ops.object. But namespace distinction really helps to document, browse and search all the operators. Predictable identifier + Python console's Autocomplete feature made it easier to discover and build upon existing operators, including those from other addons.

I don't know if it has any other significance, but self-documentation alone made the naming rule worthwhile to enforce.

share|improve this answer
add comment

Developer note: in C code blenders operators are formatted SOME_OT_operator, which gets converted to some.operator in Python. To ensure the conversion can be done the "." needs to be added.

Then we can expose all operators as bpy.ops.some.operator() too, which is neat/logical.

This is arbitrary and we could have chosen not to do it, but I think having each tool in a named category is a good thing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.