Menu

#89 x3d.py issue, PixelTexture has no len()

X3D3
closed
nobody
None
2026-02-07
2026-02-07
No

This might be my serializer, trying to repeat with X3dToPython.xslt

python ../python/net/coderextreme/data/MultiTextureDesignPattern.py

Traceback (most recent call last):
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\MultiTextureDesignPattern.py", line 172, in <module>
f.write(X3D0.XML())
~~~~~~~~^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 15189, in XML
result += str(self.Scene.XML(indentLevel=indentLevel+1, syntax=syntax))
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 14694, in XML
result += each.XML(indentLevel=indentLevel+1, syntax=syntax)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 82871, in XML
result += self.appearance.XML(indentLevel=indentLevel+1, syntax=syntax)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 16800, in XML
result += self.texture.XML(indentLevel=indentLevel+1, syntax=syntax)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 62377, in XML
if not self.hasChild():
~~~~~~~~~~~~~^^
File "C:\Users\jcarl\X3DJSONLD\src\main\python\net\coderextreme\data\x3d.py", line 62345, in hasChild
return self.IS or self.metadata or (len(self.texture) > 0)
~~~^^^^^^^^^^^^^^
TypeError: object of type 'PixelTexture' has no len()</module>

My copy of this file has a problem, apparently unrelated to Comment?   Here's the online source.  I will try to duplicate with online source:

https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/MultiTextureDesignPatternIndex.html

Online Python cfhecks out

$ python ~/MultiTextureDesignPattern.py
x3d.py package 4.0.65.0 loaded, have fun with X3D Graphics!
Self-test diagnostics for MultiTextureDesignPattern.py:
meta information, TODO: X3D schematron rules for quality assurance
Python-to-XML well-formed XML document test of XML output complete
Python-to-XML X3D 3.3 schema validation test of XML output complete
Python-to-VRML export of VRML output successful
Python-to-JSON export of JSON output successful (under development)
python MultiTextureDesignPattern.py load and self-test diagnostics complete.

Copying sourceforge version to local working directory.

$ diff X3dToPython.xslt ~/www.web3d.org/x3d/stylesheets/X3dToPython.xslt
[ no output ]

Apparently, the issue is with my Python. I am not sure what you want to do, so I am attaching my python derived from sourceforge X3D.

2 Attachments

Discussion

  • John W Carlson

    John W Carlson - 2026-02-07
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,2 @@
     MultiTextureDesignPattern.py (5.5 kB; text/x-python)
    +MultiTextureDesignPattern.x3d (3.2 kB; model/x3d+xml)
    
     
  • John W Carlson

    John W Carlson - 2026-02-07

    Here's the X3D file I am using:

     
  • John W Carlson

    John W Carlson - 2026-02-07

    Again, no issue with Archive or x3d.py that I know of. I will try to troubleshoot

     
  • John W Carlson

    John W Carlson - 2026-02-07

    texture is an MFNode. I don't know what happens if self.texture is None.

    This appears to be the problem in my PythonSerializer.js. I am not treating texture as an MFNode!

    Appearance30.material = Material31
    MultiTexture32 = x3d.MultiTexture()
    MultiTexture32.alpha = 0.8
    MultiTexture32.color = [0.9,1,0.2]
    MultiTexture32.function = ["COMPLEMENT","ALPHAREPLICATE"]
    MultiTexture32.mode = ["MODULATE","REPLACE","BLENDDIFFUSEALPHA"]
    MultiTexture32.source = ["DIFFUSE","SPECULAR","FACTOR"]
    """add multiple texture nodes here"""^M
    ImageTexture33 = x3d.ImageTexture()

    MultiTexture32.texture = ImageTexture33
    MovieTexture34 = x3d.MovieTexture()

    MultiTexture32.texture = MovieTexture34
    PixelTexture35 = x3d.PixelTexture()

    MultiTexture32.texture = PixelTexture35

     
  • John W Carlson

    John W Carlson - 2026-02-07
    • status: open --> closed
     
  • John W Carlson

    John W Carlson - 2026-02-07

    Unit test succeeded, performing wider test.

     

Log in to post a comment.

MongoDB Logo MongoDB