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

    Seeking AM CustomGui help/example

    SDK Help
    0
    27
    15.6k
    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

      On 11/09/2013 at 03:16, xxxxxxxx wrote:

      Hi Folks,

      just a quick follow-up for this, everything is going well, except I'm needing to refresh/redraw the userarea associated with the customgui when I change a description cycle. Currently I have to initiate a redraw by re-clicking in the userarea. But I'd like an auto-update.

      I've tried things like the below:

        
      ListCustomData:: // any custom function here   
      ListCustomGui::CustomGuiRedraw();   
      MyDescriptionUA::Redraw();   
      MyDescriptionUA::LayoutChanged()   
      

      but all give me compile errors concerning illegal calls of non-static member function. Should I be redrawing/recalling the tool's GetDDesription() or refreshing the AM somehow?

      What's the correct way to go about this?

      WP.

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

        On 11/09/2013 at 09:47, xxxxxxxx wrote:

        Hi WickedP,

        From when and where exactly do you need the refresh? The methods you have listed are member
        methods, you should call them on instances of the class, like

        class MyCustomGui : public iCustomGui {
          
            MyDescriptionUA m_ua;
          
        public:
          
            //| iCustomGui Overrides
          
            void CustomGuiRedraw() {
                m_ua.Redraw();
            }
          
            // ...
          
        };
        

        This by the way is the exact thing you should do when creating an iCustomGui subclass. The documentation
        contains this information:

        Originally posted by xxxxxxxx

        virtual void CustomGuiRedraw()_<_h4_>_

        Called when the GUI is redrawn. Use this to for example update your user areas.

        Best,
        -Niklas

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

          On 11/09/2013 at 16:09, xxxxxxxx wrote:

          Hi there Niklas,

          I'm calling this from my tool plugin's SetDParameter() - so that when my cycle element changes it's id, an update is triggered on the userarea to redraw itself.

          I thought it would have something to do with calling them on an instance, but the userarea is instanced in the icustomgui and not the tool plugin's class - so I couldn't work out how that was done. The customgui plugin itself is inserted via the tool's GetDDescription() using the customgui's plugin id. How do I make a call to the customgui element if the userarea is not instanced in the tool plugin's class itself?

            
          // Registered customgui plugin:   
            
          class MyCustomUA : public GeUserArea   
          {   
              //functions etc..   
          }   
            
          class MyCustomGui : public iCustomGui   
          {   
              MyCustomUA MCU;   
              // functions etc.. including the following   
              void CustomGuiRedraw()   
              {   
                  MCY.Redraw()   
              }   
          }   
            
          class MyCustomData : public CustomGuiData   
          {   
              // functions etc..   
          }   
            
          // Registered tool plugin:   
            
          class MyTool : public DescriptionToolData   
          {   
              // functions etc.. no instances to the customgui is used anywhere,   
              // the only reference to the customgui at all is in the description below   
              GetDDescription(doc, data, description, flags)   
              {   
                  .....   
                  cid = DescLevel(ID_HOME_GROUP_CUSTOMGUI, DTYPE_LONG, 0);   
                  if(!id_Home || cid.IsPartOf(*id_Home,NULL))   
                  {   
                      BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG);   
                   bc.SetLong(DESC_CUSTOMGUI,ID_MY_CUSTOMGUI); // registered plugin   
                   bc.SetBool(DESC_GROUPSCALEV, TRUE);   
                   bc.SetBool(DESC_GUIOPEN, TRUE);   
                   bc.SetLong(DESC_SCALEH, TRUE);   
                   bc.SetString(DESC_NAME, "");   
                      bc.SetString(DESC_SHORT_NAME, "");   
                      if(!description->SetParameter(cid, bc, DescLevel(ID_HOME_GROUP_CUSTOMGUI_GROUP))) return TRUE;   
                  }          
                  return SUPER::GetDDescription(doc, data, description, flags);   
              }   
          }   
          

          WP.

          P.s. on a slightly different note, I've been meaning to send you a PM sometime too regarding a topic here from some time a go. I'll try whizzing one over in the next few weeks, hope that is o.k.

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

            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

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

              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.

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

                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

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

                  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.

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

                    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 <[URL-REMOVED]>

                    That might explain why SetData() is not called.

                    Best,
                    -Niklas


                    [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

                      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.

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

                        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

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