Accessing UserData in "compound" objects...
-
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
-
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 -
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