[x3d-public] X3DJSAIL. Use of fields in ProtoInterface. addField() no longerworks.

Don Brutzman brutzman at nps.edu
Wed Feb 15 09:32:17 PST 2017


On 2/14/2017 8:08 PM, yottzumm at gmail.com wrote:
> Don,
>
> Are you requiring the Java 8 syntax for X3DJSAIL application programmers?  Thanks!

No restrictions.  The declarative approach is an interesting style and no backwards compatibility with classical programming practice is sacrificed.

also: Thank You for continuing reports such as the following, John.  i first need to get out of "tall grass" of DOM + Java Reflection but will keep getting back to these and sorting each one out, they are very important.

> *From: *yottzumm at gmail.com <mailto:yottzumm at gmail.com>
> *Sent: *Tuesday, February 14, 2017 11:00 PM
> *To: *Don Brutzman <mailto:brutzman at nps.edu>; Roy Walmsley <mailto:roy.walmsley at ntlworld.com>; X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> *Subject: *X3DJSAIL. Use of fields in ProtoInterface. addField() no longerworks.
>
> Please provide example of calling setChildren() with multiple field objects, or perhaps allow addChildren().  Haven’t spent too much time on this, addChildren() may work.  Perhaps fix addField() to allow MFNode and SFNode, or remove from API??  Have validate call setChildren or addChildren for MFNodes and SFNodes?  Many choices here. Modify fieldObject to not throw an exception of addChildren() is called on fieldObject?

preliminary answer: please see the HelloWorldProgram.java for many example invocations.

secondary answer:  the pre-existing Java SAI interfaces are sometimes more restrictive that we might hope.  Working document to keep track of issues at

	http://www.web3d.org/specifications/java/X3dJavaSceneAuthoringInterface.html#SpecificationChanges

	http://www.web3d.org/specifications/java/X3dJavaSpecificationChangesAndIssues.txt

third answer: have been experimenting with JSAIL utility methods, such as pipelined addChild which can be easier to use sometimes.

	http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Grouping/GroupObject.html#addChild-org.web3d.x3d.sai.Core.X3DChildNode-

fourth answer: protos are especially tricky but definitely converging to meet use cases.  work in progress, let's keep pushing!!  8)


> Abox.java (attached)
>
> Exception in thread "main" org.web3d.x3d.sai.InvalidProtoException: field name='myShape' with type='MFNode' cannot have any simple-type value (newValue='').  Use setChildren() method instead.
>
>         at org.web3d.x3d.jsail.Core.fieldObject.setValue(fieldObject.java:770)
>         at org.web3d.x3d.jsail.Core.fieldObject.validate(fieldObject.java:1044)
>         at org.web3d.x3d.jsail.Core.ProtoInterfaceObject.addField(ProtoInterfaceObject.java:466)
>         at abox.main(abox.java:88)

not quite understanding what you are trying to do here...

suggested approach:
- you will hopefully find an existing pattern (or TODO comment) in HelloWorldProgram
- show regular-encoding version of your goal scene for understanding (.x3d or .json or .x3dv or .wrl)
- let's build the java manually to match, once understood then go for the pattern

> I noted the change to the package structure.

glad to hear, again thanks.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list