Fix invalid suggested file name when saving resource from a scene that hasn't been saved yet
This commit is contained in:
@ -4204,7 +4204,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
|
||||
}
|
||||
|
||||
String path = selected_shader_material->get_path();
|
||||
if (path.is_empty()) {
|
||||
if (path.get_base_dir().is_empty()) {
|
||||
String root_path;
|
||||
if (editor_data->get_edited_scene_root()) {
|
||||
root_path = editor_data->get_edited_scene_root()->get_scene_file_path();
|
||||
@ -4215,6 +4215,9 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
|
||||
} else {
|
||||
shader_name = selected_shader_material->get_name();
|
||||
}
|
||||
if (shader_name.is_empty()) {
|
||||
shader_name = "new_shader";
|
||||
}
|
||||
if (root_path.is_empty()) {
|
||||
path = String("res://").path_join(shader_name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user