Open snake-biscuits opened 2 years ago
bpy.types.Mesh.from_pydata
might be a better solution[^1]
Profiling tools do exist,[^2][^3] and it is also possible to run Blender "headless" to compare different approaches.
Regardless,: finding a performant way to load large maps (e.g. Apex Legends maps) will make development much easier.
[^1]: b3d.interplanety.org: How to create mesh through the Blender Python API [^2]: wiki.blender.org: Profiling Python Code [^3]: devtalk.blender.org: Plugin-Profiler | benchmark / debug your bpy work
Another option would be to merge meshes for each model, Blender attaches a lot of metadata to objects, so reducing groups could be helpful
Maintaining the "mesh groups" defined by bsp.LEVEL_INFO
for worldspawn should help with visibility etc.
This would allow for hiding or even skipping decals & skybox, as well as clearly detecting transparent geometry & materials
Another option would be to merge meshes for each model
Specifically, merging meshes into models before generating them, which should improve import speed (theoretically)
Just wrapped up an update for faster load times in https://github.com/snake-biscuits/bsp_tool/issues/80
Should be able to update to that version of bsp_tool
pretty soon
Though I might make it bsp_tool
version 0.5.0
Mesh(...).from_pydata
is the way to go (no numpy
required)
uvs & vertex colour could get tricky
I do need to take a proper look at vertex colour Need to check w/ Fifty & others to check VertexReservedX structs are all synced up That's for another issue though
Use the bpy
.foreach_set
method with NumPy to speed up mesh assembly. Can also use the new Vertex lookup method frombsp_tool/src/glview.cpp
to save some timeVertexReservedClass -> NumPy array will likely be the hardest step