Notifications
Clear all
[Closed] Object reference is lost
Feb 09, 2012 8:18 pm
Hi! Here is my piece of code taken from a bit larger context:
_tmpname = OBJ.name
if _contains == false then
(while polyOp.getNumFaces OBJ > 1 do ( p = PolyOp.getElementsUsingFace OBJ 1 polyOp.detachFaces OBJ p asNode:true _tempElmObj = objects[objects.count] append _muchForSliceCollection _tempElmObj _totalelements = _totalelements + 1 ) ) print ("get it" + _tmpname) OBJN = getnodebyname(_tmpname) delete OBJN
And here comes error: Can not delete object which is already deleted
After detach operation, OBJ is marked as “delete scene node” for some reason, while it still exists at the scene. Like, after script is finished working with error, same code end:
OBJN = getnodebyname(_tmpname)
delete OBJN
finds correct object and deletes it. So why it can;t work out after while loop? Is some internal data is not updated or stuff like that?