On Sep 25, 2007, at 4:29 PM, Darrin Cardani wrote: On Sep 25, 2007, at 3:13 PM, Steve Christensen wrote: On Sep 24, 2007, at 8:37 AM, Darrin Cardani wrote: On Sep 24, 2007, at 5:41 AM, Benjamin Kent wrote: I've created a custom parameter push button using the NSButton class. Is there any way to force my plug-in to render in response to a user clicking on the push button? One way would be to add a hidden parameter and change its value in the push button callback, but this seems a little inelegant - is there a way to just signal to the host that it needs to update?
You shouldn't need to add an additional parameter. Just create some data (say a single byte) for the custom parameter, and when the user pushes the button, change the value of the byte just as you would if there was real data there.
My understanding is that the custom parameters take an object as their value. Wouldn't I need to create a new dummy value and pass it to -setCustomParameterValue:toParm:, then?
Yes. I just meant that you don't need a complex object. You could use an NSInteger, and change the value from 0 to 1 or back each time. Note that there is a bug in the currently shipping version of Motion which causes the document not to notice when custom parameters have changed. That has been fixed for the next release.
So, to get the correct behavior with existing versions of Motion, would it be better to follow the OP's suggestion of having a hidden parameter that is there just to force a render?
Yes, that's certainly an option. If you're targeting 2.x, that's probably the way to do it. If you're targeting 3.x or later, I recommend doing it the correct way and having customers update to the fixed version of Motion (once it's released). You could conditionalize your code based on the version number, if you need to support both.
So, I tried playing with parameters to get Motion to re-render but no joy. I have a modal configuration panel that I display in response to clicking on a button. When the user chooses OK, I stop the modal event loop, then do the following:
[paramActionAPI startAction:self]; gRenderWhackerValue = !gRenderWhackerValue; [setParamAPI setCustomParameterValue:[NSNumber numberWithBool:gRenderWhackerValue] toParm:kParameterIDConfigButton]; [setParamAPI setBoolValue:gRenderWhackerValue toParm:kParameterIDHiddenRenderWhacker atTime:[paramActionAPI currentTime]]; [paramActionAPI endAction:self];
I tried having both the custom parameter (the button) and a hidden boolean parameter to try to cover all bases in working around the Motion bug Darrin mentioned. I put a NSLog call in the method that handles my OK button as well asĀ -frameSetup:hardware:, -frameCleanup and -renderOutput:withInfo:. When I click OK, I see that the OK method is called, but nothing after that. Any further pearls of wisdom?
steve
|