From 9541ba5358a03af0f923dde4164eb574c3408f3e Mon Sep 17 00:00:00 2001 From: Licini Date: Wed, 3 Jul 2024 15:57:48 +0200 Subject: [PATCH] pass sceneform itself to callback --- scripts/treeform.py | 4 ++-- src/compas_viewer/components/sceneform.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/treeform.py b/scripts/treeform.py index e37497182..2c44a8e28 100644 --- a/scripts/treeform.py +++ b/scripts/treeform.py @@ -29,8 +29,8 @@ treeform = Treeform() viewer.ui.sidebar.widget.addWidget(treeform) -def update_treeform(obj): - treeform.update_from_dict({"name": obj.name, "objtype": obj.__class__, "item": obj.item, "settings": obj.settings}) +def update_treeform(form, node): + treeform.update_from_dict({"name": node.name, "objtype": node.__class__, "item": node.item, "settings": node.settings}) viewer.ui.sidebar.sceneform.callback = update_treeform diff --git a/src/compas_viewer/components/sceneform.py b/src/compas_viewer/components/sceneform.py index ab12df21a..a352d60e6 100644 --- a/src/compas_viewer/components/sceneform.py +++ b/src/compas_viewer/components/sceneform.py @@ -122,14 +122,14 @@ def on_item_clicked(self, item, column): for node in self.scene.objects: node.is_selected = node in selected_nodes if self.callback and node.is_selected: - self.callback(node) + self.callback(self, node) self.viewer.renderer.update() def on_item_selection_changed(self): for item in self.selectedItems(): if self.callback: - self.callback(item.node) + self.callback(self, item.node) def adjust_column_widths(self): for i in range(self.columnCount()):