From 03f62495caf33a7b337d95dbed59fa40d36e6fac Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Thu, 10 Aug 2017 11:40:28 -0500 Subject: [PATCH] Improved add texture as node dialog --- editor/editor_themes.cpp | 4 + editor/icons/2x/icon_GUI_radio_checked.png | Bin 0 -> 946 bytes editor/icons/2x/icon_GUI_radio_unchecked.png | Bin 0 -> 799 bytes editor/icons/icon_GUI_radio_checked.png | Bin 0 -> 457 bytes editor/icons/icon_GUI_radio_unchecked.png | Bin 0 -> 420 bytes .../icons/source/icon_GUI_radio_checked.svg | 87 ++++++++++++++++++ .../icons/source/icon_GUI_radio_unchecked.svg | 81 ++++++++++++++++ editor/plugins/canvas_item_editor_plugin.cpp | 28 +++--- 8 files changed, 187 insertions(+), 13 deletions(-) create mode 100644 editor/icons/2x/icon_GUI_radio_checked.png create mode 100644 editor/icons/2x/icon_GUI_radio_unchecked.png create mode 100644 editor/icons/icon_GUI_radio_checked.png create mode 100644 editor/icons/icon_GUI_radio_unchecked.png create mode 100644 editor/icons/source/icon_GUI_radio_checked.svg create mode 100644 editor/icons/source/icon_GUI_radio_unchecked.svg diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 156f00f6a3..7b1a6a8e27 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -175,6 +175,10 @@ Ref create_editor_theme() { theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons")); theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); + theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons")); + theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); + theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); + theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); // Editor background Ref style_panel = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); diff --git a/editor/icons/2x/icon_GUI_radio_checked.png b/editor/icons/2x/icon_GUI_radio_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..1b38071c00e9ca2011c003eb278afa24151fe454 GIT binary patch literal 946 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}Y)RhkE)4%caKYZ?lNlJ8 z(>+}rLn2z=PCK73>@ISAfBv4h?s-+58`f=keI)BMzr|jbqNU;*B3pO5ot0H`%~~3F zy_Z@uB2$|pu(5m!~*w}mF=_LAolv}FZTxN%IRCv zpY8o#Y5e(~^aGE$@`;Ca^2}zdbG054YH(%XJNcMFLFvCl@-45Gb1nL|KY#X2Zhufi z*>2m*Z_C0x=dlJzWCt9X@Q3w4uh-H`b(sunzfLlIR?KjGS)=dCdasq*>t6r+b%-JA zb?T()o~xX#>eFJ5Fzk3%d2g*VbH>`~9(7Y6?@?5WR*@IuYTeIxK;m)7i6+BmG7VW` zPA+z`TZMNrye+F%>sk~oap#*{L-yCIzkTn2tNEY*Ub}VErXoj|YaU|3!Tve79_s%U4_V!*zaZyX}3y5T)iXbDl#OWNm5&- zd;h!drnky-mn&|$_Iz?xfw}SC8L{>(3#MqL^Vs?9d+%E`?~>)@8&wnJ#3yc7W129> z^Z)zhQVlmV87C}R6qL0<=$rTVh=y<#HioXFN!R`b{NiKmIB`I?_wkREPn%0Q8pIgh zynjF6hrjDYfb5CgE&WDb+$X;;&)nO6qLyKUPPU@0->3DR3|=ee_FVd{5*n0Jw!C1U zblXEUPgSMoMwhK`esyLjl*v#2ux3@%Ykrp{>9@cAvgoK&Ty-_ecI{VJoApx;Y#-leWq zFxV$q%l@EuN~2uE>vga1`Q3UmVM2)Klj)nzYIH4n`t#?{m$L*JGS>P}{$sUV*4*=6 zsF&@F=atJZYerA|x~^l+(Ffa{UCtalcu@Un*4OPe_Q~=pjsi6-32#;9Rl;r0|E_y7 z%hRn%!NTUFzv`(KZ~lqrAsbE;;Egt}z1GcYhPc)I$z JtaD0e0sxDUzn}mB literal 0 HcmV?d00001 diff --git a/editor/icons/2x/icon_GUI_radio_unchecked.png b/editor/icons/2x/icon_GUI_radio_unchecked.png new file mode 100644 index 0000000000000000000000000000000000000000..b76bf63f2d856c4f615dcd48e210a5d18e638744 GIT binary patch literal 799 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}Y)RhkE)4%caKYZ?lNlJ8 zu6VjQhD5Z!oo4GV5-8Gkzqou_XP8;TZZ+!zVt*JnJbWz9;Kq4L=xwW)uymO8R>7n# zmy)u30xujp#j=#~FZ-KGJ3D(iWE;;g6~}XzPriBcrvHm4CC|_NtaxWze17kN)<5r+ z-dc!vAHC$X8)}M6cX-GX@ z7z zTzke1bIw1%|GdajSbX~Fr&sRWx#KGssW6kL*6PixSF?PVU#^d0x)5crvwqp8E@1}l zzQ=z$KKFOZEA13%Q`mXy{{8x-80-5)tNGQ ztt^R9-+49fW5Bwz99On3V^CTBE5tHOmMO&d(5V-B90l_x`KT@anH?3$tf2He(UzlW z^;{+y8JUoyT^?s;I(~DOD?1*Z%M>v!RMh)ZdN9M%D{d+;+|Lr;_QwZpQS;+ z1MlBhyEXT>X~W_!KO@hglcjfOy1i9c8FPK^MxED{UyMH0{`ZaXS^T=9=gH<7O|Fx& zy;hz*W%<3aT3AFFS6DHvIPvXU zS$}F|vXW6&k7u{X)5v}9MdAnAa&NybtpD8_<6--gyZE+Kg7!s6ZUzPh22WQ%mvv4F FO#s*qZKD7H literal 0 HcmV?d00001 diff --git a/editor/icons/icon_GUI_radio_checked.png b/editor/icons/icon_GUI_radio_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..699d0966a90a01efa1e855ecbb8b6d406eaaae34 GIT binary patch literal 457 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7*pj^6T^Rm@;DWu&Co?cG z)_J-(hFJ6-owU(U+EJkG|IM#!&+nSno#HLQc*u21$urgrg_R4OL~I%|CqB@OX_{o- zvBD|!6VJ|ROesBYjvak?ZPNEGzc0U0lb5|roZ8IHa3LyQ z)wAf)UVGJ@Yze#vRu;cIQe7{b^*x;7>7lHxQEE!|T45hHU(EQ!|1(VVfv!i`$vU&y zYh!XHKkzVgA59WJuz<a+6Ofm7#J8l MUHx3vIVCg!04M^>k^lez literal 0 HcmV?d00001 diff --git a/editor/icons/icon_GUI_radio_unchecked.png b/editor/icons/icon_GUI_radio_unchecked.png new file mode 100644 index 0000000000000000000000000000000000000000..e8ce1f8e6d7b06dc878ab8fb1169d21a582b1361 GIT binary patch literal 420 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7*pj^6T^Rm@;DWu&Co?cG zMtZt9hFJ8T4ch3(m2$#AWy z)qFqe&cE;&P)OFf$x7$dMD$5bOSyGfhxn zqB}!@%<}Xe%Ui0;_r_US|9f^*>92$GBvZji6;GorGap;z<(bXaW>8mAcN8d*?sfa) z%)l`1^wPdX84jDa=`)@5w448a`st_V&#;N@dtV*(+V5A$a|R8i_YCuT4EeA9{QrQv Yz-5X5v%jj`3=9kmp00i_>zopr00SzsApigX literal 0 HcmV?d00001 diff --git a/editor/icons/source/icon_GUI_radio_checked.svg b/editor/icons/source/icon_GUI_radio_checked.svg new file mode 100644 index 0000000000..c0dc46448b --- /dev/null +++ b/editor/icons/source/icon_GUI_radio_checked.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/editor/icons/source/icon_GUI_radio_unchecked.svg b/editor/icons/source/icon_GUI_radio_unchecked.svg new file mode 100644 index 0000000000..d21ba299b6 --- /dev/null +++ b/editor/icons/source/icon_GUI_radio_unchecked.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ac6d78adc2..a35d7a9a50 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3485,7 +3485,7 @@ void CanvasItemEditorViewport::_on_change_type() { } void CanvasItemEditorViewport::_create_preview(const Vector &files) const { - label->set_position(get_global_position() + Point2(14, 14)); + label->set_position(get_global_position() + Point2(14, 14) * EDSCALE); label_desc->set_position(label->get_position() + Point2(0, label->get_size().height)); for (int i = 0; i < files.size(); i++) { String path = files[i]; @@ -3791,10 +3791,16 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p } void CanvasItemEditorViewport::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { - connect("mouse_exited", this, "_on_mouse_exit"); - } else if (p_what == NOTIFICATION_EXIT_TREE) { - disconnect("mouse_exited", this, "_on_mouse_exit"); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + connect("mouse_exited", this, "_on_mouse_exit"); + label->add_color_override("font_color", get_color("warning_color", "Editor")); + } break; + case NOTIFICATION_EXIT_TREE: { + disconnect("mouse_exited", this, "_on_mouse_exit"); + } break; + + default: break; } } @@ -3824,11 +3830,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte accept = memnew(AcceptDialog); editor->get_gui_base()->add_child(accept); - selector = memnew(WindowDialog); + selector = memnew(AcceptDialog); selector->set_title(TTR("Change default type")); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->add_constant_override("separation", 10 * EDSCALE); + vbc->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->set_v_size_flags(SIZE_EXPAND_FILL); vbc->set_custom_minimum_size(Size2(200, 260) * EDSCALE); selector_label = memnew(Label); @@ -3851,17 +3858,12 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte } vbc->add_child(btn_group); - Button *ok = memnew(Button); - ok->set_text(TTR("OK")); - ok->set_h_size_flags(0); - vbc->add_child(ok); - ok->connect("pressed", this, "_on_change_type"); + selector->connect("confirmed", this, "_on_change_type"); selector->add_child(vbc); editor->get_gui_base()->add_child(selector); label = memnew(Label); - label->add_color_override("font_color", Color(1, 1, 0, 1)); label->add_color_override("font_color_shadow", Color(0, 0, 0, 1)); label->add_constant_override("shadow_as_outline", 1 * EDSCALE); label->hide();