THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/02/2011 at 13:52, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hey everyone. I have a question regarding the draw function of a tag plugin.
with my tag plugin I am trying to draw a circle around an object that the user has placed in to a link field in the tag attributes. When the user places any object in the link field, I want my tag to draw a circle around it. here is the code I am using.
BaseContainer* bc = tag->GetDataInstance();
if(!bc) return FALSE;
BaseDocument *doc = bh->GetDocument();
if (!doc) return FALSE;
objectToOrbit = bc->GetObjectLink(ORBIT_OBJECT_TO_ORBIT, doc);
if (!objectToOrbit) return FALSE;
Real position = bc->GetReal(ORBIT_POSITION);
/**** DRAW THE ORBIT PATH ****/
Matrix m;
Real rx = bc->GetReal(ORBIT_RADIUS_X);
Real ry = bc->GetReal(ORBIT_RADIUS_Y);
m.off = objectToOrbit->GetRelPos();
if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_X){
m.v1 = Vector(0, rx, 0);
m.v2 = Vector(0, 0, ry);
op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(0, rx, ry) * position));
}
if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_Y){
m.v1 = Vector(rx, 0, 0);
m.v2 = Vector(0, 0, ry);
op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(rx, 0, ry) * position));
}
if(bc->GetLong(ORBIT_AXIS) == ORBIT_AXIS_Z){
m.v1 = Vector(rx, 0, 0);
m.v2 = Vector(0, ry, 0);
op->SetRelPos(objectToOrbit->GetAbsPos() + objectToOrbit->GetRad() + (Vector(rx, ry, 0) * position));
}
bd->DrawCircle(m);
for some reason, instead of drawing the circle around the object in the link field, it is drawing the object around the object on which the tag is placed. That is not my desired result. Does anyone see a reason why this would be happening? Am I doing something wrong with the DrawCircle() function or the Matrix that is involved.
Thanks,
Shawn