Uranium
Application Framework
|
Public Member Functions | |
None | __init__ (self, Optional["SceneNode"] parent=None, bool visible=True, str name="", str node_id="") |
"SceneNode" | __deepcopy__ (self, Dict[int, object] memo) |
None | setCenterPosition (self, Vector center) |
Optional["SceneNode"] | getParent (self) |
Vector | getMirror (self) |
None | setMirror (self, vector) |
Optional[MeshData] | getBoundingBoxMesh (self) |
None | calculateBoundingBoxMesh (self) |
bool | collidesWithBbox (self, AxisAlignedBox check_bbox) |
None | addDecorator (self, SceneNodeDecorator decorator) |
List[SceneNodeDecorator] | getDecorators (self) |
Optional[SceneNodeDecorator] | getDecorator (self, type dec_type) |
removeDecorators (self) | |
None | removeDecorator (self, type dec_type) |
Any | callDecoration (self, str function, *args, **kwargs) |
bool | hasDecoration (self, str function) |
str | getName (self) |
None | setName (self, str name) |
str | getId (self) |
None | setId (self, str node_id) |
int | getDepth (self) |
None | setParent (self, Optional["SceneNode"] scene_node) |
bool | isVisible (self) |
None | setVisible (self, bool visible) |
Optional[MeshData] | getMeshData (self) |
Optional[MeshData] | getMeshDataTransformed (self) |
Optional[numpy.ndarray] | getMeshDataTransformedVertices (self) |
Optional[numpy.ndarray] | getMeshDataTransformedNormals (self) |
None | setMeshData (self, Optional[MeshData] mesh_data) |
None | addChild (self, "SceneNode" scene_node) |
None | removeChild (self, "SceneNode" child) |
None | removeAllChildren (self) |
List["SceneNode"] | getChildren (self) |
bool | hasChildren (self) |
List["SceneNode"] | getAllChildren (self) |
Matrix | getCachedNormalMatrix (self) |
Matrix | getWorldTransformation (self, copy=True) |
Matrix | getLocalTransformation (self, copy=True) |
setTransformation (self, Matrix transformation) | |
Quaternion | getOrientation (self) |
Quaternion | getWorldOrientation (self) |
None | rotate (self, Quaternion rotation, int transform_space=TransformSpace.Local) |
None | setOrientation (self, Quaternion orientation, int transform_space=TransformSpace.Local) |
Vector | getScale (self) |
Vector | getWorldScale (self) |
None | scale (self, Vector scale, int transform_space=TransformSpace.Local) |
None | setScale (self, Vector scale, int transform_space=TransformSpace.Local) |
Vector | getPosition (self) |
Vector | getWorldPosition (self) |
None | translate (self, Vector translation, int transform_space=TransformSpace.Local) |
None | setPosition (self, Vector position, int transform_space=TransformSpace.Local) |
None | lookAt (self, Vector target, Vector up=Vector.Unit_Y) |
bool | render (self, renderer) |
bool | isEnabled (self) |
None | setEnabled (self, bool enable) |
bool | isSelectable (self) |
None | setSelectable (self, bool select) |
Optional[AxisAlignedBox] | getBoundingBox (self) |
None | setCalculateBoundingBox (self, bool calculate) |
Vector | getShear (self) |
Any | getSetting (self, str key, Any default_value=None) |
None | setSetting (self, str key, Any value) |
None | invertNormals (self) |
str | __str__ (self) |
Public Attributes | |
metadata | |
source_mime_type | |
Static Public Attributes | |
decoratorsChanged = Signal() | |
parentChanged = Signal() | |
meshDataChanged = Signal() | |
childrenChanged = Signal() | |
transformationChanged = Signal() | |
boundingBoxChanged = Signal() | |
Protected Member Functions | |
None | _onParentChanged (self, Optional["SceneNode"] node) |
None | _onMeshDataChanged (self) |
None | _updateCachedNormalMatrix (self) |
None | _transformChanged (self) |
None | _updateLocalTransformation (self) |
None | _updateWorldTransformation (self) |
None | _updateTransformation (self) |
None | _resetAABB (self) |
None | _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. :sa SceneNodeDecorator :todo Add unit testing
None UM.Scene.SceneNode.SceneNode.__init__ | ( | self, | |
Optional["SceneNode"] | parent = None, | ||
bool | visible = True, | ||
str | name = "", | ||
str | node_id = "" ) |
Construct a scene node. :param parent: The parent of this node (if any). Only a root node should have None as a parent. :param visible: Is the SceneNode (and thus, all its children) visible? :param name: Name of the SceneNode.
Reimplemented in UM.Scene.Platform.Platform, UM.Scene.ToolHandle.ToolHandle, and UM.Scene.Camera.Camera.
str UM.Scene.SceneNode.SceneNode.__str__ | ( | self | ) |
String output for debugging.
|
protected |
Handler for the ParentChanged signal :param node: Node from which this event was triggered.
None 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.
None UM.Scene.SceneNode.SceneNode.addDecorator | ( | self, | |
SceneNodeDecorator | decorator ) |
Add a SceneNodeDecorator to this SceneNode. :param decorator: The decorator to add.
None UM.Scene.SceneNode.SceneNode.calculateBoundingBoxMesh | ( | self | ) |
(re)Calculate the bounding box mesh.
Any UM.Scene.SceneNode.SceneNode.callDecoration | ( | self, | |
str | function, | ||
* | args, | ||
** | kwargs ) |
Call a decoration of this SceneNode. SceneNodeDecorators add Decorations, which are callable functions. :param function: The function to be called. :param *args :param **kwargs
bool UM.Scene.SceneNode.SceneNode.collidesWithBbox | ( | self, | |
AxisAlignedBox | check_bbox ) |
Return if the provided bbox collides with the bbox of this SceneNode
List["SceneNode"] UM.Scene.SceneNode.SceneNode.getAllChildren | ( | self | ) |
Get list of all children (including it's children children children etc.) :returns: list ALl children in this 'tree'
Optional[AxisAlignedBox] UM.Scene.SceneNode.SceneNode.getBoundingBox | ( | self | ) |
Get the bounding box of this node and its children.
Optional[MeshData] UM.Scene.SceneNode.SceneNode.getBoundingBoxMesh | ( | self | ) |
Get the MeshData of the bounding box :returns: :type{MeshData} Bounding box mesh.
List["SceneNode"] UM.Scene.SceneNode.SceneNode.getChildren | ( | self | ) |
Get the list of direct children :returns: List of children
Optional[SceneNodeDecorator] UM.Scene.SceneNode.SceneNode.getDecorator | ( | self, | |
type | dec_type ) |
Get SceneNodeDecorators by type. :param dec_type: type of decorator to return.
List[SceneNodeDecorator] UM.Scene.SceneNode.SceneNode.getDecorators | ( | self | ) |
Get all SceneNodeDecorators that decorate this SceneNode. :return: list of all SceneNodeDecorators.
int UM.Scene.SceneNode.SceneNode.getDepth | ( | self | ) |
How many nodes is this node removed from the root? :return: Steps from root (0 means it -is- the root).
Matrix UM.Scene.SceneNode.SceneNode.getLocalTransformation | ( | self, | |
copy = True ) |
Returns the local transformation with respect to its parent. (from parent to local) :returns transformation 4x4 (homogeneous) matrix
Optional[MeshData] UM.Scene.SceneNode.SceneNode.getMeshData | ( | self | ) |
Get the (original) mesh data from the scene node/object. :returns: MeshData
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. :returns: MeshData
Optional[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. :return: numpy.ndarray
Optional[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. :return: numpy.ndarray
Quaternion UM.Scene.SceneNode.SceneNode.getOrientation | ( | self | ) |
Get the local orientation value.
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. :returns: SceneNode if it has a parent and None if it's the root node.
Vector UM.Scene.SceneNode.SceneNode.getPosition | ( | self | ) |
Get the local position.
Vector UM.Scene.SceneNode.SceneNode.getScale | ( | self | ) |
Get the local scaling value.
Vector UM.Scene.SceneNode.SceneNode.getWorldPosition | ( | self | ) |
Get the position of this scene node relative to the world.
Matrix UM.Scene.SceneNode.SceneNode.getWorldTransformation | ( | self, | |
copy = True ) |
Computes and returns the transformation from world to local space. :returns: 4x4 transformation matrix
bool UM.Scene.SceneNode.SceneNode.hasDecoration | ( | self, | |
str | function ) |
Does this SceneNode have a certain Decoration (as defined by a Decorator) :param :type{string} function the function to check for.
bool UM.Scene.SceneNode.SceneNode.isEnabled | ( | self | ) |
Get whether this SceneNode is enabled, that is, it can be modified in any way.
bool UM.Scene.SceneNode.SceneNode.isSelectable | ( | self | ) |
Get whether this SceneNode can be selected. :note This will return false if isEnabled() returns false.
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.
Rotate this scene node in such a way that it is looking at target. :param target: :type{Vector} The target to look at. :param up: :type{Vector} The vector to consider up. Defaults to Vector.Unit_Y, i.e. (0, 1, 0).
None UM.Scene.SceneNode.SceneNode.removeAllChildren | ( | self | ) |
Removes all children and its children's children.
None UM.Scene.SceneNode.SceneNode.removeChild | ( | self, | |
"SceneNode" | child ) |
remove a single child :param child: Scene node that needs to be removed.
None UM.Scene.SceneNode.SceneNode.removeDecorator | ( | self, | |
type | dec_type ) |
Remove decorator by type. :param dec_type: type of the decorator to remove.
UM.Scene.SceneNode.SceneNode.removeDecorators | ( | self | ) |
Remove all decorators
bool UM.Scene.SceneNode.SceneNode.render | ( | self, | |
renderer ) |
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. :param renderer: The renderer object to use for rendering. :return: False if the view should render this node, True if we handle our own rendering.
Reimplemented in UM.Scene.Camera.Camera, UM.Scene.Platform.Platform, and UM.Scene.ToolHandle.ToolHandle.
None UM.Scene.SceneNode.SceneNode.rotate | ( | self, | |
Quaternion | rotation, | ||
int | transform_space = TransformSpace.Local ) |
Rotate the scene object (and thus its children) by given amount :param rotation: :type{Quaternion} A quaternion indicating the amount of rotation. :param transform_space: The space relative to which to rotate. Can be any one of the constants in SceneNode::TransformSpace.
None UM.Scene.SceneNode.SceneNode.scale | ( | self, | |
Vector | scale, | ||
int | transform_space = TransformSpace.Local ) |
Scale the scene object (and thus its children) by given amount :param scale: :type{Vector} A Vector with three scale values :param transform_space: The space relative to which to scale. Can be any one of the constants in SceneNode::TransformSpace.
None UM.Scene.SceneNode.SceneNode.setCalculateBoundingBox | ( | self, | |
bool | calculate ) |
Set whether or not to calculate the bounding box for this node. :param calculate: True if the bounding box should be calculated, False if not.
None 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)
None UM.Scene.SceneNode.SceneNode.setEnabled | ( | self, | |
bool | enable ) |
Set whether this SceneNode is enabled. :param enable: True if this object should be enabled, False if not. :sa isEnabled
Reimplemented in UM.Scene.ToolHandle.ToolHandle.
None UM.Scene.SceneNode.SceneNode.setMeshData | ( | self, | |
Optional[MeshData] | mesh_data ) |
Set the mesh of this node/object :param mesh_data: MeshData object
Reimplemented in UM.Scene.Camera.Camera.
None UM.Scene.SceneNode.SceneNode.setOrientation | ( | self, | |
Quaternion | orientation, | ||
int | transform_space = TransformSpace.Local ) |
Set the local orientation of this scene node. :param orientation: :type{Quaternion} The new orientation of this scene node. :param transform_space: The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.
None UM.Scene.SceneNode.SceneNode.setParent | ( | self, | |
Optional["SceneNode"] | scene_node ) |
:brief Set the parent of this object :param scene_node: SceneNode that is the parent of this object.
None UM.Scene.SceneNode.SceneNode.setPosition | ( | self, | |
Vector | position, | ||
int | transform_space = TransformSpace.Local ) |
Set the local position value. :param position: The new position value of the SceneNode. :param transform_space: The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.
None UM.Scene.SceneNode.SceneNode.setScale | ( | self, | |
Vector | scale, | ||
int | transform_space = TransformSpace.Local ) |
Set the local scale value. :param scale: :type{Vector} The new scale value of the scene node. :param transform_space: The space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.
None UM.Scene.SceneNode.SceneNode.setSelectable | ( | self, | |
bool | select ) |
Set whether this SceneNode can be selected. :param select: True if this SceneNode should be selectable, False if not.
None UM.Scene.SceneNode.SceneNode.setVisible | ( | self, | |
bool | visible ) |
Set the visibility of this SceneNode.
None UM.Scene.SceneNode.SceneNode.translate | ( | self, | |
Vector | translation, | ||
int | transform_space = TransformSpace.Local ) |
Translate the scene object (and thus its children) by given amount. :param translation: :type{Vector} The amount to translate by. :param transform_space: The space relative to which to translate. Can be any one of the constants in SceneNode::TransformSpace.