[Closed] Avoiding Max Modify Mode
Greetings
There’s a helper Object in a script i’ve created which is basically a line which connects 2 objects… given lack of any other insight, i’ve done this by drawing a new spline from obect 1, to object 2, enter sub-object mode, selecting a vertex, and add the linked_Xform modifier to it so that the vertex follows the object when it is moved.
This works a treat, but as with everything that uses Max Modify mode, it is very very slow. When this only needed to happen a few times per session it wasn’t so bad, but if it needs to happen hundreds of times it makes you want to scream.
Is there some other animation method which would result in the same effect (a line which will connect two objects) which might avoid using Max Modify mode?
If not, is there a way to completely disable 3ds max UI refresh?
Cheers
Mikie
(code included for reference)
max modify mode
select liftline
local es1 = edit_spline name:"First ES"
addmodifier liftline es1
subObjectLevel = 1
setKnotSelection liftline 1 #(1)
local Xform1 = Linked_XForm name:"First Vertex"
modPanel.addModToSelection Xform1
Xform1.control = parentObj
local bkr = splineselect name:"Break"
addmodifier liftline bkr before:2
local es2 = edit_spline name:"Second ES"
addmodifier liftline es2 before:3
modPanel.setCurrentObject es2
subObjectLevel = 1
setKnotSelection liftline 1 #(2)
local Xform2 = Linked_XForm name:"Second Vertex"
modPanel.addModToSelection Xform2
Xform2.control = parentLoad
subObjectLevel = 0
you can try :
suspendEditing which:<panel_name> alwaysSuspend:<bool>
resumeEditing which:<panel_name> alwaysSuspend:<bool>
such as :
suspendEditing which:#modify
... do something ...
resumeEditing which:#modify
I’ve honestly never looked at skinning. Our use of 3ds max is more engineering, then anything else, so i’v never looked at anything to do with ‘skinning’, materials, rendering, etc… Will take a peak!
OMG… just looked at the skin modifier in MxS doco… just about fainted… where do you start?
Just add Skin modifier to the spline you’ve created, then add the two helpers at the two points of the spline to skin. Skin plays nicely with all kinds of objects not just bones. After that just go in to “Edit Envelopes” and adjust them to encompass the corresponding vertices.
Holy Crap my world just changed!! That’s fantastic and way the frack easier then what i kobbled together from various forums!
Gonna script something up now and see how it behaves
i would wire knots and object’s positions:
delete objects
start = dummy name:"start" pos:[-20,0,0] boxsize:[10,10,10]
end = dummy name:"end" pos:[20,0,0] boxsize:[10,10,10]
wire = splineShape name:"wire" wirecolor:yellow
addnewSpline wire
addKnot wire 1 #corner #line start.pos
addKnot wire 1 #corner #line end.pos
updateShape wire
animateVertex wire #all
wire.controller = Transform_Script script:"matrix3 1"
cc = wire[#Object__Editable_Spline][#Master].controller
paramWire.connect start.transform.controller[#Position] cc[#Spline_1___Vertex_1] "Position"
paramWire.connect end.transform.controller[#Position] cc[#Spline_1___Vertex_2] "Position"
it’s a fastest way of spline deform and redraw
that works a treat as well!
I’ll see which benchmarks faster and go wtih it
Next time either of you are in Melbourne, the first round it on me
Two things… Love the skin modifier, But i get a system exception if i try to add bones with the modify panel suspended… It’s still slightly faster then the way i was doing it, as it involves fewer steps in the modify panel.
The parameter wiring isn’t quite working however… I’m not sure if it is becasue the ‘start’ and ‘end’ objects are sometimes children of other objjects, or sometimes constrained…
if wired nodes are children of another nodes you have to transform their positions into world coordinate system.
any script controller causes the memory leaking and there is no way to stop it. check how bad the memory leaks in your solution.
That was the first thing I tried, but couldn’t find a syntax which worked. for instance replacing “Position” with “(in coordsys world Position)”… that sort of thing.
i use script controllers extensively, and havn’t noticed leaking… what’s the easiest way to tell?
i’ve double-checked your solution and it doesn’t really leak. so, in general case it works better than main
I ended up with the following… works in all scenarios for me, and is consistent with the rest of my plugin, as it’s mainly script controller based anyways…
animateVertex liftline #all
ps1 = point3_script ()
ps1.addNode "source" source
ps1.setExpression "source.pos"
ps2 = point3_script ()
ps2.addNode "load" load
ps2.setExpression "load.pos"
liftline[#Object__Editable_Spline][#Master][#Spline_1___Vertex_1].controller = ps1
liftline[#Object__Editable_Spline][#Master][#Spline_1___Vertex_2].controller = ps2
just try Spline_IK_Control modifier.
sikc = Spline_IK_Control ()
addmodifier theLine sikc
sikc.createHelper (sikc.getknotcount())
As i tested parameter wiring is the fastest way to do something like this, but isn’t there a maximum number of wirings ?