Getting/Setting Custom GUI elements



  • 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



  • 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 :/



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



  • 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



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



  • 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



  • 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



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



  • 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



  • 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 :/



  • 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



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



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

    ``

    ``



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


Log in to reply