Index: release/scripts/startup/bl_ui/properties_data_bone.py =================================================================== --- release/scripts/startup/bl_ui/properties_data_bone.py (revision 39268) +++ release/scripts/startup/bl_ui/properties_data_bone.py (working copy) @@ -356,6 +356,25 @@ col.label(text="Offset:") col.prop(bone, "use_cyclic_offset") +class BONE_PT_physics(BoneButtonsPanel, bpy.types.Panel): + bl_label = "Physics" + + @classmethod + def poll(cls, context): + rd = context.scene.render + ob = context.object + + return ob and ob.mode == 'POSE' and context.bone and rd.engine == 'BLENDER_GAME' + + def draw_header(self, context): + bone = context.bone + + self.layout.prop(bone, "use_physics", text="") + + def draw(self, context): + layout = self.layout + + bone = context.bone class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} Index: source/blender/makesdna/DNA_armature_types.h =================================================================== --- source/blender/makesdna/DNA_armature_types.h (revision 39268) +++ source/blender/makesdna/DNA_armature_types.h (working copy) @@ -199,7 +199,8 @@ BONE_EDITMODE_LOCKED = (1<<19), /* bone transforms are locked in EditMode */ BONE_TRANSFORM_CHILD = (1<<20), /* Indicates that a parent is also being transformed */ BONE_UNSELECTABLE = (1<<21), /* bone cannot be selected */ - BONE_NO_LOCAL_LOCATION = (1<<22) /* bone location is in armature space */ + BONE_NO_LOCAL_LOCATION = (1<<22), /* bone location is in armature space */ + BONE_USE_PHYSICS = (1<<23) /* BGE bone physics */ } eBone_Flag; #define MAXBONENAME 32 Index: source/blender/makesrna/intern/rna_armature.c =================================================================== --- source/blender/makesrna/intern/rna_armature.c (revision 39268) +++ source/blender/makesrna/intern/rna_armature.c (working copy) @@ -553,6 +553,11 @@ RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + + /* BGE bone physics settings */ + prop= RNA_def_property(srna, "use_physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_USE_PHYSICS); + RNA_def_property_ui_text(prop, "Use Physics", "Enable physics for this bone"); } // err... bones should not be directly edited (only editbones should be...) Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- source/gameengine/Converter/BL_BlenderDataConversion.cpp (revision 39268) +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp (working copy) @@ -69,6 +69,7 @@ #include "KX_Light.h" #include "KX_Camera.h" #include "KX_EmptyObject.h" +#include "KX_BoneObject.h" #include "KX_FontObject.h" #include "MT_Point3.h" #include "MT_Transform.h" @@ -1638,10 +1639,125 @@ } } +static void setup_bone_physics(KX_BoneObject* bone, BL_ArmatureObject *armobj, KX_Scene* kxscene, KX_BlenderSceneConverter *converter) +{ + Bone *bbone = bone->GetBone(); + PHY_ShapeProps shapeprops = {0}; + PHY_MaterialProps smmaterial = {0}; + KX_ObjectProperties objprop = {0}; + objprop.m_in_active_layer = (armobj->GetBlenderObject()->lay & kxscene->GetBlenderScene()->lay) != 0; + objprop.m_boundclass = KX_BOUNDCAPSULE; + objprop.m_boundobject.c.m_radius = 0.5f; + objprop.m_boundobject.c.m_height = (bbone->length - objprop.m_boundobject.c.m_radius) * 0.5f; + Object* parent = armobj->GetBlenderObject(); + while (parent && parent->parent) + parent = parent->parent; + objprop.m_dynamic_parent = converter->FindGameObject(parent); + KX_ConvertBulletObject(bone, NULL, NULL, kxscene, &shapeprops, &smmaterial, &objprop); +} +static void kxbones_from_blbones(BL_ArmatureObject *gameobj, KX_Scene *kxscene, Bone *bone, KX_BlenderSceneConverter *converter) +{ + KX_BoneObject *bobj = NULL; + + if (bone->flag & BONE_USE_PHYSICS) + { + MT_Matrix4x4 mtbone_matrix, mtarm_matrix; + float bone_matrix[4][4] = {0}; + bArmature* armobj = (bArmature*)gameobj->GetArmatureObject()->data; + + bobj = new KX_BoneObject(bone, kxscene, KX_Scene::m_callbacks); + bobj->SetLayer(gameobj->GetBlenderObject()->lay); + + // Setup position and orientation + gameobj->GetBoneMatrix(bone, mtbone_matrix); + //if (bone->parent) + //{ + //gameobj->GetBoneMatrix(bone->parent, mtbonepar_matrix); + //mtbone_matrix = mtbone_matrix * mtbonepar_matrix; + //} + //mtbone_matrix = mtbone_matrix * gameobj->GetSGNode()->GetWorldTransform(); + mtarm_matrix.setValue((float*)gameobj->GetArmatureObject()->obmat); + mtbone_matrix = mtbone_matrix * mtarm_matrix; + + mtbone_matrix.getValue((float*)bone_matrix); + MT_Transform bone_trans((float*)bone_matrix); + + bobj->GetSGNode()->SetLocalPosition(bone_trans.getOrigin() - MT_Vector3(0.0, gameobj->GetBoneLength(bone)*0.5, 0.0)); + //bobj->GetSGNode()->SetModified(); + bobj->GetSGNode()->SetLocalOrientation(bone_trans.getBasis()); + //bobj->NodeSetLocalPosition(MT_Point3(bone_matrix[0][3], bone_matrix[1][3], bone_matrix[2][3])); + //bobj->NodeSetLocalOrientation(MT_Matrix3x3(bone_matrix[0][0], bone_matrix[0][1], bone_matrix[0][2], + // bone_matrix[1][0], bone_matrix[1][1], bone_matrix[1][2], + // bone_matrix[2][0], bone_matrix[2][1], bone_matrix[2][2])); + bobj->NodeUpdateGS(0); + + kxscene->GetLogicManager()->RegisterGameObjectName(bobj->GetName(), bobj); + + // Handle parenting + SG_Callbacks callback(NULL, NULL, NULL, KX_Scene::KX_ScenegraphUpdateFunc, KX_Scene::KX_ScenegraphRescheduleFunc); + SG_Node* parentinversenode = new SG_Node(NULL, kxscene, callback); + + KX_NormalParentRelation* parent_rel = KX_NormalParentRelation::New(); + parentinversenode->SetParentRelation(parent_rel); + + //mtbone_matrix.invert(); + //mtbone_matrix.getValue((float*)bone_matrix); + //MT_Transform parinvtrans((float*)bone_matrix); + MT_Transform parinvtrans((float*)gameobj->GetBlenderObject()->parentinv); + parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); + + MT_Matrix3x3 ori(parinvtrans.getBasis()); + MT_Vector3 x(ori.getColumn(0)); + MT_Vector3 y(ori.getColumn(1)); + MT_Vector3 z(ori.getColumn(2)); + MT_Vector3 localscale(x.length(), y.length(), z.length()); + if (!MT_fuzzyZero(localscale[0])) + x /= localscale[0]; + if (!MT_fuzzyZero(localscale[1])) + y /= localscale[1]; + if (!MT_fuzzyZero(localscale[2])) + z /= localscale[2]; + ori.setColumn(0, x); + ori.setColumn(1, y); + ori.setColumn(2, z); + parentinversenode->SetLocalOrientation(ori); + parentinversenode->SetLocalScale(localscale); + + parentinversenode->AddChild(bobj->GetSGNode()); + + bobj->GetSGNode()->SetParentRelation(KX_BoneParentRelation::New(bone)); + gameobj->GetSGNode()->AddChild(bobj->GetSGNode()); + + // Setup physics + setup_bone_physics(bobj, gameobj, kxscene, converter); + + if ((gameobj->GetBlenderObject()->lay & kxscene->GetBlenderScene()->lay) != 0) + kxscene->GetObjectList()->Add(bobj->AddRef()); + else + kxscene->GetInactiveList()->Add(bobj->AddRef()); + } + + for (Bone* child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next) + kxbones_from_blbones(gameobj, kxscene, child, converter); + + if (bobj) + bobj->Release(); +} + +static void BL_ConvertBones(BL_ArmatureObject *gameobj, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) +{ + + bArmature* armobj = (bArmature*)gameobj->GetArmatureObject()->data; + for (Bone* bone=(Bone*)armobj->bonebase.first; bone; bone=(Bone*)bone->next) + { + kxbones_from_blbones(gameobj, kxscene, bone, converter); + } +} + static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int layerflag, KX_Scene *kxscene, RAS_IRenderTools *rendertools, KX_BlenderSceneConverter *converter) { RAS_LightObject lightobj; KX_LightObject *gamelight; @@ -2546,12 +2662,16 @@ gameobj->GetDeformer()->UpdateBuckets(); } - // Set up armature constraints + // Set up armature constraints and bone physics for (i=0;i<sumolist->GetCount();++i) { KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) - ((BL_ArmatureObject*)gameobj)->LoadConstraints(converter); + { + BL_ArmatureObject* arm_obj = (BL_ArmatureObject*)gameobj; + arm_obj->LoadConstraints(converter); + BL_ConvertBones(arm_obj, kxscene, converter); + } } bool processCompoundChildren = false; Index: source/gameengine/Ketsji/CMakeLists.txt =================================================================== --- source/gameengine/Ketsji/CMakeLists.txt (revision 39268) +++ source/gameengine/Ketsji/CMakeLists.txt (working copy) @@ -91,6 +91,7 @@ BL_Texture.cpp KX_ArmatureSensor.cpp KX_BlenderMaterial.cpp + KX_BoneObject.cpp KX_BulletPhysicsController.cpp KX_Camera.cpp KX_CameraActuator.cpp @@ -162,6 +163,7 @@ BL_Texture.h KX_ArmatureSensor.h KX_BlenderMaterial.h + KX_BoneObject.h KX_BulletPhysicsController.h KX_Camera.h KX_CameraActuator.h Index: source/gameengine/Ketsji/KX_BoneObject.cpp =================================================================== --- source/gameengine/Ketsji/KX_BoneObject.cpp (revision 0) +++ source/gameengine/Ketsji/KX_BoneObject.cpp (revision 0) @@ -0,0 +1,48 @@ +/** + * $Id: KX_EmptyObject.cpp 35171 2011-02-25 13:35:59Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Mitchell Stokes. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gameengine/Ketsji/KX_BoneObject.cpp + * \ingroup ketsji + */ + +#include "KX_BoneObject.h" + +#include "DNA_armature_types.h"; + +KX_BoneObject::KX_BoneObject(Bone *bone, void* sgReplicationInfo,SG_Callbacks callbacks) : + KX_GameObject(sgReplicationInfo,callbacks), + m_bone(bone) +{ + SetName(bone->name); +} + +KX_BoneObject::~KX_BoneObject() +{ + +} + +Bone *KX_BoneObject::GetBone() +{ + return m_bone; +} \ No newline at end of file
Property changes on: source\gameengine\Ketsji\KX_BoneObject.cpp ___________________________________________________________________ Added: svn:eol-style + native
Index: source/gameengine/Ketsji/KX_BoneObject.h =================================================================== --- source/gameengine/Ketsji/KX_BoneObject.h (revision 0) +++ source/gameengine/Ketsji/KX_BoneObject.h (revision 0) @@ -0,0 +1,51 @@ +/** + * $Id: $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Mitchell Stokes. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file KX_BoneObject.h + * \ingroup ketsji + */ + +#ifndef __KX_BONEOBJECT +#define __KX_BONEOBJECT +#include "KX_GameObject.h" + +class KX_BoneObject : public KX_GameObject +{ +private: + struct Bone *m_bone; +public: + KX_BoneObject(struct Bone *bone, void* sgReplicationInfo,SG_Callbacks callbacks); + virtual ~KX_BoneObject(); + + struct Bone *GetBone(); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneObject"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif +}; + +#endif //__KX_EMPTYOBJECT +
Property changes on: source\gameengine\Ketsji\KX_BoneObject.h ___________________________________________________________________ Added: svn:eol-style + native
Index: release/scripts/startup/bl_ui/properties_data_bone.py =================================================================== --- release/scripts/startup/bl_ui/properties_data_bone.py (revision 39268) +++ release/scripts/startup/bl_ui/properties_data_bone.py (working copy) @@ -356,6 +356,25 @@ col.label(text="Offset:") col.prop(bone, "use_cyclic_offset") +class BONE_PT_physics(BoneButtonsPanel, bpy.types.Panel): + bl_label = "Physics" + + @classmethod + def poll(cls, context): + rd = context.scene.render + ob = context.object + + return ob and ob.mode == 'POSE' and context.bone and rd.engine == 'BLENDER_GAME' + + def draw_header(self, context): + bone = context.bone + + self.layout.prop(bone, "use_physics", text="") + + def draw(self, context): + layout = self.layout + + bone = context.bone class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} Index: source/blender/makesdna/DNA_armature_types.h =================================================================== --- source/blender/makesdna/DNA_armature_types.h (revision 39268) +++ source/blender/makesdna/DNA_armature_types.h (working copy) @@ -199,7 +199,8 @@ BONE_EDITMODE_LOCKED = (1<<19), /* bone transforms are locked in EditMode */ BONE_TRANSFORM_CHILD = (1<<20), /* Indicates that a parent is also being transformed */ BONE_UNSELECTABLE = (1<<21), /* bone cannot be selected */ - BONE_NO_LOCAL_LOCATION = (1<<22) /* bone location is in armature space */ + BONE_NO_LOCAL_LOCATION = (1<<22), /* bone location is in armature space */ + BONE_USE_PHYSICS = (1<<23) /* BGE bone physics */ } eBone_Flag; #define MAXBONENAME 32 Index: source/blender/makesrna/intern/rna_armature.c =================================================================== --- source/blender/makesrna/intern/rna_armature.c (revision 39268) +++ source/blender/makesrna/intern/rna_armature.c (working copy) @@ -553,6 +553,11 @@ RNA_def_property_range(prop, 0.0f, 1000.0f); RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + + /* BGE bone physics settings */ + prop= RNA_def_property(srna, "use_physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_USE_PHYSICS); + RNA_def_property_ui_text(prop, "Use Physics", "Enable physics for this bone"); } // err... bones should not be directly edited (only editbones should be...) Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- source/gameengine/Converter/BL_BlenderDataConversion.cpp (revision 39268) +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp (working copy) @@ -69,6 +69,7 @@ #include "KX_Light.h" #include "KX_Camera.h" #include "KX_EmptyObject.h" +#include "KX_BoneObject.h" #include "KX_FontObject.h" #include "MT_Point3.h" #include "MT_Transform.h" @@ -1638,10 +1639,125 @@ } } +static void setup_bone_physics(KX_BoneObject* bone, BL_ArmatureObject *armobj, KX_Scene* kxscene, KX_BlenderSceneConverter *converter) +{ + Bone *bbone = bone->GetBone(); + PHY_ShapeProps shapeprops = {0}; + PHY_MaterialProps smmaterial = {0}; + KX_ObjectProperties objprop = {0}; + objprop.m_in_active_layer = (armobj->GetBlenderObject()->lay & kxscene->GetBlenderScene()->lay) != 0; + objprop.m_boundclass = KX_BOUNDCAPSULE; + objprop.m_boundobject.c.m_radius = 0.5f; + objprop.m_boundobject.c.m_height = (bbone->length - objprop.m_boundobject.c.m_radius) * 0.5f; + Object* parent = armobj->GetBlenderObject(); + while (parent && parent->parent) + parent = parent->parent; + objprop.m_dynamic_parent = converter->FindGameObject(parent); + KX_ConvertBulletObject(bone, NULL, NULL, kxscene, &shapeprops, &smmaterial, &objprop); +} +static void kxbones_from_blbones(BL_ArmatureObject *gameobj, KX_Scene *kxscene, Bone *bone, KX_BlenderSceneConverter *converter) +{ + KX_BoneObject *bobj = NULL; + + if (bone->flag & BONE_USE_PHYSICS) + { + MT_Matrix4x4 mtbone_matrix, mtarm_matrix; + float bone_matrix[4][4] = {0}; + bArmature* armobj = (bArmature*)gameobj->GetArmatureObject()->data; + + bobj = new KX_BoneObject(bone, kxscene, KX_Scene::m_callbacks); + bobj->SetLayer(gameobj->GetBlenderObject()->lay); + + // Setup position and orientation + gameobj->GetBoneMatrix(bone, mtbone_matrix); + //if (bone->parent) + //{ + //gameobj->GetBoneMatrix(bone->parent, mtbonepar_matrix); + //mtbone_matrix = mtbone_matrix * mtbonepar_matrix; + //} + //mtbone_matrix = mtbone_matrix * gameobj->GetSGNode()->GetWorldTransform(); + mtarm_matrix.setValue((float*)gameobj->GetArmatureObject()->obmat); + mtbone_matrix = mtbone_matrix * mtarm_matrix; + + mtbone_matrix.getValue((float*)bone_matrix); + MT_Transform bone_trans((float*)bone_matrix); + + bobj->GetSGNode()->SetLocalPosition(bone_trans.getOrigin() - MT_Vector3(0.0, gameobj->GetBoneLength(bone)*0.5, 0.0)); + //bobj->GetSGNode()->SetModified(); + bobj->GetSGNode()->SetLocalOrientation(bone_trans.getBasis()); + //bobj->NodeSetLocalPosition(MT_Point3(bone_matrix[0][3], bone_matrix[1][3], bone_matrix[2][3])); + //bobj->NodeSetLocalOrientation(MT_Matrix3x3(bone_matrix[0][0], bone_matrix[0][1], bone_matrix[0][2], + // bone_matrix[1][0], bone_matrix[1][1], bone_matrix[1][2], + // bone_matrix[2][0], bone_matrix[2][1], bone_matrix[2][2])); + bobj->NodeUpdateGS(0); + + kxscene->GetLogicManager()->RegisterGameObjectName(bobj->GetName(), bobj); + + // Handle parenting + SG_Callbacks callback(NULL, NULL, NULL, KX_Scene::KX_ScenegraphUpdateFunc, KX_Scene::KX_ScenegraphRescheduleFunc); + SG_Node* parentinversenode = new SG_Node(NULL, kxscene, callback); + + KX_NormalParentRelation* parent_rel = KX_NormalParentRelation::New(); + parentinversenode->SetParentRelation(parent_rel); + + //mtbone_matrix.invert(); + //mtbone_matrix.getValue((float*)bone_matrix); + //MT_Transform parinvtrans((float*)bone_matrix); + MT_Transform parinvtrans((float*)gameobj->GetBlenderObject()->parentinv); + parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); + + MT_Matrix3x3 ori(parinvtrans.getBasis()); + MT_Vector3 x(ori.getColumn(0)); + MT_Vector3 y(ori.getColumn(1)); + MT_Vector3 z(ori.getColumn(2)); + MT_Vector3 localscale(x.length(), y.length(), z.length()); + if (!MT_fuzzyZero(localscale[0])) + x /= localscale[0]; + if (!MT_fuzzyZero(localscale[1])) + y /= localscale[1]; + if (!MT_fuzzyZero(localscale[2])) + z /= localscale[2]; + ori.setColumn(0, x); + ori.setColumn(1, y); + ori.setColumn(2, z); + parentinversenode->SetLocalOrientation(ori); + parentinversenode->SetLocalScale(localscale); + + parentinversenode->AddChild(bobj->GetSGNode()); + + bobj->GetSGNode()->SetParentRelation(KX_BoneParentRelation::New(bone)); + gameobj->GetSGNode()->AddChild(bobj->GetSGNode()); + + // Setup physics + setup_bone_physics(bobj, gameobj, kxscene, converter); + + if ((gameobj->GetBlenderObject()->lay & kxscene->GetBlenderScene()->lay) != 0) + kxscene->GetObjectList()->Add(bobj->AddRef()); + else + kxscene->GetInactiveList()->Add(bobj->AddRef()); + } + + for (Bone* child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next) + kxbones_from_blbones(gameobj, kxscene, child, converter); + + if (bobj) + bobj->Release(); +} + +static void BL_ConvertBones(BL_ArmatureObject *gameobj, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) +{ + + bArmature* armobj = (bArmature*)gameobj->GetArmatureObject()->data; + for (Bone* bone=(Bone*)armobj->bonebase.first; bone; bone=(Bone*)bone->next) + { + kxbones_from_blbones(gameobj, kxscene, bone, converter); + } +} + static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int layerflag, KX_Scene *kxscene, RAS_IRenderTools *rendertools, KX_BlenderSceneConverter *converter) { RAS_LightObject lightobj; KX_LightObject *gamelight; @@ -2546,12 +2662,16 @@ gameobj->GetDeformer()->UpdateBuckets(); } - // Set up armature constraints + // Set up armature constraints and bone physics for (i=0;i<sumolist->GetCount();++i) { KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) - ((BL_ArmatureObject*)gameobj)->LoadConstraints(converter); + { + BL_ArmatureObject* arm_obj = (BL_ArmatureObject*)gameobj; + arm_obj->LoadConstraints(converter); + BL_ConvertBones(arm_obj, kxscene, converter); + } } bool processCompoundChildren = false; Index: source/gameengine/Ketsji/CMakeLists.txt =================================================================== --- source/gameengine/Ketsji/CMakeLists.txt (revision 39268) +++ source/gameengine/Ketsji/CMakeLists.txt (working copy) @@ -91,6 +91,7 @@ BL_Texture.cpp KX_ArmatureSensor.cpp KX_BlenderMaterial.cpp + KX_BoneObject.cpp KX_BulletPhysicsController.cpp KX_Camera.cpp KX_CameraActuator.cpp @@ -162,6 +163,7 @@ BL_Texture.h KX_ArmatureSensor.h KX_BlenderMaterial.h + KX_BoneObject.h KX_BulletPhysicsController.h KX_Camera.h KX_CameraActuator.h Index: source/gameengine/Ketsji/KX_BoneObject.cpp =================================================================== --- source/gameengine/Ketsji/KX_BoneObject.cpp (revision 0) +++ source/gameengine/Ketsji/KX_BoneObject.cpp (revision 0) @@ -0,0 +1,48 @@ +/** + * $Id: KX_EmptyObject.cpp 35171 2011-02-25 13:35:59Z jesterking $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Mitchell Stokes. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gameengine/Ketsji/KX_BoneObject.cpp + * \ingroup ketsji + */ + +#include "KX_BoneObject.h" + +#include "DNA_armature_types.h"; + +KX_BoneObject::KX_BoneObject(Bone *bone, void* sgReplicationInfo,SG_Callbacks callbacks) : + KX_GameObject(sgReplicationInfo,callbacks), + m_bone(bone) +{ + SetName(bone->name); +} + +KX_BoneObject::~KX_BoneObject() +{ + +} + +Bone *KX_BoneObject::GetBone() +{ + return m_bone; +} \ No newline at end of file Property changes on: source\gameengine\Ketsji\KX_BoneObject.cpp ___________________________________________________________________ Added: svn:eol-style + native Index: source/gameengine/Ketsji/KX_BoneObject.h =================================================================== --- source/gameengine/Ketsji/KX_BoneObject.h (revision 0) +++ source/gameengine/Ketsji/KX_BoneObject.h (revision 0) @@ -0,0 +1,51 @@ +/** + * $Id: $ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Mitchell Stokes. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file KX_BoneObject.h + * \ingroup ketsji + */ + +#ifndef __KX_BONEOBJECT +#define __KX_BONEOBJECT +#include "KX_GameObject.h" + +class KX_BoneObject : public KX_GameObject +{ +private: + struct Bone *m_bone; +public: + KX_BoneObject(struct Bone *bone, void* sgReplicationInfo,SG_Callbacks callbacks); + virtual ~KX_BoneObject(); + + struct Bone *GetBone(); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneObject"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif +}; + +#endif //__KX_EMPTYOBJECT + Property changes on: source\gameengine\Ketsji\KX_BoneObject.h ___________________________________________________________________ Added: svn:eol-style + native
|