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
    • Recent
    • Tags
    • Users
    • Login

    User Data in C++

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 574 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 27/12/2008 at 08:58, xxxxxxxx wrote:

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

      ---------
             Hi!

      How do I receive the values of userdatas. I found some snippets here in the forum, but the most code snippets iterates through the user datas, but thats not what I want.

      I know the exact id of the element and want to receive the value. Can anyone of you check my code?

      > \>                DynamicDescription\* dd = ot->GetDynamicDescription(); #ot is the BaseList2D object \>                DescID id(DescLevel(first_id)), DescLevel(second_id)); \>                const BaseContainer \*t = dd->Find(id); \>                if(t) #is TRUE \>                { \>                     if(!ot->GetParameter(id, data, 0)) #GetParameter returns False... Why? \>                          GePrint("failed"); \>                } \>

      Thank you very much 🙂

      bye.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 05/01/2009 at 08:08, xxxxxxxx wrote:

        The creation of your DescID is wrong. You have to make sure the type of the DescLevel is set correctly. Here an example for a Real type userdata with the ID of 1:

        > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      BaseObject \*op = NULL; \>      op = doc->GetActiveObject(); \>      if(!op) return TRUE; \> \>      DynamicDescription \*dd = NULL; \>      dd = op->GetDynamicDescription(); \> \>      if(dd) \>      { \>           const DescID id(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(1, DTYPE_REAL, 0)); \> \>           GeData d; \> \>           if(op->GetParameter(id, d, 0)) \>           { \>                GePrint("success "+RealToString(d.GetReal())); \>           } \>      } \> \>      return TRUE; \> } \>

        cheers,
        Matthias

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 05/01/2009 at 08:21, xxxxxxxx wrote:

          Thank you, Matthias. That will help me.

          bye

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 19/01/2009 at 00:53, xxxxxxxx wrote:

            Matthias, you wrote:

            const DescID id(DescLevel(ID_userdata, DTYPE_SUBCONTAINER, 0), DescLevel(1, DTYPE_REAL, 0));

            But what if I don't know that the element is of type Real? I just tried '0' but that did not work.

            Any suggestions? Thanks.

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 19/01/2009 at 02:21, xxxxxxxx wrote:

              You can browse the Userdata:

              > \> void \*handle; \>      if (dd)     handle = dd->BrowseInit(); \>      if (handle) \>      { \>           DescID descId; \>           const BaseContainer\* bc; \>            \>           while (dd->BrowseGetNext(handle, &descId;, &bc;)) \>           { \>                GeData data; \>                op->GetParameter(descId, data, 0); \>                GeDataType type = data->GetType(); //retrieving the type \>           } \>           dd->BrowseFree(handle); \>            \>            \>      } \> \>

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 19/01/2009 at 05:45, xxxxxxxx wrote:

                Hi!

                A combination of your solution and the solution of Matthias would be cool.

                Not to browse through the userdatas and the condition I don't know the type of the element.

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