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:
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?
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;
BaseObject *parent = op;
parent = op;
DynamicDescription *userdata = NULL;
userdata = parent->GetDynamicDescription();
void *handle = NULL;
handle = userdata->BrowseInit();
LONG cnt = 0;
const BaseContainer *data = NULL;
while (userdata->BrowseGetNext(handle, &descid, &data))
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();
On 24/03/2010 at 06:00, xxxxxxxx wrote:
The link to the object wasn't the issue, but op->GetCacheParent().