Access to Object Properties
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/10/2006 at 04:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R9.507
Platform: Windows ;
Language(s) : C++ ;---------
Helloi created a Command Plugin with an execute funtion, that creates some primitives. I am already able to access some properties like position, scale or rotation. Now i want to modify the object parameters like radius, height or orientation. Can someone describe if and how it's possible to do that?
Thanks a lot for helping me
PS: This is an extract of my plugin:
Bool CC_0::Execute (BaseDocument* doc)
{
BaseObject *op_0, *op_tube;
Vector pos_tube (0,0,0), scl (1,1,-1), rot (0,pi/2,0);//Nullobject
op_0 = BaseObject::Alloc(Onull);
doc->InsertObject(op_0,NULL,NULL);
//Tube
op_tube = BaseObject::Alloc(Otube);
op_tube->InsertUnder(op_0);
op_tube->SetPos(pos_tube);
op_tube->SetScale(scl);
op_tube->SetRot(rot);
EventAdd();return TRUE;
} -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/10/2006 at 05:19, xxxxxxxx wrote:
Since these parameters show in the Attributes Manager, they are in the object's BaseContainer as Description Resources:
BaseContainer* bc = op_tube->GetDataInstance();
Now, what to look for is the tricky part (for novices). In this case, you need to go to the 'resource/modules/objects/res/description' folder and find the .res file for the primitive object (Otube.res, for instance). These are the object's attributes - showing the type and id for each attribute (e.g.) :
REAL PRIM_TUBE_IRAD
You can get and set these attributes using the BaseContainer methods (e.g.) :
Real myRad = 2.0;
bc->SetReal(PRIM_TUBE_IRAD, myrad);
myRad = bc->GetReal(PRIM_TUBE_IRAD); -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/10/2006 at 05:59, xxxxxxxx wrote:
Thanks a lot. This solved my problem.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/10/2006 at 06:45, xxxxxxxx wrote:
Ok that works. The only thing i can't edit is the orientation. In otube.res it is included:
INCLUDE Oprimitiveaxis;
Default orientation is +Y but i need -Y. I can change it by modifiing the rotation of the object but then i change the orientation of my co-ordinate system too. So it would be better to change only the orientation of the object.
Thanks for your help
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/10/2006 at 08:18, xxxxxxxx wrote:
Oprimitiveaxis is a reference to another resource file. In it you will find the type/id and the settings (for the drop down list).