Commit: 8468a28467582b9ff6022e2a6863635b33569b70
Author: Ines Almeida
Date:   Wed Jul 23 15:50:40 2014 +0100
Branches: soc-2014-bge
https://developer.blender.org/rB8468a28467582b9ff6022e2a6863635b33569b70

gameengine: scenegraph corrections

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

M       source/gameengine/Converter/BL_BlenderDataConversion.cpp
M       source/gameengine/Ketsji/KX_GameObject.cpp
M       source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
M       source/gameengine/Ketsji/KX_SG_NodeRelationships.h
M       source/gameengine/SceneGraph/SG_Node.cpp
M       source/gameengine/SceneGraph/SG_ParentRelation.h
M       source/gameengine/SceneGraph/SG_Spatial.cpp
M       source/gameengine/SceneGraph/SG_Spatial.h

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

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 845ab8c..4f8daa5 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1763,10 +1763,14 @@ static void bl_ConvertBlenderObject_Single(
 
        MT_Matrix3x3 rotation;
        float rotmat[3][3];
-       BKE_object_rot_to_mat3(blenderobject, rotmat, false);
+       BKE_object_rot_to_mat3(blenderobject, rotmat, true);
        rotation.setValue3x3((float*)rotmat);
 
-       MT_Vector3 scale(blenderobject->size);
+       MT_Vector3 scale(
+               blenderobject->size[0]*blenderobject->dscale[0],
+               blenderobject->size[1]*blenderobject->dscale[1],
+               blenderobject->size[2]*blenderobject->dscale[2]
+       );
 
        gameobj->NodeSetLocalPosition(pos);
        gameobj->NodeSetLocalOrientation(rotation);
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 58b7d13..5b237ac 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -599,7 +599,7 @@ void KX_GameObject::ApplyMovement(const MT_Vector3& 
dloc,bool local)
                {
                        m_pPhysicsController->RelativeTranslate(dloc,local);
                }
-               
GetSGNode()->RelativeTranslate(dloc,GetSGNode()->GetSGParent(),local);
+               GetSGNode()->RelativeTranslate(dloc,local);
        }
 }
 
diff --git a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h 
b/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
index ca99c2e..e5d1c09 100644
--- a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
+++ b/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
@@ -36,6 +36,7 @@ enum  e_PhysicsEngine
 {
                NoSelection = -1,
                UseNone     =  0,
+               /* UseEnji=1, UseSumo, useDynamo and useODE were removed */
                UseBullet   =  5,
 };
 
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h 
b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
index c9a7a03..0f4e3fb 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
@@ -171,4 +171,4 @@ private :
 #endif
 };
 
-#endif * __KX_SG_NODERELATIONSHIPS_H__ */
+#endif /* __KX_SG_NODERELATIONSHIPS_H__ */
diff --git a/source/gameengine/SceneGraph/SG_Node.cpp 
b/source/gameengine/SceneGraph/SG_Node.cpp
index 3e69658..1a2597e 100644
--- a/source/gameengine/SceneGraph/SG_Node.cpp
+++ b/source/gameengine/SceneGraph/SG_Node.cpp
@@ -170,9 +170,6 @@ void SG_Node::RemoveChild(SG_Node* child)
 
 void SG_Node::UpdateWorldData(double time, bool parentUpdated)
 {
-       //if (!GetSGParent())
-       //      return;
-
        if (UpdateSpatialData(GetSGParent(),time,parentUpdated))
                // to update the 
                ActivateUpdateTransformCallback();
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h 
b/source/gameengine/SceneGraph/SG_ParentRelation.h
index f83b20b..493fcd0 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -66,7 +66,7 @@ public :
         */
        virtual bool UpdateChildCoordinates(SG_Spatial * child, const 
SG_Spatial * parent, bool& parentUpdated) = 0;
 
-       /* XXXX */
+       /* Destructor */
        virtual ~SG_ParentRelation() {}
 
        /** 
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp 
b/source/gameengine/SceneGraph/SG_Spatial.cpp
index 1438ffc..c8edc13 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -97,10 +97,8 @@ bool SG_Spatial::UpdateSpatialData(const SG_Spatial *parent, 
double time, bool&
        bool bComputesWorldTransform = false;
 
        // update spatial controllers
-
        SGControllerList::iterator cit = GetSGControllerList().begin();
        SGControllerList::const_iterator c_end = GetSGControllerList().end();
-
        for (;cit!=c_end;++cit)
        {
                if ((*cit)->Update(time))
@@ -110,44 +108,24 @@ bool SG_Spatial::UpdateSpatialData(const SG_Spatial 
*parent, double time, bool&
        // If none of the objects updated our values then we ask the
        // parent_relation object owned by this class to update
        // our world coordinates.
-
        if (!bComputesWorldTransform)
                bComputesWorldTransform = ComputeWorldTransforms(parent, 
parentUpdated);
 
        return bComputesWorldTransform;
 }
 
-/**
- * Position and translation methods
- */
 
-void SG_Spatial::RelativeTranslate(const MT_Vector3& trans, const SG_Spatial 
*parent, bool local)
+
+void SG_Spatial::RelativeTranslate(const MT_Vector3& trans, bool local)
 {
        if (local) {
-               m_localPosition += m_localRotation * trans;
-       }
-       else {
-               if (parent) {
-                       m_localPosition += trans * 
parent->GetWorldOrientation();
-               }
-               else {
-                       m_localPosition += trans;
-               }
+               m_localPosition += m_localScaling * (m_localRotation * trans);
+       } else {
+               m_localPosition += trans;
        }
        SetModified();
 }
 
-
-/**
- * Scaling methods.
- */ 
-
-
-/**
- * Orientation and rotation methods.
- */
-
-
 void SG_Spatial::RelativeRotate(const MT_Matrix3x3& rot, bool local) {
        m_localRotation = m_localRotation * (
                local ?
@@ -158,6 +136,7 @@ void SG_Spatial::RelativeRotate(const MT_Matrix3x3& rot, 
bool local) {
 
 
 
+
 MT_Transform SG_Spatial::GetWorldTransform() const
 {
        return MT_Transform(m_worldPosition, 
diff --git a/source/gameengine/SceneGraph/SG_Spatial.h 
b/source/gameengine/SceneGraph/SG_Spatial.h
index f9fa47a..bacae60 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.h
+++ b/source/gameengine/SceneGraph/SG_Spatial.h
@@ -107,14 +107,10 @@ public:
 
        /**
         * Apply a translation relative to the current position.
-        * if local then the translation is assumed to be in the 
-        * local coordinates of this object. If not then the translation
-        * is assumed to be in global coordinates. In this case 
-        * you must provide a pointer to the parent of this object if it 
-        * exists otherwise if there is no parent set it to NULL
+        * If local then the translation is assumed to be in the local 
coordinates of this object.
+        * If not then the translation is assumed to be in global coordinates.
         */ 
-
-       void RelativeTranslate(const MT_Vector3& trans, const SG_Spatial 
*parent, bool local);
+       void RelativeTranslate(const MT_Vector3& trans, bool local);
 
        void SetLocalPosition(const MT_Point3& trans)
        {

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

Reply via email to