Подскажите, пожалуйста, есть ли такой скрипт, который бы позволял отсоединить отдельными объектами все цельные элементы (Elements) от одного объекта. Например у меня есть один объект в который заатачены множество других, так мне нужно сделать Detach всех элементов в отдельные объекты с отцентрованной привязкой (Pivot).
-- Detach Elements
obj = $
totalMesh = editable_mesh transform:(obj.transform)
-- Get the complete mesh from the mesher
totalMesh.mesh = obj.mesh
i = 0
-- Repeat while there are still faces in the mesh
while totalMesh.numfaces != 0 do
(
-- Get the mesh element the first face belongs to
el = meshop.getelementsusingface totalMesh #{1}
fragmentMesh = editable_mesh transform:(obj.transform) name:(obj.name + "_element_" + (i as string) )
-- Detach the faces of the element
tMesh = meshop.detachFaces totalMesh el delete:true asMesh:true
-- Set the mesh of the fragment Emesh to the element
fragmentMesh.mesh = tMesh
-- Update the fragment Emesh
update fragmentMesh
-- Get the center of the fragment mesh
meshCenter = fragmentMesh.center
-- Move the pivot of the fragment to the original center
-- of the fragment
fragmentMesh.pivot = meshCenter
update fragmentMesh
-- Increase the counter
i += 1
)
if isValidNode totalMesh do delete totalMesh
Доступ к резюме доступен только по пакетному доступу HR менеджерам зарегистрированных компаний. Узнать о вариантах корпоративных пакетов можно по ссылке.
Alteste
Savin Denis
-- Detach Elements obj = $ totalMesh = editable_mesh transform:(obj.transform) -- Get the complete mesh from the mesher totalMesh.mesh = obj.mesh i = 0 -- Repeat while there are still faces in the mesh while totalMesh.numfaces != 0 do ( -- Get the mesh element the first face belongs to el = meshop.getelementsusingface totalMesh #{1} fragmentMesh = editable_mesh transform:(obj.transform) name:(obj.name + "_element_" + (i as string) ) -- Detach the faces of the element tMesh = meshop.detachFaces totalMesh el delete:true asMesh:true -- Set the mesh of the fragment Emesh to the element fragmentMesh.mesh = tMesh -- Update the fragment Emesh update fragmentMesh -- Get the center of the fragment mesh meshCenter = fragmentMesh.center -- Move the pivot of the fragment to the original center -- of the fragment fragmentMesh.pivot = meshCenter update fragmentMesh -- Increase the counter i += 1 ) if isValidNode totalMesh do delete totalMeshAlteste