Re: Forcing a render in response to custom parameter push
Re: Forcing a render in response to custom parameter push
- Subject: Re: Forcing a render in response to custom parameter push
- From: "Hugh Denman" <email@hidden>
- Date: Fri, 28 Sep 2007 13:15:23 +0100
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?
I use a similar method in some plugins and I find that a hidden float works better than a bool, as some hosts (Premiere Pro, for example; not sure about FCP or Motion) will cache multiple renders of a frame, with different parameter settings. So toggling the bool once should force a render, but the second time you toggle the host thinks that it's already seen the present frame rendered with this parameter value, and you don't get invoked on the render. So I incline to a hidden float that I increment by
0.1 every time the button is pushed. This is working for me in FCP at the moment.
Hugh
--
email@hidden+353876290136
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden