summaryrefslogtreecommitdiff
path: root/servers/visual
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-12-06 16:41:19 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-12-06 16:41:19 -0300
commit431dfc14585fa12750b2c1ef2e7efaeed6df2f68 (patch)
treef9012630fb897b3645012fc123bda73ded14f289 /servers/visual
parente0c00efb99a760eba3d70276f2f06c1ed0d97242 (diff)
Attempt to see if this can solve the problem with #13338
Diffstat (limited to 'servers/visual')
-rw-r--r--servers/visual/visual_server_scene.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 69827b330d..9db730ec99 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -303,6 +303,17 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
VSG::storage->instance_remove_dependency(instance->base, instance);
+ if (instance->base_type == VS::INSTANCE_GI_PROBE) {
+ //if gi probe is baking, wait until done baking, else race condition may happen when removing it
+ //from octree
+ InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(instance->base_data);
+
+ while (gi_probe->dynamic.updating_stage == GI_UPDATE_STAGE_LIGHTING) {
+ //wait until bake is done if it's baking
+ OS::get_singleton()->delay_usec(1);
+ }
+ }
+
if (scenario && instance->octree_id) {
scenario->octree.erase(instance->octree_id); //make dependencies generated by the octree go away
instance->octree_id = 0;
@@ -331,10 +342,6 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(instance->base_data);
- while (gi_probe->dynamic.updating_stage == GI_UPDATE_STAGE_LIGHTING) {
- //wait until bake is done if it's baking
- OS::get_singleton()->delay_usec(1);
- }
if (gi_probe->update_element.in_list()) {
gi_probe_update_list.remove(&gi_probe->update_element);
}