gromgull / py-vox-io

Python module for parsing and writing MagicaVoxel vox file
MIT License
102 stars 26 forks source link

Add support for new MagicaVoxel format #6

Open virtualritz opened 5 years ago

virtualritz commented 5 years ago

See here for format extensions.

I tried the simple visualization example with the castle.vox model that ships with MagicaVoxel. I get this:

2019-05-17 15:00:59 foo.home pyvox.parser[26148] DEBUG Found chunk id b'MAIN' / len 0 / children 39931
2019-05-17 15:00:59 foo.home pyvox.parser[26148] DEBUG Found chunk id b'SIZE' / len 12 / children 0
2019-05-17 15:00:59 foo.home pyvox.parser[26148] DEBUG Found chunk id b'XYZI' / len 10516 / children 0
2019-05-17 15:00:59 foo.home pyvox.parser[26148] DEBUG xyzi block with 2628 voxels (len 10516)
2019-05-17 15:00:59 foo.home pyvox.parser[26148] DEBUG Found chunk id b'nTRN' / len 28 / children 0
Traceback (most recent call last):
  File "./test.py", line 10, in <module>
    m = VoxParser(sys.argv[1]).parse()
  File "/usr/local/lib/python3.7/site-packages/pyvox/parser.py", line 93, in parse
    main = self._parseChunk()
  File "/usr/local/lib/python3.7/site-packages/pyvox/parser.py", line 81, in _parseChunk
    chunks.append(self._parseChunk())
  File "/usr/local/lib/python3.7/site-packages/pyvox/parser.py", line 83, in _parseChunk
    return Chunk(_id, content, chunks)
  File "/usr/local/lib/python3.7/site-packages/pyvox/parser.py", line 55, in __init__
    raise ParsingException('Unknown chunk type: %s'%self.id)
pyvox.parser.ParsingException: Unknown chunk type: b'nTRN'
midstreeeam commented 1 year ago

Hi, I also met this problem, so I did some modification on this module, basically for myself to use, but it might help you. Maybe you can check https://github.com/midstreeeam/PyVox