Skip to content

Commit 2539aa4

Browse files
committed
MikuMikuRig 1.78
1 parent fdd25b1 commit 2539aa4

5 files changed

Lines changed: 49 additions & 2 deletions

File tree

MikuMikuRig/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": 'MikuMikuRig',
55
"author": '小峰峰哥l',
66
"blender": (4, 2, 0),
7-
"version": (1, 76),
7+
"version": (1, 78),
88
"description": 'MMD骨骼优化工具',
99
"tracker_url": 'https://space.bilibili.com/2109816568?spm_id_from=333.1007.0.0',
1010
"support": 'COMMUNITY',

MikuMikuRig/addons/MikuMikuRig/__init__.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"name": "MikuMikuRig",
1616
"author": "小峰峰哥l",
1717
"blender": (4, 2, 0),
18-
"version": (1, 76),
18+
"version": (1, 78),
1919
"description": "MMD骨骼优化工具",
2020
"tracker_url": "https://space.bilibili.com/2109816568?spm_id_from=333.1007.0.0",
2121
"support": "COMMUNITY",
@@ -33,6 +33,40 @@ def sync_mmr_key_values(scene,depsgraph):
3333
if not obj:
3434
return
3535

36+
# 获取key对象
37+
key_obj = obj.mmr.key_obj
38+
39+
if not key_obj:
40+
return
41+
42+
# 如果值改变, 则进行处理
43+
if key_obj is not obj.mmr.Import_object_data:
44+
45+
# 更新存储的值
46+
obj.mmr.Import_object_data = key_obj
47+
48+
print("key_obj", key_obj)
49+
50+
if not key_obj.type == 'MESH':
51+
return
52+
53+
# 获取模型形态
54+
shape_key = key_obj.data.shape_keys.key_blocks
55+
56+
items = obj.mmr_key
57+
items.clear()
58+
59+
# 遍历模型形态
60+
for idx, key in enumerate(shape_key):
61+
item = items.add()
62+
if idx == 0:
63+
item.bool_value = False
64+
65+
item.name = key.name
66+
item.value = key.value
67+
item.meshkey_index = idx
68+
item.meshkey = key_obj.data.shape_keys
69+
3670
# 获取批量调整值
3771
current_value1 = obj.mmr.Batch_adjust_shape_key
3872

MikuMikuRig/addons/MikuMikuRig/panels/MMRPanels.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def draw(self, context: bpy.types.Context):
4747
layout = self.layout
4848

4949
obj = context.active_object
50+
51+
layout.prop(obj.mmr, "key_obj", text="Mesh")
52+
5053
if obj.mmr:
5154
# UL
5255
layout.template_list("MMR_UL_key", "", obj, "mmr_key", obj.mmr, "key_idx")
@@ -63,6 +66,11 @@ def draw(self, context: bpy.types.Context):
6366
row.operator(MMR_OT_Insert_Keyframe.bl_idname, icon="LAYER_ACTIVE", text="")
6467
row.prop(obj.mmr, "use_keyframe_insert_auto", text='',icon='KEYFRAME')
6568

69+
@classmethod
70+
def poll(cls, context: bpy.types.Context):
71+
return context.active_object is not None
72+
73+
6674
# 控制器选项面板
6775
class MMD_Rig_Opt(bpy.types.Panel):
6876
bl_label = "Controller options"

MikuMikuRig/addons/MikuMikuRig/panels/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ class MMR_property(bpy.types.PropertyGroup):
171171
type=bpy.types.Object,
172172
name="Import object data",
173173
)
174+
# key物体
175+
key_obj: PointerProperty(
176+
type=bpy.types.Object,
177+
name="Key object",
178+
)
174179
# key idx
175180
key_idx: IntProperty(
176181
name="Key index",

0 commit comments

Comments
 (0)