mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 15:11:19 +00:00
Improved text editor status bar and zooming UX.
This commit is contained in:
parent
16d61427ca
commit
9281c441f6
12 changed files with 321 additions and 251 deletions
|
|
@ -143,7 +143,6 @@ void ShaderEditorPlugin::edit(Object *p_object) {
|
|||
es.shader_editor = memnew(TextShaderEditor);
|
||||
es.shader_editor->edit(si);
|
||||
shader_tabs->add_child(es.shader_editor);
|
||||
es.shader_editor->connect("validation_changed", callable_mp(this, &ShaderEditorPlugin::_update_shader_list));
|
||||
} else {
|
||||
Shader *s = Object::cast_to<Shader>(p_object);
|
||||
for (uint32_t i = 0; i < edited_shaders.size(); i++) {
|
||||
|
|
@ -163,7 +162,16 @@ void ShaderEditorPlugin::edit(Object *p_object) {
|
|||
es.shader_editor = memnew(TextShaderEditor);
|
||||
shader_tabs->add_child(es.shader_editor);
|
||||
es.shader_editor->edit(s);
|
||||
es.shader_editor->connect("validation_changed", callable_mp(this, &ShaderEditorPlugin::_update_shader_list));
|
||||
}
|
||||
}
|
||||
|
||||
if (es.shader_editor) {
|
||||
es.shader_editor->connect("validation_changed", callable_mp(this, &ShaderEditorPlugin::_update_shader_list));
|
||||
|
||||
CodeTextEditor *cte = es.shader_editor->get_code_editor();
|
||||
if (cte) {
|
||||
cte->set_zoom_factor(text_shader_zoom_factor);
|
||||
cte->connect("zoomed", callable_mp(this, &ShaderEditorPlugin::_set_text_shader_zoom_factor));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +252,8 @@ void ShaderEditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
|
|||
|
||||
_update_shader_list();
|
||||
_shader_selected(selected_shader_idx);
|
||||
|
||||
_set_text_shader_zoom_factor(p_layout->get_value("ShaderEditor", "text_shader_zoom_factor", 1.0f));
|
||||
}
|
||||
|
||||
void ShaderEditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
|
||||
|
|
@ -290,6 +300,7 @@ void ShaderEditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
|
|||
p_layout->set_value("ShaderEditor", "open_shaders", shaders);
|
||||
p_layout->set_value("ShaderEditor", "split_offset", main_split->get_split_offset());
|
||||
p_layout->set_value("ShaderEditor", "selected_shader", selected_shader);
|
||||
p_layout->set_value("ShaderEditor", "text_shader_zoom_factor", text_shader_zoom_factor);
|
||||
}
|
||||
|
||||
String ShaderEditorPlugin::get_unsaved_status(const String &p_for_scene) const {
|
||||
|
|
@ -590,6 +601,20 @@ void ShaderEditorPlugin::_window_changed(bool p_visible) {
|
|||
make_floating->set_visible(!p_visible);
|
||||
}
|
||||
|
||||
void ShaderEditorPlugin::_set_text_shader_zoom_factor(float p_zoom_factor) {
|
||||
if (text_shader_zoom_factor != p_zoom_factor) {
|
||||
text_shader_zoom_factor = p_zoom_factor;
|
||||
for (const EditedShader &edited_shader : edited_shaders) {
|
||||
if (edited_shader.shader_editor) {
|
||||
CodeTextEditor *cte = edited_shader.shader_editor->get_code_editor();
|
||||
if (cte && cte->get_zoom_factor() != text_shader_zoom_factor) {
|
||||
cte->set_zoom_factor(text_shader_zoom_factor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShaderEditorPlugin::_file_removed(const String &p_removed_file) {
|
||||
for (uint32_t i = 0; i < edited_shaders.size(); i++) {
|
||||
if (edited_shaders[i].path == p_removed_file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue