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
    • Register
    • Login

    IsAlive() Problem + Workaround

    PYTHON Development
    0
    3
    554
    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 24/02/2011 at 14:20, xxxxxxxx wrote:

      Hi,

      if one wants to acess an object using Userdata an the referenceobject becomes removed, the link to the object still exists. If this is not as it ia supposed to be, see it as kind of a Bugreport. 😉

      I had a few problems then, because the Object didn't exist in the document, but it's still in the Userdata.
      Even the BaseList2D.IsAlive() method did not help, it returned True always.

      But i could find a Workaround:

      def IsAlive(op) :   
          if not op.GetDocument() : return False   
          return True   
      

      Cheers, nux

      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 24/02/2011 at 15:50, xxxxxxxx wrote:

        Yeah.
        It's kind of a long standing issue in C4D.

        The most common way I see people dealing with it in regards to UserData. Is to add a null to the link field after the previously refrenced object was removed. Then removing the null.
        Kind of clumsy. But it works.

        I'd be surprised if the developers don't already know about this.

        -ScottA

        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 24/02/2011 at 18:23, xxxxxxxx wrote:

          @nux95: This is a known bug and will be fixed with the next update. To keep your plugins downwards compatible, you should add a check if op is None (which will be the case after the update).

          Some background information about the exception that an object is not alive anymore:
          If you have a reference to an object(BaseObject, BaseTag) in your plugin and the user or C4D deletes
          it, the reference becomes invalid and raises an exception. The reference is still alive but the established object is already freed.

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