From 704263ee0b2aafc1f08a724a7eec794714dde010 Mon Sep 17 00:00:00 2001 From: Alexander N Date: Thu, 22 Aug 2013 13:42:34 +0000 Subject: undo the workaround of my previous commit for "[#36443] Vertex to UV index doesn't match with 2.68a", because that issue is fixed in blender 2.68a r59343 now. - deleted not needed workaround for issue [#36443], because it is fixed in blender 2.68a r59343, - added BMEdge generation to the importer (only for nice doing), - added undo to operators, - deleted some unused strings, --- io_scene_ms3d/ms3d_import.py | 46 +++++++++++++++++++------------------------ io_scene_ms3d/ms3d_strings.py | 8 +------- io_scene_ms3d/ms3d_ui.py | 10 +++++----- 3 files changed, 26 insertions(+), 38 deletions(-) (limited to 'io_scene_ms3d') diff --git a/io_scene_ms3d/ms3d_import.py b/io_scene_ms3d/ms3d_import.py index 125b0ee2..fa3a8462 100644 --- a/io_scene_ms3d/ms3d_import.py +++ b/io_scene_ms3d/ms3d_import.py @@ -556,10 +556,24 @@ class Ms3dImporter(): ms3d_triangle_index)) continue - bmf_normal.normalize() + # create edges for the face + # (not really needed, because bm.faces.new() will create its edges, + # if not exist, but good if we have already in case we need full control + # of bmesh stuff maybe in the future. + bme = bm.edges.get((bmv_list[0], bmv_list[1])) + if bme is None: + bme = bm.edges.new((bmv_list[0], bmv_list[1])) + bme.index = len(bm.edges) - 1 + bme = bm.edges.get((bmv_list[1], bmv_list[2])) + if bme is None: + bme = bm.edges.new((bmv_list[1], bmv_list[2])) + bme.index = len(bm.edges) - 1 + bme = bm.edges.get((bmv_list[2], bmv_list[0])) + if bme is None: + bme = bm.edges.new((bmv_list[2], bmv_list[0])) + bme.index = len(bm.edges) - 1 bmf = bm.faces.get(bmv_list) - if bmf is not None: if self.report and self.options_verbose in Ms3dUi.VERBOSE_NORMAL: self.report( @@ -570,36 +584,16 @@ class Ms3dImporter(): bmf = bm.faces.new(bmv_list) bmf.index = ms3d_triangle_index + bmf_normal.normalize() bmf.normal = bmf_normal - ########################## - ## WORKAROUND - # [#36443] Vertex to UV index doesn't match with 2.68a - # https://projects.blender.org/tracker/index.php?func=detail&aid=36443&group_id=9&atid=498 - # - scrambled_order = dict() - for face_vertex_index, face_bm_vertex in enumerate(bmf.verts): - scrambled_order[face_bm_vertex] = face_vertex_index # blender uv custom data per "face vertex" - bmf.loops[scrambled_order[bmv_list[0]]][layer_uv].uv = Vector( + bmf.loops[0][layer_uv].uv = Vector( (ms3d_triangle.s[0], 1.0 - ms3d_triangle.t[0])) - bmf.loops[scrambled_order[bmv_list[1]]][layer_uv].uv = Vector( + bmf.loops[1][layer_uv].uv = Vector( (ms3d_triangle.s[1], 1.0 - ms3d_triangle.t[1])) - bmf.loops[scrambled_order[bmv_list[2]]][layer_uv].uv = Vector( + bmf.loops[2][layer_uv].uv = Vector( (ms3d_triangle.s[2], 1.0 - ms3d_triangle.t[2])) - scrambled_order = None - # - ## WORKAROUND - ########################## - - ## blender uv custom data per "face vertex" - #bmf.loops[0][layer_uv].uv = Vector( - # (ms3d_triangle.s[0], 1.0 - ms3d_triangle.t[0])) - #bmf.loops[1][layer_uv].uv = Vector( - # (ms3d_triangle.s[1], 1.0 - ms3d_triangle.t[1])) - #bmf.loops[2][layer_uv].uv = Vector( - # (ms3d_triangle.s[2], 1.0 - ms3d_triangle.t[2])) - ########################## # ms3d custom data per "mesh face" bmf[layer_smoothing_group] = ms3d_triangle.smoothing_group diff --git a/io_scene_ms3d/ms3d_strings.py b/io_scene_ms3d/ms3d_strings.py index 0a0f8b55..b0fd9b70 100644 --- a/io_scene_ms3d/ms3d_strings.py +++ b/io_scene_ms3d/ms3d_strings.py @@ -116,7 +116,6 @@ ms3d_str = { 'ENUM_SELECT_2_SMOOTHING_GROUP': "selects all faces of selected"\ " smoothing group", 'LABEL_NAME_ANIMATION': "Animation Processing:", - 'LABEL_NAME_OBJECT': "World Processing:", 'LABEL_NAME_OPTIONS': "Advanced Options:", 'LABEL_NAME_PROCESSING': "Object Processing:", 'LABEL_NAME_MODIFIER': "Modifier Processing:", @@ -200,7 +199,7 @@ ms3d_str = { 'PROP_NAME_ROTATION_MODE' : "Bone Rotation Mode", 'PROP_DESC_ROTATION_MODE' : "set the preferred rotation mode of bones", 'PROP_ITEM_ROTATION_MODE_EULER_1' : "Euler", - 'PROP_ITEM_ROTATION_MODE_EULER_2' : "use euler bone rotation"\ + 'PROP_ITEM_ROTATION_MODE_EULER_2' : "use Euler bone rotation"\ " (gimbal-lock can be fixed by using "\ "'Graph Editor -> Key -> Discontinuity (Euler) Filter')", 'PROP_ITEM_ROTATION_MODE_QUATERNION_1' : "Quaternion", @@ -212,11 +211,6 @@ ms3d_str = { 'PROP_NAME_IMPORT_JOINT_SIZE': "Joint Size", 'PROP_DESC_IMPORT_JOINT_SIZE': "size of the joint representation in"\ " blender", - 'BL_LABEL_SET_SCENE_TO_METRIC' : "Set Scene to 'Metric' [1 mm]", - 'BL_DESC_SET_SCENE_TO_METRIC' : "set Scene | Units to Metric"\ - " (1 Unit = 1 mm),"\ - " Display | Textured Solid,"\ - " View | Clip (0.001 mm ... 1 km)", 'PROP_NAME_NORMALIZE_WEIGHTS' : "Normalize Weights", 'PROP_DESC_NORMALIZE_WEIGHTS' : "normalize all weights to 100%,", 'PROP_NAME_SHRINK_TO_KEYS' : "Shrink To Keys", diff --git a/io_scene_ms3d/ms3d_ui.py b/io_scene_ms3d/ms3d_ui.py index bde05713..6547bba2 100644 --- a/io_scene_ms3d/ms3d_ui.py +++ b/io_scene_ms3d/ms3d_ui.py @@ -263,7 +263,7 @@ class Ms3dImportOperator(Operator, ImportHelper): bl_idname = 'import_scene.ms3d' bl_label = ms3d_str['BL_LABEL_IMPORTER'] bl_description = ms3d_str['BL_DESCRIPTION_IMPORTER'] - bl_options = {'PRESET', } + bl_options = {'UNDO', 'PRESET', } bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' @@ -428,7 +428,7 @@ class Ms3dExportOperator(Operator, ExportHelper): bl_idname = 'export_scene.ms3d' bl_label = ms3d_str['BL_LABEL_EXPORTER'] bl_description = ms3d_str['BL_DESCRIPTION_EXPORTER'] - bl_options = {'PRESET', } + bl_options = {'UNDO', 'PRESET', } bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' @@ -640,7 +640,7 @@ class Ms3dExportOperator(Operator, ExportHelper): class Ms3dSetSmoothingGroupOperator(Operator): bl_idname = Ms3dUi.OPT_SMOOTHING_GROUP_APPLY bl_label = ms3d_str['BL_LABEL_SMOOTHING_GROUP_OPERATOR'] - bl_options = {'INTERNAL', } + bl_options = {'UNDO', 'INTERNAL', } smoothing_group_index = IntProperty( name=ms3d_str['PROP_SMOOTHING_GROUP_INDEX'], @@ -716,7 +716,7 @@ class Ms3dSetSmoothingGroupOperator(Operator): class Ms3dGroupOperator(Operator): bl_idname = Ms3dUi.OPT_GROUP_APPLY bl_label = ms3d_str['BL_LABEL_GROUP_OPERATOR'] - bl_options = {'INTERNAL', } + bl_options = {'UNDO', 'INTERNAL', } mode = EnumProperty( items=( ('', "", ""), @@ -807,7 +807,7 @@ class Ms3dGroupOperator(Operator): class Ms3dMaterialOperator(Operator): bl_idname = Ms3dUi.OPT_MATERIAL_APPLY bl_label = ms3d_str['BL_LABEL_MATERIAL_OPERATOR'] - bl_options = {'INTERNAL', } + bl_options = {'UNDO', 'INTERNAL', } mode = EnumProperty( items=( ('', "", ""), -- cgit v1.2.3