Skip to content

FiberArt Plugin Development Tutorial

Plugin Installation

  1. Open FiberArt.
  2. Select Plugin from the menu bar, then click Plugin Management.
  3. In the popup interface, click Install Plugin.
  4. In the file selection dialog, navigate to the folder where the plugin is located and click to select.
  5. After the installation is complete, restart the software. The installed plugin can be found in the submenu of Plugin in the menu bar (depending on the specific plugin's function, they are generally located here).

Plugin Development

To develop a plugin with a GUI, the principle is that the user develops a Widget using PySide themselves, then places this Widget into a QDockWidget, and then embeds the QDockWidget into FiberArt's QMainWindow.

In the Python script, users can use the FiberArt Python SDK interface to call relevant FiberArt functions, such as creating nodes, getting selected nodes, calling node methods, attributes, etc.

Custom Plugin Example

Refer to this simple plugin example.

Demo/__init__.py
import PyFiberArt
from FiberArtDefaultPlugins.utils import (
    QtWidgets,
    add_plugin_widget,
    decorator_factory_selected_node,
)


def create_demo():
    # create the widget
    w = QtWidgets.QWidget()
    layout = QtWidgets.QVBoxLayout()
    w.setLayout(layout)

    label = QtWidgets.QLabel("这是一个示例插件,试试选中一个节点,然后点击按钮")
    layout.addWidget(label)

    btn = QtWidgets.QPushButton("显示选中节点")
    layout.addWidget(btn)

    @decorator_factory_selected_node(PyFiberArt.Node)
    def btn_cb(node: PyFiberArt.Node):
        label.setText(f"你选择了{node.GetName()}")

    btn.clicked.connect(btn_cb)

    add_plugin_widget(w, win_title="自定义插件", visible=True)


create_demo()

Demo acts as a regular Python module. During the startup of the FiberArt software, an import Demo statement is executed.