Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Getting user data

    SDK Help
    0
    3
    345
    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 08/12/2016 at 09:26, xxxxxxxx wrote:

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

      ---------
      Ok, I am lost on how to get the userdata of an object.
      I am trying to get userdata # 11 (float) and userdata #30(gradient).
      The float seems to work, but when I try to do the same for the gradient, it fails.

      The compiler tells me 'udEntry': redefinition; multiple initialization.

      Here is the code.

      Int32 gizmo;
      GeData d;
        
      BaseObject* c4domeObj = GetActiveDocument()->SearchObject("obj with userdata");
      if (!c4domeObj) return FALSE;
      DynamicDescription *dd = obj->GetDynamicDescription();
      if(!dd) return FALSE; 
        
        
      gizmo = 11;			//brightness
      DescID udEntry(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(gizmo));
      obj->GetParameter(udEntry, d, DESCFLAGS_GET_0);
      GePrint("Brightness: " + String::FloatToString(d.GetFloat()));
        
      //get the gradient custom data
      gizmo = 30;			//gradient
      DescID udEntry(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(gizmo));
      obj->GetParameter(udEntry, d, DESCFLAGS_GET_0);
      Gradient* gd = (Gradient* )d.GetCustomDataType(CUSTOMDATATYPE_GRADIENT);
        
      Int32 kcnt = gd->GetKnotCount();
      

      It feels, I do not completely understand what is going on.

      Is there not a simple routine to readthe user data for a specific number?

      -Pim

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

        On 09/12/2016 at 05:09, xxxxxxxx wrote:

        I solved it by looking for the name instead of the id using BrowseGetNext.

        -Pim

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

          On 09/12/2016 at 05:15, xxxxxxxx wrote:

          Hi Pim,

          the issue has nothing to do with userdata. It's actually as the compiler says, you defined the variable udEntry twice.

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