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

    LinkBox links and BaseDocuments

    SDK Help
    0
    2
    189
    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 14/11/2006 at 10:45, xxxxxxxx wrote:

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

      ---------
      I need information on how to handle a possible situation. My plugin dialog has a copy-paste operation. The operation has a LinkBox for a source object (copy). You then select other objects in the Object Manager and paste attributes from the source to the destination objects.

      That's easy enough. But it seems that this should also be able to handle copying from one document to another without much ado (source in one document, destinations in another). The problem is how to guarantee that the source hasn't become invalid - say by closing the source document (!). Since the only way to get a link is LinkBoxGui::GetLink(BaseDocument* doc), even to check if the source object is still valid, I must store the source document in a pointer. If the document is closed, there is no way for me to verify that the pointer is valid. This spells 'instant crash'.

      Any ideas on how to avoid that potential disaster?

      Thank you 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 14/11/2006 at 10:51, xxxxxxxx wrote:

        How about this?

          
        BaseDocument*     doc =     GetFirstDocument();  
        for (doc = GetFirstDocument(); doc; doc = doc->GetNext())  
        {  
             if (doc == copyDoc)     break;  
        }  
        if (!doc) // Oops! :)
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post