Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Revert to original widget color

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 552 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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. 😞

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 05/07/2015 at 05:47, xxxxxxxx wrote:

        del it

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 05/07/2015 at 06:32, xxxxxxxx wrote:

            Argh, sorry
            I reread  initial post, "revert" seems for me as "invert"

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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()?

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post