Merge pull request #10231 from djrm/pr_fix_add_sprite_dialog

Improved add texture as node dialog
This commit is contained in:
Rémi Verschelde 2017-08-11 10:40:46 +02:00 committed by GitHub
commit fd6b9d9ac7
8 changed files with 187 additions and 13 deletions

View file

@ -175,6 +175,10 @@ Ref<Theme> 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<StyleBoxFlat> style_panel = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

View file

@ -0,0 +1,87 @@
<?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 15.999999"
id="svg2"
version="1.1"
inkscape:version="0.92+devel unknown"
sodipodi:docname="icon_GUI_radio_checked.svg"
inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/checked.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="10.337496"
inkscape:cy="8.5995258"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:object-paths="false"
inkscape:snap-intersection-paths="false"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid4136"
empspacing="4" />
</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.3623)">
<circle
style="opacity:1;fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78431374"
id="path4285"
cx="8"
cy="1044.3623"
r="5" />
<circle
style="opacity:1;fill:#e0e0e0;fill-opacity:0.78431373;stroke:none;stroke-width:2.99999523;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78431373"
id="path4287"
cx="8"
cy="1044.3623"
r="2.9999952" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -0,0 +1,81 @@
<?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 15.999999"
id="svg2"
version="1.1"
inkscape:version="0.92+devel unknown"
sodipodi:docname="icon_GUI_radio_unchecked.svg"
inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/checked.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="10.337496"
inkscape:cy="8.5995258"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:object-paths="false"
inkscape:snap-intersection-paths="false"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid4136"
empspacing="4" />
</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.3623)">
<circle
style="opacity:1;fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78431374"
id="path4285"
cx="8"
cy="1044.3623"
r="5" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -3485,7 +3485,7 @@ void CanvasItemEditorViewport::_on_change_type() {
}
void CanvasItemEditorViewport::_create_preview(const Vector<String> &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();