[Closed] animating scripted material params
Hi,
can someone explain why if i animate (set keyframes) variable trans in the example below, delegate.opacity won’t animate while the transparancy spinner animates just fine? I must be missing something but i can’t seem to solve it
thnx,
Obi
plugin material myGlass
name:“Supa Glass”
classID:#(695425,446581)
extends:Standard replaceUI:false version:1
(
parameters main rollout:params
(
trans type:#float default:27 ui:trans
on trans set val do
(
delegate.opacity = val
)
)
rollout params “Glass Parameters”
(
spinner trans “Transparency: ” fieldwidth:45 offset:[-90,0]
)
on create do
(
delegate.opacityFalloff = 75
)
)
hi Obi,
hmmm, seems to work here! When I animate your custom spinner ‘Transparency’ it animates both your spinner and the delegate.opacity tracks. Have I mis-understood?
Incidentally you should contain your script is CODE tags so you down inadvertently blow raspberries at potential helpers LOL
Oh, and I think maybe you should declare your variable as animatable:ie
trans type:#float default:27 ui:trans animatable:true
I am on Max8.1 BTW but this shouldn’t make any difference.
J.
Hi J_man,
just to be sure, I load this new material into the material editor and then go to trackview and set 2 keyframes for trans. In that case the trans spinner animates but not the delegate.opacity value.
yah, I just noticed, thx, for explaining that ;o)
that doesn’t make any difference here, maybe i should try for max 8.1 which is on the plank here, or can you think of anything else?
thnx,
Obi
Ah,
I see what’s happening. I’m animating the spinner, you’re key in the trackview. I don’t think the scripted plugin offers you a instanced track like what you’re expecting, so if place a key on the delegate materials transparency track, it wont update your custom track.
If however, you replace the UI then the user will be forced to place keys in your custom spinner, which will animate the delegate materials control.
Does that make sense?
Josh. (couldn’t resist)
Josh,
actually it’s the other way around, I am keying the custom track (trans) and would expect the delegate track to update with it in animation. But somehow moving the timeSlider does change the custom track but does not trigger an event, I think that is why the delegate track won’t update in animation.
I updated to MAX 8.1 today which didn’t help either so I am still trying to find a way to make this work…
thnx,
Obi
Hey J-man,
I found a solution for the simple case below. Upon creation I can create a track controller for trans and copy that to the delegate track, effectively this creates an instance. So now I can just key the trans track.
Obviously this wouldn’t work if there was a relationship between trans and delegate.opacity other than trans = delegate.opacity. If that were the case I would probably have to install scripted controllers for the delegate tracks, which would be depending on my custom tracks. So that’s what I’ll be researching now.
thnx for doublechecking the problem and let me know if you think of anything else I should try!
Obi
plugin material myGlass
name:"Supa Glass"
classID:#(695425,446581)
extends:Standard replaceUI:false version:1
(
parameters main rollout:params
(
trans type:#integer default:27 ui:trans animatable:true
on trans set val do
(
delegate.opacity = val
)
)
rollout params "Glass Parameters"
(
spinner trans "T: " type:#integer animatable:true
)
on create do
(
[size=1]
trans.controller = bezier_float()
delegate.opacity.controller = trans.controller
)
)
[/size]