Re: question on refreshing parameter data between instances.
Re: question on refreshing parameter data between instances.
- Subject: Re: question on refreshing parameter data between instances.
- From: Darrin Cardani <email@hidden>
- Date: Thu, 13 Aug 2009 15:03:46 -0700
On Aug 13, 2009, at 12:38 PM, Brian Gardner wrote:
There is no issue until the user decides to alter a global value
by changing a parameter value.
That parameter change will in turn update the corresponding global
value, stored in the singleton.
At this point, all of the other plugin instances set to
useGlobalValues will have a parameter
value that still is set to the old global value, except the one that
the user has just changed.
So, the change must be rippled to all of the other instances of the
plugin.
Normally, I'd expect to do this by having the singleton maintain an
array
to keep track of the relevant plugin instance id's. Toggling an
instance's useGlobalValues
parameter, would add/remove it from the singleton's array.
The singleton could loop through this array, to send a message to
each managed plugin instance
to perform a setParameter, to reflect whenever a global value changed.
But... just after an 'open project', the id's are not the same as in
the previous session (I think),
and the singleton has an empty array anyway (singleton data wasn't
seralized).
So, this array would need to be reconstructed somehow after the
'project open'.
Since the deserialization of the useGlobalValues parameter bypasses
ParameterChanged,
it never invokes the singleton. So the singleton can't build a list of
the relevant plugin instance's new id's.
Perhaps, I can replace the toggle with a 'custom parameter' toggle,
just so that i can trap the deserialization? Then I could (re)build
a new array upon project open.
Rather than having an array and trying to keep it in synch, what would
probably be better is to use NSNotifications. When a plugin is set for
global values, it tells the Notification Center that it wants to
receive notifications from the singleton. When the singleton makes a
change it tells the Notification Center to notify everyone who wanted
to be notified of changes. That way, neither the plugins nor the
singleton actually have to track each other.
Actually, the user wants these globals to be scoped to the sequence.
Almost like a Sequence Setting (but with easier access, since the
globals are changed more often).
Unfortunately, I can't figure out how to do that.
So, the best I can do is using a singleton ... which is
probably Project scoped, which is acceptable.
Though, if the user can open multiple projects in one session,
then it's probably not even project scoped, it's probably session
scoped.
(Session scoped is also not very desirable, either.)
Certainly, somehow, these global settings must be scoped and stored
within the Project file.
Yes, if you create a singleton, it is application scoped, actually. It
exists in the app's address space and would be used by all instances
which request it.
We don't currently have a way for plugins to know about the sequence
or project to which they are applied. It's been requested on a few
occasions, but we haven't implemented it yet. Feel free to file a
feature request. And let us know how you think it should work, too.
Darrin
--
Darrin Cardani
email@hidden
_______________________________________________
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