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

    Getting/Setting Custom GUI elements

    PYTHON Development
    0
    23
    17.5k
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 12/03/2011 at 15:56, xxxxxxxx wrote:

      The SDK has some examples in it that use descriptions. To see how it's done.
      But from what you've said so far it sounds like you're making a menu plugin.  And if you want my opinion. I would say it's probably smartest to stick to using the gui.GeDialog class for a menu plugin. And forget about using ResEdit for this.....At least for now.
      Description based GUI's are mostly used with tag and object creation plugins.

      I think you should probably concentrate on the original problem. Which is inserting an object into a link field. But I haven't seen enough of your code to offer any more advice on that problem.
      Is there any chance you can post more of it to get a better idea of what's going on?

      Keep in my..I'm probably as new at this stuff as you are. So I don't even know if I can help. But someone else here probably could, if we have more code to work with.
      When you said you were trying combine ResEdit stuff with dialog based gizmos. I was just wondering what the heck you were trying to do. 🙂

      -ScottA

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 14/03/2011 at 10:51, xxxxxxxx wrote:

        You've got it backwards Scott - ResEdit only works with the dialog resource syntax for plugins. It doesn't work with the description resource syntax for tags & objects.

        To modify the linkbox customgui (in dialog resource syntax) you need to use c4d.gui.LinkBoxCustomGui. Unfortunately FindCustomGui seems to be missing from R12, so I think you'll have to flush the group containing the linkbox and add the customgui manually in CreateLayout so you have an instance of it accessible from the class.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 14/03/2011 at 11:07, xxxxxxxx wrote:

          Doh!
          Sorry about that. My memory is very bad these days.

          -ScottA

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 16/03/2011 at 21:16, xxxxxxxx wrote:

            Follow up question:

            So I've properly flushed the group, so now I'm stuck on trying to add the link slot to the group.

            So I tried:

            linkslot=self.AddCustomGui(9999, PLUGIN_ID, "Shot Cam Slot", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0)

            Now, the  two questions I have are:

            1. it does ask for a plugin id, do they mean the group's id or my actual plugin ID?
            2. It also optionally asks for a basecontainer. I'm assuming this BaseContainer is where I specify that I'm using a link slot, but I don't really understand how I do that.

            So I am confused how to create a reference of a link slot to be able to use it. It's much easier to make the link slot in resedit, but I can't reference it with FindCustomGUI or anything 😕

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 16/03/2011 at 21:57, xxxxxxxx wrote:

              One last question:

              How does one reference the object in his c4d_symbols.h file by name? So instead of using 10000 or 10030 I could use things like KEY_BUTTON_5 or KEY_BUTTON_10?

              I thought I could just do c4d.KEY_BUTTON_5 but it doesn't work.

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 16/03/2011 at 22:48, xxxxxxxx wrote:

                I don't know how to add or initialise CustomGui elements, so I'm very interested, too.

                I'm not sure, but there's a difference in Descriprions and Dialogs, so that you may can only use the constant in "c4d.MYCONSTANT" format in descriptions, else without "c4d."

                Cheers, nux

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 17/03/2011 at 03:54, xxxxxxxx wrote:

                  Originally posted by xxxxxxxx

                  Follow up question:
                  So I've properly flushed the group, so now I'm stuck on trying to add the link slot to the group.
                  So I tried:
                  linkslot=self.AddCustomGui(9999, PLUGIN_ID, "Shot Cam Slot", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0)
                  Now, the  two questions I have are:

                  1. it does ask for a plugin id, do they mean the group's id or my actual plugin ID?

                  Custom GUI elements are also registered plugin elements in CINEMA 4D so if you want to create a custom GUI element you need to pass the ID of the control ( e.g: c4d.CUSTOMGUI_LINKBOX)

                  Originally posted by xxxxxxxx

                  2. It also optionally asks for a basecontainer. I'm assuming this BaseContainer is where I specify that I'm using a link slot, but I don't really understand how I do that.

                  The container can be used to pass parameters to the custom GUI element (e.g: LINKBOX_HIDE_ICON(Bool), LINKBOX_LAYERMODE(Bool),...)

                  As nux95 and ScottA already wrote, Descriptions!=GeDialog. AddCustomGui is a member of GeDialog and cannot be used to create descriptions for your tag, object, ... plugin.

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 17/03/2011 at 08:05, xxxxxxxx wrote:

                    Just out of curiosity.
                    Is there some special reason why you need to use a LINKBOX?
                    In all of the dialog based examples I've seen. They use a text box to produce the same drag&drop behavior as the Description based LINK type of GUI.

                    There's an example of this in the Coffee SDK called "GUIdemo.cof" that sounds like what you're trying to do.
                    It's in the general_docs_plugins/Example Files section.

                    -ScottA

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 17/03/2011 at 15:15, xxxxxxxx wrote:

                      I still don't understand how to add a custom gui element. I knoe the functionAddCustomGui(), but where do I define what kind of custom gui ?

                      Thanks, Niklas

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 17/03/2011 at 15:30, xxxxxxxx wrote:

                        The second argument in AddCustomGui(...) is used to define the type of the customgui.

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 17/03/2011 at 15:40, xxxxxxxx wrote:

                          But that's the plugin id ? Or is it just wrong documented ?
                          What Id's to overload here?

                          Thanks, Niklas

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

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 30/03/2011 at 07:23, xxxxxxxx wrote:

                            I've read through all posts but I still don't understand how to GET the object that's dragged into the link box.

                            I am using

                            msg.GetLink(ID_OF_CUSTOM_GUI_LINKBOX)
                            

                            in my dialog's

                            Command(id, msg=None)
                            

                            method but it always results in returning None even though I just dragged a cube object into the link.

                            EDIT:

                            Error message is:

                            AttributeError: 'Py2dSnapDialog' object has no attribute 'GetLink'
                            

                            if I use

                            self.GetLink(...)
                            

                            instead.

                            And what's the deal with class c4d.gui.LinkBoxGui?
                            So GetLink is defined both on that class and on BaseContainer?

                            This is getting abit frustrating... it was for a plugin that I wanted to put up as open source example 😕

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

                              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                              On 30/03/2011 at 08:44, xxxxxxxx wrote:

                              I would like to see a simple working example of this too.

                              -ScottA

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

                                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                On 30/03/2011 at 09:31, xxxxxxxx wrote:

                                Even just a little confirmation if its working only for object and tag plugins or for dialog (menu command) plugins as well would be super sweet. Then I could stop putting time in it (and start looking for an alternative).

                                As of now I have only seen object and tag based .pype plugins with a working link field and I know Python itself rather well (if I do say so myself). I went through the complete inheritance diagram and searched every nook and cranny.

                                Hm, or maybe its only working with some form of drag data? In other languages and APIs it is often done like that.

                                EDIT: I'm giving up for now. It's just not possible at the moment. Pity, the pick whip select would have made it far superior.

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

                                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                  On 31/03/2011 at 22:21, xxxxxxxx wrote:

                                  A couple things I have learned(and just made it back to here) :

                                  The CUSTOMGUI pluginids I think can be found in the coffeesymbols.h file. You should see stuff like

                                  CUSTOMGUI_LINKBOX=1009415,
                                  CUSTOMGUI_INLINE=300001044,

                                  Ok, so as for a working linkbox example: I can only provide based off of what I did with ResEdit.

                                  So like Rick said, because FindCustomGui doesn't exist, I have to manually create a linkbox.

                                  So first I had to flush the group containing the linkbox via ``GeDialog.LayoutFlushGroup().
                                  So I did the followiing:

                                  self.LayoutFlushGroup(10042)
                                        self.linkslot=self.AddCustomGui(9999, c4d.CUSTOMGUI_LINKBOX, "Shot Cam Slot", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0)
                                        self.LayoutChanged(10042)

                                  ``This gave me a variable that was c4d.gui.LinkBoxCustomGui. This gave me the ability to do this in my Command function:

                                  if id==10044:
                                            Cam=CreateShotCam()
                                            print "Cam is: " + str(Cam)
                                            self.linkslot.SetLink(Cam)

                                  Hope this helps.

                                  ``

                                  ``

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

                                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                    On 03/04/2011 at 14:12, xxxxxxxx wrote:

                                    Yes, this helps a lot. Thanks.

                                    I'm not there yet, but this is definately worth trying.

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