gameengine: dataconversion import and whitespace cleanup
This commit is contained in:
@@ -52,23 +52,13 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "BL_BlenderDataConversion.h"
|
||||
#include "KX_BlenderScalarInterpolator.h"
|
||||
|
||||
#include "RAS_IPolygonMaterial.h"
|
||||
|
||||
// Expressions
|
||||
#include "ListValue.h"
|
||||
#include "IntValue.h"
|
||||
// Collision & Fuzzics LTD
|
||||
#include "MT_Transform.h"
|
||||
#include "MT_MinMax.h"
|
||||
|
||||
#include "PHY_Pro.h"
|
||||
#include "PHY_IPhysicsEnvironment.h"
|
||||
#include "PHY_DynamicTypes.h"
|
||||
|
||||
|
||||
#include "KX_Scene.h"
|
||||
#include "KX_GameObject.h"
|
||||
#include "RAS_FramingManager.h"
|
||||
#include "RAS_MeshObject.h"
|
||||
#include "RAS_IRasterizer.h"
|
||||
#include "RAS_ILightObject.h"
|
||||
@@ -76,31 +66,27 @@
|
||||
#include "KX_ConvertActuators.h"
|
||||
#include "KX_ConvertControllers.h"
|
||||
#include "KX_ConvertSensors.h"
|
||||
|
||||
#include "SCA_LogicManager.h"
|
||||
#include "SCA_EventManager.h"
|
||||
#include "SCA_TimeEventManager.h"
|
||||
|
||||
#include "KX_ClientObjectInfo.h"
|
||||
#include "KX_Scene.h"
|
||||
#include "KX_GameObject.h"
|
||||
#include "KX_Light.h"
|
||||
#include "KX_Camera.h"
|
||||
#include "KX_ClientObjectInfo.h"
|
||||
#include "KX_EmptyObject.h"
|
||||
#include "KX_FontObject.h"
|
||||
#include "MT_Point3.h"
|
||||
#include "MT_Transform.h"
|
||||
#include "MT_MinMax.h"
|
||||
#include "SCA_IInputDevice.h"
|
||||
|
||||
#include "RAS_TexMatrix.h"
|
||||
#include "RAS_ICanvas.h"
|
||||
#include "RAS_MaterialBucket.h"
|
||||
//#include "KX_BlenderPolyMaterial.h"
|
||||
#include "RAS_Polygon.h"
|
||||
#include "RAS_TexVert.h"
|
||||
#include "RAS_BucketManager.h"
|
||||
#include "RAS_IPolygonMaterial.h"
|
||||
#include "BL_Material.h"
|
||||
#include "KX_BlenderMaterial.h"
|
||||
#include "BL_Texture.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_object.h"
|
||||
@@ -109,9 +95,9 @@
|
||||
#include "BL_SkinDeformer.h"
|
||||
#include "BL_MeshDeformer.h"
|
||||
#include "KX_SoftBodyDeformer.h"
|
||||
//#include "BL_ArmatureController.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BlenderWorldInfo.h"
|
||||
|
||||
#include "KX_KetsjiEngine.h"
|
||||
@@ -143,13 +129,14 @@
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_object_force.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "MT_Point3.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
@@ -170,48 +157,29 @@ extern Material defmaterial; /* material.c */
|
||||
|
||||
#include "KX_BlenderInputDevice.h"
|
||||
#include "KX_ConvertProperties.h"
|
||||
#include "KX_HashedPtr.h"
|
||||
|
||||
|
||||
#include "KX_ScalarInterpolator.h"
|
||||
|
||||
#include "KX_IpoConvert.h"
|
||||
#include "BL_System.h"
|
||||
|
||||
#include "SG_Node.h"
|
||||
#include "SG_BBox.h"
|
||||
#include "SG_Tree.h"
|
||||
#include "KX_SG_NodeRelationships.h"
|
||||
#include "KX_SG_BoneParentNodeRelationship.h"
|
||||
|
||||
#ifdef WITH_BULLET
|
||||
#include "CcdPhysicsEnvironment.h"
|
||||
#include "CcdGraphicController.h"
|
||||
#endif
|
||||
|
||||
#include "KX_MotionState.h"
|
||||
|
||||
// This file defines relationships between parents and children
|
||||
// in the game engine.
|
||||
|
||||
#include "KX_SG_NodeRelationships.h"
|
||||
#include "KX_SG_BoneParentNodeRelationship.h"
|
||||
|
||||
#include "BL_ArmatureObject.h"
|
||||
#include "BL_DeformableGameObject.h"
|
||||
|
||||
#include "KX_NavMeshObject.h"
|
||||
#include "KX_ObstacleSimulation.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//XXX void update_for_newframe();
|
||||
//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay);
|
||||
//void do_all_data_ipos(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "BLI_threads.h"
|
||||
|
||||
|
||||
static bool default_light_mode = 0;
|
||||
|
||||
static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
|
||||
@@ -389,6 +357,11 @@ static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
|
||||
|
||||
static std::map<int, SCA_IInputDevice::KX_EnumInputs> gReverseKeyTranslateTable = create_translate_table();
|
||||
|
||||
SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code)
|
||||
{
|
||||
return gReverseKeyTranslateTable[key_code];
|
||||
}
|
||||
|
||||
static unsigned int KX_rgbaint2uint_new(unsigned int icol)
|
||||
{
|
||||
union
|
||||
@@ -1709,9 +1682,6 @@ struct parentChildLink {
|
||||
SG_Node* m_gamechildnode;
|
||||
};
|
||||
|
||||
#include "DNA_constraint_types.h"
|
||||
//XXX #include "BIF_editconstraint.h"
|
||||
|
||||
static bPoseChannel *get_active_posechannel2(Object *ob)
|
||||
{
|
||||
bArmature *arm= (bArmature*)ob->data;
|
||||
@@ -1745,20 +1715,15 @@ static ListBase *get_active_constraints2(Object *ob)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(RBJconstraints)(Object *ob)//not used
|
||||
static void UNUSED_FUNCTION(print_active_constraints2)(Object *ob) //not used, use to debug
|
||||
{
|
||||
ListBase *conlist;
|
||||
bConstraint *curcon;
|
||||
|
||||
conlist = get_active_constraints2(ob);
|
||||
bConstraint* curcon;
|
||||
ListBase* conlist = get_active_constraints2(ob);
|
||||
|
||||
if (conlist) {
|
||||
for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) {
|
||||
|
||||
printf("%i\n",curcon->type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2336,7 +2301,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
}
|
||||
|
||||
bool processCompoundChildren = false;
|
||||
|
||||
// create physics information
|
||||
for (i=0;i<sumolist->GetCount();i++)
|
||||
{
|
||||
@@ -2369,7 +2333,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
}
|
||||
|
||||
//set ini linearVel and int angularVel //rcruiz
|
||||
if (converter->addInitFromFrame)
|
||||
if (converter->addInitFromFrame) {
|
||||
for (i=0;i<sumolist->GetCount();i++)
|
||||
{
|
||||
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
|
||||
@@ -2377,22 +2341,21 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
gameobj->setLinearVelocity(inivel[i],false);
|
||||
gameobj->setAngularVelocity(iniang[i],false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// create physics joints
|
||||
// create physics joints
|
||||
for (i=0;i<sumolist->GetCount();i++)
|
||||
{
|
||||
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
|
||||
struct Object* blenderobject = gameobj->GetBlenderObject();
|
||||
ListBase *conlist;
|
||||
bConstraint *curcon;
|
||||
conlist = get_active_constraints2(blenderobject);
|
||||
|
||||
if ((gameobj->GetLayer()&activeLayerBitInfo)==0)
|
||||
continue;
|
||||
|
||||
conlist = get_active_constraints2(blenderobject);
|
||||
if (conlist) {
|
||||
for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) {
|
||||
if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
|
||||
@@ -2403,15 +2366,13 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
|
||||
PHY_IPhysicsController* physctr2 = 0;
|
||||
|
||||
if (dat->tar)
|
||||
{
|
||||
if (dat->tar) {
|
||||
KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist);
|
||||
if (gotar && ((gotar->GetLayer()&activeLayerBitInfo)!=0) && gotar->GetPhysicsController())
|
||||
physctr2 = gotar->GetPhysicsController();
|
||||
}
|
||||
|
||||
if (gameobj->GetPhysicsController())
|
||||
{
|
||||
if (gameobj->GetPhysicsController()) {
|
||||
PHY_IPhysicsController* physctrl = gameobj->GetPhysicsController();
|
||||
//we need to pass a full constraint frame, not just axis
|
||||
|
||||
@@ -2420,62 +2381,47 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
MT_Vector3 axis0 = localCFrame.getColumn(0);
|
||||
MT_Vector3 axis1 = localCFrame.getColumn(1);
|
||||
MT_Vector3 axis2 = localCFrame.getColumn(2);
|
||||
|
||||
|
||||
int constraintId = kxscene->GetPhysicsEnvironment()->CreateConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,
|
||||
(float)dat->pivY,(float)dat->pivZ,
|
||||
(float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
|
||||
(float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
|
||||
(float)axis2.x(),(float)axis2.y(),(float)axis2.z(),dat->flag);
|
||||
if (constraintId)
|
||||
{
|
||||
if (constraintId) {
|
||||
//if it is a generic 6DOF constraint, set all the limits accordingly
|
||||
if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT)
|
||||
{
|
||||
if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT) {
|
||||
int dof;
|
||||
int dofbit=1;
|
||||
for (dof=0;dof<6;dof++)
|
||||
{
|
||||
if (dat->flag & dofbit)
|
||||
{
|
||||
for (dof=0;dof<6;dof++) {
|
||||
if (dat->flag & dofbit) {
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
//minLimit > maxLimit means free(disabled limit) for this degree of freedom
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
|
||||
}
|
||||
dofbit<<=1;
|
||||
}
|
||||
}
|
||||
else if (dat->type == PHY_CONE_TWIST_CONSTRAINT)
|
||||
{
|
||||
} else if (dat->type == PHY_CONE_TWIST_CONSTRAINT) {
|
||||
int dof;
|
||||
int dofbit = 1<<3; // bitflag use_angular_limit_x
|
||||
|
||||
for (dof=3;dof<6;dof++)
|
||||
{
|
||||
if (dat->flag & dofbit)
|
||||
{
|
||||
|
||||
for (dof=3;dof<6;dof++) {
|
||||
if (dat->flag & dofbit) {
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//maxLimit < 0 means free(disabled limit) for this degree of freedom
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
|
||||
}
|
||||
dofbit<<=1;
|
||||
}
|
||||
}
|
||||
else if (dat->type == PHY_LINEHINGE_CONSTRAINT)
|
||||
{
|
||||
} else if (dat->type == PHY_LINEHINGE_CONSTRAINT) {
|
||||
int dof = 3; // dof for angular x
|
||||
int dofbit = 1<<3; // bitflag use_angular_limit_x
|
||||
|
||||
if (dat->flag & dofbit)
|
||||
{
|
||||
|
||||
if (dat->flag & dofbit) {
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,
|
||||
dat->minLimit[dof],dat->maxLimit[dof]);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
//minLimit > maxLimit means free(disabled limit) for this degree of freedom
|
||||
kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
|
||||
}
|
||||
@@ -2535,8 +2481,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
}
|
||||
}
|
||||
|
||||
#define CONVERT_LOGIC
|
||||
#ifdef CONVERT_LOGIC
|
||||
// convert logic bricks, sensors, controllers and actuators
|
||||
for (i=0;i<logicbrick_conversionlist->GetCount();i++)
|
||||
{
|
||||
@@ -2571,8 +2515,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
gameobj->ResetState();
|
||||
}
|
||||
|
||||
#endif //CONVERT_LOGIC
|
||||
|
||||
logicbrick_conversionlist->Release();
|
||||
|
||||
// Calculate the scene btree -
|
||||
@@ -2599,7 +2541,3 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
bucketmanager->OptimizeBuckets(distance);
|
||||
}
|
||||
|
||||
SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code)
|
||||
{
|
||||
return gReverseKeyTranslateTable[key_code];
|
||||
}
|
||||
|
Reference in New Issue
Block a user