Merge remote-tracking branch 'origin/plugin' into plugin
# Conflicts: # ext/KDDockWidgets
This commit is contained in:
@@ -55,6 +55,10 @@ configure_file(ts/translations.qrc.in ts/translations.qrc @ONLY)
|
|||||||
set(OLIVE_RESOURCES
|
set(OLIVE_RESOURCES
|
||||||
${OLIVE_RESOURCES}
|
${OLIVE_RESOURCES}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ts/translations.qrc
|
${CMAKE_CURRENT_BINARY_DIR}/ts/translations.qrc
|
||||||
|
render/job/pluginjob.cpp
|
||||||
|
render/job/pluginjob.h
|
||||||
|
widget/nodeparamview/nodeparambutton.cpp
|
||||||
|
widget/nodeparamview/nodeparambutton.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add version object
|
# Add version object
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
#ifndef CURRENT_H
|
#ifndef CURRENT_H
|
||||||
#define CURRENT_H
|
#define CURRENT_H
|
||||||
|
#include "pluginSupport/OliveHost.h"
|
||||||
#include "render/videoparams.h"
|
#include "render/videoparams.h"
|
||||||
|
#include "render/job/pluginjob.h"
|
||||||
|
|
||||||
class Current {
|
class Current {
|
||||||
public:
|
public:
|
||||||
@@ -51,10 +53,36 @@ public:
|
|||||||
{
|
{
|
||||||
currentAudioParams_ = params;
|
currentAudioParams_ = params;
|
||||||
}
|
}
|
||||||
|
bool interactive()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<olive::plugin::OliveHost> pluginHost()
|
||||||
|
{
|
||||||
|
return myHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPluginHost(std::shared_ptr<olive::plugin::OliveHost> host)
|
||||||
|
{
|
||||||
|
myHost = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<OFX::Host::ImageEffect::PluginCache> pluginCache()
|
||||||
|
{
|
||||||
|
return plugin_cache_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPluginCache(std::shared_ptr<OFX::Host::ImageEffect::PluginCache> cache)
|
||||||
|
{
|
||||||
|
plugin_cache_ = cache;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
static Current current;
|
static Current current;
|
||||||
olive::VideoParams currentVideoParams_;
|
olive::VideoParams currentVideoParams_;
|
||||||
olive::AudioParams currentAudioParams_;
|
olive::AudioParams currentAudioParams_;
|
||||||
|
std::shared_ptr<olive::plugin::OliveHost> myHost;
|
||||||
|
std::shared_ptr<OFX::Host::ImageEffect::PluginCache> plugin_cache_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,6 +24,7 @@
|
|||||||
* Use the navigation above to find documentation on classes or source files.
|
* Use the navigation above to find documentation on classes or source files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "OliveHost.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavfilter/avfilter.h>
|
#include <libavfilter/avfilter.h>
|
||||||
@@ -52,7 +53,6 @@ extern "C" {
|
|||||||
#ifdef USE_CRASHPAD
|
#ifdef USE_CRASHPAD
|
||||||
#include "common/crashpadinterface.h"
|
#include "common/crashpadinterface.h"
|
||||||
#endif // USE_CRASHPAD
|
#endif // USE_CRASHPAD
|
||||||
#include "OlivePlugin.cpp"
|
|
||||||
int decompress_project(const QString &project)
|
int decompress_project(const QString &project)
|
||||||
{
|
{
|
||||||
if (project.isEmpty()) {
|
if (project.isEmpty()) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "block/transition/diptocolor/diptocolortransition.h"
|
#include "block/transition/diptocolor/diptocolortransition.h"
|
||||||
#include "color/displaytransform/displaytransform.h"
|
#include "color/displaytransform/displaytransform.h"
|
||||||
#include "color/ociogradingtransformlinear/ociogradingtransformlinear.h"
|
#include "color/ociogradingtransformlinear/ociogradingtransformlinear.h"
|
||||||
|
#include "common/Current.h"
|
||||||
#include "distort/cornerpin/cornerpindistortnode.h"
|
#include "distort/cornerpin/cornerpindistortnode.h"
|
||||||
#include "distort/crop/cropdistortnode.h"
|
#include "distort/crop/cropdistortnode.h"
|
||||||
#include "distort/flip/flipdistortnode.h"
|
#include "distort/flip/flipdistortnode.h"
|
||||||
@@ -62,6 +63,8 @@
|
|||||||
#include "math/trigonometry/trigonometry.h"
|
#include "math/trigonometry/trigonometry.h"
|
||||||
#include "output/track/track.h"
|
#include "output/track/track.h"
|
||||||
#include "output/viewer/viewer.h"
|
#include "output/viewer/viewer.h"
|
||||||
|
#include "pluginSupport/OliveHost.h"
|
||||||
|
#include "plugins/Plugin.h"
|
||||||
#include "project/folder/folder.h"
|
#include "project/folder/folder.h"
|
||||||
#include "project/footage/footage.h"
|
#include "project/footage/footage.h"
|
||||||
#include "project/sequence/sequence.h"
|
#include "project/sequence/sequence.h"
|
||||||
@@ -84,6 +87,19 @@ void NodeFactory::Initialize()
|
|||||||
|
|
||||||
library_.append(created_node);
|
library_.append(created_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<olive::plugin::OliveHost> host=std::make_shared<olive::plugin::OliveHost>();
|
||||||
|
Current::getInstance().setPluginHost(host);
|
||||||
|
std::shared_ptr<OFX::Host::ImageEffect::PluginCache> plugin_cache=std::make_shared<OFX::Host::ImageEffect::PluginCache>(*host);
|
||||||
|
plugin_cache->registerInCache(*OFX::Host::PluginCache::getPluginCache());
|
||||||
|
OFX::Host::PluginCache::getPluginCache()->scanPluginFiles();
|
||||||
|
|
||||||
|
|
||||||
|
for (auto plugin : OFX::Host::PluginCache::getPluginCache()->getPlugins()) {
|
||||||
|
plugin::PluginNode *plugin_node=new plugin::PluginNode(dynamic_cast<OFX::Host::ImageEffect::ImageEffectPlugin*>(plugin));
|
||||||
|
library_.append(plugin_node);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeFactory::Destroy()
|
void NodeFactory::Destroy()
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#ifndef NODE_H
|
#ifndef NODE_H
|
||||||
#define NODE_H
|
#define NODE_H
|
||||||
|
|
||||||
|
#include "ofxhImageEffectAPI.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -1124,7 +1126,12 @@ public:
|
|||||||
|
|
||||||
static const QString kEnabledInput;
|
static const QString kEnabledInput;
|
||||||
|
|
||||||
|
OFX::Host::ImageEffect::ImageEffectPlugin* getPlugin();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// If is set, this is a plugin node.
|
||||||
|
OFX::Host::ImageEffect::ImageEffectPlugin* plugin= nullptr;
|
||||||
|
|
||||||
void InsertInput(const QString &id, NodeValue::Type type,
|
void InsertInput(const QString &id, NodeValue::Type type,
|
||||||
const QVariant &default_value, InputFlags flags,
|
const QVariant &default_value, InputFlags flags,
|
||||||
int index);
|
int index);
|
||||||
|
|||||||
+70
-25
@@ -17,44 +17,89 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Plugin.h"
|
#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 if (ofxType == kOfxParamTypePushButton) {
|
||||||
|
type = NodeValue::kPushButton;
|
||||||
|
} else if (ofxType == kOfxParamTypeGroup) {
|
||||||
|
// TODO
|
||||||
|
} else if (ofxType == kOfxParamTypePage) {
|
||||||
|
// TODO
|
||||||
|
}else {
|
||||||
|
type = NodeValue::kNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AddInput(param.second->getName().data(), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
QString olive::plugin::PluginNode::Name() const
|
QString olive::plugin::PluginNode::Name() const
|
||||||
{
|
{
|
||||||
if (methods.name) {
|
return plugin->getDescriptor()
|
||||||
char buffer[64]={0};
|
.getProps()
|
||||||
bool ok=methods.name(buffer, 64);
|
.getStringProperty(kOfxPropLabel)
|
||||||
if (ok) {
|
.data();
|
||||||
return QString(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString olive::plugin::PluginNode::Description() const
|
QString olive::plugin::PluginNode::Description() const
|
||||||
{
|
{
|
||||||
if (methods.description) {
|
return plugin->getDescriptor().getProps().getStringProperty(kOfxPropPluginDescription).data();
|
||||||
char buffer[1024] = { 0 };
|
|
||||||
bool ok = methods.description(buffer, 1024);
|
|
||||||
if (ok) {
|
|
||||||
return QString(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
void olive::plugin::PluginNode::Value(const NodeValueRow &value,
|
void olive::plugin::PluginNode::Value(const NodeValueRow &value,
|
||||||
const NodeGlobals &globals,
|
const NodeGlobals &globals,
|
||||||
NodeValueTable *table) const
|
NodeValueTable *table) const
|
||||||
{
|
{
|
||||||
methods.value(&node_ctx_functions);
|
TexturePtr tex = value[kTextureInput].toTexture();
|
||||||
|
if (tex) {
|
||||||
|
PluginJob job(plugin, value);
|
||||||
|
table->Push(NodeValue::kTexture, tex->toJob(job), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void olive::plugin::PluginNode::pushButtonClicked(QString name)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString olive::plugin::PluginNode::id() const
|
QString olive::plugin::PluginNode::id() const
|
||||||
{
|
{
|
||||||
if (methods.id) {
|
return plugin->getIdentifier().data();
|
||||||
char buffer[64]={0};
|
|
||||||
bool ok=methods.id(buffer, 64);
|
|
||||||
if (ok) {
|
|
||||||
return QString(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
+44
-16
@@ -18,36 +18,64 @@
|
|||||||
|
|
||||||
#ifndef PLUGIN_NODES_H
|
#ifndef PLUGIN_NODES_H
|
||||||
#define PLUGIN_NODES_H
|
#define PLUGIN_NODES_H
|
||||||
|
#include "ofxhImageEffectAPI.h"
|
||||||
|
#include "ofxhPluginCache.h"
|
||||||
#include "node/node.h"
|
#include "node/node.h"
|
||||||
#include "pluginSupport/Plugin.h"
|
|
||||||
#include "pluginSupport/OlivePlugin.cpp"
|
|
||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
namespace plugin
|
namespace plugin
|
||||||
{
|
{
|
||||||
|
const QString kTextureInput = QStringLiteral("tex_in");
|
||||||
|
|
||||||
class PluginNode : public olive::Node{
|
class PluginNode : public olive::Node{
|
||||||
public:
|
public:
|
||||||
PluginNode():Node()
|
PluginNode(OFX::Host::ImageEffect::ImageEffectPlugin* plugin) ;
|
||||||
{
|
|
||||||
memset(&methods, 0, sizeof(olive_node_methods));
|
|
||||||
};
|
|
||||||
explicit PluginNode(struct olive_node_methods methods):Node()
|
|
||||||
{
|
|
||||||
this->methods=methods;
|
|
||||||
}
|
|
||||||
void setMethods(struct olive_node_methods methods)
|
|
||||||
{
|
|
||||||
this->methods=methods;
|
|
||||||
}
|
|
||||||
QString Name() const override;
|
QString Name() const override;
|
||||||
QString id() const override;
|
QString id() const override;
|
||||||
QVector<CategoryID> Category() const override;
|
QVector<CategoryID> Category() const override;
|
||||||
QString Description() const override;
|
QString Description() const override;
|
||||||
|
|
||||||
|
void AddPushButton();
|
||||||
|
void AddPage();
|
||||||
|
|
||||||
|
Node *copy() const override;
|
||||||
|
/**
|
||||||
|
* @brief The main processing function
|
||||||
|
*
|
||||||
|
* The node's main purpose is to take values from inputs to set values in outputs. For whatever subclass node you
|
||||||
|
* create, this is where the code for that goes.
|
||||||
|
*
|
||||||
|
* Note that as a video editor, the node graph has to work across time. Depending on the purpose of your node, it may
|
||||||
|
* output different values depending on the time, and even if not, it will likely be receiving different input
|
||||||
|
* depending on the time. Most of the difficult work here is handled by NodeInput::get_value() which you should pass
|
||||||
|
* the `time` parameter to. It will return its value (at that time, if it's keyframed), or pass the time to a
|
||||||
|
* corresponding output if it's connected to one. If your node doesn't directly deal with time, the default behavior
|
||||||
|
* of the NodeParam objects will handle everything related to it automatically.
|
||||||
|
*/
|
||||||
void Value(const NodeValueRow &value,
|
void Value(const NodeValueRow &value,
|
||||||
const NodeGlobals &globals, NodeValueTable *table) const override;
|
const NodeGlobals &globals, NodeValueTable *table) const override;
|
||||||
private:
|
|
||||||
struct olive_node_methods methods;
|
/**
|
||||||
|
* @brief If Value() pushes a ShaderJob, this is the function that will process them.
|
||||||
|
*/
|
||||||
|
virtual void ProcessSamples(const NodeValueRow &values,
|
||||||
|
const SampleBuffer &input, SampleBuffer &output,
|
||||||
|
int index) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief If Value() pushes a GenerateJob, override this function for the image to create
|
||||||
|
*
|
||||||
|
* @param frame
|
||||||
|
*
|
||||||
|
* The destination buffer. It will already be allocated and ready for writing to.
|
||||||
|
*/
|
||||||
|
virtual void GenerateFrame(FramePtr frame, const GenerateJob &job) const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void pushButtonClicked(QString name);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -387,6 +387,10 @@ QVector2D NodeTraverser::GenerateResolution() const
|
|||||||
video_params_.height());
|
video_params_.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve Jobs. I need to add a PluginJob here and move the plugin code here.
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
void NodeTraverser::ResolveJobs(NodeValue &val)
|
void NodeTraverser::ResolveJobs(NodeValue &val)
|
||||||
{
|
{
|
||||||
if (val.type() == NodeValue::kTexture) {
|
if (val.type() == NodeValue::kTexture) {
|
||||||
|
|||||||
+11
-1
@@ -163,7 +163,13 @@ public:
|
|||||||
* Resolves to `int` - the index currently selected
|
* Resolves to `int` - the index currently selected
|
||||||
*/
|
*/
|
||||||
kCombo,
|
kCombo,
|
||||||
|
/**
|
||||||
|
* ComboBox type
|
||||||
|
*
|
||||||
|
* Resolves to `QString` - the text of choice currently selected
|
||||||
|
* This is to support the OpenFX type kOfxParamTypeStrChoice
|
||||||
|
*/
|
||||||
|
kStrCombo,
|
||||||
/**
|
/**
|
||||||
* Video Parameters type
|
* Video Parameters type
|
||||||
*
|
*
|
||||||
@@ -191,6 +197,10 @@ public:
|
|||||||
kBinary,
|
kBinary,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*Push Button
|
||||||
|
*/
|
||||||
|
kPushButton,
|
||||||
|
/**
|
||||||
* End of list
|
* End of list
|
||||||
*/
|
*/
|
||||||
kDataTypeCount
|
kDataTypeCount
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
target_sources(libolive-editor PRIVATE
|
target_sources(libolive-editor PRIVATE
|
||||||
OliveHost.h
|
OliveHost.h
|
||||||
OliveHost.cpp
|
OliveHost.cpp
|
||||||
OliveInstance.h
|
OlivePluginInstance.h
|
||||||
OliveInstance.cpp
|
OlivePluginInstance.cpp
|
||||||
|
OliveClip.cpp
|
||||||
|
OliveClip.h
|
||||||
|
paraminstance.cpp
|
||||||
|
paraminstance.h
|
||||||
)
|
)
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Created by mikesolar on 25-10-1.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "OliveClip.h"
|
||||||
|
|
||||||
|
#include "common/Current.h"
|
||||||
|
const std::string &olive::plugin::OliveClipInstance::getUnmappedBitDepth() const
|
||||||
|
{
|
||||||
|
switch (params_.format()) {
|
||||||
|
case PixelFormat::INVALID:
|
||||||
|
return kOfxBitDepthNone;
|
||||||
|
case PixelFormat::U8:
|
||||||
|
return kOfxBitDepthByte;
|
||||||
|
case PixelFormat::U16:
|
||||||
|
return kOfxBitDepthShort;
|
||||||
|
case PixelFormat::F16:
|
||||||
|
return kOfxBitDepthHalf;
|
||||||
|
case PixelFormat::F32:
|
||||||
|
return kOfxBitDepthFloat;
|
||||||
|
default:
|
||||||
|
return kOfxBitDepthNone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const std::string &
|
||||||
|
olive::plugin::OliveClipInstance::getUnmappedComponents() const
|
||||||
|
{
|
||||||
|
switch (params_.channel_count()) {
|
||||||
|
case 1:
|
||||||
|
return kOfxImageComponentAlpha;
|
||||||
|
case 3:
|
||||||
|
return kOfxImageComponentRGB;
|
||||||
|
case 4:
|
||||||
|
return kOfxImageComponentRGBA;
|
||||||
|
default:
|
||||||
|
return kOfxImageComponentNone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const std::string &olive::plugin::OliveClipInstance::getPremult() const
|
||||||
|
{
|
||||||
|
if (params_.premultiplied_alpha()) {
|
||||||
|
return kOfxImagePreMultiplied;
|
||||||
|
} else {
|
||||||
|
return kOfxImageUnPreMultiplied;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double olive::plugin::OliveClipInstance::getAspectRatio() const
|
||||||
|
{
|
||||||
|
return params_
|
||||||
|
.pixel_aspect_ratio()
|
||||||
|
.toDouble();
|
||||||
|
}
|
||||||
|
double olive::plugin::OliveClipInstance::getFrameRate() const
|
||||||
|
{
|
||||||
|
return params_.frame_rate().toDouble();
|
||||||
|
}
|
||||||
|
void olive::plugin::OliveClipInstance::getFrameRange(double &startFrame,
|
||||||
|
double &endFrame) const
|
||||||
|
{
|
||||||
|
startFrame =
|
||||||
|
params_.frame_rate().toDouble() *
|
||||||
|
params_.start_time();
|
||||||
|
endFrame =
|
||||||
|
startFrame +
|
||||||
|
params_.frame_rate().toDouble() *
|
||||||
|
params_.duration();
|
||||||
|
}
|
||||||
|
const std::string &olive::plugin::OliveClipInstance::getFieldOrder() const
|
||||||
|
{
|
||||||
|
switch (params_.interlacing()) {
|
||||||
|
case VideoParams::kInterlaceNone:
|
||||||
|
return kOfxImageFieldNone;
|
||||||
|
case VideoParams::kInterlacedTopFirst:
|
||||||
|
return kOfxImageFieldUpper;
|
||||||
|
case VideoParams::kInterlacedBottomFirst:
|
||||||
|
return kOfxImageFieldLower;
|
||||||
|
}
|
||||||
|
return kOfxImageFieldNone;
|
||||||
|
}
|
||||||
|
bool olive::plugin::OliveClipInstance::getConnected() const
|
||||||
|
{
|
||||||
|
return params_.format() ==
|
||||||
|
PixelFormat::INVALID;
|
||||||
|
}
|
||||||
|
double olive::plugin::OliveClipInstance::getUnmappedFrameRate() const
|
||||||
|
{
|
||||||
|
return getFrameRate();
|
||||||
|
}
|
||||||
|
void olive::plugin::OliveClipInstance::getUnmappedFrameRange(
|
||||||
|
double &startFrame, double &endFrame) const
|
||||||
|
{
|
||||||
|
getFrameRange(startFrame, endFrame);
|
||||||
|
}
|
||||||
|
bool olive::plugin::OliveClipInstance::getContinuousSamples() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OFX::Host::ImageEffect::Image *
|
||||||
|
olive::plugin::OliveClipInstance::getImage(OfxTime time,
|
||||||
|
const OfxRectD *optionalBounds)
|
||||||
|
{
|
||||||
|
return &image_;
|
||||||
|
}
|
||||||
|
OfxRectD
|
||||||
|
olive::plugin::OliveClipInstance::getRegionOfDefinition(OfxTime time) const
|
||||||
|
{
|
||||||
|
if (regionOfDefinitions_.contains(time)) {
|
||||||
|
return regionOfDefinitions_[time];
|
||||||
|
}
|
||||||
|
OfxRectD regionOfDefinition;
|
||||||
|
regionOfDefinition.x1=regionOfDefinition.y1=0;
|
||||||
|
regionOfDefinition.x2=params_.width();
|
||||||
|
regionOfDefinition.y2=params_.height();
|
||||||
|
return regionOfDefinition;
|
||||||
|
}
|
||||||
|
void olive::plugin::OliveClipInstance::setRegionOfDefinition(
|
||||||
|
OfxRectD regionOfDefinition, OfxTime time)
|
||||||
|
{
|
||||||
|
regionOfDefinitions_[time] = regionOfDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void olive::plugin::OliveClipInstance::setDefaultRegionOfDefinition(
|
||||||
|
OfxRectD regionOfDefinition)
|
||||||
|
{
|
||||||
|
defaultRegionOfDefinitions_ = regionOfDefinition;
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Created by mikesolar on 25-10-1.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OLIVECLIP_H
|
||||||
|
#define OLIVECLIP_H
|
||||||
|
#include "ofxhClip.h"
|
||||||
|
#include "render/videoparams.h"
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
namespace olive
|
||||||
|
{
|
||||||
|
namespace plugin
|
||||||
|
{
|
||||||
|
class OliveClipInstance: public OFX::Host::ImageEffect::ClipInstance {
|
||||||
|
public:
|
||||||
|
OliveClipInstance(OFX::Host::ImageEffect::Instance* effectInstance,
|
||||||
|
OFX::Host::ImageEffect::ClipDescriptor& desc,VideoParams params)
|
||||||
|
: ClipInstance(effectInstance, desc)
|
||||||
|
{
|
||||||
|
params_ = params;
|
||||||
|
}
|
||||||
|
OFX::Host::ImageEffect::Image& getOutputImage()
|
||||||
|
{
|
||||||
|
return image_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &getUnmappedBitDepth() const override;
|
||||||
|
const std::string &getUnmappedComponents() const override;
|
||||||
|
const std::string &getPremult() const override;
|
||||||
|
double getAspectRatio() const override;
|
||||||
|
double getFrameRate() const override;
|
||||||
|
void getFrameRange(double &startFrame, double &endFrame) const override;
|
||||||
|
const std::string &getFieldOrder() const override;
|
||||||
|
bool getConnected() const override;
|
||||||
|
double getUnmappedFrameRate() const override;
|
||||||
|
void getUnmappedFrameRange(double &startFrame, double &endFrame) const override;
|
||||||
|
bool getContinuousSamples() const override;
|
||||||
|
OFX::Host::ImageEffect::Image* getImage(OfxTime time, const OfxRectD *optionalBounds) override;
|
||||||
|
OfxRectD getRegionOfDefinition(OfxTime time) const override;
|
||||||
|
|
||||||
|
void setRegionOfDefinition(OfxRectD regionOfDefinition, OfxTime time);
|
||||||
|
void olive::plugin::OliveClipInstance::setDefaultRegionOfDefinition(
|
||||||
|
OfxRectD regionOfDefinition);
|
||||||
|
# ifdef OFX_SUPPORTS_OPENGLRENDER
|
||||||
|
OFX::Host::ImageEffect::Texture* loadTexture(OfxTime time, const char *format, const OfxRectD *optionalBounds) { return NULL; };
|
||||||
|
# endif
|
||||||
|
private:
|
||||||
|
VideoParams params_;
|
||||||
|
|
||||||
|
QMap<OfxTime, OfxRectD> regionOfDefinitions_;
|
||||||
|
|
||||||
|
OfxRectD defaultRegionOfDefinitions_;
|
||||||
|
|
||||||
|
OFX::Host::ImageEffect::Image image_;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //OLIVECLIP_H
|
||||||
@@ -25,20 +25,16 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include "OliveHost.h"
|
#include "OliveHost.h"
|
||||||
|
|
||||||
|
#include "OlivePluginInstance.h"
|
||||||
|
#include "common/Current.h"
|
||||||
using namespace OFX::Host;
|
using namespace OFX::Host;
|
||||||
using namespace olive::plugin;
|
using namespace olive::plugin;
|
||||||
void loadPlugins(QString path)
|
|
||||||
|
void olive::plugin::loadPlugins(QString path)
|
||||||
{
|
{
|
||||||
QDir dir=(QCoreApplication::applicationDirPath()+path);
|
OFX::Host::ImageEffect::PluginCache imageEffectPluginCache(myHost);
|
||||||
QFileInfoList files=dir.entryInfoList();
|
|
||||||
for (auto& file:files) {
|
|
||||||
if (file.isDir()) {
|
|
||||||
OFX::Binary binary(file.absoluteFilePath().toStdString());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OliveHost::~OliveHost()
|
OliveHost::~OliveHost()
|
||||||
{
|
{
|
||||||
for(auto& descriptor:descriptors_){
|
for(auto& descriptor:descriptors_){
|
||||||
@@ -79,7 +75,7 @@ OFX::Host::ImageEffect::Instance* OliveHost::newInstance(void* clientData,
|
|||||||
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
||||||
OFX::Host::ImageEffect::Descriptor& desc,
|
OFX::Host::ImageEffect::Descriptor& desc,
|
||||||
const std::string& context){
|
const std::string& context){
|
||||||
//ImageEffect::Instance* instance=new ImageEffect::Instance(clientData,plugin,desc,context);
|
ImageEffect::Instance* instance=new OlivePluginInstance(plugin,desc,context,Current::getInstance().interactive());
|
||||||
instances_.append(instance);
|
instances_.append(instance);
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#ifndef OLIVE_HOST_H
|
||||||
|
#define OLIVE_HOST_H
|
||||||
#include "ofxhHost.h"
|
#include "ofxhHost.h"
|
||||||
#include "ofxhImageEffectAPI.h"
|
#include "ofxhImageEffectAPI.h"
|
||||||
#include "ofxCore.h"
|
#include "ofxCore.h"
|
||||||
@@ -67,3 +69,4 @@ private:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "OliveInstance.h"
|
#include "OlivePluginInstance.h"
|
||||||
|
|
||||||
|
#include "OliveClip.h"
|
||||||
#include "ofxCore.h"
|
#include "ofxCore.h"
|
||||||
#include "ofxMessage.h"
|
#include "ofxMessage.h"
|
||||||
#include "common/Current.h"
|
#include "common/Current.h"
|
||||||
@@ -26,11 +28,12 @@
|
|||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "paraminstance.h"
|
||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
namespace plugin
|
namespace plugin
|
||||||
{
|
{
|
||||||
OfxStatus OliveInstance::vmessage(const char *type, const char *id,
|
OfxStatus OlivePluginInstance::vmessage(const char *type, const char *id,
|
||||||
const char *format, va_list args)
|
const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char *buffer = new char[1024];
|
char *buffer = new char[1024];
|
||||||
@@ -57,7 +60,7 @@ OfxStatus OliveInstance::vmessage(const char *type, const char *id,
|
|||||||
return kOfxStatOK;
|
return kOfxStatOK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OfxStatus OliveInstance::setPersistentMessage(const char *type, const char *id,
|
OfxStatus OlivePluginInstance::setPersistentMessage(const char *type, const char *id,
|
||||||
const char *format, va_list args)
|
const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char *buffer = new char[1024];
|
char *buffer = new char[1024];
|
||||||
@@ -93,38 +96,73 @@ OfxStatus OliveInstance::setPersistentMessage(const char *type, const char *id,
|
|||||||
}
|
}
|
||||||
return kOfxStatOK;
|
return kOfxStatOK;
|
||||||
}
|
}
|
||||||
OfxStatus OliveInstance::clearPersistentMessage()
|
OfxStatus OlivePluginInstance::clearPersistentMessage()
|
||||||
{
|
{
|
||||||
persistentErrors_.clear();
|
persistentErrors_.clear();
|
||||||
// TODO: tell the shell to remove message.
|
// TODO: tell the shell to remove message.
|
||||||
return kOfxStatOK;
|
return kOfxStatOK;
|
||||||
}
|
}
|
||||||
void OliveInstance::getProjectSize(double &xSize, double &ySize) const
|
void OlivePluginInstance::getProjectSize(double &xSize, double &ySize) const
|
||||||
{
|
{
|
||||||
xSize = Current::getInstance().currentVideoParams().width();
|
xSize =params_.width();
|
||||||
ySize = Current::getInstance().currentVideoParams().height();
|
ySize =params_.height();
|
||||||
}
|
}
|
||||||
void OliveInstance::getProjectOffset(double &xOffset, double &yOffset) const
|
void OlivePluginInstance::getProjectOffset(double &xOffset, double &yOffset) const
|
||||||
{
|
{
|
||||||
xOffset = Current::getInstance().currentVideoParams().x();
|
xOffset =params_.x();
|
||||||
yOffset = Current::getInstance().currentVideoParams().y();
|
yOffset =params_.y();
|
||||||
}
|
}
|
||||||
void OliveInstance::getProjectExtent(double &xSize, double &ySize) const
|
void OlivePluginInstance::getProjectExtent(double &xSize, double &ySize) const
|
||||||
{
|
{
|
||||||
xSize = Current::getInstance().currentVideoParams().width();
|
xSize =params_.width();
|
||||||
ySize = Current::getInstance().currentVideoParams().height();
|
ySize =params_.height();
|
||||||
// TODO: Ensure this project does not support this.
|
// TODO: Ensure this project does not support this.
|
||||||
}
|
}
|
||||||
double OliveInstance::getProjectPixelAspectRatio() const
|
double OlivePluginInstance::getProjectPixelAspectRatio() const
|
||||||
{
|
{
|
||||||
return Current::getInstance()
|
return Current::getInstance()
|
||||||
.currentVideoParams()
|
.currentVideoParams()
|
||||||
.pixel_aspect_ratio()
|
.pixel_aspect_ratio()
|
||||||
.toDouble();
|
.toDouble();
|
||||||
}
|
}
|
||||||
double OliveInstance::getFrameRate() const
|
double OlivePluginInstance::getFrameRate() const
|
||||||
{
|
{
|
||||||
return Current::getInstance().currentVideoParams().frame_rate().toDouble();
|
return params_.frame_rate().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
double OlivePluginInstance::getEffectDuration() const
|
||||||
|
{
|
||||||
|
// Return a default duration value
|
||||||
|
return 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double OlivePluginInstance::getFrameRecursive() const
|
||||||
|
{
|
||||||
|
// Return current frame (this would typically be set by the host during rendering)
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OlivePluginInstance::getRenderScaleRecursive(double &x, double &y) const
|
||||||
|
{
|
||||||
|
// Return default render scale (1.0, 1.0)
|
||||||
|
x = 1.0;
|
||||||
|
y = 1.0;
|
||||||
|
}
|
||||||
|
OFX::Host::Param::Instance *
|
||||||
|
OlivePluginInstance::newParam(const std::string &name,
|
||||||
|
OFX::Host::Param::Descriptor &Descriptor)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OFX::Host::ImageEffect::ClipInstance *OlivePluginInstance::newClipInstance(
|
||||||
|
OFX::Host::ImageEffect::Instance *plugin,
|
||||||
|
OFX::Host::ImageEffect::ClipDescriptor *descriptor,
|
||||||
|
int index)
|
||||||
|
{
|
||||||
|
// Create a new clip instance
|
||||||
|
OFX::Host::ImageEffect::ClipInstance* clipInstance = new OliveClipInstance(plugin, *descriptor, params_);
|
||||||
|
return clipInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,11 +15,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#ifndef OLIVE_INSTANCE_H
|
||||||
|
#define OLIVE_INSTANCE_H
|
||||||
#include "ofxCore.h"
|
#include "ofxCore.h"
|
||||||
#include "ofxImageEffect.h"
|
#include "ofxImageEffect.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "ofxhImageEffect.h"
|
#include "ofxhImageEffect.h"
|
||||||
|
#include "render/videoparams.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <qcontainerfwd.h>
|
#include <qcontainerfwd.h>
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
@@ -34,9 +37,9 @@ struct PersistentErrors{
|
|||||||
ErrorType type;
|
ErrorType type;
|
||||||
QString message;
|
QString message;
|
||||||
};
|
};
|
||||||
class OliveInstance : public OFX::Host::ImageEffect::Instance {
|
class OlivePluginInstance : public OFX::Host::ImageEffect::Instance {
|
||||||
public:
|
public:
|
||||||
OliveInstance(
|
OlivePluginInstance(
|
||||||
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
OFX::Host::ImageEffect::ImageEffectPlugin* plugin,
|
||||||
OFX::Host::ImageEffect::Descriptor& desc,
|
OFX::Host::ImageEffect::Descriptor& desc,
|
||||||
const std::string& context,
|
const std::string& context,
|
||||||
@@ -44,11 +47,15 @@ public:
|
|||||||
: OFX::Host::ImageEffect::Instance(plugin, desc, context, interactive)
|
: OFX::Host::ImageEffect::Instance(plugin, desc, context, interactive)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~OliveInstance() override = default;
|
~OlivePluginInstance() override = default;
|
||||||
const std::string &getDefaultOutputFielding() const{
|
const std::string &getDefaultOutputFielding() const{
|
||||||
return kOfxImageFieldNone;
|
return kOfxImageFieldNone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setVideoParam(VideoParams params)
|
||||||
|
{
|
||||||
|
this->params_=params;
|
||||||
|
}
|
||||||
OFX::Host::ImageEffect::ClipInstance *newClipInstance(
|
OFX::Host::ImageEffect::ClipInstance *newClipInstance(
|
||||||
OFX::Host::ImageEffect::Instance *plugin,
|
OFX::Host::ImageEffect::Instance *plugin,
|
||||||
OFX::Host::ImageEffect::ClipDescriptor *descriptor,
|
OFX::Host::ImageEffect::ClipDescriptor *descriptor,
|
||||||
@@ -88,9 +95,62 @@ public:
|
|||||||
/// renderScale
|
/// renderScale
|
||||||
void getRenderScaleRecursive(double &x, double &y) const override;
|
void getRenderScaleRecursive(double &x, double &y) const override;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// overridden for Param::SetInstance
|
||||||
|
|
||||||
|
/// make a parameter instance
|
||||||
|
///
|
||||||
|
/// Client host code needs to implement this
|
||||||
|
virtual OFX::Host::Param::Instance* newParam(const std::string& name, OFX::Host::Param::Descriptor& Descriptor);
|
||||||
|
|
||||||
|
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditBegin
|
||||||
|
///
|
||||||
|
/// Client host code needs to implement this
|
||||||
|
virtual OfxStatus editBegin(const std::string& name);
|
||||||
|
|
||||||
|
/// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditEnd
|
||||||
|
///
|
||||||
|
/// Client host code needs to implement this
|
||||||
|
virtual OfxStatus editEnd();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// overridden for Progress::ProgressI
|
||||||
|
|
||||||
|
/// Start doing progress.
|
||||||
|
virtual void progressStart(const std::string &message, const std::string &messageid);
|
||||||
|
|
||||||
|
/// finish yer progress
|
||||||
|
virtual void progressEnd();
|
||||||
|
|
||||||
|
/// set the progress to some level of completion, returns
|
||||||
|
/// false if you should abandon processing, true to continue
|
||||||
|
virtual bool progressUpdate(double t);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// overridden for TimeLine::TimeLineI
|
||||||
|
|
||||||
|
/// get the current time on the timeline. This is not necessarily the same
|
||||||
|
/// time as being passed to an action (eg render)
|
||||||
|
virtual double timeLineGetTime();
|
||||||
|
|
||||||
|
/// set the timeline to a specific time
|
||||||
|
virtual void timeLineGotoTime(double t);
|
||||||
|
|
||||||
|
/// get the first and last times available on the effect's timeline
|
||||||
|
virtual void timeLineGetBounds(double &t1, double &t2);
|
||||||
private:
|
private:
|
||||||
QList<PersistentErrors> persistentErrors_;
|
QList<PersistentErrors> persistentErrors_;
|
||||||
|
VideoParams params_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "paraminstance.h"
|
||||||
|
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Copyright OpenFX and contributors to the OpenFX project.
|
||||||
|
#ifndef PARAM_INSTANCE_H
|
||||||
|
#define PARAM_INSTANCE_H
|
||||||
|
|
||||||
|
#include "ofxhParam.h"
|
||||||
|
#include "node/plugins/Plugin.h"
|
||||||
|
namespace olive
|
||||||
|
{
|
||||||
|
namespace plugin
|
||||||
|
{
|
||||||
|
class PushbuttonInstance : public OFX::Host::Param::PushbuttonInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor *_descriptor;
|
||||||
|
public:
|
||||||
|
PushbuttonInstance(PluginNode *effect, const std::string &name,
|
||||||
|
OFX::Host::Param::Descriptor &descriptor)
|
||||||
|
: OFX::Host::Param::PushbuttonInstance(descriptor)
|
||||||
|
, node(effect)
|
||||||
|
{
|
||||||
|
_descriptor = &descriptor;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class IntegerInstance : public OFX::Host::Param::IntegerInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* _node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
QString id;
|
||||||
|
public:
|
||||||
|
IntegerInstance(PluginNode *node, OFX::Host::Param::Descriptor &descriptor)
|
||||||
|
: _node(node), _descriptor(descriptor),
|
||||||
|
OFX::Host::Param::IntegerInstance(_descriptor){}
|
||||||
|
OfxStatus get(int &a)
|
||||||
|
{
|
||||||
|
if (id.isEmpty()) {
|
||||||
|
return kOfxStatErrBadHandle;
|
||||||
|
}
|
||||||
|
QVariant variant=_node->GetStandardValue(id);
|
||||||
|
|
||||||
|
if (variant.typeId()==QVariant::Int) {
|
||||||
|
a=variant.toInt();
|
||||||
|
return kOfxStatOK;
|
||||||
|
}
|
||||||
|
a=0;
|
||||||
|
return kOfxStatErrValue;
|
||||||
|
}
|
||||||
|
OfxStatus get(OfxTime time, int &data)
|
||||||
|
{
|
||||||
|
if (id.isEmpty()) {
|
||||||
|
return kOfxStatErrBadHandle;
|
||||||
|
}
|
||||||
|
QVariant variant=_node->GetValueAtTime(id, rational::fromDouble(time));
|
||||||
|
if (variant.typeId()==QVariant::Int) {
|
||||||
|
data=variant.toInt();
|
||||||
|
return kOfxStatOK;
|
||||||
|
}
|
||||||
|
data=0;
|
||||||
|
return kOfxStatErrValue;
|
||||||
|
}
|
||||||
|
OfxStatus set(int data)
|
||||||
|
{
|
||||||
|
_node->SetStandardValue(_descriptor.getName().c_str(), data);
|
||||||
|
id=_descriptor.getName().c_str();
|
||||||
|
return kOfxStatOK;
|
||||||
|
}
|
||||||
|
OfxStatus set(OfxTime time, int)
|
||||||
|
{
|
||||||
|
_node->SetValueAtTime()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class DoubleInstance : public OFX::Host::Param::DoubleInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
DoubleInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(double&);
|
||||||
|
OfxStatus get(OfxTime time, double&);
|
||||||
|
OfxStatus set(double);
|
||||||
|
OfxStatus set(OfxTime time, double);
|
||||||
|
OfxStatus derive(OfxTime time, double&);
|
||||||
|
OfxStatus integrate(OfxTime time1, OfxTime time2, double&);
|
||||||
|
};
|
||||||
|
|
||||||
|
class BooleanInstance : public OFX::Host::Param::BooleanInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
BooleanInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(bool&);
|
||||||
|
OfxStatus get(OfxTime time, bool&);
|
||||||
|
OfxStatus set(bool);
|
||||||
|
OfxStatus set(OfxTime time, bool);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ChoiceInstance : public OFX::Host::Param::ChoiceInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
ChoiceInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(int&);
|
||||||
|
OfxStatus get(OfxTime time, int&);
|
||||||
|
OfxStatus set(int);
|
||||||
|
OfxStatus set(OfxTime time, int);
|
||||||
|
};
|
||||||
|
|
||||||
|
class RGBAInstance : public OFX::Host::Param::RGBAInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
RGBAInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(double&,double&,double&,double&);
|
||||||
|
OfxStatus get(OfxTime time, double&,double&,double&,double&);
|
||||||
|
OfxStatus set(double,double,double,double);
|
||||||
|
OfxStatus set(OfxTime time, double,double,double,double);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class RGBInstance : public OFX::Host::Param::RGBInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
RGBInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(double&,double&,double&);
|
||||||
|
OfxStatus get(OfxTime time, double&,double&,double&);
|
||||||
|
OfxStatus set(double,double,double);
|
||||||
|
OfxStatus set(OfxTime time, double,double,double);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Double2DInstance : public OFX::Host::Param::Double2DInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
Double2DInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(double&,double&);
|
||||||
|
OfxStatus get(OfxTime time,double&,double&);
|
||||||
|
OfxStatus set(double,double);
|
||||||
|
OfxStatus set(OfxTime time,double,double);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Integer2DInstance : public OFX::Host::Param::Integer2DInstance {
|
||||||
|
protected:
|
||||||
|
PluginNode* node;
|
||||||
|
OFX::Host::Param::Descriptor& _descriptor;
|
||||||
|
public:
|
||||||
|
Integer2DInstance(PluginNode* effect, const std::string& name, OFX::Host::Param::Descriptor& descriptor);
|
||||||
|
OfxStatus get(int&,int&);
|
||||||
|
OfxStatus get(OfxTime time,int&,int&);
|
||||||
|
OfxStatus set(int,int);
|
||||||
|
OfxStatus set(OfxTime time,int,int);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HOST_DEMO_PARAM_INSTANCE_H
|
||||||
@@ -22,5 +22,7 @@ set(OLIVE_SOURCES
|
|||||||
render/job/generatejob.h
|
render/job/generatejob.h
|
||||||
render/job/samplejob.h
|
render/job/samplejob.h
|
||||||
render/job/shaderjob.h
|
render/job/shaderjob.h
|
||||||
|
render/job/pluginjob.h
|
||||||
|
render/job/pluginjob.cpp
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,22 +33,22 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeValue Get(const QString &input) const
|
virtual NodeValue Get(const QString &input) const
|
||||||
{
|
{
|
||||||
return value_map_.value(input);
|
return value_map_.value(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insert(const QString &input, const NodeValueRow &row)
|
virtual void Insert(const QString &input, const NodeValueRow &row)
|
||||||
{
|
{
|
||||||
value_map_.insert(input, row.value(input));
|
value_map_.insert(input, row.value(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insert(const QString &input, const NodeValue &value)
|
virtual void Insert(const QString &input, const NodeValue &value)
|
||||||
{
|
{
|
||||||
value_map_.insert(input, value);
|
value_map_.insert(input, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insert(const NodeValueRow &row)
|
virtual void Insert(const NodeValueRow &row)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
value_map_.insert(row);
|
value_map_.insert(row);
|
||||||
@@ -59,16 +59,16 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const NodeValueRow &GetValues() const
|
virtual const NodeValueRow &GetValues() const
|
||||||
{
|
{
|
||||||
return value_map_;
|
return value_map_;
|
||||||
}
|
}
|
||||||
NodeValueRow &GetValues()
|
virtual NodeValueRow &GetValues()
|
||||||
{
|
{
|
||||||
return value_map_;
|
return value_map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
NodeValueRow value_map_;
|
NodeValueRow value_map_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pluginjob.h"
|
||||||
|
|
||||||
|
namespace olive {
|
||||||
|
namespace plugin {
|
||||||
|
} // plugin
|
||||||
|
} // olive
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLUGINJOB_H
|
||||||
|
#define PLUGINJOB_H
|
||||||
|
#include "acceleratedjob.h"
|
||||||
|
#include "pluginSupport/OlivePluginInstance.h"
|
||||||
|
|
||||||
|
#include <any>
|
||||||
|
#include <OpenImageIO/detail/fmt/chrono.h>
|
||||||
|
|
||||||
|
namespace olive {
|
||||||
|
namespace plugin {
|
||||||
|
|
||||||
|
class PluginJob :public AcceleratedJob{
|
||||||
|
public:
|
||||||
|
explicit PluginJob(OFX::Host::ImageEffect::ImageEffectPlugin* pluginInstance, NodeValueRow row): AcceleratedJob()
|
||||||
|
{
|
||||||
|
this->pluginInstance = pluginInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
OFX::Host::ImageEffect::ImageEffectPlugin *pluginInstance=nullptr;
|
||||||
|
|
||||||
|
QHash<OfxTime, QHash<QString, std::any>> paramsOnTime;
|
||||||
|
|
||||||
|
QHash<QString, std::any> params;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // plugin
|
||||||
|
} // olive
|
||||||
|
|
||||||
|
#endif //PLUGINJOB_H
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
target_sources(libolive-editor PRIVATE pluginrenderer.cpp pluginrenderer.h)
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Created by mikesolar on 25-10-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pluginrenderer.h"
|
||||||
|
|
||||||
|
#include "pluginSupport/OlivePluginInstance.h"
|
||||||
|
void olive::plugin::PluginRenderer::Blit(QVariant shader, ShaderJob job,
|
||||||
|
Texture *destination,
|
||||||
|
VideoParams destination_params,
|
||||||
|
bool clear_destination)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Created by mikesolar on 25-10-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef PLUGINRENDERER_H
|
||||||
|
#define PLUGINRENDERER_H
|
||||||
|
#include "render/renderer.h"
|
||||||
|
namespace olive
|
||||||
|
{
|
||||||
|
namespace plugin{
|
||||||
|
class PluginRenderer : public olive::Renderer{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PluginRenderer(QObject *parent=nullptr):Renderer(parent){};
|
||||||
|
protected:
|
||||||
|
void Blit(QVariant shader,
|
||||||
|
ShaderJob job,
|
||||||
|
Texture *destination,
|
||||||
|
VideoParams destination_params,
|
||||||
|
bool clear_destination) override;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //PLUGINRENDERER_H
|
||||||
@@ -28,6 +28,8 @@
|
|||||||
#include "node/block/transition/transition.h"
|
#include "node/block/transition/transition.h"
|
||||||
#include "node/project.h"
|
#include "node/project.h"
|
||||||
#include "rendermanager.h"
|
#include "rendermanager.h"
|
||||||
|
#include "pluginSupport/OliveClip.h"
|
||||||
|
#include "pluginSupport/OliveHost.h"
|
||||||
|
|
||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
@@ -157,6 +159,7 @@ void RenderProcessor::Run()
|
|||||||
|
|
||||||
SetCancelPointer(ticket_->GetCancelAtom());
|
SetCancelPointer(ticket_->GetCancelAtom());
|
||||||
|
|
||||||
|
VideoParams params=ticket_->property("vparam").value<VideoParams>();
|
||||||
SetCacheVideoParams(ticket_->property("vparam").value<VideoParams>());
|
SetCacheVideoParams(ticket_->property("vparam").value<VideoParams>());
|
||||||
SetCacheAudioParams(ticket_->property("aparam").value<AudioParams>());
|
SetCacheAudioParams(ticket_->property("aparam").value<AudioParams>());
|
||||||
|
|
||||||
@@ -165,6 +168,93 @@ void RenderProcessor::Run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if is a plugin
|
||||||
|
/*Node *node=ticket_->property("node").value<Node*>();
|
||||||
|
if (node && node->getPlugin()) {
|
||||||
|
std::shared_ptr<OFX::Host::ImageEffect::ImageEffectPlugin> plugin
|
||||||
|
= node->getPlugin();
|
||||||
|
std::unique_ptr<OFX::Host::ImageEffect::Instance> instance(plugin->createInstance(kOfxImageEffectContextFilter, NULL));
|
||||||
|
|
||||||
|
OfxStatus stat;
|
||||||
|
stat = instance->createInstanceAction();
|
||||||
|
if(stat != kOfxStatOK && stat != kOfxStatReplyDefault) {
|
||||||
|
ticket_->Finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// now we need to to call getClipPreferences on the instance so that it does the clip component/depth
|
||||||
|
// logic and caches away the components and depth on each clip.
|
||||||
|
bool ok = instance->getClipPreferences();
|
||||||
|
if (!ok) {
|
||||||
|
ticket_->Finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// current render scale of 1
|
||||||
|
OfxPointD renderScale;
|
||||||
|
renderScale.x = renderScale.y = 1.0;
|
||||||
|
|
||||||
|
// The render window is in pixel coordinates
|
||||||
|
// ie: render scale and a PAR of not 1
|
||||||
|
OfxRectI renderWindow;
|
||||||
|
renderWindow.x1 = renderWindow.y1 = 0;
|
||||||
|
renderWindow.x2 = ticket_->property("size").value<QSize>().width();
|
||||||
|
renderWindow.y2 = ticket_->property("size").value<QSize>().height();
|
||||||
|
|
||||||
|
/// RoI is in canonical coords,
|
||||||
|
OfxRectD regionOfInterest;
|
||||||
|
regionOfInterest.x1 = regionOfInterest.y1 = 0;
|
||||||
|
regionOfInterest.x2 = renderWindow.x2 * instance->getProjectPixelAspectRatio();
|
||||||
|
regionOfInterest.y2 = renderWindow.y2 * instance->getProjectPixelAspectRatio();
|
||||||
|
|
||||||
|
OfxRectD regionOfDefinition;
|
||||||
|
regionOfDefinition.x1 = regionOfDefinition.y1 = 0;
|
||||||
|
regionOfDefinition.x2 = params.width();
|
||||||
|
regionOfDefinition.y2 = params.height();
|
||||||
|
|
||||||
|
|
||||||
|
int numFramesToRender=ticket_->property("time").value<rational>().toDouble()
|
||||||
|
* params.frame_rate().toDouble();
|
||||||
|
stat = instance->beginRenderAction(0, numFramesToRender, 1.0, false, renderScale, /*sequential=#1#true, /*interactive=#1#false
|
||||||
|
);
|
||||||
|
if (stat != kOfxStatOK && stat != kOfxStatReplyDefault) {
|
||||||
|
ticket_->Finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin::OliveClipInstance *clip=dynamic_cast<plugin::OliveClipInstance *>(instance->getClip("Output"));
|
||||||
|
for(int t = 0; t <= numFramesToRender; ++t)
|
||||||
|
{
|
||||||
|
// call get region of interest on each of the inputs
|
||||||
|
OfxTime frame = t;
|
||||||
|
|
||||||
|
// get the RoI for each input clip
|
||||||
|
// the regions of interest for each input clip are returned in a std::map
|
||||||
|
// on a real host, these will be the regions of each input clip that the
|
||||||
|
// effect needs to render a given frame (clipped to the RoD).
|
||||||
|
//
|
||||||
|
// In our example we are doing full frame fetches regardless.
|
||||||
|
std::map<OFX::Host::ImageEffect::ClipInstance *, OfxRectD> rois;
|
||||||
|
stat = instance->getRegionOfInterestAction(frame, renderScale,
|
||||||
|
regionOfInterest, rois);
|
||||||
|
assert(stat == kOfxStatOK || stat == kOfxStatReplyDefault);
|
||||||
|
|
||||||
|
// render a frame
|
||||||
|
stat = instance->renderAction(t,kOfxImageFieldBoth,renderWindow, renderScale, /*sequential=#1#true, /*interactive=#1#false, /*draft=#1#false);
|
||||||
|
assert(stat == kOfxStatOK);
|
||||||
|
|
||||||
|
// get the output image buffer
|
||||||
|
OFX::Host::ImageEffect::Image *outputImage = clip->getOutputImage();
|
||||||
|
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << "Output." << t << ".ppm";
|
||||||
|
exportToPPM(ss.str(), outputImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
instance->endRenderAction(0, numFramesToRender, 1.0, false, renderScale, /*sequential=#1#true, /*interactive=#1#false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RenderManager::kTypeVideo: {
|
case RenderManager::kTypeVideo: {
|
||||||
rational time = ticket_->property("time").value<rational>();
|
rational time = ticket_->property("time").value<rational>();
|
||||||
|
|||||||
@@ -38,5 +38,7 @@ set(OLIVE_SOURCES
|
|||||||
widget/nodeparamview/nodeparamviewtextedit.h
|
widget/nodeparamview/nodeparamviewtextedit.h
|
||||||
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
|
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
|
||||||
widget/nodeparamview/nodeparamviewwidgetbridge.h
|
widget/nodeparamview/nodeparamviewwidgetbridge.h
|
||||||
|
widget/nodeparamview/nodeparambutton.h
|
||||||
|
widget/nodeparamview/nodeparambutton.cpp
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "nodeparambutton.h"
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Olive Community Edition - Non-Linear Video Editor
|
||||||
|
* Copyright (C) 2025 Olive CE Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NODEPARAMBUTTON_H
|
||||||
|
#define NODEPARAMBUTTON_H
|
||||||
|
#include "node/plugins/Plugin.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
class NodeParamButton : public QPushButton{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
NodeParamButton(QString name, QWidget *parent = nullptr):QPushButton(parent)
|
||||||
|
{
|
||||||
|
this->name_=name;
|
||||||
|
connect(this, &QPushButton::clicked, this, &NodeParamButton::pressed);
|
||||||
|
}
|
||||||
|
signals:
|
||||||
|
void onPressed(QString name);
|
||||||
|
private slots:
|
||||||
|
void pressed(){
|
||||||
|
emit onPressed(name_);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QString name_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //NODEPARAMBUTTON_H
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "common/qtutils.h"
|
#include "common/qtutils.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
#include "nodeparambutton.h"
|
||||||
#include "node/group/group.h"
|
#include "node/group/group.h"
|
||||||
#include "node/node.h"
|
#include "node/node.h"
|
||||||
#include "node/nodeundo.h"
|
#include "node/nodeundo.h"
|
||||||
@@ -40,6 +41,8 @@
|
|||||||
#include "widget/slider/integerslider.h"
|
#include "widget/slider/integerslider.h"
|
||||||
#include "widget/slider/rationalslider.h"
|
#include "widget/slider/rationalslider.h"
|
||||||
|
|
||||||
|
#include <OpenImageIO/detail/fmt/base.h>
|
||||||
|
|
||||||
namespace olive
|
namespace olive
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -179,6 +182,13 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
&NodeParamViewWidgetBridge::WidgetCallback);
|
&NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NodeValue::kPushButton: {
|
||||||
|
NodeInput input=GetInnerInput();
|
||||||
|
NodeParamButton *button=new NodeParamButton(input.name(),parent);
|
||||||
|
widgets_.append(button);
|
||||||
|
plugin::PluginNode* plugin_node=dynamic_cast<plugin::PluginNode*>(input.node());
|
||||||
|
connect(button, &NodeParamButton::onPressed, plugin_node, &plugin::PluginNode::pushButtonClicked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all properties
|
// Check all properties
|
||||||
|
|||||||
+1
-1
Submodule ext/KDDockWidgets updated: 0e9723b96b...6b0ef44eb1
Reference in New Issue
Block a user