Armory: Error publishing with Asset Compression option

Created on 30 Jul 2020  路  10Comments  路  Source: armory3d/armory

Description
If you enable this option, then when publish, for example, in HTML5, the scene will be unloaded as "Scene.arm", but the engine is looking for the "Scene.lz4" file.
I assume there is a similar problem for other platforms.

kha.js:
Error_asset_compression_part

System
System
Blender: 2.82
Armory: git (from 28 July)
OS: Win 10

bug

Most helpful comment

Ok, thanks for the information! If you want I can try to port the lz4 encoder to python in two weeks when I get more time.

All 10 comments

That's interesting, I wonder why this was not noticed until now. It looks like the scene file is just not exported when asset compression is enabled:

https://github.com/armory3d/armory/blob/ef7ca82978a6910284207407d02749b73985e054/blender/arm/utils.py#L24-L27

@luboslenco What was the reason to add a pass statement in utils.write_arm() in https://github.com/armory3d/armory/commit/8bccdd9879e0dc428fac59d617923e461e64fd3c? Was the lz4 export implemented somewhere else instead? Maybe I'm blind but I can't find it.

Edit: I also noticed that it is not implemented in Iron in Data.getSceneRaw() as well:
https://github.com/armory3d/iron/blob/c52290b3b30016f7f47a7427db83fd444e00b2c7/Sources/iron/data/Data.hx#L258-L261

I recall there were some issues with .zip compression and the move to .lz4 is not finished. For Iron I plan to move in the lz4 encoder / decoder from ArmorPaint. For Blender side maybe the encode part could be ported from Haxe to Python.

Ok, thanks for the information! If you want I can try to port the lz4 encoder to python in two weeks when I get more time.

Hi @luboslenco, how is the second parameter (oLen) of Lz4.decode() calculated? I want to test if the Python port works but I don't know how to call decode().

Hi, it's the size of decoded bytes:

var encoded = Lz4.encode(bytes);
var decoded = Lz4.decode(encoded, bytes.length);

The original size has to be stored somewhere along the encoded bytes.

Small status update: I got it working (and after a nasty bug with shifting unsigned integers it now works for all files I've tested), but there is a problem: The current Lz4.hx doesn't work on static targets due to the use of js.lib.Int32Array and js.lib.Uint8Array. Kha has an Int32 array (without a fill-function but that's not a big problem) but there is no Uint8 array. Are there other alternatives?

There is haxe.io.UInt8Array as well but the best way would be to just add kha.arrays.Uint8Array into Kha, I recall Robert mentioning he would not mind to include additional array types.

Done, hopefully everything is correct (this is my first "bigger" commit on the Kha repo).

@luboslenco Could you please update the Kha and khacpp submodules if possible so that we can finish the work on this? The Armory and Iron part is also done and just needs to be committed. Thank you

Done!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GrahamWilkins picture GrahamWilkins  路  3Comments

donalffons picture donalffons  路  4Comments

donalffons picture donalffons  路  3Comments

SeleDreams picture SeleDreams  路  3Comments

HeadClot picture HeadClot  路  4Comments