Add OFX plugin support and related infrastructure
This commit extends the OFX plugin support in Olive by: - Initializing and scanning for OFX plugins - Updating PluginNode to handle OFX plugin parameters and inputs - Adding necessary methods and properties for OFX plugin integration - Enhancing NodeFactory to include OFX plugin nodes - Refactoring and renaming OliveInstance to OlivePluginInstance - Introducing new classes for parameter handling (ParamInstance) - Adding PluginJob for rendering OFX plugins - Adjusting CMakeLists.txt files to include new source files
This commit is contained in:
+70
-25
@@ -17,44 +17,89 @@
|
||||
*/
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
#include "render/rendermanager.h"
|
||||
#include "render/job/pluginjob.h"
|
||||
olive::plugin::PluginNode::PluginNode(
|
||||
OFX::Host::ImageEffect::ImageEffectPlugin *plugin)
|
||||
{
|
||||
this->plugin = plugin;
|
||||
auto params = plugin->getDescriptor().getParams();
|
||||
|
||||
for (auto param: params) {
|
||||
|
||||
NodeValue::Type type;
|
||||
|
||||
const std::string &ofxType = param.second->getType();
|
||||
if (ofxType == kOfxParamTypeInteger) {
|
||||
type = NodeValue::kInt;
|
||||
} else if (ofxType == kOfxParamTypeDouble) {
|
||||
type = NodeValue::kFloat;
|
||||
} else if (ofxType == kOfxParamTypeBoolean) {
|
||||
type = NodeValue::kBoolean;
|
||||
} else if (ofxType == kOfxParamTypeString) {
|
||||
type = NodeValue::kText;
|
||||
} else if (ofxType == kOfxParamTypeRGB ||
|
||||
ofxType == kOfxParamTypeRGBA) {
|
||||
type = NodeValue::kColor;
|
||||
} else if (ofxType == kOfxParamTypeChoice) {
|
||||
type = NodeValue::kCombo;
|
||||
} else if (ofxType == kOfxParamTypeDouble2D ||
|
||||
ofxType == kOfxParamTypeInteger2D){
|
||||
type = NodeValue::kVec2;}
|
||||
else if (ofxType == kOfxParamTypeDouble3D ||
|
||||
ofxType == kOfxParamTypeInteger3D){
|
||||
type = NodeValue::kVec3;
|
||||
} else if (ofxType == kOfxParamTypeStrChoice){
|
||||
type = NodeValue::kStrCombo;
|
||||
}else if (ofxType == kOfxParamTypeBytes
|
||||
|| ofxType == kOfxParamTypeCustom) {
|
||||
type = NodeValue::kBinary;
|
||||
} else {
|
||||
type = NodeValue::kNone;
|
||||
}
|
||||
|
||||
if (ofxType == kOfxParamTypePushButton) {
|
||||
// TODO
|
||||
} else if (ofxType == kOfxParamTypeGroup) {
|
||||
// TODO
|
||||
} else if (ofxType == kOfxParamTypePage) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
AddInput(param.second->getName().data(), type);
|
||||
}
|
||||
|
||||
}
|
||||
QString olive::plugin::PluginNode::Name() const
|
||||
{
|
||||
if (methods.name) {
|
||||
char buffer[64]={0};
|
||||
bool ok=methods.name(buffer, 64);
|
||||
if (ok) {
|
||||
return QString(buffer);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return plugin->getDescriptor()
|
||||
.getProps()
|
||||
.getStringProperty(kOfxPropLabel)
|
||||
.data();
|
||||
|
||||
}
|
||||
|
||||
QString olive::plugin::PluginNode::Description() const
|
||||
{
|
||||
if (methods.description) {
|
||||
char buffer[1024] = { 0 };
|
||||
bool ok = methods.description(buffer, 1024);
|
||||
if (ok) {
|
||||
return QString(buffer);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return plugin->getDescriptor().getProps().getStringProperty(kOfxPropPluginDescription).data();
|
||||
|
||||
}
|
||||
void olive::plugin::PluginNode::Value(const NodeValueRow &value,
|
||||
const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
methods.value(&node_ctx_functions);
|
||||
TexturePtr tex = value[kTextureInput].toTexture();
|
||||
if (tex) {
|
||||
PluginJob job(,value);
|
||||
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
QString olive::plugin::PluginNode::id() const
|
||||
{
|
||||
if (methods.id) {
|
||||
char buffer[64]={0};
|
||||
bool ok=methods.id(buffer, 64);
|
||||
if (ok) {
|
||||
return QString(buffer);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return plugin->getIdentifier().data();
|
||||
}
|
||||
Reference in New Issue
Block a user