Isotropix Forums

Changing Raytrace offset on all ScenOjects

Clarisse Scripting related topics

Changing Raytrace offset on all ScenOjects

Unread postby pjenness » Fri May 19, 2017 5:47 am

Hiya

We want to set all the raytrace offsets on objects in a scene.

Im guessing there are a few simple lines that will create a list of all valid scene objects (that have a rendering section in their attributes) and be able to change the offset.

Is there an example for the syntax of this.

Would love to find some guides to the syntax of clarisse python. Im familiar with Maya python and Mel, but not sure where to find good examples for clarisse.

Thanks heaps.

-P
pjenness
 
Posts: 6
Joined: Sun Sep 06, 2015 11:30 pm

Re: Changing Raytrace offset on all ScenOjects

Unread postby bvaldes » Fri May 19, 2017 11:03 am

Hi,

This is a code that can help you to achieve what you want:

python code

result = ix.api.OfObjectVector() # will contain our result
filters = ix.api.CoreStringArray(1) # will contain our filter (type of item we are looking for)
filters[0] = "Geometry"
ctx = ix.get_item("project:/") # The context where we want to search (the subcontext will be taking in acount)
ix.application.get_matching_objects(result, "*", ctx, filters) # the command to search the items

# For all items found change the raytrace_offset
for i in range(result.get_count()):
item = result[i]
attr = item.get_attribute("raytrace_offset")
ix.cmds.SetValues([str(attr)], ["0.5"]) # replace 0.5 by your value. Even if it's an interger, the value have to be a string

Hope this helps, cheers
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 101
Joined: Mon Sep 26, 2016 11:44 am


Return to Scripting