Notifications
Clear all
[Closed] problem with temporary meshes
Jun 26, 2009 1:56 pm
Im trying to do the following
make a copy of a scene node.
apply a rotation to that copy
save the resulting mesh to a variable
delete the copy
then apply further operations to the mesh contained in the variable.
When I try to do this, maxscript is giving me a Runtime error: Attempt to access deleted TriMesh
I cant understand why, when the operations that flag that error have nothing to do with the mesh that was created then deleted.
Heres a bit of the code :
-- Takes a copy of the child object from the array of children selected in the plugin UI
local tempnode=copy thechildren[i].node
-- orientchild is a function that rotates the object without affecting the pivot.
local reoriented = orientChild tempnode.mesh (inverse thechild[i].objTM)
-- This transfers the mesh to a variable that stores the mesh data
thechild[i].tmesh = reoriented
-- we delete the copy of the original node
delete tempnode
-- This line flags up the runtime error !!! argh...
thechild[i].numfaces = getnumfaces thechild[i].tmesh
perhaps theres an easier way to rotate the mesh from a scene node without actually effecting the node itself or needing to make a copy.
Any suggestions?
2 Replies
Jun 26, 2009 1:56 pm
Select all vertices in the mesh/poly and rotate them…
Is that what you’re looking for?
Jun 26, 2009 1:56 pm
No, it’s not that simple. I need to rotate a copy of the mesh, not an actual scene node, therefore I can only use meshops.
Never mind, I managed to find a workaround in my script that negated the need to do this.
The real problem was that if I take a copy of the mesh of a node into a variable, and then say rotate that mesh within the variable, it seems to also rotate the mesh in the node. Are copies of mesh data within variables directly linked to their node of origin?