Revert to original widget color
-
On 05/07/2015 at 05:17, xxxxxxxx wrote:
When I override the default color for a color ID for a widget, how am I supposed to revert it to the
original color? Until now, I used GeDialog.GetColorRGB() to get the original color value, but that is
kind of clunky. -
On 05/07/2015 at 05:47, xxxxxxxx wrote:
del it
-
On 05/07/2015 at 06:16, xxxxxxxx wrote:
I should've been more clear, I'm talking about the color associated with color IDs for widgets in a GeDialog
plugin. I'm not sure how you understood my question. -
On 05/07/2015 at 06:32, xxxxxxxx wrote:
Argh, sorry
I reread initial post, "revert" seems for me as "invert" -
On 06/07/2015 at 03:33, xxxxxxxx wrote:
Hi Niklas,
Originally posted by xxxxxxxx
I should've been more clear, I'm talking about the color associated with color IDs for widgets in a GeDialog plugin.
Do you mean calling GeDialog.SetDefaultColor() with a custom color then calling it with a color from GeDialog.GetColorRGB()?
-
On 06/07/2015 at 07:09, xxxxxxxx wrote:
Hi Yannick,
yes it's possible with GeDialog.GetColorRGB(), but it's just so inconvenient. GeDialog.SetDefaultColor()
wants a color vector, but GetColorRGB() returns a dictionary with values in RGB space.def get_color(dlg, color_id) : col = dlg.GetColorRGB(color_id) return c4d.Vector(col['r'], col['g'], col['b']) * (1.0 / 255) if engine in SUPPORTED_RENDERERS: self.SetDefaultColor(res.STR_RENDERER, c4d.COLOR_TEXT, c4d.Vector(1.0, 0.2, 0.0)) else: self.SetDefaultColor(res.STR_RENDERER, c4d.COLOR_TEXT, get_color(self, c4d.COLOR_TEXT))
It would be nice if the SetDefaultColor() function would just accept None or the dialog would have a
function to get the color as a Vector already. This is just something that makes the programmers life
unpleasent and its only one part where I think things could be improved to make them easier. Passing
None would be logical, you could just pass None and if it works you're fine, but otherwise you have to
look into the SDK how to do it otherwise.Best regards,
Niklas -
On 07/07/2015 at 02:20, xxxxxxxx wrote:
Hi Niklas,
Thanks for your input. It will help us design better functions in the future.
But we can't change the behavior of existing functions as this would break plugins.