View Full Version : paramwire.disconnect troubles
Mackinder 01-25-2012, 07:03 PM 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.
|
|
denisT
01-25-2012, 09:07 PM
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.
Mackinder
01-25-2012, 10:35 PM
Saved my ass again! Thanks man!
If you ask me, the sooner you ditch parameter wiring the better. It's slow, clumsy and unstable.
denisT
01-26-2012, 01:49 PM
If you ask me, the sooner you ditch parameter wiring the better. It's slow, clumsy and unstable.
what is an alternative?
script controller, unless you positively must have 2 way linking..
denisT
01-26-2012, 02:27 PM
script controller, unless you positively must have 2 way linking..
almost all script controllers are leaking badly. the wiring system is a newer than script/expression controllers, and it causes less memory leaking.
denisT
01-26-2012, 02:35 PM
script controller about 2-3 times slower than wired...
I remember conducting a test with opposite results, but I will have to test again...
denisT
01-26-2012, 03:19 PM
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:%\n" (timestamp() - t1) (m1 - heapfree)
gc()
t1 = timestamp()
m1 = heapfree
for k=1 to 10000 do b3.rotation
format " wire >> time:% memory:%\n" (timestamp() - t1) (m1 - heapfree)
)
denisT
01-26-2012, 03:28 PM
script controllers are weakest link in any rig. wiring is not perfect but it's better than script.
Ruramuq
01-26-2012, 07:54 PM
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, ..
Panayot
01-26-2012, 10:42 PM
speed, speed... is that the most important?
(for me) script controller == less troubles
denisT
01-27-2012, 12:47 AM
speed, speed... is that the most important?
(for me) script controller == less troubles
for me script controller is always headache.
Mackinder
01-27-2012, 12:55 AM
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.
denisT
01-27-2012, 01:23 AM
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.
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:%\n" (timestamp() - t1) (m1 - heapfree)
gc()
t1 = timestamp()
m1 = heapfree
for k=1 to 10000 do b3.rotation
format " wire >> time:% memory:%\n" (timestamp() - t1) (m1 - heapfree)
)
excuse me I have a pipeline to rebuild :eek:
Mackinder
01-27-2012, 10:55 PM
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.
denisT
01-27-2012, 11:14 PM
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
Mackinder
01-27-2012, 11:32 PM
$.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.
denisT
01-28-2012, 12:13 AM
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.upper_limit [#Limited_Controller__Bezier_Float].controller
ps. in my code there is no space after upper_limit. it's this forum bug.
Mackinder
01-28-2012, 12:28 AM
no... you are looking again in wrong place. you have to check
refs.dependents $.pos.controller.Y_Position.controller.upper_limit [#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
denisT
01-28-2012, 01:10 AM
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
Mackinder
01-28-2012, 01:19 AM
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
Aye I've not got a space.
Here's a shot of exactly how I'm executing that line:
http://dl.dropbox.com/u/21050664/joystickTroubles.JPG
denisT
01-28-2012, 01:28 AM
well... what did you connect? show me your wire connection script.
Mackinder
01-28-2012, 01:37 AM
well... what did you connect? show me your wire connection script.
Sure no problem.
paramWire.connect pickJS.object.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float] pickMesh.object.modifiers[#Morpher][(selectedMorph)](toExpression)
There's no space between "controller" and "[#Limi.." obviously. Also although we've just been looking at code for Y_Position this is just the first example of the connection in the script.
Thanks again man.
denisT
01-28-2012, 01:42 AM
Sure no problem.
paramWire.connect pickJS.object.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float] pickMesh.object.modifiers[#Morpher][(selectedMorph)](toExpression)
There's no space between "controller" and "[#Limi.." obviously. Also although we've just been looking at code for Y_Position this is just the first example of the connection in the script.
Thanks again man.
so you have to ask dependents of:
pickJS.object.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float].controller
Mackinder
01-28-2012, 01:50 AM
so you have to ask dependents of:
pickJS.object.pos.controller.X_Position.controller[#Limited_Controller__Bezier_Float].controller
But then goes back to returning:
#(Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
Which doesn't indicate any reference to the morph target. Am I missing a step here?
Cheers.
denisT
01-28-2012, 01:59 AM
But then goes back to returning:
#(Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
Which doesn't indicate any reference to the morph target. Am I missing a step here?
Cheers.
what does refs.dependson say about the same controller?
Mackinder
01-28-2012, 02:16 AM
what does refs.dependson say about the same controller?
Bugger, I was entering in the wrong position in the post before; it's actually returning:
#(Controller:Float_Wire, ReferenceTarget:ParamBlock, Morpher:Morpher, ReferenceTarget:ModApp, ReferenceTarget:DerivedObject, $PolyMesh:Teapot001 @ [-63.105194,0.000000,0.000000], Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
So it is now referencing the Morher, but not the slot.
If I change it to dependson then I get an empty array returned.
denisT
01-28-2012, 02:40 AM
Bugger, I was entering in the wrong position in the post before; it's actually returning:
#(Controller:Float_Wire, ReferenceTarget:ParamBlock, Morpher:Morpher, ReferenceTarget:ModApp, ReferenceTarget:DerivedObject, $PolyMesh:Teapot001 @ [-63.105194,0.000000,0.000000], Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
So it is now referencing the Morher, but not the slot.
If I change it to dependson then I get an empty array returned.
fine! now you can ask dependents of first item of this array:Controller:Float_Wire
it has to show you some morpher controller... maybe the name of controller will say you a slot. or you can search it going throuпh all slots.
Mackinder
01-28-2012, 12:26 PM
fine! now you can ask dependents of first item of this array:Controller:Float_Wire
it has to show you some morpher controller... maybe the name of controller will say you a slot. or you can search it going throuпh all slots.
Okay so...
refs.dependents $.pos.controller.Y_Position.controller [#Limited_Controller__Bezier_Float].controller
Which returns:
#(Controller:Float_Wire, ReferenceTarget:ParamBlock, Morpher:Morpher, ReferenceTarget:ModApp, ReferenceTarget:DerivedObject, $PolyMesh:Teapot001 @ [-57.893250,0.000000,0.000000], Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
So then I store that result in an array with:
testArray = refs.dependents $.pos.controller.Y_Position.controller[#Limited_Controller__Bezier_Float].controller
Refs.dependents testArray[1] results in:
#(ReferenceTarget:ParamBlock, Morpher:Morpher, ReferenceTarget:ModApp, ReferenceTarget:DerivedObject, $PolyMesh:Teapot001 @ [-57.893250,0.000000,0.000000])
Am I going about this the wrong way? I feel like I'm missing something here. Sorry for not grasping this better, I'm really grateful for your help.
denisT
01-28-2012, 07:08 PM
Okay so...
refs.dependents $.pos.controller.Y_Position.controller [#Limited_Controller__Bezier_Float].controller
Which returns:
#(Controller:Float_Wire, ReferenceTarget:ParamBlock, Morpher:Morpher, ReferenceTarget:ModApp, ReferenceTarget:DerivedObject, $PolyMesh:Teapot001 @ [-57.893250,0.000000,0.000000], Controller:Float_Limit, Controller:Position_XYZ, Controller:Position_Rotation_Scale, $Circle:JoystickNameCircleController @ [0.000000,0.000000,0.000000], ReferenceTarget:NodeSelection, ReferenceTarget:ReferenceTarget)
So then I store that result in an array with:
testArray = refs.dependents $.pos.controller.Y_Position.controller[#Limited_Controller__Bezier_Float].controller
...
Am I going about this the wrong way? I feel like I'm missing something here. Sorry for not grasping this better, I'm really grateful for your help.
after you have Float_Wire controller (it's testArray[1]) you can get its slave controller:
slave = testArray[1].slaveAnimation
Mackinder
01-28-2012, 10:44 PM
after you have Float_Wire controller (it's testArray[1]) you can get its slave controller:
slave = testArray[1].slaveAnimation
Hey man, cheers for continuing to help me. After asking for the slaveAnimation I'm given the result of "Controller:Bezier_Float"?
denisT
01-28-2012, 11:05 PM
Hey man, cheers for continuing to help me. After asking for the slaveAnimation I'm given the result of "Controller:Bezier_Float"?
there is some misunderstanding. i don't see any block. everything is obvious.
here is how i see the picture:
#you have master wire controller
#you want to know what the master controls
#you can get slave controller
...
why is it not simple to run through all mopher's slot controllers to get the searched one?
Mackinder
01-28-2012, 11:43 PM
there is some misunderstanding. i don't see any block. everything is obvious.
here is how i see the picture:
#you have master wire controller
#you want to know what the master controls
#you can get slave controller
...
why is it not simple to run through all mopher's slot controllers to get the searched one?
Oh I see! I was expecting to see a direct result from the controller itself, I didn't realise I was finding something to match. D'oh!
I don't have Max in front of me now, but I presume I'd run code that checks it something along the lines of:
if refs.dependson myObject.morpher[1].controller == slave then print "YES" else "NO"
Cheers man.
Mackinder
01-30-2012, 10:32 PM
there is some misunderstanding. i don't see any block. everything is obvious.
here is how i see the picture:
#you have master wire controller
#you want to know what the master controls
#you can get slave controller
...
why is it not simple to run through all mopher's slot controllers to get the searched one?
Hey man, I got a chance to get back to this and this works a charm.
Working back from the slave I've found using ref.dependents I can then find the mesh it's working with.
Which is perfect.
Thanks again man!
:bowdown:
CGTalk Moderation
01-30-2012, 10:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.