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

    Document scale always returns 1

    SDK Help
    0
    2
    189
    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 05/02/2014 at 07:59, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13,14,15 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi, if I insert a primitive cube in a document, it defaults to a certain size.
      If I then scale up the document by a factor of 10, then insert a new cube, this new cube is 10 times smaller.

      What I need is to detect the scale of this C4D "world", because I want so scale up a newly created object, so that it visually has the same size, regardless of the C4D "world scale".

      This code is totally useless:

         BaseContainer* bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);
         UnitScaleData* usd = (UnitScaleData* )bc->GetCustomDataType(DOCUMENT_DOCUNIT, CUSTOMDATATYPE_UNITSCALE);
         Real docScale = 0;
         DOCUMENT_UNIT docunit = 0;
         usd->GetUnitScale(docScale, docunit);
      

      It is useless because docScale always == 1. I scale up the document ten times. Still returns 1.
      How can I get hold of the scale of the C4D world for the current document? So that I can use this value to scale the objects I programmatically insert into C4D?

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

        On 05/02/2014 at 08:11, xxxxxxxx wrote:

        Ok folks,
        I found the solution myself.
        And instead of deleting my post, I will give you the solution here, in case someone else might need it:

           BaseSceneHook* baseSceneHook = doc->FindSceneHook(180000100);
           GeData geData;
           baseSceneHook->GetParameter(DescID(10001), geData, DESCFLAGS_GET_0);    
           Real scale = geData.GetReal();
        

        The number 10001 = WORLD_SCALE
        I have no idea where the number 180000100 comes from. I just found this brilliant post by Scott in this forum:
        https://developers.maxon.net/forum/topic/5774

        It is a super thread, I have bookmarked it!
        Thanks to Scott for this!!

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