[x3d-public] x3d.py users...quick question and answer.
vmarchetti at kshell.com
vmarchetti at kshell.com
Mon Jan 31 15:49:12 PST 2022
> On Jan 31, 2022, at 4:20 PM, John Carlson <yottzumm at gmail.com> wrote:
>
> I'm guessing I have to so something like
>
> value=SFColor((0.9,0.9,0.9))
>
> ?? No!
>
John
Although you said "No!" , I think this is the correct answer. One correct way to construct a valid SFColor instance is with a single argument value which
is a tuple of 3 numeric elements.
Vince Marchetti
> I will look through examples of generated JSON from X3dToPython.xslt, found in flower2.py. I will try the following:
> flowers2.py: field(name='diffuseColor',accessType='inputOutput',type='SFColor',value=(1,0.5,0)),
> flowers2.py: field(name='specularColor',accessType='inputOutput',type='SFColor',value=(1,0.5,0)),
>
> Looks like it works, for anyone confused why you can't pass 3 (actually 4) values to SFColor!
>
> I'm approaching near completion of x3djsonld.py, except for HAnim it appears. I might call you Joe, so prepare to video (on Zoom?). I haven't looked into these issues yet, so let me do that first.
>
> X3dToPython.xslt is still preferred, as I haven't handled children (comments) and value in Shape and Text.
>
> Note: I am reading in JSON.
>
>
> Traceback (most recent call last):
> File "C:\Users\john\X3DJSONLD\src\main\python\net\coderextreme\data\ViewFrustumPrototype.py", line 17, in <module>
> field(name="lineColor", accessType="inputOutput", appinfo="RGB color of ViewFrustum outline, default value 0.9 0.9 0.9", type="SFColor", value=SFColor(0.9,0.9,0.9)),
> TypeError: SFColor.__init__() takes from 1 to 2 positional arguments but 4 were given
> Error: ../python/net/coderextreme/data/ViewFrustumPrototype.py failed to parse
> python ../python/x3djsonld.py ../data/x3dconnector.json ../python/net/coderextreme/data/x3dconnector.py
> ../python/net/coderextreme/data/x3dconnector.py
> python ../python/x3djsonld.py ../data/x3dconnectorProto.json ../python/net/coderextreme/data/x3dconnectorProto.py
> ../python/net/coderextreme/data/x3dconnectorProto.py
> python ../python/x3djsonld.py ../data/X3dHeaderPrototypeSyntaxExamples.json ../python/net/coderextreme/data/X3dHeaderPrototypeSyntaxExamples.py
More information about the x3d-public
mailing list