Uranium
Application Framework
|
A scene node object. More...
Public Member Functions | |
__init__ (self, Optional["SceneNode"] parent=None, **kwargs) | |
Construct a scene node. | |
__deepcopy__ (self, memo) | |
setCenterPosition (self, Vector center) | |
Set the center position of this node. | |
Optional["SceneNode"] | getParent (self) |
Get the parent of this node. | |
Vector | getMirror (self) |
Vector | setMirror (self, vector) |
Optional[MeshData] | getBoundingBoxMesh (self) |
Get the MeshData of the bounding box. | |
calculateBoundingBoxMesh (self) | |
(re)Calculate the bounding box mesh. | |
addDecorator (self, SceneNodeDecorator decorator) | |
Add a SceneNodeDecorator to this SceneNode. | |
List[SceneNodeDecorator] | getDecorators (self) |
Get all SceneNodeDecorators that decorate this SceneNode. | |
Optional[SceneNodeDecorator] | getDecorator (self, dec_type) |
Get SceneNodeDecorators by type. | |
removeDecorators (self) | |
Remove all decorators. | |
removeDecorator (self, SceneNodeDecorator dec_type) | |
Remove decorator by type. | |
callDecoration (self, str function, *args, **kwargs) | |
Call a decoration of this SceneNode. | |
bool | hasDecoration (self, str function) |
Does this SceneNode have a certain Decoration (as defined by a Decorator) | |
str | getName (self) |
setName (self, str name) | |
int | getDepth (self) |
How many nodes is this node removed from the root? | |
setParent (self, Optional["SceneNode"] scene_node) | |
Set the parent of this object. | |
bool | isVisible (self) |
Get the visibility of this node. | |
setVisible (self, bool visible) | |
Set the visibility of this SceneNode. | |
Optional[MeshData] | getMeshData (self) |
Get the (original) mesh data from the scene node/object. | |
Optional[MeshData] | getMeshDataTransformed (self) |
Get the transformed mesh data from the scene node/object, based on the transformation of scene nodes wrt root. | |
numpy.ndarray | getMeshDataTransformedVertices (self) |
Get the transformed vertices from this scene node/object, based on the transformation of scene nodes wrt root. | |
numpy.ndarray | getMeshDataTransformedNormals (self) |
Get the transformed normals from this scene node/object, based on the transformation of scene nodes wrt root. | |
setMeshData (self, Optional[MeshData] mesh_data) | |
Set the mesh of this node/object. | |
addChild (self, "SceneNode" scene_node) | |
Add a child to this node and set it's parent as this node. | |
removeChild (self, "SceneNode" child) | |
remove a single child | |
removeAllChildren (self) | |
Removes all children and its children's children. | |
List["SceneNode"] | getChildren (self) |
Get the list of direct children. | |
bool | hasChildren (self) |
List["SceneNode"] | getAllChildren (self) |
Get list of all children (including it's children children children etc.) | |
Matrix | getWorldTransformation (self) |
Computes and returns the transformation from world to local space. | |
Matrix | getLocalTransformation (self) |
Returns the local transformation with respect to its parent. | |
setTransformation (self, Matrix transformation) | |
Quaternion | getOrientation (self) |
Get the local orientation value. | |
Quaternion | getWorldOrientation (self) |
rotate (self, Quaternion rotation, int transform_space=TransformSpace.Local) | |
Rotate the scene object (and thus its children) by given amount. | |
setOrientation (self, Quaternion orientation, int transform_space=TransformSpace.Local) | |
Set the local orientation of this scene node. | |
Vector | getScale (self) |
Get the local scaling value. | |
Vector | getWorldScale (self) |
scale (self, Vector scale, int transform_space=TransformSpace.Local) | |
Scale the scene object (and thus its children) by given amount. | |
setScale (self, Vector scale, int transform_space=TransformSpace.Local) | |
Set the local scale value. | |
Vector | getPosition (self) |
Get the local position. | |
Vector | getWorldPosition (self) |
Get the position of this scene node relative to the world. | |
translate (self, Vector translation, int transform_space=TransformSpace.Local) | |
Translate the scene object (and thus its children) by given amount. | |
setPosition (self, Vector position, int transform_space=TransformSpace.Local) | |
Set the local position value. | |
lookAt (self, Vector target, Vector up=Vector.Unit_Y) | |
Rotate this scene node in such a way that it is looking at target. | |
LOG_MATRIX (self, str_matrix_name, matrix) | |
Can be overridden by child nodes if they need to perform special rendering. | |
bool | render (self, renderer) |
bool | isEnabled (self) |
Get whether this SceneNode is enabled, that is, it can be modified in any way. | |
setEnabled (self, bool enable) | |
Set whether this SceneNode is enabled. | |
bool | isSelectable (self) |
Get whether this SceneNode can be selected. | |
setSelectable (self, bool select) | |
Set whether this SceneNode can be selected. | |
Optional[AxisAlignedBox] | getBoundingBox (self) |
Get the bounding box of this node and its children. | |
setCalculateBoundingBox (self, bool calculate) | |
Set whether or not to calculate the bounding box for this node. | |
Vector | getShear (self) |
str | getSetting (self, str key, str default_value="") |
setSetting (self, str key, str value) | |
__str__ (self) | |
String output for debugging. | |
Public Attributes | |
calculateBoundingBoxMesh | |
Signals. | |
Static Public Attributes | |
decoratorsChanged = Signal() | |
Signal for when a SceneNodeDecorator is added / removed. | |
parentChanged = Signal() | |
Emitted whenever the parent changes. | |
meshDataChanged = Signal() | |
Emitted whenever the attached mesh data object changes. | |
childrenChanged = Signal() | |
Emitted whenever the list of children of this object or any child object changes. | |
transformationChanged = Signal() | |
Signal. | |
boundingBoxChanged = Signal() | |
Protected Member Functions | |
_onParentChanged (self, Optional["SceneNode"] node) | |
Handler for the ParentChanged signal. | |
_onMeshDataChanged (self) | |
_transformChanged (self) | |
private: | |
_updateTransformation (self) | |
_resetAABB (self) | |
_calculateAABB (self) | |
A scene node object.
These objects can hold a mesh and multiple children. Each node has a transformation matrix that maps it it's parents space to the local space (it's inverse maps local space to parent).
SceneNodes can be "Decorated" by adding SceneNodeDecorator objects. These decorators can add functionality to scene nodes.
UM.Scene.SceneNode.SceneNode.__init__ | ( | self, | |
Optional["SceneNode"] | parent = None , |
||
** | kwargs | ||
) |
Construct a scene node.
parent | The parent of this node (if any). Only a root node should have None as a parent. |
kwargs | Keyword arguments. Possible keywords:
|
Reimplemented in UM.Scene.Platform.Platform, UM.Scene.ToolHandle.ToolHandle, and UM.Scene.Camera.Camera.
|
protected |
Handler for the ParentChanged signal.
node | Node from which this event was triggered. |
UM.Scene.SceneNode.SceneNode.addChild | ( | self, | |
"SceneNode" | scene_node | ||
) |
Add a child to this node and set it's parent as this node.
\params scene_node SceneNode to add.
UM.Scene.SceneNode.SceneNode.addDecorator | ( | self, | |
SceneNodeDecorator | decorator | ||
) |
Add a SceneNodeDecorator to this SceneNode.
<em>SceneNodeDecorator</em> | decorator The decorator to add. |
UM.Scene.SceneNode.SceneNode.callDecoration | ( | self, | |
str | function, | ||
* | args, | ||
** | kwargs | ||
) |
Call a decoration of this SceneNode.
SceneNodeDecorators add Decorations, which are callable functions.
<em>string</em> | function The function to be called. |
*args | |
**kwargs |
List["SceneNode"] UM.Scene.SceneNode.SceneNode.getAllChildren | ( | self | ) |
Get list of all children (including it's children children children etc.)
Optional[MeshData] UM.Scene.SceneNode.SceneNode.getBoundingBoxMesh | ( | self | ) |
Get the MeshData of the bounding box.
List["SceneNode"] UM.Scene.SceneNode.SceneNode.getChildren | ( | self | ) |
Get the list of direct children.
Optional[SceneNodeDecorator] UM.Scene.SceneNode.SceneNode.getDecorator | ( | self, | |
dec_type | |||
) |
Get SceneNodeDecorators by type.
dec_type | type of decorator to return. |
List[SceneNodeDecorator] UM.Scene.SceneNode.SceneNode.getDecorators | ( | self | ) |
Get all SceneNodeDecorators that decorate this SceneNode.
int UM.Scene.SceneNode.SceneNode.getDepth | ( | self | ) |
How many nodes is this node removed from the root?
Matrix UM.Scene.SceneNode.SceneNode.getLocalTransformation | ( | self | ) |
Returns the local transformation with respect to its parent.
(from parent to local) \retuns transformation 4x4 (homogenous) matrix
Optional[MeshData] UM.Scene.SceneNode.SceneNode.getMeshData | ( | self | ) |
Get the (original) mesh data from the scene node/object.
Optional[MeshData] UM.Scene.SceneNode.SceneNode.getMeshDataTransformed | ( | self | ) |
Get the transformed mesh data from the scene node/object, based on the transformation of scene nodes wrt root.
If this node is a group, it will recursively concatenate all child nodes/objects.
numpy.ndarray UM.Scene.SceneNode.SceneNode.getMeshDataTransformedNormals | ( | self | ) |
Get the transformed normals from this scene node/object, based on the transformation of scene nodes wrt root.
If this node is a group, it will recursively concatenate all child nodes/objects.
numpy.ndarray UM.Scene.SceneNode.SceneNode.getMeshDataTransformedVertices | ( | self | ) |
Get the transformed vertices from this scene node/object, based on the transformation of scene nodes wrt root.
If this node is a group, it will recursively concatenate all child nodes/objects.
Optional["SceneNode"] UM.Scene.SceneNode.SceneNode.getParent | ( | self | ) |
Get the parent of this node.
If the node has no parent, it is the root node.
Matrix UM.Scene.SceneNode.SceneNode.getWorldTransformation | ( | self | ) |
Computes and returns the transformation from world to local space.
bool UM.Scene.SceneNode.SceneNode.hasDecoration | ( | self, | |
str | function | ||
) |
Does this SceneNode have a certain Decoration (as defined by a Decorator)
<em>string</em> | function the function to check for. |
bool UM.Scene.SceneNode.SceneNode.isSelectable | ( | self | ) |
Get whether this SceneNode can be selected.
bool UM.Scene.SceneNode.SceneNode.isVisible | ( | self | ) |
Get the visibility of this node.
The parents visibility overrides the visibility. TODO: Let renderer actually use the visibility to decide whether to render or not.
UM.Scene.SceneNode.SceneNode.LOG_MATRIX | ( | self, | |
str_matrix_name, | |||
matrix | |||
) |
Can be overridden by child nodes if they need to perform special rendering.
If you need to handle rendering in a special way, for example for tool handles, you can override this method and render the node. Return True to prevent the view from rendering any attached mesh data.
renderer | The renderer object to use for rendering. |
Rotate this scene node in such a way that it is looking at target.
target | Vector The target to look at. |
up | Vector The vector to consider up. Defaults to Vector.Unit_Y, i.e. (0, 1, 0). |
UM.Scene.SceneNode.SceneNode.removeChild | ( | self, | |
"SceneNode" | child | ||
) |
remove a single child
child | Scene node that needs to be removed. |
UM.Scene.SceneNode.SceneNode.removeDecorator | ( | self, | |
SceneNodeDecorator | dec_type | ||
) |
Remove decorator by type.
dec_type | type of the decorator to remove. |
UM.Scene.SceneNode.SceneNode.rotate | ( | self, | |
Quaternion | rotation, | ||
int | transform_space = TransformSpace.Local |
||
) |
Rotate the scene object (and thus its children) by given amount.
rotation | Quaternion A quaternion indicating the amount of rotation. |
transform_space | The space relative to which to rotate. Can be any one of the constants in SceneNode::TransformSpace. |
UM.Scene.SceneNode.SceneNode.scale | ( | self, | |
Vector | scale, | ||
int | transform_space = TransformSpace.Local |
||
) |
Scale the scene object (and thus its children) by given amount.
scale | Vector A Vector with three scale values |
transform_space | The space relative to which to scale. Can be any one of the constants in SceneNode::TransformSpace. |
UM.Scene.SceneNode.SceneNode.setCalculateBoundingBox | ( | self, | |
bool | calculate | ||
) |
Set whether or not to calculate the bounding box for this node.
calculate | True if the bounding box should be calculated, False if not. |
UM.Scene.SceneNode.SceneNode.setCenterPosition | ( | self, | |
Vector | center | ||
) |
Set the center position of this node.
This is used to modify it's mesh data (and it's children) in such a way that they are centered. In most cases this means that we use the center of mass as center (which most objects don't use)
UM.Scene.SceneNode.SceneNode.setEnabled | ( | self, | |
bool | enable | ||
) |
Set whether this SceneNode is enabled.
enable | True if this object should be enabled, False if not. |
UM.Scene.SceneNode.SceneNode.setMeshData | ( | self, | |
Optional[MeshData] | mesh_data | ||
) |
Set the mesh of this node/object.
mesh_data | MeshData object |
Reimplemented in UM.Scene.Camera.Camera.
UM.Scene.SceneNode.SceneNode.setOrientation | ( | self, | |
Quaternion | orientation, | ||
int | transform_space = TransformSpace.Local |
||
) |
Set the local orientation of this scene node.
orientation | Quaternion The new orientation of this scene node. |
transform_space | The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace. |
UM.Scene.SceneNode.SceneNode.setParent | ( | self, | |
Optional["SceneNode"] | scene_node | ||
) |
Set the parent of this object.
scene_node | SceneNode that is the parent of this object. |
UM.Scene.SceneNode.SceneNode.setPosition | ( | self, | |
Vector | position, | ||
int | transform_space = TransformSpace.Local |
||
) |
Set the local position value.
position | The new position value of the SceneNode. |
transform_space | The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace. |
UM.Scene.SceneNode.SceneNode.setScale | ( | self, | |
Vector | scale, | ||
int | transform_space = TransformSpace.Local |
||
) |
Set the local scale value.
scale | Vector The new scale value of the scene node. |
transform_space | The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace. |
UM.Scene.SceneNode.SceneNode.setSelectable | ( | self, | |
bool | select | ||
) |
Set whether this SceneNode can be selected.
select | True if this SceneNode should be selectable, False if not. |
UM.Scene.SceneNode.SceneNode.translate | ( | self, | |
Vector | translation, | ||
int | transform_space = TransformSpace.Local |
||
) |
Translate the scene object (and thus its children) by given amount.
translation | Vector The amount to translate by. |
transform_space | The space relative to which to translate. Can be any one of the constants in SceneNode::TransformSpace. |
|
static |
Emitted whenever the list of children of this object or any child object changes.
object | The object that triggered the change. |
|
static |
Signal.
Emitted whenever the transformation of this object or any child object changes.
object | The object that caused the change. |