takahirox / glTF-Blender-IO-MSFT-lod

MIT License
16 stars 2 forks source link

IDs accumulate in scenes with multiple objects using LODs #2

Closed kheetor closed 1 year ago

kheetor commented 1 year ago

When exporting glTF with MSFT_lod extras with this addon, all the different objects in the scene have their IDs accumulate in MSFT_lod "ids" field. This accumulated field is then assigned to every object using LODs.

Each object/node should only list IDs of their own LODs. In the attached screenshot Cube High A should only use meshes 2 and 3, while Cube High Z should only use meshes 4 and 5.

I was able to easily fix this by moving ids=[] list definition from gather_gltf_extensions_hook space on line 202 into node-specific loop at line 210/211. This gives every node their own list and IDs no longer accumulate scene-wide.

I can also make a PR from this fix if that's what you prefer?

MSFT_lod_ID_acc