[Closed] Getting vertex selection from modifier. QUICKLY
My task is simple – I have an editable poly (or editable mesh, it’s not vital) with volume_select modifier, I have a rule to move its gizmo and I need to get vertex selection from this modifier.
The bad news is that model is about 1.5m tris and I need to do that few thousand times.
The best solution I have found is to read
<object>.mesh.selectedverts
But reading this data from object is DEADLY SLOW and calculating whole task takes hours.
Is there any other method to read modifier’s selection data?
Serejah, you can try with c# SDK…
the fastest SDK way to get current trimesh vertex selection is:
node > EvalWorldState > TriObject > mesh > VertSel
all built-in MXS methods are really slow
I didn’t do much tests, but in 2014 it is pretty fast
And it is also dependent on command panel mode
bits = #()
for mode in #( #create, #modify ) do
(
setCommandPanelTaskMode mode
delete objects
tri = plane widthsegments:850 lengthsegments:850 isSelected:true
convertToMesh tri
vs = Vol__Select ()
vs.level = 1
vs.volume = 4
vs.texture = Dent size:100
vs.method = 0
addModifier tri vs
t1=timestamp();hf = heapfree
vsel = getVertSelection tri
format "Mode:% Time: %sec. Mem: %\n" mode ((timestamp()-t1)/1000 as float) (hf-heapfree)
-- LEAKS MEMORY
t1=timestamp();hf = heapfree
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
inode = g.COREInterface14.GetINodeByHandle tri.inode.handle asdotnetobject:true
iobj = inode.evalworldstate (currenttime as integer) true asdotnetobject:true
iobj.obj.Mesh_.VertSel
format "C# sdk vsel Time: %sec. Mem: %\n\n" ((timestamp()-t1)/1000 as float) (hf-heapfree)
append bits vsel
)
bits[1].numberset == bits[2].numberset
(bits[1] - bits[2]).IsEmpty and (bits[2] - bits[1]).IsEmpty
Mode: #create Time: 1.333sec. Mem: 192L
C# sdk vsel Time: 0.673sec. Mem: 944L
Mode: #modify Time: 0.008sec. Mem: 192L
C# sdk vsel Time: 0.074sec. Mem: 944L
it works fast because the object is an Editable Mesh. It will be slower with an Editable Poly
Hah, it was too obvious to come up with it on my own!
Works great, thank you Serejah.