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
    • Recent
    • Tags
    • Users
    • Login
    The Maxon SDK Team is currently short staffed due to the winter holidays. No forum support is being provided between 15/12/2025 and 5/1/2026. For details see Maxon SDK 2025 Winter Holidays.

    How do I use DateTimeData?

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 384 Views
    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 Offline
      Helper
      last edited by

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

      On 31/07/2011 at 05:40, xxxxxxxx wrote:

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

      ---------
      Hi there,

      might be a simple solution, but I don't get it at the moment.
      I have created a Tag that includes a DateTime field:

        
      DATETIME TORBIT_START   
      {   
      TIME_CONTROL;   
      DATE_CONTROL;   
      COMPACT_MODE;   
      }   
      

      Now I want to initalize this Control with the current time and date. What I tried was this (but it didn't work) :

        
      BaseTag* tag = (BaseTag* )node;   
      BaseContainer* data = tag->GetDataInstance();   
      DateTimeData *dtd = (DateTimeData* )data->GetCustomDataType(TORBIT_START, DATETIME_DATA);   
      if (dtd)   
      {   
      tagDateTime dt = dtd->GetDateTime();   
      DateTimeNow(dt);     // Aktuelle Zeit setzen   
      dtd->SetDateTime(&dt;);   
      }   
      

      With this I did not even get the datatype, i.e. dtd remains NULL.

      Would be great if someone could help!

      Juergen

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

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

        On 31/07/2011 at 10:13, xxxxxxxx wrote:

        This code should work:

          
        BaseContainer *pbc = ((BaseTag* )node)->GetDataInstance();  
          
        GeData dTime(DATETIME_DATA, DEFAULTVALUE);  
        DateTimeData* pDateTimeData = (DateTimeData* )dTime.GetCustomDataType(DATETIME_DATA);  
        if (pDateTimeData)  
        {  
          DateTime dt;  
          GetDateTimeNow(dt);  
          pDateTimeData->SetDateTime(dt);  
          pbc->SetData(MY_DATETIME, dTime);  
        }  
        

        cheers,
        Matthias

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

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

          On 31/07/2011 at 11:54, xxxxxxxx wrote:

          Works. Thanks a lot!

          Quick question again: is there something like the DateTime description element also for dialogs?

          Juergen

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

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

            On 11/08/2011 at 05:29, xxxxxxxx wrote:

            Custom GUIs can be added to dialogs via GeDialog::AddCustomGui. Some custom GUIs don't have any access functions though and some don't seem to work in dialogs. You have to check if it's working for the DateTime GUI.

            Example how to add the DateTime GUI.

              
            class MyDialog : public GeDialog  
            {  
              public:  
                  MyDialog() { gad = NULL; }  
                  virtual Bool CreateLayout(void);  
                  virtual Bool InitValues(void);  
                  virtual Bool Command(LONG id,const BaseContainer &msg);  
              
              private:  
                  DateTimeControl *gad;  
            };  
              
            Bool MyDialog::CreateLayout()  
            {  
              Bool res = GeDialog::CreateLayout();  
              
              SetTitle("DateTime Test");  
              
              GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,0,1,String(),0);  
              
              // fill the container with the custom GUI's values (DATETIME_TIME_CONTROL, DATETIME_DATE_CONTROL, etc.)  
              BaseContainer customgui;  
              
              // adds the DateTime GUI to the dialog  
              gad = (DateTimeControl* )AddCustomGui(10000,DATETIME_GUI,String(),BFH_SCALEFIT|BFV_SCALEFIT,0,0,customgui);  
              
              GroupEnd();  
              
              return res;  
            }  
              
            ...  
            

            cheers,
            Matthias

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