[Closed] snapshot VS snapshotAsMesh
Hi,
It seems when you say snapshot $, it makes a copy of the object $, and you can see it in the scene. Conversely, if you use snapshotAsMesh, it seems to make a temporary object, stored in a variable, but it is not visible in the scene. Is this the intended behavior?
To remove the object generated by snapshot, you can call “delete” on it. But it seems this is unnecessary if you use shapshotAsMesh? Are my thoughts correct?
Also, is it possible to convert a TriMesh to a poly Object?
EDIT: I just answered my second question:
delete <trimesh> – Clears out the TriMesh’s geometry and topology, effectively freeing its memory.
So delete does have an effect.
You can create an empty Editable_Mesh object, feed in the TriMesh and convert to EPoly.
(
theObj = $Teapot01 –the object
theTMesh = snapshotAsMesh theObj –snapshot as TriMesh to memory
theNewMesh = Editable_mesh() –create an empty EMesh
theNewMesh.mesh = theTMesh –assign TriMesh value to the EMesh
convertTo theNewMesh Editable_Poly –collapse to EPoly
delete theTMesh –free up memory
)
SnapshotAsMesh() is a great method to get the actual geometry on the very top of the modifier stack, including Node Transforms and Space Warps. All vertex coordinates are in World Space. The above example creates an object at WORLD ORIGIN that has the mesh already transformed at the original location of the source object’s mesh. Since the TriMesh is only in memory, you can perform all sort of read or write operations on the TriMesh value without polluting the scene with a temp. object.
snapshot() on the other hand creates a node that contains the world state of the mesh, but keeps the node transforms of the original object. It also takes the Space Warps into account. If you actually need a collapsed clone of a geometry object, it is the way to go.