Isotropix Forums

Link attribute list

Clarisse Scripting related topics

Link attribute list

Unread postby xc278260759 » Mon Aug 13, 2018 2:15 pm

Image

Code: Select all
import ix
def xc_selNode_dependencies(search):
   
    obj = ix.get_item(search)
    obj_array = ix.api.OfItemArray(1)
    obj_array[0] = obj
    #
    print " -----------------------------------------------------------------"
    item_dependencies = ix.api.OfItemVector()
    ix.application.get_factory().get_items_dependencies(obj_array, item_dependencies, False)

    if (item_dependencies.get_count() > 0):
        print "item dependencies : {0}".format(item_dependencies.get_count())
        for i in range(0, item_dependencies.get_count()):
            print "- {0}".format(item_dependencies[i].get_full_name())
    # 输入
    item_inputs = ix.api.OfItemVector()
    ix.application.get_factory().get_items_inputs(obj_array, item_inputs, False)

    if (item_inputs.get_count() > 0):
        print "item inputs : {0}".format(item_inputs.get_count())
        for i in range(0, item_inputs.get_count()):
            print "- {0}".format(item_inputs[i].get_full_name())
    # 输出
    item_outputs = ix.api.OfItemVector()
    ix.application.get_factory().get_items_outputs(obj_array, item_outputs, False)

    if (item_outputs.get_count() > 0):
        print "item outputs : {0}".format(item_outputs.get_count())
        for i in range(0, item_outputs.get_count()):

            print "- {0}".format(item_outputs[i].get_full_name())

sel = ix.selection[0]
xc_selNode_dependencies(str(sel))
xc278260759
 
Posts: 24
Joined: Sat Aug 19, 2017 7:57 am

Re: Link attribute list

Unread postby bvaldes » Thu Aug 16, 2018 8:10 am

Hi,

There is no function to do that.
When you have the outputs items, look through all the attributes in the item, check if the attribute is textured and check if the texture correspond to the source item. That should do the tricks.
Some code example:

python code

item = ix.get_item("project://box")
# Work with all the attributes
for i in range(item.get_attribute_count()):
attr = item.get_attribute(i)
# check if the attr is texture
if attr.is_textured():
# get the texture
texture = attr.get_texture()
# now you can compare with your source item.
# You should convert to str to avoid type conflits:
# some functions gives you PyOfObjects, some OfObject so the == may not work
if str(texture) == str(sourceItem):
# now you can do what you want
print attr


Regards,
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 283
Joined: Mon Sep 26, 2016 10:44 am

Re: Link attribute list

Unread postby xc278260759 » Thu Aug 23, 2018 9:03 am

bvaldes wrote:Hi,

There is no function to do that.
When you have the outputs items, look through all the attributes in the item, check if the attribute is textured and check if the texture correspond to the source item. That should do the tricks.
Some code example:

python code

item = ix.get_item("project://box")
# Work with all the attributes
for i in range(item.get_attribute_count()):
attr = item.get_attribute(i)
# check if the attr is texture
if attr.is_textured():
# get the texture
texture = attr.get_texture()
# now you can compare with your source item.
# You should convert to str to avoid type conflits:
# some functions gives you PyOfObjects, some OfObject so the == may not work
if str(texture) == str(sourceItem):
# now you can do what you want
print attr


Regards,


Thanks for your reply.
xc278260759
 
Posts: 24
Joined: Sat Aug 19, 2017 7:57 am


Return to Scripting