Isotropix Forums

Python scripting within Clarisse?

Clarisse Scripting related topics

Re: Python scripting within Clarisse?

Unread postby Arvid » Tue Oct 08, 2013 1:36 pm

I see, I'll keep that in mind.

So, I was able to do what I wanted, which is awesome! Now I'd like to know if it's possible to duplicate existing objects and assign materials though scripting? Can't find anything for this in the helper namespace.

Also, is it possible to connect nodes this way, for example connect 100 different textures to 100 different standard materials?
Arvid
 
Posts: 191
Joined: Thu Jan 31, 2013 3:44 pm

Re: Python scripting within Clarisse?

Unread postby support_team » Tue Oct 08, 2013 2:05 pm

To set a texture, you can do:
Code: Select all
material.attrs.diffuse.attr.set_texture(your_texture_item)


To duplicate an object:
Code: Select all
# create an instance of the specified item in the context of the item
instance = item.get_context().add_instance(item)
# transform the new instance into a copy
instance.make_local()


Assigning material can be more complex. The easiest way is to assign the override material attribute.
Code: Select all
item.attrs.override_material = my_material


Assigning to individual shading group. You need to use the object module interface (The object class inherits from Geometry)
To check if it's a geometry:
Code: Select all
item.is_kindof("Geometry")

then you need to do:
Code: Select all
item.get_module().assign_material(my_material.get_module(), shading_group_index)

Look at ModuleGeometry methods in the SDK documentation
Isotropix
Support Team
User avatar
support_team
 
Posts: 1022
Joined: Thu Jan 31, 2013 11:10 am

Re: Python scripting within Clarisse?

Unread postby Arvid » Tue Oct 08, 2013 3:15 pm

Excellent! This should get me started :mrgreen:
Arvid
 
Posts: 191
Joined: Thu Jan 31, 2013 3:44 pm

Previous

Return to Scripting