Laubwerk / player-for-blender

Laubwerk Plants Add-on for Blender
GNU General Public License v2.0
2 stars 2 forks source link

Error rebuild db addon bl 4.1.1 #2

Open schroef opened 3 months ago

schroef commented 3 months ago

Describe the bug This is a "silent" error as its only seen in the console. Im seeing json or db creation errors. My guess its because of the changes done to the lbw.gz files and how they are structered. I have some old version on an USB drive. But with the latest plantkit as a test. Im see these errors in the console.

Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ AttributeError: 'ModelVariant' object has no attribute 'name' Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ m_rec = ThicketDB.parse_model(filepath) AttributeError: 'ModelVariant' object has no attribute 'name' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ AttributeError: 'ModelVariant' object has no attribute 'name' [debug] Failed to parse 'C:\Program Files\Laubwerk\Plants\Aquilegiacoerulea'McKana'\Aquilegiacoerulea'McKana'.lbw.gz' with the JSON parser. Falling back to XML parser. [debug] Failed to parse 'C:\Program Files\Laubwerk\Plants\Cenchrusalopecuroides'Hameln'\Cenchrusalopecuroides'Hameln'.lbw.gz' with the JSON parser. Falling back to XML parser. Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in [debug] Failed to parse 'C:\Program Files\Laubwerk\Plants\Cytisus_scoparius\Cytisus_scoparius.lbw.gz' with the JSON parser. Falling back to XML parser. main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") [debug] ^^^^^^ Failed to parse 'C:\Program Files\Laubwerk\Plants\Buddlejadavidii'Pablo_Purple'\Buddlejadavidii'Pablo_Purple'.lbw.gz' with the JSON parser. Falling back to XML parser. AttributeError: 'ModelVariant' object has no attribute 'name' Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ Traceback (most recent call last): AttributeError: 'ModelVariant' object has no attribute 'name' File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ AttributeError: 'ModelVariant' object has no attribute 'name' Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^ AttributeError: 'ModelVariant' object has no attribute 'name' [debug] Failed to parse 'C:\Program Files\Laubwerk\Plants\Acer_campestre\Acer_campestre.lbw.gz' with the JSON parser. Falling back to XML parser. Traceback (most recent call last): File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 390, in main() File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 383, in main ThicketDB.parse_model_json(args.f) File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 337, in parse_model_json m_rec = ThicketDB.parse_model(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\romboutversluijs\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\player-for-blender-main\thicket_db.py", line 317, in parse_model preview_path = Path(filepath).parent.absolute() / "models" / (previewstem + "" + v.name + ".png") ^^^^^^

To Reproduce Steps to reproduce the behavior:

Import thicket add

Enable addon

Press rebuild DB button

See error

Expected behavior Correct build of the db in form of a JSON file

Screenshots  

Desktop (please complete the following information): -WIN

11 home 24H2

bl 4.1.1

Additional context I tried check if i could get the name variant. But using v['name'] doesnt work, item is not subscriptable. name is an attrib name so perhaps it should be stored

I initially post this on the original repository, but he just archived and stayed that he has not been checking updated API.

In older issue reports I noticed an issue about the python version not compatible.

I got some parts working again. But I get a new error now when it is trying to load the variants. It's returning an error when trying to load the json data per variant.

Could it be because older setup was that model variants in the model folder where made from json files. Where now they are zipped XML files in custom format?

schroef commented 3 months ago

Perhaps the second issue is that I didn't fix it correctly. It seems the DB is created, but it doesn't seem to add the plants and models. But when I try the adjust parse operator,which is sued for the previews, it does read data. I think I would need to install this on a older version and see how it is filled.

Also saw an old post on the original repo about different freekits and they they are constructed differently

schroef commented 3 months ago

Did more testing, got it working again now. I'm not sure I did it correctly l, but I see the panel and I loads models corre fly according to the settings.

Seems when using json.loads() it has errors with byte type of data, so I added decode('UTF-8') from the data which is read from each lbw.gz file. Now the db is filled, not sure if it's filled how it did earlier. But all models load again and the settings from panel travel over to imported models.

I only see a weirdness when using material quality. When we use a viewport proxy, the render() model also gets the proxy low quality material. That's because it's trying material names

schroef commented 3 months ago

Where can i find API updates to the laubwerk python module. I had issue getting this addon to work again, by fiddling around and looking at the lwwtoobj importer i got it working again. But this current version seems to have issues because of old API. I see couple errors when its trying to build a database