mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 22:21:18 +00:00
Shader editor trims trailing whitespace if set in editor settings
This commit is contained in:
parent
d3415ae5aa
commit
1566b402c1
3 changed files with 28 additions and 4 deletions
|
|
@ -267,18 +267,26 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
|
|||
case FILE_SAVE: {
|
||||
int index = shader_tabs->get_current_tab();
|
||||
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
|
||||
TextShaderEditor *editor = edited_shaders[index].shader_editor;
|
||||
if (editor && editor->get_trim_trailing_whitespace_on_save()) {
|
||||
editor->trim_trailing_whitespace();
|
||||
}
|
||||
if (edited_shaders[index].shader.is_valid()) {
|
||||
EditorNode::get_singleton()->save_resource(edited_shaders[index].shader);
|
||||
} else {
|
||||
EditorNode::get_singleton()->save_resource(edited_shaders[index].shader_inc);
|
||||
}
|
||||
if (edited_shaders[index].shader_editor) {
|
||||
edited_shaders[index].shader_editor->tag_saved_version();
|
||||
if (editor) {
|
||||
editor->tag_saved_version();
|
||||
}
|
||||
} break;
|
||||
case FILE_SAVE_AS: {
|
||||
int index = shader_tabs->get_current_tab();
|
||||
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
|
||||
TextShaderEditor *editor = edited_shaders[index].shader_editor;
|
||||
if (editor && editor->get_trim_trailing_whitespace_on_save()) {
|
||||
editor->trim_trailing_whitespace();
|
||||
}
|
||||
String path;
|
||||
if (edited_shaders[index].shader.is_valid()) {
|
||||
path = edited_shaders[index].shader->get_path();
|
||||
|
|
@ -293,8 +301,8 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
|
|||
}
|
||||
EditorNode::get_singleton()->save_resource_as(edited_shaders[index].shader_inc, path);
|
||||
}
|
||||
if (edited_shaders[index].shader_editor) {
|
||||
edited_shaders[index].shader_editor->tag_saved_version();
|
||||
if (editor) {
|
||||
editor->tag_saved_version();
|
||||
}
|
||||
} break;
|
||||
case FILE_INSPECT: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue