Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't store shader edit path in metadata #84628

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions editor/plugins/shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ void ShaderEditorPlugin::_update_shader_list() {
}

// When shader is deleted in filesystem dock, need this to correctly close shader editor.
if (!path.is_empty()) {
shader->set_meta("_edit_res_path", path);
}
edited_shader.path = path;

bool unsaved = false;
if (edited_shader.shader_editor) {
Expand Down Expand Up @@ -578,9 +576,9 @@ void ShaderEditorPlugin::_window_changed(bool p_visible) {

void ShaderEditorPlugin::_file_removed(const String &p_removed_file) {
for (uint32_t i = 0; i < edited_shaders.size(); i++) {
const Ref<Shader> &shader = edited_shaders[i].shader;
if (shader->get_meta("_edit_res_path") == p_removed_file) {
if (edited_shaders[i].path == p_removed_file) {
_close_shader(i);
break;
Copy link
Member Author

@KoBeWi KoBeWi Nov 8, 2023

Choose a reason for hiding this comment

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

Only one shader can use a path.

}
}
}
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/shader_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class ShaderEditorPlugin : public EditorPlugin {
Ref<ShaderInclude> shader_inc;
TextShaderEditor *shader_editor = nullptr;
VisualShaderEditor *visual_shader_editor = nullptr;
String path;
};

LocalVector<EditedShader> edited_shaders;
Expand Down
Loading