User Data [SOLVED]



  • On 02/09/2015 at 11:22, xxxxxxxx wrote:

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

    ---------
    Hi,

    I'm looking for a clean example or some directions on how to add user data in c++.

    I'm really confused, since I saw a part of an example where that person uses a BaseContainer to store the settings, but if you want to set the user data it must be of type void*.

    Could somebody help me with this?

    Thanks in advance for your help and time!



  • On 03/09/2015 at 02:30, xxxxxxxx wrote:

    Hello,

    this is a simple example that creates a userdata group with a string parameter:

      
    // This example adds a group and a child string user data parameter to the active object.  
      
    BaseObject* op = doc->GetActiveObject();  
    if(!op)  
     return false;  
      
    DynamicDescription* ddesc = op->GetDynamicDescription();  
    if(!ddesc)  
     return false;  
      
    DescID groupID;  
      
    {  
     // make group  
     BaseContainer bc = GetCustomDataTypeDefault(DTYPE_GROUP);  
      
     bc.SetString(DESC_NAME, "Group");  
     bc.SetInt32(DESC_COLUMNS, 1);  
     bc.SetInt32(DESC_DEFAULT, 1);  
     bc.SetInt32(DESC_SCALEH, 1);  
      
     groupID = ddesc->Alloc(bc);  
    }  
      
    {  
     // make string parameter  
     BaseContainer bc = GetCustomDataTypeDefault(DTYPE_STRING);  
     bc.SetString(DESC_NAME, "Text 1");          
     bc.SetInt32(DESC_SCALEH, 1);  
      
     // set group as parent  
     bc.SetData(DESC_PARENTGROUP, GeData(CUSTOMDATATYPE_DESCID,groupID));  
        
      ddesc->Alloc(bc);  
    }  
      
    EventAdd();  
    

    I wouldn't know when a void pointer should be used. What example did you see?

    Best wishes,
    Sebastian



  • On 03/09/2015 at 03:03, xxxxxxxx wrote:

    Hi Sebastian,

    Thanks for your answer!

    I saw a python example, called Boids4Py, but it didn't help me that much.

    And well, doesn't the parameter in SetUserData have to be a void pointer?



  • On 03/09/2015 at 03:14, xxxxxxxx wrote:

    Hi,

    It is still not working.

    I really have no idea what I need to fix it.



  • On 03/09/2015 at 03:22, xxxxxxxx wrote:

    Hi,

    I didn't need a group user data, so I've changed it to the stuff I need, and it worked...

    Here is my code:

      
    DynamicDescription* ddesc = myObject->GetDynamicDescription();  
    if (!ddesc) return false;  
    DescID userDataID;  
    BaseContainer bc = GetCustomDataTypeDefault(DTYPE_REAL);  
    bc.SetString(DESC_NAME, "Left_Point");  
    bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_REAL);  
    bc.SetBool(DESC_MINEX, false);  
    bc.SetBool(DESC_MAXEX, false);  
    userDataID = ddesc->Alloc(bc);  
    EventAdd();  
    

    Thanks for setting me upon the right path!! :)



  • On 03/09/2015 at 03:31, xxxxxxxx wrote:

    Hi,

    One more thing though,

      
    bc.SetBool(DESC_MINEX, true);  
    

    seems to do the same as:

      
    bc.SetBool(DESC_MINEX, false);  
    

    I basically want to disable minimum and maximum values.
    Any thoughts on this?

    Thanks in advance for your help and time!



  • On 03/09/2015 at 05:30, xxxxxxxx wrote:

    Hi,

    I have to note that I changed

      
    bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_REAL);  
    // To:  
    bc.SetInt32(DESC_UNIT, DESC_UNIT_FLOAT);  
    

    Yet, the DESC_MINEX/MAXEX are still not working.



  • On 03/09/2015 at 09:49, xxxxxxxx wrote:

    Hello,

    DESC_MINEX and DESC_MAXEX seem to work fine here. Please notice that these description options only apply to float parameters. The limitation is applied with floating point precision, so when your value range is 0 to 100 the possible values are limited to 0.0001 to 99.9999. The precision of the GUI elements is limited so they may round the values.

    Best wishes,
    Sebastian



  • On 03/09/2015 at 09:56, xxxxxxxx wrote:

    Hi Sebastian,

    It seems like I was looking for the wrong stuff.

    What I want is to disable the minimum and maximum value.

    Is that possible?

    Thanks in advance for your help and time!



  • On 04/09/2015 at 00:18, xxxxxxxx wrote:

    Hello,

    what exactly do you mean with "disable the minimum and maximum value"? You don't have to set these values.

    Best wishes,
    Sebastian



  • On 04/09/2015 at 01:27, xxxxxxxx wrote:

    Hi Sebastian,

    Well, if you create user data of data type float, you get two checkboxes (Limit Min/Limit Max) who are enabled by default. I simply want to disable them...



  • On 04/09/2015 at 09:43, xxxxxxxx wrote:

    Hello,

    it seems that these check boxes are enabled by default, so I think you can simply ignore them.

    Best wishes,
    Sebastian



  • On 04/09/2015 at 11:09, xxxxxxxx wrote:

    Hi Sebastian,

    Well, I want them to be disabled :p

    Is there any way to do that?



  • On 07/09/2015 at 00:23, xxxxxxxx wrote:

    Hello,

    as said before, it looks like that these checkboxes are enabled by default, independent of any settings. So it seems it is not possible to disable them using the parameter description.

    Best wishes,
    Sebastian



  • On 07/09/2015 at 01:38, xxxxxxxx wrote:

    Hi Sebastian,

    Sorry, but in my opinion, that wasn't clear to me.
    First, you said I can simply ignore them, the other time you say it's not possible to do;

    Anyways, it's clear now, thanks for your answer!!


Log in to reply