Uranium
Application Framework
|
A scene node object. More...
Public Member Functions | |
def | __init__ (self, parent=None, kwargs) |
Construct a scene node. More... | |
def | __deepcopy__ (self, memo) |
def | setCenterPosition (self, center) |
Set the center position of this node. More... | |
def | getParent (self) |
Get the parent of this node. More... | |
def | getMirror (self) |
def | getBoundingBoxMesh (self) |
Get the MeshData of the bounding box. More... | |
def | calculateBoundingBoxMesh (self) |
(re)Calculate the bounding box mesh. More... | |
def | addDecorator (self, decorator) |
Add a SceneNodeDecorator to this SceneNode. More... | |
def | getDecorators (self) |
Get all SceneNodeDecorators that decorate this SceneNode. More... | |
def | getDecorator (self, dec_type) |
Get SceneNodeDecorators by type. More... | |
def | removeDecorators (self) |
Remove all decorators. | |
def | removeDecorator (self, dec_type) |
Remove decorator by type. More... | |
def | callDecoration (self, function, args, kwargs) |
Call a decoration of this SceneNode. More... | |
def | hasDecoration (self, function) |
Does this SceneNode have a certain Decoration (as defined by a Decorator) More... | |
def | getName (self) |
def | setName (self, name) |
def | getDepth (self) |
How many nodes is this node removed from the root? More... | |
def | setParent (self, scene_node) |
Set the parent of this object. More... | |
def | isVisible (self) |
Get the visibility of this node. More... | |
def | setVisible (self, visible) |
Set the visibility of this SceneNode. More... | |
def | getMeshData (self) |
Get the (original) mesh data from the scene node/object. More... | |
def | getMeshDataTransformed (self) |
Get the transformed mesh data from the scene node/object, based on the transformation of scene nodes wrt root. More... | |
def | setMeshData (self, mesh_data) |
Set the mesh of this node/object. More... | |
def | addChild |
Add a child to this node and set it's parent as this node. More... | |
def | removeChild |
remove a single child More... | |
def | removeAllChildren (self) |
Removes all children and its children's children. More... | |
def | getChildren (self) |
Get the list of direct children. More... | |
def | hasChildren (self) |
def | getAllChildren (self) |
Get list of all children (including it's children children children etc.) More... | |
def | getWorldTransformation (self) |
Computes and returns the transformation from world to local space. More... | |
def | getLocalTransformation (self) |
Returns the local transformation with respect to its parent. More... | |
def | setTransformation (self, transformation) |
def | getOrientation (self) |
Get the local orientation value. More... | |
def | getWorldOrientation (self) |
def | rotate (self, rotation, transform_space=TransformSpace.Local) |
Rotate the scene object (and thus its children) by given amount. More... | |
def | setOrientation (self, orientation, transform_space=TransformSpace.Local) |
Set the local orientation of this scene node. More... | |
def | getScale (self) |
Get the local scaling value. More... | |
def | getWorldScale (self) |
def | scale (self, scale, transform_space=TransformSpace.Local) |
Scale the scene object (and thus its children) by given amount. More... | |
def | setScale (self, scale, transform_space=TransformSpace.Local) |
Set the local scale value. More... | |
def | getPosition (self) |
Get the local position. More... | |
def | getWorldPosition (self) |
Get the position of this scene node relative to the world. More... | |
def | translate (self, translation, transform_space=TransformSpace.Local) |
Translate the scene object (and thus its children) by given amount. More... | |
def | setPosition (self, position, transform_space=TransformSpace.Local) |
Set the local position value. More... | |
def | lookAt (self, target, up=Vector.Unit_Y) |
Rotate this scene node in such a way that it is looking at target. More... | |
def | render (self, renderer) |
Can be overridden by child nodes if they need to perform special rendering. More... | |
def | isEnabled (self) |
Get whether this SceneNode is enabled, that is, it can be modified in any way. More... | |
def | setEnabled (self, enable) |
Set whether this SceneNode is enabled. More... | |
def | isSelectable (self) |
Get whether this SceneNode can be selected. More... | |
def | setSelectable (self, select) |
Set whether this SceneNode can be selected. More... | |
def | getBoundingBox (self) |
Get the bounding box of this node and its children. More... | |
def | getOriginalBoundingBox (self) |
Get the bounding box of this node and its children. More... | |
def | setCalculateBoundingBox (self, calculate) |
Set whether or not to calculate the bounding box for this node. More... | |
def | getShear (self) |
Static Public Attributes | |
decoratorsChanged = Signal() | |
Signal for when a SceneNodeDecorator is added / removed. More... | |
parentChanged = Signal() | |
Emitted whenever the parent changes. More... | |
meshDataChanged = Signal() | |
Emitted whenever the attached mesh data object changes. More... | |
childrenChanged = Signal() | |
Emitted whenever the list of children of this object or any child object changes. More... | |
transformationChanged = Signal() | |
Signal. More... | |
boundingBoxChanged = Signal() | |
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.
def UM.Scene.SceneNode.SceneNode.__init__ | ( | self, | |
parent = None , |
|||
kwargs | |||
) |
Construct a scene node.
def UM.Scene.SceneNode.SceneNode.addChild | ( | self, | |
scene_node | |||
) |
Add a child to this node and set it's parent as this node.
scene_node SceneNode to add.
def UM.Scene.SceneNode.SceneNode.addDecorator | ( | self, | |
decorator | |||
) |
Add a SceneNodeDecorator to this SceneNode.
<em>SceneNodeDecorator</em> | decorator The decorator to add. TODO: GetDecorator seems to imply that a scne node can only have a single decorator of a type, but we never enforce this. |
def UM.Scene.SceneNode.SceneNode.calculateBoundingBoxMesh | ( | self | ) |
(re)Calculate the bounding box mesh.
def UM.Scene.SceneNode.SceneNode.callDecoration | ( | self, | |
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 |
def UM.Scene.SceneNode.SceneNode.getAllChildren | ( | self | ) |
Get list of all children (including it's children children children etc.)
def UM.Scene.SceneNode.SceneNode.getBoundingBox | ( | self | ) |
Get the bounding box of this node and its children.
def UM.Scene.SceneNode.SceneNode.getBoundingBoxMesh | ( | self | ) |
Get the MeshData of the bounding box.
def UM.Scene.SceneNode.SceneNode.getChildren | ( | self | ) |
Get the list of direct children.
def UM.Scene.SceneNode.SceneNode.getDecorator | ( | self, | |
dec_type | |||
) |
Get SceneNodeDecorators by type.
dec_type | type of decorator to return. |
def UM.Scene.SceneNode.SceneNode.getDecorators | ( | self | ) |
Get all SceneNodeDecorators that decorate this SceneNode.
def UM.Scene.SceneNode.SceneNode.getDepth | ( | self | ) |
How many nodes is this node removed from the root?
def UM.Scene.SceneNode.SceneNode.getLocalTransformation | ( | self | ) |
Returns the local transformation with respect to its parent.
(from parent to local) transformation 4x4 (homogenous) matrix
def UM.Scene.SceneNode.SceneNode.getMeshData | ( | self | ) |
Get the (original) mesh data from the scene node/object.
def 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.
def UM.Scene.SceneNode.SceneNode.getOrientation | ( | self | ) |
Get the local orientation value.
def UM.Scene.SceneNode.SceneNode.getOriginalBoundingBox | ( | self | ) |
Get the bounding box of this node and its children.
Without taking any transformation into account
def UM.Scene.SceneNode.SceneNode.getParent | ( | self | ) |
Get the parent of this node.
If the node has no parent, it is the root node.
def UM.Scene.SceneNode.SceneNode.getPosition | ( | self | ) |
Get the local position.
def UM.Scene.SceneNode.SceneNode.getScale | ( | self | ) |
Get the local scaling value.
def UM.Scene.SceneNode.SceneNode.getWorldPosition | ( | self | ) |
Get the position of this scene node relative to the world.
def UM.Scene.SceneNode.SceneNode.getWorldTransformation | ( | self | ) |
Computes and returns the transformation from world to local space.
def UM.Scene.SceneNode.SceneNode.hasDecoration | ( | self, | |
function | |||
) |
Does this SceneNode have a certain Decoration (as defined by a Decorator)
<em>string</em> | function the function to check for. |
def UM.Scene.SceneNode.SceneNode.isEnabled | ( | self | ) |
Get whether this SceneNode is enabled, that is, it can be modified in any way.
def UM.Scene.SceneNode.SceneNode.isSelectable | ( | self | ) |
Get whether this SceneNode can be selected.
def 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.
def UM.Scene.SceneNode.SceneNode.lookAt | ( | self, | |
target, | |||
up = Vector.Unit_Y |
|||
) |
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). |
def UM.Scene.SceneNode.SceneNode.removeAllChildren | ( | self | ) |
Removes all children and its children's children.
def UM.Scene.SceneNode.SceneNode.removeChild | ( | self, | |
child | |||
) |
remove a single child
child | Scene node that needs to be removed. |
def UM.Scene.SceneNode.SceneNode.removeDecorator | ( | self, | |
dec_type | |||
) |
Remove decorator by type.
dec_type | type of the decorator to remove. |
def 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.
renderer | The renderer object to use for rendering. |
def UM.Scene.SceneNode.SceneNode.rotate | ( | self, | |
rotation, | |||
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. |
def UM.Scene.SceneNode.SceneNode.scale | ( | self, | |
scale, | |||
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. |
def UM.Scene.SceneNode.SceneNode.setCalculateBoundingBox | ( | self, | |
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. |
def UM.Scene.SceneNode.SceneNode.setCenterPosition | ( | self, | |
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)
def UM.Scene.SceneNode.SceneNode.setEnabled | ( | self, | |
enable | |||
) |
def UM.Scene.SceneNode.SceneNode.setMeshData | ( | self, | |
mesh_data | |||
) |
Set the mesh of this node/object.
mesh_data | MeshData object |
def UM.Scene.SceneNode.SceneNode.setOrientation | ( | self, | |
orientation, | |||
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. |
def UM.Scene.SceneNode.SceneNode.setParent | ( | self, | |
scene_node | |||
) |
Set the parent of this object.
scene_node | SceneNode that is the parent of this object. |
def UM.Scene.SceneNode.SceneNode.setPosition | ( | self, | |
position, | |||
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. |
def UM.Scene.SceneNode.SceneNode.setScale | ( | self, | |
scale, | |||
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. |
def UM.Scene.SceneNode.SceneNode.setSelectable | ( | self, | |
select | |||
) |
def UM.Scene.SceneNode.SceneNode.setVisible | ( | self, | |
visible | |||
) |
Set the visibility of this SceneNode.
def UM.Scene.SceneNode.SceneNode.translate | ( | self, | |
translation, | |||
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 for when a SceneNodeDecorator is added / removed.
|
static |
Emitted whenever the attached mesh data object changes.
|
static |
Emitted whenever the parent changes.
|
static |
Signal.
Emitted whenever the transformation of this object or any child object changes.
object | The object that caused the change. |