[x3d-public] Trying to add children
John Carlson
yottzumm at gmail.com
Sun Mar 30 07:52:57 PDT 2025
I am dumping my scene:
var xml = Browser.currentScene.toXMLString();
document.querySelector("#x3d").innerHTML = xml;
And it only shows the ProtoBody, which is OK.
<Group>
<Transform DEF='protoSlider'>
<IS>
<connect nodeField='translation' protoField='sliderTranslation'/>
</IS>
<Transform DEF='protoTransform'>
<IS>
<connect nodeField='translation' protoField='transformTranslation'/>
<connect nodeField='translation' protoField='sensorTranslation'/>
</IS>
<PlaneSensor DEF='protoSensor'
maxPosition='1 0'/>
<Transform>
<TouchSensor DEF='protoTS'/>
</Transform>
<Transform>
<Shape>
<Appearance>
<Material/>
</Appearance>
<Text DEF='protoText'>
<IS>
<connect nodeField='string' protoField='textString'/>
</IS>
<FontStyle
size='0.23'/>
</Text>
</Shape>
</Transform>
</Transform>
</Transform>
<Script DEF='protoValueTransformerScript'
directOutput='true'
mustEvaluate='true'>
<field accessType='inputOutput' type='SFFloat' name='protoScale'/>
<field accessType='inputOutput' type='MFString' name='petNames'/>
<field accessType='inputOutput' type='SFString'
name='protoParameterName'/>
<field accessType='inputOutput' type='SFNode' name='shader'/>
<field accessType='inputOnly' type='SFVec3f' name='newTranslation'/>
<field accessType='outputOnly' type='SFFloat'
name='protoValue_changed'/>
<field accessType='outputOnly' type='MFString'
name='protoText_changed'/>
<IS>
<connect nodeField='protoScale' protoField='parameterScale'/>
<connect nodeField='petNames' protoField='petNames'/>
<connect nodeField='protoParameterName' protoField='parameterName'/>
<connect nodeField='shader' protoField='shaderNode'/>
</IS>
<![CDATA[../javascripts/X3DUser.js]]>
</Script>
<Group DEF='nodeGroup'/>
<Group DEF='linkGroup'/>
</Group>
<ROUTE fromNode='protoSensor' fromField='translation_changed'
toNode='protoTransform' toField='set_translation'/>
<ROUTE fromNode='protoSensor' fromField='translation_changed'
toNode='protoValueTransformerScript' toField='newTranslation'/>
<ROUTE fromNode='protoValueTransformerScript' fromField='protoText_changed'
toNode='protoText' toField='set_string'/>
I am adding children nodes like:
const setMFField = function(node, fieldName, value) {
let field = node.getField(fieldName);
let children = field.getValue();
children.push(value);
field.setValue(children);
}
setMFField(nodeTransform, 'addChildren', shape);
setMFField(linkTransform, 'addChildren', shape);
setMFField(nodeGroup, 'addChildren', nodeTransform);
setMFField(linkGroup, 'addChildren', linkTransform);
Nothing is being added to the nodeGroup and linkGroup, as far as i can
tell. The textarea is continually being refreshed.
Any hints with SAI are welcome.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250330/a7a196fa/attachment-0001.html>
More information about the x3d-public
mailing list