Skip to content

Commit 682f80e

Browse files
committed
UPBGE: Remove physics record animation features.
This feature can be replaced by a simulation baking in the viewport.
1 parent 043f2fe commit 682f80e

File tree

18 files changed

+1
-378
lines changed

18 files changed

+1
-378
lines changed

release/scripts/startup/bl_ui/properties_game.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ def draw(self, context):
162162
col = layout.column()
163163
col.prop(game, "use_actor")
164164
col.prop(game, "use_ghost")
165-
col.prop(game, "use_record_animation")
166165
col.prop(ob, "hide_render", text="Invisible")
167166

168167
layout.separator()

release/scripts/startup/bl_ui/space_info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ def draw(self, context):
229229
layout.prop(gs, "show_bounding_box")
230230
layout.prop(gs, "show_armatures")
231231
layout.prop(gs, "use_deprecation_warnings")
232-
layout.prop(gs, "use_animation_record")
233232
layout.separator()
234233
layout.prop(gs, "use_auto_start")
235234

source/blender/editors/space_view3d/view3d_view.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,9 +1562,6 @@ static void game_set_commmandline_options(GameData *gm)
15621562
test = (gm->flag & GAME_ENABLE_ALL_FRAMES);
15631563
SYS_WriteCommandLineInt(syshandle, "fixedtime", test);
15641564

1565-
test = (gm->flag & GAME_ENABLE_ANIMATION_RECORD);
1566-
SYS_WriteCommandLineInt(syshandle, "animation_record", test);
1567-
15681565
test = (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS);
15691566
SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test);
15701567

source/blender/makesdna/DNA_object_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,6 @@ enum {
563563
OB_NAVMESH = 1 << 20,
564564
OB_HASOBSTACLE = 1 << 21,
565565
OB_CHARACTER = 1 << 22,
566-
567-
OB_RECORD_ANIMATION = 1 << 23,
568566
};
569567

570568
/* ob->gameflag2 */

source/blender/makesdna/DNA_scene_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,6 @@ typedef struct GameData {
891891
#define GAME_GLSL_NO_NODES (1 << 10)
892892
#define GAME_GLSL_NO_EXTRA_TEX (1 << 11)
893893
#define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12)
894-
#define GAME_ENABLE_ANIMATION_RECORD (1 << 13)
895894
#define GAME_SHOW_MOUSE (1 << 14)
896895
#define GAME_GLSL_NO_COLOR_MANAGEMENT (1 << 15)
897896
#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 16)

source/blender/makesrna/intern/rna_object.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,10 +1690,6 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
16901690
RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation");
16911691
RNA_def_property_update(prop, NC_LOGIC, NULL);
16921692

1693-
prop = RNA_def_property(srna, "use_record_animation", PROP_BOOLEAN, PROP_NONE);
1694-
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_RECORD_ANIMATION);
1695-
RNA_def_property_ui_text(prop, "Record Animation", "Record animation objects without physics");
1696-
16971693
prop = RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
16981694
RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
16991695
RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor");

source/blender/makesrna/intern/rna_scene.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,10 +4187,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
41874187
RNA_def_property_ui_text(prop, "Deprecation Warnings",
41884188
"Print warnings when using deprecated features in the python API");
41894189

4190-
prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
4191-
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
4192-
RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
4193-
41944190
prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
41954191
RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
41964192
RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");

source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
263263
bool usefixed = (SYS_GetCommandLineInt(syshandle, "fixedtime", 0) != 0);
264264
bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0);
265265
bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
266-
bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0);
267266
bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0) && GPU_display_list_support();
268267
bool showBoundingBox = (SYS_GetCommandLineInt(syshandle, "show_bounding_box", 0) != 0);
269268
bool showArmatures = (SYS_GetCommandLineInt(syshandle, "show_armatures", 0) != 0);
@@ -294,8 +293,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
294293
}
295294
}
296295

297-
if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */
298-
299296
// create the canvas and rasterizer
300297
RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar);
301298

@@ -448,9 +445,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
448445

