forked from bartvdbraak/blender
* More updates to game engine type docs from Roelf de Kock
* FBX Bugfix, was exporting all animation curves as 'Constant' type (no docs for this so could only guess), Thanks to Sander Brandenburg for spotting this problem. Also improved keyframe removal to work on animation curves an angle
This commit is contained in:
parent
c7519789b8
commit
240aa6d34d
@ -2611,10 +2611,9 @@ Takes: {''')
|
||||
if frame!=act_start:
|
||||
file.write(',')
|
||||
|
||||
# Curve types are
|
||||
# Curve types are 'C,n' for constant, 'L' for linear
|
||||
# C,n is for bezier? - linear is best for now so we can do simple keyframe removal
|
||||
file.write('\n\t\t\t\t\t\t\t%i,%.15f,C,n' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] ))
|
||||
#file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] ))
|
||||
file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame-1), context_bone_anim_vecs[frame-act_start][i] ))
|
||||
frame+=1
|
||||
else:
|
||||
# remove unneeded keys, j is the frame, needed when some frames are removed.
|
||||
@ -2622,12 +2621,33 @@ Takes: {''')
|
||||
|
||||
# last frame to fisrt frame, missing 1 frame on either side.
|
||||
# removeing in a backwards loop is faster
|
||||
for j in xrange( (act_end-act_start)-1, 0, -1 ):
|
||||
# Is this key reduenant?
|
||||
if abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j-1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT and\
|
||||
abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j+1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT:
|
||||
#for j in xrange( (act_end-act_start)-1, 0, -1 ):
|
||||
# j = (act_end-act_start)-1
|
||||
j = len(context_bone_anim_keys)-2
|
||||
while j > 0 and len(context_bone_anim_keys) > 2:
|
||||
# print j, len(context_bone_anim_keys)
|
||||
# Is this key the same as the ones next to it?
|
||||
|
||||
# co-linear horizontal...
|
||||
if abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j-1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT and\
|
||||
abs(context_bone_anim_keys[j][0] - context_bone_anim_keys[j+1][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT:
|
||||
|
||||
del context_bone_anim_keys[j]
|
||||
|
||||
else:
|
||||
frame_range = float(context_bone_anim_keys[j+1][1] - context_bone_anim_keys[j-1][1])
|
||||
frame_range_fac1 = (context_bone_anim_keys[j+1][1] - context_bone_anim_keys[j][1]) / frame_range
|
||||
frame_range_fac2 = 1.0 - frame_range_fac1
|
||||
|
||||
if abs(((context_bone_anim_keys[j-1][0]*frame_range_fac1 + context_bone_anim_keys[j+1][0]*frame_range_fac2)) - context_bone_anim_keys[j][0]) < ANIM_OPTIMIZE_PRECISSION_FLOAT:
|
||||
del context_bone_anim_keys[j]
|
||||
else:
|
||||
j-=1
|
||||
|
||||
# keep the index below the list length
|
||||
if j > len(context_bone_anim_keys)-2:
|
||||
j = len(context_bone_anim_keys)-2
|
||||
|
||||
if len(context_bone_anim_keys) == 2 and context_bone_anim_keys[0][0] == context_bone_anim_keys[1][0]:
|
||||
# This axis has no moton, its okay to skip KeyCount and Keys in this case
|
||||
pass
|
||||
@ -2639,8 +2659,7 @@ Takes: {''')
|
||||
if frame != context_bone_anim_keys[0][1]: # not the first
|
||||
file.write(',')
|
||||
# frame is alredy one less then blenders frame
|
||||
file.write('\n\t\t\t\t\t\t\t%i,%.15f,C,n' % (fbx_time(frame), val ))
|
||||
#file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame), val ))
|
||||
file.write('\n\t\t\t\t\t\t\t%i,%.15f,L' % (fbx_time(frame), val ))
|
||||
|
||||
if i==0: file.write('\n\t\t\t\t\t\tColor: 1,0,0')
|
||||
elif i==1: file.write('\n\t\t\t\t\t\tColor: 0,1,0')
|
||||
@ -2919,7 +2938,7 @@ def fbx_ui():
|
||||
Draw.BeginAlign()
|
||||
GLOBALS['ANIM_OPTIMIZE'] = Draw.Toggle('Optimize Keyframes', EVENT_REDRAW, x+20, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE'].val, 'Remove double keyframes', do_redraw)
|
||||
if GLOBALS['ANIM_OPTIMIZE'].val:
|
||||
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Number('Precission: ', EVENT_NONE, x+180, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val, 3, 16, 'Tolerence for comparing double keyframes (higher for greater accuracy)')
|
||||
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Number('Precission: ', EVENT_NONE, x+180, y+0, 160, 20, GLOBALS['ANIM_OPTIMIZE_PRECISSION'].val, 1, 16, 'Tolerence for comparing double keyframes (higher for greater accuracy)')
|
||||
Draw.EndAlign()
|
||||
|
||||
Draw.BeginAlign()
|
||||
@ -2997,7 +3016,7 @@ def write_ui():
|
||||
# animation opts
|
||||
GLOBALS['ANIM_ENABLE'] = Draw.Create(1)
|
||||
GLOBALS['ANIM_OPTIMIZE'] = Draw.Create(1)
|
||||
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Create(6) # decimal places
|
||||
GLOBALS['ANIM_OPTIMIZE_PRECISSION'] = Draw.Create(4) # decimal places
|
||||
GLOBALS['ANIM_ACTION_ALL'] = [Draw.Create(0), Draw.Create(1)] # not just the current action
|
||||
|
||||
# batch export options
|
||||
|
@ -512,8 +512,7 @@ class BL_Shader(PyObjectPlus):
|
||||
|
||||
def delSource():
|
||||
"""
|
||||
TODO - Description
|
||||
|
||||
Clear the shader. Use this method before the source is changed with L{setSource}.
|
||||
"""
|
||||
def getFragmentProg():
|
||||
"""
|
||||
@ -997,39 +996,56 @@ class KX_BlenderMaterial(PyObjectPlus): # , RAS_IPolyMaterial)
|
||||
"""
|
||||
KX_BlenderMaterial
|
||||
|
||||
All placeholders have a __ prefix
|
||||
"""
|
||||
|
||||
def __getShader(val):
|
||||
def getShader():
|
||||
"""
|
||||
TODO - Description
|
||||
Returns the material's shader.
|
||||
|
||||
@param val: the starting frame of the animation
|
||||
@type val: float
|
||||
@rtype: L{BL_Shader}
|
||||
@return: the material's shader
|
||||
"""
|
||||
|
||||
def setBlending(src, dest):
|
||||
"""
|
||||
Set the pixel color arithmetic functions.
|
||||
|
||||
@param src: Specifies how the red, green, blue,
|
||||
and alpha source blending factors are computed.
|
||||
@type src: GL_ZERO,
|
||||
GL_ONE,
|
||||
GL_SRC_COLOR,
|
||||
GL_ONE_MINUS_SRC_COLOR,
|
||||
GL_DST_COLOR,
|
||||
GL_ONE_MINUS_DST_COLOR,
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA,
|
||||
GL_DST_ALPHA,
|
||||
GL_ONE_MINUS_DST_ALPHA,
|
||||
GL_SRC_ALPHA_SATURATE
|
||||
|
||||
|
||||
@param dest: Specifies how the red, green, blue,
|
||||
and alpha destination blending factors are computed.
|
||||
@type dest: GL_ZERO,
|
||||
GL_ONE,
|
||||
GL_SRC_COLOR,
|
||||
GL_ONE_MINUS_SRC_COLOR,
|
||||
GL_DST_COLOR,
|
||||
GL_ONE_MINUS_DST_COLOR,
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA,
|
||||
GL_DST_ALPHA,
|
||||
GL_ONE_MINUS_DST_ALPHA,
|
||||
GL_SRC_ALPHA_SATURATE
|
||||
|
||||
"""
|
||||
def getMaterialIndex():
|
||||
"""
|
||||
Returns the material's index.
|
||||
|
||||
@rtype: integer
|
||||
@return: TODO Description
|
||||
"""
|
||||
|
||||
def __setBlending(val):
|
||||
"""
|
||||
TODO - Description
|
||||
|
||||
@param val: the starting frame of the animation
|
||||
@type val: float
|
||||
|
||||
@rtype: integer
|
||||
@return: TODO Description
|
||||
"""
|
||||
def __getMaterialIndex(val):
|
||||
"""
|
||||
TODO - Description
|
||||
|
||||
@param val: the starting frame of the animation
|
||||
@type val: float
|
||||
|
||||
@rtype: integer
|
||||
@return: TODO Description
|
||||
@return: the material's index
|
||||
"""
|
||||
|
||||
class KX_CDActuator(SCA_IActuator):
|
||||
@ -1419,28 +1435,13 @@ class KX_ConstraintWrapper(PyObjectPlus):
|
||||
"""
|
||||
KX_ConstraintWrapper
|
||||
|
||||
All placeholders have a __ prefix
|
||||
"""
|
||||
def __getConstraintId(val):
|
||||
def getConstraintId(val):
|
||||
"""
|
||||
TODO - Description
|
||||
|
||||
@param val: the starting frame of the animation
|
||||
@type val: float
|
||||
Returns the contraint's ID
|
||||
|
||||
@rtype: integer
|
||||
@return: TODO Description
|
||||
"""
|
||||
|
||||
def __testMethod(val):
|
||||
"""
|
||||
TODO - Description
|
||||
|
||||
@param val: the starting frame of the animation
|
||||
@type val: float
|
||||
|
||||
@rtype: integer
|
||||
@return: TODO Description
|
||||
@return: the constraint's ID
|
||||
"""
|
||||
|
||||
class KX_GameActuator(SCA_IActuator):
|
||||
|
Loading…
Reference in New Issue
Block a user