[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4061] contrib/py/scripts/addons/ io_scene_ms3d: modified exporter triangulation and modifier handling ( now it needs blender 2.65, because of triangulate modifier)
Alexander Nussbaumer
alpha-beta-release at gmx.net
Mon Dec 17 13:50:47 CET 2012
Revision: 4061
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4061
Author: beta-tester
Date: 2012-12-17 12:50:46 +0000 (Mon, 17 Dec 2012)
Log Message:
-----------
modified exporter triangulation and modifier handling (now it needs blender 2.65, because of triangulate modifier)
Modified Paths:
--------------
contrib/py/scripts/addons/io_scene_ms3d/__init__.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_export.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
Modified: contrib/py/scripts/addons/io_scene_ms3d/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/__init__.py 2012-12-17 10:33:39 UTC (rev 4060)
+++ contrib/py/scripts/addons/io_scene_ms3d/__init__.py 2012-12-17 12:50:46 UTC (rev 4061)
@@ -23,8 +23,8 @@
'description': "Import / Export MilkShape3D MS3D files"\
" (conform with v1.8.4)",
'author': "Alexander Nussbaumer",
- 'version': (0, 7, 0, 0),
- 'blender': (2, 6, 3, 0),
+ 'version': (0, 7, 0, 1),
+ 'blender': (2, 6, 5, 0),
'location': "File > Import & File > Export",
#'warning': "",
'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_export.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_export.py 2012-12-17 10:33:39 UTC (rev 4060)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_export.py 2012-12-17 12:50:46 UTC (rev 4061)
@@ -231,41 +231,39 @@
# create a complete copy of mesh and bend object data
# to be able to apply operations to it.
- # temporary, create a full copy of the model
+ # temporary, create a full heavy copy of the model (object, mesh, modifiers)
blender_mesh_temp = blender_mesh_object.data.copy()
blender_mesh_object_temp = blender_mesh_object.copy()
blender_mesh_object_temp.data = blender_mesh_temp
blender_scene.objects.link(blender_mesh_object_temp)
blender_scene.objects.active = blender_mesh_object_temp
- blender_mesh_temp.validate(self.options.verbose)
+ # apply transform
if self.options.apply_transform:
matrix_transform = blender_mesh_object_temp.matrix_local
else:
matrix_transform = Matrix()
# apply modifiers
- enable_edit_mode(False)
- if self.options.apply_modifiers:
- for modifier in blender_mesh_object_temp.modifiers:
- if (self.options.apply_modifiers_mode == Ms3dUi.PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW \
- and modifier.show_viewport) \
- or (self.options.apply_modifiers_mode == Ms3dUi.PROP_ITEM_APPLY_MODIFIERS_MODE_RENDER \
- and modifier.show_render):
- if not modifier.type in {'ARMATURE',
- 'CLOTH', 'COLLISION', 'DYNAMIC_PAINT', 'EXPLODE', 'FLUID_SIMULATION', 'OCEAN',
- 'PARTICLE_INSTANCE', 'PARTICLE_SYSTEM', 'SMOKE', 'SOFT_BODY', 'SURFACE', }:
- if ops.object.modifier_apply.poll():
- ops.object.modifier_apply(apply_as='DATA', modifier=modifier.name)
+ for modifier in blender_mesh_object_temp.modifiers:
+ if self.options.apply_modifiers:
+ # disable only armature modifiers
+ if modifier.type in {'ARMATURE', }:
+ modifier.show_viewport = False
+ modifier.show_render = False
+ else:
+ # disable all modifiers,
+ # to be able to add and apply triangulate modifier later
+ modifier.show_viewport = False
+ modifier.show_render = False
- # convert to tris
- enable_edit_mode(True)
- select_all(True)
- if ops.mesh.quads_convert_to_tris.poll():
- ops.mesh.quads_convert_to_tris()
+ # convert to tris by using the triangulate modifier
+ blender_mesh_object_temp.modifiers.new("temp", 'TRIANGULATE')
+ blender_mesh_temp = blender_mesh_object_temp.to_mesh(
+ blender_scene,
+ True,
+ self.options.apply_modifiers_mode)
- enable_edit_mode(False)
-
enable_edit_mode(True)
bm = bmesh.new()
bm.from_mesh(blender_mesh_temp)
@@ -460,7 +458,12 @@
##########################
# remove the temporary data
blender_scene.objects.unlink(blender_mesh_object_temp)
+ if blender_mesh_temp is not None:
+ blender_mesh_temp.user_clear()
+ blender_context.blend_data.meshes.remove(blender_mesh_temp)
+ blender_mesh_temp = None
if blender_mesh_object_temp is not None:
+ blender_mesh_temp = blender_mesh_object_temp.data.user_clear()
blender_mesh_object_temp.user_clear()
blender_context.blend_data.objects.remove(blender_mesh_object_temp)
if blender_mesh_temp is not None:
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_strings.py 2012-12-17 10:33:39 UTC (rev 4060)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_strings.py 2012-12-17 12:50:46 UTC (rev 4061)
@@ -225,11 +225,11 @@
'PROP_NAME_EXTENDED_NORMAL_HANDLING': "Extended Normal Handling",
'PROP_DESC_EXTENDED_NORMAL_HANDLING': "adds extra vertices if normals are different",
'PROP_NAME_APPLY_TRANSFORM': "Apply Transform",
- 'PROP_DESC_APPLY_TRANSFORM': "applies location, rotation, scale transform on export",
+ 'PROP_DESC_APPLY_TRANSFORM': "applies location, rotation and scale on export",
'PROP_NAME_APPLY_MODIFIERS': "Apply Modifiers",
- 'PROP_DESC_APPLY_MODIFIERS': "applies modifiers on export that are enabled(except of Armature and Physic modifiers)",
+ 'PROP_DESC_APPLY_MODIFIERS': "applies modifiers on export that are enabled (except of armature modifiers)",
'PROP_NAME_APPLY_MODIFIERS_MODE': "Apply Mode",
- 'PROP_DESC_APPLY_MODIFIERS_MODE': "apply if modifiers enabled in this mode",
+ 'PROP_DESC_APPLY_MODIFIERS_MODE': "apply modifier, if enabled in its mode",
'PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW_1': "View",
'PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW_2': "apply modifiers that are enabled in viewport",
'PROP_ITEM_APPLY_MODIFIERS_MODE_RENDER_1': "Render",
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_ui.py 2012-12-17 10:33:39 UTC (rev 4060)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_ui.py 2012-12-17 12:50:46 UTC (rev 4061)
@@ -229,7 +229,7 @@
PROP_DEFAULT_APPLY_MODIFIERS = True
###########################################################################
- PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW = 'VIEW'
+ PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW = 'PREVIEW'
PROP_ITEM_APPLY_MODIFIERS_MODE_RENDER = 'RENDER'
PROP_DEFAULT_APPLY_MODIFIERS_MODE = PROP_ITEM_APPLY_MODIFIERS_MODE_VIEW
More information about the Bf-extensions-cvs
mailing list