For example, I can run:

retCode = bpy.ops.mesh.primitive_cube_add(). 

It doesnt return any kind of identifier, just a code (e.g. "FINISHED", if it finished correctly).

When I make my own operator, I can set programmatically what name it should have, and put that into an input argument to the operator. But this still does not solve the problem, because Blender renames meshes with the .XXX logic when names collide.

I would have expected an interface of the kind:

retCode,AssignedName = bpy.ops.mesh.primitive_cube_add(Name, lots of other args)

What am I missing?

  • 2
    $\begingroup$ Short answer is no: blender.stackexchange.com/a/18878/31447 Doesn't matter to much, because the recommended way is to use low level calls anyway: blender.stackexchange.com/questions/61879/… $\endgroup$ – brockmann Dec 14 '20 at 13:13
  • 1
    $\begingroup$ Sigh. Blender uses the operator context paradigm. Changes made by the operator are reflected in the context. The name of a new primitive object would be context.object.name directly after running the operator successfully. (It is expected of operators that create objects to set the new object as both active and selected,) What would be your expectation of the return codes for bpy.ops.object.delete() or show splash screen? $\endgroup$ – batFINGER Dec 14 '20 at 16:22
  • $\begingroup$ blender.stackexchange.com/questions/45101/… $\endgroup$ – batFINGER Dec 14 '20 at 16:27
  • $\begingroup$ Thanks @batFINGER. Clear answer, and great link to the connected question. Must be tiring with so many new users interested in this stuff :) $\endgroup$ – Stefan Karlsson Dec 15 '20 at 13:57
  • $\begingroup$ Apologies , was getting flak elsewhere.. it's to late to "de-sigh" comment above. $\endgroup$ – batFINGER Dec 15 '20 at 14:02

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.