Getting/Setting Custom GUI elements



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

    On 12/03/2011 at 13:44, xxxxxxxx wrote:

    The answer to your questions depends heavily on which method (dialog or description) you decide to use.  That's why I asked if you were making a plugin or not.

    You said you're building a plugin using ResEdit GUI items. That's a description based GUI..Not a dialog based GUI.
    And if you are using a description based GUI. You don't create a dialog class for those GUI items.
    Instead you use Init, Message, and Execute functions that work in conjunction with the main class that is set to something like class: MyTag(plugins.TagData) : or  MyObject(plugins.ObjectData) :.

    A dialog based GUI is a completely different animal. So it has to be one or the other. Not both.
    -If you decide to use dialogs and dialog classes. Then *.res & *.h files isn't an option anymore.
    -If you decide to use descriptions. Then using the dialog class isn't an option anymore.

    AFAIK. You can't mix a dialog class GUI with the description based ResEdit GUI file structure.
    You have to make a choice.

    -ScottA



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

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

    Ok, so then since I'm using ResEdit, it's description based. Does that mean I don't use the GeDialog class? Under which class are the Init, Message, and Execute Functions?

    I'm afraid I'm fairly new at this. Does this mean I don't use the Command Function from the GeDialog class? Because up until this little snag everything was working just fine in terms of my interface doing things I tell it to when i click buttons and such.

    The Back story is that this is a plugin, initially I was creating all of the gui stuff by hand, before I tried ResEdit. So I had a class that was running Create Layout and such(I still am actually), anywho, It's a plugin doing an async dialog. The idea is this plugin when opened, you could dock it somewhere and have it available the whole time. Most of the other stuff is working aside from some undo support, but I just am not sure how to add an object into that link slot.



  • 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



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



  • 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