Merge pull request #105124 from Calinou/script-shader-editor-unify-toggle-files-panel
Unify Scripts Panel naming for the script and shader editors
This commit is contained in:
commit
758ce02fcc
15 changed files with 97 additions and 97 deletions
|
|
@ -1634,10 +1634,10 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) {
|
|||
emit_signal(SNAME("show_warnings_panel"), p_show);
|
||||
}
|
||||
|
||||
void CodeTextEditor::_toggle_scripts_pressed() {
|
||||
ERR_FAIL_NULL(toggle_scripts_list);
|
||||
toggle_scripts_list->set_visible(!toggle_scripts_list->is_visible());
|
||||
update_toggle_scripts_button();
|
||||
void CodeTextEditor::_toggle_files_pressed() {
|
||||
ERR_FAIL_NULL(toggle_files_list);
|
||||
toggle_files_list->set_visible(!toggle_files_list->is_visible());
|
||||
update_toggle_files_button();
|
||||
}
|
||||
|
||||
void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
||||
|
|
@ -1655,22 +1655,22 @@ void CodeTextEditor::_notification(int p_what) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
if (toggle_scripts_button->is_visible()) {
|
||||
update_toggle_scripts_button();
|
||||
if (toggle_files_button->is_visible()) {
|
||||
update_toggle_files_button();
|
||||
}
|
||||
_update_text_editor_theme();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||
case NOTIFICATION_TRANSLATION_CHANGED: {
|
||||
if (toggle_scripts_button->is_visible()) {
|
||||
update_toggle_scripts_button();
|
||||
if (toggle_files_button->is_visible()) {
|
||||
update_toggle_files_button();
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
if (toggle_scripts_button->is_visible()) {
|
||||
update_toggle_scripts_button();
|
||||
if (toggle_files_button->is_visible()) {
|
||||
update_toggle_files_button();
|
||||
}
|
||||
set_process_input(is_visible_in_tree());
|
||||
} break;
|
||||
|
|
@ -1827,18 +1827,18 @@ void CodeTextEditor::set_code_complete_func(CodeTextEditorCodeCompleteFunc p_cod
|
|||
}
|
||||
|
||||
void CodeTextEditor::set_toggle_list_control(Control *p_control) {
|
||||
toggle_scripts_list = p_control;
|
||||
toggle_files_list = p_control;
|
||||
}
|
||||
|
||||
void CodeTextEditor::show_toggle_scripts_button() {
|
||||
toggle_scripts_button->show();
|
||||
void CodeTextEditor::show_toggle_files_button() {
|
||||
toggle_files_button->show();
|
||||
}
|
||||
|
||||
void CodeTextEditor::update_toggle_scripts_button() {
|
||||
ERR_FAIL_NULL(toggle_scripts_list);
|
||||
bool forward = toggle_scripts_list->is_visible() == is_layout_rtl();
|
||||
toggle_scripts_button->set_button_icon(get_editor_theme_icon(forward ? SNAME("Forward") : SNAME("Back")));
|
||||
toggle_scripts_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text()));
|
||||
void CodeTextEditor::update_toggle_files_button() {
|
||||
ERR_FAIL_NULL(toggle_files_list);
|
||||
bool forward = toggle_files_list->is_visible() == is_layout_rtl();
|
||||
toggle_files_button->set_button_icon(get_editor_theme_icon(forward ? SNAME("Forward") : SNAME("Back")));
|
||||
toggle_files_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Files Panel"), ED_GET_SHORTCUT("script_editor/toggle_files_panel")->get_as_text()));
|
||||
}
|
||||
|
||||
CodeTextEditor::CodeTextEditor() {
|
||||
|
|
@ -1875,13 +1875,13 @@ CodeTextEditor::CodeTextEditor() {
|
|||
error_line = 0;
|
||||
error_column = 0;
|
||||
|
||||
toggle_scripts_button = memnew(Button);
|
||||
toggle_scripts_button->set_flat(true);
|
||||
toggle_scripts_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
|
||||
toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed));
|
||||
toggle_scripts_button->set_accessibility_name(TTRC("Scripts"));
|
||||
status_bar->add_child(toggle_scripts_button);
|
||||
toggle_scripts_button->hide();
|
||||
toggle_files_button = memnew(Button);
|
||||
toggle_files_button->set_flat(true);
|
||||
toggle_files_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
|
||||
toggle_files_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_toggle_files_pressed));
|
||||
toggle_files_button->set_accessibility_name(TTRC("Scripts"));
|
||||
status_bar->add_child(toggle_files_button);
|
||||
toggle_files_button->hide();
|
||||
|
||||
// Error
|
||||
ScrollContainer *scroll = memnew(ScrollContainer);
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ class CodeTextEditor : public VBoxContainer {
|
|||
FindReplaceBar *find_replace_bar = nullptr;
|
||||
HBoxContainer *status_bar = nullptr;
|
||||
|
||||
Button *toggle_scripts_button = nullptr;
|
||||
Control *toggle_scripts_list = nullptr;
|
||||
Button *toggle_files_button = nullptr;
|
||||
Control *toggle_files_list = nullptr;
|
||||
Button *error_button = nullptr;
|
||||
Button *warning_button = nullptr;
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ class CodeTextEditor : public VBoxContainer {
|
|||
|
||||
void _zoom_popup_id_pressed(int p_idx);
|
||||
|
||||
void _toggle_scripts_pressed();
|
||||
void _toggle_files_pressed();
|
||||
|
||||
protected:
|
||||
virtual void _load_theme_settings() {}
|
||||
|
|
@ -298,8 +298,8 @@ public:
|
|||
void validate_script();
|
||||
|
||||
void set_toggle_list_control(Control *p_control);
|
||||
void show_toggle_scripts_button();
|
||||
void update_toggle_scripts_button();
|
||||
void show_toggle_files_button();
|
||||
void update_toggle_files_button();
|
||||
|
||||
CodeTextEditor();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3197,9 +3197,9 @@ void EditorHelp::generate_doc(bool p_use_cache, bool p_use_script_cache) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorHelp::_toggle_scripts_pressed() {
|
||||
ScriptEditor::get_singleton()->toggle_scripts_panel();
|
||||
update_toggle_scripts_button();
|
||||
void EditorHelp::_toggle_files_pressed() {
|
||||
ScriptEditor::get_singleton()->toggle_files_panel();
|
||||
update_toggle_files_button();
|
||||
}
|
||||
|
||||
void EditorHelp::_notification(int p_what) {
|
||||
|
|
@ -3233,13 +3233,13 @@ void EditorHelp::_notification(int p_what) {
|
|||
if (is_inside_tree()) {
|
||||
_class_desc_resized(true);
|
||||
}
|
||||
update_toggle_scripts_button();
|
||||
update_toggle_files_button();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
|
||||
case NOTIFICATION_TRANSLATION_CHANGED:
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
update_toggle_scripts_button();
|
||||
update_toggle_files_button();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3308,13 +3308,13 @@ void EditorHelp::set_scroll(int p_scroll) {
|
|||
class_desc->get_v_scroll_bar()->set_value(p_scroll);
|
||||
}
|
||||
|
||||
void EditorHelp::update_toggle_scripts_button() {
|
||||
void EditorHelp::update_toggle_files_button() {
|
||||
if (is_layout_rtl()) {
|
||||
toggle_scripts_button->set_button_icon(get_editor_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Forward") : SNAME("Back")));
|
||||
toggle_files_button->set_button_icon(get_editor_theme_icon(ScriptEditor::get_singleton()->is_files_panel_toggled() ? SNAME("Forward") : SNAME("Back")));
|
||||
} else {
|
||||
toggle_scripts_button->set_button_icon(get_editor_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Back") : SNAME("Forward")));
|
||||
toggle_files_button->set_button_icon(get_editor_theme_icon(ScriptEditor::get_singleton()->is_files_panel_toggled() ? SNAME("Back") : SNAME("Forward")));
|
||||
}
|
||||
toggle_scripts_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text()));
|
||||
toggle_files_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Files Panel"), ED_GET_SHORTCUT("script_editor/toggle_files_panel")->get_as_text()));
|
||||
}
|
||||
|
||||
void EditorHelp::_bind_methods() {
|
||||
|
|
@ -3357,11 +3357,11 @@ EditorHelp::EditorHelp() {
|
|||
status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
status_bar->set_custom_minimum_size(Size2(0, 24 * EDSCALE));
|
||||
|
||||
toggle_scripts_button = memnew(Button);
|
||||
toggle_scripts_button->set_accessibility_name(TTRC("Scripts"));
|
||||
toggle_scripts_button->set_flat(true);
|
||||
toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelp::_toggle_scripts_pressed));
|
||||
status_bar->add_child(toggle_scripts_button);
|
||||
toggle_files_button = memnew(Button);
|
||||
toggle_files_button->set_accessibility_name(TTRC("Scripts"));
|
||||
toggle_files_button->set_flat(true);
|
||||
toggle_files_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelp::_toggle_files_pressed));
|
||||
status_bar->add_child(toggle_files_button);
|
||||
|
||||
class_desc->set_selection_enabled(true);
|
||||
class_desc->set_context_menu_enabled(true);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class EditorHelp : public VBoxContainer {
|
|||
LineEdit *search = nullptr;
|
||||
FindBar *find_bar = nullptr;
|
||||
HBoxContainer *status_bar = nullptr;
|
||||
Button *toggle_scripts_button = nullptr;
|
||||
Button *toggle_files_button = nullptr;
|
||||
|
||||
String base_path;
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ class EditorHelp : public VBoxContainer {
|
|||
void _request_help(const String &p_string);
|
||||
void _search(bool p_search_previous = false);
|
||||
|
||||
void _toggle_scripts_pressed();
|
||||
void _toggle_files_pressed();
|
||||
|
||||
inline static int doc_generation_count = 0;
|
||||
inline static String doc_version_hash;
|
||||
|
|
@ -264,7 +264,7 @@ public:
|
|||
int get_scroll() const;
|
||||
void set_scroll(int p_scroll);
|
||||
|
||||
void update_toggle_scripts_button();
|
||||
void update_toggle_files_button();
|
||||
|
||||
static void init_gdext_pointers();
|
||||
|
||||
|
|
|
|||
|
|
@ -1304,13 +1304,13 @@ TypedArray<Script> ScriptEditor::_get_open_scripts() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool ScriptEditor::toggle_scripts_panel() {
|
||||
bool ScriptEditor::toggle_files_panel() {
|
||||
list_split->set_visible(!list_split->is_visible());
|
||||
EditorSettings::get_singleton()->set_project_metadata("scripts_panel", "show_scripts_panel", list_split->is_visible());
|
||||
EditorSettings::get_singleton()->set_project_metadata("files_panel", "show_files_panel", list_split->is_visible());
|
||||
return list_split->is_visible();
|
||||
}
|
||||
|
||||
bool ScriptEditor::is_scripts_panel_toggled() {
|
||||
bool ScriptEditor::is_files_panel_toggled() {
|
||||
return list_split->is_visible();
|
||||
}
|
||||
|
||||
|
|
@ -1438,15 +1438,15 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
_sort_list_on_update = true;
|
||||
_update_script_names();
|
||||
} break;
|
||||
case TOGGLE_SCRIPTS_PANEL: {
|
||||
toggle_scripts_panel();
|
||||
case TOGGLE_FILES_PANEL: {
|
||||
toggle_files_panel();
|
||||
if (current) {
|
||||
current->update_toggle_scripts_button();
|
||||
current->update_toggle_files_button();
|
||||
} else {
|
||||
Control *tab = tab_container->get_current_tab_control();
|
||||
EditorHelp *editor_help = Object::cast_to<EditorHelp>(tab);
|
||||
if (editor_help) {
|
||||
editor_help->update_toggle_scripts_button();
|
||||
editor_help->update_toggle_files_button();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3476,7 +3476,7 @@ void ScriptEditor::_make_script_list_context_menu() {
|
|||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_up"), WINDOW_MOVE_UP);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_down"), WINDOW_MOVE_DOWN);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_sort"), WINDOW_SORT);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_scripts_panel"), TOGGLE_SCRIPTS_PANEL);
|
||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), TOGGLE_FILES_PANEL);
|
||||
|
||||
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() <= 0);
|
||||
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
|
||||
|
|
@ -4222,7 +4222,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|||
overview_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
list_split->add_child(overview_vbox);
|
||||
list_split->set_visible(EditorSettings::get_singleton()->get_project_metadata("scripts_panel", "show_scripts_panel", true));
|
||||
list_split->set_visible(EditorSettings::get_singleton()->get_project_metadata("files_panel", "show_files_panel", true));
|
||||
buttons_hbox = memnew(HBoxContainer);
|
||||
overview_vbox->add_child(buttons_hbox);
|
||||
|
||||
|
|
@ -4355,7 +4355,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTRC("Run"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::X), FILE_RUN);
|
||||
|
||||
file_menu->get_popup()->add_separator();
|
||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTRC("Toggle Scripts Panel"), KeyModifierMask::CMD_OR_CTRL | Key::BACKSLASH), TOGGLE_SCRIPTS_PANEL);
|
||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_files_panel", TTRC("Toggle Files Panel"), KeyModifierMask::CMD_OR_CTRL | Key::BACKSLASH), TOGGLE_FILES_PANEL);
|
||||
file_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_menu_option));
|
||||
file_menu->get_popup()->connect("about_to_popup", callable_mp(this, &ScriptEditor::_prepare_file_menu));
|
||||
file_menu->get_popup()->connect("popup_hide", callable_mp(this, &ScriptEditor::_file_menu_closed));
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public:
|
|||
virtual void update_settings() = 0;
|
||||
virtual void set_debugger_active(bool p_active) = 0;
|
||||
virtual bool can_lose_focus_on_node_selection() { return true; }
|
||||
virtual void update_toggle_scripts_button() {}
|
||||
virtual void update_toggle_files_button() {}
|
||||
|
||||
virtual bool show_members_overview() = 0;
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ class ScriptEditor : public PanelContainer {
|
|||
CLOSE_DOCS,
|
||||
CLOSE_ALL,
|
||||
CLOSE_OTHER_TABS,
|
||||
TOGGLE_SCRIPTS_PANEL,
|
||||
TOGGLE_FILES_PANEL,
|
||||
SHOW_IN_FILE_SYSTEM,
|
||||
FILE_COPY_PATH,
|
||||
FILE_COPY_UID,
|
||||
|
|
@ -545,8 +545,8 @@ protected:
|
|||
public:
|
||||
static ScriptEditor *get_singleton() { return script_editor; }
|
||||
|
||||
bool toggle_scripts_panel();
|
||||
bool is_scripts_panel_toggled();
|
||||
bool toggle_files_panel();
|
||||
bool is_files_panel_toggled();
|
||||
void apply_scripts() const;
|
||||
void reload_scripts(bool p_refresh_only = false);
|
||||
void open_script_create_dialog(const String &p_base_name, const String &p_base_path);
|
||||
|
|
|
|||
|
|
@ -1227,8 +1227,8 @@ String ScriptTextEditor::_get_absolute_path(const String &rel_path) {
|
|||
return path.replace("///", "//").simplify_path();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::update_toggle_scripts_button() {
|
||||
code_editor->update_toggle_scripts_button();
|
||||
void ScriptTextEditor::update_toggle_files_button() {
|
||||
code_editor->update_toggle_files_button();
|
||||
}
|
||||
|
||||
void ScriptTextEditor::_update_connected_methods() {
|
||||
|
|
@ -2382,7 +2382,7 @@ void ScriptTextEditor::_enable_code_editor() {
|
|||
code_editor->get_text_editor()->connect("gutter_removed", callable_mp(this, &ScriptTextEditor::_update_gutter_indexes));
|
||||
code_editor->get_text_editor()->connect("gutter_clicked", callable_mp(this, &ScriptTextEditor::_gutter_clicked));
|
||||
code_editor->get_text_editor()->connect(SceneStringName(gui_input), callable_mp(this, &ScriptTextEditor::_text_edit_gui_input));
|
||||
code_editor->show_toggle_scripts_button();
|
||||
code_editor->show_toggle_files_button();
|
||||
_update_gutter_indexes();
|
||||
|
||||
editor_box->add_child(warnings_panel);
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public:
|
|||
|
||||
virtual void add_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
||||
virtual void set_syntax_highlighter(Ref<EditorSyntaxHighlighter> p_highlighter) override;
|
||||
void update_toggle_scripts_button() override;
|
||||
void update_toggle_files_button() override;
|
||||
|
||||
virtual void apply_code() override;
|
||||
virtual Ref<Resource> get_edited_resource() const override;
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ void ShaderEditorPlugin::_setup_popup_menu(PopupMenuType p_type, PopupMenu *p_me
|
|||
p_menu->add_separator();
|
||||
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
|
||||
p_menu->add_separator();
|
||||
p_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_scripts_panel"), TOGGLE_SHADERS_PANEL);
|
||||
p_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/toggle_files_panel"), TOGGLE_FILES_PANEL);
|
||||
} else {
|
||||
p_menu->add_shortcut(ED_SHORTCUT("shader_editor/close_file", TTRC("Close File"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
|
||||
p_menu->add_item(TTR("Close All"), CLOSE_ALL);
|
||||
|
|
@ -610,18 +610,18 @@ void ShaderEditorPlugin::_menu_item_pressed(int p_index) {
|
|||
Ref<Resource> shader = _get_current_shader();
|
||||
DisplayServer::get_singleton()->clipboard_set(shader->get_path());
|
||||
} break;
|
||||
case TOGGLE_SHADERS_PANEL: {
|
||||
case TOGGLE_FILES_PANEL: {
|
||||
left_panel->set_visible(!left_panel->is_visible());
|
||||
|
||||
int index = shader_tabs->get_current_tab();
|
||||
ERR_FAIL_INDEX(index, shader_tabs->get_tab_count());
|
||||
TextShaderEditor *editor = Object::cast_to<TextShaderEditor>(edited_shaders[index].shader_editor);
|
||||
if (editor) {
|
||||
editor->get_code_editor()->update_toggle_scripts_button();
|
||||
editor->get_code_editor()->update_toggle_files_button();
|
||||
} else {
|
||||
VisualShaderEditor *vs_editor = Object::cast_to<VisualShaderEditor>(edited_shaders[index].shader_editor);
|
||||
if (vs_editor) {
|
||||
vs_editor->update_toggle_scripts_button();
|
||||
vs_editor->update_toggle_files_button();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
|
@ -779,7 +779,7 @@ void ShaderEditorPlugin::_switch_to_editor(ShaderEditor *p_editor) {
|
|||
|
||||
VisualShaderEditor *vs_editor = Object::cast_to<VisualShaderEditor>(p_editor);
|
||||
if (vs_editor) {
|
||||
file_menu_index = 2; // Toggle Scripts Panel button + separator
|
||||
file_menu_index = 2; // Toggle Files Panel button + separator
|
||||
}
|
||||
|
||||
file_menu->get_parent()->remove_child(file_menu);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class ShaderEditorPlugin : public EditorPlugin {
|
|||
CLOSE_OTHER_TABS,
|
||||
SHOW_IN_FILE_SYSTEM,
|
||||
COPY_PATH,
|
||||
TOGGLE_SHADERS_PANEL,
|
||||
TOGGLE_FILES_PANEL,
|
||||
};
|
||||
|
||||
enum PopupMenuType {
|
||||
|
|
|
|||
|
|
@ -601,8 +601,8 @@ void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is
|
|||
context_menu->popup();
|
||||
}
|
||||
|
||||
void TextEditor::update_toggle_scripts_button() {
|
||||
code_editor->update_toggle_scripts_button();
|
||||
void TextEditor::update_toggle_files_button() {
|
||||
code_editor->update_toggle_files_button();
|
||||
}
|
||||
|
||||
TextEditor::TextEditor() {
|
||||
|
|
@ -613,7 +613,7 @@ TextEditor::TextEditor() {
|
|||
code_editor->connect("validate_script", callable_mp(this, &TextEditor::_validate_script));
|
||||
code_editor->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
|
||||
code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
code_editor->show_toggle_scripts_button();
|
||||
code_editor->show_toggle_files_button();
|
||||
code_editor->set_toggle_list_control(ScriptEditor::get_singleton()->get_left_list_split());
|
||||
|
||||
update_settings();
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public:
|
|||
virtual void set_debugger_active(bool p_active) override;
|
||||
virtual void set_tooltip_request_func(const Callable &p_toolip_callback) override;
|
||||
virtual void add_callback(const String &p_function, const PackedStringArray &p_args) override;
|
||||
void update_toggle_scripts_button() override;
|
||||
void update_toggle_files_button() override;
|
||||
|
||||
virtual Control *get_edit_menu() override;
|
||||
virtual void clear_edit_menu() override;
|
||||
|
|
|
|||
|
|
@ -1270,5 +1270,5 @@ TextShaderEditor::TextShaderEditor() {
|
|||
add_child(disk_changed);
|
||||
|
||||
_editor_settings_changed();
|
||||
code_editor->show_toggle_scripts_button(); // TODO: Disabled for now, because it doesn't work properly.
|
||||
code_editor->show_toggle_files_button(); // TODO: Disabled for now, because it doesn't work properly.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2470,11 +2470,11 @@ Size2 VisualShaderEditor::get_minimum_size() const {
|
|||
return Size2(10, 200);
|
||||
}
|
||||
|
||||
void VisualShaderEditor::update_toggle_scripts_button() {
|
||||
ERR_FAIL_NULL(toggle_scripts_list);
|
||||
bool forward = toggle_scripts_list->is_visible() == is_layout_rtl();
|
||||
toggle_scripts_button->set_button_icon(get_editor_theme_icon(forward ? SNAME("Forward") : SNAME("Back")));
|
||||
toggle_scripts_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text()));
|
||||
void VisualShaderEditor::update_toggle_files_button() {
|
||||
ERR_FAIL_NULL(toggle_files_list);
|
||||
bool forward = toggle_files_list->is_visible() == is_layout_rtl();
|
||||
toggle_files_button->set_button_icon(get_editor_theme_icon(forward ? SNAME("Forward") : SNAME("Back")));
|
||||
toggle_files_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Files Panel"), ED_GET_SHORTCUT("script_editor/toggle_files_panel")->get_as_text()));
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_draw_color_over_button(Object *p_obj, Color p_color) {
|
||||
|
|
@ -5270,11 +5270,11 @@ void VisualShaderEditor::_notification(int p_what) {
|
|||
if (is_visible_in_tree()) {
|
||||
_update_graph();
|
||||
}
|
||||
update_toggle_scripts_button();
|
||||
update_toggle_files_button();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
update_toggle_scripts_button();
|
||||
update_toggle_files_button();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_DRAG_BEGIN: {
|
||||
|
|
@ -6391,13 +6391,13 @@ void VisualShaderEditor::_show_shader_preview() {
|
|||
}
|
||||
|
||||
void VisualShaderEditor::set_toggle_list_control(Control *p_control) {
|
||||
toggle_scripts_list = p_control;
|
||||
toggle_files_list = p_control;
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_toggle_scripts_pressed() {
|
||||
ERR_FAIL_NULL(toggle_scripts_list);
|
||||
toggle_scripts_list->set_visible(!toggle_scripts_list->is_visible());
|
||||
update_toggle_scripts_button();
|
||||
void VisualShaderEditor::_toggle_files_pressed() {
|
||||
ERR_FAIL_NULL(toggle_files_list);
|
||||
toggle_files_list->set_visible(!toggle_files_list->is_visible());
|
||||
update_toggle_files_button();
|
||||
}
|
||||
|
||||
void VisualShaderEditor::_bind_methods() {
|
||||
|
|
@ -6655,11 +6655,11 @@ VisualShaderEditor::VisualShaderEditor() {
|
|||
toolbar->add_child(separator);
|
||||
toolbar->move_child(separator, 0);
|
||||
|
||||
toggle_scripts_button = memnew(Button);
|
||||
toggle_scripts_button->set_flat(true);
|
||||
toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &VisualShaderEditor::_toggle_scripts_pressed));
|
||||
toolbar->add_child(toggle_scripts_button);
|
||||
toolbar->move_child(toggle_scripts_button, 0);
|
||||
toggle_files_button = memnew(Button);
|
||||
toggle_files_button->set_flat(true);
|
||||
toggle_files_button->connect(SceneStringName(pressed), callable_mp(this, &VisualShaderEditor::_toggle_files_pressed));
|
||||
toolbar->add_child(toggle_files_button);
|
||||
toolbar->move_child(toggle_files_button, 0);
|
||||
|
||||
///////////////////////////////////////
|
||||
// CODE PREVIEW
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@ class VisualShaderEditor : public ShaderEditor {
|
|||
EditorProperty *current_prop = nullptr;
|
||||
VBoxContainer *shader_preview_vbox = nullptr;
|
||||
Button *site_search = nullptr;
|
||||
Button *toggle_scripts_button = nullptr;
|
||||
Control *toggle_scripts_list = nullptr;
|
||||
Button *toggle_files_button = nullptr;
|
||||
Control *toggle_files_list = nullptr;
|
||||
GraphEdit *graph = nullptr;
|
||||
Button *add_node = nullptr;
|
||||
MenuButton *varying_button = nullptr;
|
||||
|
|
@ -450,7 +450,7 @@ class VisualShaderEditor : public ShaderEditor {
|
|||
|
||||
void _show_shader_preview();
|
||||
|
||||
void _toggle_scripts_pressed();
|
||||
void _toggle_files_pressed();
|
||||
|
||||
Vector<int> nodes_link_to_frame_buffer; // Contains the nodes that are requested to be linked to a frame. This is used to perform one Undo/Redo operation for dragging nodes.
|
||||
int frame_node_id_to_link_to = -1;
|
||||
|
|
@ -666,7 +666,7 @@ public:
|
|||
void update_custom_type(const Ref<Resource> &p_resource);
|
||||
|
||||
virtual Size2 get_minimum_size() const override;
|
||||
void update_toggle_scripts_button();
|
||||
void update_toggle_files_button();
|
||||
|
||||
Ref<VisualShader> get_visual_shader() const { return visual_shader; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue