[Closed] How to check that XRefScene deleted or not?
here is very simple situation:
XRef a scene
put it in a variable:
xs = xrefs.getXRefFile 1
delete xref scene
delete xs
The question is – How to check that xs deleted or not?
(try/catch is not a solution)
(collect all xref scenes and try to find xs in the list – is not a solution too)
matchpattern (xs as string) pattern:“Deleted XRefScene:*”
What do I win?
you didn’t really win …
check:
(
t = timestamp()
h = heapfree
for k=1 to 1000 do try
(
xs.tree
)
catch()
format "time:% heap:%
" (timestamp() - t) (h - heapfree)
)
-- VS
(
t = timestamp()
h = heapfree
ss = "Deleted XRefScene:*"
for k=1 to 1000 do
(
matchpattern (xs as string) pattern:ss
)
format "time:% heap:%
" (timestamp() - t) (h - heapfree)
)
the problem that xs (deleted xref scene) stays in the scene as absolutely valid reference target… and only the system knows what wrong with it.
for example PhysX just crashes max after you try to delete any xref scene
the problem is that after deletion xs stays a valid maxwrapper… you can check before and after deletion… the system via mxs returns the same:
isvalidobj xs
-- true
classof xs
-- XRefScene
but when you try to access xs as a mxs value the ‘deleted’ one causes an exception
xs.tree
-- Runtime error: Attempt to access deleted XRefScene:...
i’m trying to find what they they know that i can’t
Hi Denis,
A possible clue is when you type xs in the Maxscript listener, in the case of a deleted XRef it prints :
Deleted XRef scene :
Though I don’t know yet how to get that information from Maxscript…
the max 2012 as well returns false at isdeleted and true at [b]isvalidobj
[/b]if it was fixed in the most recent versions it doesn’t automatically answer my question. what is the difference on the system level between deleted and not deleted xref scene?
i know the difference… the tree reference target (scene rootnode) is marked as A_IS_DELETED… but there is no methods to get it via max sdk as well
The solution seems to be
In Maxscript :
isDeleted xs
which returns true.
Regards,
it’s exactly what i’m talking about… if it’s deleted it has to be marked as deleted. i can see a reason to keep it valid… but only in case being undoable. But all xres scene manipulations are NOT undoable. More… all of them flush the undo stack buffer