Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Different behavior on Mac for Commanddata options

    Cinema 4D SDK
    r23 python
    3
    6
    662
    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.
    • P
      pim
      last edited by

      I have a commanddata plugin that has options enabled using the PLUGINFLAG_COMMAND_OPTION_DIALOG flag.
      On the pc everything is ok, I see the option icon in the command and I can select it.
      However, on the mac (Catalina 10.15.6) I do not see the option icon and when I click the command (the commanddata plugin), it goes directly to ExecuteOptionID() and not to Execute()

      Here the stripped code

      import c4d
      import os
      import sys
      from c4d import gui, plugins, bitmaps, documents
      from c4d import utils
      
      
      PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT = 1039980 
      
              
      class MyOptionsDialogSUBSTRACT(gui.GeDialog):
          OK = False
          
          def InitValues(self): 
              return True
              
          def CreateLayout(self):
       
              self.SetTitle("MeshBoolean Command SUBSTRACT Test 01")        
              self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)  
              
              return True
              
          def Command(self, id, msg):
       
              if (id == 1):   
                  self.OK = True
                  self.Close()
                  
              if (id == 2):   
                  self.OK = False
                  self.Close()
                  
              return True
                     
      class MESHBOOLEANSUBSTRACT(plugins.CommandData):
      
          dialog = None
      
          def Execute(self, doc):
              print ("Execute")
              print ("Done test")
              return True         #end plugin
      
          def ExecuteOptionID(self, doc, plugid, subid):
              print ("ExecuteOptionID")
              
              if self.dialog is None: self.dialog = MyOptionsDialogSUBSTRACT()
              self.dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL, pluginid=PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT, defaultw=500, defaulth=120)
              
              print ("OK: ", self.dialog.OK)
              if (self.dialog.OK):
                  self.Execute(doc) 
                  self.dialog.OK = False
              return True
      
      if __name__ == "__main__":
              
          pluginString = "MeshBoolean Command Subtract"    
          bmp = bitmaps.BaseBitmap()
          dir, file = os.path.split(__file__)
          fn = os.path.join(dir, "res", "command subtract.png")
          bmp.InitWith(fn)
          
          okyn = plugins.RegisterCommandPlugin(id=PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT, str="#$1 " + pluginString, info=c4d.PLUGINFLAG_COMMAND_OPTION_DIALOG, help="MeshBoolean Command", dat=MESHBOOLEANSUBSTRACT(), icon=bmp) 
          if (not okyn): 
              print("Error initializing " + pluginString)
      
      1 Reply Last reply Reply Quote 0
      • P
        pim
        last edited by

        What I also notice, is that - on the mac - when I do a customize command and add the plugin as an icon to my interface, the option icon is there and it works like expected.

        1 Reply Last reply Reply Quote 0
        • C4DSC
          C4DS
          last edited by C4DS

          I guess you encounter the same issue as mentioned here.

          Short answer:
          When the window has it's own menu then the option's cog wheel should work as expected.
          Not so if it is the Finder's main menu.

          Which also explains why dropping an icon in the interface does work as expected. As the issue seems to be the main menu in Finder.

          1 Reply Last reply Reply Quote 1
          • ManuelM
            Manuel
            last edited by

            hi,

            thanks for linking the other thread and yes, that's the difference with the mac menu on the osx bar.
            On those menu we can't add the cogwheel so we choose to display the option by default (with was the old behaviors)

            cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            P 1 Reply Last reply Reply Quote 0
            • P
              pim @Manuel
              last edited by

              @m_magalhaes said in Different behavior on Mac for Commanddata options:

              hi,

              thanks for linking the other thread and yes, that's the difference with the mac menu on the osx bar.
              On those menu we can't add the cogwheel so we choose to display the option by default (with was the old behaviors)

              cheers,
              Manuel

              Ok, clear.
              Please mention it in the documentation.

              -Pim

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                hi
                That's already mentioned in our application documentation.

                https://help.maxon.net/us/index.html#PREFSINTERFACE-PREF_INTERFACE_MAIN_GROUP

                Where do you think we should mention it ?

                Cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

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