Isotropix Forums

Querying if an attribute is localized

Clarisse Scripting related topics

Querying if an attribute is localized

Unread postby alexey » Fri Jun 05, 2020 1:32 am

Hello,
I am trying to find a way to check if an attribute is localized on an instance object. I can't find any API method so far. Currently, I am comparing attribute values on the source and instance objects, but it doesn't look convenient.

Did I miss something in methods, or I have to query an attribute flag somehow?

Thank you in advance,
Alexey
alexey
 
Posts: 8
Joined: Fri Jun 05, 2020 1:11 am

Re: Querying if an attribute is localized

Unread postby anemoff » Fri Jun 05, 2020 9:20 am

Hi,

Simply use "is_local()" on the attribute.

python code

attr = ix.get_item("path/to/object").get_attribute("some_attribute")
print attr.is_local()


See https://www.clarissewiki.com/4.0/sdk/class_of_attr.html

Cheers,
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 367
Joined: Wed Jan 13, 2016 10:10 am

Re: Querying if an attribute is localized

Unread postby alexey » Fri Jun 05, 2020 1:26 pm

Thank you, Anthony!

Definitely, it is simple. Yesterday I was confused by this method because it shows True for all modified attributes of a source object. But now it makes sense because it returns True if "its value is not inherited from a source attribute". I have to call the is_local() method only for attributes of my instances. Thank you!

Regards,
Alexey
alexey
 
Posts: 8
Joined: Fri Jun 05, 2020 1:11 am

Re: Querying if an attribute is localized

Unread postby anemoff » Fri Jun 05, 2020 3:39 pm

Yes, that's right!

Cheers,
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 367
Joined: Wed Jan 13, 2016 10:10 am


Return to Scripting