Isotropix Forums

Get all geos from a context and get the shading groups

Clarisse Scripting related topics

Get all geos from a context and get the shading groups

Unread postby qinyao » Wed Jan 09, 2019 12:00 pm

Hi, great Clarisse team,

How can I get all geometries from a abc referenced context and get the shading groups of each geometry?
qinyao
 
Posts: 71
Joined: Fri Aug 26, 2016 11:29 am

Re: Get all geos from a context and get the shading groups

Unread postby bvaldes » Wed Jan 09, 2019 2:59 pm

Hi

Take a look to the following code:

python code

context = ix.get_item("project://scene/context") # The context whenre you want to looking for


objects_array = ix.api.OfObjectArray(context.get_object_count()) # Grab all the items in the context and put it in the array
context.get_objects(objects_array)# An array that will contain the content of the context

# Look at all the items in the context with the for loop
for j in range(objects_array.get_count()):
item = objects_array[j]
print item
# Only geometry have shading groups so you just want to affect Geometries objects
if item.is_kindof("Geometry"):
for i in range(item.get_module().get_shading_group_count()):
print " " + item.get_module().get_shading_group(i)

I hope this is enough, feel free to ask if you need more help.
Regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 337
Joined: Mon Sep 26, 2016 10:44 am

Re: Get all geos from a context and get the shading groups

Unread postby qinyao » Thu Jan 10, 2019 2:35 am

cool, thank you!
qinyao
 
Posts: 71
Joined: Fri Aug 26, 2016 11:29 am

Re: Get all geos from a context and get the shading groups

Unread postby qinyao » Thu Jan 10, 2019 9:25 am

BTW, how tho make my GuiWindow always on the top of the application.
qinyao
 
Posts: 71
Joined: Fri Aug 26, 2016 11:29 am

Re: Get all geos from a context and get the shading groups

Unread postby guillaume » Fri Jan 11, 2019 2:13 pm

Hi,

qinyao wrote:BTW, how tho make my GuiWindow always on the top of the application.


You have to parent your new window to the application window, like this:

python code

clarisse_win = ix.application.get_event_window()
window = MyWindow(clarisse_win, x, y, width, height)
Regards
Guillaume
Isotropix
R&D Engineer
User avatar
guillaume
 
Posts: 140
Joined: Fri Feb 01, 2013 12:14 pm

Re: Get all geos from a context and get the shading groups

Unread postby qinyao » Sat Jan 12, 2019 2:40 pm

wow, it works, thank you!
qinyao
 
Posts: 71
Joined: Fri Aug 26, 2016 11:29 am


Return to Scripting