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.
- color
compas.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
.- frame
compas.geometry.Frame
, optional The local frame of the scene object, in relation to its parent frame.
- transformation
compas.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:
- item
compas.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.
- node
compas.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.
- frame
compas.geometry.Frame
The local frame of the scene object, in relation to its parent frame.
- transformation
compas.geometry.Transformation
The local transformation of the scene object in relation to its frame.
- worldtransformation
compas.geometry.Transformation
The transformation of the scene object in world coordinates.
- color
compas.colors.Color
The color of the object.
- contrastcolor
compas.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.
- scene
compas.scene.Scene
The scene to which the scene object belongs.
- item
Methods
Add a child item to the scene object.
The main clearing method.
The main drawing method.
Inherited Methods
Converts the instance to a string.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Remove a child node from this node.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Traverse the tree from this node.
Validate the data against the object's data schema.