Im having to repeatedly scale sets of vertices so they occupy the same position in space, and I'm using Soft Selection to influence their neighboring vertices.
I'd love to have a MAXScript that does this in a single button, but I'm MXS illiterate.
I tried using the FlattenX/Y/Z meshtools, but they ignore Soft Selection. Same with Orionflame's AverageX/Y/Z.
The reason for this is I have a trench in my model, and Im creating morph targets for it, that will have the two top edges of the trench come together to close the trench, kind of like the way a zipper works. So I select two verts on opposite sides, turn on Soft Selection, and softly uniform-scale them together into the middle of the trench.
But dragging the Scale tool with the mouse down to 0% is a long painful process to have to repeat again and again. The MAXScript Listener doesn't record any Scale commands, even when the TTI is being used.
Maybe it's time to learn MXS... except I'm hella busy, and so is the coder I'd normally ask to do this kind of thing.
Maybe someone here knows the syntax and could help me out?
Replies
EDIT; ah just noticed u mentioned transform type in. still its not too bad to just use that is it?
Four clicks instead of a possible hotkey.
I can't seem to find the function for "selected object" at all... cos then you could use
scale $selectedObject.selectedVerts [0.0,0.0,0.0]
but it seems you need to use $Box01.selectedVerts (or whatever object name)... I had a look through the help but no clarification was forthcoming. I'm sure it's a dead-easy script to write if you know how, but I'm no coder.
MoP
but you can do
for obj in selection do (
scale obj.selectedVerts [0.0,0.0,0.0]
)
Hmmm, doesn't seem to do anything. If I evaluate it, Listener says "756 OK" but then running it has no effect.
Create a plane, collapse to Editable Poly, select two verts, run the script, nothing happens?
Maybe it's because I'm in max5.1... I'm looking into upgrading the studio to v7, but we think it just isn't a wise idea mid-production.
<font class="small">Code:</font><hr /><pre>vertArr = getVertSelection $ as array
posArr = #()
newPos = 0
for i in vertArr do (
append posArr (getVert $ i)
)
newPos = posArr[1] + posArr[2]
if posArr.count > 2 then (
for i = 3 to posArr.count do (
newPos2 = newPos + posArr
newPos = newPos2
)
)
newPos = newPos / posArr.count
for i in vertArr do (
setVert $ i newPos
)
update $</pre><hr />
scale $.selectedVerts [0.0,0.0,0.0]
?
Happens to me all the time when making Python scripts for Blender.
MoP, nothing happens when I try your code...
<font class="small">Code:</font><hr /><pre>
-- Paul Greveson, 2005.01.26
macroScript ScaleVertsPG
category:"Eric"
toolTip:"Will scale the selected vertices to 0"
(
scale $.selectedVerts [0.0,0.0,0.0]
update $
)
</pre><hr />
Maybe I'm setting up the .MCR wrong? Evaluate it and the Listener says "884 OK".
But anyhow I found a solution so you don't have to spend time on this if you don't want to.
I asked the guy who wrote the OrionFlame tools if he could update his AverageX/Y/Z scripts to support Soft Selections, and now they work great.
He's working on some very interesting modeling tools these days. Check out the vids...
http://www.flamefx.com
Site mentions max6/7, but the tools also work in 5.1.
Thanks again everyone for chipping in, much appreciated.
And my script might work on EPoly too, I just didn't try it. But it's sounds like you've got a good solution going. Cheers.
Eric: Glad you got it working... I knew my method didn't work, I just wanted to know why
<mesh>.selectedVerts
The currently selected vertices of the mesh object
Sorry to pop up this old old post. I am in the same situation.
The macro recorder will give me :
scale $.selectedVerts [1.001,1.001,1.001]
Whish return undefinded when run in the code.
*looking for alternative solution*. I'd rather not having to do my scale "manually" by storing the original position of my verts and then giving them an offset...