Notifications
Clear all

[Closed] move with softselection

Hi!

Is there a way of moving vertices with softselection via script? I found i can get a percentual selection via

pointSelection $ index

but i dont know how to set it. Or do i have to move the vertices manually (with polyop.getvert and setvert instead of just move $.selectedverts)?

What i would like to do is mirror actions from one side to the other! Ive got the corresponding vertex ids in an array, and can symmetrize the mesh and all but id like to be able to work on an asymetrical mesh. and without having to scale in x all the time to move vertices!

Thanks for any ideas!!

seb

:bounce:

2 Replies

Hey,

This should be enough to get the points to move, however I did notice that it wouldn’t update the opengl render of the object all the time. Not sure if this is going to be an issue for you? I’d be interested to see your script once you’ve got it working?

function movePointSelection inputObject moveAmount = (
with undo “movePointSelection” on[indent] (
for i = 1 to inputObject.mesh.verts.count do[indent] (
vertWeight = (pointSelection inputObject i)
inputObject.mesh.verts[i].pos += (moveAmount * vertWeight)
)
)
[/indent])
[/indent]movePointSelection $ [15,15,15]

 Rod.

Helllo again!

I kindof got it all working! Im basically saving all vert positions and then move the opposite side by the delta. Its all working on a button now but id love to have it updating in realtime!

I tried hooking this function up with the viewport redraw event but its sadly not working :(. Could it be that its not possible to update the scene in that time? (its still printing the delta for example but just not setting the opposite vert, or the testbox) i tried switching off the redraw but that doesnt change things either…

btw when this is all done ill release this whole symmetry business if people are interested!!

Thanks !

seb


fn updateSymmetry = 
(
	disableSceneReDraw()
	local verts = (polyOp.getVertSelection obj) as array
	local numVerts = polyOp.getNumVerts obj
	
	if verts != undefined do (
		if vertpos.count != numVerts then (  -- first time 
		print "first!"
			for i = 1 to numVerts do (
				vertpos[i] = (polyOp.GetVert obj i)
				vertposOld[i] = vertpos[i]
			)
		)
		else for vert in verts do (
			vertpos[vert] = polyOp.GetVert obj vert
			delta[vert] = vertpos[vert] - vertposOld[vert]
			if delta[vert] != [0,0,0] do ( --update other side
				print delta[vert]
				delta[vert].x=delta[vert].x*-1
			
			    local posOp = (vertposold[vertID[vert]]+delta[vert])
				polyOp.setVert obj vertId[vert] posOp
				$box01.position = posOp

				vertPosOld[vert] = vertpos[vert]					
				vertPosOld[vertId[vert]] = posOp
			)
		)	
	)
	enableSceneReDraw()
	
)