Explorar o código

Merge pull request #97861 from Grandro/fix-update-viewport-path

Update ViewportTexture path relative to its local scene instead of the Viewport owner
Thaddeus Crews hai 5 meses
pai
achega
df758feae5
Modificáronse 1 ficheiros con 5 adicións e 9 borrados
  1. 5 9
      scene/main/viewport.cpp

+ 5 - 9
scene/main/viewport.cpp

@@ -502,18 +502,14 @@ int Viewport::_sub_window_find(Window *p_window) const {
 }
 
 void Viewport::_update_viewport_path() {
-	if (viewport_textures.is_empty()) {
+	if (!is_inside_tree()) {
 		return;
 	}
 
-	Node *scene_root = get_scene_file_path().is_empty() ? get_owner() : this;
-	if (!scene_root && is_inside_tree()) {
-		scene_root = get_tree()->get_edited_scene_root();
-	}
-	if (scene_root && (scene_root == this || scene_root->is_ancestor_of(this))) {
-		NodePath path_in_scene = scene_root->get_path_to(this);
-		for (ViewportTexture *E : viewport_textures) {
-			E->path = path_in_scene;
+	for (ViewportTexture *E : viewport_textures) {
+		Node *loc_scene = E->get_local_scene();
+		if (loc_scene) {
+			E->path = loc_scene->get_path_to(this);
 		}
 	}
 }