|
I have written a script that displaces points on an editable mesh object by iterating through the selected vertices with a for loop, and using meshOp methods (eg. meshop.moveVert selected[1] vertIndex Offset node:selected[1] useSoftSel:true) My script works perfectly for points that are directly selected, but I can’t get it to work with soft-selected points.
I have tried using meshop.supportVSelectWeights selected[1], meshop.setVDataChannelSupport selected[1] 1 true and meshop.setNumVDataChannels selected[1] 2 keep:false prior to getting the selected vertices with meshop.getVert selected[1] vertIndex node:selected[1]. The script runs just fine, without compile or runtime errors, but it doesn’t move the soft-selected vertices when I have that mode on.
It appears that my problem is that my method of getting the number of selected points (selected[1].selectedVerts.count) and the points themselves (selected[1].selectedVerts[s].index) don’t recognize soft-selected points. Is there a way I can get these methods to recognize soft-selected vertices with my current setup, or do I have to use another method, (perhaps mapped method?)
[By the way, I used selected = GetCurrentSelection().]
I would greatly appreciate any help. Thank you in advance.
The relevant sections of code:
else if subObjectLevel == 1 and selected[1].selectedVerts.count > 0 then (
meshop.supportVSelectWeights selected[1]
meshop.setVDataChannelSupport selected[1] 1 true
meshop.setNumVDataChannels selected[1] 2 keep:false
numSelVerts = selected[1].selectedVerts.count
for s = 1 to numSelVerts do
(
global x = 0.0
global y = 0.0
global z = 0.0
vertIndex = selected[1].selectedVerts[s].index
softValue = meshop.getVDataValue selected[1] 1 vertIndex
vert = meshop.getVert selected[1] vertIndex node:selected[1]
[...]
meshop.moveVert selected[1] vertIndex Offset node:selected[1] useSoftSel:true
) [...] )
Using Max 2012
|