You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
Modern Style: Use a style box for Input Map actions
This commit is contained in:
@@ -418,6 +418,18 @@ bool ActionMapEditor::_should_display_action(const String &p_name, const Array &
|
|||||||
return event_match && action_list_search_bar->get_name().is_subsequence_ofn(p_name);
|
return event_match && action_list_search_bar->get_name().is_subsequence_ofn(p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActionMapEditor::_highlight_subsection_action(Object *p_item, const Rect2 p_rect) {
|
||||||
|
TreeItem *item = Object::cast_to<TreeItem>(p_item);
|
||||||
|
ERR_FAIL_NULL(item);
|
||||||
|
|
||||||
|
if (item->is_selected(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Ref<StyleBox> &stylebox = get_theme_stylebox(SNAME("style_highlight_subsection"), EditorStringName(Editor));
|
||||||
|
stylebox->draw(action_tree->get_canvas_item(), p_rect);
|
||||||
|
}
|
||||||
|
|
||||||
void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_infos) {
|
void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_infos) {
|
||||||
if (!p_action_infos.is_empty()) {
|
if (!p_action_infos.is_empty()) {
|
||||||
actions_cache = p_action_infos;
|
actions_cache = p_action_infos;
|
||||||
@@ -458,6 +470,8 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
|
|||||||
|
|
||||||
// First Column - Action Name
|
// First Column - Action Name
|
||||||
action_item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
action_item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
||||||
|
action_item->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM);
|
||||||
|
action_item->set_custom_draw_callback(0, callable_mp(this, &ActionMapEditor::_highlight_subsection_action));
|
||||||
action_item->set_text(0, action_info.name);
|
action_item->set_text(0, action_info.name);
|
||||||
action_item->set_editable(0, action_info.editable);
|
action_item->set_editable(0, action_info.editable);
|
||||||
action_item->set_icon(0, action_info.icon);
|
action_item->set_icon(0, action_info.icon);
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ private:
|
|||||||
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
|
||||||
|
|
||||||
void _set_show_builtin_actions(bool p_show);
|
void _set_show_builtin_actions(bool p_show);
|
||||||
|
void _highlight_subsection_action(Object *p_item, const Rect2 p_rect);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|||||||
@@ -1963,6 +1963,13 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
|
|||||||
p_theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE);
|
p_theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE);
|
||||||
p_theme->set_constant("h_separation", "EditorInspectorSection", 2.0 * EDSCALE);
|
p_theme->set_constant("h_separation", "EditorInspectorSection", 2.0 * EDSCALE);
|
||||||
|
|
||||||
|
Color prop_subsection_stylebox_color = Color(1, 1, 1, 0);
|
||||||
|
p_theme->set_color("prop_subsection_stylebox", EditorStringName(Editor), prop_subsection_stylebox_color);
|
||||||
|
|
||||||
|
Ref<StyleBoxFlat> style_highlight_subsection = p_config.base_style->duplicate();
|
||||||
|
style_highlight_subsection->set_bg_color(prop_subsection_stylebox_color);
|
||||||
|
p_theme->set_stylebox("style_highlight_subsection", EditorStringName(Editor), style_highlight_subsection);
|
||||||
|
|
||||||
Color prop_category_color = p_config.dark_color_1.lerp(p_config.mono_color, 0.12);
|
Color prop_category_color = p_config.dark_color_1.lerp(p_config.mono_color, 0.12);
|
||||||
Color prop_subsection_color = p_config.dark_color_1.lerp(p_config.mono_color, 0.06);
|
Color prop_subsection_color = p_config.dark_color_1.lerp(p_config.mono_color, 0.06);
|
||||||
|
|
||||||
|
|||||||
@@ -1923,6 +1923,14 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
|
|||||||
p_theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE);
|
p_theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE);
|
||||||
p_theme->set_constant("h_separation", "EditorInspectorSection", p_config.base_margin * EDSCALE);
|
p_theme->set_constant("h_separation", "EditorInspectorSection", p_config.base_margin * EDSCALE);
|
||||||
|
|
||||||
|
Color prop_subsection_stylebox_color = p_config.dark_color_1.lerp(p_config.mono_color_font, p_config.dark_icon_and_font ? 0.09 : 0.16);
|
||||||
|
p_theme->set_color("prop_subsection_stylebox", EditorStringName(Editor), prop_subsection_stylebox_color);
|
||||||
|
|
||||||
|
Ref<StyleBoxFlat> style_highlight_subsection = p_config.base_style->duplicate();
|
||||||
|
style_highlight_subsection->set_bg_color(prop_subsection_stylebox_color);
|
||||||
|
style_highlight_subsection->set_corner_radius_all(p_config.corner_radius * EDSCALE);
|
||||||
|
p_theme->set_stylebox("style_highlight_subsection", EditorStringName(Editor), style_highlight_subsection);
|
||||||
|
|
||||||
p_theme->set_color("prop_subsection", EditorStringName(Editor), Color(1, 1, 1, 0));
|
p_theme->set_color("prop_subsection", EditorStringName(Editor), Color(1, 1, 1, 0));
|
||||||
#ifndef DISABLE_DEPRECATED // Used before 4.3.
|
#ifndef DISABLE_DEPRECATED // Used before 4.3.
|
||||||
p_theme->set_color("property_color", EditorStringName(Editor), p_config.dark_color_1.lerp(p_config.mono_color_font, 0.12));
|
p_theme->set_color("property_color", EditorStringName(Editor), p_config.dark_color_1.lerp(p_config.mono_color_font, 0.12));
|
||||||
|
|||||||
Reference in New Issue
Block a user