How to get attributes that are dictionaries?
How can I get an attribute that is stored as a dictionary?
I have a panel. After lots of careful tweaking I got a color that's very pleasing to me. I want to use that color elsewhere in my patch. I figured I would use [getattr] to get the 4 value list that I could pass around to anything else that I wanted to match to that color. But [getattr] doesn't output anything. If I use the inspector to "create a message box with this attribute's current value" I get "bgfillcolor dictionary."
Okay, so panel colors are stored as dictionaries. I read a bit about dictionaries. Dictionaries look neat! I thought maybe if I hook up a [dict.view] to [getattr] I'd be able to see the attributes values. But alas, it still is empty.
So... the question remains? How can I get the values of attributes that are stored as dictionaries?
I know there are ways, for example I could open the patch as a text file and find the values that ways. But if I want to manage these attributes programmatically I need to be able to get them within the program.
Thanks for any tips.
Yes, I also experienced the same as you are describing. It is impossible with the [getattr] object to query the color attribute of the [panel] object when in "Color Fill" mode.
You may fill a feature request with C74, however I believe there is no immediate workaround for this.
Still not possible. The multi views of [attrui] shows only one value.
Workaround is the [colorpicker] and use the dropper but that is a manual non programmatically way.
Applause! Though I do think Cycling should include these properties in the [attrui] object.
yes wonderful, theAttr.getkeys() in the code of 11Olsen.
is there also a chance to set such an attribute?
d = object.getattr("bgfillcolor");
d.set("angle", 12.);
object.setattr("bgfillcolor",d);
was a try, but results in the error "jsobject: bad number"
Maybe the last dot in theAttr.set("angle", 12.)
is too much. For me it works:
let TFL be thanked !
works great
a follow up:
why is this not working?
well, this is working...