[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2721] contrib/py/scripts/addons/ io_scene_ms3d: fixed wrong bone roll, ...
Alexander Nussbaumer
alpha-beta-release at gmx.net
Mon Dec 5 08:34:28 CET 2011
Revision: 2721
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2721
Author: beta-tester
Date: 2011-12-05 07:34:22 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
fixed wrong bone roll, ...
changed: (0, 3, 4, "beta (2011-12-05 00:00)"),
add: importer adds ms3d_flags custom properties for some objects
fix: importer corrects the roll of blender bones
Modified Paths:
--------------
contrib/py/scripts/addons/io_scene_ms3d/__README__.txt
contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_spec.py
contrib/py/scripts/addons/io_scene_ms3d/ms3d_utils.py
Modified: contrib/py/scripts/addons/io_scene_ms3d/__README__.txt
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/__README__.txt 2011-12-04 23:42:20 UTC (rev 2720)
+++ contrib/py/scripts/addons/io_scene_ms3d/__README__.txt 2011-12-05 07:34:22 UTC (rev 2721)
@@ -91,7 +91,9 @@
changelog:
-changed: (0, 3, 4, "beta (2011-12-04 00:00)"),
+changed: (0, 3, 4, "beta (2011-12-05 00:00)"),
+add: importer adds ms3d_flags custom properties for some objects
+fix: importer corrects the roll of blender bones
add: importer adds ms3d_comment custom properties for modelComment (to a blender empty), groupComments (to its blender meshes), materialComments (to its blender materials) and jointComments (to its blender bones)
add: importer adds raw data ms3d_ambient and ms3d_emissive custom properties to material, because blender does not have an exact similar color definition
fix: ms3d_spec, modelComment, only one comment is allowed and a modelComment does not have an index value
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py 2011-12-04 23:42:20 UTC (rev 2720)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_import.py 2011-12-05 07:34:22 UTC (rev 2721)
@@ -293,10 +293,13 @@
if setupGroup:
for item in self.dict_mesh_objects.values():
blenderGroup.objects.link(item)
+ item.select = True
for item in self.dict_armature_objects.values():
blenderGroup.objects.link(item)
+ item.select = True
for item in self.dict_comment_objects.values():
blenderGroup.objects.link(item)
+ item.select = True
print()
print("######################################################################")
@@ -340,6 +343,7 @@
blenderBone = blenderBones.new(ms3dJoint.name)
bones[ms3dJoint.name] = (blenderBone, ms3dJoint)
+ blenderBone[prop(ms3d_spec.PROP_NAME_FLAGS)] = ms3dJoint.flags
ms3dComment = ms3dTemplate.get_joint_comment_by_key(iBone)
if ms3dComment is not None:
blenderBone[prop(ms3d_spec.PROP_NAME_COMMENT)] = ms3dComment.comment
@@ -353,6 +357,7 @@
blenderBone.tail = mathVector
blenderBone.head = blenderBone.tail + mathutils.Vector((-1.0, 0.0, 0.0))
bones_parentName = ms3dJoint.name
+ matrixRotation = None
else:
# some models have more than one initial bone (with no parent)
@@ -375,10 +380,9 @@
-bones[key][1].rotation[2]))
rotationAxis = rotationAxis * self.matrixSwapAxis
- rotation = mathutils.Euler(rotationAxis, 'XZY')
+ mathRotation = mathutils.Euler(rotationAxis, 'XZY')
+ matrixRotation = matrixRotation * mathRotation.to_matrix().to_4x4()
- matrixRotation = matrixRotation * rotation.to_matrix().to_4x4()
-
blenderBone.tail = blenderBone.parent.tail + (mathVector * matrixRotation)
@@ -386,6 +390,9 @@
blenderBone.use_connect = True
blenderBone.select = True
+ if matrixRotation is not None:
+ blenderBone.align_roll(mathutils.Vector([0.0, 0.0, 1.0]) * matrixRotation)
+
ms3d_utils.EnableEditMode(False)
return bones
@@ -514,6 +521,7 @@
blenderObject.location = blenderScene.cursor_location
blenderScene.objects.link(blenderObject)
if setupObject:
+ blenderObject[prop(ms3d_spec.PROP_NAME_FLAGS)] = ms3dGroup.flags
ms3dComment = ms3dTemplate.get_group_comment_by_key(ms3dGroupIndex)
if ms3dComment is not None:
blenderObject[prop(ms3d_spec.PROP_NAME_COMMENT)] = ms3dComment.comment
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_spec.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_spec.py 2011-12-04 23:42:20 UTC (rev 2720)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_spec.py 2011-12-05 07:34:22 UTC (rev 2721)
@@ -52,10 +52,6 @@
PROP_NAME_AMBIENT = "ambient"
PROP_NAME_EMISSIVE = "emissive"
-PRINT_LEVEL1 = 3
-PRINT_LEVEL1x = 6
-PRINT_LEVEL2 = 9
-
#
#
#
@@ -1460,9 +1456,7 @@
"_nHasModelComment",
"_modelComment",
"subVersionVertexExtra",
- "_vertex_ex1",
- "_vertex_ex2",
- "_vertex_ex3",
+ "_vertex_ex",
"subVersionJointExtra",
"_joint_ex",
"subVersionModelExtra",
@@ -1562,14 +1556,8 @@
# Then comes the subversion of the vertex extra information like bone weights, extra etc.
self.subVersionVertexExtra = 2
- # ms3d_vertex_ex_t for subVersionVertexExtra == 1
- self._vertex_ex1 = [] #ms3d_vertex_ex1_t()
-
- # ms3d_vertex_ex_t for subVersionVertexExtra == 2
- self._vertex_ex2 = [] #ms3d_vertex_ex2_t()
-
- # ms3d_vertex_ex_t for subVersionVertexExtra == 3
- self._vertex_ex3 = [] #ms3d_vertex_ex3_t()
+ # ms3d_vertex_ex_t for subVersionVertexExtra in {1, 2, 3}
+ self._vertex_ex = [] #ms3d_vertex_ex1_t() #ms3d_vertex_ex2_t() #ms3d_vertex_ex3_t()
# Then comes nNumVertices times ms3d_vertex_ex_t structs (sizeof(ms3d_vertex_ex_t) == 10)
##
@@ -1688,18 +1676,10 @@
@property
- def vertex_ex1(self):
- return self._vertex_ex1
+ def vertex_ex(self):
+ return self._vertex_ex
@property
- def vertex_ex2(self):
- return self._vertex_ex2
-
- @property
- def vertex_ex3(self):
- return self._vertex_ex3
-
- @property
def joint_ex(self):
return self._joint_ex
@@ -1778,16 +1758,7 @@
print("modelComment={0}".format(self.modelComment))
print("subVersionVertexExtra={0}".format(self.subVersionVertexExtra))
- if (self.subVersionVertexExtra == 1):
- print("vertex_ex1={0}".format(self.vertex_ex1))
- elif (self.subVersionVertexExtra == 2):
- print("vertex_ex2={0}".format(self.vertex_ex2))
- elif (self.subVersionVertexExtra == 3):
- print("vertex_ex3={0}".format(self.vertex_ex3))
- else:
- print("vertex_ex1={0}".format(self.vertex_ex1))
- print("vertex_ex2={0}".format(self.vertex_ex2))
- print("vertex_ex3={0}".format(self.vertex_ex3))
+ print("vertex_ex={0}".format(self.vertex_ex))
print("subVersionJointExtra={0}".format(self.subVersionJointExtra))
print("joint_ex={0}".format(self.joint_ex))
@@ -1883,20 +1854,18 @@
progressCount += 1
self.subVersionVertexExtra = read_dword(file)
- self._vertex_ex1 = []
- self._vertex_ex2 = []
- self._vertex_ex3 = []
- if (self.subVersionVertexExtra == 1):
+ if (self.subVersionVertexExtra in {1, 2, 3}):
+ self._vertex_ex = []
for i in range(_nNumVertices):
- self.vertex_ex1.append(ms3d_vertex_ex1_t().read(file))
- elif (self.subVersionVertexExtra == 2):
- for i in range(_nNumVertices):
- self.vertex_ex2.append(ms3d_vertex_ex2_t().read(file))
- elif (self.subVersionVertexExtra == 3):
- for i in range(_nNumVertices):
- self.vertex_ex3.append(ms3d_vertex_ex3_t().read(file))
+ if self.subVersionVertexExtra == 1:
+ item = ms3d_vertex_ex1_t()
+ if self.subVersionVertexExtra == 2:
+ item = ms3d_vertex_ex2_t()
+ if self.subVersionVertexExtra == 3:
+ item = ms3d_vertex_ex3_t()
+ self.vertex_ex.append(item.read(file))
else:
- pass
+ self._vertex_ex = None
progressCount += 1
@@ -1943,9 +1912,7 @@
if (progressCount <= 6):
self.subVersionVertexExtra = None
- self._vertex_ex1 = None
- self._vertex_ex2 = None
- self._vertex_ex3 = None
+ self._vertex_ex = None
if (progressCount <= 7):
self.subVersionJointExtra = None
@@ -2020,17 +1987,9 @@
self.modelComment.write(file)
write_dword(file, self.subVersionVertexExtra)
- if (self.subVersionVertexExtra == 1):
+ if (self.subVersionVertexExtra in {1, 2, 3}):
for i in range(self.nNumVertices):
- self.vertex_ex1[i].write(file)
- elif (self.subVersionVertexExtra == 2):
- for i in range(self.nNumVertices):
- self.vertex_ex2[i].write(file)
- elif (self.subVersionVertexExtra == 3):
- for i in range(self.nNumVertices):
- self.vertex_ex3[i].write(file)
- else:
- pass
+ self.vertex_ex[i].write(file)
write_dword(file, self.subVersionJointExtra)
for i in range(self.nNumJoints):
Modified: contrib/py/scripts/addons/io_scene_ms3d/ms3d_utils.py
===================================================================
--- contrib/py/scripts/addons/io_scene_ms3d/ms3d_utils.py 2011-12-04 23:42:20 UTC (rev 2720)
+++ contrib/py/scripts/addons/io_scene_ms3d/ms3d_utils.py 2011-12-05 07:34:22 UTC (rev 2721)
@@ -152,7 +152,7 @@
PROP_DEFAULT_OBJECTS_IMP = {
#PROP_ITEM_OBJECT_MESH,
PROP_ITEM_OBJECT_MATERIAL,
- #PROP_ITEM_OBJECT_JOINT,
+ PROP_ITEM_OBJECT_JOINT,
PROP_ITEM_OBJECT_SMOOTHGROUPS,
PROP_ITEM_OBJECT_GROUP,
#PROP_ITEM_OBJECT_TRI_TO_QUAD,
@@ -188,7 +188,7 @@
###############################################################################
PROP_NAME_ANIMATION = "Animation **)"
PROP_DESC_ANIMATION = "keyframes (rotations, positions)"
-PROP_DEFAULT_ANIMATION = True
+PROP_DEFAULT_ANIMATION = False
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list