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

    CommandData plugin with a res dialog

    Cinema 4D SDK
    python r20
    4
    11
    1.7k
    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.
    • M
      mp5gosu
      last edited by mp5gosu

      In Short: You can't.
      Long story:
      Afaik CommandData plugins don't have an interface per se. They are literally just commands.
      But there are several ways to get around that.
      You need at least a NodeData plugin or anything that derives from that. (a scene hook for example), or even a dummy object, or a tool.

      Another option would be to call a Dialog (Dialogs don't have descriptions, but layouts - you can load it with a DescriptionCustomGui however.)

      May I ask what exactly you want to do, so we can point you in the right direction?

      1 Reply Last reply Reply Quote 0
      • R
        rui_mac
        last edited by

        I just want to create a plugin that, when executed from the Plugin menu would show a few parameters in the Attribute Manager.
        One of the gizmos would be a button that, when pressed, would execute the code, using the data in the parameters.
        I know how to do all that for tag and object plugins.
        Would I have to create a Tool plugin for that?

        rsodreR 1 Reply Last reply Reply Quote 0
        • rsodreR
          rsodre @rui_mac
          last edited by

          @rui_mac Sounds like you need a GeDialog with a CommandData.

          1 Reply Last reply Reply Quote 0
          • R
            rui_mac
            last edited by

            But, will it appear in the Attribute Manager? Or in a floating dialog?

            1 Reply Last reply Reply Quote 0
            • R
              rui_mac
              last edited by

              In C++ I create a Tool plugin and it shows the parameters in the Attribute Manager, just the way I want it.
              Isn't it easy to do the same in python?

              1 Reply Last reply Reply Quote 0
              • M
                mp5gosu
                last edited by

                You can use a Tool plugin, of course. However, it seems a bit weird.
                I would go for a NodeData or ObjectData plugin as this would be the bare minimum and also does not show up in the recent tools list.
                The downside with NodeData plugins is, that by default, the do not belong to the document. That can be an advantage or disadvantage, depending on what your plugin should do.

                1 Reply Last reply Reply Quote 0
                • S
                  s_bach
                  last edited by

                  Hello,

                  as others have already pointed out, the typical way of presenting arbitrary functions to a user is to use a CommandData plugin that hosts and shows a floating GeDialog. Such a dialog can present any kind of information or interaction. If you want to, you can add this dialog to your layout as well.

                  As an example: You can open the "Character" -> "Manager" -> "Weight Manager". This dialog presents various gizmos including buttons to press. There is nothing wrong about that. Why do you think you need to present that in the Attribute Manager?

                  The Attribute Manger is used to present parameters of elements associated with the current document e.g. objects or tags or the specific settings of a tool stored within the document. The Attribute Manager is not an arbitrary canvas.

                  An example for a CommandData / GeDialog combination in Python is Py-MemoryViewer.pyp.
                  An example for a Python tool is Py-LiquidPainter.pyp.

                  best wishes,
                  Sebastian

                  MAXON SDK Specialist

                  Development Blog, MAXON Registered Developer

                  1 Reply Last reply Reply Quote 0
                  • R
                    rui_mac
                    last edited by

                    This plugin is a add-on to a set of plugins and all of them show stuff in the Attribute Manager.
                    One of them is a tag, another is a tool, another is a shader, etc...
                    It was just to keep a consistency.

                    1 Reply Last reply Reply Quote 0
                    • R
                      rui_mac
                      last edited by

                      But, assuming that I would go with the dialog way, do I need to create it in code, or can I load it from a res file?

                      1 Reply Last reply Reply Quote 0
                      • S
                        s_bach
                        last edited by

                        Hello,

                        yes, you can use resource files to define the dialog layout. Or combine layout files and code.

                        def CreateLayout(self):
                        
                          self.SetTitle("Dialog Test")
                        
                          # load dialog from resource file
                          if self.LoadDialogResource(10000, None, 0) == False:
                            return False
                        
                          # set a different title
                          self.SetTitle("New Title")
                        
                          # disable a GUI element
                          self.Enable(10001, False)
                        
                          return True
                        

                        See GeDialog Manual and Layout files.

                        best wishes,
                        Sebastian

                        MAXON SDK Specialist

                        Development Blog, MAXON Registered Developer

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