[Closed] paramwire.disconnect troubles
Hey there folks, I’m having trouble with disconnecting parameter wires. I’ve taken this back to basics and am still struggling with it though.
I have one object’s rotation that is wired to another’s rotation.
Neither:
paramwire.disconnect $.rotation.controller[#Rotation_Wire]
Or:
paramwire.disconnect $.rotation.controller[#Euler_XYZ]
Work on either object, and the error I get is “** system exception**”.
Am I missing something simple here? Thanks.
-- if one-way conection:
paramWire.disconnect <master>.rotation.controller
-- if two-way conection:
paramWire.disconnect2Way <one_node>.rotation.controller <another_node>.rotation.controller
paramWire connects subAnims but disconnects controllers… it doesn’t make sense for me, but it’s how it works.
If you ask me, the sooner you ditch parameter wiring the better. It’s slow, clumsy and unstable.
almost all script controllers are leaking badly. the wiring system is a newer than script/expression controllers, and it causes less memory leaking.
I remember conducting a test with opposite results, but I will have to test again…
script VS wire
(
delete objects
b1 = box name:"s_target" width:10 length:10 height:10 pos:[-12,-12,0] wirecolor:yellow
b2 = box name:"s_source" width:10 length:10 height:10 pos:[12,-12,0] wirecolor:orange
sc = b1.rotation.controller = Rotation_Script()
sc.addtarget "source_rotation" b2.rotation.controller
sc.setexpression "source_rotation"
b3 = box name:"w_target" width:10 length:10 height:10 pos:[-12,12,0] wirecolor:red
b4 = box name:"w_source" width:10 length:10 height:10 pos:[12,12,0] wirecolor:brown
paramWire.connect b4.controller[#Rotation] b3.controller[#Rotation] "Rotation"
gc()
t1 = timestamp()
m1 = heapfree
for k=1 to 10000 do b1.rotation
format "script >> time:% memory:%
" (timestamp() - t1) (m1 - heapfree)
gc()
t1 = timestamp()
m1 = heapfree
for k=1 to 10000 do b3.rotation
format " wire >> time:% memory:%
" (timestamp() - t1) (m1 - heapfree)
)
script controllers are weakest link in any rig. wiring is not perfect but it’s better than script.
there is a difference in setting a value and getting a value, and how you get it
$.transform –uses the matrix already evaluated
$.rotation.controller.value –forces evaluations
$.pos = – forces more…
which controller is evaluated could force other controllers eval… a matrix thing…
there is difference when the user manipulates an objec vs when he plays the animation:
try your example using random slidertime ,and redundancy is lost.
there is differences in evaluations, related to the active Transform gizmo,
if I remember right, scale is the most expensive, then rotation, then translation.
there is also the issue of weak references(custom), not the one integrated inside a script_controller…
working with script controllers and evaluations is very complicated in 3dsmax
wires are faster for when the user interact with an object
I was testing. .but max crashed, …
speed, speed… is that the most important?
(for me) script controller == less troubles
Seeing as this thread is already active, does anyone happen to know how to find out what’s on the other end of a controller that is set-up via wire parameter?
I have some joystick controllers that are driving morph targets, that also have float_limits to lock their positions. It’d be useful to be able to find out which morph target each one (broken down into its four components: -x, +x, -y, +y) was controlling; so I can then break the connection and add a new one via MAXScript.
you can find wired controllers using refs.dependson and refs.dependents… in case of one-way connection refs.dependencylooptest is true in one direction and false in another.
Ah thanks! I was looking at the paramWire stuff.
So I’ve been looking into this and I can’t just supply the same thing I’ve supplied for parameter creation?
refs.dependents $.pos.controller.Y_Position.controller.upper_limit[#Limited_Controller__Bezier_Float]
That contains my first argument for paramWire.connect but it doesn’t give me the results I’d expect.
$.pos.controller.Y_Position.controller.upper_limit[#Limited_Controller__Bezier_Float] is subanim.
you have to ask its controller for dependents. <subanim>.controller
Oh I see, so:
refs.dependson $.pos.controller.Y_Position.controller.upper_limit.controller
Is what I’m after? After executing that I’m given:
#(ReferenceTarget:ParamBlock2, Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
I can’t see anything that indicates its attachment to a morph target.
I really appreciate the help, man; you’ve helped me no end over the last couple of days.
no… you are looking again in wrong place. you have to check
refs.dependents $.pos.controller.Y_Position.controller.[b]upper_limit[/b] [#Limited_Controller__Bezier_Float].controller
ps. in my code there is no space after upper_limit. it’s this forum bug.
Hum… that doesn’t seem to work for me, I get this in the listener:
-- No ""get"" function for 5.0
i repeat: there is no space after …_limit. the code is:
refs.dependents $.pos.controller.Y_Position.controller.upper_limit[#Limited_Controller__Bezier_Float].controller