ReadVector() in object's Read()

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

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

---------
Hi Folks,

in my object plugin I'm now going through the motions of trying to save some of the variables etc used in the object's class. I use the Write() function to do the following:

  
//Just Fyi: there's a struct outside the class with a Vector in it, hence the VecStruct.MyVector[].   
  
  
    virtual Bool Write(GeListNode *node, HyperFile *hf)   
    {   
        hf->WriteVector(VecStruct.MyVector[1]);   
        return TRUE;   
    }   
  
// and in my read I use:   
  
    virtual Bool Read(GeListNode *node, HyperFile *hf, LONG Level)   
    {   
        hf->ReadVector(&VecStruct.MyVector;[1]);   
        return TRUE;   
    }   

But when I try to compile the above it gives me the following compile error:

"error C2664: 'HyperFile::ReadVector' : cannot convert parameter 1 from 'double *' to 'Vector *'"

Why am I unable to use the ReadVector() when using the WriteVector() to save it initially?

WP.

On 30/05/2013 at 07:29, xxxxxxxx wrote:

What is MyVector?  If it is a Real[3] then you are doing it incorrectly.  Make it a literal Vector member of the class. Or, at the least, enclose VecStruct.MyVector[1] in parentheses:

hf->ReadVector(&(VecStruct.MyVector[1]));

On 30/05/2013 at 17:39, xxxxxxxx wrote:

Eh. You're right. I should have looked at my Struct a little closer. I thought it was a Vector but it isn't, it's a vector of Reals.

Thanks Rob.

WP.