Page 1 of 1

Get all attribute of any object except Hidden & Private ones

Unread postPosted: Wed Oct 21, 2020 8:12 am
by vishumish
Hi,

I want to query only those attributes which are editable by the user. I think listing all the attributes which are visible in the attribute editor is the way to go. And to do that I have to filter out OfAttr.FLAG_HIDDEN & OfAttr.FLAG_PRIVATE from all the attributes.

Can someone please tell me a way to do that? I couldn't find any way to filter certain attributes or is there any other way to list all the "user editable" attributes?

Following is a snippet for your reference :

python code

item = ix.get_item("project://camera/top")
for i in range(item.get_attribute_count()):
attr = item.get_attribute(i)
print attr.get_full_name(), attr.FLAG_HIDDEN


I want a way to either add mask on item.get_attribute_count(mask) method to exclude certain attributes or a way to check True or False state of attr.FLAG_HIDDEN in a condition?

Re: Get all attribute of any object except Hidden & Private

Unread postPosted: Thu Oct 22, 2020 9:36 am
by anemoff
Hi,

You can simply use the following OfAttr methods:
- is_hidden()
- is_private()

These methods are helpers that check the presence of FLAG_HIDDEN and FLAG_PRIVATE.

Cheers,

Re: Get all attribute of any object except Hidden & Private

Unread postPosted: Thu Oct 22, 2020 2:55 pm
by vishumish
oh, that's so ignorant of me.. thanks anemoff :)