THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/09/2011 at 16:09, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12.032
Platform:
Language(s) : C++ ;
---------
Hi,
I have a plugin that writes a camera Matrix out to an XML file. I want to write the values in the same units as the user set for the document.
So I get the matrix:
Matrix world = cameraObj->GetMg();
And I get the document units:
const UnitScaleData *docScaleData = (const UnitScaleData* )doc->GetDataInstance()->GetCustomDataType(DOCUMENT_DOCUNIT,CUSTOMDATATYPE_UNITSCALE);
Then I get what I thought would be the conversion factor:
enum DOCUMENT_UNIT unit;
Real docScale = 1.0;
docScaleData->GetUnitScale(docScale, unit);
Aftre executing GetUnitScale, docScale is still set to 1.0.
When I examine the values returned from Mg, the position vector is in centimeters. I want to convert those values to DOCUNIT.
I'm doing something wrong, but it's unclear to me how best to proceed. Should I make the assumption that Cinema4D's internal units are Centimeters and set up my own conversion factors? Or is there another way to get the conversion factor from the internal units to the document units?
Thanks!