[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4044] trunk/py/scripts/addons/ io_export_unreal_psk_psa.py: added scale object on export, rebuild object on export, and check mesh for vertices's error mesh.

John Phan darkneter at gmail.com
Thu Dec 13 21:55:09 CET 2012


Revision: 4044
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4044
Author:   darknet
Date:     2012-12-13 20:55:06 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
added scale object on export, rebuild object on export, and check mesh for vertices's error mesh. update the menu to rework the layouts.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py

Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2012-12-13 10:30:07 UTC (rev 4043)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2012-12-13 20:55:06 UTC (rev 4044)
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Export Unreal Engine Format(.psk/.psa)",
     "author": "Darknet/Optimus_P-Fat/Active_Trash/Sinsoft/VendorX/Spoof",
-    "version": (2, 6),
+    "version": (2, 7),
     "blender": (2, 6, 3),
     "api": 36079,
     "location": "File > Export > Skeletal Mesh/Animation Data (.psk/.psa)",
@@ -84,8 +84,8 @@
 """
 NOTES for Jan 2012 refactor (Spoof)
 
-	* THIS IS A WORK IN PROGRESS. These modifications were originally
-	intended for internal use and are incomplete. Use at your own risk! *
+    * THIS IS A WORK IN PROGRESS. These modifications were originally
+    intended for internal use and are incomplete. Use at your own risk! *
 
 TODO
 
@@ -102,11 +102,11 @@
 - progress reporting while processing smooth groups
 - more informative logging
 - code refactor for clarity and modularity
-	- naming conventions unified to use lowercase_with_underscore
-	- C++ datatypes and PSK/PSA classes remain CamelCaseStyle for clarity
-	- names such as 'ut' and 'unreal' unified to 'udk'
-	- simplification of code structure
-	- removed legacy code paths
+    - naming conventions unified to use lowercase_with_underscore
+    - C++ datatypes and PSK/PSA classes remain CamelCaseStyle for clarity
+    - names such as 'ut' and 'unreal' unified to 'udk'
+    - simplification of code structure
+    - removed legacy code paths
 
 USAGE
 
@@ -116,9 +116,9 @@
 
 Taking advantage of this script requires the following methodology:
 
-	* Place all exportable bones into a bone hierarchy extending from a single
-	root. This root bone must have use_deform enabled. All other root bones
-	in the armature must disable use_deform. *
+    * Place all exportable bones into a bone hierarchy extending from a single
+    root. This root bone must have use_deform enabled. All other root bones
+    in the armature must disable use_deform. *
 
 The script searches for a root bone with use_deform set true and considers all
 bones parented to it as part of the UDK skeletal mesh. Thus only these bones
@@ -129,7 +129,7 @@
 approach you can build complex animation rigs in a similar vein to the Rigify
 add-on, by Nathan Vegdahl. However...
 
-	* Rigify is incompatible with this script *
+    * Rigify is incompatible with this script *
 
 Rigify interlaces deformer bones within a single hierarchy making it difficult
 to deconstruct for export. It also splits some meta-rig bones into multiple
@@ -159,21 +159,21 @@
 # Triangles specifed counter clockwise for front face
 #
 # defines for sizeofs
-SIZE_FQUAT				= 16
-SIZE_FVECTOR			= 12
-SIZE_VJOINTPOS			= 44
-SIZE_ANIMINFOBINARY		= 168
-SIZE_VCHUNKHEADER		= 32
-SIZE_VMATERIAL			= 88
-SIZE_VBONE				= 120
-SIZE_FNAMEDBONEBINARY	= 120
-SIZE_VRAWBONEINFLUENCE	= 12
-SIZE_VQUATANIMKEY		= 32
-SIZE_VVERTEX			= 16
-SIZE_VPOINT				= 12
-SIZE_VTRIANGLE			= 12
+SIZE_FQUAT              = 16
+SIZE_FVECTOR            = 12
+SIZE_VJOINTPOS          = 44
+SIZE_ANIMINFOBINARY     = 168
+SIZE_VCHUNKHEADER       = 32
+SIZE_VMATERIAL          = 88
+SIZE_VBONE              = 120
+SIZE_FNAMEDBONEBINARY   = 120
+SIZE_VRAWBONEINFLUENCE  = 12
+SIZE_VQUATANIMKEY       = 32
+SIZE_VVERTEX            = 16
+SIZE_VPOINT             = 12
+SIZE_VTRIANGLE          = 12
 
-MaterialName			= []
+MaterialName            = []
 
 
 #===========================================================================
@@ -181,63 +181,63 @@
 #===========================================================================
 class Error( Exception ):
 
-	def __init__(self, message):
-		self.message = message
+    def __init__(self, message):
+        self.message = message
 
 #===========================================================================
 # Verbose logging with loop truncation
 #===========================================================================
 def verbose( msg, iteration=-1, max_iterations=4, msg_truncated="..." ):
 
-	if bpy.context.scene.udk_option_verbose == True:
-		# limit the number of times a loop can output messages
-		if iteration > max_iterations:
-			return
-		elif iteration == max_iterations:
-			print(msg_truncated)
-			return
+    if bpy.context.scene.udk_option_verbose == True:
+        # limit the number of times a loop can output messages
+        if iteration > max_iterations:
+            return
+        elif iteration == max_iterations:
+            print(msg_truncated)
+            return
 
-		print(msg)
-	
+        print(msg)
+    
 #===========================================================================
 # Log header/separator
 #===========================================================================
 def header( msg, justify='LEFT', spacer='_', cols=78 ):
-	
-	if justify == 'LEFT':
-		s = '{:{spacer}<{cols}}'.format(msg+" ", spacer=spacer, cols=cols)
-	
-	elif justify == 'RIGHT':
-		s = '{:{spacer}>{cols}}'.format(" "+msg, spacer=spacer, cols=cols)
-	
-	else:
-		s = '{:{spacer}^{cols}}'.format(" "+msg+" ", spacer=spacer, cols=cols)
-	
-	return "\n" + s + "\n"
+    
+    if justify == 'LEFT':
+        s = '{:{spacer}<{cols}}'.format(msg+" ", spacer=spacer, cols=cols)
+    
+    elif justify == 'RIGHT':
+        s = '{:{spacer}>{cols}}'.format(" "+msg, spacer=spacer, cols=cols)
+    
+    else:
+        s = '{:{spacer}^{cols}}'.format(" "+msg+" ", spacer=spacer, cols=cols)
+    
+    return "\n" + s + "\n"
 
 #===========================================================================
 # Generic Object->Integer mapping
 # the object must be usable as a dictionary key
 #===========================================================================
 class ObjMap:
-	
-	def __init__(self):
-		self.dict = {}
-		self.next = 0
-	
-	def get(self, obj):
-		if obj in self.dict:
-			return self.dict[obj]
-		else:
-			id = self.next
-			self.next = self.next + 1
-			self.dict[obj] = id
-			return id
-	
-	def items(self):
-		getval = operator.itemgetter(0)
-		getkey = operator.itemgetter(1)
-		return map(getval, sorted(self.dict.items(), key=getkey))
+    
+    def __init__(self):
+        self.dict = {}
+        self.next = 0
+    
+    def get(self, obj):
+        if obj in self.dict:
+            return self.dict[obj]
+        else:
+            id = self.next
+            self.next = self.next + 1
+            self.dict[obj] = id
+            return id
+    
+    def items(self):
+        getval = operator.itemgetter(0)
+        getkey = operator.itemgetter(1)
+        return map(getval, sorted(self.dict.items(), key=getkey))
 
 #===========================================================================
 # RG - UNREAL DATA STRUCTS - CONVERTED FROM C STRUCTS GIVEN ON UDN SITE 
@@ -246,258 +246,258 @@
 #===========================================================================
 class FQuat:
 
-	def __init__(self): 
-		self.X = 0.0
-		self.Y = 0.0
-		self.Z = 0.0
-		self.W = 1.0
-		
-	def dump(self):
-		return pack('ffff', self.X, self.Y, self.Z, self.W)
-		
-	def __cmp__(self, other):
-		return cmp(self.X, other.X) \
-			or cmp(self.Y, other.Y) \
-			or cmp(self.Z, other.Z) \
-			or cmp(self.W, other.W)
-		
-	def __hash__(self):
-		return hash(self.X) ^ hash(self.Y) ^ hash(self.Z) ^ hash(self.W)
-		
-	def __str__(self):
-		return "[%f,%f,%f,%f](FQuat)" % (self.X, self.Y, self.Z, self.W)
+    def __init__(self): 
+        self.X = 0.0
+        self.Y = 0.0
+        self.Z = 0.0
+        self.W = 1.0
+        
+    def dump(self):
+        return pack('ffff', self.X, self.Y, self.Z, self.W)
+        
+    def __cmp__(self, other):
+        return cmp(self.X, other.X) \
+            or cmp(self.Y, other.Y) \
+            or cmp(self.Z, other.Z) \
+            or cmp(self.W, other.W)
+        
+    def __hash__(self):
+        return hash(self.X) ^ hash(self.Y) ^ hash(self.Z) ^ hash(self.W)
+        
+    def __str__(self):
+        return "[%f,%f,%f,%f](FQuat)" % (self.X, self.Y, self.Z, self.W)
 
 class FVector(object):
 
-	def __init__(self, X=0.0, Y=0.0, Z=0.0):
-		self.X = X
-		self.Y = Y
-		self.Z = Z
-		
-	def dump(self):
-		return pack('fff', self.X, self.Y, self.Z)
-		
-	def __cmp__(self, other):
-		return cmp(self.X, other.X) \
-			or cmp(self.Y, other.Y) \
-			or cmp(self.Z, other.Z)
-		
-	def _key(self):
-		return (type(self).__name__, self.X, self.Y, self.Z)
-		
-	def __hash__(self):
-		return hash(self._key())
-		
-	def __eq__(self, other):
-		if not hasattr(other, '_key'):
-			return False
-		return self._key() == other._key() 
-		
-	def dot(self, other):
-		return self.X * other.X + self.Y * other.Y + self.Z * other.Z
-	
-	def cross(self, other):
-		return FVector(self.Y * other.Z - self.Z * other.Y,
-				self.Z * other.X - self.X * other.Z,
-				self.X * other.Y - self.Y * other.X)
-				
-	def sub(self, other):
-		return FVector(self.X - other.X,
-			self.Y - other.Y,
-			self.Z - other.Z)
+    def __init__(self, X=0.0, Y=0.0, Z=0.0):
+        self.X = X
+        self.Y = Y
+        self.Z = Z
+        
+    def dump(self):
+        return pack('fff', self.X, self.Y, self.Z)
+        
+    def __cmp__(self, other):
+        return cmp(self.X, other.X) \
+            or cmp(self.Y, other.Y) \
+            or cmp(self.Z, other.Z)
+        
+    def _key(self):
+        return (type(self).__name__, self.X, self.Y, self.Z)
+        
+    def __hash__(self):
+        return hash(self._key())
+        
+    def __eq__(self, other):
+        if not hasattr(other, '_key'):
+            return False
+        return self._key() == other._key() 
+        
+    def dot(self, other):
+        return self.X * other.X + self.Y * other.Y + self.Z * other.Z
+    
+    def cross(self, other):
+        return FVector(self.Y * other.Z - self.Z * other.Y,
+                self.Z * other.X - self.X * other.Z,
+                self.X * other.Y - self.Y * other.X)
+                
+    def sub(self, other):
+        return FVector(self.X - other.X,
+            self.Y - other.Y,
+            self.Z - other.Z)
 
 class VJointPos:
 
-	def __init__(self):
-		self.Orientation	= FQuat()
-		self.Position		= FVector()
-		self.Length			= 0.0
-		self.XSize			= 0.0
-		self.YSize			= 0.0
-		self.ZSize			= 0.0
-		
-	def dump(self):
-		return self.Orientation.dump() + self.Position.dump() + pack('4f', self.Length, self.XSize, self.YSize, self.ZSize)

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list