Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Allocation of PrefsDialogObject

    Cinema 4D SDK
    3
    4
    1.1k
    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.
    • Y
      Yakuza
      last edited by s_bach

      Hi.

      Nice new forum. ^^

      While adapting my plugin for R20 I've been sifting through the code in order to get rid of all the red underlines vc++ throws at me. This is the last one:

      class SoloPrefs : public PrefsDialogObject
      {
      INSTANCEOF(SoloPrefs, PrefsDialogObject)

      public:
      virtual Bool InitValues(const DescID &id, Description* desc = NULL);

      virtual Bool Init(GeListNode* node);
      virtual Bool GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags);
      virtual Bool SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags);
      virtual Bool GetDEnabling(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc);
      virtual Bool GetDDescription(GeListNode node, Description description, DESCFLAGS_DESC &flags);
      virtual Bool Message(GeListNode
      node, Int32 type, void
      data);

      BaseContainer *GetSoloPrefs();
      Int32 dirty;

      static NodeData *Alloc() { return gNew SoloPrefs; }
      };

      How to do the last line correctly? Thanks.

      1 Reply Last reply Reply Quote 0
      • Y
        Yakuza
        last edited by

        SOLVED
        It's just static NodeData *Alloc() { return NewObjClear(SoloPrefs); }

        1 Reply Last reply Reply Quote 1
        • S
          s_bach
          last edited by

          Hello,

          gNew was already removed and replaced in R15. See Changes for New Naming Scheme.

          NewObjClear() is deprecated and should only be used to handle old code.

          If you write new code, please use NewObj() and proper error handling. See Entity Creation.

          You find some example of handling the error in the microsdk example.

          Also, please use tags when creating a new post. See Read Before Posting.

          best wishes,
          Sebastian

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • M
            mp5gosu
            last edited by

            In your specific example, it could look like this:

            static maxon::Result<NodeData*> Alloc() 
            {
                iferr_scope;
                return NewObj(SoloPrefs) iferr_return; 
            }
            

            And when you construct your NodeDataclass, you have to access the actual value of maxon::Result:

            SoloPrefs::Alloc().GetValue();
            

            Note, if that allocation fails that you can access the error with GetError().
            There have changed lots of things, Sebastian already posted the links to the relevant documentation.

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