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

    Default for program-created UI element

    SDK Help
    0
    3
    526
    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 02/12/2003 at 17:35, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.207 
      Platform:   Windows  ; Mac  ;  
      Language(s) :     C++  ;

      ---------

      Hi,

      I'm creating some UI elements for my plugin programmatically in [NodeData::]GetDDescription(). Everything works fine except the element defaults (using DESC_DEFAULT), which don't seem to be recognised.

      Maybe I'm trying to use DESC_DEFAULT wrongly. What is it supposed to do? How else can one specify defaults for UI elements?

      Unfortunately, I don't know which elements I will be creating until *after* [NodeData::]Read() has been called, so I can't initialise them in [NodeData::]Init(), and I haven't been able to find a way to detect whether a parameter has already been set in GetDDescription().

      Is there a way to detect whether a parameter has already been set in GetDDescription()?

      Here's more-or-less what I'm currently doing in GetDDescription()

        
      Bool  
      MyPlugin::GetDDescription(GeListNode* node, Description* desc, LONG& flags)  
      {  
          if (!desc->LoadDescription(MY_PLUGIN_ID))  
              return false;  
          flags |= DESCFLAGS_DESC_LOADED;  
        
          LONG dtype = DA_LONG;  
          BaseContainer descbc = GetCustomDataTypeDefault(dtype);  
          String name = "my param name";  
          descbc.SetString(DESC_NAME, name);  
          descbc.SetString(DESC_SHORT_NAME, name);  
        
          // this seems to do nothing                                                   
          descbc.SetLong(DESC_DEFAULT, 2); // for eg                                    
        
          // etc for DESC_MIN, DESC_MAX, DESC_MINSLIDER, DESC_MAXSLIDER                 
          descbc.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_LONGSLIDER);  
          DescID descid(DescLevel(MY_PARAM_ID, dtype, MY_PLUGIN_ID));  
          if (!desc->SetParameter(descid, descbc, DescLevel(ID_OBJECTPROPERTIES)))  
              return false;  
        
          return SUPER::GetDDescription(node, desc, flags);  
      }  
      

      Thanks.

      .angus.
      PS: I've found that CUSTOMGUI_LONGSLIDER uses DESC_MIN and DESC_MAX, not DESC_SLIDERMIN and DESC_SLIDERMAX. Is this intentional?

      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 08/12/2003 at 05:44, xxxxxxxx wrote:

        Couldn't you provide a default value in GetDParameter()?

        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 08/12/2003 at 21:31, xxxxxxxx wrote:

          Mikael said:
          > Couldn't you provide a default value in getdparameter()?

          I hadn't known GetDParameter was an option... the doco for it is a little opaque to me! The only examples I can see for it are for using bitmaps. I've now done a couple of tests using GetDParameter but I can't see how I would use it to set a default.

          1. it doesn't appear to get called until the UI is exposed, which may happen *after* the parameters are queried

          2. no flags or other information appear to be set to indicate when a default should be provided (ie: how can I tell that the current value has not been set by reading from file or by the user?)

          3. if I set no flags, the value doesn't get set to the default. if I *do* set flags, (using either DESCFLAGS_PARAM_SET or GET), the value can't be changed from the default, and any other value (eg read from hyperfile) is overwritten.

          So all up, it's just as bad as trying to set the value to the default in GetDDescription.

          I still wonder what DESC_DEFAULT is there for, if it's not for setting the default value of a parameter.

          Here's more-or-less the code I tried for GetDParameter()

            
          Bool  
          MyPlugin::GetDParameter(GeListNode* node, const DescID& id, GeData& t_data,  
                                  LONG& flags)  
          {  
              const LONG MY_DEFAULT = 2; // for eg  
              switch (id[0].id)  
              {  
              case MY_PARAM:  
                  t_data = GeData(MY_DEFAULT);  
                  flags |= DESCFLAGS_PARAM_GET; // um...                                    
                  break;  
              }  
              return SUPER::GetDParameter(node, id, t_data, flags);  
          }  
          

          How does one know when a parameter needs to be set to the default?

          .angus.

          1 Reply Last reply Reply Quote 0
          • mikeudinM mikeudin referenced this topic on
          • First post
            Last post