Moving vertices on "Edit Mesh"-modifier
I hope somebody can help me.
In my script theres is an editable mesh, wich I want to transform. It ist possible to do this tranformation manual. If I add an "edit mesh"-modifier, I can move the several vertices in the vertex-sublevelmode. By deleting the "edit mesh"-modifier I can undo my transformation if it isn't correct.
I tried to write a script, but it doesn't work. Either it is irreversible or it doesn't work. Has anybody an idea how to solve this problem?
This is my script:
disableSceneRedraw()
percent = 50
factor = (percent/100.0)
currentSelection = getCurrentSelection()
max modify mode
for obj in currentSelection do
(
-- addModifier obj (edit_mesh())
for i = 1 to getNumVerts obj do
(
vert = getVert obj i
vert.x = vert.x * factor
vert.y = vert.y * factor
vert.z = vert.z * factor
setVert obj i [vert.x, vert.y, vert.z]
)
update obj
)
enablesceneredraw()
Comments
Thanks for your answer. You
Thanks for your answer.
You are right, but my problem is that I want to run the script over a UI. With this was it isn't possible to undo the modification done by the script.
If I open a existing mesh for example and run the script over a UI there is no way to undo the modification.
I don't understand why it is possible to do the modification over the "edit mesh" modifier manually but not with the script.
i'm new to maxscript myself,
i'm new to maxscript myself, but i found this in an example:
Which is a lot like what you did, except for the "convertToMesh obj" part... and the setVert at once.
I don't quite understand what you mean by deleting as a kind of undo-function. And why you would want to script that. There is a Max Undo call, btw.
Studio3DR.nl