[x3d-public] Question: Geometry class for x3d.py?
John Carlson
yottzumm at gmail.com
Tue Dec 7 07:58:30 PST 2021
Don, you may want to create a Geometry class in x3d.py like:
classGeometry(_X3DGeometryNode):
defFIELD_DECLARATIONS(cls):
return[]
defJSON(self):
returnself.geometry.JSON();
defXML(self):
returnself.geometry.XML();
Also, we would have to provide parsers to fill in self.geometry.
Or test for self.geometry in the JSON and XML methods, or add a constructor.
This is mainly for loading the -geometry field.
It could be handled in the Shape class, with eval() figuring out which
geometry constructor to call. That is okay with me!
Obviously, eval is a tiny bit dangerous, even if only resolving a
class. I recommend creating a regexp that matches all node and
statement names.
I'm going to proceed with eval in the Shape class for now.
Thanks!
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20211207/6ea6ef2b/attachment.html>
More information about the x3d-public
mailing list