Open michael-barrow opened 6 years ago
Hello Michael,
Thank for reporting the issue. I think this could be investigated as part of the work done with Mass by @hugtalbot in #637
To me this is a fundamental problem of Sofa scene were, in some case (because of specific implementation of component) the ordering of initialization matter and in some GUI we cannot control the ordering except by creating the object in the right sequence.
In my opinion the abstraction should change or the c++ instantiation should be made more robust. As of now the Mass node appears to be a child of a Mechanical Object, but this is not reflected in the xml where they are siblings. I would suggest the abstraction should change since I imagine mathematically order matters sometimes and it would be a bad idea to guess the correct order during instantiation.
@epernod can we consider that your PR on visualizing Data dependency #1187 corresponds to this issue? Have you noticed it @mjbarrow
Issue: Adding "UniformMass" To a Node before a "MechanicalObject" in Modeler leads to badly formatted .scn files that cannot be instantiated in SOFA
Expected Outcome: Adding Mechanical State and Mass to a node in an arbitrary order from the Modeler Gui will construct well formatted .scn files
Steps to Reproduce: Follow the Pendulum Step By step Tutorial (step 0). Add UniformMass before MechanicalObject. Save the .scn. This .scn will not instantiate the UniformMass and will instead output the error shown in the image below:
Alternatively, the problem can be demonstrated with this minimal .scn. If MechanicalObject and UniformMass tags are swapped, simulation is possible.
<?xml version="1.0"?>
<Node name="Root" dt="0.01" >
<VisualStyle name="visualStyle1" displayFlags="showVisual showBehavior hideCollision hideMapping hideOptions" />
<Node name="FirstObject" >
<UniformMass template="Vec3d" name="Mass" filename="unused" />
<MechanicalObject template="Vec3d" name="Particles" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" derivX="0 0 0 0 0 0 0 0 0" showObject="1" showObjectScale="0.5" size="1" />
</Node>
</Node>
Suggested labels: