[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2146] trunk/py/scripts/addons/ io_scene_fbx/export_fbx.py: no functional changes, write out tabs rather then spaces for FBX indentation.
Campbell Barton
ideasman42 at gmail.com
Wed Jul 20 11:15:43 CEST 2011
Revision: 2146
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2146
Author: campbellbarton
Date: 2011-07-20 09:15:43 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
no functional changes, write out tabs rather then spaces for FBX indentation.
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
Modified: trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
===================================================================
--- trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-07-20 08:10:59 UTC (rev 2145)
+++ trunk/py/scripts/addons/io_scene_fbx/export_fbx.py 2011-07-20 09:15:43 UTC (rev 2146)
@@ -40,9 +40,6 @@
def tuple_rad_to_deg(eul):
return eul[0] * 57.295779513, eul[1] * 57.295779513, eul[2] * 57.295779513
-# def strip_path(p):
-# return p.split('\\')[-1].split('/')[-1]
-
# Used to add the scene name into the filepath without using odd chars
sane_name_mapping_ob = {}
sane_name_mapping_ob_unique = set()
@@ -245,7 +242,6 @@
self.blenMeshes = {} # fbxMeshObName : mesh
self.fbxArm = fbxArm
self.restMatrix = blenBone.matrix_local
-# self.restMatrix = blenBone.matrix['ARMATURESPACE']
# not used yet
# self.restMatrixInv = self.restMatrix.inverted()
@@ -406,22 +402,22 @@
#
file.write(\
'''FBXHeaderExtension: {
- FBXHeaderVersion: 1003
- FBXVersion: 6100
- CreationTimeStamp: {
- Version: 1000
- Year: %.4i
- Month: %.2i
- Day: %.2i
- Hour: %.2i
- Minute: %.2i
- Second: %.2i
- Millisecond: 0
- }
- Creator: "FBX SDK/FBX Plugins build 20070228"
- OtherFlags: {
- FlagPLE: 0
- }
+ FBXHeaderVersion: 1003
+ FBXVersion: 6100
+ CreationTimeStamp: {
+ Version: 1000
+ Year: %.4i
+ Month: %.2i
+ Day: %.2i
+ Hour: %.2i
+ Minute: %.2i
+ Second: %.2i
+ Millisecond: 0
+ }
+ Creator: "FBX SDK/FBX Plugins build 20070228"
+ OtherFlags: {
+ FlagPLE: 0
+ }
}''' % (curtime))
file.write('\nCreationTime: "%.4i-%.2i-%.2i %.2i:%.2i:%.2i:000"' % curtime)
@@ -435,18 +431,15 @@
Matrix mod is so armature objects can modify their bone matricies
'''
if isinstance(ob, bpy.types.Bone):
-# if isinstance(ob, Blender.Types.BoneType):
# we know we have a matrix
# matrix = mtx4_z90 * (ob.matrix['ARMATURESPACE'] * matrix_mod)
matrix = ob.matrix_local * mtx4_z90 # dont apply armature matrix anymore
-# matrix = mtx4_z90 * ob.matrix['ARMATURESPACE'] # dont apply armature matrix anymore
parent = ob.parent
if parent:
#par_matrix = mtx4_z90 * (parent.matrix['ARMATURESPACE'] * matrix_mod)
par_matrix = parent.matrix_local * mtx4_z90 # dont apply armature matrix anymore
-# par_matrix = mtx4_z90 * parent.matrix['ARMATURESPACE'] # dont apply armature matrix anymore
matrix = par_matrix.inverted() * matrix
loc, rot, scale = matrix.decompose()
@@ -463,7 +456,7 @@
matrix_rot = matrix
#if matrix:
- # matrix = matrix_scale * matrix
+ # matrix = matrix_scale * matrix
if matrix:
loc, rot, scale = matrix.decompose()
@@ -498,7 +491,6 @@
file.write('\n\t\t\tProperty: "Lcl Translation", "Lcl Translation", "A+",%.15f,%.15f,%.15f' % loc)
file.write('\n\t\t\tProperty: "Lcl Rotation", "Lcl Rotation", "A+",%.15f,%.15f,%.15f' % tuple_rad_to_deg(rot))
-# file.write('\n\t\t\tProperty: "Lcl Rotation", "Lcl Rotation", "A+",%.15f,%.15f,%.15f' % rot)
file.write('\n\t\t\tProperty: "Lcl Scaling", "Lcl Scaling", "A+",%.15f,%.15f,%.15f' % scale)
return loc, rot, scale, matrix, matrix_rot
@@ -546,9 +538,9 @@
# if the type is 0 its an empty otherwise its a mesh
# only difference at the moment is one has a color
file.write('''
- Properties60: {
- Property: "QuaternionInterpolate", "bool", "",0
- Property: "Visibility", "Visibility", "A+",1''')
+ Properties60: {
+ Property: "QuaternionInterpolate", "bool", "",0
+ Property: "Visibility", "Visibility", "A+",1''')
loc, rot, scale, matrix, matrix_rot = write_object_tx(ob, loc, matrix, matrix_mod)
@@ -654,7 +646,6 @@
file.write('\n\t\t\tProperty: "LimbLength", "double", "",%.6f' %
(my_bone.blenBone.head_local - my_bone.blenBone.tail_local).length)
-# (my_bone.blenBone.head['ARMATURESPACE'] - my_bone.blenBone.tail['ARMATURESPACE']).length)
#file.write('\n\t\t\tProperty: "LimbLength", "double", "",1')
file.write('\n\t\t\tProperty: "Color", "ColorRGB", "",0.8,0.8,0.8')
@@ -669,25 +660,25 @@
def write_camera_switch():
file.write('''
- Model: "Model::Camera Switcher", "CameraSwitcher" {
- Version: 232''')
+ Model: "Model::Camera Switcher", "CameraSwitcher" {
+ Version: 232''')
write_object_props()
file.write('''
- Property: "Color", "Color", "A",0.8,0.8,0.8
- Property: "Camera Index", "Integer", "A+",100
- }
- MultiLayer: 0
- MultiTake: 1
- Hidden: "True"
- Shading: W
- Culling: "CullingOff"
- Version: 101
- Name: "Model::Camera Switcher"
- CameraId: 0
- CameraName: 100
- CameraIndexName:
- }''')
+ Property: "Color", "Color", "A",0.8,0.8,0.8
+ Property: "Camera Index", "Integer", "A+",100
+ }
+ MultiLayer: 0
+ MultiTake: 1
+ Hidden: "True"
+ Shading: W
+ Culling: "CullingOff"
+ Version: 101
+ Name: "Model::Camera Switcher"
+ CameraId: 0
+ CameraName: 100
+ CameraIndexName:
+ }''')
def write_camera_dummy(name, loc, near, far, proj_type, up):
file.write('\n\tModel: "Model::%s", "Camera" {' % name)
@@ -989,13 +980,13 @@
pose_items.append((fbxName, poseMatrix))
file.write('''
- }
- MultiLayer: 0
- MultiTake: 1
- Shading: Y
- Culling: "CullingOff"
- TypeFlags: "Null"
- }''')
+ }
+ MultiLayer: 0
+ MultiTake: 1
+ Shading: Y
+ Culling: "CullingOff"
+ TypeFlags: "Null"
+ }''')
# Material Settings
if world:
@@ -1082,12 +1073,12 @@
file.write('\n\tVideo: "Video::%s", "Clip" {' % texname)
file.write('''
- Type: "Clip"
- Properties60: {
- Property: "FrameRate", "double", "",0
- Property: "LastFrame", "int", "",0
- Property: "Width", "int", "",0
- Property: "Height", "int", "",0''')
+ Type: "Clip"
+ Properties60: {
+ Property: "FrameRate", "double", "",0
+ Property: "LastFrame", "int", "",0
+ Property: "Width", "int", "",0
+ Property: "Height", "int", "",0''')
if tex:
fname_rel = bpy_extras.io_utils.path_reference(tex.filepath, base_src, base_dst, path_mode, "", copy_set)
fname_strip = bpy.path.basename(fname_rel)
@@ -1097,16 +1088,16 @@
file.write('\n\t\t\tProperty: "Path", "charptr", "", "%s"' % fname_strip)
file.write('''
- Property: "StartFrame", "int", "",0
- Property: "StopFrame", "int", "",0
- Property: "PlaySpeed", "double", "",1
- Property: "Offset", "KTime", "",0
- Property: "InterlaceMode", "enum", "",0
- Property: "FreeRunning", "bool", "",0
- Property: "Loop", "bool", "",0
- Property: "AccessMode", "enum", "",0
- }
- UseMipMap: 0''')
+ Property: "StartFrame", "int", "",0
+ Property: "StopFrame", "int", "",0
+ Property: "PlaySpeed", "double", "",1
+ Property: "Offset", "KTime", "",0
+ Property: "InterlaceMode", "enum", "",0
+ Property: "FreeRunning", "bool", "",0
+ Property: "Loop", "bool", "",0
+ Property: "AccessMode", "enum", "",0
+ }
+ UseMipMap: 0''')
file.write('\n\t\tFilename: "%s"' % fname_strip)
file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # make relative
@@ -1121,29 +1112,29 @@
file.write('\n\t\tTextureName: "Texture::%s"' % texname)
file.write('''
- Properties60: {
- Property: "Translation", "Vector", "A+",0,0,0
- Property: "Rotation", "Vector", "A+",0,0,0
- Property: "Scaling", "Vector", "A+",1,1,1''')
+ Properties60: {
+ Property: "Translation", "Vector", "A+",0,0,0
+ Property: "Rotation", "Vector", "A+",0,0,0
+ Property: "Scaling", "Vector", "A+",1,1,1''')
file.write('\n\t\t\tProperty: "Texture alpha", "Number", "A+",%i' % num)
# WrapModeU/V 0==rep, 1==clamp, TODO add support
file.write('''
- Property: "TextureTypeUse", "enum", "",0
- Property: "CurrentTextureBlendMode", "enum", "",1
- Property: "UseMaterial", "bool", "",0
- Property: "UseMipMap", "bool", "",0
- Property: "CurrentMappingType", "enum", "",0
- Property: "UVSwap", "bool", "",0''')
+ Property: "TextureTypeUse", "enum", "",0
+ Property: "CurrentTextureBlendMode", "enum", "",1
+ Property: "UseMaterial", "bool", "",0
+ Property: "UseMipMap", "bool", "",0
+ Property: "CurrentMappingType", "enum", "",0
+ Property: "UVSwap", "bool", "",0''')
file.write('\n\t\t\tProperty: "WrapModeU", "enum", "",%i' % tex.use_clamp_x)
file.write('\n\t\t\tProperty: "WrapModeV", "enum", "",%i' % tex.use_clamp_y)
file.write('''
- Property: "TextureRotationPivot", "Vector3D", "",0,0,0
- Property: "TextureScalingPivot", "Vector3D", "",0,0,0
- Property: "VideoProperty", "object", ""
- }''')
+ Property: "TextureRotationPivot", "Vector3D", "",0,0,0
+ Property: "TextureScalingPivot", "Vector3D", "",0,0,0
+ Property: "VideoProperty", "object", ""
+ }''')
file.write('\n\t\tMedia: "Video::%s"' % texname)
@@ -1157,11 +1148,11 @@
file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # need some make relative command
file.write('''
- ModelUVTranslation: 0,0
- ModelUVScaling: 1,1
- Texture_Alpha_Source: "None"
- Cropping: 0,0,0,0
- }''')
+ ModelUVTranslation: 0,0
+ ModelUVScaling: 1,1
+ Texture_Alpha_Source: "None"
+ Cropping: 0,0,0,0
+ }''')
def write_deformer_skin(obname):
'''
@@ -1169,13 +1160,13 @@
'''
file.write('\n\tDeformer: "Deformer::Skin %s", "Skin" {' % obname)
file.write('''
- Version: 100
- MultiLayer: 0
- Type: "Skin"
- Properties60: {
- }
- Link_DeformAcuracy: 50
- }''')
+ Version: 100
+ MultiLayer: 0
+ Type: "Skin"
+ Properties60: {
+ }
+ Link_DeformAcuracy: 50
+ }''')
# in the example was 'Bip01 L Thigh_2'
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list