[Closed] parameter wiring
I am trying to figure out parameter wiring here is a sample script:
rollout myroll "s" width:100 height:100
(
local newcontroller,mycontroller,mybox
spinner myspin "s"
on myroll open do
(
mycontroller = bezier_float name:"1"
newcontroller = bezier_float name:"2"
mybox = box name:"3"
mybox.height.controller = newcontroller
myspin.controller = mycontroller
--paramwire.connect2Way mycontroller newcontroller "value /2 " "value * 2"
)
)
createdialog myroll
I can set up a wire parameter between 2 object in the scene easily enough. But what are the parameters here ? as neither mycontroller or newcontroller were originally linked to an object what is their #value to link, and what to do for the expression?
I am trying to link radius of a circle to area of a circle in a spinner so that there is a 2 way link.
parameter wiring is for connecting of two subanims. you can’t connect controllers without subanim.
but you can use script or expression controller instead
something like this:
try (destroydialog ConnectControllers) catch()
rollout ConnectControllers "Connect Controllers" width:200
(
spinner sp "Sin Height: " fieldwidth:56 range:[-1e9,1e9,0] align:#right
local b
on ConnectControllers open do
(
delete objects
b = box width:10 length:10 height:0 wirecolor:orange
s = sp.controller = bezier_float()
h = b.height.controller = float_script()
h.AddObject "hsin" s
h.SetExpression "(sin hsin.value)*10"
)
)
createdialog ConnectControllers
thanks for the repyl
I previously tried using an expression controller on the spinner that was pi*r^2 so I could set up a 2 way connection, so on the modifier panel I could changes the size, and the spinner I could change the area. I found that the Spinner in the rollout updated from the modifier panel, but not visa-versa. The script controller in your example over-rides the modifier panel controller, and is not usable.
I did notice that if I set up 2 objects and wired them together with a 2way mathematical link, and then I linked the spinner to the 2nd objects dependent value, that the spinner would change the radius and changing the radius in the modifier panel would change the area.
I am using this “on the fly” as the scene may have multiple circles and there is a listbox to select them, as well as in the viewport. So using the spinner valuechanged event was leading to problems of “which item is being changed?” the one selected in the viewport, or the listbox or by the “current item” to which the spinner event was linked.
I hit upon the wire-parameters idea because if I wire the spinner to the parameter of the item selected by the listbox and make it selected with clicking the listbox it narrows it down the possiblities. At least that was my thinking. Cuts down on code to…
Switching between objects I just had to ‘spinner.controller = undefined’ before applying the new link.
I think there is a flaw in my logic about selected item…so i’ll give it some more thought.
Is there another way to link object mathematically and have both the object and the dependant modifiable?
Sorry about the wordy question.
imo… this my help you…
are you asking about a two-way parameter connection?
ok. tell us what you want to do exactly. give us an example