Determining type of an object

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/08/2009 at 11:27, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R11 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
I know this has been asked several times, and I've searched the forum for explanations, but I'm still confused. It's so easy in COFFEE but how to do it in C++?

Specifically, I want to determine if an object in the scene is a point object. According to the SDK, I should be able to do:

if(obj->GetInfo() & OBJECT_POINTOBJECT) ...

but it won't compile, in that OBJECT_POINTOBJECT is undefined. Where in the API is this (and the other OBJECT_ constants) defined? I can't find them anywhere. Or am I misinterpreting the SDK (more than likely!)?

Thanks,
Steve

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/08/2009 at 12:37, xxxxxxxx wrote:

if (obj->IsInstanceOf(Opoint)) ...

Except for Splines, this works for everything (tags, materials, objects, ...). Most of the available IDs are in the SDK docs.

For Splines, use:

if (obj->GetInfo()&OBJECT;_ISSPLINE) ...

To use IsInstanceOf() with your own plugin classes, use the unique Plugin ID in place of something like 'Opoint' and add this to the top of your class definition:

class MyObject : public ObjectData
{
INSTANCEOF(MyObject,ObjectData)
...
};

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/08/2009 at 14:46, xxxxxxxx wrote:

Ah... thank you! I was obviously going wrong with GetInfo, IsInstanceOf does exactly what I need.

I'll be back when I hit another brick wall, many thanks in the meantime.