Define new object class



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

    On 02/05/2008 at 03:06, xxxxxxxx wrote:

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

    ---------
    Hi, I've got another problem regarding a new object class. In fact I don't need a new object class, I only want to redefine the CAJointObject class. Unfortunately this doesn't seem to work with deriving from this class because I need to modify the free()-method.

    > \> class JointObject : public CAJointObject \> { \> \>      private: \> \>      JointObject(); \>      ~JointObject(); \>       \>      BaseObject \*counterpart; \> \>      public: \> \>      void SetCounterpart (BaseObject \*cp){ \>      GePrint ("SetCounterpart"); \>      counterpart = cp; \>      } \>       \>      void StartSettings(BaseObject \*bo, long id){ \>      String name = bo->GetName(); \>      //this->SetCounterpart(bo); \>      //GePrint ("After SetCounterpart"); \>      this->SetName(name); \>      GePrint ("1"); \>      BaseContainer \*jointContainer = this->GetDataInstance(); \>      GePrint ("2"); \>      jointContainer->SetLong (DESC_JOINT_ID, id); \>      GePrint ("3"); \>      jointContainer->SetBool (DESC_USED, TRUE); \>      GePrint ("4"); \>      } \> \>      static JointObject \*Alloc(BaseObject \*bo, long id){ \> \>      BaseContainer \*bc = bo->GetDataInstance(); \>      bc->SetBool (DESC_USED, TRUE); \>      bc->SetLong (DESC_JOINT_ID, id); \>      JointObject \*jo = (JointObject\* )CAJointObject::Alloc(); \>      return jo; \>      } \> \>      static void Free(JointObject \*&pObject;){ \> \>      GePrint ("Free JointObject"); \>           CAJointObject \*ca = pObject; \>           CAJointObject::Free(ca); \>           pObject = NULL; \> \> \> /\*     BaseContainer \*bc = counterpart->GetDataInstance(); \> \>      bc->SetBool(DESC_USED, FALSE); \>      bc->SetLong(DESC_JOINT_ID, 0);\*/ \>      } \> \> \>      }; \> \>

    When I delete the CAJointObject from the Object Manager logically the CAJointObject::free()-method is called. Is there a workaround? Or do I really have to define a new object class? And how do I do this?

    Greetz

    J.



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

    On 02/05/2008 at 03:47, xxxxxxxx wrote:

    You can not do this. If you want to create your own joint-like objects you have to create them your on own. The ObjectData class is for creating your own objects. Look at the examples in the SDK for object plugins.

    cheers,
    Matthias



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

    On 02/05/2008 at 05:09, xxxxxxxx wrote:

    Hi Matthias, thx for your quick advice. Problem is that I exactly need CAJointObjects but I have to call one certain function as they are allocated or deleted. I think there has to be an easier way than programming all the same object plus one line. Any idea?



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

    On 02/05/2008 at 05:42, xxxxxxxx wrote:

    What are you trying to achieve, maybe there is a simple solution?

    cheers,
    Matthias



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

    On 02/05/2008 at 06:07, xxxxxxxx wrote:

    Hi Matthias, ich schreib jetzt mal auf deutsch, könnte einfacher sein:)

    Ich schreibe an einem PlugIn zur Verarbeitung von MoCap-Daten, also animierten Nullobjekten. Mit dem Plugin können aus den Nullobjekten Joints generiert werden, welche die Animation übernehmen und auch hierarchisch angeordnet werden können.

    Um die Benutzung zu vereinfachen, soll jedes Nullobjekt, dass benutzt wurde, mit einer entsprechenden ID und einem Boolean versehen werden. So werden keine doppelten Joints erzeugt. Wird jedoch ein bereits angelegter Joint gelöscht, müssen auch die entsprechenden Nullobjekte wieder auf "unbenutzt" geswitcht werden. Genau an dieser Stelle liegt mein momentanes Problem:)

    Ich möchte also, dass, sobald ein CAJointObject gelöscht wird, Daten für den entsprechenden Counterpart bei den Nullobjekten geschrieben werden.

    Grüße

    Jeong



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

    On 02/05/2008 at 06:32, xxxxxxxx wrote:

    Also in dem Fall würde ich eher ein eigenes PluginTag erstellen das du an deine Joints hängst. Wenn die Joints gelöscht werden kannst dann in deiner Tag Free() Funktion oder Destructor die nötigen Aufräumarbeiten machen.

    For the English speaking people, I adviced Jeong to use a plugin tag attached to the joints and the tag's Free() function or the destructor.

    cheers,
    Matthias



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

    On 02/05/2008 at 07:06, xxxxxxxx wrote:

    That's it. Thx!:)


Log in to reply