On 18/05/2013 at 08:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14 Stud
Platform: Windows ;
Language(s) : C++ ;
---------
I am rather new to C++, but not to programming, 15 years of assembler, Pascal and C#.
When trying to write plugins, there are a few fundamentals I have to learn and understand.
Take this:
BaseObject* op = bc->GetObjectLink(MYPLUGIN_LINK_SOURCE, doc);
I would now expect to have access to all BaseObject's methods and properties, and it looks like that too. So so far, so good. But the BaseObject can be a Cube, a Spline or a Joint.
So I write this:
CAJointObject* someJoint_a = (CAJointObject* )op;
CAJointObject* someJoint_b = static_cast<CAJointObject*>(op);
- When the linked object is a Joint, I would expect to have access to the Joint specific properties (and methods). But I don't see them when invoking Intellisense.
- But even more confusing - if the linked object is not a Joint , when doing this in C# or Pascal, my computer will snare, spit, catch fire and bombard me with nasty error messages "invalid typecast" and the like. But not here. In fact, the watch window claims the Type is CAJointObject, which it definitely not is, because I have linked in a Cube.
My challenge now, is to be able to work the way I am used to in object oriented programming, that is having objects inheriting other objects, and having access to their properties and methods in a "normal" object oriented way.
If someone could lead me in the right direction, it is very much appreciated!
-Ingvar