Skip to content

MakeDataAlias

This object create an alias to a data field.

Target: Sofa.Component.SceneUtility

namespace: sofa::component::sceneutility::makedataaliascomponent

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
componentname The component class for which to create an alias.
dataname The data field for which to create an alias.
alias The alias of the data field.

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/MakeDataAlias.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 [MakeDataAlias] -->
       <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
       <DefaultAnimationLoop/>      
       <MakeDataAlias componentname='MechanicalObject' dataname='position' alias='myrest_position'/> 
       <MechanicalObject name="position should be 1 2 3 " myrest_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('MakeDataAlias', componentname="MechanicalObject", dataname="position", alias="myrest_position")
    Root.addObject('MechanicalObject', name="position should be 1 2 3 ", myrest_position="1 2 3")