[Closed] Help me: MaxScript and EditPoly
Is it possible to set vertex positions and modify map channels in the edit poly modifier via script?
I’ve RTFM and can’t find reference to it, I’m hopinh that someone is privy to some secret info.
Look up polyOp in the help.
pos=polyOp.getVert $.baseObject 1
polyOp.setVert $.baseObject 2 pos
As for the channels I would have to look that up as I can’t remember off the top of my head.
Paul, he means the modifier, that only works on Editable_Poly
I rarely use the edit_poly mod but here are some pointers:
I’m not sure about moving vertices directly. I don’t find anything in the help. However you can select vertices and use the MoveSelection for sure. This is of course not as cool, but it is doable.
<bool>SetSelection <enum>meshSelLevel <&bitArray>newSelection node:<node>
MoveSelection
I didn’t find any way to set Map channels, however you could get them if you liked at least.
Bah, there is a reason I stay away from the Edit_Poly Modifier.
/Andreas
I’ve got a sneaky suspision that map channels and explicit vertex positioning has been ommitted because of the animation aspect of edit poly.
Oops sorry, I didn’t read it right. I don’t think that you can do it in editPoly.
You could do the following (it’s a hack).
- Using object A make a snapshot to object B as a Editable_Poly.
- Move the vertexs on object B as you want.
- Add morph modifier to object A.
- Blend to object B.
- Add a Edit_Poly modifier to object A.
- Delete the morph modifier.
- Delete the old Edit_Poly that was under the morph modifier.
Now you have a Edit_Poly with the vertex changes you wanted.
Hey, there is no setVert function for Edit poly wich is too bad, but here is way you can use to move veritces:
polyobj = modpanel.getcurrentobject()
polyobj.setSelection #Vertex #{}
polyobj.Select #Vertex #{1}
polyobj.SetOperation #Transform
polyobj.MoveSelection [0,0,10]
polyobj.Commit()
redrawviews()
There was a problem with using setselection in edit poly(not sure if it is still there in 3ds max 9 actually) so I had to use this method to first deselect all verts then add to the selection using polyobj.Select.
edit- btw you also need to be in vertex subobjectlevel for it to work.
cheers,
CML
Yep, what Rivendale wrote is the way to go
the bugger is that you can only use MoveSelection (offfset from the current vertex pos)
so you need to
loop through the vert selection 1 by 1
select each vert
get the vert position
calculate the offset (finalpos-originalpos)
move the vert
commit()
boring and slow, but i don’t think there is another way… (hope i’m wrong)