[x3d-public] X3D Python pyjnius API/Pipelining serializer problem (similar reported before)

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Tue Apr 30 08:52:25 PDT 2019


On 4/29/2019 6:31 PM, John Carlson wrote:
> A similar error has been reported recently.

I've been doing some work on X3DLoaderObject and thing that fixed the first of the following two errors.  Build logs follow below.

Not sure what is wrong with setProtoField exception.  Source code excerpts follow.

.x3d
           <Transform DEF='blade_Y1' rotation='0 0 1 1.2'>
             <IS>
               <connect nodeField='scale' protoField='frontBladeSize'/>
               <connect nodeField='translation' protoField='frontSideBladeHeight'/>
             </IS>
             <Transform USE='BLADE'/>
           </Transform>

.py
        .addChild(Transform() \
         .setDEF(SFString("blade_Y1")) \
         .setRotation(SFRotation([0,0,1,1.2])) \
         .setIS(IS() \
          .addConnect(connect() \
           .setNodeField(SFString("scale")) \
           .setProtoField(SFString("frontBladeSize")) \
          ) \
          .addConnect(connect() \
           .setNodeField(SFString("translation")) \
           .setProtoField(SFString("frontSideBladeHeight")) \
          ) \
         ) \
         .addChild(Transform() \
          .setUSE(SFString("BLADE")) \
         ) \
        ) \

.java
           .addChild(new TransformObject("blade_Y1").setRotation(0.0f,0.0f,1.0f,1.2f)
             .setIS(new ISObject()
               .addConnect(new connectObject().setNodeField("scale").setProtoField("frontBladeSize"))
               .addConnect(new connectObject().setNodeField("translation").setProtoField("frontSideBladeHeight")))
             .addChild(new TransformObject().setUSE("BLADE")))

i checked javadoc, as expected there is a correctly typed method available in underlying X3DJSAIL:

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/connectObject.html#setProtoField-org.web3d.x3d.jsail.fields.SFStringObject-

not making sense why that line fails...

hmmm, interpreted languages can easily get confused about which line an error actually occurs on...

... but the next line in the python source has been consistently translated too.

and so, not sure why that one isn't working.

=====================
create python:
node xml2all.js C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//HalfMoonPrototype.x3d
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\_archive
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit
Attempting to rename: C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\HalfMoonPrototype.future.py to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\HalfMoonPrototype.py
HalfMoonPrototype.x3d converted to archive/HalfMoonPrototype.py (verbose syntax) and HalfMoonPrototype.py (pipeline syntax)
- - - - - - - - - - -
validate python:
Loading archive/HalfMoonPrototype.py (verbose syntax) with python, if successful then saving and validating as archive/HalfMoonPrototype_RoundTrip1.x3d version:
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\_archive
CommandLine parameter: "-validate" for model validation
parameter: source file HalfMoonPrototype_RoundTrip1.x3d filesize 6420 bytes
Parsing using Document Object Model (DOM) based X3DLoader...
[X3DLoaderObject] <meta name='warning' content='Additional PositionInterpolator present but disabled.'/>
[X3DLoaderObject] <meta name='warning' content='Wiggle causes texture flashing. TODO: move animation to example file.'/>
validate results: success, no problems noted
archive/HalfMoonPrototype.py (verbose syntax) RoundTrip load test #1 complete
- - - - - -
Loading HalfMoonPrototype.py (pipeline syntax) with python, if successful then saving and validating as HalfMoonPrototype_RoundTrip2.x3d version:
Traceback (most recent call last):
   File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//HalfMoonPrototype.py", line 118, in <module>
     .setProtoField(SFString("fishScale")) \
AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'
Result: 1
CommandLine parameter: "-validate" for model validation
[Error]  [org.web3d.x3d.jsail.CommandLine] file not found: C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//HalfMoonPrototype_RoundTrip2.x3d
HalfMoonPrototype.py (pipeline syntax) RoundTrip load test #2 complete
=====================

=====================
create python:
node xml2all.js C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//KelpPrototype.x3d
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\_archive
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit
Attempting to rename: C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\KelpPrototype.future.py to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\KelpPrototype.py
KelpPrototype.x3d converted to archive/KelpPrototype.py (verbose syntax) and KelpPrototype.py (pipeline syntax)
- - - - - - - - - - -
validate python:
Loading archive/KelpPrototype.py (verbose syntax) with python, if successful then saving and validating as archive/KelpPrototype_RoundTrip1.x3d version:
Moving 1 file to C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\_archive
CommandLine parameter: "-validate" for model validation
parameter: source file KelpPrototype_RoundTrip1.x3d filesize 7773 bytes
Parsing using Document Object Model (DOM) based X3DLoader...
validate results:
WARNING_PROTOINSTANCE_NOT_FOUND, ProtoDeclare Kelp has no corresponding ProtoInstance attached to the scene graph.

archive/KelpPrototype.py (verbose syntax) RoundTrip load test #1 complete
- - - - - -
Loading KelpPrototype.py (pipeline syntax) with python, if successful then saving and validating as KelpPrototype_RoundTrip2.x3d version:
Traceback (most recent call last):
   File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//KelpPrototype.py", line 242, in <module>
     .setProtoField(SFString("frontSideBladeHeight")) \
AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'
Result: 1
CommandLine parameter: "-validate" for model validation
[Error]  [org.web3d.x3d.jsail.CommandLine] file not found: C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/KelpForestExhibit//KelpPrototype_RoundTrip2.x3d
KelpPrototype.py (pipeline syntax) RoundTrip load test #2 complete
=====================

> processSingleScene.pythonValidation:
> 
>       [echo] processSingleScene.python C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\HalfMoonPrototype.future.py
> 
>       [echo] Loading X3D model as .py program, if successful then saving as round-trip .x3d version:
> 
>       [exec] Traceback (most recent call last):
> 
>       [exec]   File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\HalfMoonPrototype.future.py", line 118, in <module>
> 
>       [exec]     .setProtoField(SFString("fishScale")) \
> 
>       [exec] AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'
> 
>       [exec] Result: 1
> 
>       [echo] =====================
> 
> Also:
> 
> processSingleScene.pythonValidation:
> 
>       [echo] processSingleScene.python C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\KelpPrototype.future.py
> 
>       [echo] Loading X3D model as .py program, if successful then saving as round-trip .x3d version:
> 
>       [exec] Traceback (most recent call last):
> 
>       [exec]   File "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\KelpForestExhibit\KelpPrototype.future.py", line 242, in <module>
> 
>       [exec]     .setProtoField(SFString("frontSideBladeHeight")) \
> 
>       [exec] AttributeError: 'org.web3d.x3d.jsail.X3DConcreteNode' object has no attribute 'addChild'
> 
>       [exec] Result: 1
> 
>       [echo] =====================
> 


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