Uranium
Application Framework
UM.Scene.SceneNode.SceneNode Class Reference

A scene node object. More...

Inheritance diagram for UM.Scene.SceneNode.SceneNode:
UM.Scene.Camera.Camera UM.Scene.Platform.Platform UM.Scene.ToolHandle.ToolHandle

Public Member Functions

def __init__
 Construct a scene node. More...
 
def __deepcopy__ (self, memo)
 
def setCenterPosition
 Set the center position of this node. More...
 
def getParent (self)
 Get the parent of this node. More...
 
def getMirror (self)
 
def setMirror (self, vector)
 
def getBoundingBoxMesh (self)
 Get the MeshData of the bounding box. More...
 
def calculateBoundingBoxMesh (self)
 (re)Calculate the bounding box mesh. More...
 
def addDecorator
 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
 Remove decorator by type. More...
 
def callDecoration
 Call a decoration of this SceneNode. More...
 
def hasDecoration
 Does this SceneNode have a certain Decoration (as defined by a Decorator) More...
 
def getName (self)
 
def setName
 
def getDepth (self)
 How many nodes is this node removed from the root? More...
 
def setParent
 Set the parent of this object. More...
 
def isVisible (self)
 Get the visibility of this node. More...
 
def setVisible
 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 getMeshDataTransformedVertices (self)
 Get the transformed vertices from this scene node/object, based on the transformation of scene nodes wrt root. More...
 
def getMeshDataTransformedNormals (self)
 Get the transformed normals from this scene node/object, based on the transformation of scene nodes wrt root. More...
 
def setMeshData
 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
 
def getOrientation (self)
 Get the local orientation value. More...
 
def getWorldOrientation (self)
 
def rotate
 Rotate the scene object (and thus its children) by given amount. More...
 
def setOrientation
 Set the local orientation of this scene node. More...
 
def getScale (self)
 Get the local scaling value. More...
 
def getWorldScale (self)
 
def scale
 Scale the scene object (and thus its children) by given amount. More...
 
def setScale
 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
 Translate the scene object (and thus its children) by given amount. More...
 
def setPosition
 Set the local position value. More...
 
def lookAt
 Rotate this scene node in such a way that it is looking at target. More...
 
def LOG_MATRIX (self, str_matrix_name, matrix)
 Can be overridden by child nodes if they need to perform special rendering. More...
 
def render (self, renderer)
 
def isEnabled (self)
 Get whether this SceneNode is enabled, that is, it can be modified in any way. More...
 
def setEnabled
 Set whether this SceneNode is enabled. More...
 
def isSelectable (self)
 Get whether this SceneNode can be selected. More...
 
def setSelectable
 Set whether this SceneNode can be selected. More...
 
def getBoundingBox (self)
 Get the bounding box of this node and its children. More...
 
def setCalculateBoundingBox
 Set whether or not to calculate the bounding box for this node. More...
 
def getShear (self)
 
def getSetting
 
def setSetting
 
def __str__ (self)
 String output for debugging. More...
 

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()
 

Detailed Description

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.

See also
SceneNodeDecorator
Todo:
Add unit testing

Constructor & Destructor Documentation

◆ __init__()

def UM.Scene.SceneNode.SceneNode.__init__ (   self,
  parent 
)

Construct a scene node.

