Implement multi-input OFX clip wiring and texture handling

Store PluginJob input values for lookup
Add per-clip texture inputs on plugin nodes
Map input clips to textures during render (with Source fallback)
This commit is contained in:
2026-01-04 22:30:41 +08:00
parent 7c0f37b0a7
commit f191486375
31 changed files with 1147 additions and 130 deletions
+2
View File
@@ -1303,6 +1303,8 @@ signals:
void KeyframeTimeChanged(NodeKeyframe *key);
void MessageCountChanged();
void KeyframeTypeChanged(NodeKeyframe *key);
void KeyframeValueChanged(NodeKeyframe *key);
+24 -2
View File
@@ -24,6 +24,7 @@ olive::plugin::PluginNode::PluginNode(
OFX::Host::ImageEffect::Instance *plugin)
{
plugin_instance_=plugin;
bool has_texture_input = false;
auto params=plugin_instance_->getParams();
for (auto param: params) {
@@ -70,6 +71,17 @@ olive::plugin::PluginNode::PluginNode(
AddInput(param.second->getName().data(), type);
}
const auto &clips = plugin_instance_->getDescriptor().getClips();
for (const auto &entry : clips) {
if (entry.first == kOfxImageEffectOutputClipName) {
continue;
}
AddInput(entry.first.data(), NodeValue::kTexture);
has_texture_input = true;
}
if (!has_texture_input) {
AddInput(kTextureInput, NodeValue::kTexture);
}
}
QString olive::plugin::PluginNode::Name() const
{
@@ -94,9 +106,19 @@ void olive::plugin::PluginNode::Value(const NodeValueRow &value,
const NodeGlobals &globals,
NodeValueTable *table) const
{
TexturePtr tex = value[kTextureInput].toTexture();
TexturePtr tex = value.value(kTextureInput).toTexture();
if (!tex) {
for (auto it = value.cbegin(); it != value.cend(); ++it) {
if (it.value().type() == NodeValue::kTexture) {
tex = it.value().toTexture();
if (tex) {
break;
}
}
}
}
if (tex && plugin_instance_) {
PluginJob job(plugin_instance_, value);
PluginJob job(plugin_instance_, this, value);
table->Push(NodeValue::kTexture, tex->toJob(job), this);
}
}
+1
View File
@@ -20,6 +20,7 @@
#define PLUGIN_NODES_H
#include "ofxhImageEffectAPI.h"
#include "ofxhPluginCache.h"
#include "ofxImageEffect.h"
#include "node/node.h"
namespace olive
+8 -2
View File
@@ -382,7 +382,7 @@ TexturePtr NodeTraverser::ProcessVideoCacheJob(const CacheJob *val)
return nullptr;
}
TexturePtr NodeTraverser::ProcessPluginJob(plugin::PluginJob *job)
TexturePtr NodeTraverser::ProcessPluginJob(TexturePtr texture, TexturePtr destination, const Node *node,)
{
// TODO
}
@@ -496,7 +496,13 @@ void NodeTraverser::ResolveJobs(NodeValue &val)
val.set_value(tex);
}
else if (plugin::PluginJob* plugin_job=dynamic_cast<plugin::PluginJob*>(base_job)) {
ProcessPluginJob(plugin_job);
VideoParams tex_params = job_tex->params();
TexturePtr tex = CreateTexture(tex_params);
ProcessPluginJob(job_tex, tex, val.source());
val.set_value(tex);
}
// Cache resolved value
+1 -1
View File
@@ -144,7 +144,7 @@ protected:
return SampleBuffer();
}
virtual TexturePtr ProcessPluginJob(plugin::PluginJob *job);
virtual TexturePtr ProcessPluginJob(TexturePtr texture, TexturePtr destination, const Node *node);
SampleBuffer CreateSampleBuffer(const AudioParams &params,
const rational &length)
{