From 3444d6612a525b879857c60d49165efb01f77529 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Wed, 12 Mar 2008 21:33:24 +0000 Subject: Delta Loc/Rot/Scale Ipo curve are now supporting in the BGE with the following limitations: 1. All Ipo channels are now independent. In Blender 2.45, all 3 Loc Ipo channels were automatically set together. For example, having just a LocX Ipo channel was sufficient to fix the X, Y and Z coordinates, with the Y and Z value taken from the object original Y and Z location in Blender. The same was true for the 3 Rot and the 3 Scale Ipo channels: the missing channels were assumed to have constant value taken from the object original orientation/scale in Blender. With this patch, all Ipo channels are now independent. THIS WILL CREATE BACKWARD COMPATIBILITY PROBLEM if you omit to define the 3 channels of a same type together in your Blend file: the undefined Loc, Rot, Scale coordinates of the object will be influenced by the parent/spawner Loc/Rot/Scale in case the object is a child or dynamically created. 2. Delta Loc, Rot, Scale are now supported with the following limitations: - The delta Loc/Rot Ipo modify the object global (NOT local) location/orientation - The delta Scale change the object local scale - The delta Ipo curves are relative to the object starting Loc/Rot/Scale when the Ipo was first activated; after that, the delta Ipo becomes global. This means that the object will return to this initial Loc/Rot/Scale when you later restart the Ipo curve, even if you had changed the object Loc/Rot/Scale in the meantime. Of course this applies only to the specific Loc/Rot/Scale coordinate that are defined in the Ipo channels as the channels are now independent. 3. When the objects are converted from Blender to the BGE, the delta Loc/Rot/Scale that might result from initial non-zero values in delta Ipo Curves will be ignored. However, as soon as the delta Ipo curve is activated, the non-zero values will be taken into account and the object will jump to the same Loc/Rot/Scale situation as in Blender. Note that delta Ipo curves with initial non-zero values is bad practice; logically, a delta Ipo curver should always start from 0. 4. If you define both a global and delta channel of the same type (LocX and DLocX), the result will be a global channel equivalent to the sum of the two channels (LocX+DLocX). --- source/gameengine/Converter/KX_IpoConvert.cpp | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'source/gameengine/Converter/KX_IpoConvert.cpp') diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index defcdffb6fc..2cf29e9dd62 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -100,9 +100,9 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend ipocontr->GetIPOTransform().SetPosition( MT_Point3( - blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] + blenderobject->loc[0]/*+blenderobject->dloc[0]*/, + blenderobject->loc[1]/*+blenderobject->dloc[1]*/, + blenderobject->loc[2]/*+blenderobject->dloc[2]*/ ) ); ipocontr->GetIPOTransform().SetEulerAngles( @@ -134,7 +134,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetPosition()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_LOC_X, true); } @@ -145,7 +145,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetPosition()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_LOC_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_LOC_Z); @@ -155,7 +155,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetPosition()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_LOC_Z, true); } // Master the art of cut & paste programming... @@ -167,7 +167,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaPosition()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_DLOC_X, true); } ipo = ipoList->GetScalarInterpolator(OB_DLOC_Y); @@ -177,7 +177,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaPosition()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_DLOC_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_DLOC_Z); @@ -187,7 +187,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaPosition()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyPosition(true); + ipocontr->SetIPOChannelActive(OB_DLOC_Z, true); } // Explore the finesse of reuse and slight modification @@ -199,7 +199,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetEulerAngles()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_ROT_X, true); } ipo = ipoList->GetScalarInterpolator(OB_ROT_Y); if (ipo) { @@ -208,7 +208,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetEulerAngles()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_ROT_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_ROT_Z); if (ipo) { @@ -217,7 +217,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetEulerAngles()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_ROT_Z, true); } // Hmmm, the need for a macro comes to mind... @@ -229,7 +229,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_DROT_X, true); } ipo = ipoList->GetScalarInterpolator(OB_DROT_Y); if (ipo) { @@ -238,7 +238,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_DROT_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_DROT_Z); if (ipo) { @@ -247,7 +247,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyOrientation(true); + ipocontr->SetIPOChannelActive(OB_DROT_Z, true); } // Hang on, almost there... @@ -259,7 +259,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetScaling()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_SIZE_X, true); } ipo = ipoList->GetScalarInterpolator(OB_SIZE_Y); if (ipo) { @@ -268,7 +268,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetScaling()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_SIZE_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_SIZE_Z); if (ipo) { @@ -277,7 +277,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetScaling()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_SIZE_Z, true); } // The last few... @@ -289,7 +289,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaScaling()[0]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_DSIZE_X, true); } ipo = ipoList->GetScalarInterpolator(OB_DSIZE_Y); if (ipo) { @@ -298,7 +298,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaScaling()[1]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_DSIZE_Y, true); } ipo = ipoList->GetScalarInterpolator(OB_DSIZE_Z); if (ipo) { @@ -307,7 +307,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend &(ipocontr->GetIPOTransform().GetDeltaScaling()[2]), ipo); ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyScaling(true); + ipocontr->SetIPOChannelActive(OB_DSIZE_Z, true); } { -- cgit v1.2.3