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

    Accessing UserData in "compound" objects...

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 290 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 22/03/2010 at 10:10, xxxxxxxx wrote:

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

      ---------
      I'm reading userData from objects in a shader. This works fine for polygonal objects and spheres, but fails for most parametric objects like for Cylinder/Capsules/etc.

      vd->op->link is simply nil in those cases, probably as the hit surface is created just before rendering.

      Is there any way to access the objet that belongs to that surface?

      Thanks

      Kabe

      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 24/03/2010 at 03:43, xxxxxxxx wrote:

        Sorry, I can't confirm. How do you obtain the link to the object?

        Something like this works for me

          
        Vector MandelbrotData::Output(PluginShader *chn, ChannelData *cd)  
        {  
          if (cd->vd && cd->vd->op)  
          {  
              BaseObject *op = NULL;  
              op = cd->vd->op->link;  
          
              if (op)  
              {  
                  BaseObject *parent = op;  
          
                  while (op)  
                  {  
                      parent = op;  
          
                      DynamicDescription *userdata = NULL;  
                      userdata = parent->GetDynamicDescription();  
                      if (userdata)  
                      {  
                          void *handle = NULL;  
                          handle = userdata->BrowseInit();  
          
                          LONG cnt = 0;  
                          DescID descid;  
                          const BaseContainer *data = NULL;  
          
                          while (userdata->BrowseGetNext(handle, &descid, &data))  
                          {  
                              cnt++;  
                          }  
          
                          userdata->BrowseFree(handle);  
                            
                          //userdata found  
                          if (cnt > 0) return 1.0;  
                      }  
          
                      //step up the cache hierarchy until userdata or the end of the cache hierarchy has been found  
                      op = op->GetCacheParent();  
                  }  
          
              }  
          }  
          
          return 0.0;  
        }  
        

        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 24/03/2010 at 06:00, xxxxxxxx wrote:

          Thanks Matthias!

          The link to the object wasn't the issue, but op->GetCacheParent().

          Cheers

          Kabe

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