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