SceneObject

class compas.scene.SceneObject[source]

Bases: TreeNode

Base class for all scene objects.

Parameters:
itemAny

The item which should be visualized using the created SceneObject.

namestr, optional

The name of the scene object. Note that is is not the same as the name of underlying data item, since different scene objects can refer to the same data item.

colorcompas.colors.Color, optional

The color of the object.

opacityfloat, optional

The opacity of the object.

showbool, optional

Flag for showing or hiding the object. Default is True.

framecompas.geometry.Frame, optional

The local frame of the scene object, in relation to its parent frame.

transformationcompas.geometry.Transformation, optional

The local transformation of the scene object in relation to its frame.

contextstr, optional

The context in which the scene object is created.

**kwargsdict

Additional keyword arguments to create the scene object for the item.

Attributes:
itemcompas.data.Data

The item which should be visualized using the created SceneObject.

namestr

The name of the scene object. Note that is is not the same as the name of underlying data item, since different scene objects can refer to the same data item.

nodecompas.scene.SceneObjectNode

The node in the scene tree which represents the scene object.

guidslist[object]

The GUIDs of the items drawn in the visualization context.

framecompas.geometry.Frame

The local frame of the scene object, in relation to its parent frame.

transformationcompas.geometry.Transformation

The local transformation of the scene object in relation to its frame.

worldtransformationcompas.geometry.Transformation

The transformation of the scene object in world coordinates.

colorcompas.colors.Color

The color of the object.

contrastcolorcompas.colors.Color, readon-only

The contrastcolor wrt to the color. This is a 50% darket or lighter version of the color, depending on whether the color is light or dark.

opacityfloat

The opacity of the object.

showbool

Flag for showing or hiding the object. Default is True.

settingsdict

The settings including necessary attributes for reconstructing the scene object besides the Data item.

contextstr

The context in which the scene object is created.

scenecompas.scene.Scene

The scene to which the scene object belongs.

Methods

add

Add a child item to the scene object.

clear

The main clearing method.

draw

The main drawing method.

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

remove

Remove a child node from this node.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

traverse

Traverse the tree from this node.

validate_data

Validate the data against the object's data schema.