How to implement ConvertFromGv for general objects

  • On 30/05/2013 at 05:19, xxxxxxxx wrote:

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


    I'm trying to make my custom data type and want to convert a general object (ID_GV_VALUE_TYPE_GENERAL_OBJECT) to the my type. I'm following the example of cinema4dsdk sample project, but I'm getting an AccessViolation crash in ConvertFromGv method.

    The example in cinema4dsdk defines a magic structure GvObject and uses it to cast the src parameter of ConvertFromGv method. This is the code:

    struct GvObject
      BaseList2D*    object;
      LONG                type;

    virtual GvError ConvertFromGv(LONG type,const void *const src,LONG cpu_id,CustomDataType *dst)
          iExampleDataType *d = (iExampleDataType* )dst;
          switch (type)
              case 400006000: // ID_GV_VALUE_TYPE_GENERAL_OBJECT
                      GvObject *s = &((GvObject* )src)[cpu_id];
                      if (s->object) d->sdata = s->object->GetName();
                      else d->sdata = "<<no object>>";

    d->ldata = -1;

    return GV_CALC_ERR_NONE;                   

    It seems that this is not the right structure of the src void pointer.
    Does anybody know what is the structure of the src pointer in case of ID_GV_VALUE_TYPE_GENERAL_OBJECT type (for Cinema4D R13 version)?

    Thank you.

Log in to reply