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

    tagPlugin: getObject at init()

    SDK Help
    0
    5
    427
    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 29/04/2008 at 14:37, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      Hi,

      im writing a small tag Plugin, but im having a hard time in the init function.

      at init i need to access the object that the tag is attached to, but i just cant seem to get it from the GeListNode that is passed in the init.

      i tried to cast the node some object, but when i start the plugin cinema always crashes..

      i tried like this, but its no good 😞
      -----------
      Bool SplineMassTag::Init(GeListNode *node)
      {
           GePrint("Init..");

      BaseTag *tag = (BaseTag* )node;               
           int pointCount = ((PointObject* )tag->GetObject())->GetPointCount() :
      .
      .
      .

      what's wrong with that ?

      thanks,
      Daniel

      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 29/04/2008 at 15:06, xxxxxxxx wrote:

        ok, after using the search a little more i decided to use the execute funtion instead by overriding the addtoexecute.

        now i want to access the points of the object:
        --------

        LONG SplineMassTag::Execute(PluginTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, LONG flags){
             GePrint("Execute..");
             GePrint("name: "+tag->GetObject()->GetTypeName());
             GePrint("points: "+((PointObject * )op)->GetPointCount());

        ------
        the name is printed alright, but not the pointcount.
        Is my cast wrong maybe ?

        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 29/04/2008 at 15:17, xxxxxxxx wrote:

          Init() is not the best place for this. When loading Cinema 4D documents, it is not guaranteed that other things exist yet. And Init() is called before the tag is inserted into the object which means double trouble (boil and bubble).

          Instead, use the Message() method.

          Specifically MSG_MULTI_DOCUMENTIMPORTED will be sent after the document is loaded and everything is guaranteed to exist.

          When creating your tag on an object, the best course of action is to check for something like MSG_MENUPREPARE to do this initialization.

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

            1. Make sure that the object is indeed a PointObject (or derivative thereof like PolygonObject or SplineObject).

            2. LongToString(ToPoint(op)->GetPointCount()). GePrint doesn't do ANY conversion of types - it only knows String. There are LongToString() and RealToString() methods available.

            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 29/04/2008 at 15:31, xxxxxxxx wrote:

              alright thanks alot.

              guess i have to dig alot deeper into the api...
              or make alot more posts ;|

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