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 Project Settings

    SDK Help
    0
    5
    589
    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 09/06/2011 at 09:58, xxxxxxxx wrote:

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

      ---------
      Here is the list of all the project settings so users can quickly look them up if needed:

      //Reference files:  
      //DOCUMENTSETTINGS_GENERAL:General settings: See ddoc.h.  
      //DOCUMENTSETTINGS_MODELING:Modeler settings: See MDATA_Options and toolsnapping.h.  
      //DOCUMENTSETTINGS_TOOLS: See Tool settings  
        
        
        
        
      //// Scene Scale & Units optoptions  
        
      BaseContainer *bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);  
      UnitScaleData *usd = (UnitScaleData* )bc->GetCustomDataType(DOCUMENT_DOCUNIT, CUSTOMDATATYPE_UNITSCALE);  
      if (!usd) return FALSE;  
        
      usd->SetUnitScale(1.0, DOCUMENT_UNIT_CM);// SceneScale & Units options = DOCUMENT_UNIT_UNDEF, DOCUMENT_UNIT_KM, DOCUMENT_UNIT_M, DOCUMENT_UNIT_CM,  
                                             //DOCUMENT_UNIT_MM, DOCUMENT_UNIT_MICRO, DOCUMENT_UNIT_MILE, DOCUMENT_UNIT_YARD,DOCUMENT_UNIT_FOOT, DOCUMENT_UNIT_INCH  
      bc->SetData(DOCUMENT_DOCUNIT, GeData(CUSTOMDATATYPE_UNITSCALE, *usd));  
      doc->Message(MSG_UPDATE);                 
      EventAdd();  
        
        
        
      //// Project Settings  
        
      //First set up BaseTime so we can use it later on in the attributes  
      BaseTime time = doc->GetTime(); // assigns the basetime class to a variable  
      Real fps = doc->GetFps();       // Gets the frames per second value  
      Real frame = time.GetFrame(fps);// The current frame the slider is on  
        
      doc->SetParameter(DOCUMENT_FPS, GeData(30), DESCFLAGS_SET_0);               // Sets the FPS attribute  
      doc->SetParameter(DOCUMENT_TIME, GeData(BaseTime(0, fps)), DESCFLAGS_SET_0); // The frame where the scrubber starts   
      doc->SetParameter(DOCUMENT_MINTIME, GeData(BaseTime(0, fps)), DESCFLAGS_SET_0);//The start frame value   
      doc->SetParameter(DOCUMENT_MAXTIME, GeData(BaseTime(90, fps)), DESCFLAGS_SET_0);//The end Frame value   
      doc->SetParameter(DOCUMENT_LOOPMINTIME, GeData(BaseTime(0, fps)), DESCFLAGS_SET_0);//The Preview option Start time  
      doc->SetParameter(DOCUMENT_LOOPMAXTIME, GeData(BaseTime(90, fps)), DESCFLAGS_SET_0);//The Preview option End time  
      doc->SetParameter(DOCUMENT_LOD, GeData(1.0), DESCFLAGS_SET_0);            // Level of Detail          
      doc->SetParameter(DOCUMENT_RENDERLOD, GeData(FALSE), DESCFLAGS_SET_0);    // Render LOD in Editor  
      doc->SetParameter(DOCUMENT_USEANIMATION, GeData(TRUE), DESCFLAGS_SET_0);  // Use Animation  
      doc->SetParameter(DOCUMENT_USEEXPRESSIONS, GeData(TRUE), DESCFLAGS_SET_0);// Use Expressions  
      doc->SetParameter(DOCUMENT_USEGENERATORS, GeData(TRUE), DESCFLAGS_SET_0); // Use Generators  
      doc->SetParameter(DOCUMENT_USEDEFORMERS, GeData(TRUE), DESCFLAGS_SET_0);  // Use Deformers  
      doc->SetParameter(DOCUMENT_USEMOTIONSYSTEM, GeData(TRUE), DESCFLAGS_SET_0); // Use Motion System  
      doc->SetParameter(DOCUMENT_DEFAULTMATERIAL_TYPE, GeData(1), DESCFLAGS_SET_0);// 0=WHITE, 1=GREY-BLUE, 2=USER  
      doc->SetParameter(DOCUMENT_CLIPPING_PRESET, GeData(1), DESCFLAGS_SET_0); // 3=TINY, 0=SMALL, 1=MEDIUM, 2=LARGE, 4=HUGE, 5=CUSTOM  
      doc->SetParameter(DOCUMENT_CLIPPING_PRESET_NEAR, GeData(1.0), DESCFLAGS_SET_0); //Sets the Near clipping value  
      doc->SetParameter(DOCUMENT_CLIPPING_PRESET_FAR, GeData(100000.0), DESCFLAGS_SET_0); //Sets the Far clipping value  
      doc->SetParameter(DOCUMENT_LINEARWORKFLOW, GeData(TRUE), DESCFLAGS_SET_0); // Use Linear Workflow  
      doc->SetParameter(DOCUMENT_COLORPROFILE, GeData(1), DESCFLAGS_SET_0);//  0=SRGB, 1=LINEAR, 2=DISABLED;  
      EventAdd();  
        
        
        
        
      ///// Info Settings  
        
      doc->SetParameter(DOCUMENT_INFO_AUTHOR, GeData(""), DESCFLAGS_SET_0);    //Type your name in here  
      doc->SetParameter(DOCUMENT_INFO_COPYRIGHT, GeData(""), DESCFLAGS_SET_0); //Type your copyright info here  
      doc->SetParameter(DOCUMENT_INFO_README, GeData(""), DESCFLAGS_SET_0);   // Type your notes here  
      EventAdd();  
        
        
        
        
        
      //// Dynamics Settings  
      //Make sure to use this include:  
      #include "../../modules/dynamics2/res/description/dynworldobject.h"  
        
       //GENERAL  
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      sh->SetParameter(DescID(WORLD_ENABLED), GeData(TRUE), DESCFLAGS_SET_0);            // Enabled  
      sh->SetParameter(DescID(WORLD_DISABLE_DURING_LEAP), GeData(TRUE), DESCFLAGS_SET_0);// Disable on Skip Frame  
      sh->SetParameter(DescID(WORLD_TIMESCALE), GeData(BaseTime(0, fps)), DESCFLAGS_SET_0);// Time Scale          
      sh->SetParameter(DescID(WORLD_GRAVITY), GeData(1000.0), DESCFLAGS_SET_0);          // Gravity value      
      sh->SetParameter(DescID(WORLD_DENSITY), GeData(1.0), DESCFLAGS_SET_0);             // Density value  
      EventAdd();  
        
        
       //CACHE  
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      sh->SetParameter(DescID(WORLD_CACHE_BAKE), GeData(1.0), DESCFLAGS_SET_0);                    //...See Button code below  
      sh->SetParameter(DescID(WORLD_CACHE_CLEAR), GeData(1.0), DESCFLAGS_SET_0);                   //...See Button code below  
      sh->SetParameter(DescID(WORLD_CACHE_USE), GeData(FALSE), DESCFLAGS_SET_0);                   //Use cached data  
      sh->SetParameter(DescID(WORLD_CACHE_DISABLE_BAKED_OBJECTS), GeData(FALSE), DESCFLAGS_SET_0); //Disable cached objects  
      sh->SetParameter(DescID(WORLD_CACHE_USE_TIME), GeData(FALSE), DESCFLAGS_SET_0);              //Use time stops to control cached playback  
      sh->SetParameter(DescID(WORLD_CACHE_TIME), GeData(BaseTime(0, fps)), DESCFLAGS_SET_0);       //time stops frame value  
      EventAdd();  
        
        
       //EXPERT  
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      sh->SetParameter(DescID(WORLD_MARGIN), GeData(1.0), DESCFLAGS_SET_0);                        //Collision Margin  
      sh->SetParameter(DescID(WORLD_SCALE), GeData(1.0), DESCFLAGS_SET_0);                        // Scale  
      sh->SetParameter(DescID(WORLD_CONTACT_RESTITUTION_LIFETIME), GeData(5.0), DESCFLAGS_SET_0); // Resting Contact  
      sh->SetParameter(DescID(WORLD_SEED), GeData(0.0), DESCFLAGS_SET_0);                         // Random Seed  
      sh->SetParameter(DescID(WORLD_SUBSTEPS), GeData(5.0), DESCFLAGS_SET_0);                     // Steps per frame  
      sh->SetParameter(DescID(WORLD_ITERATIONS), GeData(10.0), DESCFLAGS_SET_0);                  // Max Iterations per step   
      sh->SetParameter(DescID(WORLD_ERROR_THRESHOLD), GeData(10.0), DESCFLAGS_SET_0);             // Error threshold  
      EventAdd();   
        
        
        
       //VISUALIZATION  
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      sh->SetParameter(DescID(WORLD_VISUALIZE), GeData(FALSE), DESCFLAGS_SET_0);               // Enable  
      sh->SetParameter(DescID(WORLD_VISUALIZE_SHAPES), GeData(TRUE), DESCFLAGS_SET_0);         // Collision Shapes  
      sh->SetParameter(DescID(WORLD_VISUALIZE_AABBS), GeData(TRUE), DESCFLAGS_SET_0);          // Bounding Boxes  
      sh->SetParameter(DescID(WORLD_VISUALIZE_CONTACT_POINTS), GeData(TRUE), DESCFLAGS_SET_0); // Contact Points  
      sh->SetParameter(DescID(WORLD_VISUALIZE_CONSTRAINTS), GeData(TRUE), DESCFLAGS_SET_0);    // Connectors  
      EventAdd();  
        
        
        
        
      // Execute Dynamics Cache Button  
        
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      BaseContainer msg(BFM_ACTION);  
      msg.SetLong(BFM_ACTION_ID, 1440);  
      msg.SetLong(BFM_ACTION_VALUE, TRUE);  
        
      DescriptionCommand dc;  
      dc.id = DescID(DescLevel(WORLD_CACHE_BAKE, DTYPE_BUTTON, sh->GetType()));  
      DescriptionCheckUpdate du;  
      du.doc = doc;  
      du.descid = &dc.id;  
      du.drawflags = 0;  
        
      sh->Message(MSG_DESCRIPTION_COMMAND, (void* )&dc);  
      sh->Message(MSG_DESCRIPTION_CHECKUPDATE, (void* )&du);  
      EventAdd();  
        
        
        
        
      // Execute Dynamics Clear Cache Button  
        
      BaseSceneHook *sh = doc->FindSceneHook(180000100);  
      if (!sh) return FALSE;  
        
      BaseContainer msg(BFM_ACTION);  
      msg.SetLong(BFM_ACTION_ID, 1440);  
      msg.SetLong(BFM_ACTION_VALUE, TRUE);  
        
      DescriptionCommand dc;  
      dc.id = DescID(DescLevel(WORLD_CACHE_CLEAR, DTYPE_BUTTON, sh->GetType()));  
      DescriptionCheckUpdate du;  
      du.doc = doc;  
      du.descid = &dc.id;  
      du.drawflags = 0;  
        
      sh->Message(MSG_DESCRIPTION_COMMAND, (void* )&dc);  
      sh->Message(MSG_DESCRIPTION_CHECKUPDATE, (void* )&du);  
      EventAdd();
      

      -ScottA

      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 09/06/2011 at 13:14, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        But I'm having trouble with the document scale & Unit's attributes.
        If someone can tell me how to edit those settings.

        Since R12 CINEMA supports true units which required each document to have a unit scale. Its data type is UnitScaleData. Please check the docs for a detailed description.

        cheers,
        Matthias

        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 09/06/2011 at 16:43, xxxxxxxx wrote:

          The SDK does a good job explaining the methods and their parameters.
          But it assumes that the reader knows how to construct the correct path to the proper owner of these methods(in this case the document).

          Here's my crude attempt:

          #include "customgui_unitscale.h"  
            UnitScaleData *data;   
            data->SetUnitScale(1, DOCUMENT_UNIT_KM);       
            doc->SetParameter(DescID(DOCUMENT_DOCUNIT), GeData(data), DESCFLAGS_SET_0); //<--This is definitely wrong 
          

          I'm still not very good at understanding the SDK yet.
          I'm hoping if I get enough examples under my belt. I will get to a point where I can use it much better.

          -ScottA

          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 10/06/2011 at 02:08, xxxxxxxx wrote:

            You can set custom data like this:

              
            BaseContainer *bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);  
              
            UnitScaleData *usd = (UnitScaleData* )bc->GetCustomDataType(DOCUMENT_DOCUNIT, CUSTOMDATATYPE_UNITSCALE);  
            if (!usd) return FALSE;  
              
            usd->SetUnitScale(10.0, DOCUMENT_UNIT_KM);  
              
            bc->SetData(DOCUMENT_DOCUNIT, GeData(CUSTOMDATATYPE_UNITSCALE, *usd));  
              
            doc->Message(MSG_UPDATE);  
              
            EventAdd();  
            

            cheers,
            Matthias

            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 10/06/2011 at 07:25, xxxxxxxx wrote:

              Thank you sir.🍺
              I added it to the list. Now it should be complete.

              -ScottA

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