null object, where, how?



  • On 08/09/2013 at 09:54, xxxxxxxx wrote:

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

    ---------
    hi there!

    i want to export "null objects" but can't find a constant for it like OBJECT_POLYGONOBJECT.
    when i GePrint the GetInfo() from a null object, i get a 1<<28, but also can't find a suitable
    define for it in the c++SDK. where is it?

    is it safe to use the 1<<28 or even go for the name including "null"?
    feels so dirty...

    now i have "forward-kinematics" with hierarchical poly-objects,
    but null-objetcs are so usefull for everything and i want them as parents
    for the SRT-matrices... dragging the other objects every time in/out would be painfull...



  • On 08/09/2013 at 10:05, xxxxxxxx wrote:

    Hi Sibu,

    it's not 1 << 28, I wonder how you come to this value? The actual plugin ID of a Null-Object is Onull
    or 5140 in integral form. OBJECT_POLYGONOBJECT also is not the ID of a Polygon-Object, it is a
    bitflag used for the registration of object plugins. The plugin ID of Cinema 4D's standart polygon
    object is Opolygon (or 5100 in integral form).

    Best regards,
    -Niklas



  • On 08/09/2013 at 10:11, xxxxxxxx wrote:

    hi niklas!

    well, i do this:

    if (o->GetInfo() & OBJECT_POLYGONOBJECT)
    and export my polyObjects.

    i want to do the same with null-objects.

    as said, when i GePrint the GetInfo from a null-object, i get 1<<28.



  • On 08/09/2013 at 10:48, xxxxxxxx wrote:

    Hi Sibu,

    oh I'm sorry, I confused the GetInfo() method. Well, yes the return of GetInfo() is expected. You
    should switch to using IsInstanceOf() and the Onull and Opolygon constants.

    if (o->IsInstanceOf(Opolygon)) {
        // ...
    }
    else if (o->IsInstanceOf(Onull)) {
        // ...
    }
    

    While the Opolygon constant represents the plugin ID of the standart Cinema 4D polygon object,
    it also represents the "class" of the object being capable of the polygon object interface and is
    actually equal to your method.

    Same goes for the Opoint constant. For example, you can check an FFD deformer for

    ffd->IsInstanceOf(Opoint)
    

    and it yields TRUE! However,

    ffd->GetType() == Opoint
    

    yields FALSE. It depends on your needs which way you choose. Either way, any object which
    returns TRUE on calling IsInstanceOf(Opolygon) can be cast to a PolygonObject* of the SDK.

    GetInfo() only returns the flags that have been passed to RegisterObjectPlugin(), specifieng
    fundamental properties of the plugin (does it generate geometry? does it deform geometry? is it a point object? etc.)

    Cheers,
    -Niklas



  • On 08/09/2013 at 11:08, xxxxxxxx wrote:

    thank you very much!

    thats what i was looking for, still new to the c4d-sdk, ofcourse i should check for IsInstanceOf...

    nochmal, vielen dank!
    bis demnäxt...


Log in to reply