Skip to content

Commit

Permalink
0.55
Browse files Browse the repository at this point in the history
  • Loading branch information
LaoBro authored Apr 20, 2022
1 parent 2ca890d commit 028b0f5
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 31 deletions.
12 changes: 11 additions & 1 deletion MikuMikuRig/mmr_operators/extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,14 @@ def execute(self,context):
hide_skirt()
return{"FINISHED"}

Class_list=[OT_Set_Min_IK_Loop,OT_Hide_Skirt]
class OT_Decorate_MMD_Arm(Operator):
bl_idname = "mmr.decorate_mmd_arm" # python 提示
bl_label = "Interface"
bl_options = {'REGISTER', 'UNDO'}

def execute(self,context):
rig.decorate_mmd_arm(context)
return{"FINISHED"}


Class_list=[OT_Set_Min_IK_Loop,OT_Hide_Skirt,OT_Decorate_MMD_Arm]
48 changes: 23 additions & 25 deletions MikuMikuRig/mmr_operators/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,20 @@ def convert_rigid_body_to_cloth(context):
bm=bmesh.new()
bm.from_mesh(mesh)
#bmesh.ops.edgenet_fill(bm, edges=bm.edges, mat_nr=0, use_smooth=True, sides=4)
bmesh.ops.holes_fill(bm, edges=bm.edges, sides=4)

#删除大于四边的面
#remove ngon
'''for f in bm.faces:
if len(f.verts)>4:
bm.faces.remove(f)'''
#删除多余边
#remove extra edge
for e in bm.edges:
true_edge=False
for i in edge_index:
if e.verts[0].index in i and e.verts[1].index in i:
true_edge=True
break
if true_edge==False:
bm.edges.remove(e)
bm.faces.ensure_lookup_table()
if mmr_property.cloth_convert_mod!='Bone Constrain':
bmesh.ops.holes_fill(bm, edges=bm.edges, sides=4)

#删除多余边
#remove extra edge
for e in bm.edges:
true_edge=False
for i in edge_index:
if e.verts[0].index in i and e.verts[1].index in i:
true_edge=True
break
if true_edge==False:
bm.edges.remove(e)
bm.faces.ensure_lookup_table()

#尝试标记出头发,飘带
#try mark hair or ribbon vertex
Expand Down Expand Up @@ -313,24 +309,26 @@ def convert_rigid_body_to_cloth(context):
#extend side vertex
bm.verts.index_update( )
bm.faces.ensure_lookup_table()
new_side_verts=[None for i in range(len(bm.verts))]
new_side_verts={}
for v in side_verts:
for e in v.link_edges:
if e not in side_edges:
if e.verts[0]==v:
new_location=v.co*2-e.verts[1].co
else:
new_location=v.co*2-e.verts[0].co
#这里改了
new_vert=bm.verts.new(new_location,v)
new_side_verts[v.index]=new_vert
break
new_vert=bm.verts.new(new_location,v)
new_side_verts[v.index]=new_vert


for e in side_edges:
vert1=e.verts[0]
vert2=e.verts[1]
vert3=new_side_verts[vert2.index]
vert4=new_side_verts[vert1.index]
if vert3 != None and vert4 != None:
if vert2.index in new_side_verts and vert1.index in new_side_verts:
vert3=new_side_verts[vert2.index]
vert4=new_side_verts[vert1.index]
bm.faces.new([vert1,vert2,vert3,vert4])

bm.verts.ensure_lookup_table()
Expand Down Expand Up @@ -478,7 +476,7 @@ class OT_Convert_Rigid_Body_To_Cloth(Operator):
bl_options = {'REGISTER', 'UNDO'}

