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:
authorCampbell Barton <ideasman42@gmail.com>2009-04-22 18:42:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-22 18:42:00 +0400
commit5553d2c0142539c754575ce471c2676e0d5dff34 (patch)
tree7842bd82afbc5cf797594dbee03fb881039e37b9 /source/gameengine/Expressions/Value.cpp
parenta8592d09d0173bab0e3eb66a315146e164cf14a4 (diff)
BGE C++ API
PyObjectPlus::ProcessReplica() is now called when any of its subclasses are replicated. This is important because PyObjectPlus::ProcessReplica() NULL's the 'm_proxy' python pointer I added recently. Without this a replicated subclass of PyObjectPlus could have an invalid pointer (crashing the BGE). This change also means CValue::AddDataToReplica() can be moved into CValue::ProcessReplica() since ProcessReplica is always called.
Diffstat (limited to 'source/gameengine/Expressions/Value.cpp')
-rw-r--r--source/gameengine/Expressions/Value.cpp50
1 files changed, 20 insertions, 30 deletions
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 106bd1256a6..b5aca518e88 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -439,27 +439,6 @@ int CValue::GetPropertyCount()
}
-
-
-
-void CValue::CloneProperties(CValue *replica)
-{
-
- if (m_pNamedPropertyArray)
- {
- replica->m_pNamedPropertyArray=NULL;
- std::map<STR_String,CValue*>::iterator it;
- for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
- {
- CValue *val = (*it).second->GetReplica();
- replica->SetProperty((*it).first,val);
- val->Release();
- }
- }
-
-
-}
-
double* CValue::GetVector3(bool bGetTransformedVec)
{
assertd(false); // don;t get vector from me
@@ -534,22 +513,33 @@ void CValue::DisableRefCount()
-void CValue::AddDataToReplica(CValue *replica)
+void CValue::ProcessReplica() /* was AddDataToReplica in 2.48 */
{
- replica->m_refcount = 1;
-
+ m_refcount = 1;
+
#ifdef _DEBUG
//gRefCountValue++;
#endif
- replica->m_ValFlags.RefCountDisabled = false;
+ PyObjectPlus::ProcessReplica();
- replica->ReplicaSetName(GetName());
-
- //copy all props
- CloneProperties(replica);
-}
+ m_ValFlags.RefCountDisabled = false;
+ ReplicaSetName(GetName());
+ /* copy all props */
+ if (m_pNamedPropertyArray)
+ {
+ std::map<STR_String,CValue*> *pOldArray = m_pNamedPropertyArray;
+ m_pNamedPropertyArray=NULL;
+ std::map<STR_String,CValue*>::iterator it;
+ for (it= pOldArray->begin(); (it != pOldArray->end()); it++)
+ {
+ CValue *val = (*it).second->GetReplica();
+ SetProperty((*it).first,val);
+ val->Release();
+ }
+ }
+}
CValue* CValue::FindIdentifier(const STR_String& identifiername)
{