[x3d-public] Fwd: Next, in Python news...

Joseph D Williams joedwil at earthlink.net
Wed Aug 25 16:03:09 PDT 2021


https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Prototypes/AllenStandShootRifleM24Index.html

When I look at this I see maybe a browser-specific problem, that the player is drawing geometries twice. 
The first is drawn from the Humanoid skeleton user code and the second set is drawn from the (my word) spurious joints, segments and sites fields, the lists of skeleton items. 
Of course the funny thing is that the second set, of course, doesn’t get animated, so the problem is easy to see. This is positive proof that the style of coding using USE in those lists of nodes is bad coding. If these are needed, then all that is necessary is a simple list of the DEF names,  omitting the USE. 
Otherwise we need that (my word) silly rule that Hey players, don’t draw the USE - DEFs in the joints, segments, sites fields!!!! 
Mush simpler and more in the old spirit to simply MFsptring of quoted either  DEFs used in the skeleton, or, even more enlightend, the  element names.

Thanks and Best,
Joe

From: John Carlson
Sent: Wednesday, August 25, 2021 1:18 PM
To: Brutzman, Donald (Don) (CIV); Joseph D Williams
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] Fwd: Next, in Python news...

Downloaded:
AllenStandShootRifleM24.py
From:
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Prototypes/AllenStandShootRifleM24Index.html
Results:
coderextreme at coderextreme-Kubuntu20:~/Downloads$ python3 AllenStandShootRifleM24.py 
Traceback (most recent call last):
  File "AllenStandShootRifleM24.py", line 21, in <module>
    from x3d import *
AttributeError: module 'x3d' has no attribute 'SFBool'

coderextreme at coderextreme-Kubuntu20:~/Downloads$ source ~/X3DJSONLD/src/main/python/venv/bin/activate

(venv) coderextreme at coderextreme-Kubuntu20:~/Downloads$ python3 AllenStandShootRifleM24.py Traceback (most recent call last):
  File "AllenStandShootRifleM24.py", line 21, in <module>
    from x3d import *
AttributeError: module 'x3d' has no attribute 'SFBool'

(venv) coderextreme at coderextreme-Kubuntu20:~/Downloads$ export PYTHONPATH=~/X3DJSONLD/src/main/python/net/x3djsonld/data/

(venv) coderextreme at coderextreme-Kubuntu20:~/Downloads$ python3 AllenStandShootRifleM24.py x3d.py package loaded, have fun with X3D Graphics!
Traceback (most recent call last):
  File "AllenStandShootRifleM24.py", line 44, in <module>
    ProtoDeclare(name='LOA1_ShootAnimation',
  File "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", line 10239, in __init__
    self.ProtoBody = ProtoBody
  File "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", line 10282, in ProtoBody
    if not ProtoBody is None and not isinstance(ProtoBody,(ProtoBody,ProtoInstance)):
TypeError: isinstance() arg 2 must be a type or tuple of types

Look at:

File "/home/coderextreme/X3DJSONLD/src/main/python/net/x3djsonld/data/x3d.py", line 10282, in ProtoBody
    if not ProtoBody is None and not isinstance(ProtoBody,(ProtoBody,ProtoInstance)):

It seems obvious to me that there's an issue with this line, but I don't really know Python too well!
Please bring up a virtual environment or otherwise provide better instructions for patching the issue.

John
On 8/25/21 1:33 AM, John Carlson wrote:
This is a repeat.  I only saw ProtoBody setter isinstance error when running python generated from the X3D archives from sourceforge.
If you like, I can download a python file from the website?  Okay!
On 8/24/21 10:41 PM, Brutzman, Donald (Don) (CIV) wrote:
John, we have a lot of simple prototypes and prototypes with embedded Script nodes in the archives that have all tested OK.
 
If your example is that Rubiks’s cube with nested prototypes, that is harder.  We believe the spec is OK but that feature is only occasionally demonstrated as working.  Any model with nested prototypes (ProtoDeclare within ProtoDeclare) can be easily refactored by putting all of the ProtoDeclare blocks first.  Similarly it makes sense to test individual ProtoInstance nodes without feeding them nested ProtoInstance fields.
 
Looking at existing examples is also good because they have passed through validation.  Step by step.
 
1. https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
 
Once again sorry I can’t pursue “deep dive” excursions at this time.  Am working on (a) X3D architecture Mantis editorial issues, (b) DIS protocol implementation open-dis7-java, upgraded DIS support in Xj3D, and just tonight got X3D-Edit building despite issues with a very old laptop.  Step  by step.
 
From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of John Carlson
Sent: Tuesday, August 24, 2021 7:48 PM
To: Joseph D Williams <joedwil at earthlink.net>
Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: Re: [x3d-public] Fwd: Next, in Python news...
 
Yes, you need to ‘’’pip install x3d’’’
before running the provided script in previous message.   See link previously posted by Joe.
 
Thanks for confirmation of received message.
 
The header is the top of the file.   If you don’t want to run my code, convert your own proto xml to python using X3dToPython.xslt.   I don’t have a JSON converter for this test.
 
The main purpose is to get proper implementation of Protos in pure python.   I’m guessing it may be a wider problem with x3d.py, because when I patched Protos in my version, there were further issues.   So simply patching Protos won’t fix all the issues.   A full roundtrip XML -> python -> XML needs to be done for the archive.
 
I’ve freed up some time to work on python, and I plan to start work on a test suite soon.   It would be good to get past my initial issues with the package.   I can reattempt to modify the x3d package generator, but that doesn’t mean my patches will be available when I am done.    It still needs to go through official channels.
 
If you’re fed up with stylesheets, I can offer a solution, but it’s not as elegant or pythonic and uses Java.   As far as I can tell, XSLT is the declarative transformer of choice for XML.
 
The main thing I think needs to be done is handle cases where parameters and classes have the same case sensitive name.
 
If people want to contribute to x3d.py project, now’s your chance.   I’m fairly sure the python binding needs to be standardized.
 
I know pretty much everyone has been covidized.
 
After spinning up python, I’ll return to C++ if there’s enough code separated from the standard.
 
John
 
On Tue, Aug 24, 2021 at 8:55 PM Joseph D Williams <joedwil at earthlink.net> wrote:
 
# Now available: developmental python x3d.py package on PyPi for import.
#   This approach greatly simplifies Python X3D deployment and use.
#   https://pypi.org/project/x3d
 
The text got here as attachment
Joe
 
 
From: John Carlson
Sent: Tuesday, August 24, 2021 3:00 PM
To: Don Brutzman; X3D Graphics public mailing list
Subject: [x3d-public] Fwd: Next, in Python news...
 
Resend of non-working python code.   No rush,    I don’t want anyone to be surprised.  I do want someone to confirm receipt of email.   I’m guessing things are going to spam?
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210825/1632ed5a/attachment.html>


More information about the x3d-public mailing list