Newer
Older
for data in data_seq: # scene or group
newname = prefix + bpy.path.clean_name(data.name)
if use_batch_own_dir:
new_fbxpath = fbxpath + newname + os.sep
# path may already exist
# TODO - might exist but be a file. unlikely but should probably account for it.
if not os.path.exists(new_fbxpath):
os.makedirs(new_fbxpath)
filepath = new_fbxpath + newname + '.fbx'
print('\nBatch exporting %s as...\n\t%r' % (data, filepath))
# XXX don't know what to do with this, probably do the same? (Arystan)
if batch_mode == 'GROUP': # group
# group, so objects update properly, add a dummy scene.
scene = bpy.data.scenes.new(name="FBX_Temp")
scene.layers = [True] * 20
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
for ob_base in data.objects:
scene.objects.link(ob_base)
scene.update()
else:
scene = data
# TODO - BUMMER! Armatures not in the group wont animate the mesh
# else: # scene
# data_seq.active = data
# Call self with modified args
# Dont pass batch options since we already usedt them
kwargs_batch = kwargs.copy()
kwargs_batch["context_objects"] = data.objects
save_single(operator, scene, filepath, **kwargs_batch)
if batch_mode == 'GROUP':
# remove temp group scene
bpy.data.scenes.remove(scene)
# no active scene changing!
# bpy.data.scenes.active = orig_sce
return {'FINISHED'} # so the script wont run after we have batch exported.
# APPLICATION REQUIREMENTS
# Please update the lists for UDK, Unity, XNA etc. on the following web page:
# http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Import-Export/UnifiedFBX
# XNA FBX Requirements (JCB 29 July 2011)
# - Armature must be parented to the scene
# - Armature must be a 'Limb' never a 'null'. This is in several places.
# - First bone must be parented to the armature.
# - Rotation must be completely disabled including
# always returning the original matrix in In object_tx().
# It is the animation that gets distorted during rotation!
# - Lone edges cause intermittent errors in the XNA content pipeline!
# I have added a warning message and excluded them.
# - Bind pose must be included with the 'MESH'
# Typical settings for XNA export
# No Cameras, No Lamps, No Edges, No face smoothing, No Default_Take, Armature as bone, Disable rotation
# Can any or all of the following notes be removed because some have been here for a long time? (JCB 27 July 2011)
# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
# - get rid of bpy.path.clean_name somehow
# + get rid of BPyObject_getObjectArmature, move it in RNA?
# - implement all BPyMesh_* used here with RNA
# - getDerivedObjects is not fully replicated with .dupli* funcs
# - don't know what those colbits are, do we need them? they're said to be deprecated in DNA_object_types.h: 1886-1893
# - no hq normals: 1900-1901