From a9a508d1e717c81af62f0854bada6140cc7b58b5 Mon Sep 17 00:00:00 2001 From: AnimNyan Date: Thu, 22 Jun 2023 20:21:42 +1000 Subject: [PATCH] shape key support through named keyword arguments for shape_key_add function --- __init__.py | 2 +- io_import_scene_lwo.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index c9a2ccd..7a25bd7 100644 --- a/__init__.py +++ b/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "LightWanda Importer", "author": "Ken Nign (Ken9) and Gert De Roost, Wisi, ASapphicKitsune and Anime Nyan", - "version": (1, 5, 0), + "version": (1, 5, 1), "blender": (3, 5, 0), "location": "File > Import > LightWave Object (.lwo)", "description": "Imports a LWO file including any UV, Morph and Color maps. " diff --git a/io_import_scene_lwo.py b/io_import_scene_lwo.py index 2dcd6b6..1b74c83 100644 --- a/io_import_scene_lwo.py +++ b/io_import_scene_lwo.py @@ -1958,9 +1958,9 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object # Create the Shape Keys (LW's Endomorphs). if len(layer_data.morphs) > 0: print("Adding %d Shapes Keys" % len(layer_data.morphs)) - ob.shape_key_add('Basis') # Got to have a Base Shape. + ob.shape_key_add(name="Basis") # Got to have a Base Shape. for morph_key in layer_data.morphs: - skey = ob.shape_key_add(morph_key) + skey = ob.shape_key_add(name=morph_key) dlist = layer_data.morphs[morph_key] for pdp in dlist: me.shape_keys.key_blocks[skey.name].data[pdp[0]].co = [pdp[1], pdp[2], pdp[3]] @@ -2114,7 +2114,10 @@ def build_objects(object_layers, object_surfs, object_clips, object_tags, object # With the objects made, setup the parents and re-adjust the locations. if len(ob_dict.keys()) > 1: empty = bpy.data.objects.new(name=object_name + "_empty", object_data=None) + + #parent all objects to the newly created empty bpy.context.scene.objects.link(empty) + for ob_key in ob_dict: if ob_dict[ob_key][1] != -1 and ob_dict[ob_key][1] in ob_dict: parent_ob = ob_dict[ob_dict[ob_key][1]]