Page 1 of 1

Attribute list enabling/disabling not working?

Unread postPosted: Wed Feb 19, 2020 4:46 pm
by briansilva
Hello! I have a file list attribute I'm trying to drive in Python, but the API for managing the enabled/disabled state doesn't seem to be working.

For example, I create a box and add a custom attribute to it:

python code

item = ix.get_item("project://scene/box")
attr_layers = item.add_attribute(

then add some values to it.

python code

ix.cmds.AddValues(["project://scene/box.layers"], ["c:/layer1"])
ix.cmds.AddValues(["project://scene/box.layers"], ["c:/layer2"])
ix.cmds.AddValues(["project://scene/box.layers"], ["c:/layer3"])

From then on, I can enable/disable the list items through the UI, but nothing in the Python API seems to work:

python code

ix.cmds.DisableAttributeValue(["project://scene/box.layers"], [1], False)  # does nothing

print item.get_attribute("layers").is_value_disabled(1) # always False (even after disabling through UI)
print item.get_attribute("layers").is_any_value_disabled() # always False
layers = ix.api.CoreStringArray()
item.get_attribute("layers").get_values(layers, ix.api.OfAttr.VALUE_PAGE_CURRENT, False) # always returns all items, despite setting consider_disabled to false
print list(layers)

Is this broken, or am I missing/misunderstanding something?

Thank you!

Re: Attribute list enabling/disabling not working?

Unread postPosted: Thu Feb 20, 2020 1:52 pm
by anemoff
This is a limitation of attributes of container type CONTAINER_LIST.
Currently, only types TYPE_OBJECT, TYPE_REFERENCE, and TYPE_STRING support enabling/disabling individual values in the list. For other types, changing the disabled status does nothing.

In your case, you can simply change TYPE_FILE to TYPE_STRING. Be sure to use one of the FILENAME visual hints otherwise the UI doesn't show the "eye" column to toggle the status (this is another limitation)


Re: Attribute list enabling/disabling not working?

Unread postPosted: Thu Feb 20, 2020 3:40 pm
by briansilva
Ah perfect, thank you! It works great now.