449446
if (scene)
450447
{
451-
int startFrame = scene->r.cfra;
452-
ketsjiengine->SetAnimRecordMode(animation_record, startFrame);
453-
454448
// Quad buffered needs a special window.
455449
if (scene->gm.stereoflag == STEREO_ENABLED) {
456450
if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)

source/gameengine/Converter/BL_BlenderDataConversion.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,10 +1215,6 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
12151215
(isSensor) ? ((isActor) ? KX_ClientObjectInfo::OBACTORSENSOR : KX_ClientObjectInfo::OBSENSOR) :
12161216
(isActor) ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC;
12171217

1218-
// should we record animation for this object?
1219-
if ((blenderobject->gameflag & OB_RECORD_ANIMATION) != 0)
1220-
gameobj->SetRecordAnimation(true);
1221-
12221218
delete shapeprops;
12231219
delete smmaterial;
12241220
if (dm) {

source/gameengine/Converter/KX_BlenderSceneConverter.cpp

Lines changed: 0 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -484,225 +484,6 @@ void KX_BlenderSceneConverter::RegisterWorldInfo(KX_WorldInfo *worldinfo)
484484
m_worldinfos.push_back(pair<KX_Scene *, KX_WorldInfo *> (m_currentScene, worldinfo));
485485
}
486486

487-
void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
488-
{
489-
//TODO this entire function is deprecated, written for 2.4x
490-
//the functionality should be rewritten, currently it does nothing
491-
492-
CListValue *scenes = m_ketsjiEngine->CurrentScenes();
493-
for (CListValue::iterator sceit = scenes->GetBegin(); sceit != scenes->GetEnd(); ++sceit) {
494-
KX_Scene *scene = (KX_Scene *)*sceit;
495-
//PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment();
496-
CListValue* parentList = scene->GetRootParentList();
497-
int numObjects = parentList->GetCount();
498-
int g;
499-
for (g = 0; g < numObjects; g++) {
500-
KX_GameObject *gameObj = (KX_GameObject *)parentList->GetValue(g);
501-
if (gameObj->IsRecordAnimation()) {
502-
Object *blenderObject = gameObj->GetBlenderObject();
503-
if (blenderObject) {
504-
#if 0
505-
//erase existing ipo's
506-
Ipo* ipo = blenderObject->ipo;//findIpoForName(blenderObject->id.name+2);
507-
if (ipo) { //clear the curve data
508-
if (clearIpo) {//rcruiz
509-
IpoCurve *icu1;
510-
511-
int numCurves = 0;
512-
for ( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) {
513-
514-
IpoCurve* tmpicu = icu1;
515-
516-
/*int i;
517-
BezTriple *bezt;
518-
for ( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++) {
519-
printf("(%f,%f,%f),(%f,%f,%f),(%f,%f,%f)\n",bezt->vec[0][0],bezt->vec[0][1],bezt->vec[0][2],bezt->vec[1][0],bezt->vec[1][1],bezt->vec[1][2],bezt->vec[2][0],bezt->vec[2][1],bezt->vec[2][2]);
520-
}*/
521-
522-
icu1 = icu1->next;
523-
numCurves++;
524-
525-
BLI_remlink( &( blenderObject->ipo->curve ), tmpicu );
526-
if ( tmpicu->bezt )
527-
MEM_freeN( tmpicu->bezt );
528-
MEM_freeN( tmpicu );
529-
localDel_ipoCurve( tmpicu );
530-
}
531-
}
532-
}
533-
else {
534-
ipo = NULL; // XXX add_ipo(blenderObject->id.name+2, ID_OB);
535-
blenderObject->ipo = ipo;
536-
}
537-
#endif
538-
}
539-
}
540-
}
541-
}
542-
}
543-
544-
void KX_BlenderSceneConverter::resetNoneDynamicObjectToIpo()
545-
{
546-
//TODO the functionality should be rewritten
547-
}
548-
549-
// this generates ipo curves for position, rotation, allowing to use game physics in animation
550-
void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
551-
{
552-
CListValue *scenes = m_ketsjiEngine->CurrentScenes();
553-
for (CListValue::iterator sceit = scenes->GetBegin(); sceit != scenes->GetEnd(); ++sceit) {
554-
KX_Scene *scene = (KX_Scene *)*sceit;
555-
//PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment();
556-
CListValue *parentList = scene->GetObjectList();
557-
int numObjects = parentList->GetCount();
558-
int g;
559-
for (g = 0; g < numObjects; g++) {
560-
KX_GameObject *gameObj = (KX_GameObject *)parentList->GetValue(g);
561-
Object *blenderObject = gameObj->GetBlenderObject();
562-
if (blenderObject && blenderObject->parent == NULL && gameObj->IsRecordAnimation()) {
563-
if (blenderObject->adt == NULL)
564-
BKE_animdata_add_id(&blenderObject->id);
565-
566-
if (blenderObject->adt) {
567-
const MT_Vector3 &position = gameObj->NodeGetWorldPosition();
568-
//const MT_Vector3& scale = gameObj->NodeGetWorldScaling();
569-
const MT_Matrix3x3 &orn = gameObj->NodeGetWorldOrientation();
570-
571-
position.getValue(blenderObject->loc);
572-
573-
float tmat[3][3];
574-
for (int r = 0; r < 3; r++)
575-
for (int c = 0; c < 3; c++)
576-
tmat[r][c] = (float)orn[c][r];
577-
578-
mat3_to_compatible_eul(blenderObject->rot, blenderObject->rot, tmat);
579-
580-
insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "location", -1, (float)frameNumber, INSERTKEY_FAST);
581-
insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, (float)frameNumber, INSERTKEY_FAST);
582-
583-
#if 0
584-
const MT_Vector3& position = gameObj->NodeGetWorldPosition();
585-
//const MT_Vector3& scale = gameObj->NodeGetWorldScaling();
586-
const MT_Matrix3x3& orn = gameObj->NodeGetWorldOrientation();
587-
588-
float eulerAngles[3];
589-
float eulerAnglesOld[3] = {0.0f, 0.0f, 0.0f};
590-
float tmat[3][3];
591-
592-
// XXX animato
593-
Ipo* ipo = blenderObject->ipo;
594-
595-
//create the curves, if not existing, set linear if new
596-
597-
IpoCurve *icu_lx = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX");
598-
if (!icu_lx) {
599-
icu_lx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1);
600-
if (icu_lx) icu_lx->ipo = IPO_LIN;
601-
}
602-
IpoCurve *icu_ly = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY");
603-
if (!icu_ly) {
604-
icu_ly = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1);
605-
if (icu_ly) icu_ly->ipo = IPO_LIN;
606-
}
607-
IpoCurve *icu_lz = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ");
608-
if (!icu_lz) {
609-
icu_lz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1);
610-
if (icu_lz) icu_lz->ipo = IPO_LIN;
611-
}
612-
IpoCurve *icu_rx = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX");
613-
if (!icu_rx) {
614-
icu_rx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1);
615-
if (icu_rx) icu_rx->ipo = IPO_LIN;
616-
}
617-
IpoCurve *icu_ry = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY");
618-
if (!icu_ry) {
619-
icu_ry = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1);
620-
if (icu_ry) icu_ry->ipo = IPO_LIN;
621-
}
622-
IpoCurve *icu_rz = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ");
623-
if (!icu_rz) {
624-
icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1);
625-
if (icu_rz) icu_rz->ipo = IPO_LIN;
626-
}
627-
628-
if (icu_rx) eulerAnglesOld[0] = eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
629-
if (icu_ry) eulerAnglesOld[1] = eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
630-
if (icu_rz) eulerAnglesOld[2] = eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
631-
632-
// orn.getValue((float *)tmat); // uses the wrong ordering, cant use this
633-
for (int r = 0; r < 3; r++)
634-
for (int c = 0; c < 3; c++)
635-
tmat[r][c] = orn[c][r];
636-
637-
// mat3_to_eul( eulerAngles,tmat); // better to use Mat3ToCompatibleEul
638-
mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat);
639-
640-
//eval_icu
641-
for (int x = 0; x < 3; x++)
642-
eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0);
643-
644-
//fill the curves with data
645-
if (icu_lx) insert_vert_icu(icu_lx, frameNumber, position.x(), 1);
646-
if (icu_ly) insert_vert_icu(icu_ly, frameNumber, position.y(), 1);
647-
if (icu_lz) insert_vert_icu(icu_lz, frameNumber, position.z(), 1);
648-
if (icu_rx) insert_vert_icu(icu_rx, frameNumber, eulerAngles[0], 1);
649-
if (icu_ry) insert_vert_icu(icu_ry, frameNumber, eulerAngles[1], 1);
650-
if (icu_rz) insert_vert_icu(icu_rz, frameNumber, eulerAngles[2], 1);
651-
652-
// Handles are corrected at the end, testhandles_ipocurve isn't needed yet
653-
#endif
654-
}
655-
}
656-
}
657-
}
658-
}
659-
660-
void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
661-
{
662-
CListValue *scenes = m_ketsjiEngine->CurrentScenes();
663-
for (CListValue::iterator sceit = scenes->GetBegin(); sceit != scenes->GetEnd(); ++sceit) {
664-
KX_Scene *scene = (KX_Scene *)*sceit;
665-
//PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment();
666-
CListValue *parentList = scene->GetRootParentList();
667-
int numObjects = parentList->GetCount();
668-
int g;
669-
for (g = 0; g < numObjects; g++) {
670-
KX_GameObject *gameObj = (KX_GameObject *)parentList->GetValue(g);
671-
if (gameObj->IsRecordAnimation()) {
672-
Object *blenderObject = gameObj->GetBlenderObject();
673-
if (blenderObject && blenderObject->adt) {
674-
bAction *act = verify_adt_action(&blenderObject->id, false);
675-
FCurve *fcu;
676-
677-
if (!act) {
678-
continue;
679-
}
680-
681-
/* for now, not much choice but to run this on all curves... */
682-
for (fcu = (FCurve *)act->curves.first; fcu; fcu = fcu->next) {
683-
/* Note: calling `sort_time_fcurve()` here is not needed, since
684-
* all keys have been added in 'right' order. */
685-
calchandles_fcurve(fcu);
686-
}
687-
#if 0
688-
// XXX animato
689-
Ipo* ipo = blenderObject->ipo;
690-
691-
//create the curves, if not existing
692-
//testhandles_ipocurve checks for NULL
693-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"));
694-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"));
695-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"));
696-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"));
697-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"));
698-
testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"));
699-
#endif
700-
}
701-
}
702-
}
703-
}
704-
}
705-
706487
#ifdef WITH_PYTHON
707488
PyObject *KX_BlenderSceneConverter::GetPyNamespace()
708489
{

0 commit comments

Comments
 (0)