Isotropix Forums

Create, edit and assign AOV's

Clarisse Scripting related topics

Create, edit and assign AOV's

Unread postby daaims » Fri Feb 03, 2017 11:26 am

Hi,

I want to create a Layer in the "channel layer editor", edit it, and then add this new AOV to my 3DLayer. Unfortunatly, Clarisse do not log those steps so i'm lost in the middle of nowhere to do this with a script.

Any clue ?

Thank you ;)
User avatar
daaims
 
Posts: 431
Joined: Fri Mar 22, 2013 1:17 am

Re: Create, edit and assign AOV's

Unread postby fjutel » Mon Feb 06, 2017 1:13 pm

Hi Daims,

To create a new Layer you can use this code :

python code

def new_ch_aov(name_of_AOV):
aov_ch = str(name_of_AOV)

cm = ix.application.get_channel_manager()
index = cm.add_layer(aov_ch, ix.api.OfChannelManager.AOVBLENDINGMODE_BLEND)

# ImagePixel.BIT_DEPTH_16 == 2
# ImagePixel.BIT_TYPE_FLOAT == 2
cm.set_group_bit_format(index, 2, 2)

cm.set_channel(index, 'red', 0)
cm.set_channel(index, 'green', 1)
cm.set_channel(index, 'blue', 2)

# This is used to make sure they are arranged hierarchally
cm.set_group_separator(index, '_')

cm.set_layer_description(index, 'Layer description\nC')


To add an AOv in your layer3d, for example all Pbr AOV, you can use this code :

python code

def addAOVs(layer_3d, aovsToAdd):

aov_list = layer_3d.get_attribute("selected_aov_list")
enabled_aov_list = layer_3d.get_attribute("enabled_aov_list")
aov_blend_override_list = layer_3d.get_attribute("aov_blend_override_list")

for aovToAdd in aovsToAdd:
old_value_count = aov_list.get_value_count()
aov_list.set_value_count(old_value_count + 1)
aov_list.set_string(aovToAdd, old_value_count)

enabled_aov_list.set_value_count(old_value_count+1)
enabled_aov_list.set_bool(True, old_value_count)

aov_blend_override_list.set_value_count(old_value_count+1)
aov_blend_override_list.set_long(-1, old_value_count)

return

def addPhysicalAOVs():

aovsToAdd = [ 'rgba',
'coordinates',
'motion_vector',
'camera_normal',
'camera_position',
'depth',
'pbr_direct_diffuse_reflection',
'pbr_direct_diffuse_transmission',
'pbr_direct_glossy_reflection',
'pbr_direct_glossy_transmission',
'pbr_direct_specular_reflection',
'pbr_direct_spacular_transmission',
'pbr_direct_subsurface',
'pbr_direct_volume',
'pbr_indirect_diffuse_reflection',
'pbr_indirect_diffuse_transmission',
'pbr_indirect_glossy_reflection',
'pbr_indirect_glossy_transmission',
'pbr_indirect_specular_reflection',
'pbr_indirect_specular_transmission',
'pbr_indirect_subsurface',
'pbr_indirect_volume',
'pbr_emission',
'pbr_light_direction',
'pbr_light_radiance']
image = ix.selection[0]
layers = image.get_module().get_layers()
addAOVs(ix.get_item(layers[0].get_object().get_full_name()), aovsToAdd)

return
addPhysicalAOVs()


Cheers,
Florent Jutel
Isotropix
Clarisse QA
User avatar
fjutel
 
Posts: 264
Joined: Tue Jan 13, 2015 1:21 pm

Re: Create, edit and assign AOV's

Unread postby daaims » Mon Feb 06, 2017 1:25 pm

Thank you very much Flo'

Cheers ;)
User avatar
daaims
 
Posts: 431
Joined: Fri Mar 22, 2013 1:17 am

Re: Create, edit and assign AOV's

Unread postby anabil » Wed Mar 22, 2017 3:23 am

hey fjutel,

i tried your script in my existing clarisse scene and it gave me an error, i'm using clarisse SP3 and i don't know if that's the case or not!
i already have multiple images with multiple layers in it, should i change something in the script?

cheers.
anabil
 
Posts: 12
Joined: Tue Mar 21, 2017 11:51 am

Re: Create, edit and assign AOV's

Unread postby fjutel » Wed Mar 22, 2017 11:28 am

Hi anabil,

Yes, you need to modify the script if you have different layers in your image.

Here : addAOVs(ix.get_item(layers[0].get_object().get_full_name()), aovsToAdd) , you need to test if your layer is a 3D layer.

Hope this help.

Regards,
Florent Jutel
Isotropix
Clarisse QA
User avatar
fjutel
 
Posts: 264
Joined: Tue Jan 13, 2015 1:21 pm

Re: Create, edit and assign AOV's

Unread postby anabil » Thu Mar 23, 2017 7:50 am

yes it helped, thank you very much.
anabil
 
Posts: 12
Joined: Tue Mar 21, 2017 11:51 am


Return to Scripting