From 9c72afe1662c7316785cbc24b2d0feb983b35bdb Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Tue, 6 May 2025 14:58:58 -0400 Subject: [PATCH 1/2] Require hosts to call instanceChanged action after loading project Fixes #184. Signed-off-by: Gary Oberbrunner --- include/ofxCore.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/include/ofxCore.h b/include/ofxCore.h index 772826ef..5458e652 100644 --- a/include/ofxCore.h +++ b/include/ofxCore.h @@ -321,9 +321,24 @@ These are the actions passed to a plug-in's 'main' function /** @brief - This action is the first action passed to a plug-in's - instance after its creation. It is there to allow a plugin to create any - per-instance data structures it may need. + Called when an instance of a plugin is created by the host. The plugin can + create any per-instance data structures it may need. Plugins may also + enable/disable their params here, based on other param values or clips. + + When a host creates a plugin instance from a saved project with a connected + clip, the host must either: + + - connect all params and clips to an effect *before* calling createInstance, + and support the \ref OfxTimeLineSuite so the effect can call + \ref OfxTimeLineSuiteV1::getTime in createInstance (so the plugin can call + \ref OfxImageEffectSuiteV1::clipGetRegionOfDefinition), + +OR: + + - call `instanceChanged` after `createInstance` and after the host has + hooked up all clips, with property \ref kOfxPropType = \ref kOfxTypeClip and + \ref kOfxPropChangeReason = \ref kOfxChangePluginEdited, and ensure that + \ref OfxImageEffectSuiteV1::clipGetRegionOfDefinition works in that action. @param handle handle to the plug-in instance, cast to an \ref OfxImageEffectHandle @param inArgs is redundant and is set to NULL @@ -399,6 +414,13 @@ These are the actions passed to a plug-in's 'main' function used to determine what was the thing inside the instance that was changed. + Note: when a host loads a plugin instance from a saved project, if the input + clips are not connected at that time, the host must call `instanceChanged` + after \ref kOfxActionCreateInstance and after the host has hooked up all clips, with + property \ref kOfxPropType = \ref kOfxTypeClip and \ref kOfxPropChangeReason = + \ref kOfxChangePluginEdited, and ensure that \ref OfxImageEffectSuiteV1::clipGetRegionOfDefinition works in + this action. + @param handle handle to the plug-in instance, cast to an \ref OfxImageEffectHandle @param inArgs has the following properties - \ref kOfxPropType The type of the thing that changed which will be one of.. From a692120ea1ffdc6a49c3846d935d41eeb9697658 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Thu, 8 May 2025 12:27:04 +0000 Subject: [PATCH 2/2] Require kOfxPropChangeReason=kOfxChangePluginEdited when clip changed on load Signed-off-by: Gary Oberbrunner --- include/ofxCore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ofxCore.h b/include/ofxCore.h index 5458e652..e40fe4e7 100644 --- a/include/ofxCore.h +++ b/include/ofxCore.h @@ -337,7 +337,7 @@ These are the actions passed to a plug-in's 'main' function - call `instanceChanged` after `createInstance` and after the host has hooked up all clips, with property \ref kOfxPropType = \ref kOfxTypeClip and - \ref kOfxPropChangeReason = \ref kOfxChangePluginEdited, and ensure that + \ref kOfxPropChangeReason = \ref kOfxChangeUserEdited, and ensure that \ref OfxImageEffectSuiteV1::clipGetRegionOfDefinition works in that action. @param handle handle to the plug-in instance, cast to an \ref OfxImageEffectHandle