Seeking AM CustomGui help/example



  • On 12/09/2013 at 05:41, xxxxxxxx wrote:

    Hi WP,

    do you redraw the UserArea on iCustomGui::SetData()?

    If it's not something you can ask in the forum, go ahead and contact me via PM.

    Cheers,
    -Niklas



  • On 12/09/2013 at 06:58, xxxxxxxx wrote:

    Oooo no, I've missed that function.. I may have even removed it at one stage..

    Is this what I'm needing? Can this be called without an instance? Below are the functions used in my iCustomGui thus far:

      
    class MyCustomGui : public iCustomGui   
    {   
        typedef iCustomGui super;   
      
    private:   
      
        LONG Height;   
        MyUserArea UserArea; // instance of GeUserArea   
      
    public:   
      
        MyCustomGui(const BaseContainer& settings, CUSTOMGUIPLUGIN* plug) : super(settings, plug);   
        virtual LONG CustomGuiWidth();   
        virtual LONG CustomGuiHeight();   
        virtual void CustomGuiRedraw();   
        virtual Bool CreateLayout();   
        virtual Bool InitValues();   
        virtual Bool Command(LONG id, const BaseContainer& msg);   
        virtual LONG Message(const BaseContainer& msg, BaseContainer& result);   
    };   
    

    WP.



  • On 13/09/2013 at 13:37, xxxxxxxx wrote:

    Hi WP,

    well the SetData() method is called to give you the data you should display in your custom GUI. It is
    called when the data was changed and the AM is updated (for instance). You need to redraw your
    user-area(s) from this method, CustomGuiRedraw() is not called automatically afterwards.

    Simply do

    UserArea.Redraw();

    from MyCustomGui::SetData().

    -Niklas



  • On 24/09/2013 at 03:31, xxxxxxxx wrote:

    Ok, I've stumped myself on this one. I can't get SetData() to call, or any auto-refreshing of the user area happening. I've tried my own custom functions and sending messages... and I just can't seem to get it to work without having to click in the user area itself in the attributes manager. Come to think of it, I don't think SetData() is even called when I 'load' the tool plugin.

    So, bare bones question - how do I refresh a customgui element in the AM (one that incorporates a GeUserArea)?

    WP.



  • On 24/09/2013 at 04:25, xxxxxxxx wrote:

    Have you registered a fake library for your CustomGuiData plugin as described in the documentation?

    See the CustomGuiData class on http://www.maxonexchange.de/sdk/CINEMA4DSDK/index.html

    That might explain why SetData() is not called.

    Best,
    -Niklas



  • On 24/09/2013 at 05:04, xxxxxxxx wrote:

    Hi Niklas,

    yep, I have. I played around with a few flags (and no flags) in the RegisterCustomGuiPlugin() to no avail.

    I've done some more looking over the posted examples, and I notice there's some custom functions which I haven't incorporated. I thought this was to do with sending data to the GeUserArea, but as I'm using separate structs to house necessary data I didn't think I'd need them. Could that be what I'm needing?

    Examples (I don't have these anywhere) :

      
    static Bool SendValueChanged(iCustomGui* dlg, BaseContainer msg) {   
        msg.SetLong(BFM_ACTION_ID, dlg->GetId());   
        msg.RemoveData(BFM_ACTION_VALUE);   
        msg.SetData(BFM_ACTION_VALUE, dlg->GetData().GetValue());   
        return dlg->SendParentMessage(msg);   
    }   
      
    static Bool InvokeCommandCall(GeDialog* dialog, LONG id) {   
        BaseContainer actionmsg(BFM_ACTION), actionresult;   
        actionmsg.SetLong(BFM_ACTION_ID, id);   
        return dialog->Message(actionmsg, actionresult);   
    }   
      
    

    WP.



  • On 26/09/2013 at 04:59, xxxxxxxx wrote:

    The functions you have quoted are from my TriState Custom GUI example code and are not part
    of the Cinema 4D SDK. View the code on github.

    Without seeing your full code, I can only tell you to skim the examples you have available and look
    out for the issue. SetData() is called when set up correctly, but the issues can reside in very
    different locations, that is why snippets help certainly rare.

    Best,
    -Niklas


Log in to reply