From e28d162919ac09cb62a55fc76026ff1a7b15deb8 Mon Sep 17 00:00:00 2001 From: tomvanmele Date: Tue, 25 Jun 2024 10:21:26 +0200 Subject: [PATCH] ruff --- scripts/buffer.py | 4 ++-- scripts/dynamic_box.py | 5 +++-- scripts/forms.py | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/buffer.py b/scripts/buffer.py index 87e315a300..4afc7f710f 100644 --- a/scripts/buffer.py +++ b/scripts/buffer.py @@ -1,7 +1,7 @@ -from compas_viewer.scene import BufferGeometry -from compas_viewer import Viewer import numpy as np +from compas_viewer import Viewer +from compas_viewer.scene import BufferGeometry points = np.random.rand(1000, 3) * 10 pointcolor = np.random.rand(1000, 4) diff --git a/scripts/dynamic_box.py b/scripts/dynamic_box.py index 3a4026b91c..811a676378 100644 --- a/scripts/dynamic_box.py +++ b/scripts/dynamic_box.py @@ -1,7 +1,7 @@ from random import random -from compas.geometry import Box from compas.datastructures import Mesh +from compas.geometry import Box from compas_viewer import Viewer viewer = Viewer() @@ -9,10 +9,11 @@ mesh = Mesh.from_shape(Box.from_width_height_depth(2, 2, 2)) obj = viewer.scene.add(mesh) + @viewer.on(interval=100) def deform_mesh(frame): for v in mesh.vertices(): - vertex: list = mesh.vertex_attributes(v, "xyz") + vertex: list = mesh.vertex_attributes(v, "xyz") vertex[0] += (random() - 0.5) * 0.1 vertex[1] += (random() - 0.5) * 0.1 vertex[2] += (random() - 0.5) * 0.1 diff --git a/scripts/forms.py b/scripts/forms.py index 02fea74e65..4baca9b050 100644 --- a/scripts/forms.py +++ b/scripts/forms.py @@ -3,9 +3,9 @@ from compas.datastructures import Mesh from compas.geometry import Box from compas.geometry import Frame -from compas_viewer.viewer import Viewer -from compas_viewer.config import Config from compas_viewer.components import Sceneform +from compas_viewer.config import Config +from compas_viewer.viewer import Viewer config = Config() config.ui.sidebar.sceneform = False @@ -33,6 +33,7 @@ def callback(item): print("Callback triggered on", item) + viewer.ui.sidebar.widget.addWidget(Sceneform(viewer.scene, {"Name": (lambda o: o.name)}, callback=callback)) viewer.show()