mirror of
https://github.com/godotengine/collada-exporter.git
synced 2026-01-06 02:09:47 +03:00
Small Issues & Maintenance
-=-=-=-=-=-=-=-=-=-=-=-=-= -Begin work on Navigation Meshes (simple pathfinding for now, will improve soon) -More doc on theme overriding -Upgraded OpenSSL to version without bugs -Misc bugfixes
This commit is contained in:
@@ -1030,7 +1030,7 @@ class DaeExporter:
|
||||
return [anim_id]
|
||||
|
||||
|
||||
def export_animation(self,start,end):
|
||||
def export_animation(self,start,end,allowed=None):
|
||||
|
||||
#Blender -> Collada frames needs a little work
|
||||
#Collada starts from 0, blender usually from 1
|
||||
@@ -1047,7 +1047,7 @@ class DaeExporter:
|
||||
# Change frames first, export objects last
|
||||
# This improves performance enormously
|
||||
|
||||
print("anim from: "+str(start)+" to "+str(end))
|
||||
print("anim from: "+str(start)+" to "+str(end)+" allowed: "+str(allowed))
|
||||
for t in range(start,end+1):
|
||||
self.scene.frame_set(t)
|
||||
key = t * frame_len - frame_sub
|
||||
@@ -1057,6 +1057,8 @@ class DaeExporter:
|
||||
|
||||
if (not node in self.valid_nodes):
|
||||
continue
|
||||
if (allowed!=None and not (node in allowed)):
|
||||
continue
|
||||
|
||||
if (node.type=="MESH" and node.parent and node.parent.type=="ARMATURE"):
|
||||
continue #In Collada, nodes that have skin modifier must not export animation, animate the skin instead.
|
||||
@@ -1080,6 +1082,7 @@ class DaeExporter:
|
||||
bone_name=self.skeleton_info[node]["bone_ids"][bone]
|
||||
|
||||
if (not (bone_name in xform_cache)):
|
||||
print("has bone: "+bone_name)
|
||||
xform_cache[bone_name]=[]
|
||||
|
||||
posebone = node.pose.bones[bone.name]
|
||||
@@ -1113,12 +1116,33 @@ class DaeExporter:
|
||||
for x in bpy.data.actions[:]:
|
||||
if x in self.action_constraints:
|
||||
continue
|
||||
|
||||
bones=[]
|
||||
#find bones used
|
||||
for p in x.fcurves:
|
||||
dp = str(p.data_path)
|
||||
base = "pose.bones[\""
|
||||
if (dp.find(base)==0):
|
||||
dp=dp[len(base):]
|
||||
if (dp.find('"')!=-1):
|
||||
dp=dp[:dp.find('"')]
|
||||
if (not dp in bones):
|
||||
bones.append(dp)
|
||||
|
||||
allowed_skeletons=[]
|
||||
for y in self.skeletons:
|
||||
if (y.animation_data):
|
||||
for z in y.pose.bones:
|
||||
if (z.bone.name in bones):
|
||||
if (not y in allowed_skeletons):
|
||||
allowed_skeletons.append(y)
|
||||
y.animation_data.action=x;
|
||||
|
||||
|
||||
tcn = self.export_animation(int(x.frame_range[0]),int(x.frame_range[1]))
|
||||
|
||||
print(str(x))
|
||||
|
||||
tcn = self.export_animation(int(x.frame_range[0]),int(x.frame_range[1]),allowed_skeletons)
|
||||
framelen=(1.0/self.scene.render.fps)
|
||||
start = x.frame_range[0]*framelen
|
||||
end = x.frame_range[1]*framelen
|
||||
|
||||
Reference in New Issue
Block a user