Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to implement ConvertFromGv for general objects

    SDK Help
    0
    1
    128
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

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

      ---------
      Hello,

      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.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post