[Bf-extensions-cvs] [2842b37] master: Clean whitespace.
Chris Foster
noreply at git.blender.org
Mon Feb 22 08:26:03 CET 2016
Commit: 2842b37eb86bfb77a2914020c4463fb3e0d54678
Author: Chris Foster
Date: Mon Feb 22 02:20:44 2016 -0500
Branches: master
https://developer.blender.org/rBA2842b37eb86bfb77a2914020c4463fb3e0d54678
Clean whitespace.
===================================================================
M io_scene_x/export_x.py
===================================================================
diff --git a/io_scene_x/export_x.py b/io_scene_x/export_x.py
index bde0fd2..64f5ff8 100644
--- a/io_scene_x/export_x.py
+++ b/io_scene_x/export_x.py
@@ -34,16 +34,16 @@ class DirectXExporter:
self.File = File(self.Config.filepath)
self.Log("Setting up coordinate system...")
-
+
# SystemMatrix converts from right-handed, z-up to the target coordinate system
self.SystemMatrix = Matrix()
-
+
if self.Config.CoordinateSystem == 'LEFT_HANDED':
self.SystemMatrix *= Matrix.Scale(-1, 4, Vector((0, 0, 1)))
-
+
if self.Config.UpAxis == 'Y':
self.SystemMatrix *= Matrix.Rotation(radians(-90), 4, 'X')
-
+
self.Log("Done")
self.Log("Generating object lists for export...")
@@ -69,7 +69,7 @@ class DirectXExporter:
self.RootExportList = [Object for Object in ExportMap.values()
if Object.BlenderObject.parent not in ExportList]
self.RootExportList = Util.SortByNameField(self.RootExportList)
-
+
self.ExportList = Util.SortByNameField(ExportMap.values())
# Determine each object's children from the pool of ExportObjects
@@ -80,14 +80,14 @@ class DirectXExporter:
if Child in ExportMap:
Object.Children.append(ExportMap[Child])
self.Log("Done")
-
+
self.AnimationWriter = None
if self.Config.ExportAnimation:
self.Log("Gathering animation data...")
-
+
# Collect all animated object data
AnimationGenerators = self.__GatherAnimationGenerators()
-
+
# Split the data up into animation sets based on user options
if self.Config.ExportActionsAsSets:
self.AnimationWriter = SplitSetAnimationWriter(self.Config,
@@ -124,7 +124,7 @@ class DirectXExporter:
self.Log("Closing Root frame...")
self.__CloseRootFrame()
self.Log("Done")
-
+
if self.AnimationWriter is not None:
self.Log("Writing animation set(s)...")
self.AnimationWriter.WriteAnimationSets()
@@ -173,27 +173,27 @@ template SkinWeights {\n\
self.File.Write("FrameTransformMatrix {\n")
self.File.Indent()
-
+
# Write the matrix that will convert Blender's coordinate space into
# DirectX's.
Util.WriteMatrix(self.File, self.SystemMatrix)
-
+
self.File.Unindent()
self.File.Write("}\n")
def __CloseRootFrame(self):
self.File.Unindent()
self.File.Write("} // End of Root\n")
-
+
def __GatherAnimationGenerators(self):
Generators = []
-
+
# If all animation data is to be lumped into one AnimationSet,
if not self.Config.ExportActionsAsSets:
# Build the appropriate generators for each object's type
for Object in self.ExportList:
if Object.BlenderObject.type == 'ARMATURE':
- Generators.append(ArmatureAnimationGenerator(self.Config,
+ Generators.append(ArmatureAnimationGenerator(self.Config,
None, Object))
else:
Generators.append(GenericAnimationGenerator(self.Config,
@@ -203,7 +203,7 @@ template SkinWeights {\n\
# Keep track of which objects have no action. These will be
# lumped together in a Default_Action AnimationSet.
ActionlessObjects = []
-
+
for Object in self.ExportList:
if Object.BlenderObject.animation_data is None:
ActionlessObjects.append(Object)
@@ -212,7 +212,7 @@ template SkinWeights {\n\
if Object.BlenderObject.animation_data.action is None:
ActionlessObjects.append(Object)
continue
-
+
# If an object has an action, build its appropriate generator
if Object.BlenderObject.type == 'ARMATURE':
Generators.append(ArmatureAnimationGenerator(self.Config,
@@ -224,7 +224,7 @@ template SkinWeights {\n\
Util.SafeName(
Object.BlenderObject.animation_data.action.name),
Object))
-
+
# If we should export unused actions as if the first armature was
# using them,
if self.Config.AttachToFirstArmature:
@@ -234,7 +234,7 @@ template SkinWeights {\n\
if Object.BlenderObject.type == 'ARMATURE':
FirstArmature = Object
break
-
+
if FirstArmature is not None:
# Determine which actions are not used
UsedActions = [BlenderObject.animation_data.action
@@ -242,12 +242,12 @@ template SkinWeights {\n\
if BlenderObject.animation_data is not None]
FreeActions = [Action for Action in bpy.data.actions
if Action not in UsedActions]
-
+
# If the first armature has no action, remove it from the
# actionless objects so it doesn't end up in Default_Action
if FirstArmature in ActionlessObjects and len(FreeActions):
ActionlessObjects.remove(FirstArmature)
-
+
# Keep track of the first armature's animation data so we
# can restore it after export
OldAction = None
@@ -258,29 +258,29 @@ template SkinWeights {\n\
else:
NoData = True
FirstArmature.BlenderObject.animation_data_create()
-
+
# Build a generator for each unused action
for Action in FreeActions:
FirstArmature.BlenderObject.animation_data.action = \
Action
-
+
Generators.append(ArmatureAnimationGenerator(
self.Config, Util.SafeName(Action.name),
FirstArmature))
-
+
# Restore old animation data
FirstArmature.BlenderObject.animation_data.action = \
OldAction
-
+
if NoData:
FirstArmature.BlenderObject.animation_data_clear()
-
+
# Build a special generator for all actionless objects
if len(ActionlessObjects):
Generators.append(GroupAnimationGenerator(self.Config,
"Default_Action", ActionlessObjects))
- return Generators
+ return Generators
# This class wraps a Blender object and writes its data to the file
class ExportObject: # Base class, do not use
@@ -335,7 +335,7 @@ class EmptyExportObject(ExportObject):
def __repr__(self):
return "[EmptyExportObject: {}]".format(self.name)
-
+
# Mesh object implementation of ExportObject
class MeshExportObject(ExportObject):
def __init__(self, Config, Exporter, BlenderObject):
@@ -357,9 +357,9 @@ class MeshExportObject(ExportObject):
if self.Config.ApplyModifiers:
# Certain modifiers shouldn't be applied in some cases
# Deactivate them until after mesh generation is complete
-
+
DeactivatedModifierList = []
-
+
# If we're exporting armature data, we shouldn't apply
# armature modifiers to the mesh
if self.Config.ExportSkinWeights:
@@ -367,21 +367,21 @@ class MeshExportObject(ExportObject):
for Modifier in self.BlenderObject.modifiers
if Modifier.type == 'ARMATURE' and \
Modifier.show_viewport]
-
+
for Modifier in DeactivatedModifierList:
Modifier.show_viewport = False
-
+
Mesh = self.BlenderObject.to_mesh(self.Exporter.context.scene,
True, 'PREVIEW')
-
+
# Restore the deactivated modifiers
for Modifier in DeactivatedModifierList:
- Modifier.show_viewport = True
+ Modifier.show_viewport = True
else:
Mesh = self.BlenderObject.to_mesh(self.Exporter.context.scene,
False, 'PREVIEW')
self.Exporter.Log("Done")
-
+
self.__WriteMesh(Mesh)
# Cleanup
@@ -394,7 +394,7 @@ class MeshExportObject(ExportObject):
self.Exporter.Log("Closed frame of {}".format(self))
# "Protected"
-
+
# This class provides a general system for indexing a mesh, depending on
# exporter needs. For instance, some options require us to duplicate each
# vertex of each face, some can reuse vertex data. For those we'd use
@@ -402,23 +402,23 @@ class MeshExportObject(ExportObject):
class _MeshEnumerator:
def __init__(self, Mesh):
self.Mesh = Mesh
-
+
# self.vertices and self.PolygonVertexIndices relate to the
# original mesh in the following way:
-
- # Mesh.vertices[Mesh.polygons[x].vertices[y]] ==
+
+ # Mesh.vertices[Mesh.polygons[x].vertices[y]] ==
# self.vertices[self.PolygonVertexIndices[x][y]]
-
- self.vertices = None
+
+ self.vertices = None
self.PolygonVertexIndices = None
-
+
# Represents the mesh as it is inside Blender
class _OneToOneMeshEnumerator(_MeshEnumerator):
def __init__(self, Mesh):
MeshExportObject._MeshEnumerator.__init__(self, Mesh)
-
+
self.vertic
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list