A lot operators use StringPropertys to reference objects by name. This works well for ID datablocks - no duplicate names allowed (although there can be issues with linked datablocks).

But not all objects are of type ID datablock, and unique names may not be enforced. Related operators may take a string for indentification however. Thus you may not act upon the right object.

If names aren't unique, one could use an integer to reference by index. But I wonder if there are any operators, which actually take a pointer to the right object (in C)? Like:

ot->prop = RNA_def_pointer(...);

Is it even possible to use pointers as operator properties? It would mean that python couldn't make any use of it, if I'm not mistaken (or could one pass a python object, and have C code figure out the pointer?).


1 Answer 1


Operators should never have pointer properties and as far as I know there aren't any that do.

Such pointers would not be valid after deleting objects or after undo/redo steps, which would give problems in the operator history stack when repeating operators for example.

Operators that take datablock names should usually be avoided for python scripting. It's better to edit the data directly than going through operators when possible, there's probably only a handful of cases where you need to do this.

  • $\begingroup$ Thanks brecht, makes sense. I encountered transform orientations not needing a unique name, and currently delete based on index number in my mockup code. It is necessary to use an operator 'cause there is no RNA method to create/delete them. It doesn't even take a name for deletion, it is based on context instead. I wondered if there's a better way, at least in C. $\endgroup$
    – CodeManX
    Feb 26, 2014 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .