From 0dc7729051d0978cb4c0fa1d1a91caf0fa25bd75 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 12 Sep 2025 17:33:51 +0800 Subject: [PATCH] add: some plugin support. --- app/node/plugins/Plugin.h | 2 +- app/pluginSupport/OliveInstance.cpp | 43 +++++++++++++++++++++++++++++ app/pluginSupport/OliveInstance.h | 17 +++++++++++- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/app/node/plugins/Plugin.h b/app/node/plugins/Plugin.h index 457a0ece8..5e69358dc 100644 --- a/app/node/plugins/Plugin.h +++ b/app/node/plugins/Plugin.h @@ -35,7 +35,7 @@ public: explicit PluginNode(struct olive_node_methods methods):Node() { this->methods=methods; - }PLUGIN_H + } void setMethods(struct olive_node_methods methods) { this->methods=methods; diff --git a/app/pluginSupport/OliveInstance.cpp b/app/pluginSupport/OliveInstance.cpp index bac1cd081..7c3177df8 100644 --- a/app/pluginSupport/OliveInstance.cpp +++ b/app/pluginSupport/OliveInstance.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include namespace olive{ @@ -59,6 +60,48 @@ OfxStatus OliveInstance::vmessage(const char* type, return kOfxStatOK; } } +OfxStatus OliveInstance::setPersistentMessage(const char* type, + const char* id, + const char* format, + va_list args){ + char *buffer=new char[1024]; + memset(buffer, 0, 1024*sizeof(char)); + int ret=vsprintf(buffer, format, args); + if(ret<0){ + return kOfxStatFailed; + } + QString message(buffer); + + delete [] buffer; + + // If This is a error message + if(strncmp(type, kOfxMessageError, strlen(kOfxMessageError))==0){ + persistentErrors_.append({ErrorType::Error, message}); + QMessageBox::critical(nullptr, "", message); + // TODO: tell the shell to show the error + } + // A warning + else if(strncmp(type, kOfxMessageWarning, strlen(kOfxMessageError))==0){ + persistentErrors_.append({ErrorType::Warning, message}); + QMessageBox::warning(nullptr, "", message); + // TODO: tell the shell to show the warning + + } + // A simple information + else if(strncmp(type, kOfxMessageMessage, strlen(kOfxMessageError))==0){ + persistentErrors_.append({ErrorType::Message, message}); + QMessageBox::information(nullptr, "", message); + } + else{ + return kOfxStatFailed; + } + return kOfxStatOK; +} +OfxStatus OliveInstance::clearPersistentMessage(){ + persistentErrors_.clear(); + // TODO: tell the shell to remove message. + return kOfxStatOK; +} } } diff --git a/app/pluginSupport/OliveInstance.h b/app/pluginSupport/OliveInstance.h index 6522efa6d..2ae62b768 100644 --- a/app/pluginSupport/OliveInstance.h +++ b/app/pluginSupport/OliveInstance.h @@ -16,10 +16,24 @@ * along with this program. If not, see . */ +#include "ofxCore.h" #include "ofxImageEffect.h" +#include #include "ofxhImageEffect.h" +#include +#include +#include namespace olive { namespace plugin{ +enum class ErrorType{ + Error, + Warning, + Message +}; +struct PersistentErrors{ + ErrorType type; + QString message; +}; class OliveInstance : public OFX::Host::ImageEffect::Instance { public: OliveInstance( @@ -51,7 +65,8 @@ public: va_list args) override; OfxStatus clearPersistentMessage() override; - +private: + QList persistentErrors_; }; }