Api for changing the preferences of an object ?
Hello,
I have read the python bindings (Core, Utils), but could not find a way to set up the color or other properties of an object on the UI. Is that possible?
Thanks Endre
Yes, indeed! When it comes to preferences, that usually suggests that it is a 'registry' rather than an 'attribute'. The main advantage of this separation is that you keep all purely visual features in one place, while the ones that actually gives to the semantics of the model among the attributes. Another hint is the actual name of the feature shown in the property editor. For example, color of the node should be simply 'color' but you can also change the 'textColor' and the 'borderColor' if you would like (to set, use the 'set_registry' function). I do not know from the top of my head what is the usual format we use for these color, but you can set it on the UI and just print it from your plugin (Probably hex values representing RGB).
Hope this helps, Let me know if you have further questions!
Hello,
core.set_registry(TestItem, 'color', 0xFF0000)
this did not work. Any idea? Thanks Endre
On 13 Jul 2020, at 18:14, Tamas Kecskes [email protected] wrote:
Yes, indeed! When it comes to preferences, that usually suggests that it is a 'registry' rather than an 'attribute'. The main advantage of this separation is that you keep all purely visual features in one place, while the ones that actually gives to the semantics of the model among the attributes. Another hint is the actual name of the feature shown in the property editor. For example, color of the node should be simply 'color' but you can also change the 'textColor' and the 'borderColor' if you would like (to set, use the 'set_registry' function). I do not know from the top of my head what is the usual format we use for these color, but you can set it on the UI and just print it from your plugin (Probably hex values representing RGB).
Hope this helps, Let me know if you have further questions!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/webgme/webgme/issues/1705#issuecomment-657653161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQAXYJK6J6K4VZBZ6ZQGLULR3MXHFANCNFSM4OYQRTOA.
Hey, sorry for the late response. So apparently, we store the color values as string (that way you not only able to set values like #FF0000, but things like 'red'). Other than that, just make sure to call the save function so that your changes are stored.
hope this helps! br, Tamas
setPreferences (color, “#FF0000”) worked Thanks, Endre
On 19 Jul 2020, at 16:30, Tamas Kecskes [email protected] wrote:
Hey, sorry for the late response. So apparently, we store the color values as string (that way you not only able to set values like #FF0000, but things like 'red'). Other than that, just make sure to call the save function so that your changes are stored.
hope this helps! br, Tamas
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/webgme/webgme/issues/1705#issuecomment-660653126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQAXYJPFRYV2LW3J767OSYDR4L7QPANCNFSM4OYQRTOA.