Added separators using StyleBoxLine, some theme style fixes, added variant icon
This commit is contained in:
parent
69a4ea34c4
commit
17c3422431
10 changed files with 305 additions and 16 deletions
|
@ -1628,7 +1628,7 @@ void EditorNode::_edit_current() {
|
|||
p->add_separator();
|
||||
p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
|
||||
p->add_separator();
|
||||
p->add_icon_shortcut(gui_base->get_icon("Help", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
|
||||
p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
|
||||
}
|
||||
|
||||
List<MethodInfo> methods;
|
||||
|
@ -5642,7 +5642,7 @@ EditorNode::EditorNode() {
|
|||
p = help_menu->get_popup();
|
||||
p->connect("id_pressed", this, "_menu_option");
|
||||
p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);
|
||||
p->add_icon_item(gui_base->get_icon("Help", "EditorIcons"), TTR("Search"), HELP_SEARCH);
|
||||
p->add_icon_item(gui_base->get_icon("HelpSearch", "EditorIcons"), TTR("Search"), HELP_SEARCH);
|
||||
p->add_separator();
|
||||
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
|
||||
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Q&A"), HELP_QA);
|
||||
|
|
|
@ -69,6 +69,15 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -
|
|||
return style;
|
||||
}
|
||||
|
||||
static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, float grow = 1, bool vertical = false) {
|
||||
Ref<StyleBoxLine> style(memnew(StyleBoxLine));
|
||||
style->set_color(color);
|
||||
style->set_grow(grow);
|
||||
style->set_thickness(thickness);
|
||||
style->set_vertical(vertical);
|
||||
return style;
|
||||
}
|
||||
|
||||
static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
|
||||
Ref<StyleBoxFlat> style = p_style->duplicate();
|
||||
style->set_light_color(p_color);
|
||||
|
@ -143,6 +152,9 @@ Ref<Theme> create_editor_theme() {
|
|||
Color title_color_hl_text_color = dark_bg ? Color(1, 1, 1, 0.9) : Color(0, 0, 0, 0.9);
|
||||
Ref<Texture> title_hl_close_icon = theme->get_icon((dark_bg ? "GuiCloseLight" : "GuiCloseDark"), "EditorIcons");
|
||||
|
||||
bool dark_base = ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5;
|
||||
Color separator_color = dark_base ? Color(1, 1, 1, 0.1) : Color(0, 0, 0, 0.1);
|
||||
|
||||
theme->set_color("highlight_color", "Editor", highlight_color);
|
||||
theme->set_color("base_color", "Editor", base_color);
|
||||
theme->set_color("dark_color_1", "Editor", dark_color_1);
|
||||
|
@ -244,7 +256,7 @@ Ref<Theme> create_editor_theme() {
|
|||
theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a));
|
||||
|
||||
// OptionButton
|
||||
Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
|
||||
Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 8, 4);
|
||||
style_option_button->set_border_size(border_width);
|
||||
style_option_button->set_light_color(light_color_1);
|
||||
style_option_button->set_dark_color(light_color_1);
|
||||
|
@ -259,6 +271,8 @@ Ref<Theme> create_editor_theme() {
|
|||
theme->set_color("font_color_pressed", "OptionButton", highlight_color);
|
||||
theme->set_color("icon_color_hover", "OptionButton", HIGHLIGHT_COLOR_LIGHT);
|
||||
theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons"));
|
||||
theme->set_constant("arrow_margin", "OptionButton", 4);
|
||||
theme->set_constant("modulate_arrow", "OptionButton", true);
|
||||
|
||||
// CheckButton
|
||||
theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons"));
|
||||
|
@ -271,7 +285,7 @@ Ref<Theme> create_editor_theme() {
|
|||
style_popup_menu->set_dark_color(light_color_1);
|
||||
style_popup_menu->set_border_blend(false);
|
||||
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
|
||||
theme->set_stylebox("separator", "PopupMenu", make_empty_stylebox());
|
||||
theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, border_width, 8 - border_width));
|
||||
|
||||
// Tree & ItemList background
|
||||
Ref<StyleBoxFlat> style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4);
|
||||
|
@ -362,8 +376,8 @@ Ref<Theme> create_editor_theme() {
|
|||
theme->set_icon("close", "Tabs", title_hl_close_icon);
|
||||
|
||||
// Separatos (no separatos)
|
||||
theme->set_stylebox("separator", "HSeparator", make_empty_stylebox());
|
||||
theme->set_stylebox("separator", "VSeparator", make_empty_stylebox());
|
||||
theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width));
|
||||
theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true));
|
||||
|
||||
// Debugger
|
||||
Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 0, 4, 0, 0);
|
||||
|
|
BIN
editor/icons/2x/icon_variant.png
Normal file
BIN
editor/icons/2x/icon_variant.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 B |
Binary file not shown.
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 237 B |
146
editor/icons/source/icon_variant.svg
Normal file
146
editor/icons/source/icon_variant.svg
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 16 16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.92+devel unknown"
|
||||
inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
|
||||
inkscape:export-xdpi="45"
|
||||
inkscape:export-ydpi="45"
|
||||
sodipodi:docname="icon_variant.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.627418"
|
||||
inkscape:cx="12.635414"
|
||||
inkscape:cy="11.860443"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="false"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-center="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1016"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-midpoints="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:document-rotation="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3336" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<g
|
||||
transform="translate(0,-3)"
|
||||
id="layer1-5"
|
||||
inkscape:label="Layer 1"
|
||||
style="fill:#e0e0e0;fill-opacity:1">
|
||||
<rect
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect4320"
|
||||
width="2"
|
||||
height="5.9999666"
|
||||
x="3"
|
||||
y="1044.3622" />
|
||||
<rect
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect4324"
|
||||
width="2"
|
||||
height="5.9999843"
|
||||
x="6"
|
||||
y="1044.3622" />
|
||||
<rect
|
||||
y="1044.3622"
|
||||
x="3"
|
||||
height="2.0000174"
|
||||
width="1"
|
||||
id="rect4326"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 3,1044.3622 a 3,3 0 0 0 -3,3 h 2 a 1.0000174,1.0000174 0 0 1 1,-1 z"
|
||||
id="path4328"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path4330"
|
||||
d="m 14,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
transform="scale(1,-1)"
|
||||
y="-1052.3622"
|
||||
x="14"
|
||||
height="7.9999843"
|
||||
width="2"
|
||||
id="rect4334"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
transform="scale(1,-1)"
|
||||
y="-1047.3622"
|
||||
x="11"
|
||||
height="2.9999826"
|
||||
width="2"
|
||||
id="rect4338"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4340"
|
||||
d="m 3,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4342"
|
||||
d="m 8,1044.3622 a 3,3 0 0 1 3,3 H 9 a 1.0000174,1.0000174 0 0 0 -1,-1 z"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
y="1047.3622"
|
||||
x="9"
|
||||
height="3.0000174"
|
||||
width="2"
|
||||
id="rect4344"
|
||||
style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.5 KiB |
|
@ -1849,30 +1849,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
|
|||
}
|
||||
|
||||
{ // misc
|
||||
VBoxContainer *info_left = memnew(VBoxContainer);
|
||||
info_left->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
GridContainer *info_left = memnew(GridContainer);
|
||||
info_left->set_columns(2);
|
||||
info_left->set_name(TTR("Misc"));
|
||||
tabs->add_child(info_left);
|
||||
clicked_ctrl = memnew(LineEdit);
|
||||
info_left->add_margin_child(TTR("Clicked Control:"), clicked_ctrl);
|
||||
clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
info_left->add_child(memnew(Label(TTR("Clicked Control:"))));
|
||||
info_left->add_child(clicked_ctrl);
|
||||
clicked_ctrl_type = memnew(LineEdit);
|
||||
info_left->add_margin_child(TTR("Clicked Control Type:"), clicked_ctrl_type);
|
||||
info_left->add_child(memnew(Label(TTR("Clicked Control Type:"))));
|
||||
info_left->add_child(clicked_ctrl_type);
|
||||
|
||||
live_edit_root = memnew(LineEdit);
|
||||
live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
{
|
||||
HBoxContainer *lehb = memnew(HBoxContainer);
|
||||
Label *l = memnew(Label(TTR("Live Edit Root:")));
|
||||
lehb->add_child(l);
|
||||
l->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
info_left->add_child(l);
|
||||
lehb->add_child(live_edit_root);
|
||||
le_set = memnew(Button(TTR("Set From Tree")));
|
||||
lehb->add_child(le_set);
|
||||
le_clear = memnew(Button(TTR("Clear")));
|
||||
lehb->add_child(le_clear);
|
||||
info_left->add_child(lehb);
|
||||
MarginContainer *mc = memnew(MarginContainer);
|
||||
mc->add_child(live_edit_root);
|
||||
info_left->add_child(mc);
|
||||
le_set->set_disabled(true);
|
||||
le_clear->set_disabled(true);
|
||||
}
|
||||
|
|
|
@ -584,5 +584,6 @@ Button *ConfirmationDialog::get_cancel() {
|
|||
ConfirmationDialog::ConfirmationDialog() {
|
||||
|
||||
set_title(RTR("Please Confirm..."));
|
||||
set_custom_minimum_size(Size2(200, 70));
|
||||
cancel = add_cancel();
|
||||
}
|
||||
|
|
|
@ -52,11 +52,26 @@ void OptionButton::_notification(int p_what) {
|
|||
RID ci = get_canvas_item();
|
||||
Ref<Texture> arrow = Control::get_icon("arrow");
|
||||
Ref<StyleBox> normal = get_stylebox("normal");
|
||||
Color clr = Color(1, 1, 1);
|
||||
if (get_constant("modulate_arrow"))
|
||||
switch (get_draw_mode()) {
|
||||
case DRAW_PRESSED:
|
||||
clr = get_color("font_color_pressed");
|
||||
break;
|
||||
case DRAW_HOVER:
|
||||
clr = get_color("font_color_hover");
|
||||
break;
|
||||
case DRAW_DISABLED:
|
||||
clr = get_color("font_color_disabled");
|
||||
break;
|
||||
default:
|
||||
clr = get_color("font_color");
|
||||
}
|
||||
|
||||
Size2 size = get_size();
|
||||
|
||||
Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
|
||||
arrow->draw(ci, ofs);
|
||||
arrow->draw(ci, ofs, clr);
|
||||
|
||||
} break;
|
||||
}
|
||||
|
|
|
@ -437,3 +437,81 @@ StyleBoxFlat::StyleBoxFlat() {
|
|||
}
|
||||
StyleBoxFlat::~StyleBoxFlat() {
|
||||
}
|
||||
|
||||
void StyleBoxLine::set_color(const Color &p_color) {
|
||||
color = p_color;
|
||||
emit_changed();
|
||||
}
|
||||
Color StyleBoxLine::get_color() const {
|
||||
return color;
|
||||
}
|
||||
|
||||
void StyleBoxLine::set_thickness(int p_thickness) {
|
||||
thickness = p_thickness;
|
||||
emit_changed();
|
||||
}
|
||||
int StyleBoxLine::get_thickness() const {
|
||||
return thickness;
|
||||
}
|
||||
|
||||
void StyleBoxLine::set_vertical(bool p_vertical) {
|
||||
vertical = p_vertical;
|
||||
}
|
||||
bool StyleBoxLine::is_vertical() const {
|
||||
return vertical;
|
||||
}
|
||||
|
||||
void StyleBoxLine::set_grow(float p_grow) {
|
||||
grow = p_grow;
|
||||
emit_changed();
|
||||
}
|
||||
float StyleBoxLine::get_grow() const {
|
||||
return grow;
|
||||
}
|
||||
|
||||
void StyleBoxLine::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_color", "color"), &StyleBoxLine::set_color);
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &StyleBoxLine::get_color);
|
||||
ClassDB::bind_method(D_METHOD("set_thickness", "thickness"), &StyleBoxLine::set_thickness);
|
||||
ClassDB::bind_method(D_METHOD("get_thickness"), &StyleBoxLine::get_thickness);
|
||||
ClassDB::bind_method(D_METHOD("set_grow", "grow"), &StyleBoxLine::set_grow);
|
||||
ClassDB::bind_method(D_METHOD("get_grow"), &StyleBoxLine::get_grow);
|
||||
ClassDB::bind_method(D_METHOD("set_vertical", "vertical"), &StyleBoxLine::set_vertical);
|
||||
ClassDB::bind_method(D_METHOD("is_vertical"), &StyleBoxLine::is_vertical);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "get_vertical");
|
||||
}
|
||||
float StyleBoxLine::get_style_margin(Margin p_margin) const {
|
||||
return thickness;
|
||||
}
|
||||
Size2 StyleBoxLine::get_center_size() const {
|
||||
return Size2();
|
||||
}
|
||||
|
||||
void StyleBoxLine::draw(RID p_canvas_item, const Rect2 &p_rect) const {
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
Rect2i r = p_rect;
|
||||
|
||||
if (vertical) {
|
||||
r.position.y -= grow;
|
||||
r.size.y += grow * 2;
|
||||
r.size.x = thickness;
|
||||
} else {
|
||||
r.position.x -= grow;
|
||||
r.size.x += grow * 2;
|
||||
r.size.y = thickness;
|
||||
}
|
||||
|
||||
vs->canvas_item_add_rect(p_canvas_item, r, color);
|
||||
}
|
||||
|
||||
StyleBoxLine::StyleBoxLine() {
|
||||
grow = 1.0;
|
||||
thickness = 1;
|
||||
color = Color(0.0, 0.0, 0.0);
|
||||
vertical = false;
|
||||
}
|
||||
StyleBoxLine::~StyleBoxLine() {}
|
||||
|
|
|
@ -164,4 +164,38 @@ public:
|
|||
~StyleBoxFlat();
|
||||
};
|
||||
|
||||
// just used to draw lines.
|
||||
class StyleBoxLine : public StyleBox {
|
||||
|
||||
GDCLASS(StyleBoxLine, StyleBox);
|
||||
Color color;
|
||||
int thickness;
|
||||
bool vertical;
|
||||
float grow;
|
||||
|
||||
protected:
|
||||
virtual float get_style_margin(Margin p_margin) const;
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void set_color(const Color &p_color);
|
||||
Color get_color() const;
|
||||
|
||||
void set_thickness(int p_thickness);
|
||||
int get_thickness() const;
|
||||
|
||||
void set_vertical(bool p_vertical);
|
||||
bool is_vertical() const;
|
||||
|
||||
void set_grow(float p_grow);
|
||||
float get_grow() const;
|
||||
|
||||
virtual Size2 get_center_size() const;
|
||||
|
||||
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const;
|
||||
|
||||
StyleBoxLine();
|
||||
~StyleBoxLine();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue