Skip to content

Commit

Permalink
shape key support through named keyword arguments for shape_key_add f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
AnimNyan committed Jun 22, 2023
1 parent 641c498 commit a9a508d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
Expand Down
7 changes: 5 additions & 2 deletions io_import_scene_lwo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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]]
Expand Down

0 comments on commit a9a508d

Please sign in to comment.