add: some codes about nodes plugin.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2022 Olive 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/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
node/plugins/Plugin.h
|
||||
node/plugins/Plugin.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Created by katherinesolar on 25-8-3.
|
||||
//
|
||||
|
||||
#include "Plugin.h"
|
||||
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 "";
|
||||
}
|
||||
|
||||
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 "";
|
||||
}
|
||||
void olive::plugin::PluginNode::Value(const NodeValueRow &value,
|
||||
const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
methods.value(&node_ctx_functions);
|
||||
}
|
||||
|
||||
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 "";
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Created by katherinesolar on 25-8-3.
|
||||
//
|
||||
|
||||
#ifndef PLUGIN_H
|
||||
#define PLUGIN_H
|
||||
#include "node/node.h"
|
||||
#include "pluginSupport/Plugin.h"
|
||||
#include "pluginSupport/olive_plugin.h"
|
||||
namespace olive
|
||||
{
|
||||
namespace plugin
|
||||
{
|
||||
|
||||
class PluginNode : public olive::Node{
|
||||
public:
|
||||
PluginNode():Node()
|
||||
{
|
||||
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 id() const override;
|
||||
QVector<CategoryID> Category() const override;
|
||||
QString Description() const override;
|
||||
void Value(const NodeValueRow &value,
|
||||
const NodeGlobals &globals, NodeValueTable *table) const override;
|
||||
private:
|
||||
struct olive_node_methods methods;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //PLUGIN_H
|
||||
Reference in New Issue
Block a user