forked from bartvdbraak/blender
BGE: Fix T33187 constraints replication for libloaded objects.
Reviewers: Moguri
This commit is contained in:
parent
c1506454ec
commit
bccc6c393c
@ -2319,6 +2319,12 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
|||||||
/* Store constraints of grouped and instanced objects for all layers */
|
/* Store constraints of grouped and instanced objects for all layers */
|
||||||
gameobj->AddConstraint(dat);
|
gameobj->AddConstraint(dat);
|
||||||
|
|
||||||
|
/** if it's during libload we only add constraints in the object but
|
||||||
|
* doesn't create it. Constraint will be replicated later in scene->MergeScene
|
||||||
|
*/
|
||||||
|
if (libloading)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Skipped already converted constraints.
|
/* Skipped already converted constraints.
|
||||||
* This will happen when a group instance is made from a linked group instance
|
* This will happen when a group instance is made from a linked group instance
|
||||||
* and both are on the active layer. */
|
* and both are on the active layer. */
|
||||||
|
@ -2064,6 +2064,28 @@ bool KX_Scene::MergeScene(KX_Scene *other)
|
|||||||
MergeScene_GameObject(gameobj, this, other);
|
MergeScene_GameObject(gameobj, this, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (env) {
|
||||||
|
env->MergeEnvironment(env_other);
|
||||||
|
CListValue *otherObjects = other->GetObjectList();
|
||||||
|
|
||||||
|
// List of all physics objects to merge (needed by ReplicateConstraints).
|
||||||
|
std::vector<KX_GameObject *> physicsObjects;
|
||||||
|
for (unsigned int i = 0; i < otherObjects->GetCount(); ++i) {
|
||||||
|
KX_GameObject *gameobj = (KX_GameObject *)otherObjects->GetValue(i);
|
||||||
|
if (gameobj->GetPhysicsController()) {
|
||||||
|
physicsObjects.push_back(gameobj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < physicsObjects.size(); ++i) {
|
||||||
|
KX_GameObject *gameobj = physicsObjects[i];
|
||||||
|
// Replicate all constraints in the right physics environment.
|
||||||
|
gameobj->GetPhysicsController()->ReplicateConstraints(gameobj, physicsObjects);
|
||||||
|
gameobj->ClearConstraints();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GetTempObjectList()->MergeList(other->GetTempObjectList());
|
GetTempObjectList()->MergeList(other->GetTempObjectList());
|
||||||
other->GetTempObjectList()->ReleaseAndRemoveAll();
|
other->GetTempObjectList()->ReleaseAndRemoveAll();
|
||||||
|
|
||||||
@ -2079,9 +2101,6 @@ bool KX_Scene::MergeScene(KX_Scene *other)
|
|||||||
GetLightList()->MergeList(other->GetLightList());
|
GetLightList()->MergeList(other->GetLightList());
|
||||||
other->GetLightList()->ReleaseAndRemoveAll();
|
other->GetLightList()->ReleaseAndRemoveAll();
|
||||||
|
|
||||||
if (env)
|
|
||||||
env->MergeEnvironment(env_other);
|
|
||||||
|
|
||||||
/* move materials across, assume they both use the same scene-converters
|
/* move materials across, assume they both use the same scene-converters
|
||||||
* Do this after lights are merged so materials can use the lights in shaders
|
* Do this after lights are merged so materials can use the lights in shaders
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user