Isotropix Forums

Finding objects and parenting

Clarisse Scripting related topics

Finding objects and parenting

Unread postby jorgetrevilla » Thu Apr 06, 2017 3:01 am

Hi guys!

I've been trying to script something very simple that would save lots of time;

I'm trying to to script something that would find a very specific object if it finds it parent it to another object and set the transforms of said object

Any ideas very much appreciated!

Thank you
Lighting TD
Double Negative Vancouver
Posts: 5
Joined: Thu Feb 11, 2016 7:25 am

Re: Finding objects and parenting

Unread postby bvaldes » Mon Apr 10, 2017 10:52 am


You can take a look at this script to help you:

python code

parentItem = ix.item_exists("project://scene/camera") # get the item if it exists else return None
items = ix.api.OfObjectVector() # This variable will contain all the result of ou search
ix.application.get_matching_objects(items, "*light*") # The search function, set a rule like the group ones

# For all items founds, even if you should only find one
for i in range(items.get_count()):
item = items[i]
if parentItem:
ix.cmds.SetParent([item.get_attribute("parent").get_full_name()], [parentItem.get_full_name()], [0]) # Set the parent item

# Get parent transform and set it to the child
for attr in ["translate", "rotate", "scale"]:
for i in range(3):
parentValue = str(parentItem.get_attribute(attr).get_double(i))
ix.cmds.SetValues([item.get_attribute(attr).get_full_name()+"["+str(i)+"]"], [parentValue])

Hope this help, let me know if not. Regards.
Clarisse QA
User avatar
Posts: 141
Joined: Mon Sep 26, 2016 11:44 am

Return to Scripting