Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h10
-rw-r--r--source/gameengine/Ketsji/KX_SG_NodeRelationships.h6
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp18
-rw-r--r--source/gameengine/SceneGraph/SG_Node.cpp10
-rw-r--r--source/gameengine/SceneGraph/SG_Node.h8
-rw-r--r--source/gameengine/SceneGraph/SG_ParentRelation.h9
6 files changed, 55 insertions, 6 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index b83d63e26bf..5dae59d1d63 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -368,7 +368,15 @@ public:
{
return m_bDyna;
}
-
+
+ /**
+ * Check if this object has a vertex parent relationship
+ */
+ bool IsVertexParent( )
+ {
+ return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
+ }
+
bool RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data);
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
index d83fb79ee25..e53af22408e 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
@@ -129,6 +129,12 @@ public :
~KX_VertexParentRelation(
);
+ bool
+ IsVertexRelation(
+ ) {
+ return true;
+ }
+
private :
KX_VertexParentRelation(
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index 58b87367258..b9792303565 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -69,13 +69,19 @@ KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
m_upflag = upflag;
m_parentobj = 0;
- if (m_object){
+ if (m_object)
m_object->RegisterActuator(this);
- KX_GameObject* curobj = (KX_GameObject*) GetParent();
- m_parentobj = curobj->GetParent(); // check if the object is parented
- if (m_parentobj) { // if so, store the initial local rotation
- m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation();
+ if (gameobj->isA(&KX_GameObject::Type))
+ {
+ // if the object is vertex parented, don't check parent orientation as the link is broken
+ if (!((KX_GameObject*)gameobj)->IsVertexParent()){
+ m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented
+ if (m_parentobj) {
+ // if so, store the initial local rotation
+ // this is needed to revert the effect of the parent inverse node (TBC)
+ m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation();
+ }
}
}
@@ -180,6 +186,8 @@ KX_TrackToActuator::~KX_TrackToActuator()
{
if (m_object)
m_object->UnregisterActuator(this);
+ if (m_parentobj)
+ m_parentobj->Release();
} /* end of destructor */
void KX_TrackToActuator::ProcessReplica()
diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp
index 73e16863173..ff9a9f7f371 100644
--- a/source/gameengine/SceneGraph/SG_Node.cpp
+++ b/source/gameengine/SceneGraph/SG_Node.cpp
@@ -148,6 +148,16 @@ GetRootSGParent(
return (m_SGparent ? (const SG_Node*) m_SGparent->GetRootSGParent() : (const SG_Node*) this);
}
+ bool
+SG_Node::
+IsVertexParent()
+{
+ if (m_parent_relation)
+ {
+ return m_parent_relation->IsVertexRelation();
+ }
+ return false;
+}
void
SG_Node::
diff --git a/source/gameengine/SceneGraph/SG_Node.h b/source/gameengine/SceneGraph/SG_Node.h
index 4808f6f7d94..5cf24de68f3 100644
--- a/source/gameengine/SceneGraph/SG_Node.h
+++ b/source/gameengine/SceneGraph/SG_Node.h
@@ -152,6 +152,14 @@ public:
) ;
+ /**
+ * Return vertex parent status.
+ */
+
+ bool
+ IsVertexParent(
+ ) ;
+
/**
* Update the spatial data of this node. Iterate through
* the children of this node and update their world data.
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h b/source/gameengine/SceneGraph/SG_ParentRelation.h
index 1d211a9f39f..9d360d1c274 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -90,6 +90,15 @@ public :
NewCopy(
) = 0;
+ /**
+ * Vertex Parent Relation are special: they don't propagate rotation
+ */
+ virtual
+ bool
+ IsVertexRelation(
+ ) {
+ return false;
+ }
protected :
/**