My problem is that when I loop through the array of nodes and attach them to the mesh, the UVs of the new mesh do not match the UVs of the individual nodes. After looking through the docs I thought Meshop.attach() might fix this by setting the targetnode:, but i'm not sure if I understand how that works.
Here is some sample code that shoes the problem, after running this look at the UVs of $myCollapsedMesh. I would expect to see typical box mapping there, but thats not the case.
--An array of random geometry
For i=1 to 4 do(
NewBox = box()
NewBox.pos.x = (i*100)
MyGeo = $box*
--Make an empty mesh
NewExportMesh = editable_mesh()
NewExportMesh.name = "myCollapsedMesh"
--Attach copies of objs in MyGeo to the empty mesh
for obj in MyGeo do(
NewMesh = snapshotasmesh obj
--attach NewExportMesh NewMesh
meshop.attach NewExportMesh NewMesh targetNode:NewExportMesh.baseobject
addModifier NewExportMesh (Unwrap_UVW ())
Thanks in advance!