Different behavior on Mac for Commanddata options



  • 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)
    


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



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



  • 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



  • @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



  • 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


Log in to reply