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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Enable / Disable GUI from res file

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 508 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 19/09/2016 at 00:16, xxxxxxxx wrote:

      Hi All,

      I'm working on a plugin where i would like to enable/disable a piece of the gui generated by the .res file.
      Is there a way to do this?

      Thanx in advance

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

        On 19/09/2016 at 06:13, xxxxxxxx wrote:

        Hi,

        welcome to the Plugin Café forums 🙂

        From within a resource file this is not possible.

        Via code it is possible, but it depends whether you are working with a description or a dialog.

        For a description resource of a NodeData (and derived) or ToolData based plugin you need to implement GetDEnabling(). Check the Py-DoubleCircle or Py-DynamicParametersObject examples to see GetDEnabling() in action.

        In a GeDialog you use Enable(). See the Py-TextureBaker example.

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

          On 19/09/2016 at 09:09, xxxxxxxx wrote:

          Thanx Andreas,

          This is a real though one and if i should believe the forums i'm not the only one struggling with this problem :D.
          It is used in a python ObjectPlugin

          This is my code so far

          def GetDEnabling(self, node, id, t_data, flags, itemdesc) :
                data = node.GetDataInstance()
                  if data is None:
                      return
                  if data.GetBool(ONOFF_ENABLED) :

          My question is what should come next to gray out the item MY_SUBBOX

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

            On 19/09/2016 at 10:20, xxxxxxxx wrote:

            I know it's a tiny bit confusing, but did you look at the DoubleCircle example?  
            In your case

            ...
            if data.GetBool(ONOFF_ENABLED) :
            	if id[0].id == MY_SUBBOX:
            		return False
            

            would disable MY_SUBBOX if ONOFF_ENABLED, assuming you assigned its id properly.  I also gave you an example when you posted on the other cafe...

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

              On 20/09/2016 at 01:10, xxxxxxxx wrote:

              I saw your post on the other forum. I know it was the same question but this gives me the possibility to call you a hero twice 😉

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