THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/09/2008 at 19:17, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.1
Platform: Windows ; Mac ;
Language(s) : C++ ;
---------
Hi, me again ;-)
I want a channelshader to get access to the object it's attached to (yes I read this thread).
Using a plugin object, I have written some values in the objects' container. Like this:
> obj->GetDataInstance()->SetReal(OBJ_MYSECRETOFFSET, Offset);
In the ChannelShader, I try to retrieve the values like this:
> Vector MyFunnyChannelshader::Output(PluginShader \*chn, ChannelData \*cd) \> { \> RayObject \*robj = NULL; \> BaseObject \*op; \> LONG local_id = 0; \> robj = cd->vd->ID_to_Obj(cd->vd->lhit, &local;\_id); \> op = robj->link; \> \> // Print object's name and the stored value \> GePrint(op->GetName() + ": " + RealToString(op->GetDataInstance()->GetReal(OBJ_MYSECRETOFFSET, 0.0))); \> \> return Vector(1.0, 0.0, 1.0); // Return some dummy color \> }
The object's name is printed out fine while rendering, but the retrieved value is always 0. Also, the "op" pointer in MyFunnyChannelshader::Output points to different addresses than the "obj" pointer in the first code. It seems, all objects are copied for rendering; even when rendering in the editor?
This is my first approach to a channel shader, so go easy on me ;-)
I'd be happy about any tips or hints. How can I put values into the objects that I can retrieve in my shader?
Greetings,
Jack