Skip to content

Commit

Permalink
pass sceneform itself to callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jul 3, 2024
1 parent 3b385f0 commit 9541ba5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/treeform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/compas_viewer/components/sceneform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down

0 comments on commit 9541ba5

Please sign in to comment.