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

    Member variables in ObjectData

    SDK Help
    0
    3
    206
    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 27/10/2004 at 23:01, xxxxxxxx wrote:

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

      ---------
      I have an object derived from ObjectData. I have one member variable in this object (e.g. String). But i can not save any data in this variable. Why?
      ...
      class MyObjectData: public ObjectData
      {
      INSTANCEOF(MyObjectData,ObjectData)
      public:
          static NodeData *Alloc(void){return gNew MyObjectData;}
          virtual Bool Init(GeListNode *node);
          void ShowValue();
      private:
          String text;
      };
      ...
      ...
      Bool MyObjectData::Init(GeListNode *node)
      {
          text = "hello";       //assigning a value
          return TRUE;
      }
      ...
      ...
      void MyObjectData::ShowValue()
      {
          GePrint("Text:" + text);        //variable text is empty
      }
      ...
      Thanks,
      Torsten

      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 28/10/2004 at 08:59, xxxxxxxx wrote:

        First, you could easily store the String in a BaseContainer with an id (i.e.: node->GetDataInstance()->SetStaticText(MYOBJECTDATA_TEXT, "hello")), but that's beside the point. 🙂

        Everything looks proper. Init() is called directly after the constructor during gNew, so it should have a valid value afterwards. Have you tried GePrint() within Init()? Are you at least getting "Text:" to show in the console?

        Robert

        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 03/11/2004 at 11:09, xxxxxxxx wrote:

          I can't see either why this wouldn't work in the code posted. Perhaps your object is cloned? You'd need to implement the CopyTo(), Read() and Write() functions to make the data persistent.

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