Skip to content

MakeAlias

This object create 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 objet 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.

Links:

Name Description
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used)
slaves Sub-objects used internally by this object
master nullptr for regular objects, or master object for which this object is one sub-objects

Examples

Component/SceneUtility/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(rootNode):

    Root = rootNode.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")