Getting Variable into Expression Controller

Getting Variable into Expression Controller

Anonymous
Not applicable
472 Views
1 Reply
Message 1 of 2

Getting Variable into Expression Controller

Anonymous
Not applicable
Hi
I've create a dialog with a spinner and I want to get the spinner.value into the expression controller how can I do it ?
0 Likes
473 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
If you create an external controller then assign it to the spinner and to a dummy object, you'll be able to access that controller from the Expression dialog.
eg

-- Create a dummy rollout
rollout testRoll "Test"
(
spinner testSpinner range: type:#float
)

-- Create a Bezier Float controller, this will control the spinner and the X Position of the dummy
spinnerController = Bezier_Float()

-- Create the dialog with the spinner, the spinner value should be 5.5 at this stage
createDialog testRoll width: 100 height:100

-- Set the Controller value to 6.0, spinner is still 5.5, as the controller isn't linked
spinnerController.value = 6.0

-- Set the spinner controller to the controller we just created, the spinner value is now 6.0
testRoll.testSpinner.controller = spinnerController

-- Create a dummy object and assign it's X-Axis position controller the same controller as the spinner
-- We only do this because controllers that aren't assigned to objects are not accessible from the Expression dialog
dummy01 = dummy()
dummy01.pos.X_Position.controller = spinnerController


You could probably access the controller without going through the dummy if you're scripting the expression directly, but this is a hacky workaround
0 Likes