Skip to content

MakeDataAlias

This object creates 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 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
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.
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

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(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('MakeDataAlias', componentname="MechanicalObject", dataname="position", alias="myrest_position")
   root.addObject('MechanicalObject', name="position should be 1 2 3 ", myrest_position="1 2 3")