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
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Object likely to NullObject

    SDK Help
    0
    4
    399
    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 12/04/2008 at 06:18, xxxxxxxx wrote:

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

      ---------
      Hi,

      I need to make a plugin object that's in fact a Null Object (including e.g. the ID_BASEOBJECT_COLOR and ID_BASEOBJECT_SHADEDWIRECOLORMODE working as in an Null Object), just with 2 extra attributes.

      I tried with:

      > `

      class OPointOfInterest : public ObjectData  
      \>  {  
      \>       INSTANCEOF(OPointOfInterest,ObjectData)  
      \>    
      \>       private:  
      \>    
      \>       public:  
      \>            virtual Bool Init(GeListNode *node);  
      \>    
      \>            virtual Bool Message                    (GeListNode *node, LONG type, void *data);  
      \>            virtual Bool Draw                         (PluginObject *op, LONG type, BaseDraw *bd, BaseDrawHelp *bh);  
      \>            virtual Bool GetDEnabling               (GeListNode *node, const DescID &id;,GeData &t;_data,LONG flags,const BaseContainer *itemdesc);  
      \>            virtual void CheckDirty(PluginObject* op, BaseDocument* doc);  
      \>    
      \>            static NodeData *Alloc(void) { return gNew OPointOfInterest; }  
      \>  };
      

      `

      All void functions just return TRUE.

      I try to register it with:
      > `

      Bool RegisterPointOfInterest(void)  
      \>  {  
      \>       // decide by name if the plugin shall be registered - just for user convenience  
      \>       String name=GeLoadString(IDS_POINTOFINTEREST); if (!name.Content()) return TRUE;  
      \>       return RegisterObjectPlugin(ID_POINTOFINTEREST,name,0,OPointOfInterest::Alloc,"OPointOfInterest","PointOfInterest.tif",0);  
      \>  }
      

      `

      Not sure about the "0" flag, have also tried OBJECT_GENERATOR.

      In the .res file I include Onull and add some attributes.

      Now the object looks like I want, and has all attributes that I want. But if I try to use the Null Object's functionality to draw e.g. a circle in a certain color, it does not work. Nothing is drawn.

      What do I have to do to make an object that completely behaves like the null object?

      Thanks in advance for hints and help 🙂

      Best regards,
      Jack

      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 12/04/2008 at 07:42, xxxxxxxx wrote:

        Howdy,

        Well, the drawing of a Null object is in the NULL object's ObjectData::Draw() function, which you'd have to mimic in your OPointOfInterest::Draw() function. ;o)

        Adios,
        Cactus Dan

        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 12/04/2008 at 19:39, xxxxxxxx wrote:

          Just return a Null object in GetVirtualObjects. Here an example (it's a modified sample from the SDK)

          > \> class MorphMixerObject : public ObjectData \> { \>      INSTANCEOF(MorphMixerObject,ObjectData) \> \>      public: \>           virtual BaseObject\* GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh); \> \>           static NodeData \*Alloc(void) { return gNew MorphMixerObject; } \> }; \> \> // create morphed object \> BaseObject \*MorphMixerObject::GetVirtualObjects(PluginObject \*op, HierarchyHelp \*hh) \> { \>      BaseObject \*null = NULL; \>      null = BaseObject::Alloc(Onull); \>      if (!null) goto Error; \> \>      BaseContainer \*data = null->GetDataInstance(); \> \>      data->SetLong(NULLOBJECT_DISPLAY, NULLOBJECT_DISPLAY_PENTAGON); \> \>      return null; \> \> Error: \>      BaseObject::Free(null); \>      return NULL; \> } \> \> // be sure to use unique IDs obtained from www.plugincafe.com \> #define ID_MORPHMIXER_OBJECT     1001156 \> \> Bool RegisterMorphMixer(void) \> { \>      // decide by name if the plugin shall be registered - just for user convenience \>      String name=GeLoadString(IDS_MORPHMIXER); if (!name.Content()) return TRUE; \>      return RegisterObjectPlugin(ID_MORPHMIXER_OBJECT,name,OBJECT_GENERATOR,MorphMixerObject::Alloc,"Omorphmixer","morphmixer.tif",0); \> } \>

          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 13/04/2008 at 09:00, xxxxxxxx wrote:

            Right that's a good possibility, too. Thanks again, Matthias!

            Anway, I already did the drawing stuff in the Draw(), that way I have the possibility to draw some more things and give the object a special look.

            Greetings,
            Jack

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