mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #110231 from fstxz/fix_shader_path
Fix invalid suggested file name when saving resource from a scene that hasn't been saved yet
This commit is contained in:
commit
f987cf8a8a
2 changed files with 5 additions and 2 deletions
|
@ -4207,7 +4207,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = selected_shader_material->get_path();
|
String path = selected_shader_material->get_path();
|
||||||
if (path.is_empty()) {
|
if (path.get_base_dir().is_empty()) {
|
||||||
String root_path;
|
String root_path;
|
||||||
if (editor_data->get_edited_scene_root()) {
|
if (editor_data->get_edited_scene_root()) {
|
||||||
root_path = editor_data->get_edited_scene_root()->get_scene_file_path();
|
root_path = editor_data->get_edited_scene_root()->get_scene_file_path();
|
||||||
|
@ -4218,6 +4218,9 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
|
||||||
} else {
|
} else {
|
||||||
shader_name = selected_shader_material->get_name();
|
shader_name = selected_shader_material->get_name();
|
||||||
}
|
}
|
||||||
|
if (shader_name.is_empty()) {
|
||||||
|
shader_name = "new_shader";
|
||||||
|
}
|
||||||
if (root_path.is_empty()) {
|
if (root_path.is_empty()) {
|
||||||
path = String("res://").path_join(shader_name);
|
path = String("res://").path_join(shader_name);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1690,7 +1690,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
|
||||||
file->set_current_file(String());
|
file->set_current_file(String());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!p_resource->get_path().is_empty()) {
|
} else if (!p_resource->get_path().get_base_dir().is_empty()) {
|
||||||
file->set_current_path(p_resource->get_path());
|
file->set_current_path(p_resource->get_path());
|
||||||
if (!extensions.is_empty()) {
|
if (!extensions.is_empty()) {
|
||||||
const String ext = p_resource->get_path().get_extension().to_lower();
|
const String ext = p_resource->get_path().get_extension().to_lower();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue