From 63ca066aa121c355095c13a205699999f1cf2c03 Mon Sep 17 00:00:00 2001 From: tomvanmele Date: Fri, 23 Aug 2024 23:35:22 +0200 Subject: [PATCH] default base color --- CHANGELOG.md | 1 + src/compas_notebook/scene/sceneobject.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4af324e..f1d066d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added custom scene `compas_notebook.scene.Scene`. +* Added default base color to all scene objects. ### Changed diff --git a/src/compas_notebook/scene/sceneobject.py b/src/compas_notebook/scene/sceneobject.py index 14ea812..ebea822 100644 --- a/src/compas_notebook/scene/sceneobject.py +++ b/src/compas_notebook/scene/sceneobject.py @@ -6,6 +6,7 @@ from compas.geometry import Rotation from compas.geometry import Transformation from compas.scene import SceneObject +from compas.scene.descriptors.color import ColorAttribute Rx = Rotation.from_axis_and_angle([1, 0, 0], 3.14159 / 2) @@ -13,6 +14,8 @@ class ThreeSceneObject(SceneObject): """Base class for all PyThreeJS scene objects.""" + color = ColorAttribute(default=Color(0.2, 0.2, 0.2)) + def y_to_z(self, transformation: Transformation) -> Transformation: """Convert a transformation from COMPAS to the ThreeJS coordinate system.