Skip to content

Commit e717b11

Browse files
feat: Transform Editor toolbox plugin — PJ3 Custom Series port
Ports PlotJuggler 3's Custom Series / Function Editor as a data-only toolbox plugin. The UI mirrors PJ3: a Single Function tab (drag-drop source, additional sources with a primary-source radio in the first column, function body), a Batch Functions tab, and a function library — an interactive browser sub-panel and Import / Export of the library to a JSON file. Data-only: the plugin never runs a script itself. On Save it hands the host a self-describing Luau class (N inputs -> M outputs) via `pj.data_processors.v1`, run live as a DerivedEngine node; the live preview is produced host-side too (ephemeral transform + validate). There is no local Lua engine in the plugin. Requires plotjuggler_sdk 0.14.0 — the data-processor script API, the interactive sub-panel + table radio-column dialog additions (#136), and the save-file picker used by the library Export (#138). The extern/plotjuggler_core submodule is pinned to an SDK build carrying both. Contents: - transform_editor_plugin.cpp — dialog + toolbox: drag-drop, primary-source radio, function library browser, Import/Export, host-side preview, name-prompt + overwrite on Save, createTransform on Save. - transform_editor_dialog.ui — PJ3-style UI. - manifest.json / CMakeLists.txt / conanfile.py — registration; SDK 0.14.0. Pairs with the host side: PlotJuggler/PJ4#252.
1 parent 82f1ed6 commit e717b11

8 files changed

Lines changed: 2426 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ if(TARGET plotjuggler_sdk::plugin_sdk)
4949
add_subdirectory(toolbox_quaternion)
5050
add_subdirectory(toolbox_reactive_scripts_editor)
5151
add_subdirectory(toolbox_mosaico)
52+
add_subdirectory(toolbox_transform_editor)
5253
return()
5354
endif()
5455

SDK_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.0
1+
0.14.0
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
find_package(nlohmann_json REQUIRED)
2+
3+
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/EmbedUi.cmake)
4+
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/EmbedManifest.cmake)
5+
6+
add_library(toolbox_transform_editor_plugin SHARED transform_editor_plugin.cpp)
7+
8+
target_compile_features(toolbox_transform_editor_plugin PRIVATE cxx_std_20)
9+
target_compile_options(toolbox_transform_editor_plugin PRIVATE ${PJ_WARNING_FLAGS})
10+
11+
target_link_libraries(toolbox_transform_editor_plugin PRIVATE
12+
plotjuggler_sdk::plugin_sdk
13+
nlohmann_json::nlohmann_json
14+
)
15+
16+
# When built as part of the PJ4 app (not standalone), link pj_dialog_engine_qt
17+
# to get access to ChartPreviewWidget for the live preview chart.
18+
if(TARGET pj_dialog_engine_qt)
19+
target_link_libraries(toolbox_transform_editor_plugin PRIVATE pj_dialog_engine_qt)
20+
target_compile_definitions(toolbox_transform_editor_plugin PRIVATE PJ_HAS_CHART_PREVIEW=1)
21+
endif()
22+
23+
target_include_directories(toolbox_transform_editor_plugin PRIVATE
24+
${CMAKE_CURRENT_BINARY_DIR}/generated
25+
)
26+
27+
pj_embed_ui(toolbox_transform_editor_plugin
28+
UI_FILE ${CMAKE_CURRENT_SOURCE_DIR}/transform_editor_dialog.ui
29+
HEADER ${CMAKE_CURRENT_BINARY_DIR}/generated/transform_editor_dialog_ui.hpp
30+
VAR_NAME kTransformEditorDialogUi
31+
)
32+
33+
pj_embed_manifest(toolbox_transform_editor_plugin
34+
HEADER ${CMAKE_CURRENT_BINARY_DIR}/generated/transform_editor_manifest.hpp
35+
VAR_NAME kTransformEditorManifest
36+
)
37+
38+
pj_emit_plugin_manifest(toolbox_transform_editor_plugin
39+
FAMILY toolbox
40+
MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/manifest.json
41+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
from conan import ConanFile
3+
4+
5+
_SDK_VERSION = (
6+
open(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, "SDK_VERSION"))
7+
.read()
8+
.strip()
9+
)
10+
11+
12+
class ToolboxTransformEditorConan(ConanFile):
13+
name = "toolbox_transform_editor"
14+
version = "0"
15+
settings = "os", "compiler", "build_type", "arch"
16+
generators = "CMakeDeps", "CMakeToolchain"
17+
requires = (
18+
f"plotjuggler_sdk/{_SDK_VERSION}",
19+
"gtest/1.17.0",
20+
"nlohmann_json/3.12.0",
21+
)
22+
default_options = {"*:shared": False}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"id": "toolbox-transform-editor",
3+
"name": "Transform Editor",
4+
"version": "1.0.0",
5+
"description": "Create named derived time series using Lua functions. Equivalent to the Custom Series editor in PJ3.",
6+
"author": "PlotJuggler Team",
7+
"publisher": "PlotJuggler",
8+
"website": "https://github.com/PlotJuggler/pj-official-plugins",
9+
"repository": "https://github.com/PlotJuggler/pj-official-plugins",
10+
"license": "MIT",
11+
"icon_url": "",
12+
"category": "toolbox",
13+
"tags": [
14+
"lua",
15+
"transform",
16+
"derived",
17+
"custom",
18+
"toolbox",
19+
"hidden"
20+
],
21+
"min_plotjuggler_version": "4.0.0"
22+
}

toolbox_transform_editor/transform_editor_dialog.ui

Lines changed: 618 additions & 0 deletions
Large diffs are not rendered by default.

toolbox_transform_editor/transform_editor_plugin.cpp

Lines changed: 1720 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)