فهرست منبع

Make ViewportTexture path be updated relative to its local scene instead of the Viewport owner.

Grandro 11 ماه پیش
والد
کامیت
b214cdd252
1فایلهای تغییر یافته به همراه5 افزوده شده و 9 حذف شده
  1. 5 9
      scene/main/viewport.cpp

+ 5 - 9
scene/main/viewport.cpp

@@ -489,18 +489,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);
 		}
 	}
 }