[x3d-public] X3DJSAIL updated; python pyjnius mapping, javascript warnings, cleaner .py export syntax
Brutzman, Donald (Don) (CIV)
brutzman at nps.edu
Sun May 12 18:58:02 PDT 2019
Reduced warnings, Python build log is down to 11MB
http://www.web3d.org/x3d/content/examples/build.python.all.log.txt
also checked into Sourceforge but probably only retrievable into local subversion archive due to size
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/build.python.all.log.txt
Rebuilt all .py files to cleaner syntax, uploading them all now.
On 5/12/2019 12:39 PM, Brutzman, Donald (Don) (CIV) wrote:
> On 5/11/2019 6:46 PM, John Carlson wrote:
>> Fixed, checked in.
>
> thank you.
>
> Found some issues with PythonPipeliningSerializer.js:
>
> - Netbeans provides a number of warnings, worked as follows to clear them.
> - semicolons added where indicated
>
> - printSubArray method had a number of issues
> -- nested variable v defined multiple times, renamed it to vv within nested scope
> -- irregular indentation led to variable v later being out of scope;
> -- reason was premature completion of integer "for (var v in values)" loop
> -- moved closing } to put everything appropriate within loop, please check
>
> - thanks for fixing "if (attrType.startsWith("SF"))"
>
> - changed some identity operators == to equality operators ===
> https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons
> note that Douglas Crockford is quoted as
> "JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. [...] The lack of transitivity is alarming. My advice is to never use the evil twins. Instead, always use === and !==."
>
> - i worked on removing line-continuation characters completely by wrapping entire expression in one extra set of parentheses
> - comments now appear on a new line for readability
> - changed \r\n to \n for consistency throughout, seemed OK
> - output line breaks inserted between sections and otherwise minimized for readability
>
> Still getting an error: Unexpected 'const'
> const DOUBLE_SUFFIX = '';
>
> Checked in these changes to PythonPipeliningSerializer.js.
>
> Clean example attached - better and better.
>
>> Do you have an example we can test with?
>
> I continue focusing on HelloWorld.x3d and corresponding HelloWorld.py
>
> Moving around and removing sections of .x3d source can push the error around...
>
> Each time, am only able to get errors in .py file of the form
>
> .addChild(Viewpoint().setDEF("ViewUpClose").setCenterOfRotation(0,-1,0).setDescription("Hello world!").setPosition(0,-1,7))
> AttributeError: 'org.web3d.x3d.sai.Navigation.X3DViewpointNode' object has no attribute 'setCenterOfRotation'
>
> .setMaterial(Material().setDEF("MaterialLightBlue").setDiffuseColor(0.1,0.5,1))
> AttributeError: 'org.web3d.x3d.sai.Shape.X3DMaterialNode' object has no attribute 'setDiffuseColor'
>
> .setTexture(ImageTexture().setDEF("ImageCloudlessEarth").setUrl(["earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"]))))))))
> AttributeError: 'org.web3d.x3d.sai.Texturing.X3DTextureNode' object has no attribute 'setUrl'
>
> so it sure looks like it has something to do with incorrect handling of direct methods, it seems OK when a method is found in abstract parent of an object class.
>
>> Thanks,
>>
>> John
>>
>> Index: PythonPipeliningSerializer.js
>>
>> ===================================================================
>>
>> --- PythonPipeliningSerializer.js (revision 28463)
>>
>> +++ PythonPipeliningSerializer.js (working copy)
>>
>> @@ -82,7 +82,7 @@
>>
>> values.pop();
>>
>> }
>>
>> - if (type.startsWith("SF")) // TODO fix this javascript, test is not working
>>
>> + if (attrType.startsWith("SF"))
>>
>> return lead+values.join(j)+trail; // avoid array brackets on SF types
>>
>> else
>>
>> return '['+lead+values.join(j)+trail+']';
>>
>> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>>
>> *From: *John Carlson <mailto:yottzumm at gmail.com>
>> *Sent: *Saturday, May 11, 2019 8:39 PM
>> *To: *Brutzman, Donald (Don) (CIV) <mailto:brutzman at nps.edu>
>> *Cc: *X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
>> *Subject: *RE: X3DJSAIL updated support for setting with doubles; pythonpyjniusmapping
>>
>> ==========================================
>>
>> >2. Also tried to get PythonPipeliningSerializer.js to avoid brackets on simple and numeric types.
>>
>> >Checked in block that didn't work, please fix and check back in:
>>
>> if (type.startsWith("SF")) // TODO fix this javascript, test is not working
>>
>> return lead+values.join(j)+trail; // avoid array brackets on SF types
>>
>> else
>>
>> return '['+lead+values.join(j)+trail+']';
>>
>> ==========================================
>>
>> I logged type, and these appear to be Java types. So we’ll have to change type to attrType or something. Will do.
>>
>> John
>>
>
>
> all the best, Don
>
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