On 09/09/2014 at 14:01, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I have not used the VolumeData class very much. And I don't really understand in what context where are supposed to use it in (tool plugins, videoPostdata plugins, etc...)?
I'm not really sure how to use it in general.
Here is an example using the VD class in a CommandData plugin.
But some of the functions don't work. And I'm thinking that's because I'm using it in the wrong kind of plugin.
Bool SimplePlugin::Execute(BaseDocument *doc)
{
//This code block works
VolumeData *vd = VolumeData::Alloc();
BaseDraw *bd = doc->GetRenderBaseDraw();
BaseObject *camera = bd?bd->GetSceneCamera(doc) :NULL; //Gets the active camera and assigns it to the variable "camera"
RenderData *rdata = doc->GetActiveRenderData(); //Gets the render settings
LONG x = 0;
LONG y = 0;
Ray ray;
Vector campos = camera->GetAbsPos();
vd->AttachVolumeDataFake(camera,*rdata->GetDataInstance());
vd->GetRay(x,y,&ray);
GePrint(RealToString(ray.v.x)+String(" ")+RealToString(ray.v.y)+String(" ")+RealToString(ray.v.z));//Prints the rotation value of the active camera
GePrint(RealToString(vd->CameraToScreen(campos).y)); //Prints the active camera's y screen position
//This code does not work
LONG objCount = vd->GetObjCount();
GePrint(LongToString(objCount)); //<---Always returns 0 :-{
RayObject *rayObj = vd->GetObj(1);
BaseObject *obj = (BaseObject * )rayObj; //Crashes!
GePrint(obj->GetName());
VolumeData::Free(vd);
EventAdd();
return TRUE;
}
What if I wanted to use the GetObj() method. What kind of plugin do I use for that to work?
What is all the ray stuff in that class for? Camera rays, Rendering rays?
-ScottA