On 04/09/2017 at 08:16, xxxxxxxx wrote:
Hi,
welcome to the Plugin Café forums :slightly_smiling_face:
SearchObject() is one of the options you have. Depending on a user's naming scheme not always the best one, as it returns only one object with the specified name.If the user has several objects with identical names, you probably won't get the desired result.
For example it's often simpler or more effective to iterate through the scene (tree of objects). Maybe you don't even want to search objects by name, but rather by type...
In these cases you can either start with the first object (GetFirstObject()) or with the currently active/selected object (GetActiveObject()). And then you have GetPred(), GetNext(), GetUp() and GetDown() to walk through the tree of objects.
See also our C++ manual on navigation in lists and trees, no worries it should be easy to understand for Python developers as well.
Regarding your question on doc and op. These are predefined variables in most places where you can use Python inside Cinema (plugins excluded). doc is always pointing to the active document. In case of a Python tag op is the tag itself, in general op points to the entity the Python code is running in. So in a Python Generator it's the generator object. In a Xpresso Python node it's the node. In Script Manager and Console it is the currently active object (if any).