Parameters
parentThe parent of this node (if any). Only a root node should have None as a parent.
kwargsKeyword arguments. Possible keywords:
  • visible bool Is the SceneNode (and thus, all it's children) visible? Defaults to True
  • name string Name of the SceneNode. Defaults to empty string.

Member Function Documentation

◆ __str__()

def UM.Scene.SceneNode.SceneNode.__str__ (   self)

String output for debugging.

◆ addChild()

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.

◆ addDecorator()

def UM.Scene.SceneNode.SceneNode.addDecorator (   self,
  decorator 
)

Add a SceneNodeDecorator to this SceneNode.

Parameters
<em>SceneNodeDecorator</em>decorator The decorator to add.

◆ calculateBoundingBoxMesh()

def UM.Scene.SceneNode.SceneNode.calculateBoundingBoxMesh (   self)

(re)Calculate the bounding box mesh.

◆ callDecoration()

def UM.Scene.SceneNode.SceneNode.callDecoration (   self,
  function 
)

Call a decoration of this SceneNode.

SceneNodeDecorators add Decorations, which are callable functions.

Parameters
<em>string</em>function The function to be called.
*args
**kwargs

◆ getAllChildren()

def UM.Scene.SceneNode.SceneNode.getAllChildren (   self,
  List,
  SceneNode 
)

Get list of all children (including it's children children children etc.)

Returns
list ALl children in this 'tree'

◆ getBoundingBox()

def UM.Scene.SceneNode.SceneNode.getBoundingBox (   self,
  Optional,
  AxisAlignedBox 
)

Get the bounding box of this node and its children.

◆ getBoundingBoxMesh()

def UM.Scene.SceneNode.SceneNode.getBoundingBoxMesh (   self,
  Optional,
  MeshData 
)

Get the MeshData of the bounding box.

Returns
MeshData Bounding box mesh.

◆ getChildren()

def UM.Scene.SceneNode.SceneNode.getChildren (   self,
  List,
  SceneNode 
)

Get the list of direct children.

Returns
List of children

◆ getDecorator()

def UM.Scene.SceneNode.SceneNode.getDecorator (   self,
  dec_type,
  Optional,
  SceneNodeDecorator 
)

Get SceneNodeDecorators by type.

Parameters
dec_typetype of decorator to return.

◆ getDecorators()

def UM.Scene.SceneNode.SceneNode.getDecorators (   self,
  List,
  SceneNodeDecorator 
)

Get all SceneNodeDecorators that decorate this SceneNode.

Returns
list of all SceneNodeDecorators.

◆ getDepth()

def UM.Scene.SceneNode.SceneNode.getDepth (   self,
  int 
)

How many nodes is this node removed from the root?

Returns
|tupe{int} Steps from root (0 means it -is- the root).

◆ getLocalTransformation()

def UM.Scene.SceneNode.SceneNode.getLocalTransformation (   self,
  Matrix 
)

Returns the local transformation with respect to its parent.

(from parent to local) transformation 4x4 (homogenous) matrix

◆ getMeshData()

def UM.Scene.SceneNode.SceneNode.getMeshData (   self,
  Optional,
  MeshData 
)

Get the (original) mesh data from the scene node/object.

Returns
MeshData

◆ getMeshDataTransformed()

def UM.Scene.SceneNode.SceneNode.getMeshDataTransformed (   self,
  Optional,
  MeshData 
)

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

◆ getMeshDataTransformedNormals()

def UM.Scene.SceneNode.SceneNode.getMeshDataTransformedNormals (   self,
  numpy,
  ndarray 
)

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.

Returns
numpy.ndarray

◆ getMeshDataTransformedVertices()

def UM.Scene.SceneNode.SceneNode.getMeshDataTransformedVertices (   self,
  numpy,
  ndarray 
)

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.

Returns
numpy.ndarray

◆ getOrientation()

def UM.Scene.SceneNode.SceneNode.getOrientation (   self,
  Quaternion 
)

Get the local orientation value.

◆ getParent()

def UM.Scene.SceneNode.SceneNode.getParent (   self,
  Optional,
  SceneNode 
)

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.

◆ getPosition()

def UM.Scene.SceneNode.SceneNode.getPosition (   self,
  Vector 
)

Get the local position.

◆ getScale()

def UM.Scene.SceneNode.SceneNode.getScale (   self,
  Vector 
)

Get the local scaling value.

◆ getWorldPosition()

def UM.Scene.SceneNode.SceneNode.getWorldPosition (   self,
  Vector 
)

Get the position of this scene node relative to the world.

◆ getWorldTransformation()

def UM.Scene.SceneNode.SceneNode.getWorldTransformation (   self,
  Matrix 
)

Computes and returns the transformation from world to local space.

Returns
4x4 transformation matrix

◆ hasDecoration()

def UM.Scene.SceneNode.SceneNode.hasDecoration (   self,
  function 
)

Does this SceneNode have a certain Decoration (as defined by a Decorator)

Parameters
<em>string</em>function the function to check for.

◆ isEnabled()

def UM.Scene.SceneNode.SceneNode.isEnabled (   self,
  bool 
)

Get whether this SceneNode is enabled, that is, it can be modified in any way.

◆ isSelectable()

def UM.Scene.SceneNode.SceneNode.isSelectable (   self,
  bool 
)

Get whether this SceneNode can be selected.

Note
This will return false if isEnabled() returns false.

◆ isVisible()

def UM.Scene.SceneNode.SceneNode.isVisible (   self,
  bool 
)

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.

◆ LOG_MATRIX()

def 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.

Parameters
rendererThe renderer object to use for rendering.
Returns
False if the view should render this node, True if we handle our own rendering.

◆ lookAt()

def UM.Scene.SceneNode.SceneNode.lookAt (   self,
  target 
)

Rotate this scene node in such a way that it is looking at target.

Parameters
targetVector The target to look at.
upVector The vector to consider up. Defaults to Vector.Unit_Y, i.e. (0, 1, 0).

◆ removeAllChildren()

def UM.Scene.SceneNode.SceneNode.removeAllChildren (   self)

Removes all children and its children's children.

◆ removeChild()

def UM.Scene.SceneNode.SceneNode.removeChild (   self,
  child 
)

remove a single child

Parameters
childScene node that needs to be removed.

◆ removeDecorator()

def UM.Scene.SceneNode.SceneNode.removeDecorator (   self,
  dec_type 
)

Remove decorator by type.

Parameters
dec_typetype of the decorator to remove.

◆ rotate()

def UM.Scene.SceneNode.SceneNode.rotate (   self,
  rotation 
)

Rotate the scene object (and thus its children) by given amount.

Parameters
rotationQuaternion A quaternion indicating the amount of rotation.
transform_spaceThe space relative to which to rotate. Can be any one of the constants in SceneNode::TransformSpace.

◆ scale()

def UM.Scene.SceneNode.SceneNode.scale (   self,
  scale 
)

Scale the scene object (and thus its children) by given amount.

Parameters
scaleVector A Vector with three scale values
transform_spaceThe space relative to which to scale. Can be any one of the constants in SceneNode::TransformSpace.

◆ setCalculateBoundingBox()

def UM.Scene.SceneNode.SceneNode.setCalculateBoundingBox (   self,
  calculate 
)

Set whether or not to calculate the bounding box for this node.

Parameters
calculateTrue if the bounding box should be calculated, False if not.

◆ setCenterPosition()

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)

◆ setEnabled()

def UM.Scene.SceneNode.SceneNode.setEnabled (   self,
  enable 
)

Set whether this SceneNode is enabled.

Parameters
enableTrue if this object should be enabled, False if not.
See also
isEnabled

◆ setMeshData()

def UM.Scene.SceneNode.SceneNode.setMeshData (   self,
  mesh_data 
)

Set the mesh of this node/object.

Parameters
mesh_dataMeshData object

◆ setOrientation()

def UM.Scene.SceneNode.SceneNode.setOrientation (   self,
  orientation 
)

Set the local orientation of this scene node.

Parameters
orientationQuaternion The new orientation of this scene node.
transform_spaceThe space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.

◆ setParent()

def UM.Scene.SceneNode.SceneNode.setParent (   self,
  scene_node 
)

Set the parent of this object.

Parameters
scene_nodeSceneNode that is the parent of this object.

◆ setPosition()

def UM.Scene.SceneNode.SceneNode.setPosition (   self,
  position 
)

Set the local position value.

Parameters
positionThe new position value of the SceneNode.
transform_spaceThe space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.

◆ setScale()

def UM.Scene.SceneNode.SceneNode.setScale (   self,
  scale 
)

Set the local scale value.

Parameters
scaleVector The new scale value of the scene node.
transform_spaceThe space relative to which to rotate. Can be Local or World from SceneNode::TransformSpace.

◆ setSelectable()

def UM.Scene.SceneNode.SceneNode.setSelectable (   self,
  select 
)

Set whether this SceneNode can be selected.

Parameters
selectTrue if this SceneNode should be selectable, False if not.

◆ setVisible()

def UM.Scene.SceneNode.SceneNode.setVisible (   self,
  visible 
)

Set the visibility of this SceneNode.

◆ translate()

def UM.Scene.SceneNode.SceneNode.translate (   self,
  translation 
)

Translate the scene object (and thus its children) by given amount.

Parameters
translationVector The amount to translate by.
transform_spaceThe space relative to which to translate. Can be any one of the constants in SceneNode::TransformSpace.

Member Data Documentation

◆ childrenChanged

UM.Scene.SceneNode.SceneNode.childrenChanged = Signal()
static

Emitted whenever the list of children of this object or any child object changes.

Parameters
objectThe object that triggered the change.

◆ decoratorsChanged

UM.Scene.SceneNode.SceneNode.decoratorsChanged = Signal()
static

Signal for when a SceneNodeDecorator is added / removed.

◆ meshDataChanged

UM.Scene.SceneNode.SceneNode.meshDataChanged = Signal()
static

Emitted whenever the attached mesh data object changes.

◆ parentChanged

UM.Scene.SceneNode.SceneNode.parentChanged = Signal()
static

Emitted whenever the parent changes.

◆ transformationChanged

UM.Scene.SceneNode.SceneNode.transformationChanged = Signal()
static

Signal.

Emitted whenever the transformation of this object or any child object changes.

Parameters
objectThe object that caused the change.

The documentation for this class was generated from the following file: