[x3d-public] X3DJSAIL: Usage of addChild witth fieldObject and fieldValueObject?
Don Brutzman
brutzman at nps.edu
Mon Feb 27 18:17:51 PST 2017
Another excellent catch. 8)
Content model for field element is OK in XML Schema and Object Model for X3D, an oversight was found and fixed in X3DJSAIL interface generation.
Same change applies to fieldValueObject. This also led to an improved validation check, avoiding an unnecessary exception.
Node type for field/field method is now addChild(X3DNode newValue), rather than the overly restrictive and incorrect addChild(X3DChildNode newValue)
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/fieldObject.html#addChild-org.web3d.x3d.sai.Core.X3DNode-
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/fieldValueObject.html#addChild-org.web3d.x3d.sai.Core.X3DNode-
This correction will be deployed later tonight. Your example appears to run satisfactorily, program output attached.
On 2/27/2017 5:12 PM, yottzumm at gmail.com wrote:
> Appears that I can’t use geometry (Box, Sphere) as a child of field or fieldValue in JSON? Would addChildren work better?
>
>
>
> Thanks,
>
>
>
> John
>
>
>
> rubikOnFire.java:101: error: incompatible types: SphereObject cannot be converted to X3DChildNode
>
> field0_0_4_0_2.addChild(Sphere0_0_4_0_2_0);
>
> ^
>
> rubikOnFire.java:142: error: incompatible types: SphereObject cannot be converted to X3DChildNode
>
> field0_0_6_0_2.addChild(Sphere0_0_6_0_2_0);
>
> ^
>
> rubikOnFire.java:209: error: incompatible types: SphereObject cannot be converted to X3DChildNode
>
> field0_0_8_0_2.addChild(Sphere0_0_8_0_2_0);
>
> ^
>
> rubikOnFire.java:276: error: incompatible types: SphereObject cannot be converted to X3DChildNode
>
> field0_0_10_0_2.addChild(Sphere0_0_10_0_2_0);
>
> ^
>
> rubikOnFire.java:339: error: incompatible types: BoxObject cannot be converted to X3DChildNode
>
> fieldValue0_0_12_2.addChild(Box0_0_12_2_0);
>
> ^
>
> Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
>
> 5 errors
>
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
-------------- next part --------------
{ "X3D": {
"encoding":"UTF-8",
"@profile":"Immersive",
"@version":"3.3",
"@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
"JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
"Scene": {
"-children":[
{ "NavigationInfo":
{
"@type":["EXAMINE"]
}
},
{ "Viewpoint":
{
"@description":"Rubiks Cube on Fire",
"@position":[0,0,12]
}
},
{ "ProtoDeclare":
{
"@name":"anyShape",
"ProtoInterface": {
"field": [
{
"@name":"xtranslation",
"@accessType":"inputOutput",
"@type":"SFVec3f",
"@value":[0,0,0]
},
{
"@name":"myShape",
"@accessType":"inputOutput",
"@type":"SFNode",
"-children":[
{ "Sphere":
{
}
}
]
}
]
},
"ProtoBody": {
"-children":[
{ "Transform":
{
"IS": {
"connect": [
{
"@nodeField":"translation",
"@protoField":"xtranslation"
}
]
},
"-children":[
{ "Shape":
{
"IS": {
"connect": [
{
"@nodeField":"geometry",
"@protoField":"myShape"
}
]
},
"-appearance":
{ "Appearance":
{
"-material":
{ "Material":
{
"@diffuseColor":[1,1,1]
}
}
}
}
}
}
]
}
}
]
}
}
},
{ "ProtoDeclare":
{
"@name":"three",
"ProtoInterface": {
"field": [
{
"@name":"ytranslation",
"@accessType":"inputOutput",
"@type":"SFVec3f",
"@value":[0,0,0]
},
{
"@name":"myShape",
"@accessType":"inputOutput",
"@type":"SFNode",
"-children":[
{ "Sphere":
{
}
}
]
}
]
},
"ProtoBody": {
"-children":[
{ "Transform":
{
"IS": {
"connect": [
{
"@nodeField":"translation",
"@protoField":"ytranslation"
}
]
},
"-children":[
{ "ProtoInstance":
{
"@name":"anyShape",
"fieldValue": [
{
"@name":"xtranslation",
"@value":[0,0,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"anyShape",
"fieldValue": [
{
"@name":"xtranslation",
"@value":[2,0,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"anyShape",
"fieldValue": [
{
"@name":"xtranslation",
"@value":[-2,0,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
}
]
}
}
]
}
}
},
{ "ProtoDeclare":
{
"@name":"nine",
"ProtoInterface": {
"field": [
{
"@name":"ztranslation",
"@accessType":"inputOutput",
"@type":"SFVec3f",
"@value":[0,0,0]
},
{
"@name":"myShape",
"@accessType":"inputOutput",
"@type":"SFNode",
"-children":[
{ "Sphere":
{
}
}
]
}
]
},
"ProtoBody": {
"-children":[
{ "Transform":
{
"IS": {
"connect": [
{
"@nodeField":"translation",
"@protoField":"ztranslation"
}
]
},
"-children":[
{ "ProtoInstance":
{
"@name":"three",
"fieldValue": [
{
"@name":"ytranslation",
"@value":[0,0,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"three",
"fieldValue": [
{
"@name":"ytranslation",
"@value":[0,2,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"three",
"fieldValue": [
{
"@name":"ytranslation",
"@value":[0,-2,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
}
]
}
}
]
}
}
},
{ "ProtoDeclare":
{
"@name":"twentyseven",
"ProtoInterface": {
"field": [
{
"@name":"ttranslation",
"@accessType":"inputOutput",
"@type":"SFVec3f",
"@value":[0,0,0]
},
{
"@name":"myShape",
"@accessType":"inputOutput",
"@type":"SFNode",
"-children":[
{ "Sphere":
{
}
}
]
}
]
},
"ProtoBody": {
"-children":[
{ "Transform":
{
"IS": {
"connect": [
{
"@nodeField":"translation",
"@protoField":"ttranslation"
}
]
},
"-children":[
{ "ProtoInstance":
{
"@name":"nine",
"fieldValue": [
{
"@name":"ztranslation",
"@value":[0,0,0]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"nine",
"fieldValue": [
{
"@name":"ztranslation",
"@value":[0,0,2]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"nine",
"fieldValue": [
{
"@name":"ztranslation",
"@value":[0,0,-2]
}
],
"IS": {
"connect": [
{
"@nodeField":"myShape",
"@protoField":"myShape"
}
]
}
}
}
]
}
}
]
}
}
},
{ "ProtoInstance":
{
"@name":"twentyseven",
"fieldValue": [
{
"@name":"ttranslation",
"@value":[0,0,0]
},
{
"@name":"myShape",
"-children":[
{ "Box":
{
"@size":[1,1,1]
}
}
]
}
]
}
}
]
}
}
}
More information about the x3d-public
mailing list