DavidJaramillo
04-09-2009, 01:56 PM
Hello,
I'm working on a scene where I've used the Hermite function to create some lightning effects....
I'm building a UI to control the wavelength, frequency, speed, and radius of the particles and am having trouble while passing variables from my procedures in the script editor to the PP values in the expressions on the particles. The code for the UI is pretty straightforward with floatSliderGrp's for the inputs, so I'll just post an example of the procedures here:
global proc getSpeed(){
global float $inSpeed=0;
$inSpeed = `floatSliderGrp -q -value "speedSldr"`;
setSpeed $inSpeed;
}//end getSpeed
global proc setSpeed(float $inSpeed){
dynExpression -s "lightningHermitePShape.lifespanPP = $inSpeed;" -c
lightningHermitePShape;
}//end setSpeed
This code puts the string "$inSpeed", not the value contained in $inSpeed, into the value for lifeSpanPP which is what I am trying to fill with the input from the UI slider. I made the variable $inSpeed global because I was getting "variable $inSpeed is undeclared" errors when it was not global since it was not declared in the expression.
(As a side note)
As of now I'm using a button to insert the values (or incorrect strings in my case so far) into the expressions, but would like them to be inserted dynamically as the simulation is running. So I could scrub through the sliders to see the changes in real time. I'm not sure of how to do this though.
Any help and ideas would be greatly appreciated. I thank you in advance for any help you can offer.
Take Care,
Dave Jaramillo
I'm working on a scene where I've used the Hermite function to create some lightning effects....
I'm building a UI to control the wavelength, frequency, speed, and radius of the particles and am having trouble while passing variables from my procedures in the script editor to the PP values in the expressions on the particles. The code for the UI is pretty straightforward with floatSliderGrp's for the inputs, so I'll just post an example of the procedures here:
global proc getSpeed(){
global float $inSpeed=0;
$inSpeed = `floatSliderGrp -q -value "speedSldr"`;
setSpeed $inSpeed;
}//end getSpeed
global proc setSpeed(float $inSpeed){
dynExpression -s "lightningHermitePShape.lifespanPP = $inSpeed;" -c
lightningHermitePShape;
}//end setSpeed
This code puts the string "$inSpeed", not the value contained in $inSpeed, into the value for lifeSpanPP which is what I am trying to fill with the input from the UI slider. I made the variable $inSpeed global because I was getting "variable $inSpeed is undeclared" errors when it was not global since it was not declared in the expression.
(As a side note)
As of now I'm using a button to insert the values (or incorrect strings in my case so far) into the expressions, but would like them to be inserted dynamically as the simulation is running. So I could scrub through the sliders to see the changes in real time. I'm not sure of how to do this though.
Any help and ideas would be greatly appreciated. I thank you in advance for any help you can offer.
Take Care,
Dave Jaramillo
