|
@@ -880,7 +880,7 @@ void Viewport::_camera_set(Camera *p_camera) {
|
|
|
if (camera == p_camera)
|
|
|
return;
|
|
|
|
|
|
- if (camera && find_world().is_valid()) {
|
|
|
+ if (camera) {
|
|
|
camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
|
|
|
}
|
|
|
camera = p_camera;
|
|
@@ -889,7 +889,7 @@ void Viewport::_camera_set(Camera *p_camera) {
|
|
|
else
|
|
|
VisualServer::get_singleton()->viewport_attach_camera(viewport, RID());
|
|
|
|
|
|
- if (camera && find_world().is_valid()) {
|
|
|
+ if (camera) {
|
|
|
camera->notification(Camera::NOTIFICATION_BECAME_CURRENT);
|
|
|
}
|
|
|
|
|
@@ -908,9 +908,7 @@ void Viewport::_camera_remove(Camera *p_camera) {
|
|
|
|
|
|
cameras.erase(p_camera);
|
|
|
if (camera == p_camera) {
|
|
|
- if (camera && find_world().is_valid()) {
|
|
|
- camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
|
|
|
- }
|
|
|
+ camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
|
|
|
camera = NULL;
|
|
|
}
|
|
|
}
|
|
@@ -1007,7 +1005,7 @@ void Viewport::_propagate_enter_world(Node *p_node) {
|
|
|
Viewport *v = Object::cast_to<Viewport>(p_node);
|
|
|
if (v) {
|
|
|
|
|
|
- if (v->world.is_valid())
|
|
|
+ if (v->world.is_valid() || v->own_world.is_valid())
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -1044,7 +1042,7 @@ void Viewport::_propagate_exit_world(Node *p_node) {
|
|
|
Viewport *v = Object::cast_to<Viewport>(p_node);
|
|
|
if (v) {
|
|
|
|
|
|
- if (v->world.is_valid())
|
|
|
+ if (v->world.is_valid() || v->own_world.is_valid())
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -1064,23 +1062,11 @@ void Viewport::set_world(const Ref<World> &p_world) {
|
|
|
if (is_inside_tree())
|
|
|
_propagate_exit_world(this);
|
|
|
|
|
|
-#ifndef _3D_DISABLED
|
|
|
- if (find_world().is_valid() && camera)
|
|
|
- camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
|
|
|
-#endif
|
|
|
-
|
|
|
world = p_world;
|
|
|
|
|
|
if (is_inside_tree())
|
|
|
_propagate_enter_world(this);
|
|
|
|
|
|
-#ifndef _3D_DISABLED
|
|
|
- if (find_world().is_valid() && camera)
|
|
|
- camera->notification(Camera::NOTIFICATION_BECAME_CURRENT);
|
|
|
-#endif
|
|
|
-
|
|
|
- //propagate exit
|
|
|
-
|
|
|
if (is_inside_tree()) {
|
|
|
VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario());
|
|
|
}
|
|
@@ -2695,11 +2681,6 @@ void Viewport::set_use_own_world(bool p_world) {
|
|
|
if (is_inside_tree())
|
|
|
_propagate_exit_world(this);
|
|
|
|
|
|
-#ifndef _3D_DISABLED
|
|
|
- if (find_world().is_valid() && camera)
|
|
|
- camera->notification(Camera::NOTIFICATION_LOST_CURRENT);
|
|
|
-#endif
|
|
|
-
|
|
|
if (!p_world)
|
|
|
own_world = Ref<World>();
|
|
|
else
|
|
@@ -2708,13 +2689,6 @@ void Viewport::set_use_own_world(bool p_world) {
|
|
|
if (is_inside_tree())
|
|
|
_propagate_enter_world(this);
|
|
|
|
|
|
-#ifndef _3D_DISABLED
|
|
|
- if (find_world().is_valid() && camera)
|
|
|
- camera->notification(Camera::NOTIFICATION_BECAME_CURRENT);
|
|
|
-#endif
|
|
|
-
|
|
|
- //propagate exit
|
|
|
-
|
|
|
if (is_inside_tree()) {
|
|
|
VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario());
|
|
|
}
|