Commit: 1187b98d4849572932b159462d1da610c89cd77c
Author: Bastien Montagne
Date:   Fri Jan 9 14:59:39 2015 +0100
Branches: master
https://developer.blender.org/rB1187b98d4849572932b159462d1da610c89cd77c

Fix T43174: "Record animation" does not update fcurve handles

`INSERT_FAST` implies you call `calchandles_fcurve()` at the end...
For now, since we do not store edited FCurves nor can we get them easily
(requires RNA...), just update handles of all fcurves, it's much more
performant than removing usage of `INSERT_FAST` anyway.

===================================================================

M       source/blenderplayer/bad_level_call_stubs/stubs.c
M       source/gameengine/Converter/KX_BlenderSceneConverter.cpp

===================================================================

diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c 
b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 8a7c761..9eff340 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -623,6 +623,7 @@ int WM_operator_ui_popup(struct bContext *C, struct 
wmOperator *op, int width, i
 void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct 
ReportList *reports, struct PointerRNA *ptr) RET_NONE
 short insert_keyframe(struct ReportList *reports, struct ID *id, struct 
bAction *act, const char group[], const char rna_path[], int array_index, float 
cfra, short flag) RET_ZERO
 short delete_keyframe(struct ReportList *reports, struct ID *id, struct 
bAction *act, const char group[], const char rna_path[], int array_index, float 
cfra, short flag) RET_ZERO
+struct bAction *verify_adt_action(struct ID *id, short add) RET_NULL
 char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, const 
bool all_args, const bool macro_args, struct wmOperatorType *ot, struct 
PointerRNA *opptr) RET_NULL
 char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, const 
bool all_args, const bool macro_args) RET_NULL
 struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, 
int val, int modifier, int keymodifier, int value) RET_NULL
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index a20ebb3..eb4b9a8 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -69,6 +69,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_world_types.h"
 #include "BKE_main.h"
+#include "BKE_fcurve.h"
 
 #include "BLI_math.h"
 
@@ -87,6 +88,7 @@ extern "C"
 #include "BKE_mesh.h" // BKE_mesh_copy
 #include "DNA_space_types.h"
 #include "DNA_anim_types.h"
+#include "DNA_action_types.h"
 #include "RNA_define.h"
 #include "../../blender/editors/include/ED_keyframing.h"
 }
@@ -843,13 +845,26 @@ void      
KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
                {
                        KX_GameObject* gameObj = 
(KX_GameObject*)parentList->GetValue(g);
                        if (gameObj->IsRecordAnimation()) {
-#if 0
                                Object* blenderObject = 
gameObj->GetBlenderObject();
-                               if (blenderObject && blenderObject->ipo)
+                               if (blenderObject && blenderObject->adt)
                                {
+                                       bAction *act = 
verify_adt_action(&blenderObject->id, false);
+                                       FCurve *fcu;
+
+                                       if (!act) {
+                                               continue;
+                                       }
+
+                                       /* for now, not much choice but to run 
this on all curves... */
+                                       for (fcu = (FCurve *)act->curves.first; 
fcu; fcu = fcu->next) {
+                                               /* Note: calling 
`sort_time_fcurve()` here is not needed, since
+                                                *       all keys have been 
added in 'right' order. */
+                                               calchandles_fcurve(fcu);
+                                       }
+#if 0
                                        // XXX animato
                                        Ipo* ipo = blenderObject->ipo;
-                                       
+
                                        //create the curves, if not existing
                                        //testhandles_ipocurve checks for NULL
                                        
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"));
@@ -858,8 +873,8 @@ void        
KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
                                        
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"));
                                        
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"));
                                        
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"));
-                               }
 #endif
+                               }
                        }
                }
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to