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

    Crash when closing Cinema

    SDK Help
    0
    4
    360
    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 02/05/2008 at 02:58, xxxxxxxx wrote:

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

      ---------
      Hi, I've got a problem when closing Cinema. My tag plugin has to write some data when it is shut down. The folowing method is called inside the free()-method:

      > \> \> void MoCap::SetBackIDs (){ \> \>      BaseDocument \*doc = GetActiveDocument(); \>      GePrint ("doc"); \>      if (!doc->GetFirstObject()){ \>           GePrint ("if"); \>           return; \>      } \>      BaseObject \*op = doc->GetFirstObject(); \>      GePrint ("op"); \>      BaseObject \*current; \>      GePrint ("current"); \>      BaseContainer \*opContainer = op->GetDataInstance(); \>      GePrint ("opContainer"); \>       \>      GePrint("MoCap::Free"); \> \>      while (op!= NULL){ \>           GePrint ("while"); \>      opContainer = op->GetDataInstance(); \>      opContainer->SetBool (DESC_USED, FALSE); \>      opContainer->SetLong (DESC_JOINT_ID, 0); \>      current = op->GetDown(); \>      if (current == NULL) \>           current = op->GetNext(); \>      if (current == NULL) \>           current = op->GetUp()->GetNext(); \>      op = current; \>      } \> \>      GePrint ("End Free()"); \> } \> \>

      This works fine. The problem is, when closing Cinema the document already seems empty when calling this free-method. The console prints out "doc", but doesn't get any further. Does someone have an idea?

      Thanks

      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 02/05/2008 at 03:43, xxxxxxxx wrote:

        You shouldn't use GetActiveDocument() within a tag. You should use the document the node (tag) is attached to.

        node->GetDocument()

        The node is passed to the classes' methods

        Free(GeListNode *node)

        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 02/05/2008 at 04:10, xxxxxxxx wrote:

          Thx very much

          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 02/05/2008 at 12:40, xxxxxxxx wrote:

            ...you should also be testing your variables before accessing them...

                
                
                  
                BaseDocument *doc = GetActiveDocument();  
                 **if( doc )**  
                 {  
                  BaseObject *op = doc->GetFirstObject();  
                  **if( op )  
                **   {  
                    BaseContainer *opContainer = op->GetDataInstance();  
                    **if( opContainer )  
                **     {  
                        ...yadda..  
                    }  
                  }  
                }  
                
            

            ...or similar, etc.

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