Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-05-14 02:52:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-14 02:52:31 +0400
commit240aa6d34d561ac6156eda50ece90130903a2df0 (patch)
tree75df1c82fb729dd742dc1afedaf632ffe2cdf55c
parentc7519789b8a7ba8973b2a165b2d008679c3f8241 (diff)
* 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
-rw-r--r--release/scripts/export_fbx.py41
-rw-r--r--source/gameengine/PyDoc/GameTypes.py81
2 files changed, 71 insertions, 51 deletions
diff --git a/release/scripts/export_fbx.py b/release/scripts/export_fbx.py
index 707ab9ebbb7..d2028c22468 100644
--- a/release/scripts/export_fbx.py
+++ b/release/scripts/export_fbx.py
@@ -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,11 +2621,32 @@ 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
@@ -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
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py
index 828435b813a..6758824611c 100644
--- a/source/gameengine/PyDoc/GameTypes.py
+++ b/source/gameengine/PyDoc/GameTypes.py
@@ -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
-
- @param val: the starting frame of the animation
- @type val: float
+ Returns the material's shader.
- @rtype: integer
- @return: TODO Description
+ @rtype: L{BL_Shader}
+ @return: the material's shader
"""
- def __setBlending(val):
+ def setBlending(src, dest):
"""
- TODO - Description
+ Set the pixel color arithmetic functions.
- @param val: the starting frame of the animation
- @type val: float
+ @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
+
- @rtype: integer
- @return: TODO Description
+ @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(val):
+ def getMaterialIndex():
"""
- TODO - Description
-
- @param val: the starting frame of the animation
- @type val: float
+ Returns the material's index.
@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):
- """
- TODO - Description
-
- @param val: the starting frame of the animation
- @type val: float
-
- @rtype: integer
- @return: TODO Description
- """
-
- def __testMethod(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
+ @return: the constraint's ID
"""
class KX_GameActuator(SCA_IActuator):