Minor envelope progress

This commit is contained in:
Will Snyder
2020-10-14 16:06:04 -04:00
parent 2599a7203e
commit 1892a1cdbd
5 changed files with 93 additions and 45 deletions

View File

@@ -46,6 +46,7 @@ class Scene:
models: List[Model] = field(default_factory=list)
anims: List[Animation] = field(default_factory=list)
def create_scene(generate_triangle_strips: bool, apply_modifiers: bool, export_target: str) -> Scene:
""" Create a msh Scene from the active Blender scene. """
@@ -69,9 +70,23 @@ def create_scene(generate_triangle_strips: bool, apply_modifiers: bool, export_t
if has_multiple_root_models(scene.models):
scene.models = reparent_model_roots(scene.models)
#now that we've collected all models, we should remap WGHT indices...
names_to_indices = {}
for i,model in enumerate(scene.models):
names_to_indices[model.name] = i;
for model in scene.models:
if model.model_type == ModelType.SKIN:
for segment in model.geometry:
for i in range(len(segment.weights)):
vgroup_index = segment.weights[i][0]
segment.weights[i][0] = names_to_indices[model.vgroups_to_modelnames_map[vgroup_index]]
scene.materials = remove_unused_materials(scene.materials, scene.models)
scene.anims = gather_animdata(bpy.context.scene.objects["Armature"])
#scene.anims = gather_animdata(bpy.context.scene.objects["Armature"])
return scene