Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions io_mhrigging_mhskel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,29 @@
"""

bl_info = {
'name': 'Export: MakeHuman Rigging (.mhskel)',
'author': 'Manuel Bastioni',
'version': (1,0,2),
"blender": (2,6,0),
'location': "File > Export > MakeHuman Rigging (.mhskel) and File > Import > MakeHuman Rigging (.mhskel)",
'description': 'Export skeleton, groups and weights as mhskel file',
'warning': '',
'wiki_url': '',
'category': 'MakeHuman'}

import bpy
"name": "Export: MakeHuman Rigging (.mhskel)",
"author": "Manuel Bastioni",
"version": (1,0,3),
"blender": (2, 80, 0),
"location": "File > Export > MakeHuman Rigging (.mhskel) and File > Import > MakeHuman Rigging (.mhskel)",
"description": "Export skeleton, groups and weights as mhskel file",
"warning": "",
"wiki_url": (""),
"tracker_url": "",
"support": "COMMUNITY",
"category": "Import-Export"}

import bpy

from . import shared_mh_rigging
from . import export_mh_rigging
from . import import_mh_rigging


def register():
shared_mh_rigging.register()
export_mh_rigging.register()
import_mh_rigging.register()


def unregister():
shared_mh_rigging.unregister()
export_mh_rigging.unregister()
Expand All @@ -67,4 +68,3 @@ def unregister():

if __name__ == "__main__":
register()

16 changes: 8 additions & 8 deletions io_mhrigging_mhskel/export_mh_rigging.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def writeRiggingFile(context, filepath):
# This is very important, because the armature
# must be active in order to turn in edit mode.

bpy.context.scene.objects.active = armature
bpy.context.view_layer.objects.active = armature

bones, rot_planes = getBonesData(basemesh, armature)
joints = getJointsData(basemesh, armature)
Expand Down Expand Up @@ -428,7 +428,7 @@ def writeRiggingFile(context, filepath):
outfile.close()

#Restore the initial active object
bpy.context.scene.objects.active = basemesh
bpy.context.view_layer.objects.active = basemesh
return {'FINISHED'}

"""
Expand All @@ -444,7 +444,7 @@ def writeRiggingFile(context, filepath):
from bpy.types import Operator

def menu_func_export(self, context):
self.layout.operator(ExportMHRigging.bl_idname, text="MakeHuman rigging (.mhskel)")
self.layout.operator(ExportMHRigging.bl_idname, text="MakeHuman rigging (.mhskel)")

class ExportMHRigging(Operator, ExportHelper):
"""This appears in the tooltip of the operator and in the generated docs"""
Expand All @@ -454,21 +454,21 @@ class ExportMHRigging(Operator, ExportHelper):
# ImportHelper mixin class uses this
filename_ext = ".mhskel"

filter_glob = StringProperty(
filter_glob: StringProperty(
default="*.mhskel",
options={'HIDDEN'},
)

def execute(self, context):
return writeRiggingFile(context, self.filepath)
def execute(self, context):
return writeRiggingFile(context, self.filepath)

def register():
bpy.utils.register_class(ExportMHRigging)
bpy.types.INFO_MT_file_export.append(menu_func_export)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

def unregister():
bpy.utils.unregister_class(ExportMHRigging)
bpy.types.INFO_MT_file_export.remove(menu_func_export)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions io_mhrigging_mhskel/import_mh_rigging.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def createArmatureFromJsonFile(filePath):
weightsFile.close()

for group, weights in weights.items():
newGroup = basemesh.vertex_groups.new(group)
newGroup = basemesh.vertex_groups.new(name=group)
for weightData in weights:
newGroup.add([weightData[0]], weightData[1], 'ADD')

Expand Down Expand Up @@ -130,7 +130,7 @@ class ImportMHRigging(Operator, ImportHelper):
# ImportHelper mixin class uses this
filename_ext = ".mhskel"

filter_glob = StringProperty(
filter_glob: StringProperty(
default="*.mhskel",
options={'HIDDEN'},
)
Expand All @@ -141,11 +141,11 @@ def execute(self, context):

def register():
bpy.utils.register_class(ImportMHRigging)
bpy.types.INFO_MT_file_import.append(menu_func_import)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)

def unregister():
bpy.utils.unregister_class(ImportMHRigging)
bpy.types.INFO_MT_file_import.remove(menu_func_import)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)


if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion io_mhrigging_mhskel/shared_mh_rigging.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@
"upperleg02.R____head": [4260 ,4308, 4407, 6394],
"upperleg01.R____tail": [4260, 4308, 4407, 6394],
"upperarm02.R____head": [1404, 1406, 1419, 1429, 1440, 1442, 1628, 1638, 1639, 1640, 1648, 1649, 1652, 1662, 3759, 3760],
"upperarm01.R____tail": [1404, 1406, 1419, 1429, 1440, 1442, 1628, 1638, 1639, 1640, 1648, 1649, 1652, 1662, 3759, 3760],
"shoulder02.R____tail": [1404, 1406, 1419, 1429, 1440, 1442, 1628, 1638, 1639, 1640, 1648, 1649, 1652, 1662, 3759, 3760],
"upperarm02.L____head": [8092, 8094, 8107, 8117, 8128, 8130, 8300, 8310, 8311, 8312, 8320, 8321, 8324, 8334, 10426, 10427],
"upperarm01.L____tail": [8092, 8094, 8107, 8117, 8128, 8130, 8300, 8310, 8311, 8312, 8320, 8321, 8324, 8334, 10426, 10427],
"shoulder02.L____tail": [8092, 8094, 8107, 8117, 8128, 8130, 8300, 8310, 8311, 8312, 8320, 8321, 8324, 8334, 10426, 10427],
"tongue07.L____head": [14558, 14559, 14560, 14561, 14562, 14563, 14564, 14565, 14550, 14551, 14552, 14553, 14554, 14555, 14556, 14557],
"tongue07.R____head": [14558, 14559, 14560, 14561, 14562, 14563, 14564, 14565, 14550, 14551, 14552, 14553, 14554, 14555, 14556, 14557],
Expand Down Expand Up @@ -262,7 +264,7 @@ def getObject():
if len(bpy.context.selected_objects) > 0:

#Get latest selected obj and make it the active one
bpy.context.scene.objects.active = bpy.context.selected_objects[0]
bpy.context.view_layer.objects.active = bpy.context.selected_objects[0]

activeObject = bpy.context.object
return activeObject
Expand Down