Menu

#67 X3DJSAIL: setPhysics in ParticleSystems/ParticleSystem.java returns void

X3D4
open
None
2025-12-29
2025-08-26
No

I'm not sure if returning void was intentional or not. Suggest changing X3dToJava.xslt to addPhysics, or return this.

    /**
     * Set single child physics node, replacing prior array of existing nodes (if any).
     * <br><br>
     * <i>Note:</i> according to X3D Unified Object Model (X3DUOM), acceptable node types are restricted to X3DParticlePhysicsModelNode.
     * @param newValue is new node for the physics field (restricted to X3DParticlePhysicsModelNode)
     */
    /* @Override */
    public void setPhysics(org.web3d.x3d.sai.Core.X3DNode newValue)
    {
            if (newValue == null)
            {
                    clearPhysics(); // reset newValueNullClearsFieldReturnVoid
                    return;
            }
            if  (newValue instanceof org.web3d.x3d.sai.Core.X3DNode)
            {
                    for (org.web3d.x3d.sai.Core.X3DNode element : physics)
                            ((X3DConcreteElement) element).clearParent(); // remove references to facilitate Java memory management
                    clearPhysics(); // reset
                    ((X3DConcreteElement) newValue).setParent(this); // parentTest8
                    physics.add(newValue);
            }
            else throw new org.web3d.x3d.sai.InvalidFieldValueException("org.web3d.x3d.sai.Core.X3DNode newValue is not instanceof org.web3d.x3d.sai.Core.X3DNode; newValue=" + newValue);

}

Discussion

  • John W Carlson

    John W Carlson - 2025-08-26

    Attaching original file (may be buggy).

     
  • John W Carlson

    John W Carlson - 2025-08-26

    Attaching generated Java (from X3dToJava.xslt

     
  • Don Brutzman

    Don Brutzman - 2025-12-29

    Please provide a valid .x3d input model. That is always a necessary prerequisite to testing Java conversion and corresponding X3DJSAIL support.

    n.b. this model throws the same validation errors on ParticleSystem contained nodes.

     

Log in to post a comment.

MongoDB Logo MongoDB