CGMATLAM
01-06-2009, 04:24 PM
Quick Question about Scripted Custom Attributes and wiring. I have been able to use a scripted custom attribute with a spinner UI to control a parameter, say the radius of a circle but I havent't been able to get it to work the other way around , and use the radius of the circle to control the scripted custom attribute. It seems to only work when the CA parameter is the master in the wiring.
I set up a simple test script where I have a boxes x position being = to a float Custom attribute parameter with a spinner UI .
The on Parameter set val do ( ) work fine via direct manipulation of the spinner interface for the parameter. The x position of the box is controlled by the spinner.
Actually when the Custom attribute parameter is wired with the sphere being the master, the spinner of the Parameter of the Scripted Custom attribute will change as the radius parameter of the sphere changes, but the commands that are contained in the
on Parameter set val do ( ) , will not execute , when the radius value of the sphere is changed. So the x position of the box does not change.
I have tried setting up the wire using the normal right click method and also using the scripted method and in both cases I can only get it to work in one direction with the Scripted custom attribute parameter controlling the sphere radius
Does the parameter wiring only work one way with scripted Custom Attributes.
Here is the code for the setup of the custom attribute and the wiring. You may recognize this from a previous post by Paule Neale on Scripted wiring. I have used it to make sure that I am getting the wiring code right since his script works perfectly. I have only added the set val section for controlling the X position of the box.
b=box()
s=sphere()
eM=emptyModifier()
addModifier b eM
def=attributes testAttrib
(
parameters testP rollout:testR
(
animationTrack type:#float UI:mySpinner
on animationTrack set val do
(
b.pos.x = val * 10
)
)
rollout testR "test"
(
spinner mySpinner "My Spinner"
)
)
custAttributes.add eM def
paramWire.connect eM.testAttrib[#animationTrack] s.baseObject[#radius] "animationTrack"
max modify mode
select b
If you run the above everything will work fine The boxes x position will be controlled by its animation track spinner , and the sphere radius will be controlled by the box animation track parameter spinner.
But if you then change the wiring so that the Custom attribute is being controlled by the
Sphere radius the Spinner of the Boxes Animation track parameter will update , but the box will not move in the position x.
Thank you.
I set up a simple test script where I have a boxes x position being = to a float Custom attribute parameter with a spinner UI .
The on Parameter set val do ( ) work fine via direct manipulation of the spinner interface for the parameter. The x position of the box is controlled by the spinner.
Actually when the Custom attribute parameter is wired with the sphere being the master, the spinner of the Parameter of the Scripted Custom attribute will change as the radius parameter of the sphere changes, but the commands that are contained in the
on Parameter set val do ( ) , will not execute , when the radius value of the sphere is changed. So the x position of the box does not change.
I have tried setting up the wire using the normal right click method and also using the scripted method and in both cases I can only get it to work in one direction with the Scripted custom attribute parameter controlling the sphere radius
Does the parameter wiring only work one way with scripted Custom Attributes.
Here is the code for the setup of the custom attribute and the wiring. You may recognize this from a previous post by Paule Neale on Scripted wiring. I have used it to make sure that I am getting the wiring code right since his script works perfectly. I have only added the set val section for controlling the X position of the box.
b=box()
s=sphere()
eM=emptyModifier()
addModifier b eM
def=attributes testAttrib
(
parameters testP rollout:testR
(
animationTrack type:#float UI:mySpinner
on animationTrack set val do
(
b.pos.x = val * 10
)
)
rollout testR "test"
(
spinner mySpinner "My Spinner"
)
)
custAttributes.add eM def
paramWire.connect eM.testAttrib[#animationTrack] s.baseObject[#radius] "animationTrack"
max modify mode
select b
If you run the above everything will work fine The boxes x position will be controlled by its animation track spinner , and the sphere radius will be controlled by the box animation track parameter spinner.
But if you then change the wiring so that the Custom attribute is being controlled by the
Sphere radius the Spinner of the Boxes Animation track parameter will update , but the box will not move in the position x.
Thank you.
