Skip to content

Conversation

@xuhuisheng
Copy link
Contributor

Issue Description

When we create a new instance PackedScene, then create a new Material for this embedded node. The properties of the new material will all read-only, until we save and reopen the scene.

The reason is EditorResourcePicker try to get scene_path from node to locate the resource of material. But embedded node returns its own scene_path, which is different from root scene_path.

if (node) {
if (node->get_scene_file_path().is_empty()) {
node = node->get_owner();
}

The inspector determines we cannot edit embedded scene's property, then mark them as read-only. After saving and reopening scene, the relevant scene path will be corrected, so we can edit these properties.

all_read_only = EditorNode::get_singleton()->is_resource_read_only(res);

Solution

We can use the root scene path of editing scene, when current node path is different.

material.webm

@xuhuisheng xuhuisheng requested a review from a team as a code owner November 3, 2025 02:58
@AThousandShips AThousandShips added bug topic:editor cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Nov 3, 2025
@AThousandShips AThousandShips added this to the 4.6 milestone Nov 3, 2025

Node *node = Object::cast_to<Node>(obj);
if (node) {
String root_path = EditorNode::get_singleton()->get_editor_data().get_edited_scene_root()->get_scene_file_path();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unlikely under normal circumstances, but the scene might not exist. You should check whether root is not null before getting path.

if (node->get_scene_file_path().is_empty()) {
node = node->get_owner();
} else if (root_path != node->get_scene_file_path()) {
// PackedScene should use root scene path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// PackedScene should use root scene path
// PackedScene should use root scene path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release topic:editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All properties are disabled on a PackedScene node

3 participants