Problem by saving data

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

On 06/05/2009 at 06:34, xxxxxxxx wrote:

User Information:
Cinema 4D Version:    
Platform:      
Language(s) :

---------
Hello,

i have written own datatypes for points, lines, ngons and one which has arrays of three datatypes before as attributes.
Also i have written a "cubenode" and a generatorobject, that visualizes the geometry.
So far it works fine and if i add the object and the node in xpresso it works too.
If i want to save the cinemafile now, i get an BAD ACCESS because cinema calls the CopyData-function of the CustomDataTypes points, lines and ngons with values i can't explain to myself.

I don't understand why cinema calls the CopyData-functions if i want to save the data and the WriteData only for the points.
Tries cinema to write the data in its cache before it saves the data?
And how or rather where cinema gets the values, so that i can retrace where the values become wrong?

Thanks,

Oli

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

On 06/05/2009 at 08:38, xxxxxxxx wrote:

I have returned FALSE in the CopyData of the lines and ngons for debugging.
That's the reason why only WriteData of the points was called :-).

Ok cinema calls the CopyData first and then the WriteData, but i still don't know where/how cinema gets the values.

cheers,

Oli

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

On 06/05/2009 at 09:13, xxxxxxxx wrote:

Ok, i have found out, that cinema calls the WriteData of my geometrydatatype, which is a kind of container for the other three datatypes, first.
At this point all values are corrcet.
I believe the problem is ny reading out and convert the three arrays (points, lines, ngons).
For better understanding i post a snip of code.

> Bool AixGeometryClass::WriteData(const CustomDataType\* d, HyperFile\* hf){ \> \>      AixGeometry\* write = (AixGeometry\* ) d; \> \>      if(!write){ \>           return FALSE; \>      } \>       \>      //write data in Hyperfile \>      //write AixPoints \>      LONG pointCount = write->pointArraySize; \>       \>      hf->WriteLong(pointCount); \>       \>      for(LONG j = 0; j < pointCount; j++){ \>            \>           //cast to CustomDataType \>           const CustomDataType pointToWrite = (CustomDataType) write->pointArray[j]; \>            \>           //GeData as container \>           GeData pointData; \>            \>           pointData.SetCustomDataType(CUSTOMDATATYPE_AIXPOINT, pointToWrite); \>            \>           hf->WriteGeData(pointData); \>      } \>      //the same with the other two arrays \>

Any ideas?

Thanks,

Oli

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

On 07/05/2009 at 03:48, xxxxxxxx wrote:

I got it :-).

Cinema calls the CopyData of every Datatype when i cast them to CustomDataType.

I had to write the cast to CustomDataType as follows

> const CustomDataType* pointToWrite = (CustomDataType* ) &write-;>pointArray[j];

and

> pointData.SetCustomDataType(CUSTOMDATATYPE_AIXPOINT, *pointToWrite);

Then i get the correct values and it works.

cheers,

Oli

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

On 07/05/2009 at 06:35, xxxxxxxx wrote:

Sometimes those monologues can be quite fruitful.

I didn't tknow much about that topic, but now I have learned something from your experience, too ;-)

Greetings,
Jack