[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4052] contrib/py/scripts/addons/ io_scene_ms3d: add importer option for extended normal handling
Alexander Nussbaumer
alpha-beta-release at gmx.net
Sun Dec 16 10:54:07 CET 2012
Revision: 4052
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4052
Author: beta-tester
Date: 2012-12-16 09:54:05 +0000 (Sun, 16 Dec 2012)
Log Message:
-----------
add importer option for extended normal handling
Modified Paths:
--------------
contrib/py/scripts/addons/io_scene_ms3d/__init__.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
Removed Paths:
-------------
contrib/py/scripts/addons/io_scene_ms3d/__README__.txt
Deleted: contrib/py/scripts/addons/io_scene_ms3d/__README__.txt
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/__README__.txt 2012-12-16 05:52:22 UTC (rev 4051)
+++ contrib/py/scripts/addons/io_scene_ms3d/__README__.txt 2012-12-16 09:54:05 UTC (rev 4052)
@@ -1,210 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-###############################################################################
-#234567890123456789012345678901234567890123456789012345678901234567890123456789
-#--------1---------2---------3---------4---------5---------6---------7---------
-
-
-# ##### BEGIN COPYRIGHT BLOCK #####
-#
-# initial script copyright (c)2011,2012 Alexander Nussbaumer
-#
-# ##### END COPYRIGHT BLOCK #####
-
-
-files:
-__README__.txt
-__init__.py
-ms3d_export.py
-ms3d_import.py
-ms3d_spec.py
-ms3d_utils.py
-ms3d_ui.py
-ms3d_strings.py
-
-
-description:
-__README__.txt : this file
- \xA7 Blender maintenance
-
-__init__.py : entry point for blender plugins
- initialize and registers/unregisters plugin functions
- \xA7 Blender maintenance
-
-ms3d_export.py : entry point for exporter
- functions to bring Blender content in a correct way to
- MilkShape
- \xA7 Blender -> MilkShape3D maintenance
-
-ms3d_import.py : entry point for importer
- functions to bring MilkShape content in a correct way to
- Blender
- \xA7 MilkShape3D -> Blender maintenance
-
-ms3d_spec.py : objects and structures that specified a MilkShape3D file
- base functions to write/read its objects itself
- \xA7 MilkShape maintenance
-
-ms3d_ui.py : additional custom properties for Blender objects
- give user access to MilkShape specific properties
- \xA7 Blender maintenance
-
-ms3d_strings.py : most of the strings used in the addon to have a
- central point for optional internationalization
-
-
-known issues:
- importer issues:
- -/-
-
- exporter issues:
- - does only export active mesh object
- - does only export the first existing UV texture coordinates,
- if more than one UV texture is used per mesh
-
-
-todo / nice to have:
- - export options to ms3d joints/animation/extra parts optional
-
-
-###############################################################################
- exporter:
- Ms3dModel
- .vertices
- Ms3dVertex
- .vertex: 100%
- .bone_id: 100%
- .reference_count: 100%
- .flags: 0%
- .vertex_ex
- Ms3dVertexEx
- .bone_ids: 100%
- .weights: 100%
- .extra: 100% (not exposed to UI)
- .triangles
- Ms3dTriangle
- .vertex_indices: 100%
- .s: 100%
- .t: 100%
- .group_index: 100%
- .smoothing_group: 100%
- .flags: 0%
- .vertex_normals: 100%
- .groups
- Ms3dGroup
- .name: 100%
- .triangle_indices: 100%
- .material_index: 100%
- .comment: 100%
- .flags: 100%
- .materials
- Ms3dMaterial
- name: 100%
- ambient: 100%
- diffuse: 100%
- specular: 100%
- emissive: 100%
- shininess: 100%
- transparency: 100%
- mode: 100%
- texture: 100%
- alphamap: 100%
- comment: 100%
- .comment: 100%
- .model_ex
- Ms3dModelEx
- .joint_size: 100%
- .transparency_mode: 100%
- .alpha_ref: 100%
- .joints
- Ms3dJoint
- .name: 100%
- .parent_name: 100%
- .rotation: 100%
- .position: 100%
- .rotation_keyframes: 100%
- .translation_keyframes: 100%
- .joint_ex
- Ms3DJointEx
- .color: 100%
- .comment: 100%
-###############################################################################
- importer:
- Ms3dModel
- .vertices
- Ms3dVertex
- .vertex: 100%
- .bone_id: 100%
- .reference_count: 0%
- .flags: 0%
- .vertex_ex
- Ms3dVertexEx
- .bone_ids: 100%
- .weights: 100%
- .extra: 100% (not exposed to UI)
- .triangles
- Ms3dTriangle
- .vertex_indices: 100%
- .s: 100%
- .t: 100%
- .group_index: 100%
- .smoothing_group: 100%
- .flags: 0%
- .vertex_normals: 0%
- .groups
- Ms3dGroup
- .name: 100%
- .triangle_indices: 100%
- .material_index: 100%
- .comment: 100%
- .flags: 100%
- .materials
- Ms3dMaterial
- name: 100%
- ambient: 100%
- diffuse: 100%
- specular: 100%
- emissive: 100%
- shininess: 100%
- transparency: 100%
- mode: 100%
- texture: 100%
- alphamap: 100%
- comment: 100%
- .comment: 100%
- .model_ex
- Ms3dModelEx
- .joint_size: 100%
- .transparency_mode: 100%
- .alpha_ref: 100%
- .joints
- Ms3dJoint
- .name: 100%
- .parent_name: 100%
- .rotation: 100%
- .position: 100%
- .rotation_keyframes: 100%
- .translation_keyframes: 100%
- .joint_ex
- Ms3DJointEx
- .color: 100%
- .comment: 100%
-###############################################################################
Modified: contrib/py/scripts/addons/io_scene_ms3d/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/__init__.py 2012-12-16 05:52:22 UTC (rev 4051)
+++ contrib/py/scripts/addons/io_scene_ms3d/__init__.py 2012-12-16 09:54:05 UTC (rev 4052)
@@ -23,7 +23,7 @@
'description': "Import / Export MilkShape3D MS3D files"\
" (conform with v1.8.4)",
'author': "Alexander Nussbaumer",
- 'version': (0, 6, 0, 3),
+ 'version': (0, 6, 0, 4),
'blender': (2, 6, 3, 0),
'location': "File > Import & File > Export",
#'warning': "",
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py 2012-12-16 05:52:22 UTC (rev 4051)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py 2012-12-16 09:54:05 UTC (rev 4052)
@@ -431,15 +431,46 @@
# BMesh stuff:
# create all triangles
length_verts = len(bm.verts)
+ vertex_extra_index = length_verts
+ blender_invalide_normal = Vector()
smoothing_group_blender_faces = {}
for ms3d_triangle_index, ms3d_triangle in enumerate(
ms3d_model.triangles):
bmv_list = []
+ bmf_normal = Vector()
+
for index, vert_index in enumerate(ms3d_triangle.vertex_indices):
if vert_index < 0 or vert_index >= length_verts:
continue
bmv = bm.verts[vert_index]
- bmv.normal = self.geometry_correction(ms3d_triangle.vertex_normals[index])
+
+ blender_normal = self.geometry_correction(ms3d_triangle.vertex_normals[index])
+ if bmv.normal == blender_invalide_normal:
+ bmv.normal = blender_normal
+ elif bmv.normal != blender_normal and self.options.extended_normal_handling:
+ ## search for an already created extra vertex
+ bmv_new = None
+ for vert_index_candidat in range(vertex_extra_index, length_verts):
+ bmv_candidat = bm.verts[vert_index_candidat]
+ if bmv_candidat.co == bmv.co \
+ and bmv_candidat.normal == blender_normal:
+ bmv_new = bmv_candidat
+ vert_index = vert_index_candidat
+ break
+
+ ## if not exists, create one in blender and ms3d as well
+ if bmv_new is None:
+ ms3d_model.vertices.append(ms3d_model.vertices[vert_index])
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list