Skip to content

MakeAlias

This object creates an alias to a component name to make the scene more readable.

Target: Sofa.Component.SceneUtility

namespace: sofa::component::sceneutility::makealiascomponent

parents:

  • BaseObject

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the object belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
targetcomponent The component class for which to create an alias.
alias The new alias of the component.
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseObject
master nullptr for regular objects, or master object for which this object is one sub-objects BaseObject

Examples

MakeAlias.scn

<?xml version='1.0'?>                                               
<Node   name='Root' gravity='0 0 0' time='0' animate='0' bbox="-1 -1 -1 1 1 1"  >   
        <RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [MakeAlias] -->
        <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
        <DefaultAnimationLoop/>
        <MakeAlias targetcomponent='MechanicalObject' alias='Mecha'/>    
        <MechanicalObject  name="createdWithAlias" position="1 2 3"/>    
</Node>                                                             
def createScene(root_node):

   root = root_node.addChild('Root', gravity="0 0 0", time="0", animate="0", bbox="-1 -1 -1 1 1 1")

   root.addObject('RequiredPlugin', name="Sofa.Component.SceneUtility")
   root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('MakeAlias', targetcomponent="MechanicalObject", alias="Mecha")
   root.addObject('MechanicalObject', name="createdWithAlias", position="1 2 3")