Maxon Developers
    • Downloads
      • All Downloads
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
      • Cinema 4D Python Examples
      • Cinema 4D C++ Examples
      • Project Tool
      • SDK Database
    • Documentation
      • Cinema 4D Python SDK
      • Cinema 4D C++ SDK
      • Cineware SDK
      • ZBrush GoZ SDK
    • Forum
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Forums
      • Overview
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • News & Information
      • Downloads
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Can't convert internal units to document units

    SDK Help
    0
    3
    115
    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

      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!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 04/09/2011 at 10:35, xxxxxxxx wrote:

        OK, I was unclear on the concept...

        This worked:

        const UnitScaleData *docScaleData = (const UnitScaleData* )doc->GetDataInstance()->GetCustomDataType(DOCUMENT_DOCUNIT,CUSTOMDATATYPE_UNITSCALE);
        AutoAlloc<UnitScaleData> internalScaleData;
        internalScaleData->SetUnitScale(1.0, DOCUMENT_UNIT_CM);
        Real scale = CalculateTranslationScale(docScaleData, internalScaleData);

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 12/09/2011 at 02:42, xxxxxxxx wrote:

          Is this working for you now?

          cheers,
          Matthias

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