def execute(self,context):
if bpy.app.version[1]>=93:
if bpy.app.version>=(2, 93, 0):
convert_rigid_body_to_cloth(context)
else:
alert_error('警告','该功能需要blender2.93及更新版本')
Expand Down
214 changes: 214 additions & 0 deletions MikuMikuRig/mmr_operators/preset.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,220 @@
"toe.R",
false
]
},
"VRM": {
"Hips": [
"spine",
false
],
"Spine": [
"spine.002",
false
],
"Chest": [
"spine.003",
false
],
"Neck": [
"spine.004",
false
],
"Head": [
"spine.006",
false
],
"LeftEye": [
"eye.L",
false
],
"RightEye": [
"eye.R",
false
],
"Shoulder.L": [
"shoulder.L",
false
],
"Upper Arm.L": [
"upper_arm.L",
false
],
"Lower Arm.L": [
"forearm.L",
false
],
"Hand.L": [
"hand.L",
false
],
"Index Proximal.L": [
"f_index.01.L",
false
],
"Index Intermediate.L": [
"f_index.02.L",
false
],
"Index Distal.L": [
"f_index.03.L",
false
],
"Little Proximal.L": [
"f_pinky.01.L",
false
],
"Little Intermediate.L": [
"f_pinky.02.L",
false
],
"Little Distal.L": [
"f_pinky.03.L",
false
],
"Middle Proximal.L": [
"f_middle.01.L",
false
],
"Middle Intermediate.L": [
"f_middle.02.L",
false
],
"Middle Distal.L": [
"f_middle.03.L",
false
],
"Ring Proximal.L": [
"f_ring.01.L",
false
],
"Ring Intermediate.L": [
"f_ring.02.L",
false
],
"Ring Distal.L": [
"f_ring.03.L",
false
],
"Thumb Proximal.L": [
"thumb.01.L",
false
],
"Thumb Intermediate.L": [
"thumb.02.L",
false
],
"Thumb Distal.L": [
"thumb.03.L",
false
],
"Shoulder.R": [
"shoulder.R",
false
],
"Upper Arm.R": [
"ArmTwist_R",
false
],
"Lower Arm.R": [
"forearm.R",
false
],
"Hand.R": [
"hand.R",
false
],
"Index Proximal.R": [
"f_index.01.R",
false
],
"Index Intermediate.R": [
"f_index.02.R",
false
],
"Index Distal.R": [
"f_index.03.R",
false
],
"Little Proximal.R": [
"f_pinky.01.R",
false
],
"Little Intermediate.R": [
"f_pinky.02.R",
false
],
"Little Distal.R": [
"f_pinky.03.R",
false
],
"Middle Proximal.R": [
"f_middle.01.R",
false
],
"Middle Intermediate.R": [
"f_middle.02.R",
false
],
"Middle Distal.R": [
"f_middle.03.R",
false
],
"Ring Proximal.R": [
"f_ring.01.R",
false
],
"Ring Intermediate.R": [
"f_ring.02.R",
false
],
"Ring Distal.R": [
"f_ring.03.R",
false
],
"Thumb Proximal.R": [
"thumb.01.R",
false
],
"Thumb Intermediate.R": [
"thumb.02.R",
false
],
"Thumb Distal.R": [
"thumb.03.R",
false
],
"Upper Leg.L": [
"thigh.L",
false
],
"Lower Leg.L": [
"shin.L",
false
],
"Foot.L.001": [
"foot.L",
false
],
"Foot.L.002": [
"toe.L",
false
],
"Upper Leg.R": [
"thigh.R",
false
],
"Lower Leg.R": [
"shin.R",
false
],
"Foot.R.001": [
"foot.R",
false
],
"Foot.R.002": [
"toe.R",
false
]
}
},
"retarget": {
Expand Down
2 changes: 1 addition & 1 deletion MikuMikuRig/mmr_operators/retarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def retarget_mixmao(OT,context):
rigify_action.name=action_name

old_frame=context.scene.frame_current
context.scene.frame_current=frame_range[0]
context.scene.frame_current=int(frame_range[0])

#写入MMR预设
fbx_preset=preset.preset_dict_dict['retarget'][mmr_property.retarget_preset_name]
Expand Down
Loading

0 comments on commit 028b0f5

Please sign in to comment.