in my plugin, I have a PrefsDialogObject. After the user changed something in those preferences, I need to notify all my plugin objects in all open documents. What's the best way of doing this?
I'd go for SpecialEventAdd.
That would work... if NodeDatas would receive CoreMessages
Ah yea, my bad. You were talking about objects, not GUI.
Maybe implement a Scenehook that notifies all objects in question.
Yeah, I thought about a SceneHook, too. But if that scene hook would only iterate over the objects in the document and send a message to each object of the desired type, I can simply do that from within the PrefsDialogObject.
I was hoping for some message-based approach that would spare me more code
Maybe the SDK Team has an idea(@r_gigante )? If I could just have all object in the scene receive a message like MSG_MYPREFSHAVECHANGED, that would be nice.
Oh wait, I think I found a way. In case anybody else wants to know, here it is...
In the PrefsDialogObject:
Bool MyPrefsDialog::SetDParameter(GeListNode *node, const DescID &id,const GeData &t_data,DESCFLAGS_SET &flags)
BaseContainer* bc = MyPlugin::GetPreferences();
SUPER::SetDParameter(node, id, t_data, flags);
// If PREFS_MYPLUGIN_SOMEVALUE was changed, store value and notify plugin objects in all open documents.
flags |= DESCFLAGS_SET::PARAM_SET;
// Iterate open documents
for (BaseDocument *doc = GetFirstDocument(); doc; doc = doc->GetNext())
// Send broadcast message to each document, use unique ID
doc->MultiMessage(MULTIMSG_ROUTE::BROADCAST, MyPlugin::UNIQUE_ID_PREFS, nullptr);
return SUPER::SetDParameter(node, id, t_data, flags);
And then, in the plugin object:
Bool MyPluginObject::Message(GeListNode *node, Int32 type, void *data)
if (type == MyPlugin::UNIQUE_ID_PREFS)
GePrint("Aha! My prefs have changed!"_s);
return SUPER::Message(node, type, data);