Add push button support for OFX plugins

This commit adds support for push buttons in OFX plugins by:

- Adding `kPushButton` to `NodeValue` enum
- Implementing `pushButtonClicked` slot in `PluginNode`
- Creating `NodeParamButton` widget for UI representation
- Updating `paraminstance.h` to handle push button instances
- Modifying `nodeparamviewwidgetbridge.cpp` to connect push button signals
This commit is contained in:
2025-11-10 13:57:04 +08:00
parent 8a7b6cf869
commit 5aaa49c515
10 changed files with 188 additions and 66 deletions
+26 -24
View File
@@ -15,28 +15,30 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/nodeparamview/nodeparamview.cpp
widget/nodeparamview/nodeparamview.h
widget/nodeparamview/nodeparamviewarraywidget.cpp
widget/nodeparamview/nodeparamviewarraywidget.h
widget/nodeparamview/nodeparamviewconnectedlabel.cpp
widget/nodeparamview/nodeparamviewconnectedlabel.h
widget/nodeparamview/nodeparamviewcontext.cpp
widget/nodeparamview/nodeparamviewcontext.h
widget/nodeparamview/nodeparamviewdockarea.cpp
widget/nodeparamview/nodeparamviewdockarea.h
widget/nodeparamview/nodeparamviewitem.cpp
widget/nodeparamview/nodeparamviewitem.h
widget/nodeparamview/nodeparamviewitembase.cpp
widget/nodeparamview/nodeparamviewitembase.h
widget/nodeparamview/nodeparamviewitemtitlebar.cpp
widget/nodeparamview/nodeparamviewitemtitlebar.h
widget/nodeparamview/nodeparamviewkeyframecontrol.cpp
widget/nodeparamview/nodeparamviewkeyframecontrol.h
widget/nodeparamview/nodeparamviewtextedit.cpp
widget/nodeparamview/nodeparamviewtextedit.h
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
widget/nodeparamview/nodeparamviewwidgetbridge.h
PARENT_SCOPE
${OLIVE_SOURCES}
widget/nodeparamview/nodeparamview.cpp
widget/nodeparamview/nodeparamview.h
widget/nodeparamview/nodeparamviewarraywidget.cpp
widget/nodeparamview/nodeparamviewarraywidget.h
widget/nodeparamview/nodeparamviewconnectedlabel.cpp
widget/nodeparamview/nodeparamviewconnectedlabel.h
widget/nodeparamview/nodeparamviewcontext.cpp
widget/nodeparamview/nodeparamviewcontext.h
widget/nodeparamview/nodeparamviewdockarea.cpp
widget/nodeparamview/nodeparamviewdockarea.h
widget/nodeparamview/nodeparamviewitem.cpp
widget/nodeparamview/nodeparamviewitem.h
widget/nodeparamview/nodeparamviewitembase.cpp
widget/nodeparamview/nodeparamviewitembase.h
widget/nodeparamview/nodeparamviewitemtitlebar.cpp
widget/nodeparamview/nodeparamviewitemtitlebar.h
widget/nodeparamview/nodeparamviewkeyframecontrol.cpp
widget/nodeparamview/nodeparamviewkeyframecontrol.h
widget/nodeparamview/nodeparamviewtextedit.cpp
widget/nodeparamview/nodeparamviewtextedit.h
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
widget/nodeparamview/nodeparamviewwidgetbridge.h
widget/nodeparamview/nodeparambutton.h
widget/nodeparamview/nodeparambutton.cpp
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 "core.h"
#include "nodeparambutton.h"
#include "node/group/group.h"
#include "node/node.h"
#include "node/nodeundo.h"
@@ -40,6 +41,8 @@
#include "widget/slider/integerslider.h"
#include "widget/slider/rationalslider.h"
#include <OpenImageIO/detail/fmt/base.h>
namespace olive
{
@@ -179,6 +182,13 @@ void NodeParamViewWidgetBridge::CreateWidgets()
&NodeParamViewWidgetBridge::WidgetCallback);
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