summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_editor.cpp1609
-rw-r--r--editor/animation_editor.h2
-rw-r--r--editor/asset_library_editor_plugin.cpp9
-rw-r--r--editor/code_editor.cpp31
-rw-r--r--editor/code_editor.h4
-rw-r--r--editor/connections_dialog.cpp6
-rw-r--r--editor/create_dialog.cpp14
-rw-r--r--editor/create_dialog.h2
-rw-r--r--editor/doc/doc_data.cpp140
-rw-r--r--editor/doc/doc_dump.cpp15
-rw-r--r--editor/editor_audio_buses.cpp35
-rw-r--r--editor/editor_audio_buses.h2
-rw-r--r--editor/editor_file_dialog.cpp18
-rw-r--r--editor/editor_file_dialog.h2
-rw-r--r--editor/editor_help.cpp44
-rw-r--r--editor/editor_help.h8
-rw-r--r--editor/editor_log.cpp3
-rw-r--r--editor/editor_name_dialog.cpp10
-rw-r--r--editor/editor_name_dialog.h2
-rw-r--r--editor/editor_node.cpp423
-rw-r--r--editor/editor_node.h23
-rw-r--r--editor/editor_path.cpp5
-rw-r--r--editor/editor_path.h2
-rw-r--r--editor/editor_plugin.cpp15
-rw-r--r--editor/editor_plugin.h7
-rw-r--r--editor/editor_profiler.cpp20
-rw-r--r--editor/editor_profiler.h2
-rw-r--r--editor/editor_run_native.cpp9
-rw-r--r--editor/editor_settings.cpp38
-rw-r--r--editor/editor_settings.h2
-rw-r--r--editor/editor_themes.cpp410
-rw-r--r--editor/filesystem_dock.cpp15
-rw-r--r--editor/icons/2x/icon_checked.pngbin0 -> 534 bytes
-rw-r--r--editor/icons/2x/icon_dropdown.pngbin0 -> 327 bytes
-rw-r--r--editor/icons/2x/icon_godot.pngbin1842 -> 0 bytes
-rw-r--r--editor/icons/2x/icon_godot_docs.pngbin0 -> 1840 bytes
-rw-r--r--editor/icons/2x/icon_hslider_bg.pngbin0 -> 233 bytes
-rw-r--r--editor/icons/2x/icon_option_arrow.pngbin0 -> 360 bytes
-rw-r--r--editor/icons/2x/icon_play_button_group.pngbin0 -> 942 bytes
-rw-r--r--editor/icons/2x/icon_slider_grabber.pngbin0 -> 686 bytes
-rw-r--r--editor/icons/2x/icon_slider_grabber_hl.pngbin0 -> 672 bytes
-rw-r--r--editor/icons/2x/icon_spinbox_updown.pngbin0 -> 562 bytes
-rw-r--r--editor/icons/2x/icon_tab_menu.pngbin0 -> 277 bytes
-rw-r--r--editor/icons/2x/icon_texture.pngbin0 -> 262 bytes
-rw-r--r--editor/icons/2x/icon_tree_arrow_down.pngbin0 -> 312 bytes
-rw-r--r--editor/icons/2x/icon_tree_arrow_right.pngbin0 -> 319 bytes
-rw-r--r--editor/icons/2x/icon_unchecked.pngbin0 -> 404 bytes
-rw-r--r--editor/icons/2x/icon_vslider_bg.pngbin0 -> 236 bytes
-rw-r--r--editor/icons/SCsub6
-rw-r--r--editor/icons/icon_checked.pngbin0 -> 377 bytes
-rw-r--r--editor/icons/icon_default_project_icon.pngbin2713 -> 3480 bytes
-rw-r--r--editor/icons/icon_dropdown.pngbin0 -> 179 bytes
-rw-r--r--editor/icons/icon_godot.pngbin769 -> 0 bytes
-rw-r--r--editor/icons/icon_godot_docs.pngbin0 -> 722 bytes
-rw-r--r--editor/icons/icon_hslider_bg.pngbin0 -> 233 bytes
-rw-r--r--editor/icons/icon_hsplit_bg.pngbin0 -> 96 bytes
-rw-r--r--editor/icons/icon_hsplitter.pngbin0 -> 132 bytes
-rw-r--r--editor/icons/icon_logo.pngbin6211 -> 11594 bytes
-rw-r--r--editor/icons/icon_logo_small.pngbin1825 -> 1465 bytes
-rw-r--r--editor/icons/icon_option_arrow.pngbin0 -> 205 bytes
-rw-r--r--editor/icons/icon_play_button_group.pngbin0 -> 427 bytes
-rw-r--r--editor/icons/icon_scroll_bg.pngbin0 -> 90 bytes
-rw-r--r--editor/icons/icon_scroll_grabber.pngbin0 -> 147 bytes
-rw-r--r--editor/icons/icon_scroll_grabber_hl.pngbin0 -> 268 bytes
-rw-r--r--editor/icons/icon_slider_grabber.pngbin0 -> 384 bytes
-rw-r--r--editor/icons/icon_slider_grabber_hl.pngbin0 -> 354 bytes
-rw-r--r--editor/icons/icon_spinbox_updown.pngbin0 -> 345 bytes
-rw-r--r--editor/icons/icon_tab_menu.pngbin251 -> 146 bytes
-rw-r--r--editor/icons/icon_texture.pngbin0 -> 200 bytes
-rw-r--r--editor/icons/icon_tree_arrow_down.pngbin0 -> 170 bytes
-rw-r--r--editor/icons/icon_tree_arrow_right.pngbin0 -> 189 bytes
-rw-r--r--editor/icons/icon_unchecked.pngbin0 -> 267 bytes
-rw-r--r--editor/icons/icon_vslider_bg.pngbin0 -> 236 bytes
-rw-r--r--editor/icons/icon_vsplit_bg.pngbin0 -> 96 bytes
-rw-r--r--editor/icons/icon_vsplitter.pngbin0 -> 122 bytes
-rw-r--r--editor/icons/source/icon_checked.svg79
-rw-r--r--editor/icons/source/icon_dropdown.svg79
-rw-r--r--editor/icons/source/icon_godot.svg168
-rw-r--r--editor/icons/source/icon_godot_docs.svg173
-rw-r--r--editor/icons/source/icon_hslider_bg.svg79
-rw-r--r--editor/icons/source/icon_hsplitter.svg79
-rw-r--r--editor/icons/source/icon_mini_matrix32.svg145
-rw-r--r--editor/icons/source/icon_option_arrow.svg80
-rw-r--r--editor/icons/source/icon_particles_shader.svg159
-rw-r--r--editor/icons/source/icon_play_button_group.svg78
-rw-r--r--editor/icons/source/icon_scroll_bg.svg71
-rw-r--r--editor/icons/source/icon_scroll_grabber.svg78
-rw-r--r--editor/icons/source/icon_scroll_grabber_hl.svg82
-rw-r--r--editor/icons/source/icon_slider_grabber.svg80
-rw-r--r--editor/icons/source/icon_slider_grabber_hl.svg80
-rw-r--r--editor/icons/source/icon_spatial_shader.svg165
-rw-r--r--editor/icons/source/icon_spinbox_updown.svg83
-rw-r--r--editor/icons/source/icon_tab_menu.svg92
-rw-r--r--editor/icons/source/icon_texture.svg137
-rw-r--r--editor/icons/source/icon_tree_arrow_down.svg (renamed from editor/icons/source/icon_2_d.svg)37
-rw-r--r--editor/icons/source/icon_tree_arrow_right.svg (renamed from editor/icons/source/icon_3_d.svg)49
-rw-r--r--editor/icons/source/icon_unchecked.svg77
-rw-r--r--editor/icons/source/icon_vslider_bg.svg85
-rw-r--r--editor/icons/source/icon_vsplit_bg.svg79
-rw-r--r--editor/icons/source/icon_vsplitter.svg79
-rw-r--r--editor/import/editor_import_plugin.cpp152
-rw-r--r--editor/import/editor_import_plugin.h54
-rw-r--r--editor/import/resource_importer_csv_translation.cpp2
-rw-r--r--editor/import/resource_importer_texture.cpp67
-rw-r--r--editor/import/resource_importer_texture.h4
-rw-r--r--editor/io_plugins/editor_texture_import_plugin.cpp2
-rw-r--r--editor/pane_drag.cpp7
-rw-r--r--editor/pane_drag.h2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp33
-rw-r--r--editor/plugins/animation_player_editor_plugin.h6
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp212
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h2
-rw-r--r--editor/plugins/baked_light_baker.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp134
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h6
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.cpp287
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/collision_polygon_editor_plugin.cpp16
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp82
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h4
-rw-r--r--editor/plugins/curve_editor_plugin.cpp19
-rw-r--r--editor/plugins/curve_editor_plugin.h2
-rw-r--r--editor/plugins/gradient_texture_editor_plugin.cpp36
-rw-r--r--editor/plugins/gradient_texture_editor_plugin.h2
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp302
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.h4
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp123
-rw-r--r--editor/plugins/line_2d_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp6
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.cpp361
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.h4
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp15
-rw-r--r--editor/plugins/particles_editor_plugin.cpp4
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp517
-rw-r--r--editor/plugins/path_2d_editor_plugin.h4
-rw-r--r--editor/plugins/path_editor_plugin.cpp50
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp329
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h6
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h2
-rw-r--r--editor/plugins/script_editor_plugin.cpp30
-rw-r--r--editor/plugins/script_editor_plugin.h4
-rw-r--r--editor/plugins/script_text_editor.cpp16
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp18
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp1289
-rw-r--r--editor/plugins/spatial_editor_plugin.h14
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.h2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp62
-rw-r--r--editor/plugins/texture_region_editor_plugin.h2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp603
-rw-r--r--editor/plugins/tile_map_editor_plugin.h6
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp26
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
-rw-r--r--editor/project_export.cpp1
-rw-r--r--editor/project_manager.cpp39
-rw-r--r--editor/project_manager.h4
-rw-r--r--editor/project_settings.cpp234
-rw-r--r--editor/project_settings.h15
-rw-r--r--editor/property_editor.cpp104
-rw-r--r--editor/property_editor.h2
-rw-r--r--editor/property_selector.cpp42
-rw-r--r--editor/property_selector.h5
-rw-r--r--editor/pvrtc_compress.cpp4
-rw-r--r--editor/quick_open.cpp9
-rw-r--r--editor/quick_open.h2
-rw-r--r--editor/scene_tree_dock.cpp13
-rw-r--r--editor/scene_tree_dock.h4
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--editor/script_editor_debugger.cpp50
-rw-r--r--editor/settings_config_dialog.cpp42
-rw-r--r--editor/settings_config_dialog.h4
175 files changed, 6655 insertions, 4198 deletions
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 1e6562fcf2..7c29162e67 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -154,13 +154,15 @@ private:
}
}
- void _gui_input(const InputEvent &p_ev) {
- if (p_ev.type == InputEvent::MOUSE_MOTION && p_ev.mouse_motion.button_mask & BUTTON_MASK_LEFT) {
+ void _gui_input(const Ref<InputEvent> &p_ev) {
+
+ Ref<InputEventMouseMotion> mm = p_ev;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
if (mode == MODE_DISABLED)
return;
- float rel = p_ev.mouse_motion.relative_x;
+ float rel = mm->get_relative().x;
if (rel == 0)
return;
@@ -1035,7 +1037,7 @@ void AnimationKeyEditor::_track_pos_draw() {
//draw position
int pixel = (timeline_pos - h_scroll->get_value()) * zoom_scale;
pixel += name_limit;
- track_pos->draw_line(ofs + Point2(pixel, 0), ofs + Point2(pixel, size.height), get_color("animation_editor_track_pos", "Editor"));
+ track_pos->draw_line(ofs + Point2(pixel, 0), ofs + Point2(pixel, size.height), get_color("highlight_color", "Editor"));
}
}
@@ -1089,12 +1091,12 @@ void AnimationKeyEditor::_track_editor_draw() {
int sep = get_constant("vseparation", "Tree");
int hsep = get_constant("hseparation", "Tree");
Color color = get_color("font_color", "Tree");
- Color sepcolor = get_color("guide_color", "Editor");
- Color timecolor = get_color("animation_editor_time", "Editor");
+ Color sepcolor = get_color("light_color_1", "Editor");
+ Color timecolor = get_color("dark_color_2", "Editor");
Color hover_color = Color(1, 1, 1, 0.05);
Color select_color = Color(1, 1, 1, 0.1);
Color invalid_path_color = Color(1, 0.6, 0.4, 0.5);
- Color track_select_color = Color::html("ffbd8e8e");
+ Color track_select_color = get_color("highlight_color", "Editor");
Ref<Texture> remove_icon = get_icon("Remove", "EditorIcons");
Ref<Texture> move_up_icon = get_icon("MoveUp", "EditorIcons");
@@ -1154,9 +1156,8 @@ void AnimationKeyEditor::_track_editor_draw() {
int settings_limit = size.width - right_separator_ofs;
int name_limit = settings_limit * name_column_ratio;
- Color line_color = get_color("animation_editor_line", "Editor");
- te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), line_color);
- te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), line_color);
+ te->draw_line(ofs + Point2(name_limit, 0), ofs + Point2(name_limit, size.height), color);
+ te->draw_line(ofs + Point2(settings_limit, 0), ofs + Point2(settings_limit, size.height), color);
te->draw_texture(hsize_icon, ofs + Point2(name_limit - hsize_icon->get_width() - hsep, (h - hsize_icon->get_height()) / 2));
te->draw_line(ofs + Point2(0, h), ofs + Point2(size.width, h), color);
@@ -1179,11 +1180,7 @@ void AnimationKeyEditor::_track_editor_draw() {
int end_px = (l - h_scroll->get_value()) * scale;
int begin_px = -h_scroll->get_value() * scale;
- Color notimecol;
- notimecol.r = timecolor.gray();
- notimecol.g = notimecol.r;
- notimecol.b = notimecol.r;
- notimecol.a = timecolor.a;
+ Color notimecol = get_color("light_color_1", "Editor");
{
@@ -1483,7 +1480,9 @@ void AnimationKeyEditor::_track_editor_draw() {
switch (click.click) {
case ClickOver::CLICK_SELECT_KEYS: {
- te->draw_rect(Rect2(click.at, click.to - click.at), get_color("animation_editor_selection_rect", "Editor"));
+ Color box_color = get_color("highlight_color", "Editor");
+ box_color.a = 0.35;
+ te->draw_rect(Rect2(click.at, click.to - click.at), box_color);
} break;
case ClickOver::CLICK_MOVE_KEYS: {
@@ -1749,7 +1748,7 @@ void AnimationKeyEditor::_anim_delete_keys() {
}
}
-void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) {
+void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input) {
Control *te = track_editor;
Ref<StyleBox> style = get_stylebox("normal", "TextEdit");
@@ -1807,1087 +1806,1083 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) {
int settings_limit = size.width - right_separator_ofs;
int name_limit = settings_limit * name_column_ratio;
- switch (p_input.type) {
+ Ref<InputEventKey> key = p_input;
+ if (key.is_valid()) {
- case InputEvent::KEY: {
+ if (key->get_scancode() == KEY_D && key->is_pressed() && key->get_command()) {
- if (p_input.key.scancode == KEY_D && p_input.key.pressed && p_input.key.mod.command) {
+ if (key->get_shift())
+ _menu_track(TRACK_MENU_DUPLICATE_TRANSPOSE);
+ else
+ _menu_track(TRACK_MENU_DUPLICATE);
- if (p_input.key.mod.shift)
- _menu_track(TRACK_MENU_DUPLICATE_TRANSPOSE);
- else
- _menu_track(TRACK_MENU_DUPLICATE);
+ accept_event();
- accept_event();
+ } else if (key->get_scancode() == KEY_DELETE && key->is_pressed() && click.click == ClickOver::CLICK_NONE) {
- } else if (p_input.key.scancode == KEY_DELETE && p_input.key.pressed && click.click == ClickOver::CLICK_NONE) {
+ _anim_delete_keys();
+ } else if (animation.is_valid() && animation->get_track_count() > 0) {
- _anim_delete_keys();
- } else if (animation.is_valid() && animation->get_track_count() > 0) {
-
- if (p_input.is_pressed() && (p_input.is_action("ui_up") || p_input.is_action("ui_page_up"))) {
+ if (key->is_pressed() && (key->is_action("ui_up") || key->is_action("ui_page_up"))) {
- if (p_input.is_action("ui_up"))
- selected_track--;
- if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_up"))
- selected_track--;
+ if (key->is_action("ui_up"))
+ selected_track--;
+ if (v_scroll->is_visible_in_tree() && key->is_action("ui_page_up"))
+ selected_track--;
- if (selected_track < 0)
- selected_track = 0;
+ if (selected_track < 0)
+ selected_track = 0;
- if (v_scroll->is_visible_in_tree()) {
- if (v_scroll->get_value() > selected_track)
- v_scroll->set_value(selected_track);
- }
-
- track_editor->update();
- accept_event();
+ if (v_scroll->is_visible_in_tree()) {
+ if (v_scroll->get_value() > selected_track)
+ v_scroll->set_value(selected_track);
}
- if (p_input.is_pressed() && (p_input.is_action("ui_down") || p_input.is_action("ui_page_down"))) {
+ track_editor->update();
+ accept_event();
+ }
- if (p_input.is_action("ui_down"))
- selected_track++;
- else if (v_scroll->is_visible_in_tree() && p_input.is_action("ui_page_down"))
- selected_track += v_scroll->get_page();
+ if (key->is_pressed() && (key->is_action("ui_down") || key->is_action("ui_page_down"))) {
- if (selected_track >= animation->get_track_count())
- selected_track = animation->get_track_count() - 1;
+ if (key->is_action("ui_down"))
+ selected_track++;
+ else if (v_scroll->is_visible_in_tree() && key->is_action("ui_page_down"))
+ selected_track += v_scroll->get_page();
- if (v_scroll->is_visible_in_tree() && v_scroll->get_page() + v_scroll->get_value() < selected_track + 1) {
- v_scroll->set_value(selected_track - v_scroll->get_page() + 1);
- }
+ if (selected_track >= animation->get_track_count())
+ selected_track = animation->get_track_count() - 1;
- track_editor->update();
- accept_event();
+ if (v_scroll->is_visible_in_tree() && v_scroll->get_page() + v_scroll->get_value() < selected_track + 1) {
+ v_scroll->set_value(selected_track - v_scroll->get_page() + 1);
}
+
+ track_editor->update();
+ accept_event();
}
+ }
+ }
- } break;
- case InputEvent::MOUSE_BUTTON: {
+ Ref<InputEventMouseButton> mb = p_input;
- const InputEventMouseButton &mb = p_input.mouse_button;
+ if (mb.is_valid()) {
- if (mb.button_index == BUTTON_WHEEL_UP && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
- if (mb.mod.command) {
+ if (mb->get_command()) {
- zoom->set_value(zoom->get_value() + zoom->get_step());
- } else {
+ zoom->set_value(zoom->get_value() + zoom->get_step());
+ } else {
- v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * mb.factor / 8);
- }
+ v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * mb->get_factor() / 8);
}
+ }
- if (mb.button_index == BUTTON_WHEEL_DOWN && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
- if (mb.mod.command) {
+ if (mb->get_command()) {
- zoom->set_value(zoom->get_value() - zoom->get_step());
- } else {
+ zoom->set_value(zoom->get_value() - zoom->get_step());
+ } else {
- v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb.factor / 8);
- }
+ v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb->get_factor() / 8);
}
+ }
- if (mb.button_index == BUTTON_WHEEL_RIGHT && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_WHEEL_RIGHT && mb->is_pressed()) {
- h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb.factor / 8);
- }
+ h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb->get_factor() / 8);
+ }
- if (mb.button_index == BUTTON_WHEEL_LEFT && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_WHEEL_LEFT && mb->is_pressed()) {
- v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb.factor / 8);
- }
+ v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb->get_factor() / 8);
+ }
- if (mb.button_index == BUTTON_RIGHT && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
- Point2 mpos = Point2(mb.x, mb.y) - ofs;
+ Point2 mpos = mb->get_pos() - ofs;
- if (selection.size() == 0) {
- // Auto-select on right-click if nothing is selected
- // Note: This code is pretty much duplicated from the left click code,
- // both codes could be moved into a function to avoid the duplicated code.
- Point2 mpos = Point2(mb.x, mb.y) - ofs;
+ if (selection.size() == 0) {
+ // Auto-select on right-click if nothing is selected
+ // Note: This code is pretty much duplicated from the left click code,
+ // both codes could be moved into a function to avoid the duplicated code.
+ Point2 mpos = mb->get_pos() - ofs;
- if (mpos.y < h) {
- return;
- }
+ if (mpos.y < h) {
+ return;
+ }
- mpos.y -= h;
+ mpos.y -= h;
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0 || idx >= animation->get_track_count())
- break;
+ int idx = mpos.y / h;
+ idx += v_scroll->get_value();
+ if (idx < 0 || idx >= animation->get_track_count())
+ return;
- if (mpos.x < name_limit) {
- } else if (mpos.x < settings_limit) {
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
+ if (mpos.x < name_limit) {
+ } else if (mpos.x < settings_limit) {
+ float pos = mpos.x - name_limit;
+ pos /= _get_zoom_scale();
+ pos += h_scroll->get_value();
+ float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
- int key = -1;
+ int kidx = animation->track_find_key(idx, pos);
+ int kidx_n = kidx + 1;
+ int key = -1;
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
+ if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
+ float kpos = animation->track_get_key_time(idx, kidx);
+ if (ABS(pos - kpos) <= w_time) {
- key = kidx;
- }
+ key = kidx;
}
+ }
- if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
+ if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
+ float kpos = animation->track_get_key_time(idx, kidx_n);
+ if (ABS(pos - kpos) <= w_time) {
- key = kidx_n;
- }
+ key = kidx_n;
}
+ }
- if (key == -1) {
+ if (key == -1) {
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- click.shift = mb.mod.shift;
- selected_track = idx;
- track_editor->update();
- //drag select region
- return;
- }
+ click.click = ClickOver::CLICK_SELECT_KEYS;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ click.shift = mb->get_shift();
+ selected_track = idx;
+ track_editor->update();
+ //drag select region
+ return;
+ }
- SelectedKey sk;
- sk.track = idx;
- sk.key = key;
- KeyInfo ki;
- ki.pos = animation->track_get_key_time(idx, key);
- click.shift = mb.mod.shift;
- click.selk = sk;
+ SelectedKey sk;
+ sk.track = idx;
+ sk.key = key;
+ KeyInfo ki;
+ ki.pos = animation->track_get_key_time(idx, key);
+ click.shift = mb->get_shift();
+ click.selk = sk;
- if (!mb.mod.shift && !selection.has(sk))
- _clear_selection();
+ if (!mb->get_shift() && !selection.has(sk))
+ _clear_selection();
- selection.insert(sk, ki);
+ selection.insert(sk, ki);
- click.click = ClickOver::CLICK_MOVE_KEYS;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- update();
- selected_track = idx;
- track_editor->update();
+ click.click = ClickOver::CLICK_MOVE_KEYS;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ update();
+ selected_track = idx;
+ track_editor->update();
- if (_edit_if_single_selection() && mb.mod.command) {
- edit_button->set_pressed(true);
- key_editor_tab->show();
- }
+ if (_edit_if_single_selection() && mb->get_command()) {
+ edit_button->set_pressed(true);
+ key_editor_tab->show();
}
}
+ }
- if (selection.size()) {
- // User has right clicked and we have a selection, show a popup menu with options
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- track_menu->add_item(TTR("Duplicate Selection"), RIGHT_MENU_DUPLICATE);
- track_menu->add_item(TTR("Duplicate Transposed"), RIGHT_MENU_DUPLICATE_TRANSPOSE);
- track_menu->add_item(TTR("Remove Selection"), RIGHT_MENU_REMOVE);
+ if (selection.size()) {
+ // User has right clicked and we have a selection, show a popup menu with options
+ track_menu->clear();
+ track_menu->set_size(Point2(1, 1));
+ track_menu->add_item(TTR("Duplicate Selection"), RIGHT_MENU_DUPLICATE);
+ track_menu->add_item(TTR("Duplicate Transposed"), RIGHT_MENU_DUPLICATE_TRANSPOSE);
+ track_menu->add_item(TTR("Remove Selection"), RIGHT_MENU_REMOVE);
- track_menu->set_position(te->get_global_position() + mpos);
+ track_menu->set_position(te->get_global_position() + mpos);
- interp_editing = -1;
- cont_editing = -1;
- wrap_editing = -1;
+ interp_editing = -1;
+ cont_editing = -1;
+ wrap_editing = -1;
- track_menu->popup();
- }
+ track_menu->popup();
}
+ }
- if (mb.button_index == BUTTON_LEFT && !(mb.button_mask & ~BUTTON_MASK_LEFT)) {
+ if (mb->get_button_index() == BUTTON_LEFT && !(mb->get_button_mask() & ~BUTTON_MASK_LEFT)) {
- if (mb.pressed) {
+ if (mb->is_pressed()) {
- Point2 mpos = Point2(mb.x, mb.y) - ofs;
+ Point2 mpos = mb->get_pos() - ofs;
- if (mpos.y < h) {
+ if (mpos.y < h) {
- if (mpos.x < name_limit && mpos.x > (name_limit - hsep - hsize_icon->get_width())) {
+ if (mpos.x < name_limit && mpos.x > (name_limit - hsep - hsize_icon->get_width())) {
- click.click = ClickOver::CLICK_RESIZE_NAMES;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- click.at.y = name_limit;
- }
+ click.click = ClickOver::CLICK_RESIZE_NAMES;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ click.at.y = name_limit;
+ }
- if (mpos.x >= name_limit && mpos.x < settings_limit) {
- //seek
- //int zoomw = settings_limit-name_limit;
- float scale = _get_zoom_scale();
- float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
- if (animation->get_step())
- pos = Math::stepify(pos, animation->get_step());
-
- if (pos < 0)
- pos = 0;
- if (pos >= animation->get_length())
- pos = animation->get_length();
- timeline_pos = pos;
- click.click = ClickOver::CLICK_DRAG_TIMELINE;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- emit_signal("timeline_changed", pos, false);
- }
+ if (mpos.x >= name_limit && mpos.x < settings_limit) {
+ //seek
+ //int zoomw = settings_limit-name_limit;
+ float scale = _get_zoom_scale();
+ float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
+ if (animation->get_step())
+ pos = Math::stepify(pos, animation->get_step());
- return;
+ if (pos < 0)
+ pos = 0;
+ if (pos >= animation->get_length())
+ pos = animation->get_length();
+ timeline_pos = pos;
+ click.click = ClickOver::CLICK_DRAG_TIMELINE;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ emit_signal("timeline_changed", pos, false);
}
- mpos.y -= h;
+ return;
+ }
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0)
- break;
+ mpos.y -= h;
- if (idx >= animation->get_track_count()) {
+ int idx = mpos.y / h;
+ idx += v_scroll->get_value();
+ if (idx < 0)
+ return;
- if (mpos.x >= name_limit && mpos.x < settings_limit) {
+ if (idx >= animation->get_track_count()) {
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- //drag select region
- }
+ if (mpos.x >= name_limit && mpos.x < settings_limit) {
- break;
+ click.click = ClickOver::CLICK_SELECT_KEYS;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ //drag select region
}
- if (mpos.x < name_limit) {
- //name column
-
- // area
- if (idx != selected_track) {
-
- selected_track = idx;
- track_editor->update();
- break;
- }
+ return;
+ }
- Rect2 area(ofs.x, ofs.y + ((int(mpos.y) / h) + 1) * h, name_limit, h);
- track_name->set_text(animation->track_get_path(idx));
- track_name->set_position(te->get_global_position() + area.pos);
- track_name->set_size(area.size);
- track_name->show_modal();
- track_name->grab_focus();
- track_name->select_all();
- track_name_editing = idx;
+ if (mpos.x < name_limit) {
+ //name column
- } else if (mpos.x < settings_limit) {
+ // area
+ if (idx != selected_track) {
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
+ selected_track = idx;
+ track_editor->update();
+ return;
+ }
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
- int key = -1;
+ Rect2 area(ofs.x, ofs.y + ((int(mpos.y) / h) + 1) * h, name_limit, h);
+ track_name->set_text(animation->track_get_path(idx));
+ track_name->set_position(te->get_global_position() + area.pos);
+ track_name->set_size(area.size);
+ track_name->show_modal();
+ track_name->grab_focus();
+ track_name->select_all();
+ track_name_editing = idx;
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
+ } else if (mpos.x < settings_limit) {
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
+ float pos = mpos.x - name_limit;
+ pos /= _get_zoom_scale();
+ pos += h_scroll->get_value();
+ float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
- key = kidx;
- }
- }
+ int kidx = animation->track_find_key(idx, pos);
+ int kidx_n = kidx + 1;
+ int key = -1;
- if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
+ if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
+ float kpos = animation->track_get_key_time(idx, kidx);
+ if (ABS(pos - kpos) <= w_time) {
- key = kidx_n;
- }
+ key = kidx;
}
+ }
- if (key == -1) {
+ if (key == -1 && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
- click.click = ClickOver::CLICK_SELECT_KEYS;
- click.at = Point2(mb.x, mb.y);
- click.to = click.at;
- click.shift = mb.mod.shift;
- selected_track = idx;
- track_editor->update();
- //drag select region
- return;
- }
-
- SelectedKey sk;
- sk.track = idx;
- sk.key = key;
- KeyInfo ki;
- ki.pos = animation->track_get_key_time(idx, key);
- click.shift = mb.mod.shift;
- click.selk = sk;
+ float kpos = animation->track_get_key_time(idx, kidx_n);
+ if (ABS(pos - kpos) <= w_time) {
- if (!mb.mod.shift && !selection.has(sk))
- _clear_selection();
+ key = kidx_n;
+ }
+ }
- selection.insert(sk, ki);
+ if (key == -1) {
- click.click = ClickOver::CLICK_MOVE_KEYS;
- click.at = Point2(mb.x, mb.y);
+ click.click = ClickOver::CLICK_SELECT_KEYS;
+ click.at = mb->get_pos();
click.to = click.at;
- update();
+ click.shift = mb->get_shift();
selected_track = idx;
track_editor->update();
+ //drag select region
+ return;
+ }
- if (_edit_if_single_selection() && mb.mod.command) {
- edit_button->set_pressed(true);
- key_editor_tab->show();
- }
- } else {
- //button column
- int ofsx = size.width - mpos.x;
- if (ofsx < 0)
- break;
- /*
- if (ofsx < remove_icon->get_width()) {
-
- undo_redo->create_action("Remove Anim Track");
- undo_redo->add_do_method(animation.ptr(),"remove_track",idx);
- undo_redo->add_undo_method(animation.ptr(),"add_track",animation->track_get_type(idx),idx);
- undo_redo->add_undo_method(animation.ptr(),"track_set_path",idx,animation->track_get_path(idx));
- //todo interpolation
- for(int i=0;i<animation->track_get_key_count(idx);i++) {
+ SelectedKey sk;
+ sk.track = idx;
+ sk.key = key;
+ KeyInfo ki;
+ ki.pos = animation->track_get_key_time(idx, key);
+ click.shift = mb->get_shift();
+ click.selk = sk;
- Variant v = animation->track_get_key_value(idx,i);
- float time = animation->track_get_key_time(idx,i);
- float trans = animation->track_get_key_transition(idx,i);
+ if (!mb->get_shift() && !selection.has(sk))
+ _clear_selection();
- undo_redo->add_undo_method(animation.ptr(),"track_insert_key",idx,time,v);
- undo_redo->add_undo_method(animation.ptr(),"track_set_key_transition",idx,i,trans);
+ selection.insert(sk, ki);
- }
+ click.click = ClickOver::CLICK_MOVE_KEYS;
+ click.at = mb->get_pos();
+ click.to = click.at;
+ update();
+ selected_track = idx;
+ track_editor->update();
- undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",idx,animation->track_get_interpolation_type(idx));
- if (animation->track_get_type(idx)==Animation::TYPE_VALUE) {
- undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",idx,animation->value_track_is_continuous(idx));
+ if (_edit_if_single_selection() && mb->get_command()) {
+ edit_button->set_pressed(true);
+ key_editor_tab->show();
+ }
+ } else {
+ //button column
+ int ofsx = size.width - mpos.x;
+ if (ofsx < 0)
+ return;
+ /*
+ if (ofsx < remove_icon->get_width()) {
- }
+ undo_redo->create_action("Remove Anim Track");
+ undo_redo->add_do_method(animation.ptr(),"remove_track",idx);
+ undo_redo->add_undo_method(animation.ptr(),"add_track",animation->track_get_type(idx),idx);
+ undo_redo->add_undo_method(animation.ptr(),"track_set_path",idx,animation->track_get_path(idx));
+ //todo interpolation
+ for(int i=0;i<animation->track_get_key_count(idx);i++) {
- undo_redo->commit_action();
+ Variant v = animation->track_get_key_value(idx,i);
+ float time = animation->track_get_key_time(idx,i);
+ float trans = animation->track_get_key_transition(idx,i);
+ undo_redo->add_undo_method(animation.ptr(),"track_insert_key",idx,time,v);
+ undo_redo->add_undo_method(animation.ptr(),"track_set_key_transition",idx,i,trans);
- return;
}
- ofsx-=hsep+remove_icon->get_width();
-
- if (ofsx < move_down_icon->get_width()) {
+ undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",idx,animation->track_get_interpolation_type(idx));
+ if (animation->track_get_type(idx)==Animation::TYPE_VALUE) {
+ undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",idx,animation->value_track_is_continuous(idx));
- if (idx < animation->get_track_count() -1) {
- undo_redo->create_action("Move Anim Track Down");
- undo_redo->add_do_method(animation.ptr(),"track_move_up",idx);
- undo_redo->add_undo_method(animation.ptr(),"track_move_down",idx+1);
- undo_redo->commit_action();
- }
- return;
}
- ofsx-=hsep+move_down_icon->get_width();
+ undo_redo->commit_action();
- if (ofsx < move_up_icon->get_width()) {
- if (idx >0) {
- undo_redo->create_action("Move Anim Track Up");
- undo_redo->add_do_method(animation.ptr(),"track_move_down",idx);
- undo_redo->add_undo_method(animation.ptr(),"track_move_up",idx-1);
- undo_redo->commit_action();
- }
- return;
- }
+ return;
+ }
+ ofsx-=hsep+remove_icon->get_width();
- ofsx-=hsep*3+move_up_icon->get_width();
- */
+ if (ofsx < move_down_icon->get_width()) {
- if (ofsx < track_ofs[1]) {
+ if (idx < animation->get_track_count() -1) {
+ undo_redo->create_action("Move Anim Track Down");
+ undo_redo->add_do_method(animation.ptr(),"track_move_up",idx);
+ undo_redo->add_undo_method(animation.ptr(),"track_move_down",idx+1);
+ undo_redo->commit_action();
+ }
+ return;
+ }
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- static const char *interp_name[2] = { "Clamp Loop Interp", "Wrap Loop Interp" };
- for (int i = 0; i < 2; i++) {
- track_menu->add_icon_item(wrap_icon[i], interp_name[i]);
- }
+ ofsx-=hsep+move_down_icon->get_width();
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[1];
+ if (ofsx < move_up_icon->get_width()) {
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
+ if (idx >0) {
+ undo_redo->create_action("Move Anim Track Up");
+ undo_redo->add_do_method(animation.ptr(),"track_move_down",idx);
+ undo_redo->add_undo_method(animation.ptr(),"track_move_up",idx-1);
+ undo_redo->commit_action();
+ }
+ return;
+ }
- wrap_editing = idx;
- interp_editing = -1;
- cont_editing = -1;
- track_menu->popup();
+ ofsx-=hsep*3+move_up_icon->get_width();
+ */
- return;
+ if (ofsx < track_ofs[1]) {
+
+ track_menu->clear();
+ track_menu->set_size(Point2(1, 1));
+ static const char *interp_name[2] = { "Clamp Loop Interp", "Wrap Loop Interp" };
+ for (int i = 0; i < 2; i++) {
+ track_menu->add_icon_item(wrap_icon[i], interp_name[i]);
}
- if (ofsx < track_ofs[2]) {
+ int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
+ int popup_x = size.width - track_ofs[1];
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- static const char *interp_name[3] = { "Nearest", "Linear", "Cubic" };
- for (int i = 0; i < 3; i++) {
- track_menu->add_icon_item(interp_icon[i], interp_name[i]);
- }
+ track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[2];
+ wrap_editing = idx;
+ interp_editing = -1;
+ cont_editing = -1;
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
+ track_menu->popup();
- interp_editing = idx;
- cont_editing = -1;
- wrap_editing = -1;
+ return;
+ }
- track_menu->popup();
+ if (ofsx < track_ofs[2]) {
- return;
+ track_menu->clear();
+ track_menu->set_size(Point2(1, 1));
+ static const char *interp_name[3] = { "Nearest", "Linear", "Cubic" };
+ for (int i = 0; i < 3; i++) {
+ track_menu->add_icon_item(interp_icon[i], interp_name[i]);
}
- if (ofsx < track_ofs[3]) {
+ int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
+ int popup_x = size.width - track_ofs[2];
- track_menu->clear();
- track_menu->set_size(Point2(1, 1));
- String cont_name[3] = { TTR("Continuous"), TTR("Discrete"), TTR("Trigger") };
- for (int i = 0; i < 3; i++) {
- track_menu->add_icon_item(cont_icon[i], cont_name[i]);
- }
+ track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
- int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
- int popup_x = size.width - track_ofs[3];
+ interp_editing = idx;
+ cont_editing = -1;
+ wrap_editing = -1;
- track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
+ track_menu->popup();
- interp_editing = -1;
- wrap_editing = -1;
- cont_editing = idx;
+ return;
+ }
- track_menu->popup();
+ if (ofsx < track_ofs[3]) {
- return;
+ track_menu->clear();
+ track_menu->set_size(Point2(1, 1));
+ String cont_name[3] = { TTR("Continuous"), TTR("Discrete"), TTR("Trigger") };
+ for (int i = 0; i < 3; i++) {
+ track_menu->add_icon_item(cont_icon[i], cont_name[i]);
}
- if (ofsx < track_ofs[4]) {
+ int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h;
+ int popup_x = size.width - track_ofs[3];
- Animation::TrackType tt = animation->track_get_type(idx);
+ track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y));
- float pos = timeline_pos;
- int existing = animation->track_find_key(idx, pos, true);
+ interp_editing = -1;
+ wrap_editing = -1;
+ cont_editing = idx;
- Variant newval;
+ track_menu->popup();
- if (tt == Animation::TYPE_TRANSFORM) {
- Dictionary d;
- d["loc"] = Vector3();
- d["rot"] = Quat();
- d["scale"] = Vector3();
- newval = d;
+ return;
+ }
- } else if (tt == Animation::TYPE_METHOD) {
+ if (ofsx < track_ofs[4]) {
- Dictionary d;
- d["method"] = "";
- d["args"] = Vector<Variant>();
+ Animation::TrackType tt = animation->track_get_type(idx);
- newval = d;
- } else if (tt == Animation::TYPE_VALUE) {
+ float pos = timeline_pos;
+ int existing = animation->track_find_key(idx, pos, true);
- NodePath np;
- PropertyInfo inf = _find_hint_for_track(idx, np);
- if (inf.type != Variant::NIL) {
+ Variant newval;
- Variant::CallError err;
- newval = Variant::construct(inf.type, NULL, 0, err);
- }
+ if (tt == Animation::TYPE_TRANSFORM) {
+ Dictionary d;
+ d["loc"] = Vector3();
+ d["rot"] = Quat();
+ d["scale"] = Vector3();
+ newval = d;
- if (newval.get_type() == Variant::NIL) {
- //popup a new type
- cvi_track = idx;
- cvi_pos = pos;
+ } else if (tt == Animation::TYPE_METHOD) {
- type_menu->set_position(get_global_position() + mpos + ofs);
- type_menu->popup();
- return;
- }
- }
+ Dictionary d;
+ d["method"] = "";
+ d["args"] = Vector<Variant>();
- undo_redo->create_action(TTR("Anim Add Key"));
+ newval = d;
+ } else if (tt == Animation::TYPE_VALUE) {
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", idx, pos, newval, 1);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", idx, pos);
+ NodePath np;
+ PropertyInfo inf = _find_hint_for_track(idx, np);
+ if (inf.type != Variant::NIL) {
- if (existing != -1) {
- Variant v = animation->track_get_key_value(idx, existing);
- float trans = animation->track_get_key_transition(idx, existing);
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", idx, pos, v, trans);
+ Variant::CallError err;
+ newval = Variant::construct(inf.type, NULL, 0, err);
}
- undo_redo->commit_action();
+ if (newval.get_type() == Variant::NIL) {
+ //popup a new type
+ cvi_track = idx;
+ cvi_pos = pos;
- return;
+ type_menu->set_position(get_global_position() + mpos + ofs);
+ type_menu->popup();
+ return;
+ }
}
- }
- } else {
+ undo_redo->create_action(TTR("Anim Add Key"));
- switch (click.click) {
- case ClickOver::CLICK_SELECT_KEYS: {
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", idx, pos, newval, 1);
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", idx, pos);
- float zoom_scale = _get_zoom_scale();
- float keys_from = h_scroll->get_value();
- float keys_to = keys_from + (settings_limit - name_limit) / zoom_scale;
+ if (existing != -1) {
+ Variant v = animation->track_get_key_value(idx, existing);
+ float trans = animation->track_get_key_transition(idx, existing);
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", idx, pos, v, trans);
+ }
- float from_time = keys_from + (click.at.x - (name_limit + ofs.x)) / zoom_scale;
- float to_time = keys_from + (click.to.x - (name_limit + ofs.x)) / zoom_scale;
+ undo_redo->commit_action();
- if (to_time < from_time)
- SWAP(from_time, to_time);
+ return;
+ }
+ }
- if (from_time > keys_to || to_time < keys_from)
- break;
+ } else {
- if (from_time < keys_from)
- from_time = keys_from;
+ switch (click.click) {
+ case ClickOver::CLICK_SELECT_KEYS: {
- if (to_time >= keys_to)
- to_time = keys_to;
+ float zoom_scale = _get_zoom_scale();
+ float keys_from = h_scroll->get_value();
+ float keys_to = keys_from + (settings_limit - name_limit) / zoom_scale;
- int from_track = int(click.at.y - ofs.y - h - sep) / h + v_scroll->get_value();
- int to_track = int(click.to.y - ofs.y - h - sep) / h + v_scroll->get_value();
- int from_mod = int(click.at.y - ofs.y - sep) % h;
- int to_mod = int(click.to.y - ofs.y - sep) % h;
+ float from_time = keys_from + (click.at.x - (name_limit + ofs.x)) / zoom_scale;
+ float to_time = keys_from + (click.to.x - (name_limit + ofs.x)) / zoom_scale;
- if (to_track < from_track) {
+ if (to_time < from_time)
+ SWAP(from_time, to_time);
- SWAP(from_track, to_track);
- SWAP(from_mod, to_mod);
- }
+ if (from_time > keys_to || to_time < keys_from)
+ break;
- if ((from_mod > (h / 2)) && ((click.at.y - ofs.y) >= (h + sep))) {
- from_track++;
- }
+ if (from_time < keys_from)
+ from_time = keys_from;
- if (to_mod < h / 2) {
- to_track--;
- }
+ if (to_time >= keys_to)
+ to_time = keys_to;
- if (from_track > to_track) {
- if (!click.shift)
- _clear_selection();
- _edit_if_single_selection();
- break;
- }
+ int from_track = int(click.at.y - ofs.y - h - sep) / h + v_scroll->get_value();
+ int to_track = int(click.to.y - ofs.y - h - sep) / h + v_scroll->get_value();
+ int from_mod = int(click.at.y - ofs.y - sep) % h;
+ int to_mod = int(click.to.y - ofs.y - sep) % h;
+
+ if (to_track < from_track) {
- int tracks_from = v_scroll->get_value();
- int tracks_to = v_scroll->get_value() + fit - 1;
- if (tracks_to >= animation->get_track_count())
- tracks_to = animation->get_track_count() - 1;
+ SWAP(from_track, to_track);
+ SWAP(from_mod, to_mod);
+ }
+
+ if ((from_mod > (h / 2)) && ((click.at.y - ofs.y) >= (h + sep))) {
+ from_track++;
+ }
- tracks_from = 0;
+ if (to_mod < h / 2) {
+ to_track--;
+ }
+
+ if (from_track > to_track) {
+ if (!click.shift)
+ _clear_selection();
+ _edit_if_single_selection();
+ break;
+ }
+
+ int tracks_from = v_scroll->get_value();
+ int tracks_to = v_scroll->get_value() + fit - 1;
+ if (tracks_to >= animation->get_track_count())
tracks_to = animation->get_track_count() - 1;
- if (to_track > tracks_to)
- to_track = tracks_to;
- if (from_track < tracks_from)
- from_track = tracks_from;
-
- if (from_track > tracks_to || to_track < tracks_from) {
- if (!click.shift)
- _clear_selection();
- _edit_if_single_selection();
- break;
- }
+ tracks_from = 0;
+ tracks_to = animation->get_track_count() - 1;
+ if (to_track > tracks_to)
+ to_track = tracks_to;
+ if (from_track < tracks_from)
+ from_track = tracks_from;
+
+ if (from_track > tracks_to || to_track < tracks_from) {
if (!click.shift)
_clear_selection();
+ _edit_if_single_selection();
+ break;
+ }
- int higher_track = 0x7FFFFFFF;
- for (int i = from_track; i <= to_track; i++) {
+ if (!click.shift)
+ _clear_selection();
- int kc = animation->track_get_key_count(i);
- for (int j = 0; j < kc; j++) {
+ int higher_track = 0x7FFFFFFF;
+ for (int i = from_track; i <= to_track; i++) {
- float t = animation->track_get_key_time(i, j);
- if (t < from_time)
- continue;
- if (t > to_time)
- break;
+ int kc = animation->track_get_key_count(i);
+ for (int j = 0; j < kc; j++) {
- if (i < higher_track)
- higher_track = i;
+ float t = animation->track_get_key_time(i, j);
+ if (t < from_time)
+ continue;
+ if (t > to_time)
+ break;
- SelectedKey sk;
- sk.track = i;
- sk.key = j;
- KeyInfo ki;
- ki.pos = t;
- selection[sk] = ki;
- }
- }
+ if (i < higher_track)
+ higher_track = i;
- if (higher_track != 0x7FFFFFFF) {
- selected_track = higher_track;
- track_editor->update();
+ SelectedKey sk;
+ sk.track = i;
+ sk.key = j;
+ KeyInfo ki;
+ ki.pos = t;
+ selection[sk] = ki;
}
+ }
- _edit_if_single_selection();
+ if (higher_track != 0x7FFFFFFF) {
+ selected_track = higher_track;
+ track_editor->update();
+ }
- } break;
- case ClickOver::CLICK_MOVE_KEYS: {
+ _edit_if_single_selection();
- if (selection.empty())
- break;
- if (click.at == click.to) {
+ } break;
+ case ClickOver::CLICK_MOVE_KEYS: {
- if (!click.shift) {
+ if (selection.empty())
+ break;
+ if (click.at == click.to) {
- KeyInfo ki = selection[click.selk];
- _clear_selection();
- selection[click.selk] = ki;
- _edit_if_single_selection();
- }
+ if (!click.shift) {
- break;
+ KeyInfo ki = selection[click.selk];
+ _clear_selection();
+ selection[click.selk] = ki;
+ _edit_if_single_selection();
}
- float from_t = 1e20;
+ break;
+ }
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
- float t = animation->track_get_key_time(E->key().track, E->key().key);
- if (t < from_t)
- from_t = t;
- }
+ float from_t = 1e20;
- float motion = from_t + (click.to.x - click.at.x) / _get_zoom_scale();
- if (step->get_value())
- motion = Math::stepify(motion, step->get_value());
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.front(); E; E = E->next()) {
+ float t = animation->track_get_key_time(E->key().track, E->key().key);
+ if (t < from_t)
+ from_t = t;
+ }
- undo_redo->create_action(TTR("Anim Move Keys"));
+ float motion = from_t + (click.to.x - click.at.x) / _get_zoom_scale();
+ if (step->get_value())
+ motion = Math::stepify(motion, step->get_value());
- List<_AnimMoveRestore> to_restore;
+ undo_redo->create_action(TTR("Anim Move Keys"));
- // 1-remove the keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ List<_AnimMoveRestore> to_restore;
- undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
- }
- // 2- remove overlapped keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ // 1-remove the keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
- float newtime = E->get().pos - from_t + motion;
- int idx = animation->track_find_key(E->key().track, newtime, true);
- if (idx == -1)
- continue;
- SelectedKey sk;
- sk.key = idx;
- sk.track = E->key().track;
- if (selection.has(sk))
- continue; //already in selection, don't save
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
+ }
+ // 2- remove overlapped keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+
+ float newtime = E->get().pos - from_t + motion;
+ int idx = animation->track_find_key(E->key().track, newtime, true);
+ if (idx == -1)
+ continue;
+ SelectedKey sk;
+ sk.key = idx;
+ sk.track = E->key().track;
+ if (selection.has(sk))
+ continue; //already in selection, don't save
+
+ undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newtime);
+ _AnimMoveRestore amr;
+
+ amr.key = animation->track_get_key_value(E->key().track, idx);
+ amr.track = E->key().track;
+ amr.time = newtime;
+ amr.transition = animation->track_get_key_transition(E->key().track, idx);
+
+ to_restore.push_back(amr);
+ }
- undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newtime);
- _AnimMoveRestore amr;
+ // 3-move the keys (re insert them)
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
- amr.key = animation->track_get_key_value(E->key().track, idx);
- amr.track = E->key().track;
- amr.time = newtime;
- amr.transition = animation->track_get_key_transition(E->key().track, idx);
+ float newpos = E->get().pos - from_t + motion;
+ /*
+ if (newpos<0)
+ continue; //no add at the beginning
+ */
+ undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
- to_restore.push_back(amr);
- }
+ // 4-(undo) remove inserted keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
- // 3-move the keys (re insert them)
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ float newpos = E->get().pos + -from_t + motion;
+ /*
+ if (newpos<0)
+ continue; //no remove what no inserted
+ */
+ undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newpos);
+ }
- float newpos = E->get().pos - from_t + motion;
- /*
- if (newpos<0)
- continue; //no add at the beginning
- */
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->key().track, newpos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
+ // 5-(undo) reinsert keys
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
- // 4-(undo) remove inserted keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
+ }
- float newpos = E->get().pos + -from_t + motion;
- /*
- if (newpos<0)
- continue; //no remove what no inserted
- */
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_pos", E->key().track, newpos);
- }
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
- // 5-(undo) reinsert keys
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->key().track, E->get().pos, animation->track_get_key_value(E->key().track, E->key().key), animation->track_get_key_transition(E->key().track, E->key().key));
- }
+ // 6-(undo) reinsert overlapped keys
+ for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+ _AnimMoveRestore &amr = E->get();
+ undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
+ }
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
+ undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
+ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- // 6-(undo) reinsert overlapped keys
- for (List<_AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) {
+ // 7-reselect
- _AnimMoveRestore &amr = E->get();
- undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, amr.transition);
- }
+ for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
- undo_redo->add_do_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
+ float oldpos = E->get().pos;
+ float newpos = oldpos - from_t + motion;
+ //if (newpos>=0)
+ undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
+ undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
+ }
- // 7-reselect
+ undo_redo->commit_action();
+ _edit_if_single_selection();
- for (Map<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
+ } break;
+ default: {}
+ }
- float oldpos = E->get().pos;
- float newpos = oldpos - from_t + motion;
- //if (newpos>=0)
- undo_redo->add_do_method(this, "_select_at_anim", animation, E->key().track, newpos);
- undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, oldpos);
- }
+ //button released
+ click.click = ClickOver::CLICK_NONE;
+ track_editor->update();
+ }
+ }
+ }
- undo_redo->commit_action();
- _edit_if_single_selection();
+ Ref<InputEventMouseMotion> mm = p_input;
- } break;
- default: {}
- }
+ if (mm.is_valid()) {
- //button released
- click.click = ClickOver::CLICK_NONE;
- track_editor->update();
- }
- }
+ mouse_over.over = MouseOver::OVER_NONE;
+ mouse_over.track = -1;
+ te->update();
+ track_editor->set_tooltip("");
- } break;
+ if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
+ track_editor->call_deferred("grab_focus");
- case InputEvent::MOUSE_MOTION: {
+ if (click.click != ClickOver::CLICK_NONE) {
- const InputEventMouseMotion &mb = p_input.mouse_motion;
+ switch (click.click) {
+ case ClickOver::CLICK_RESIZE_NAMES: {
- mouse_over.over = MouseOver::OVER_NONE;
- mouse_over.track = -1;
- te->update();
- track_editor->set_tooltip("");
+ float base = click.at.y;
+ float clickp = click.at.x - ofs.x;
+ float dif = base - clickp;
- if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
- track_editor->call_deferred("grab_focus");
+ float target = mb->get_pos().x + dif - ofs.x;
- if (click.click != ClickOver::CLICK_NONE) {
+ float ratio = target / settings_limit;
- switch (click.click) {
- case ClickOver::CLICK_RESIZE_NAMES: {
+ if (ratio > 0.9)
+ ratio = 0.9;
+ else if (ratio < 0.2)
+ ratio = 0.2;
- float base = click.at.y;
- float clickp = click.at.x - ofs.x;
- float dif = base - clickp;
+ name_column_ratio = ratio;
- float target = mb.x + dif - ofs.x;
+ } break;
+ case ClickOver::CLICK_DRAG_TIMELINE: {
- float ratio = target / settings_limit;
+ Point2 mpos = mb->get_pos() - ofs;
+ /*
+ if (mpos.x<name_limit)
+ mpos.x=name_limit;
+ if (mpos.x>settings_limit)
+ mpos.x=settings_limit;
+ */
- if (ratio > 0.9)
- ratio = 0.9;
- else if (ratio < 0.2)
- ratio = 0.2;
+ //int zoomw = settings_limit-name_limit;
+ float scale = _get_zoom_scale();
+ float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
+ if (animation->get_step()) {
+ pos = Math::stepify(pos, animation->get_step());
+ }
+ if (pos < 0)
+ pos = 0;
+ if (pos >= animation->get_length())
+ pos = animation->get_length();
+
+ if (pos < h_scroll->get_value()) {
+ h_scroll->set_value(pos);
+ } else if (pos > h_scroll->get_value() + (settings_limit - name_limit) / scale) {
+ h_scroll->set_value(pos - (settings_limit - name_limit) / scale);
+ }
- name_column_ratio = ratio;
+ timeline_pos = pos;
+ emit_signal("timeline_changed", pos, true);
- } break;
- case ClickOver::CLICK_DRAG_TIMELINE: {
-
- Point2 mpos = Point2(mb.x, mb.y) - ofs;
- /*
- if (mpos.x<name_limit)
- mpos.x=name_limit;
- if (mpos.x>settings_limit)
- mpos.x=settings_limit;
- */
+ } break;
+ case ClickOver::CLICK_SELECT_KEYS: {
- //int zoomw = settings_limit-name_limit;
- float scale = _get_zoom_scale();
- float pos = h_scroll->get_value() + (mpos.x - name_limit) / scale;
- if (animation->get_step()) {
- pos = Math::stepify(pos, animation->get_step());
- }
- if (pos < 0)
- pos = 0;
- if (pos >= animation->get_length())
- pos = animation->get_length();
+ click.to = mb->get_pos();
+ if (click.to.y < h && click.at.y > h && mm->get_relative().y < 0) {
- if (pos < h_scroll->get_value()) {
- h_scroll->set_value(pos);
- } else if (pos > h_scroll->get_value() + (settings_limit - name_limit) / scale) {
- h_scroll->set_value(pos - (settings_limit - name_limit) / scale);
- }
+ float prev = v_scroll->get_value();
+ v_scroll->set_value(v_scroll->get_value() - 1);
+ if (prev != v_scroll->get_value())
+ click.at.y += h;
+ }
+ if (click.to.y > size.height && click.at.y < size.height && mm->get_relative().y > 0) {
- timeline_pos = pos;
- emit_signal("timeline_changed", pos, true);
+ float prev = v_scroll->get_value();
+ v_scroll->set_value(v_scroll->get_value() + 1);
+ if (prev != v_scroll->get_value())
+ click.at.y -= h;
+ }
- } break;
- case ClickOver::CLICK_SELECT_KEYS: {
+ } break;
+ case ClickOver::CLICK_MOVE_KEYS: {
- click.to = Point2(mb.x, mb.y);
- if (click.to.y < h && click.at.y > h && mb.relative_y < 0) {
+ click.to = mb->get_pos();
+ } break;
+ default: {}
+ }
- float prev = v_scroll->get_value();
- v_scroll->set_value(v_scroll->get_value() - 1);
- if (prev != v_scroll->get_value())
- click.at.y += h;
- }
- if (click.to.y > size.height && click.at.y < size.height && mb.relative_y > 0) {
+ return;
+ } else if (mb->get_button_mask() & BUTTON_MASK_MIDDLE) {
- float prev = v_scroll->get_value();
- v_scroll->set_value(v_scroll->get_value() + 1);
- if (prev != v_scroll->get_value())
- click.at.y -= h;
- }
+ int rel = mm->get_relative().x;
+ float relf = rel / _get_zoom_scale();
+ h_scroll->set_value(h_scroll->get_value() - relf);
+ }
- } break;
- case ClickOver::CLICK_MOVE_KEYS: {
+ if (mb->get_button_mask() == 0) {
- click.to = Point2(mb.x, mb.y);
- } break;
- default: {}
- }
+ Point2 mpos = mb->get_pos() - ofs;
+ if (mpos.y < h) {
+#if 0
+ //seek
+ //int zoomw = settings_limit-name_limit;
+ float scale = _get_zoom_scale();
+ float pos = h_scroll->get_val() + (mpos.y-name_limit) / scale;
+ if (pos<0 )
+ pos=0;
+ if (pos>=animation->get_length())
+ pos=animation->get_length();
+ timeline->set_val(pos);
+#endif
return;
- } else if (mb.button_mask & BUTTON_MASK_MIDDLE) {
-
- int rel = mb.relative_x;
- float relf = rel / _get_zoom_scale();
- h_scroll->set_value(h_scroll->get_value() - relf);
}
- if (mb.button_mask == 0) {
+ mpos.y -= h;
- Point2 mpos = Point2(mb.x, mb.y) - ofs;
+ int idx = mpos.y / h;
+ idx += v_scroll->get_value();
+ if (idx < 0 || idx >= animation->get_track_count())
+ return;
- if (mpos.y < h) {
-#if 0
- //seek
- //int zoomw = settings_limit-name_limit;
- float scale = _get_zoom_scale();
- float pos = h_scroll->get_val() + (mpos.y-name_limit) / scale;
- if (pos<0 )
- pos=0;
- if (pos>=animation->get_length())
- pos=animation->get_length();
- timeline->set_val(pos);
-#endif
- return;
- }
+ mouse_over.track = idx;
- mpos.y -= h;
+ if (mpos.x < name_limit) {
+ //name column
- int idx = mpos.y / h;
- idx += v_scroll->get_value();
- if (idx < 0 || idx >= animation->get_track_count())
- break;
+ mouse_over.over = MouseOver::OVER_NAME;
- mouse_over.track = idx;
+ } else if (mpos.x < settings_limit) {
- if (mpos.x < name_limit) {
- //name column
+ float pos = mpos.x - name_limit;
+ pos /= _get_zoom_scale();
+ pos += h_scroll->get_value();
+ float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
- mouse_over.over = MouseOver::OVER_NAME;
+ int kidx = animation->track_find_key(idx, pos);
+ int kidx_n = kidx + 1;
- } else if (mpos.x < settings_limit) {
+ bool found = false;
- float pos = mpos.x - name_limit;
- pos /= _get_zoom_scale();
- pos += h_scroll->get_value();
- float w_time = (type_icon[0]->get_width() / _get_zoom_scale()) / 2.0;
+ if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
- int kidx = animation->track_find_key(idx, pos);
- int kidx_n = kidx + 1;
+ float kpos = animation->track_get_key_time(idx, kidx);
+ if (ABS(pos - kpos) <= w_time) {
- bool found = false;
+ mouse_over.over = MouseOver::OVER_KEY;
+ mouse_over.track = idx;
+ mouse_over.over_key = kidx;
+ found = true;
+ }
+ }
- if (kidx >= 0 && kidx < animation->track_get_key_count(idx)) {
+ if (!found && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
- float kpos = animation->track_get_key_time(idx, kidx);
- if (ABS(pos - kpos) <= w_time) {
+ float kpos = animation->track_get_key_time(idx, kidx_n);
+ if (ABS(pos - kpos) <= w_time) {
- mouse_over.over = MouseOver::OVER_KEY;
- mouse_over.track = idx;
- mouse_over.over_key = kidx;
- found = true;
- }
+ mouse_over.over = MouseOver::OVER_KEY;
+ mouse_over.track = idx;
+ mouse_over.over_key = kidx_n;
+ found = true;
}
+ }
- if (!found && kidx_n >= 0 && kidx_n < animation->track_get_key_count(idx)) {
+ if (found) {
- float kpos = animation->track_get_key_time(idx, kidx_n);
- if (ABS(pos - kpos) <= w_time) {
+ String text;
+ text = "time: " + rtos(animation->track_get_key_time(idx, mouse_over.over_key)) + "\n";
- mouse_over.over = MouseOver::OVER_KEY;
- mouse_over.track = idx;
- mouse_over.over_key = kidx_n;
- found = true;
- }
- }
+ switch (animation->track_get_type(idx)) {
- if (found) {
-
- String text;
- text = "time: " + rtos(animation->track_get_key_time(idx, mouse_over.over_key)) + "\n";
-
- switch (animation->track_get_type(idx)) {
-
- case Animation::TYPE_TRANSFORM: {
-
- Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
- if (d.has("loc"))
- text += "loc: " + String(d["loc"]) + "\n";
- if (d.has("rot"))
- text += "rot: " + String(d["rot"]) + "\n";
- if (d.has("scale"))
- text += "scale: " + String(d["scale"]) + "\n";
- } break;
- case Animation::TYPE_VALUE: {
-
- Variant v = animation->track_get_key_value(idx, mouse_over.over_key);
- //text+="value: "+String(v)+"\n";
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Node *node = root->get_node_and_resource(animation->track_get_path(idx), res);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj) {
- valid_type = obj->get_static_property_type(animation->track_get_path(idx).get_property(), &prop_exists);
- }
-
- text += "type: " + Variant::get_type_name(v.get_type()) + "\n";
- if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
- text += "value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
- } else {
- text += "value: " + String(v) + "\n";
- }
-
- } break;
- case Animation::TYPE_METHOD: {
-
- Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
- if (d.has("method"))
- text += String(d["method"]);
- text += "(";
- Vector<Variant> args;
- if (d.has("args"))
- args = d["args"];
- for (int i = 0; i < args.size(); i++) {
-
- if (i > 0)
- text += ", ";
- text += String(args[i]);
- }
- text += ")\n";
-
- } break;
- }
- text += "easing: " + rtos(animation->track_get_key_transition(idx, mouse_over.over_key));
+ case Animation::TYPE_TRANSFORM: {
- track_editor->set_tooltip(text);
- return;
- }
+ Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
+ if (d.has("loc"))
+ text += "loc: " + String(d["loc"]) + "\n";
+ if (d.has("rot"))
+ text += "rot: " + String(d["rot"]) + "\n";
+ if (d.has("scale"))
+ text += "scale: " + String(d["scale"]) + "\n";
+ } break;
+ case Animation::TYPE_VALUE: {
- } else {
- //button column
- int ofsx = size.width - mpos.x;
- if (ofsx < 0)
- break;
- /*
- if (ofsx < remove_icon->get_width()) {
+ Variant v = animation->track_get_key_value(idx, mouse_over.over_key);
+ //text+="value: "+String(v)+"\n";
- mouse_over.over=MouseOver::OVER_REMOVE;
+ bool prop_exists = false;
+ Variant::Type valid_type = Variant::NIL;
+ Object *obj = NULL;
- return;
- }
+ RES res;
+ Node *node = root->get_node_and_resource(animation->track_get_path(idx), res);
- ofsx-=hsep+remove_icon->get_width();
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
- if (ofsx < move_down_icon->get_width()) {
+ if (obj) {
+ valid_type = obj->get_static_property_type(animation->track_get_path(idx).get_property(), &prop_exists);
+ }
- mouse_over.over=MouseOver::OVER_DOWN;
- return;
+ text += "type: " + Variant::get_type_name(v.get_type()) + "\n";
+ if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
+ text += "value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
+ } else {
+ text += "value: " + String(v) + "\n";
+ }
+
+ } break;
+ case Animation::TYPE_METHOD: {
+
+ Dictionary d = animation->track_get_key_value(idx, mouse_over.over_key);
+ if (d.has("method"))
+ text += String(d["method"]);
+ text += "(";
+ Vector<Variant> args;
+ if (d.has("args"))
+ args = d["args"];
+ for (int i = 0; i < args.size(); i++) {
+
+ if (i > 0)
+ text += ", ";
+ text += String(args[i]);
+ }
+ text += ")\n";
+
+ } break;
}
+ text += "easing: " + rtos(animation->track_get_key_transition(idx, mouse_over.over_key));
- ofsx-=hsep+move_down_icon->get_width();
+ track_editor->set_tooltip(text);
+ return;
+ }
- if (ofsx < move_up_icon->get_width()) {
+ } else {
+ //button column
+ int ofsx = size.width - mpos.x;
+ if (ofsx < 0)
+ return;
+ /*
+ if (ofsx < remove_icon->get_width()) {
- mouse_over.over=MouseOver::OVER_UP;
- return;
- }
+ mouse_over.over=MouseOver::OVER_REMOVE;
- ofsx-=hsep*3+move_up_icon->get_width();
+ return;
+ }
- */
+ ofsx-=hsep+remove_icon->get_width();
- if (ofsx < down_icon->get_width() + wrap_icon[0]->get_width() + hsep * 3) {
+ if (ofsx < move_down_icon->get_width()) {
- mouse_over.over = MouseOver::OVER_WRAP;
- return;
- }
+ mouse_over.over=MouseOver::OVER_DOWN;
+ return;
+ }
- ofsx -= hsep * 3 + wrap_icon[0]->get_width() + down_icon->get_width();
+ ofsx-=hsep+move_down_icon->get_width();
- if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep * 3) {
+ if (ofsx < move_up_icon->get_width()) {
- mouse_over.over = MouseOver::OVER_INTERP;
- return;
- }
+ mouse_over.over=MouseOver::OVER_UP;
+ return;
+ }
- ofsx -= hsep * 2 + interp_icon[0]->get_width() + down_icon->get_width();
+ ofsx-=hsep*3+move_up_icon->get_width();
- if (ofsx < down_icon->get_width() + cont_icon[0]->get_width() + hsep * 3) {
+*/
- mouse_over.over = MouseOver::OVER_VALUE;
- return;
- }
+ if (ofsx < down_icon->get_width() + wrap_icon[0]->get_width() + hsep * 3) {
- ofsx -= hsep * 3 + cont_icon[0]->get_width() + down_icon->get_width();
+ mouse_over.over = MouseOver::OVER_WRAP;
+ return;
+ }
- if (ofsx < add_key_icon->get_width()) {
+ ofsx -= hsep * 3 + wrap_icon[0]->get_width() + down_icon->get_width();
- mouse_over.over = MouseOver::OVER_ADD_KEY;
- return;
- }
+ if (ofsx < down_icon->get_width() + interp_icon[0]->get_width() + hsep * 3) {
+
+ mouse_over.over = MouseOver::OVER_INTERP;
+ return;
}
- }
- } break;
+ ofsx -= hsep * 2 + interp_icon[0]->get_width() + down_icon->get_width();
+
+ if (ofsx < down_icon->get_width() + cont_icon[0]->get_width() + hsep * 3) {
+
+ mouse_over.over = MouseOver::OVER_VALUE;
+ return;
+ }
+
+ ofsx -= hsep * 3 + cont_icon[0]->get_width() + down_icon->get_width();
+
+ if (ofsx < add_key_icon->get_width()) {
+
+ mouse_over.over = MouseOver::OVER_ADD_KEY;
+ return;
+ }
+ }
+ }
}
}
@@ -2905,6 +2900,8 @@ void AnimationKeyEditor::_notification(int p_what) {
key_editor->edit(key_edit);
zoomicon->set_texture(get_icon("Zoom", "EditorIcons"));
+ zoomicon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
+ zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
menu_add_track->set_icon(get_icon("AddTrack", "EditorIcons"));
menu_add_track->get_popup()->add_icon_item(get_icon("KeyValue", "EditorIcons"), "Add Normal Track", ADD_TRACK_MENU_ADD_VALUE_TRACK);
@@ -3767,7 +3764,6 @@ AnimationKeyEditor::AnimationKeyEditor() {
//add_child(menu);
zoomicon = memnew(TextureRect);
- zoomicon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hb->add_child(zoomicon);
zoomicon->set_tooltip(TTR("Animation zoom."));
@@ -3943,6 +3939,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
v_scroll->set_value(0);
key_editor_tab = memnew(TabContainer);
+ key_editor_tab->set_tab_align(TabContainer::ALIGN_LEFT);
hb->add_child(key_editor_tab);
key_editor_tab->set_custom_minimum_size(Size2(200, 0));
diff --git a/editor/animation_editor.h b/editor/animation_editor.h
index 0f6cc95634..128481c837 100644
--- a/editor/animation_editor.h
+++ b/editor/animation_editor.h
@@ -273,7 +273,7 @@ class AnimationKeyEditor : public VBoxContainer {
float _get_zoom_scale() const;
void _track_editor_draw();
- void _track_editor_gui_input(const InputEvent &p_input);
+ void _track_editor_gui_input(const Ref<InputEvent> &p_input);
void _track_pos_draw();
void _track_name_changed(const String &p_name);
diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp
index 971adb14cf..fcb92e13b4 100644
--- a/editor/asset_library_editor_plugin.cpp
+++ b/editor/asset_library_editor_plugin.cpp
@@ -683,17 +683,18 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt
int len = image_data.size();
PoolByteArray::Read r = image_data.read();
- Image image(r.ptr(), len);
- if (!image.empty()) {
+ Ref<Image> image = Ref<Image>(memnew(Image(r.ptr(), len)));
+
+ if (!image->empty()) {
float max_height = 10000;
switch (image_queue[p_queue_id].image_type) {
case IMAGE_QUEUE_ICON: max_height = 80; break;
case IMAGE_QUEUE_THUMBNAIL: max_height = 80; break;
case IMAGE_QUEUE_SCREENSHOT: max_height = 345; break;
}
- float scale_ratio = max_height / image.get_height();
+ float scale_ratio = max_height / image->get_height();
if (scale_ratio < 1) {
- image.resize(image.get_width() * scale_ratio, image.get_height() * scale_ratio, Image::INTERPOLATE_CUBIC);
+ image->resize(image->get_width() * scale_ratio, image->get_height() * scale_ratio, Image::INTERPOLATE_CUBIC);
}
Ref<ImageTexture> tex;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index a84d65de0e..2e406fb23d 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -94,17 +94,16 @@ void FindReplaceBar::_notification(int p_what) {
}
}
-void FindReplaceBar::_unhandled_input(const InputEvent &p_event) {
+void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid()) {
- const InputEventKey &k = p_event.key;
-
- if (k.pressed && (text_edit->has_focus() || text_vbc->is_a_parent_of(get_focus_owner()))) {
+ if (k->is_pressed() && (text_edit->has_focus() || text_vbc->is_a_parent_of(get_focus_owner()))) {
bool accepted = true;
- switch (k.scancode) {
+ switch (k->get_scancode()) {
case KEY_ESCAPE: {
@@ -957,23 +956,27 @@ FindReplaceDialog::FindReplaceDialog() {
/*** CODE EDITOR ****/
-void CodeTextEditor::_text_editor_gui_input(const InputEvent &p_event) {
+void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::MOUSE_BUTTON) {
+ Ref<InputEventMouseButton> mb = p_event;
- const InputEventMouseButton &mb = p_event.mouse_button;
+ if (mb.is_valid()) {
- if (mb.pressed && mb.mod.command) {
+ if (mb->is_pressed() && mb->get_command()) {
- if (mb.button_index == BUTTON_WHEEL_UP) {
+ if (mb->get_button_index() == BUTTON_WHEEL_UP) {
_zoom_in();
- } else if (mb.button_index == BUTTON_WHEEL_DOWN) {
+ } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) {
_zoom_out();
}
}
- } else if (p_event.type == InputEvent::KEY) {
+ }
+
+ Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid()) {
- if (p_event.key.pressed) {
+ if (k->is_pressed()) {
if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) {
_zoom_in();
}
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 44d526fda9..8d48c56503 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -100,7 +100,7 @@ class FindReplaceBar : public HBoxContainer {
protected:
void _notification(int p_what);
- void _unhandled_input(const InputEvent &p_event);
+ void _unhandled_input(const Ref<InputEvent> &p_event);
bool _search(uint32_t p_flags, int p_from_line, int p_from_col);
@@ -213,7 +213,7 @@ class CodeTextEditor : public VBoxContainer {
void _complete_request();
void _font_resize_timeout();
- void _text_editor_gui_input(const InputEvent &p_event);
+ void _text_editor_gui_input(const Ref<InputEvent> &p_event);
void _zoom_in();
void _zoom_out();
void _reset_zoom();
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 93c2b7493c..9762bd2000 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -239,7 +239,6 @@ void ConnectDialog::_add_bind() {
case Variant::BASIS: value = Basis(); break;
case Variant::TRANSFORM: value = Transform(); break;
case Variant::COLOR: value = Color(); break;
- case Variant::IMAGE: value = Image(); break;
default: { ERR_FAIL(); } break;
}
@@ -327,7 +326,6 @@ ConnectDialog::ConnectDialog() {
type_list->add_item("Transform", Variant::TRANSFORM);
//type_list->add_separator();
type_list->add_item("Color", Variant::COLOR);
- type_list->add_item("Image", Variant::IMAGE);
type_list->select(0);
Button *add_bind = memnew(Button);
@@ -419,6 +417,10 @@ void ConnectionsDock::_notification(int p_what) {
//RID ci = get_canvas_item();
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
}
+
+ if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+ update_tree();
+ }
}
void ConnectionsDock::_close() {
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 7c9dae1e3f..c5cfea0b95 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -109,14 +109,15 @@ void CreateDialog::_text_changed(const String &p_newtext) {
_update_search();
}
-void CreateDialog::_sbox_input(const InputEvent &p_ie) {
+void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP ||
- p_ie.key.scancode == KEY_DOWN ||
- p_ie.key.scancode == KEY_PAGEUP ||
- p_ie.key.scancode == KEY_PAGEDOWN)) {
+ Ref<InputEventKey> k = p_ie;
+ if (k.is_valid() && (k->get_scancode() == KEY_UP ||
+ k->get_scancode() == KEY_DOWN ||
+ k->get_scancode() == KEY_PAGEUP ||
+ k->get_scancode() == KEY_PAGEDOWN)) {
- search_options->call("_gui_input", p_ie);
+ search_options->call("_gui_input", k);
search_box->accept_event();
}
}
@@ -622,7 +623,6 @@ CreateDialog::CreateDialog() {
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
search_hb->add_child(search_box);
favorite = memnew(Button);
- favorite->set_flat(true);
favorite->set_toggle_mode(true);
search_hb->add_child(favorite);
favorite->connect("pressed", this, "_favorite_toggled");
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index 6170149c6b..02ce762726 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -69,7 +69,7 @@ class CreateDialog : public ConfirmationDialog {
void _history_activated();
void _favorite_activated();
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _confirmed();
void _text_changed(const String &p_newtext);
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index af95f8d919..6a79f99354 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -295,8 +295,8 @@ void DocData::generate(bool p_basic_types) {
case Variant::REAL:
//keep it
break;
- case Variant::STRING: // 15
- case Variant::NODE_PATH: // 15
+ case Variant::STRING:
+ case Variant::NODE_PATH:
default_arg_text = "\"" + default_arg_text + "\"";
break;
case Variant::TRANSFORM:
@@ -307,19 +307,19 @@ void DocData::generate(bool p_basic_types) {
default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
break;
- case Variant::RECT3: //sorry naming convention fail :( not like it's used often // 10
+ case Variant::RECT3:
case Variant::COLOR:
case Variant::PLANE:
case Variant::POOL_BYTE_ARRAY:
case Variant::POOL_INT_ARRAY:
case Variant::POOL_REAL_ARRAY:
- case Variant::POOL_STRING_ARRAY: //25
+ case Variant::POOL_STRING_ARRAY:
case Variant::POOL_VECTOR2_ARRAY:
case Variant::POOL_VECTOR3_ARRAY:
case Variant::POOL_COLOR_ARRAY:
default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
break;
- case Variant::VECTOR2: // 5
+ case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::QUAT:
@@ -331,15 +331,10 @@ void DocData::generate(bool p_basic_types) {
default_arg_text = "NULL";
break;
}
- case Variant::INPUT_EVENT:
case Variant::DICTIONARY: // 20
case Variant::ARRAY:
case Variant::_RID:
- case Variant::IMAGE:
- //case Variant::RESOURCE:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "()";
- break;
default: {}
}
@@ -481,97 +476,78 @@ void DocData::generate(bool p_basic_types) {
if (i == Variant::OBJECT)
continue; //use the core type instead
- int loops = 1;
-
- if (i == Variant::INPUT_EVENT)
- loops = InputEvent::TYPE_MAX;
-
- for (int j = 0; j < loops; j++) {
-
- String cname = Variant::get_type_name(Variant::Type(i));
-
- if (i == Variant::INPUT_EVENT) {
- static const char *ie_type[InputEvent::TYPE_MAX] = {
- "", "Key", "MouseMotion", "MouseButton", "JoypadMotion", "JoypadButton", "ScreenTouch", "ScreenDrag", "Action"
- };
- cname += ie_type[j];
- }
-
- class_list[cname] = ClassDoc();
- ClassDoc &c = class_list[cname];
- c.name = cname;
- c.category = "Built-In Types";
+ String cname = Variant::get_type_name(Variant::Type(i));
- Variant::CallError cerror;
- Variant v = Variant::construct(Variant::Type(i), NULL, 0, cerror);
-
- if (i == Variant::INPUT_EVENT) {
- v.set("type", j);
- }
+ class_list[cname] = ClassDoc();
+ ClassDoc &c = class_list[cname];
+ c.name = cname;
+ c.category = "Built-In Types";
- List<MethodInfo> method_list;
- v.get_method_list(&method_list);
- method_list.sort();
- Variant::get_constructor_list(Variant::Type(i), &method_list);
+ Variant::CallError cerror;
+ Variant v = Variant::construct(Variant::Type(i), NULL, 0, cerror);
- for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
+ List<MethodInfo> method_list;
+ v.get_method_list(&method_list);
+ method_list.sort();
+ Variant::get_constructor_list(Variant::Type(i), &method_list);
- MethodInfo &mi = E->get();
- MethodDoc method;
+ for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
- method.name = mi.name;
+ MethodInfo &mi = E->get();
+ MethodDoc method;
- for (int i = 0; i < mi.arguments.size(); i++) {
+ method.name = mi.name;
- ArgumentDoc arg;
- PropertyInfo pi = mi.arguments[i];
+ for (int i = 0; i < mi.arguments.size(); i++) {
- arg.name = pi.name;
- //print_line("arg name: "+arg.name);
- if (pi.type == Variant::NIL)
- arg.type = "var";
- else
- arg.type = Variant::get_type_name(pi.type);
- int defarg = mi.default_arguments.size() - mi.arguments.size() + i;
- if (defarg >= 0)
- arg.default_value = mi.default_arguments[defarg];
+ ArgumentDoc arg;
+ PropertyInfo pi = mi.arguments[i];
- method.arguments.push_back(arg);
- }
+ arg.name = pi.name;
+ //print_line("arg name: "+arg.name);
+ if (pi.type == Variant::NIL)
+ arg.type = "var";
+ else
+ arg.type = Variant::get_type_name(pi.type);
+ int defarg = mi.default_arguments.size() - mi.arguments.size() + i;
+ if (defarg >= 0)
+ arg.default_value = mi.default_arguments[defarg];
- if (mi.return_val.type == Variant::NIL) {
- if (mi.return_val.name != "")
- method.return_type = "var";
+ method.arguments.push_back(arg);
+ }
- } else {
- method.return_type = Variant::get_type_name(mi.return_val.type);
- }
+ if (mi.return_val.type == Variant::NIL) {
+ if (mi.return_val.name != "")
+ method.return_type = "var";
- c.methods.push_back(method);
+ } else {
+ method.return_type = Variant::get_type_name(mi.return_val.type);
}
- List<PropertyInfo> properties;
- v.get_property_list(&properties);
- for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
+ c.methods.push_back(method);
+ }
- PropertyInfo pi = E->get();
- PropertyDoc property;
- property.name = pi.name;
- property.type = Variant::get_type_name(pi.type);
+ List<PropertyInfo> properties;
+ v.get_property_list(&properties);
+ for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
- c.properties.push_back(property);
- }
+ PropertyInfo pi = E->get();
+ PropertyDoc property;
+ property.name = pi.name;
+ property.type = Variant::get_type_name(pi.type);
+
+ c.properties.push_back(property);
+ }
- List<StringName> constants;
- Variant::get_numeric_constants_for_type(Variant::Type(i), &constants);
+ List<StringName> constants;
+ Variant::get_numeric_constants_for_type(Variant::Type(i), &constants);
- for (List<StringName>::Element *E = constants.front(); E; E = E->next()) {
+ for (List<StringName>::Element *E = constants.front(); E; E = E->next()) {
- ConstantDoc constant;
- constant.name = E->get();
- constant.value = itos(Variant::get_numeric_constant_value(Variant::Type(i), E->get()));
- c.constants.push_back(constant);
- }
+ ConstantDoc constant;
+ constant.name = E->get();
+ constant.value = itos(Variant::get_numeric_constant_value(Variant::Type(i), E->get()));
+ c.constants.push_back(constant);
}
}
diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp
index bda4d80f4d..79a8f79a7c 100644
--- a/editor/doc/doc_dump.cpp
+++ b/editor/doc/doc_dump.cpp
@@ -165,8 +165,8 @@ void DocDump::dump(const String &p_file) {
case Variant::REAL:
//keep it
break;
- case Variant::STRING: // 15
- case Variant::NODE_PATH: // 15
+ case Variant::STRING:
+ case Variant::NODE_PATH:
default_arg_text = "\"" + default_arg_text + "\"";
break;
case Variant::TRANSFORM:
@@ -177,32 +177,27 @@ void DocDump::dump(const String &p_file) {
default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
break;
- case Variant::VECTOR2: // 5
+ case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::PLANE:
case Variant::QUAT:
- case Variant::RECT3: //sorry naming convention fail :( not like it's used often // 10
+ case Variant::RECT3:
case Variant::BASIS:
case Variant::COLOR:
case Variant::POOL_BYTE_ARRAY:
case Variant::POOL_INT_ARRAY:
case Variant::POOL_REAL_ARRAY:
- case Variant::POOL_STRING_ARRAY: //25
+ case Variant::POOL_STRING_ARRAY:
case Variant::POOL_VECTOR3_ARRAY:
case Variant::POOL_COLOR_ARRAY:
default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
break;
case Variant::OBJECT:
- case Variant::INPUT_EVENT:
case Variant::DICTIONARY: // 20
case Variant::ARRAY:
case Variant::_RID:
- case Variant::IMAGE:
- //case Variant::RESOURCE:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "()";
- break;
default: {}
}
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 1129a7d633..26029261b2 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -45,10 +45,6 @@ void EditorAudioBus::_notification(int p_what) {
vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
scale->set_texture(get_icon("BusVuDb", "EditorIcons"));
- solo->set_icon(get_icon("AudioBusSolo", "EditorIcons"));
- mute->set_icon(get_icon("AudioBusMute", "EditorIcons"));
- bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons"));
-
disabled_vu = get_icon("BusVuFrozen", "EditorIcons");
prev_active = true;
@@ -389,15 +385,18 @@ void EditorAudioBus::_effect_add(int p_which) {
ur->commit_action();
}
-void EditorAudioBus::_gui_input(const InputEvent &p_event) {
+void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode == KEY_DELETE && !p_event.key.echo) {
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
accept_event();
emit_signal("delete_request");
}
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 2 && p_event.mouse_button.pressed) {
- Vector2 pos = Vector2(p_event.mouse_button.x, p_event.mouse_button.y);
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
+
+ Vector2 pos = Vector2(mb->get_pos().x, mb->get_pos().y);
delete_popup->set_position(get_global_position() + pos);
delete_popup->popup();
}
@@ -631,23 +630,23 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses) {
vb->add_child(hbc);
hbc->add_spacer();
solo = memnew(ToolButton);
- solo->set_tooltip(TTR("Toggle Solo"));
+ solo->set_text("S");
solo->set_toggle_mode(true);
- // solo->set_modulate(Color(0.8, 1.2, 0.8));
+ solo->set_modulate(Color(0.8, 1.2, 0.8));
solo->set_focus_mode(FOCUS_NONE);
solo->connect("pressed", this, "_solo_toggled");
hbc->add_child(solo);
mute = memnew(ToolButton);
- mute->connect("pressed", this, "_mute_toggled");
+ mute->set_text("M");
mute->set_toggle_mode(true);
- // mute->set_modulate(Color(1.2, 0.8, 0.8));
+ mute->set_modulate(Color(1.2, 0.8, 0.8));
mute->set_focus_mode(FOCUS_NONE);
- mute->set_tooltip(TTR("Toggle Mute"));
+ mute->connect("pressed", this, "_mute_toggled");
hbc->add_child(mute);
bypass = memnew(ToolButton);
- bypass->set_tooltip(TTR("Toggle Bypass"));
+ bypass->set_text("B");
bypass->set_toggle_mode(true);
- // bypass->set_modulate(Color(1.1, 1.1, 0.8));
+ bypass->set_modulate(Color(1.1, 1.1, 0.8));
bypass->set_focus_mode(FOCUS_NONE);
bypass->connect("pressed", this, "_bypass_toggled");
hbc->add_child(bypass);
@@ -767,7 +766,7 @@ void EditorAudioBuses::_update_buses() {
EditorAudioBus *audio_bus = memnew(EditorAudioBus(this));
if (i == 0) {
- audio_bus->set_self_modulate(Color(0.7, 0.7, 0.7));
+ audio_bus->set_self_modulate(Color(1, 0.9, 0.9));
}
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request", this, "_delete_bus", varray(audio_bus), CONNECT_DEFERRED);
@@ -1109,9 +1108,9 @@ EditorAudioBuses::EditorAudioBuses() {
file_dialog = memnew(EditorFileDialog);
List<String> ext;
- ResourceLoader::get_recognized_extensions_for_type("AudioServerState", &ext);
+ ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
for (List<String>::Element *E = ext.front(); E; E = E->next()) {
- file_dialog->add_filter("*." + E->get() + "; Audio Bus State");
+ file_dialog->add_filter("*." + E->get() + "; Audio Bus Layout");
}
add_child(file_dialog);
file_dialog->connect("file_selected", this, "_file_dialog_callback");
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 4a3d784796..f5bf464fd0 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -75,7 +75,7 @@ class EditorAudioBus : public PanelContainer {
bool updating_bus;
- void _gui_input(const InputEvent &p_event);
+ void _gui_input(const Ref<InputEvent> &p_event);
void _delete_pressed(int p_option);
void _name_changed(const String &p_new_name);
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index c2e829e312..25fade46d6 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -95,11 +95,13 @@ void EditorFileDialog::_notification(int p_what) {
}
}
-void EditorFileDialog::_unhandled_input(const InputEvent &p_event) {
+void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY && is_window_modal_on_top()) {
+ Ref<InputEventKey> k = p_event;
- if (p_event.key.pressed) {
+ if (k.is_valid() && is_window_modal_on_top()) {
+
+ if (k->is_pressed()) {
bool handled = false;
@@ -488,8 +490,9 @@ void EditorFileDialog::update_file_list() {
if (!has_icon("ResizedFolder", "EditorIcons")) {
Ref<ImageTexture> folder = get_icon("FolderBig", "EditorIcons");
- Image img = folder->get_data();
- img.resize(thumbnail_size, thumbnail_size);
+ Ref<Image> img = folder->get_data();
+ img = img->duplicate();
+ img->resize(thumbnail_size, thumbnail_size);
Ref<ImageTexture> resized_folder = Ref<ImageTexture>(memnew(ImageTexture));
resized_folder->create_from_image(img, 0);
Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder);
@@ -499,8 +502,9 @@ void EditorFileDialog::update_file_list() {
if (!has_icon("ResizedFile", "EditorIcons")) {
Ref<ImageTexture> file = get_icon("FileBig", "EditorIcons");
- Image img = file->get_data();
- img.resize(thumbnail_size, thumbnail_size);
+ Ref<Image> img = file->get_data();
+ img = img->duplicate();
+ img->resize(thumbnail_size, thumbnail_size);
Ref<ImageTexture> resized_file = Ref<ImageTexture>(memnew(ImageTexture));
resized_file->create_from_image(img, 0);
Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file);
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index f8c85c4ad1..f44193c70b 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -169,7 +169,7 @@ private:
void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
void _request_single_thumbnail(const String &p_path);
- void _unhandled_input(const InputEvent &p_event);
+ void _unhandled_input(const Ref<InputEvent> &p_event);
protected:
void _notification(int p_what);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 11fa9396a0..5c5fc7c3d4 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -61,14 +61,16 @@ void EditorHelpSearch::_text_changed(const String &p_newtext) {
_update_search();
}
-void EditorHelpSearch::_sbox_input(const InputEvent &p_ie) {
+void EditorHelpSearch::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP ||
- p_ie.key.scancode == KEY_DOWN ||
- p_ie.key.scancode == KEY_PAGEUP ||
- p_ie.key.scancode == KEY_PAGEDOWN)) {
+ Ref<InputEventKey> k = p_ie;
- search_options->call("_gui_input", p_ie);
+ if (k.is_valid() && (k->get_scancode() == KEY_UP ||
+ k->get_scancode() == KEY_DOWN ||
+ k->get_scancode() == KEY_PAGEUP ||
+ k->get_scancode() == KEY_PAGEDOWN)) {
+
+ search_options->call("_gui_input", k);
search_box->accept_event();
}
}
@@ -448,14 +450,16 @@ void EditorHelpIndex::_update_class_list() {
}
}
-void EditorHelpIndex::_sbox_input(const InputEvent &p_ie) {
+void EditorHelpIndex::_sbox_input(const Ref<InputEvent> &p_ie) {
+
+ Ref<InputEventKey> k = p_ie;
- if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP ||
- p_ie.key.scancode == KEY_DOWN ||
- p_ie.key.scancode == KEY_PAGEUP ||
- p_ie.key.scancode == KEY_PAGEDOWN)) {
+ if (k.is_valid() && (k->get_scancode() == KEY_UP ||
+ k->get_scancode() == KEY_DOWN ||
+ k->get_scancode() == KEY_PAGEUP ||
+ k->get_scancode() == KEY_PAGEDOWN)) {
- class_list->call("_gui_input", p_ie);
+ class_list->call("_gui_input", k);
search_box->accept_event();
}
}
@@ -499,11 +503,14 @@ EditorHelpIndex::EditorHelpIndex() {
/// /////////////////////////////////
DocData *EditorHelp::doc = NULL;
-void EditorHelp::_unhandled_key_input(const InputEvent &p_ev) {
+void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
if (!is_visible_in_tree())
return;
- if (p_ev.key.mod.control && p_ev.key.scancode == KEY_F) {
+
+ Ref<InputEventKey> k = p_ev;
+
+ if (k.is_valid() && k->get_control() && k->get_scancode() == KEY_F) {
search->grab_focus();
search->select_all();
@@ -598,8 +605,11 @@ void EditorHelp::_class_desc_select(const String &p_select) {
}
}
-void EditorHelp::_class_desc_input(const InputEvent &p_input) {
- if (p_input.type == InputEvent::MOUSE_BUTTON && p_input.mouse_button.pressed && p_input.mouse_button.button_index == 1) {
+void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
+
+ Ref<InputEventMouseButton> mb = p_input;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1) {
class_desc->set_selection_enabled(false);
class_desc->set_selection_enabled(true);
}
@@ -1776,7 +1786,7 @@ void EditorHelpBit::_bind_methods() {
void EditorHelpBit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- add_style_override("panel", get_stylebox("normal", "TextEdit"));
+ add_style_override("panel", get_stylebox("ScriptPanel", "EditorStyles"));
}
}
diff --git a/editor/editor_help.h b/editor/editor_help.h
index d22d61b91d..d6fc0e3bf2 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -56,7 +56,7 @@ class EditorHelpSearch : public ConfirmationDialog {
void _update_search();
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _confirmed();
void _text_changed(const String &p_newtext);
@@ -81,7 +81,7 @@ class EditorHelpIndex : public ConfirmationDialog {
void _tree_item_selected();
void _text_changed(const String &p_text);
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _update_class_list();
@@ -147,7 +147,7 @@ class EditorHelp : public VBoxContainer {
void _scroll_changed(double p_scroll);
void _class_list_select(const String &p_select);
void _class_desc_select(const String &p_select);
- void _class_desc_input(const InputEvent &p_input);
+ void _class_desc_input(const Ref<InputEvent> &p_input);
Error _goto_desc(const String &p_class, int p_vscr = -1);
//void _update_history_buttons();
@@ -157,7 +157,7 @@ class EditorHelp : public VBoxContainer {
void _search(const String &p_str);
void _search_cbk();
- void _unhandled_key_input(const InputEvent &p_ev);
+ void _unhandled_key_input(const Ref<InputEvent> &p_ev);
protected:
void _notification(int p_what);
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index c15eac67fb..5d13c7c254 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -87,6 +87,9 @@ void EditorLog::_notification(int p_what) {
log->add_color_override("default_color", get_color("font_color", "Tree"));
//button->set_icon(get_icon("Console","EditorIcons"));
}
+ if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+ _override_logger_styles();
+ }
/*if (p_what==NOTIFICATION_DRAW) {
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp
index 29d5dda658..d4c418bfc9 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_name_dialog.cpp
@@ -32,14 +32,16 @@
#include "class_db.h"
#include "os/keyboard.h"
-void EditorNameDialog::_line_gui_input(const InputEvent &p_event) {
+void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_event;
- if (!p_event.key.pressed)
+ if (k.is_valid()) {
+
+ if (!k->is_pressed())
return;
- switch (p_event.key.scancode) {
+ switch (k->get_scancode()) {
case KEY_ENTER:
case KEY_RETURN: {
diff --git a/editor/editor_name_dialog.h b/editor/editor_name_dialog.h
index eeeee34d7e..57586951d1 100644
--- a/editor/editor_name_dialog.h
+++ b/editor/editor_name_dialog.h
@@ -41,7 +41,7 @@ class EditorNameDialog : public ConfirmationDialog {
VBoxContainer *makevb;
LineEdit *name;
- void _line_gui_input(const InputEvent &p_event);
+ void _line_gui_input(const Ref<InputEvent> &p_event);
protected:
static void _bind_methods();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 698066f188..70ace76243 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -173,12 +173,13 @@ void EditorNode::_update_title() {
OS::get_singleton()->set_window_title(title);
}
-void EditorNode::_unhandled_input(const InputEvent &p_event) {
+void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
if (Node::get_viewport()->get_modal_stack_top())
return; //ignore because of modal window
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) {
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid() && k->is_pressed() && !k->is_echo() && !gui_base->get_viewport()->gui_has_modal_stack()) {
if (ED_IS_SHORTCUT("editor/next_tab", p_event)) {
int next_tab = editor_data.get_edited_scene() + 1;
@@ -194,28 +195,20 @@ void EditorNode::_unhandled_input(const InputEvent &p_event) {
filesystem_dock->focus_on_filter();
}
- switch (p_event.key.scancode) {
-
- /*case KEY_F1:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_SCRIPT);
- break;*/
- case KEY_F1:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_2D);
- break;
- case KEY_F2:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_3D);
- break;
- case KEY_F3:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_SCRIPT);
- break;
- /* case KEY_F5: _menu_option_confirm((p_event.key.mod.control&&p_event.key.mod.shift)?RUN_PLAY_CUSTOM_SCENE:RUN_PLAY,true); break;
- case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
- //case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break;
- case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;*/
+ if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) {
+ _editor_select(EDITOR_2D);
+ } else if (ED_IS_SHORTCUT("editor/editor_3d", p_event)) {
+ _editor_select(EDITOR_3D);
+ } else if (ED_IS_SHORTCUT("editor/editor_script", p_event)) {
+ _editor_select(EDITOR_SCRIPT);
+ } else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
+ emit_signal("request_help_search", "");
+ } else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event)) {
+ _editor_select(EDITOR_ASSETLIB);
+ } else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
+ _editor_select_next();
+ } else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) {
+ _editor_select_prev();
}
}
}
@@ -276,29 +269,8 @@ void EditorNode::_notification(int p_what) {
update_menu->set_icon(gui_base->get_icon("Progress" + itos(circle_step + 1), "EditorIcons"));
}
}
-
editor_selection->update();
- {
- uint32_t p32 = 0; //AudioServer::get_singleton()->read_output_peak()>>8;
-
- float peak = p32 == 0 ? -80 : Math::linear2db(p32 / 65535.0);
-
- if (peak < -80)
- peak = -80;
- float vu = audio_vu->get_value();
-
- if (peak > vu) {
- audio_vu->set_value(peak);
- } else {
- float new_vu = vu - get_process_delta_time() * 70.0;
- if (new_vu < -80)
- new_vu = -80;
- if (new_vu != -80 && vu != -80)
- audio_vu->set_value(new_vu);
- }
- }
-
ResourceImporterTexture::get_singleton()->update_imports();
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -356,11 +328,17 @@ void EditorNode::_notification(int p_what) {
if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST) {
_menu_option_confirm(FILE_QUIT, false);
- };
+ }
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ Ref<Theme> theme = create_editor_theme();
+ theme_base->set_theme(theme);
+ gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
+ play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
+ scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
}
}
@@ -454,6 +432,30 @@ void EditorNode::_node_renamed() {
property_editor->update_tree();
}
+void EditorNode::_editor_select_next() {
+
+ int editor = _get_current_main_editor();
+
+ if (editor == editor_table.size() - 1) {
+ editor = 0;
+ } else {
+ editor++;
+ }
+ _editor_select(editor);
+}
+
+void EditorNode::_editor_select_prev() {
+
+ int editor = _get_current_main_editor();
+
+ if (editor == 0) {
+ editor = editor_table.size() - 1;
+ } else {
+ editor--;
+ }
+ _editor_select(editor);
+}
+
Error EditorNode::load_resource(const String &p_scene) {
RES res = ResourceLoader::load(p_scene);
@@ -2434,28 +2436,28 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_FILE_SERVER: {
//file_server
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER));
if (ischecked) {
file_server->stop();
run_native->set_deploy_dumb(false);
- //debug_button->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
} else {
file_server->start();
run_native->set_deploy_dumb(true);
- //debug_button->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
}
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
} break;
case RUN_LIVE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
@@ -2463,23 +2465,23 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
/*case RUN_DEPLOY_DUMB_CLIENTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
- debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
+ debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
run_native->set_deploy_dumb(!ischecked);
} break;*/
case RUN_DEPLOY_REMOTE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
run_native->set_deploy_debug_remote(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
} break;
case RUN_DEBUG_COLLISONS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
run_native->set_debug_collisions(!ischecked);
editor_run.set_debug_collisions(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisons", !ischecked);
@@ -2487,8 +2489,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_DEBUG_NAVIGATION: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
run_native->set_debug_navigation(!ischecked);
editor_run.set_debug_navigation(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
@@ -2496,8 +2498,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_RELOAD_SCRIPTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
@@ -2706,7 +2708,9 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) {
ToolButton *tb = memnew(ToolButton);
tb->set_toggle_mode(true);
tb->connect("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size()));
- tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons"));
+ tb->set_text(p_editor->get_name());
+ tb->set_icon(p_editor->get_base_control()->get_icon(p_editor->get_name(), "EditorIcons"));
+ tb->set_name(p_editor->get_name());
singleton->main_editor_buttons.push_back(tb);
singleton->main_editor_button_vb->add_child(tb);
singleton->editor_table.push_back(p_editor);
@@ -3566,7 +3570,7 @@ bool EditorNode::is_scene_in_use(const String &p_path) {
void EditorNode::register_editor_types() {
ClassDB::register_class<EditorPlugin>();
- // ClassDB::register_class<EditorImportPlugin>();
+ ClassDB::register_class<EditorImportPlugin>();
// ClassDB::register_class<EditorExportPlugin>();
// ClassDB::register_class<EditorScenePostImport>();
ClassDB::register_class<EditorScript>();
@@ -3686,11 +3690,13 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) {
warning->popup_centered_minsize();
}
-void EditorNode::_dock_select_input(const InputEvent &p_input) {
+void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
+
+ Ref<InputEventMouse> me = p_input;
- if (p_input.type == InputEvent::MOUSE_BUTTON || p_input.type == InputEvent::MOUSE_MOTION) {
+ if (me.is_valid()) {
- Vector2 point(p_input.mouse_motion.x, p_input.mouse_motion.y);
+ Vector2 point = me->get_pos();
int nrect = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
@@ -3708,7 +3714,9 @@ void EditorNode::_dock_select_input(const InputEvent &p_input) {
if (nrect == -1)
return;
- if (p_input.type == InputEvent::MOUSE_BUTTON && p_input.mouse_button.button_index == 1 && p_input.mouse_button.pressed && dock_popup_selected != nrect) {
+ Ref<InputEventMouseButton> mb = me;
+
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && dock_popup_selected != nrect) {
Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control();
if (dock) {
dock_slot[dock_popup_selected]->remove_child(dock);
@@ -4463,8 +4471,9 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
{
//todo make proper previews
Ref<ImageTexture> pic = gui_base->get_icon("FileBig", "EditorIcons");
- Image img = pic->get_data();
- img.resize(48, 48); //meh
+ Ref<Image> img = pic->get_data();
+ img = img->duplicate();
+ img->resize(48, 48); //meh
Ref<ImageTexture> resized_pic = Ref<ImageTexture>(memnew(ImageTexture));
resized_pic->create_from_image(img);
preview = resized_pic;
@@ -4708,6 +4717,23 @@ void EditorNode::_dim_timeout() {
}
}
+void EditorNode::_check_gui_base_size() {
+ print_line(itos(int(gui_base->get_size().width)));
+ if (gui_base->get_size().width > 1200 * EDSCALE) {
+ for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
+ ToolButton *btn = singleton->main_editor_button_vb->get_child(i)->cast_to<ToolButton>();
+ if (btn == singleton->distraction_free) continue;
+ btn->set_text(btn->get_name());
+ }
+ } else {
+ for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
+ ToolButton *btn = singleton->main_editor_button_vb->get_child(i)->cast_to<ToolButton>();
+ if (btn == singleton->distraction_free) continue;
+ btn->set_text("");
+ }
+ }
+}
+
void EditorNode::open_export_template_manager() {
export_template_manager->popup_manager();
@@ -4790,11 +4816,13 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_open_imported"), &EditorNode::_open_imported);
ClassDB::bind_method(D_METHOD("_inherit_imported"), &EditorNode::_inherit_imported);
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
+ ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size);
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
ADD_SIGNAL(MethodInfo("request_help"));
+ ADD_SIGNAL(MethodInfo("request_help_search"));
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::POOL_STRING_ARRAY, "args")));
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj")));
}
@@ -4922,17 +4950,19 @@ EditorNode::EditorNode() {
ClassDB::set_class_enabled("CollisionShape2D", true);
ClassDB::set_class_enabled("CollisionPolygon2D", true);
- Control *theme_base = memnew(Control);
+ theme_base = memnew(Control);
add_child(theme_base);
theme_base->set_area_as_parent_rect();
gui_base = memnew(Panel);
theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
+ gui_base->connect("item_rect_changed", this, "_check_gui_base_size");
Ref<Theme> theme = create_editor_theme();
theme_base->set_theme(theme);
gui_base->set_theme(create_custom_theme());
+ gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
resource_preview = memnew(EditorResourcePreview);
add_child(resource_preview);
@@ -4947,6 +4977,7 @@ EditorNode::EditorNode() {
main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
main_vbox->set_area_as_parent_rect(8);
+ main_vbox->set_margin(MARGIN_TOP, 5);
#if 0
PanelContainer *top_dark_panel = memnew( PanelContainer );
@@ -5083,7 +5114,7 @@ EditorNode::EditorNode() {
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popoup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
- //dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
+ dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
}
dock_drag_timer = memnew(Timer);
@@ -5114,16 +5145,24 @@ EditorNode::EditorNode() {
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
scene_tabs->connect("tab_close", this, "_scene_tab_closed");
- // MarginContainer *st_mc = memnew( MarginContainer );
- // st_mc->add_child(scene_tabs);
- srt->add_child(scene_tabs);
+ HBoxContainer *tabbar_container = memnew(HBoxContainer);
+ scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+
+ srt->add_child(tabbar_container);
+ tabbar_container->add_child(scene_tabs);
+ distraction_free = memnew(ToolButton);
+ tabbar_container->add_child(distraction_free);
+ distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
+ distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
+ distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
+ distraction_free->set_toggle_mode(true);
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
- scene_root_parent->add_style_override("panel", gui_base->get_stylebox("EditorPanel", "EditorStyles"));
+ scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
- // Ref<StyleBox> sp = scene_root_parent->get_stylebox("panel_full","PanelContainer");
- // scene_root_parent->add_style_override("panel",sp);
+ //Ref<StyleBox> sp = scene_root_parent->get_stylebox("panel","TabContainer");
+ //scene_root_parent->add_style_override("panel",sp);
/*scene_root_parent->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
scene_root_parent->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_END );
@@ -5153,17 +5192,45 @@ EditorNode::EditorNode() {
scene_root_parent->add_child(viewport);
PanelContainer *top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", memnew(StyleBoxEmpty));
+ top_region->add_style_override("panel", gui_base->get_stylebox("MenuPanel", "EditorStyles"));
HBoxContainer *left_menu_hb = memnew(HBoxContainer);
top_region->add_child(left_menu_hb);
menu_hb->add_child(top_region);
PopupMenu *p;
+ project_menu = memnew(MenuButton);
+ project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
+ project_menu->set_text(TTR("Project"));
+ project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(project_menu);
+
+ p = project_menu->get_popup();
+ p->connect("id_pressed", this, "_menu_option");
+ p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
+ p->add_item(TTR("Export"), FILE_EXPORT_PROJECT);
+
+ PopupMenu *tool_menu = memnew(PopupMenu);
+ tool_menu->set_name("Tools");
+ tool_menu->connect("id_pressed", this, "_menu_option");
+ p->add_child(tool_menu);
+ p->add_submenu_item(TTR("Tools"), "Tools");
+ tool_menu->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
+ p->add_separator();
+ p->add_item(TTR("Project Settings"), RUN_SETTINGS);
+ p->add_separator();
+#ifdef OSX_ENABLED
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
+#else
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
+#endif
+ p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
+
file_menu = memnew(MenuButton);
file_menu->set_text(TTR("Scene"));
//file_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
left_menu_hb->add_child(file_menu);
+ file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
prev_scene = memnew(ToolButton);
prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons"));
@@ -5211,18 +5278,7 @@ EditorNode::EditorNode() {
p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true);
p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Z), EDIT_REDO, true);
p->add_separator();
- p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
- p->add_separator();
- p->add_item(TTR("Project Settings"), RUN_SETTINGS);
- p->add_separator();
p->add_item(TTR("Revert Scene"), EDIT_REVERT);
- p->add_separator();
-#ifdef OSX_ENABLED
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
-#else
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
-#endif
- p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_name("RecentScenes");
@@ -5236,17 +5292,11 @@ EditorNode::EditorNode() {
}
PanelContainer *editor_region = memnew(PanelContainer);
- editor_region->add_style_override("panel", memnew(StyleBoxEmpty));
main_editor_button_vb = memnew(HBoxContainer);
editor_region->add_child(main_editor_button_vb);
- menu_hb->add_child(editor_region);
- distraction_free = memnew(ToolButton);
- main_editor_button_vb->add_child(distraction_free);
- distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
- distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
- distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
- distraction_free->set_toggle_mode(true);
+ menu_hb->add_spacer();
+ menu_hb->add_child(editor_region);
//menu_hb->add_spacer();
#if 0
@@ -5277,25 +5327,54 @@ EditorNode::EditorNode() {
menu_panel->add_child( resource_menu );
#endif
- tool_menu = memnew(MenuButton);
- tool_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
- tool_menu->set_text(TTR("Tools"));
+ debug_menu = memnew(MenuButton);
+ debug_menu->set_text(TTR("Debug"));
+ debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(debug_menu);
+ p = debug_menu->get_popup();
+ p->set_hide_on_item_selection(false);
+ p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
+ p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
+ p->add_separator();
+ p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
+ p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
+ p->add_separator();
+ p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
+ p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
+ p->connect("id_pressed", this, "_menu_option");
- //tool_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
- left_menu_hb->add_child(tool_menu);
+ menu_hb->add_spacer();
- p = tool_menu->get_popup();
- p->connect("id_pressed", this, "_menu_option");
- p->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
+ settings_menu = memnew(MenuButton);
+ left_menu_hb->add_child(settings_menu);
+ settings_menu->set_text(TTR("Editor"));
+ settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
+ p = settings_menu->get_popup();
+
+ //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
+ p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
+ //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
+ p->add_separator();
+ editor_layouts = memnew(PopupMenu);
+ editor_layouts->set_name("Layouts");
+ p->add_child(editor_layouts);
+ editor_layouts->connect("id_pressed", this, "_layout_menu_option");
+ p->add_submenu_item(TTR("Editor Layout"), "Layouts");
- export_button = memnew(ToolButton);
- export_button->set_tooltip(TTR("Export the project to many platforms."));
- export_button->set_text(TTR("Export"));
- export_button->connect("pressed", this, "_menu_option", varray(FILE_EXPORT_PROJECT));
- export_button->set_focus_mode(Control::FOCUS_NONE);
- left_menu_hb->add_child(export_button);
+ p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
- menu_hb->add_spacer();
+ p->add_separator();
+ p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
+ p->add_separator();
+ p->add_item(TTR("About"), SETTINGS_ABOUT);
//Separator *s1 = memnew( VSeparator );
//menu_panel->add_child(s1);
@@ -5303,20 +5382,18 @@ EditorNode::EditorNode() {
//s1->set_size(Point2(10,15));
play_cc = memnew(CenterContainer);
- // play_cc->add_style_override("bg",gui_base->get_stylebox("panel","PanelContainer"));
-
play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
- gui_base->add_child(play_cc);
+ menu_hb->add_child(play_cc);
play_cc->set_area_as_parent_rect();
play_cc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 10);
play_cc->set_margin(MARGIN_TOP, 5);
- top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", gui_base->get_stylebox("panel", "ButtonGroup"));
- play_cc->add_child(top_region);
+ play_button_panel = memnew(PanelContainer);
+ play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
+ play_cc->add_child(play_button_panel);
HBoxContainer *play_hb = memnew(HBoxContainer);
- top_region->add_child(play_hb);
+ play_button_panel->add_child(play_hb);
play_button = memnew(ToolButton);
play_hb->add_child(play_button);
@@ -5377,33 +5454,6 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
- debug_button = memnew(MenuButton);
- debug_button->set_flat(true);
- play_hb->add_child(debug_button);
- //debug_button->set_toggle_mode(true);
- debug_button->set_focus_mode(Control::FOCUS_NONE);
- debug_button->set_icon(gui_base->get_icon("Remote", "EditorIcons"));
- //debug_button->connect("pressed", this,"_menu_option",make_binds(RUN_LIVE_DEBUG));
- debug_button->set_tooltip(TTR("Debug options"));
-
- p = debug_button->get_popup();
- p->set_hide_on_item_selection(false);
- p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
- p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
- p->add_separator();
- p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
- p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
- p->add_separator();
- p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->connect("id_pressed", this, "_menu_option");
-
/*
run_settings_button = memnew( ToolButton );
//menu_hb->add_child(run_settings_button);
@@ -5423,65 +5473,24 @@ EditorNode::EditorNode() {
*/
progress_hb = memnew(BackgroundProgress);
- menu_hb->add_child(progress_hb);
+ //menu_hb->add_child(progress_hb);
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
- PanelContainer *vu_cont = memnew(PanelContainer);
- vu_cont->add_style_override("panel", memnew(StyleBoxEmpty));
-
- // CenterContainer *vu_cont = memnew( CenterContainer );
- menu_hb->add_child(vu_cont);
-
- audio_vu = memnew(TextureProgress);
- CenterContainer *vu_cc = memnew(CenterContainer);
- vu_cc->add_child(audio_vu);
- vu_cont->add_child(vu_cc);
- audio_vu->set_under_texture(gui_base->get_icon("VuEmpty", "EditorIcons"));
- audio_vu->set_progress_texture(gui_base->get_icon("VuFull", "EditorIcons"));
- audio_vu->set_max(24);
- audio_vu->set_min(-80);
- audio_vu->set_step(0.01);
- audio_vu->set_value(0);
-
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", memnew(StyleBoxEmpty));
HBoxContainer *right_menu_hb = memnew(HBoxContainer);
- top_region->add_child(right_menu_hb);
- menu_hb->add_child(top_region);
-
- settings_menu = memnew(MenuButton);
- settings_menu->set_text(TTR("Settings"));
- //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
- right_menu_hb->add_child(settings_menu);
- p = settings_menu->get_popup();
-
- //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
- p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
- //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
- p->add_separator();
- editor_layouts = memnew(PopupMenu);
- editor_layouts->set_name("Layouts");
- p->add_child(editor_layouts);
- editor_layouts->connect("id_pressed", this, "_layout_menu_option");
- p->add_submenu_item(TTR("Editor Layout"), "Layouts");
-
- p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
-
- p->add_separator();
- p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
- p->add_separator();
- p->add_item(TTR("About"), SETTINGS_ABOUT);
+ //top_region->add_child(right_menu_hb);
+ menu_hb->add_child(right_menu_hb);
layout_dialog = memnew(EditorNameDialog);
gui_base->add_child(layout_dialog);
@@ -5489,16 +5498,11 @@ EditorNode::EditorNode() {
layout_dialog->set_size(Size2(175, 70) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
- sources_button = memnew(ToolButton);
- right_menu_hb->add_child(sources_button);
- sources_button->set_icon(gui_base->get_icon("DependencyOk", "EditorIcons"));
- sources_button->connect("pressed", this, "_menu_option", varray(SOURCES_REIMPORT));
- sources_button->set_tooltip(TTR("Alerts when an external resource has changed."));
-
update_menu = memnew(MenuButton);
update_menu->set_tooltip(TTR("Spins when the editor window repaints!"));
right_menu_hb->add_child(update_menu);
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
+ update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
p = update_menu->get_popup();
p->add_check_item(TTR("Update Always"), SETTINGS_UPDATE_ALWAYS);
p->add_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES);
@@ -5621,7 +5625,7 @@ EditorNode::EditorNode() {
search_button = memnew(ToolButton);
search_button->set_toggle_mode(true);
search_button->set_pressed(false);
- search_button->set_icon(gui_base->get_icon("Search", "EditorIcons"));
+ search_button->set_icon(gui_base->get_icon("Zoom", "EditorIcons"));
prop_editor_hb->add_child(search_button);
search_button->connect("toggled", this, "_toggle_search_bar");
@@ -5711,7 +5715,7 @@ EditorNode::EditorNode() {
_update_layouts_menu();
bottom_panel = memnew(PanelContainer);
- bottom_panel->add_style_override("panel", gui_base->get_stylebox("EditorPanel", "EditorStyles"));
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
center_split->add_child(bottom_panel);
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
@@ -5883,7 +5887,6 @@ EditorNode::EditorNode() {
file_menu->get_popup()->connect("id_pressed", this, "_menu_option");
object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
settings_menu->get_popup()->connect("id_pressed", this, "_menu_option");
file->connect("file_selected", this, "_dialog_action");
@@ -6111,6 +6114,14 @@ EditorNode::EditorNode() {
_dim_timer->set_wait_time(0.01666f);
_dim_timer->connect("timeout", this, "_dim_timeout");
add_child(_dim_timer);
+
+ ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F2);
+ ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F3);
+ ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F4);
+ ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F1);
+ ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
+ ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
+ ED_SHORTCUT("editor/editor_prev", TTR("Open the previous Editor"));
}
EditorNode::~EditorNode() {
@@ -6140,7 +6151,7 @@ void EditorPluginList::edit(Object *p_object) {
}
}
-bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) {
+bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) {
bool discard = false;
@@ -6153,7 +6164,7 @@ bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, cons
return discard;
}
-bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const InputEvent &p_event) {
+bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
bool discard = false;
for (int i = 0; i < plugins_list.size(); i++) {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index fc107bb505..b996505016 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -205,8 +205,10 @@ private:
//Ref<ResourceImportMetadata> scene_import_metadata;
PanelContainer *scene_root_parent;
+ Control *theme_base;
Control *gui_base;
VBoxContainer *main_vbox;
+ PanelContainer *play_button_panel;
//split
@@ -242,7 +244,9 @@ private:
HBoxContainer *menu_hb;
Control *viewport;
MenuButton *file_menu;
- MenuButton *tool_menu;
+ MenuButton *project_menu;
+ MenuButton *debug_menu;
+ PopupMenu *tool_menu;
ToolButton *export_button;
ToolButton *prev_scene;
MenuButton *object_menu;
@@ -254,7 +258,6 @@ private:
ToolButton *run_settings_button;
ToolButton *play_scene_button;
ToolButton *play_custom_scene_button;
- MenuButton *debug_button;
ToolButton *search_button;
TextureProgress *audio_vu;
//MenuButton *fileserver_menu;
@@ -310,7 +313,7 @@ private:
LineEdit *file_export_password;
String current_path;
MenuButton *update_menu;
- ToolButton *sources_button;
+
//TabContainer *prop_pallete;
//TabContainer *top_pallete;
String defer_load_scene;
@@ -440,6 +443,8 @@ private:
void _imported(Node *p_node);
void _node_renamed();
+ void _editor_select_next();
+ void _editor_select_prev();
void _editor_select(int p_which);
void _set_scene_metadata(const String &p_file, int p_idx = -1);
void _get_scene_metadata(const String &p_file);
@@ -478,7 +483,7 @@ private:
bool convert_old;
- void _unhandled_input(const InputEvent &p_event);
+ void _unhandled_input(const Ref<InputEvent> &p_event);
static void _load_error_notify(void *p_ud, const String &p_text);
@@ -535,7 +540,7 @@ private:
bool _find_scene_in_use(Node *p_node, const String &p_path) const;
- void _dock_select_input(const InputEvent &p_input);
+ void _dock_select_input(const Ref<InputEvent> &p_input);
void _dock_move_left();
void _dock_move_right();
void _dock_select_draw();
@@ -607,6 +612,7 @@ private:
void _start_dimming(bool p_dimming);
void _dim_timeout();
+ void _check_gui_base_size();
protected:
void _notification(int p_what);
@@ -618,7 +624,8 @@ public:
enum EditorTable {
EDITOR_2D = 0,
EDITOR_3D,
- EDITOR_SCRIPT
+ EDITOR_SCRIPT,
+ EDITOR_ASSETLIB
};
void set_visible_editor(EditorTable p_table) { _editor_select(p_table); }
@@ -801,8 +808,8 @@ public:
void make_visible(bool p_visible);
void edit(Object *p_object);
- bool forward_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event);
- bool forward_spatial_gui_input(Camera *p_camera, const InputEvent &p_event);
+ bool forward_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event);
+ bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
void forward_draw_over_canvas(const Transform2D &p_canvas_xform, Control *p_canvas);
void clear();
bool empty();
diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp
index 98e0808ba5..8ce4f88590 100644
--- a/editor/editor_path.cpp
+++ b/editor/editor_path.cpp
@@ -69,9 +69,10 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {
}
}
-void EditorPath::_gui_input(const InputEvent &p_event) {
+void EditorPath::_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == BUTTON_LEFT && p_event.mouse_button.pressed) {
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
Object *obj = ObjectDB::get_instance(history->get_path_object(history->get_path_size() - 1));
if (!obj)
diff --git a/editor/editor_path.h b/editor/editor_path.h
index a142cba44c..7b73e7ebb6 100644
--- a/editor/editor_path.h
+++ b/editor/editor_path.h
@@ -46,7 +46,7 @@ class EditorPath : public Control {
EditorPath();
void _popup_select(int p_idx);
- void _gui_input(const InputEvent &p_event);
+ void _gui_input(const Ref<InputEvent> &p_event);
void _add_children_to_popup(Object *p_obj, int p_depth = 0);
protected:
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 405784a7e2..1b8d1b1677 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -156,7 +156,7 @@ Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
return Ref<SpatialEditorGizmo>();
}
-bool EditorPlugin::forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) {
+bool EditorPlugin::forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) {
if (get_script_instance() && get_script_instance()->has_method("forward_canvas_gui_input")) {
return get_script_instance()->call("forward_canvas_gui_input", p_canvas_xform, p_event);
@@ -175,7 +175,7 @@ void EditorPlugin::update_canvas() {
CanvasItemEditor::get_singleton()->get_viewport_control()->update();
}
-bool EditorPlugin::forward_spatial_gui_input(Camera *p_camera, const InputEvent &p_event) {
+bool EditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) {
if (get_script_instance() && get_script_instance()->has_method("forward_spatial_gui_input")) {
return get_script_instance()->call("forward_spatial_gui_input", p_camera, p_event);
@@ -276,6 +276,11 @@ bool EditorPlugin::get_remove_list(List<Node *> *p_list) {
void EditorPlugin::restore_global_state() {}
void EditorPlugin::save_global_state() {}
+void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
+ ResourceFormatImporter::get_singleton()->add_importer(p_importer);
+ EditorFileSystem::get_singleton()->scan_changes();
+}
+
void EditorPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
if (get_script_instance() && get_script_instance()->has_method("set_window_layout")) {
@@ -360,10 +365,10 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings);
ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout);
ClassDB::bind_method(D_METHOD("edit_resource"), &EditorPlugin::edit_resource);
-
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::INPUT_EVENT, "event")));
+ ClassDB::bind_method(D_METHOD("add_import_plugin"), &EditorPlugin::add_import_plugin);
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_canvas", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "canvas:Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::INPUT_EVENT, "event")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
MethodInfo gizmo = MethodInfo(Variant::OBJECT, "create_spatial_gizmo", PropertyInfo(Variant::OBJECT, "for_spatial:Spatial"));
gizmo.return_val.hint = PROPERTY_HINT_RESOURCE_TYPE;
gizmo.return_val.hint_string = "EditorSpatialGizmo";
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 5df1f63fbe..1ef447a6b8 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -30,6 +30,7 @@
#ifndef EDITOR_PLUGIN_H
#define EDITOR_PLUGIN_H
+#include "editor/import/editor_import_plugin.h"
#include "io/config_file.h"
#include "scene/gui/tool_button.h"
#include "scene/main/node.h"
@@ -106,9 +107,9 @@ public:
void remove_tool_menu_item(const String &p_name);
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event);
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event);
virtual void forward_draw_over_canvas(const Transform2D &p_canvas_xform, Control *p_canvas);
- virtual bool forward_spatial_gui_input(Camera *p_camera, const InputEvent &p_event);
+ virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
virtual String get_name() const;
virtual bool has_main_screen() const;
virtual void make_visible(bool p_visible);
@@ -146,6 +147,8 @@ public:
virtual void restore_global_state();
virtual void save_global_state();
+ void add_import_plugin(const Ref<EditorImportPlugin> &p_importer);
+
EditorPlugin();
virtual ~EditorPlugin();
};
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp
index 8f4312111a..d427126734 100644
--- a/editor/editor_profiler.cpp
+++ b/editor/editor_profiler.cpp
@@ -344,14 +344,16 @@ void EditorProfiler::_update_plot() {
wr = PoolVector<uint8_t>::Write();
- Image img(w, h, 0, Image::FORMAT_RGBA8, graph_image);
+ Ref<Image> img;
+ img.instance();
+ img->create(w, h, 0, Image::FORMAT_RGBA8, graph_image);
if (reset_texture) {
if (graph_texture.is_null()) {
graph_texture.instance();
}
- graph_texture->create(img.get_width(), img.get_height(), img.get_format(), Texture::FLAG_VIDEO_SURFACE);
+ graph_texture->create(img->get_width(), img->get_height(), img->get_format(), Texture::FLAG_VIDEO_SURFACE);
}
graph_texture->set_data(img);
@@ -481,16 +483,20 @@ void EditorProfiler::_cursor_metric_changed(double) {
_update_frame();
}
-void EditorProfiler::_graph_tex_input(const InputEvent &p_ev) {
+void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
if (last_metric < 0)
return;
+ Ref<InputEventMouse> me = p_ev;
+ Ref<InputEventMouseButton> mb = p_ev;
+ Ref<InputEventMouseMotion> mm = p_ev;
+
if (
- (p_ev.type == InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index == BUTTON_LEFT && p_ev.mouse_button.pressed) ||
- (p_ev.type == InputEvent::MOUSE_MOTION)) {
+ (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) ||
+ (mm.is_valid())) {
- int x = p_ev.mouse_button.x;
+ int x = me->get_pos().x;
x = x * frame_metrics.size() / graph->get_size().width;
bool show_hover = x >= 0 && x < frame_metrics.size();
@@ -517,7 +523,7 @@ void EditorProfiler::_graph_tex_input(const InputEvent &p_ev) {
hover_metric = -1;
}
- if (p_ev.type == InputEvent::MOUSE_BUTTON || p_ev.mouse_motion.button_mask & BUTTON_MASK_LEFT) {
+ if (mb.is_valid() || mb->get_button_mask() & BUTTON_MASK_LEFT) {
//cursor_metric=x;
updating_frame = true;
diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h
index 35b5ae366c..4998d45a89 100644
--- a/editor/editor_profiler.h
+++ b/editor/editor_profiler.h
@@ -143,7 +143,7 @@ private:
void _graph_tex_mouse_exit();
void _graph_tex_draw();
- void _graph_tex_input(const InputEvent &p_ev);
+ void _graph_tex_input(const Ref<InputEvent> &p_ev);
int _get_cursor_index() const;
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index 5a519a1dbd..4a767621ef 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -43,11 +43,12 @@ void EditorRunNative::_notification(int p_what) {
continue;
Ref<ImageTexture> icon = eep->get_logo();
if (!icon.is_null()) {
- Image im = icon->get_data();
- im.clear_mipmaps();
- if (!im.empty()) {
+ Ref<Image> im = icon->get_data();
+ im = im->duplicate();
+ im->clear_mipmaps();
+ if (!im->empty()) {
- im.resize(16, 16);
+ im->resize(16, 16);
Ref<ImageTexture> small_icon;
small_icon.instance();
small_icon->create_from_image(im, 0);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 0a46acddb2..858c38c796 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -65,7 +65,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
for (int i = 0; i < arr.size(); i += 2) {
String name = arr[i];
- InputEvent shortcut = arr[i + 1];
+ Ref<InputEvent> shortcut = arr[i + 1];
Ref<ShortCut> sc;
sc.instance();
@@ -109,8 +109,8 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
continue; //this came from settings but is not any longer used
}
- InputEvent original = sc->get_meta("original");
- if (sc->is_shortcut(original) || (original.type == InputEvent::NONE && sc->get_shortcut().type == InputEvent::NONE))
+ Ref<InputEvent> original = sc->get_meta("original");
+ if (sc->is_shortcut(original) || (original.is_null() && sc->get_shortcut().is_null()))
continue; //not changed from default, don't save
}
@@ -503,8 +503,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/custom_font", "");
hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
- set("interface/custom_theme", "");
- hints["interface/custom_theme"] = PropertyInfo(Variant::STRING, "interface/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("interface/dim_editor_on_dialog_popup", true);
set("interface/dim_amount", 0.6f);
hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT);
@@ -513,6 +511,15 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("interface/separate_distraction_mode", false);
+ set("interface/theme/base_color", Color(0.3, 0.3, 0.3, 1));
+ hints["interface/theme/highlight_color"] = PropertyInfo(Variant::COLOR, "interface/theme/highlight_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/highlight_color", Color(0.5, 0.5, 0.6, 1));
+ hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+ set("interface/theme/contrast", 0.2);
+ hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01");
+ set("interface/theme/custom_theme", "");
+ hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
+
set("filesystem/directories/autoscan_project_path", "");
hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR);
set("filesystem/directories/default_project_path", "");
@@ -572,7 +579,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("editors/grid_map/pick_distance", 5000.0);
- set("editors/3d/grid_color", Color(1, 1, 1, 0.2));
+ set("editors/3d/grid_color", Color(0, 1, 0, 0.2));
hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED);
set("editors/3d/default_fov", 45.0);
@@ -979,7 +986,7 @@ void EditorSettings::add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcu
shortcuts[p_name] = p_shortcut;
}
-bool EditorSettings::is_shortcut(const String &p_name, const InputEvent &p_event) const {
+bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const {
const Map<String, Ref<ShortCut> >::Element *E = shortcuts.find(p_name);
if (!E) {
@@ -1096,15 +1103,16 @@ Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) {
- InputEvent ie;
+ Ref<InputEventKey> ie;
if (p_keycode) {
- ie.type = InputEvent::KEY;
- ie.key.unicode = p_keycode & KEY_CODE_MASK;
- ie.key.scancode = p_keycode & KEY_CODE_MASK;
- ie.key.mod.shift = bool(p_keycode & KEY_MASK_SHIFT);
- ie.key.mod.alt = bool(p_keycode & KEY_MASK_ALT);
- ie.key.mod.control = bool(p_keycode & KEY_MASK_CTRL);
- ie.key.mod.meta = bool(p_keycode & KEY_MASK_META);
+ ie.instance();
+
+ ie->set_unicode(p_keycode & KEY_CODE_MASK);
+ ie->set_scancode(p_keycode & KEY_CODE_MASK);
+ ie->set_shift(bool(p_keycode & KEY_MASK_SHIFT));
+ ie->set_alt(bool(p_keycode & KEY_MASK_ALT));
+ ie->set_control(bool(p_keycode & KEY_MASK_CTRL));
+ ie->set_metakey(bool(p_keycode & KEY_MASK_META));
}
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index a876f23134..7b45e28350 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -160,7 +160,7 @@ public:
bool save_text_editor_theme_as(String p_file);
void add_shortcut(const String &p_name, Ref<ShortCut> &p_shortcut);
- bool is_shortcut(const String &p_name, const InputEvent &p_event) const;
+ bool is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const;
Ref<ShortCut> get_shortcut(const String &p_name) const;
void get_shortcut_list(List<String> *r_shortcuts);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 1457f6b421..9968b73044 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -35,99 +35,389 @@
#include "editor_scale.h"
#include "editor_settings.h"
+static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
+ Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
+ style->set_texture(texture);
+ style->set_margin_size(MARGIN_LEFT, p_left * EDSCALE);
+ style->set_margin_size(MARGIN_RIGHT, p_right * EDSCALE);
+ style->set_margin_size(MARGIN_BOTTOM, p_botton * EDSCALE);
+ style->set_margin_size(MARGIN_TOP, p_top * EDSCALE);
+ style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(MARGIN_BOTTOM, p_margin_botton * EDSCALE);
+ style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ style->set_draw_center(p_draw_center);
+ return style;
+}
+
+static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
+ Ref<StyleBoxEmpty> style(memnew(StyleBoxEmpty));
+ style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ return style;
+}
+
+static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
+ Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
+ style->set_bg_color(color);
+ style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ 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);
+ style->set_dark_color(p_color);
+ return style;
+}
+
+static Ref<StyleBoxFlat> add_additional_border(Ref<StyleBoxFlat> p_style, int p_left, int p_top, int p_right, int p_bottom) {
+ Ref<StyleBoxFlat> style = p_style->duplicate();
+ style->_set_additional_border_size(MARGIN_LEFT, p_left * EDSCALE);
+ style->_set_additional_border_size(MARGIN_RIGHT, p_right * EDSCALE);
+ style->_set_additional_border_size(MARGIN_TOP, p_top * EDSCALE);
+ style->_set_additional_border_size(MARGIN_BOTTOM, p_bottom * EDSCALE);
+ return style;
+}
+
+#define HIGHLIGHT_COLOR_LIGHT highlight_color.linear_interpolate(Color(1, 1, 1, 1), 0.3)
+#define HIGHLIGHT_COLOR_DARK highlight_color.linear_interpolate(Color(0, 0, 0, 1), 0.5)
+
Ref<Theme> create_editor_theme() {
Ref<Theme> theme = Ref<Theme>(memnew(Theme));
editor_register_fonts(theme);
editor_register_icons(theme);
- Ref<StyleBoxTexture> focus_sbt = memnew(StyleBoxTexture);
- focus_sbt->set_texture(theme->get_icon("EditorFocus", "EditorIcons"));
- for (int i = 0; i < 4; i++) {
- focus_sbt->set_margin_size(Margin(i), 16 * EDSCALE);
- focus_sbt->set_default_margin(Margin(i), 16 * EDSCALE);
- }
+ // Define colors
+ Color highlight_color = EDITOR_DEF("interface/theme/highlight_color", Color::html("#b79047"));
+ Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#213d4c"));
+ float contrast = EDITOR_DEF("interface/theme/contrast", 0.25);
+
+ Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast);
+ Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5);
+ Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2);
+
+ Color light_color_1 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast);
+ Color light_color_2 = base_color.linear_interpolate(Color(1, 1, 1, 1), contrast * 1.5);
+
+ 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);
+ theme->set_color("dark_color_2", "Editor", dark_color_2);
+ theme->set_color("dark_color_3", "Editor", dark_color_3);
+ theme->set_color("light_color_1", "Editor", light_color_1);
+ theme->set_color("light_color_2", "Editor", light_color_2);
+
+ // Checkbox icon
+ theme->set_icon("checked", "CheckBox", theme->get_icon("Checked", "EditorIcons"));
+ theme->set_icon("unchecked", "CheckBox", theme->get_icon("Unchecked", "EditorIcons"));
+ theme->set_icon("checked", "PopupMenu", theme->get_icon("Checked", "EditorIcons"));
+ theme->set_icon("unchecked", "PopupMenu", theme->get_icon("Unchecked", "EditorIcons"));
+
+ // Editor background
+ Ref<StyleBoxFlat> style_background = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
+ theme->set_stylebox("Background", "EditorStyles", style_background);
+
+ // Focus
+ Ref<StyleBoxFlat> focus_sbt = make_flat_stylebox(light_color_1, 4, 4, 4, 4);
focus_sbt->set_draw_center(false);
- theme->set_stylebox("EditorFocus", "EditorStyles", focus_sbt);
-
- Ref<StyleBoxFlat> style_panel(memnew(StyleBoxFlat));
- style_panel->set_bg_color(Color::html("#36424e"));
- style_panel->set_default_margin(MARGIN_LEFT, 1);
- style_panel->set_default_margin(MARGIN_RIGHT, 1);
- style_panel->set_default_margin(MARGIN_BOTTOM, 1);
- style_panel->set_default_margin(MARGIN_TOP, 4 * EDSCALE);
+ focus_sbt->set_border_size(1 * EDSCALE);
+ focus_sbt = change_border_color(focus_sbt, light_color_2);
+ theme->set_stylebox("Focus", "EditorStyles", focus_sbt);
+
+ // Menu
+ Ref<StyleBoxEmpty> style_menu = make_empty_stylebox(4, 4, 4, 4);
+ theme->set_stylebox("panel", "PanelContainer", style_menu);
+ theme->set_stylebox("MenuPanel", "EditorStyles", style_menu);
+
+ // Play button group
+ theme->set_stylebox("PlayButtonPanel", "EditorStyles", make_stylebox(theme->get_icon("PlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4));
+
+ Ref<StyleBoxFlat> style_menu_hover_border = make_flat_stylebox(highlight_color, 4, 4, 4, 4);
+ Ref<StyleBoxFlat> style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
+
+ style_menu_hover_border->set_draw_center(false);
+ style_menu_hover_border->_set_additional_border_size(MARGIN_BOTTOM, 1 * EDSCALE);
+ theme->set_stylebox("normal", "MenuButton", style_menu);
+ theme->set_stylebox("hover", "MenuButton", style_menu);
+ theme->set_stylebox("pressed", "MenuButton", style_menu);
+ theme->set_stylebox("focus", "MenuButton", style_menu);
+ theme->set_stylebox("disabled", "MenuButton", style_menu);
+
+ theme->set_stylebox("normal", "PopupMenu", style_menu);
+ theme->set_stylebox("hover", "PopupMenu", style_menu_hover_bg);
+ theme->set_stylebox("pressed", "PopupMenu", style_menu);
+ theme->set_stylebox("focus", "PopupMenu", style_menu);
+ theme->set_stylebox("disabled", "PopupMenu", style_menu);
+
+ theme->set_stylebox("normal", "ToolButton", style_menu);
+ theme->set_stylebox("hover", "ToolButton", style_menu);
+ theme->set_stylebox("pressed", "ToolButton", style_menu);
+ theme->set_stylebox("focus", "ToolButton", style_menu);
+ theme->set_stylebox("disabled", "ToolButton", style_menu);
+
+ theme->set_color("font_color_hover", "MenuButton", HIGHLIGHT_COLOR_LIGHT);
+ theme->set_color("font_color_hover", "ToolButton", HIGHLIGHT_COLOR_LIGHT);
+ theme->set_color("font_color_pressed", "ToolButton", highlight_color);
+
+ theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border);
+
+ // Content of each tab
+ Ref<StyleBoxFlat> style_panel = make_flat_stylebox(base_color, 1, 4, 1, 1);
theme->set_stylebox("panel", "TabContainer", style_panel);
- theme->set_stylebox("EditorPanel", "EditorStyles", style_panel);
-
- Ref<StyleBoxFlat> style_bg(memnew(StyleBoxFlat));
- style_bg->set_bg_color(Color::html("#2b353f"));
- style_bg->set_default_margin(MARGIN_LEFT, 0);
- style_bg->set_default_margin(MARGIN_RIGHT, 0);
- style_bg->set_default_margin(MARGIN_BOTTOM, 0);
- style_bg->set_default_margin(MARGIN_TOP, 0);
+ theme->set_stylebox("Content", "EditorStyles", style_panel);
+
+ // Button
+ Ref<StyleBoxFlat> style_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
+ style_button->set_draw_center(true);
+ style_button->set_border_size(2 * EDSCALE);
+ style_button->set_light_color(light_color_1);
+ style_button->set_dark_color(light_color_1);
+ style_button->set_border_blend(false);
+ theme->set_stylebox("normal", "Button", style_button);
+ theme->set_stylebox("hover", "Button", style_button);
+ theme->set_stylebox("pressed", "Button", style_button);
+ theme->set_stylebox("focus", "Button", style_button);
+ theme->set_stylebox("disabled", "Button", style_button);
+ theme->set_color("font_color_hover", "Button", HIGHLIGHT_COLOR_LIGHT);
+ theme->set_color("font_color_pressed", "Button", highlight_color);
+ theme->set_color("icon_color_hover", "Button", HIGHLIGHT_COLOR_LIGHT);
+ // make icon color value bigger because icon image is not complete white
+ 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);
+ style_option_button->set_border_size(1 * EDSCALE);
+ style_option_button->set_light_color(light_color_1);
+ style_option_button->set_dark_color(light_color_1);
+ style_option_button->_set_additional_border_size(MARGIN_RIGHT, -16 * EDSCALE);
+ theme->set_stylebox("hover", "OptionButton", change_border_color(style_option_button, HIGHLIGHT_COLOR_LIGHT));
+ theme->set_stylebox("pressed", "OptionButton", change_border_color(style_option_button, highlight_color));
+ theme->set_stylebox("focus", "OptionButton", change_border_color(style_option_button, highlight_color));
+ theme->set_stylebox("disabled", "OptionButton", style_option_button);
+ theme->set_stylebox("normal", "OptionButton", style_option_button);
+ theme->set_icon("arrow", "OptionButton", theme->get_icon("OptionArrow", "EditorIcons"));
+
+ // PopupMenu
+ Ref<StyleBoxFlat> style_popup_menu = make_flat_stylebox(dark_color_1, 8, 8, 8, 8);
+ style_popup_menu->set_border_size(2 * EDSCALE);
+ style_popup_menu->set_light_color(light_color_1);
+ style_popup_menu->set_dark_color(light_color_1);
+ theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
+
+ // Tree & script background
+ Ref<StyleBoxFlat> style_bg = make_flat_stylebox(dark_color_1, 0, 0, 0, 0);
theme->set_stylebox("bg", "Tree", style_bg);
- theme->set_stylebox("bg", "ItemList", style_bg);
- theme->set_stylebox("EditorBG", "EditorStyles", style_bg);
+ theme->set_stylebox("ScriptPanel", "EditorStyles", style_bg);
- Ref<StyleBox> style_tree_btn = theme->get_stylebox("button_pressed", "Tree");
- style_tree_btn->set_default_margin(MARGIN_LEFT, 3 * EDSCALE);
- style_tree_btn->set_default_margin(MARGIN_RIGHT, 3 * EDSCALE);
+ // Tree
+ theme->set_icon("checked", "Tree", theme->get_icon("Checked", "EditorIcons"));
+ theme->set_icon("unchecked", "Tree", theme->get_icon("Unchecked", "EditorIcons"));
+ theme->set_icon("arrow", "Tree", theme->get_icon("TreeArrowDown", "EditorIcons"));
+ theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("TreeArrowRight", "EditorIcons"));
+ theme->set_icon("select_arrow", "Tree", theme->get_icon("Dropdown", "EditorIcons"));
+ theme->set_stylebox("bg_focus", "Tree", focus_sbt);
+
+ Ref<StyleBox> style_tree_btn = make_flat_stylebox(light_color_1, 2, 4, 2, 4);
theme->set_stylebox("button_pressed", "Tree", style_tree_btn);
- Ref<StyleBoxFlat> style_tab(memnew(StyleBoxFlat));
- style_tab->set_default_margin(MARGIN_LEFT, 15 * EDSCALE);
- style_tab->set_default_margin(MARGIN_RIGHT, 15 * EDSCALE);
- style_tab->set_default_margin(MARGIN_BOTTOM, 5 * EDSCALE);
- style_tab->set_default_margin(MARGIN_TOP, 5 * EDSCALE);
+ Ref<StyleBoxFlat> style_tree_focus = make_flat_stylebox(HIGHLIGHT_COLOR_DARK, 4, 4, 4, 4);
+ theme->set_stylebox("selected_focus", "Tree", style_tree_focus);
+
+ Ref<StyleBoxFlat> style_tree_selected = make_flat_stylebox(light_color_1, 4, 4, 4, 4);
+ theme->set_stylebox("selected", "Tree", style_tree_selected);
+
+ Ref<StyleBoxFlat> style_tree_cursor = make_flat_stylebox(HIGHLIGHT_COLOR_DARK, 4, 4, 4, 4);
+ style_tree_cursor->set_draw_center(false);
+ style_tree_cursor->set_border_size(1 * EDSCALE);
+ style_tree_cursor->set_light_color(light_color_1);
+ style_tree_cursor->set_dark_color(light_color_1);
+ Ref<StyleBoxFlat> style_tree_title = make_flat_stylebox(dark_color_3, 4, 4, 4, 4);
+ theme->set_stylebox("cursor", "Tree", style_tree_cursor);
+ theme->set_stylebox("cursor_unfocused", "Tree", style_tree_cursor);
+ theme->set_stylebox("title_button_normal", "Tree", style_tree_title);
+ theme->set_stylebox("title_button_hover", "Tree", style_tree_title);
+ theme->set_stylebox("title_button_pressed", "Tree", style_tree_title);
- Ref<StyleBoxFlat> style_tab_fg = style_tab->duplicate();
- style_tab_fg->set_bg_color(Color::html("#36424e"));
+ theme->set_color("prop_category", "Editor", dark_color_3);
+ theme->set_color("prop_section", "Editor", dark_color_1);
+ theme->set_color("prop_subsection", "Editor", dark_color_2);
+ theme->set_color("fg_selected", "Editor", Color::html("ffbd8e8e"));
+ theme->set_color("fg_error", "Editor", Color::html("ffbd8e8e"));
+ theme->set_color("drop_position_color", "Tree", highlight_color);
- Ref<StyleBoxFlat> style_tab_bg = style_tab->duplicate();
+ // ItemList
+ Ref<StyleBoxFlat> style_itemlist_cursor = make_flat_stylebox(highlight_color, 8, 8, 8, 8);
+ style_itemlist_cursor->set_draw_center(false);
+ style_itemlist_cursor->set_border_size(1 * EDSCALE);
+ style_itemlist_cursor->set_light_color(light_color_1);
+ style_itemlist_cursor->set_dark_color(light_color_1);
+ theme->set_stylebox("cursor", "ItemList", style_itemlist_cursor);
+ theme->set_stylebox("cursor_unfocused", "ItemList", style_itemlist_cursor);
+ theme->set_stylebox("selected_focus", "ItemList", style_tree_focus);
+ theme->set_stylebox("selected", "ItemList", style_tree_selected);
+ theme->set_stylebox("bg_focus", "ItemList", focus_sbt);
+ theme->set_stylebox("bg", "ItemList", style_bg);
+
+ Ref<StyleBoxFlat> style_tab_fg = make_flat_stylebox(base_color, 15, 5, 15, 5);
+ Ref<StyleBoxFlat> style_tab_bg = make_flat_stylebox(base_color, 15, 5, 15, 5);
style_tab_bg->set_draw_center(false);
+ // Tabs & TabContainer
theme->set_stylebox("tab_fg", "TabContainer", style_tab_fg);
theme->set_stylebox("tab_bg", "TabContainer", style_tab_bg);
theme->set_stylebox("tab_fg", "Tabs", style_tab_fg);
theme->set_stylebox("tab_bg", "Tabs", style_tab_bg);
+ theme->set_color("font_color_fg", "TabContainer", Color(1, 1, 1, 1));
+ theme->set_color("font_color_bg", "TabContainer", light_color_2);
+ theme->set_icon("menu", "TabContainer", theme->get_icon("TabMenu", "EditorIcons"));
+ theme->set_icon("menu_hl", "TabContainer", theme->get_icon("TabMenu", "EditorIcons"));
- Ref<StyleBoxFlat> style_panel_debugger(memnew(StyleBoxFlat));
- style_panel_debugger->set_bg_color(Color::html("#3e4c5a"));
- style_panel_debugger->set_default_margin(MARGIN_LEFT, 0);
- style_panel_debugger->set_default_margin(MARGIN_RIGHT, 0);
- style_panel_debugger->set_default_margin(MARGIN_BOTTOM, 0);
- style_panel_debugger->set_default_margin(MARGIN_TOP, 4 * EDSCALE);
- theme->set_stylebox("EditorPanelDebugger", "EditorStyles", style_panel_debugger);
-
- Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab->duplicate();
- style_tab_fg_debugger->set_bg_color(Color::html("#3e4c5a"));
- style_tab_fg_debugger->set_default_margin(MARGIN_LEFT, 10 * EDSCALE);
- style_tab_fg_debugger->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE);
- Ref<StyleBoxFlat> style_tab_bg_debugger = style_tab->duplicate();
+ // Debugger
+ Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 0, 4, 0, 0);
+ theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
+
+ Ref<StyleBoxFlat> style_tab_fg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5);
+ Ref<StyleBoxFlat> style_tab_bg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5);
style_tab_bg_debugger->set_draw_center(false);
- style_tab_bg_debugger->set_default_margin(MARGIN_LEFT, 10 * EDSCALE);
- style_tab_bg_debugger->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE);
- theme->set_stylebox("EditorTabFGDebugger", "EditorStyles", style_tab_fg_debugger);
- theme->set_stylebox("EditorTabBGDebugger", "EditorStyles", style_tab_bg_debugger);
+ theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger);
+ theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger);
+
+ // LineEdit
+ Ref<StyleBoxFlat> style_lineedit = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
+ style_lineedit->set_border_size(1 * EDSCALE);
+ style_lineedit = change_border_color(style_lineedit, light_color_1);
+ Ref<StyleBoxFlat> style_lineedit_disabled = style_lineedit->duplicate();
+ style_lineedit_disabled->set_bg_color(light_color_1);
+ Ref<StyleBoxFlat> style_lineedit_focus = change_border_color(style_lineedit, highlight_color);
+ style_lineedit_focus->set_draw_center(false);
+ theme->set_stylebox("normal", "LineEdit", style_lineedit);
+ theme->set_stylebox("focus", "LineEdit", style_lineedit_focus);
+ theme->set_stylebox("read_only", "LineEdit", style_lineedit_disabled);
+ // TextEdit
Ref<StyleBoxFlat> style_textedit_normal(memnew(StyleBoxFlat));
- style_textedit_normal->set_bg_color(Color::html("#29343d"));
+ style_textedit_normal->set_bg_color(dark_color_2);
style_textedit_normal->set_default_margin(MARGIN_LEFT, 0);
style_textedit_normal->set_default_margin(MARGIN_RIGHT, 0);
style_textedit_normal->set_default_margin(MARGIN_BOTTOM, 0);
style_textedit_normal->set_default_margin(MARGIN_TOP, 0);
theme->set_stylebox("normal", "TextEdit", style_textedit_normal);
+ theme->set_stylebox("focus", "TextEdit", focus_sbt);
+ theme->set_constant("side_margin", "TabContainer", 0);
+
+ // H/VSplitContainer
+ theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("VsplitBg", "EditorIcons"), 1, 1, 1, 1));
+ theme->set_stylebox("bg", "HSplitContainer", make_stylebox(theme->get_icon("HsplitBg", "EditorIcons"), 1, 1, 1, 1));
+
+ theme->set_icon("grabber", "VSplitContainer", theme->get_icon("Vsplitter", "EditorIcons"));
+ theme->set_icon("grabber", "HSplitContainer", theme->get_icon("Hsplitter", "EditorIcons"));
theme->set_constant("separation", "HSplitContainer", 8 * EDSCALE);
theme->set_constant("separation", "VSplitContainer", 8 * EDSCALE);
- theme->set_constant("side_margin", "TabContainer", 0);
- // theme->set_color("prop_category","Editor",Color::hex(0x3f3a44ff));
- // theme->set_color("prop_section","Editor",Color::hex(0x35313aff));
- // theme->set_color("prop_subsection","Editor",Color::hex(0x312e37ff));
- // theme->set_color("fg_selected","Editor",Color::html("ffbd8e8e"));
- // theme->set_color("fg_error","Editor",Color::html("ffbd8e8e"));
+ // WindowDialog
+ Ref<StyleBoxFlat> style_window = make_flat_stylebox(dark_color_2, 4, 4, 4, 4);
+ style_window->set_border_size(2 * EDSCALE);
+ style_window->set_border_blend(false);
+ style_window->set_light_color(light_color_2);
+ style_window->set_dark_color(light_color_2);
+ style_window->_set_additional_border_size(MARGIN_TOP, 24 * EDSCALE);
+ theme->set_stylebox("panel", "WindowDialog", style_window);
+
+ // HScrollBar
+ Ref<Texture> empty_icon = memnew(ImageTexture);
+
+ theme->set_stylebox("scroll", "HScrollBar", make_stylebox(theme->get_icon("ScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("scroll_focus", "HScrollBar", make_stylebox(theme->get_icon("ScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("grabber", "HScrollBar", make_stylebox(theme->get_icon("ScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_highlight", "HScrollBar", make_stylebox(theme->get_icon("ScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+
+ theme->set_icon("increment", "HScrollBar", empty_icon);
+ theme->set_icon("increment_highlight", "HScrollBar", empty_icon);
+ theme->set_icon("decrement", "HScrollBar", empty_icon);
+ theme->set_icon("decrement_highlight", "HScrollBar", empty_icon);
+
+ // VScrollBar
+ theme->set_stylebox("scroll", "VScrollBar", make_stylebox(theme->get_icon("ScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("scroll_focus", "VScrollBar", make_stylebox(theme->get_icon("ScrollBg", "EditorIcons"), 5, 5, 5, 5, 0, 0, 0, 0));
+ theme->set_stylebox("grabber", "VScrollBar", make_stylebox(theme->get_icon("ScrollGrabber", "EditorIcons"), 6, 6, 6, 6, 2, 2, 2, 2));
+ theme->set_stylebox("grabber_highlight", "VScrollBar", make_stylebox(theme->get_icon("ScrollGrabberHl", "EditorIcons"), 5, 5, 5, 5, 2, 2, 2, 2));
+
+ theme->set_icon("increment", "VScrollBar", empty_icon);
+ theme->set_icon("increment_highlight", "VScrollBar", empty_icon);
+ theme->set_icon("decrement", "VScrollBar", empty_icon);
+ theme->set_icon("decrement_highlight", "VScrollBar", empty_icon);
+
+ // HSlider
+ theme->set_stylebox("slider", "HSlider", make_stylebox(theme->get_icon("HsliderBg", "EditorIcons"), 4, 4, 4, 4));
+ theme->set_icon("grabber", "HSlider", theme->get_icon("SliderGrabber", "EditorIcons"));
+ theme->set_icon("grabber_highlight", "HSlider", theme->get_icon("SliderGrabberHl", "EditorIcons"));
+
+ // VSlider
+ theme->set_stylebox("slider", "VSlider", make_stylebox(theme->get_icon("VsliderBg", "EditorIcons"), 4, 4, 4, 4));
+ theme->set_icon("grabber", "VSlider", theme->get_icon("SliderGrabber", "EditorIcons"));
+ theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("SliderGrabberHl", "EditorIcons"));
+
+ // TooltipPanel
+ Ref<StyleBoxFlat> style_tooltip = make_flat_stylebox(Color(1, 1, 1, 0.8), 8, 8, 8, 8);
+ style_tooltip->set_border_size(2 * EDSCALE);
+ style_tooltip->set_border_blend(false);
+ style_tooltip->set_light_color(Color(1, 1, 1, 0.9));
+ style_tooltip->set_dark_color(Color(1, 1, 1, 0.9));
+ theme->set_stylebox("panel", "TooltipPanel", style_tooltip);
+
+ // PopupPanel
+ Ref<StyleBoxFlat> style_dock_select = make_flat_stylebox(base_color);
+ style_dock_select->set_light_color(light_color_1);
+ style_dock_select->set_dark_color(light_color_1);
+ style_dock_select = add_additional_border(style_dock_select, 2, 2, 2, 2);
+ theme->set_stylebox("panel", "PopupPanel", style_dock_select);
+
+ // SpinBox
+ theme->set_icon("updown", "SpinBox", theme->get_icon("SpinboxUpdown", "EditorIcons"));
+
+ // GraphNode
+ Ref<StyleBoxFlat> graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
+ graphsb->set_border_blend(false);
+ graphsb->set_border_size(2);
+ graphsb->set_light_color(Color(1, 1, 1, 0.6));
+ graphsb->set_dark_color(Color(1, 1, 1, 0.6));
+ graphsb = add_additional_border(graphsb, 0, -22, 0, 0);
+ Ref<StyleBoxFlat> graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
+ graphsbselected->set_border_blend(false);
+ graphsbselected->set_border_size(2);
+ graphsbselected->set_light_color(Color(1, 1, 1, 0.9));
+ graphsbselected->set_dark_color(Color(1, 1, 1, 0.9));
+ graphsbselected = add_additional_border(graphsbselected, 0, -22, 0, 0);
+ Ref<StyleBoxFlat> graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5);
+ graphsbcomment->set_border_blend(false);
+ graphsbcomment->set_border_size(1);
+ graphsbcomment->set_light_color(Color(1, 1, 1, 0.6));
+ graphsbcomment->set_dark_color(Color(1, 1, 1, 0.6));
+ graphsbcomment = add_additional_border(graphsbcomment, 0, -22, 0, 0);
+ Ref<StyleBoxFlat> graphsbcommentselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5);
+ graphsbcommentselected->set_border_blend(false);
+ graphsbcommentselected->set_border_size(1);
+ graphsbcommentselected->set_light_color(Color(1, 1, 1, 0.9));
+ graphsbcommentselected->set_dark_color(Color(1, 1, 1, 0.9));
+ graphsbcommentselected = add_additional_border(graphsbcommentselected, 0, -22, 0, 0);
+ theme->set_stylebox("frame", "GraphNode", graphsb);
+ theme->set_stylebox("selectedframe", "GraphNode", graphsbselected);
+ theme->set_stylebox("comment", "GraphNode", graphsbcomment);
+ theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected);
+
+ // FileDialog
+ Color disable_color = light_color_2;
+ disable_color.a = 0.7;
+ theme->set_color("files_disabled", "FileDialog", disable_color);
return theme;
}
@@ -135,7 +425,7 @@ Ref<Theme> create_editor_theme() {
Ref<Theme> create_custom_theme() {
Ref<Theme> theme;
- String custom_theme = EditorSettings::get_singleton()->get("interface/custom_theme");
+ String custom_theme = EditorSettings::get_singleton()->get("interface/theme/custom_theme");
if (custom_theme != "") {
theme = ResourceLoader::load(custom_theme);
}
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index c324f474bb..62fb241ade 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -150,11 +150,10 @@ void FileSystemDock::_notification(int p_what) {
}
button_display_mode->connect("pressed", this, "_change_file_display");
//file_options->set_icon( get_icon("Tools","EditorIcons"));
-
files->connect("item_activated", this, "_select_file");
button_hist_next->connect("pressed", this, "_fw_history");
button_hist_prev->connect("pressed", this, "_bw_history");
- search_icon->set_texture(get_icon("Search", "EditorIcons"));
+ search_icon->set_texture(get_icon("Zoom", "EditorIcons"));
button_hist_next->set_icon(get_icon("Forward", "EditorIcons"));
button_hist_prev->set_icon(get_icon("Back", "EditorIcons"));
@@ -416,8 +415,9 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
if (!has_icon("ResizedFolder", "EditorIcons")) {
Ref<ImageTexture> folder = get_icon("FolderBig", "EditorIcons");
- Image img = folder->get_data();
- img.resize(thumbnail_size, thumbnail_size);
+ Ref<Image> img = folder->get_data();
+ img = img->duplicate();
+ img->resize(thumbnail_size, thumbnail_size);
Ref<ImageTexture> resized_folder = Ref<ImageTexture>(memnew(ImageTexture));
resized_folder->create_from_image(img, 0);
Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder);
@@ -427,8 +427,8 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
if (!has_icon("ResizedFile", "EditorIcons")) {
Ref<ImageTexture> file = get_icon("FileBig", "EditorIcons");
- Image img = file->get_data();
- img.resize(thumbnail_size, thumbnail_size);
+ Ref<Image> img = file->get_data();
+ img->resize(thumbnail_size, thumbnail_size);
Ref<ImageTexture> resized_file = Ref<ImageTexture>(memnew(ImageTexture));
resized_file->create_from_image(img, 0);
Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file);
@@ -1668,6 +1668,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_reload->set_tooltip(TTR("Re-Scan Filesystem"));
button_reload->hide();
+ //toolbar_hbc->add_spacer();
+
button_favorite = memnew(Button);
button_favorite->set_flat(true);
button_favorite->set_toggle_mode(true);
@@ -1722,7 +1724,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
tree->connect("item_rmb_selected", this, "_dir_rmb_pressed");
files = memnew(ItemList);
- files->add_style_override("bg", editor->get_gui_base()->get_stylebox("EditorBG", "EditorStyles"));
files->set_v_size_flags(SIZE_EXPAND_FILL);
files->set_select_mode(ItemList::SELECT_MULTI);
files->set_drag_forwarding(this);
diff --git a/editor/icons/2x/icon_checked.png b/editor/icons/2x/icon_checked.png
new file mode 100644
index 0000000000..6083540ffe
--- /dev/null
+++ b/editor/icons/2x/icon_checked.png
Binary files differ
diff --git a/editor/icons/2x/icon_dropdown.png b/editor/icons/2x/icon_dropdown.png
new file mode 100644
index 0000000000..626dba79ec
--- /dev/null
+++ b/editor/icons/2x/icon_dropdown.png
Binary files differ
diff --git a/editor/icons/2x/icon_godot.png b/editor/icons/2x/icon_godot.png
deleted file mode 100644
index 94d87e23cc..0000000000
--- a/editor/icons/2x/icon_godot.png
+++ /dev/null
Binary files differ
diff --git a/editor/icons/2x/icon_godot_docs.png b/editor/icons/2x/icon_godot_docs.png
new file mode 100644
index 0000000000..be30f092ef
--- /dev/null
+++ b/editor/icons/2x/icon_godot_docs.png
Binary files differ
diff --git a/editor/icons/2x/icon_hslider_bg.png b/editor/icons/2x/icon_hslider_bg.png
new file mode 100644
index 0000000000..e3c61f25e0
--- /dev/null
+++ b/editor/icons/2x/icon_hslider_bg.png
Binary files differ
diff --git a/editor/icons/2x/icon_option_arrow.png b/editor/icons/2x/icon_option_arrow.png
new file mode 100644
index 0000000000..ed177a4451
--- /dev/null
+++ b/editor/icons/2x/icon_option_arrow.png
Binary files differ
diff --git a/editor/icons/2x/icon_play_button_group.png b/editor/icons/2x/icon_play_button_group.png
new file mode 100644
index 0000000000..e28cb52e64
--- /dev/null
+++ b/editor/icons/2x/icon_play_button_group.png
Binary files differ
diff --git a/editor/icons/2x/icon_slider_grabber.png b/editor/icons/2x/icon_slider_grabber.png
new file mode 100644
index 0000000000..64cf83270a
--- /dev/null
+++ b/editor/icons/2x/icon_slider_grabber.png
Binary files differ
diff --git a/editor/icons/2x/icon_slider_grabber_hl.png b/editor/icons/2x/icon_slider_grabber_hl.png
new file mode 100644
index 0000000000..d68da0d12a
--- /dev/null
+++ b/editor/icons/2x/icon_slider_grabber_hl.png
Binary files differ
diff --git a/editor/icons/2x/icon_spinbox_updown.png b/editor/icons/2x/icon_spinbox_updown.png
new file mode 100644
index 0000000000..e711fbf08b
--- /dev/null
+++ b/editor/icons/2x/icon_spinbox_updown.png
Binary files differ
diff --git a/editor/icons/2x/icon_tab_menu.png b/editor/icons/2x/icon_tab_menu.png
new file mode 100644
index 0000000000..becad9db76
--- /dev/null
+++ b/editor/icons/2x/icon_tab_menu.png
Binary files differ
diff --git a/editor/icons/2x/icon_texture.png b/editor/icons/2x/icon_texture.png
new file mode 100644
index 0000000000..ad5d04dfee
--- /dev/null
+++ b/editor/icons/2x/icon_texture.png
Binary files differ
diff --git a/editor/icons/2x/icon_tree_arrow_down.png b/editor/icons/2x/icon_tree_arrow_down.png
new file mode 100644
index 0000000000..00012dea39
--- /dev/null
+++ b/editor/icons/2x/icon_tree_arrow_down.png
Binary files differ
diff --git a/editor/icons/2x/icon_tree_arrow_right.png b/editor/icons/2x/icon_tree_arrow_right.png
new file mode 100644
index 0000000000..baaf016784
--- /dev/null
+++ b/editor/icons/2x/icon_tree_arrow_right.png
Binary files differ
diff --git a/editor/icons/2x/icon_unchecked.png b/editor/icons/2x/icon_unchecked.png
new file mode 100644
index 0000000000..cd8b781000
--- /dev/null
+++ b/editor/icons/2x/icon_unchecked.png
Binary files differ
diff --git a/editor/icons/2x/icon_vslider_bg.png b/editor/icons/2x/icon_vslider_bg.png
new file mode 100644
index 0000000000..a7e0e78564
--- /dev/null
+++ b/editor/icons/2x/icon_vslider_bg.png
Binary files differ
diff --git a/editor/icons/SCsub b/editor/icons/SCsub
index 3fc8e5461f..20a381cc78 100644
--- a/editor/icons/SCsub
+++ b/editor/icons/SCsub
@@ -62,9 +62,9 @@ def make_editor_icons_action(target, source, env):
s.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png,const uint8_t* p_hidpi_png) {\n")
s.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n")
s.write("\tbool use_hidpi_image=(editor_get_scale()>1.0&&p_hidpi_png);\n")
- s.write("\tImage img(use_hidpi_image?p_hidpi_png:p_png);\n")
- s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img.convert(Image::FORMAT_RGBA8); img.expand_x2_hq2x(); use_hidpi_image=true;}\n")
- s.write("\timg.resize(img.get_width()*EDSCALE/(use_hidpi_image?2:1),img.get_height()*EDSCALE/(use_hidpi_image?2:1));\n")
+ s.write("\tRef<Image> img = memnew(Image(use_hidpi_image?p_hidpi_png:p_png));\n")
+ s.write("\tif (editor_get_scale()>1.0 && !p_hidpi_png) { img->convert(Image::FORMAT_RGBA8); img->expand_x2_hq2x(); use_hidpi_image=true;}\n")
+ s.write("\timg->resize(img->get_width()*EDSCALE/(use_hidpi_image?2:1),img->get_height()*EDSCALE/(use_hidpi_image?2:1));\n")
s.write("\ttexture->create_from_image( img,ImageTexture::FLAG_FILTER );\n")
s.write("\treturn texture;\n")
s.write("}\n\n")
diff --git a/editor/icons/icon_checked.png b/editor/icons/icon_checked.png
new file mode 100644
index 0000000000..d3442930bb
--- /dev/null
+++ b/editor/icons/icon_checked.png
Binary files differ
diff --git a/editor/icons/icon_default_project_icon.png b/editor/icons/icon_default_project_icon.png
index e87a49bd28..4c31fe5cb2 100644
--- a/editor/icons/icon_default_project_icon.png
+++ b/editor/icons/icon_default_project_icon.png
Binary files differ
diff --git a/editor/icons/icon_dropdown.png b/editor/icons/icon_dropdown.png
new file mode 100644
index 0000000000..b9a324be7c
--- /dev/null
+++ b/editor/icons/icon_dropdown.png
Binary files differ
diff --git a/editor/icons/icon_godot.png b/editor/icons/icon_godot.png
deleted file mode 100644
index 0b72e6ecc7..0000000000
--- a/editor/icons/icon_godot.png
+++ /dev/null
Binary files differ
diff --git a/editor/icons/icon_godot_docs.png b/editor/icons/icon_godot_docs.png
new file mode 100644
index 0000000000..554280c5b4
--- /dev/null
+++ b/editor/icons/icon_godot_docs.png
Binary files differ
diff --git a/editor/icons/icon_hslider_bg.png b/editor/icons/icon_hslider_bg.png
new file mode 100644
index 0000000000..e3c61f25e0
--- /dev/null
+++ b/editor/icons/icon_hslider_bg.png
Binary files differ
diff --git a/editor/icons/icon_hsplit_bg.png b/editor/icons/icon_hsplit_bg.png
new file mode 100644
index 0000000000..cfb76f7dc7
--- /dev/null
+++ b/editor/icons/icon_hsplit_bg.png
Binary files differ
diff --git a/editor/icons/icon_hsplitter.png b/editor/icons/icon_hsplitter.png
new file mode 100644
index 0000000000..3ac1dddf90
--- /dev/null
+++ b/editor/icons/icon_hsplitter.png
Binary files differ
diff --git a/editor/icons/icon_logo.png b/editor/icons/icon_logo.png
index 9bbd7dc619..aed94cb87a 100644
--- a/editor/icons/icon_logo.png
+++ b/editor/icons/icon_logo.png
Binary files differ
diff --git a/editor/icons/icon_logo_small.png b/editor/icons/icon_logo_small.png
index 9c7c7fe365..809cf18541 100644
--- a/editor/icons/icon_logo_small.png
+++ b/editor/icons/icon_logo_small.png
Binary files differ
diff --git a/editor/icons/icon_option_arrow.png b/editor/icons/icon_option_arrow.png
new file mode 100644
index 0000000000..b7bc38e03f
--- /dev/null
+++ b/editor/icons/icon_option_arrow.png
Binary files differ
diff --git a/editor/icons/icon_play_button_group.png b/editor/icons/icon_play_button_group.png
new file mode 100644
index 0000000000..83820c8e0c
--- /dev/null
+++ b/editor/icons/icon_play_button_group.png
Binary files differ
diff --git a/editor/icons/icon_scroll_bg.png b/editor/icons/icon_scroll_bg.png
new file mode 100644
index 0000000000..1908fd8aee
--- /dev/null
+++ b/editor/icons/icon_scroll_bg.png
Binary files differ
diff --git a/editor/icons/icon_scroll_grabber.png b/editor/icons/icon_scroll_grabber.png
new file mode 100644
index 0000000000..4be7f4e6cc
--- /dev/null
+++ b/editor/icons/icon_scroll_grabber.png
Binary files differ
diff --git a/editor/icons/icon_scroll_grabber_hl.png b/editor/icons/icon_scroll_grabber_hl.png
new file mode 100644
index 0000000000..a81239b84b
--- /dev/null
+++ b/editor/icons/icon_scroll_grabber_hl.png
Binary files differ
diff --git a/editor/icons/icon_slider_grabber.png b/editor/icons/icon_slider_grabber.png
new file mode 100644
index 0000000000..6b6982e26c
--- /dev/null
+++ b/editor/icons/icon_slider_grabber.png
Binary files differ
diff --git a/editor/icons/icon_slider_grabber_hl.png b/editor/icons/icon_slider_grabber_hl.png
new file mode 100644
index 0000000000..03d4b2bb99
--- /dev/null
+++ b/editor/icons/icon_slider_grabber_hl.png
Binary files differ
diff --git a/editor/icons/icon_spinbox_updown.png b/editor/icons/icon_spinbox_updown.png
new file mode 100644
index 0000000000..ff65df801b
--- /dev/null
+++ b/editor/icons/icon_spinbox_updown.png
Binary files differ
diff --git a/editor/icons/icon_tab_menu.png b/editor/icons/icon_tab_menu.png
index 29edd02f01..ffc63f2d41 100644
--- a/editor/icons/icon_tab_menu.png
+++ b/editor/icons/icon_tab_menu.png
Binary files differ
diff --git a/editor/icons/icon_texture.png b/editor/icons/icon_texture.png
new file mode 100644
index 0000000000..7c4493395e
--- /dev/null
+++ b/editor/icons/icon_texture.png
Binary files differ
diff --git a/editor/icons/icon_tree_arrow_down.png b/editor/icons/icon_tree_arrow_down.png
new file mode 100644
index 0000000000..4ef7b41de6
--- /dev/null
+++ b/editor/icons/icon_tree_arrow_down.png
Binary files differ
diff --git a/editor/icons/icon_tree_arrow_right.png b/editor/icons/icon_tree_arrow_right.png
new file mode 100644
index 0000000000..13a42f730d
--- /dev/null
+++ b/editor/icons/icon_tree_arrow_right.png
Binary files differ
diff --git a/editor/icons/icon_unchecked.png b/editor/icons/icon_unchecked.png
new file mode 100644
index 0000000000..9d7d55aa46
--- /dev/null
+++ b/editor/icons/icon_unchecked.png
Binary files differ
diff --git a/editor/icons/icon_vslider_bg.png b/editor/icons/icon_vslider_bg.png
new file mode 100644
index 0000000000..a7e0e78564
--- /dev/null
+++ b/editor/icons/icon_vslider_bg.png
Binary files differ
diff --git a/editor/icons/icon_vsplit_bg.png b/editor/icons/icon_vsplit_bg.png
new file mode 100644
index 0000000000..0c29b1e35c
--- /dev/null
+++ b/editor/icons/icon_vsplit_bg.png
Binary files differ
diff --git a/editor/icons/icon_vsplitter.png b/editor/icons/icon_vsplitter.png
new file mode 100644
index 0000000000..56fb20bc3f
--- /dev/null
+++ b/editor/icons/icon_vsplitter.png
Binary files differ
diff --git a/editor/icons/source/icon_checked.svg b/editor/icons/source/icon_checked.svg
new file mode 100644
index 0000000000..6d2c03f4c5
--- /dev/null
+++ b/editor/icons/source/icon_checked.svg
@@ -0,0 +1,79 @@
+<?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.1 r"
+ sodipodi:docname="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="32"
+ inkscape:cx="8.555527"
+ inkscape:cy="7.1886752"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3623)">
+ <path
+ style="opacity:1;fill:#e0e0e0;fill-opacity:0.78431374;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 4 2 C 2.8954305 2 2 2.8954305 2 4 L 2 12 C 2 13.104569 2.8954305 14 4 14 L 12 14 C 13.104569 14 14 13.104569 14 12 L 14 4 C 14 2.8954305 13.104569 2 12 2 L 4 2 z M 11.292969 4.2929688 L 12.707031 5.7070312 L 6 12.414062 L 3.2929688 9.7070312 L 4.7070312 8.2929688 L 6 9.5859375 L 11.292969 4.2929688 z "
+ transform="translate(0,1036.3623)"
+ id="circle4178" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_dropdown.svg b/editor/icons/source/icon_dropdown.svg
new file mode 100644
index 0000000000..5963e74007
--- /dev/null
+++ b/editor/icons/source/icon_dropdown.svg
@@ -0,0 +1,79 @@
+<?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="8"
+ height="8"
+ viewBox="0 0 8 8"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="dropdown.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="64"
+ inkscape:cx="3.5701039"
+ inkscape:cy="3.3945836"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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,-1044.3622)">
+ <path
+ style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.78431374"
+ d="m 1,1047.3622 3,3 3,-3"
+ id="path4503"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_godot.svg b/editor/icons/source/icon_godot.svg
deleted file mode 100644
index 419f23125b..0000000000
--- a/editor/icons/source/icon_godot.svg
+++ /dev/null
@@ -1,168 +0,0 @@
-<?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.91 r13725"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"
- sodipodi:docname="icon_godot.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="32"
- inkscape:cx="9.8470361"
- inkscape:cy="9.8599985"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- units="px"
- inkscape:snap-bbox="true"
- inkscape:bbox-paths="true"
- inkscape:bbox-nodes="true"
- inkscape:snap-bbox-edge-midpoints="true"
- inkscape:snap-bbox-midpoints="true"
- 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: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 />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-1036.3622)">
- <g
- transform="matrix(0.01724138,0,0,0.01724138,-0.82758647,1035.0456)"
- id="layer1-5"
- inkscape:label="Layer 1">
- <g
- transform="matrix(1.0688992,0,0,1.1334985,-45.061194,-81.689066)"
- id="g4149">
- <path
- style="fill:#ffffff;fill-opacity:1;stroke:none"
- d="m 116.99388,715.36604 43.13957,-74.51381 75.99672,-171.42666 271.088,-13.63746 282.06373,14.1696 138.45065,255.56931 -25.0756,66.96734 -376.12685,53.39482 -367.70391,-40.32222 z"
- id="path3239"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccccccc" />
- <g
- id="g3412"
- transform="matrix(12.995388,0,0,-12.995388,898.37246,704.73082)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 0,-3.942 c 0,-0.39 -0.25,-0.734 -0.621,-0.852 L -6.835,-6.8 c -0.273,-0.091 -0.57,-0.042 -0.8,0.128 -0.232,0.168 -0.37,0.437 -0.37,0.721 l 0,4.305 -5.818,-1.108 0,-4.381 c 0,-0.447 -0.332,-0.824 -0.775,-0.885 l -8.41,-1.152 c -0.039,-0.003 -0.081,-0.008 -0.121,-0.008 -0.214,0 -0.424,0.078 -0.588,0.22 -0.195,0.172 -0.306,0.416 -0.306,0.676 l 0,4.638 -4.341,-0.018 0,-10e-4 -0.318,10e-4 -0.319,-10e-4 0,10e-4 -4.34,0.018 0,-4.638 c 0,-0.26 -0.112,-0.504 -0.307,-0.676 -0.164,-0.142 -0.374,-0.22 -0.587,-0.22 -0.041,0 -0.082,0.005 -0.123,0.008 l -8.41,1.152 c -0.442,0.061 -0.774,0.438 -0.774,0.885 l 0,4.381 -5.819,1.108 0,-4.305 c 0,-0.284 -0.137,-0.553 -0.368,-0.721 -0.232,-0.17 -0.529,-0.219 -0.802,-0.128 l -6.215,2.006 c -0.369,0.118 -0.619,0.462 -0.619,0.852 l 0,3.942 -3.837,1.29 c -0.19,-0.811 -0.295,-1.642 -0.295,-2.481 0,-10.301 14.512,-18.252 32.448,-18.309 l 0.022,0 0.023,0 c 17.936,0.057 32.448,8.008 32.448,18.309 0,0.766 -0.088,1.521 -0.247,2.266 L 0,0 Z"
- style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3414" />
- </g>
- <g
- id="g3416"
- transform="matrix(12.995388,0,0,-12.995388,140.10982,467.34929)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 0,-16.047 2.163,-0.729 c 0.364,-0.122 0.61,-0.462 0.61,-0.847 l 0,-3.936 4.426,-1.428 0,4.154 c 0,0.27 0.118,0.52 0.323,0.689 0.206,0.172 0.474,0.241 0.739,0.192 l 7.608,-1.452 c 0.422,-0.079 0.728,-0.448 0.728,-0.877 l 0,-4.338 6.62,-0.904 0,4.509 c 0,0.241 0.096,0.467 0.264,0.635 0.167,0.166 0.394,0.259 0.633,0.259 l 0.002,0 5.551,-0.022 5.549,0.022 c 0.245,-10e-4 0.468,-0.093 0.635,-0.259 0.169,-0.168 0.264,-0.394 0.264,-0.635 l 0,-4.509 6.621,0.904 0,4.338 c 0,0.429 0.304,0.798 0.726,0.877 l 7.609,1.452 c 0.262,0.049 0.533,-0.02 0.738,-0.192 0.205,-0.169 0.325,-0.419 0.325,-0.689 l 0,-4.154 4.425,1.428 0,3.936 c 0,0.385 0.245,0.725 0.609,0.847 l 1.475,0.497 0,16.279 0.04,0 c 1.437,1.834 2.767,3.767 4.042,5.828 -1.694,2.883 -3.768,5.459 -5.986,7.846 -2.057,-1.035 -4.055,-2.208 -5.942,-3.456 -0.944,0.938 -2.008,1.706 -3.052,2.509 -1.027,0.824 -2.183,1.428 -3.281,2.132 0.327,2.433 0.489,4.828 0.554,7.327 -2.831,1.424 -5.85,2.369 -8.903,3.047 -1.219,-2.048 -2.334,-4.267 -3.304,-6.436 -1.152,0.192 -2.309,0.264 -3.467,0.277 l 0,0.002 c -0.008,0 -0.015,-0.002 -0.022,-0.002 -0.008,0 -0.015,0.002 -0.022,0.002 l 0,-0.002 c -1.16,-0.013 -2.316,-0.085 -3.468,-0.277 -0.97,2.169 -2.084,4.388 -3.305,6.436 C 19.475,24.555 16.456,23.61 13.626,22.186 13.69,19.687 13.852,17.292 14.18,14.859 13.081,14.155 11.925,13.551 10.898,12.727 9.855,11.924 8.79,11.156 7.846,10.218 5.958,11.466 3.961,12.639 1.904,13.674 -0.314,11.287 -2.388,8.711 -4.082,5.828 -2.807,3.767 -1.477,1.834 -0.04,0 L 0,0 Z"
- style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3418" />
- </g>
- <g
- id="g3420"
- transform="matrix(12.995388,0,0,-12.995388,411.4457,567.42812)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 c 0,-3.611 -2.926,-6.537 -6.537,-6.537 -3.608,0 -6.535,2.926 -6.535,6.537 0,3.609 2.927,6.533 6.535,6.533 C -2.926,6.533 0,3.609 0,0"
- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3422" />
- </g>
- <g
- id="g3424"
- transform="matrix(12.995388,0,0,-12.995388,391.00655,572.46636)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 c 0,-2.396 -1.941,-4.337 -4.339,-4.337 -2.396,0 -4.339,1.941 -4.339,4.337 0,2.396 1.943,4.339 4.339,4.339 C -1.941,4.339 0,2.396 0,0"
- style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3426" />
- </g>
- <g
- id="g3428"
- transform="matrix(12.995388,0,0,-12.995388,526.30933,660.10985)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 c -1.162,0 -2.104,0.856 -2.104,1.912 l 0,6.018 c 0,1.054 0.942,1.912 2.104,1.912 1.162,0 2.106,-0.858 2.106,-1.912 l 0,-6.018 C 2.106,0.856 1.162,0 0,0"
- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3430" />
- </g>
- <g
- id="g3432"
- transform="matrix(12.995388,0,0,-12.995388,641.18731,567.42812)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 c 0,-3.611 2.926,-6.537 6.537,-6.537 3.609,0 6.535,2.926 6.535,6.537 0,3.609 -2.926,6.533 -6.535,6.533 C 2.926,6.533 0,3.609 0,0"
- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3434" />
- </g>
- <g
- id="g3436"
- transform="matrix(12.995388,0,0,-12.995388,661.63165,572.46636)">
- <path
- inkscape:connector-curvature="0"
- d="m 0,0 c 0,-2.396 1.941,-4.337 4.336,-4.337 2.398,0 4.339,1.941 4.339,4.337 0,2.396 -1.941,4.339 -4.339,4.339 C 1.941,4.339 0,2.396 0,0"
- style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path3438" />
- </g>
- </g>
- </g>
- <path
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.44162436"
- d="m 4,1041.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 z m 0,1 a 2.0000174,2.0000174 0 0 1 2,2 2.0000174,2.0000174 0 0 1 -2,2 2.0000174,2.0000174 0 0 1 -2,-2 2.0000174,2.0000174 0 0 1 2,-2 z"
- id="path4151"
- inkscape:connector-curvature="0" />
- <path
- inkscape:connector-curvature="0"
- id="path4156"
- d="m 12,1041.3622 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 3,3 0 0 0 3,-3 3,3 0 0 0 -3,-3 z m 0,1 a 2.0000174,2.0000174 0 0 1 2,2 2.0000174,2.0000174 0 0 1 -2,2 2.0000174,2.0000174 0 0 1 -2,-2 2.0000174,2.0000174 0 0 1 2,-2 z"
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.44162436" />
- <rect
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.44162436"
- id="rect4160"
- width="4"
- height="1"
- x="6"
- y="1043.3622"
- ry="0" />
- </g>
-</svg>
diff --git a/editor/icons/source/icon_godot_docs.svg b/editor/icons/source/icon_godot_docs.svg
new file mode 100644
index 0000000000..77aa92b31f
--- /dev/null
+++ b/editor/icons/source/icon_godot_docs.svg
@@ -0,0 +1,173 @@
+<?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 15 15"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r15371"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_godot_docs.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.627417"
+ inkscape:cx="-14.305844"
+ inkscape:cy="5.1981046"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1011"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336"
+ originx="0"
+ originy="0"
+ spacingx="1"
+ spacingy="1" />
+ </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,-1037.3622)">
+ <g
+ id="g78"
+ transform="matrix(0.06307836,0,0,-0.06307664,13.671143,1047.293)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c 0,0 -0.325,1.994 -0.515,1.976 l -36.182,-3.491 c -2.879,-0.278 -5.115,-2.574 -5.317,-5.459 l -0.994,-14.247 -27.992,-1.997 -1.904,12.912 c -0.424,2.872 -2.932,5.037 -5.835,5.037 h -38.188 c -2.902,0 -5.41,-2.165 -5.834,-5.037 l -1.905,-12.912 -27.992,1.997 -0.994,14.247 c -0.202,2.886 -2.438,5.182 -5.317,5.46 l -36.2,3.49 c -0.187,0.018 -0.324,-1.978 -0.511,-1.978 l -0.049,-7.83 30.658,-4.944 1.004,-14.374 c 0.203,-2.91 2.551,-5.263 5.463,-5.472 l 38.551,-2.75 c 0.146,-0.01 0.29,-0.016 0.434,-0.016 2.897,0 5.401,2.166 5.825,5.038 l 1.959,13.286 h 28.005 l 1.959,-13.286 c 0.423,-2.871 2.93,-5.037 5.831,-5.037 0.142,0 0.284,0.005 0.423,0.015 l 38.556,2.75 c 2.911,0.209 5.26,2.562 5.463,5.472 l 1.003,14.374 30.645,4.966 z"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path80"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g82-3"
+ transform="matrix(0.06307836,0,0,-0.06307664,1.3279404,1043.5689)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 v -47.514 -6.035 -5.492 c 0.108,-0.001 0.216,-0.005 0.323,-0.015 l 36.196,-3.49 c 1.896,-0.183 3.382,-1.709 3.514,-3.609 l 1.116,-15.978 31.574,-2.253 2.175,14.747 c 0.282,1.912 1.922,3.329 3.856,3.329 h 38.188 c 1.933,0 3.573,-1.417 3.855,-3.329 l 2.175,-14.747 31.575,2.253 1.115,15.978 c 0.133,1.9 1.618,3.425 3.514,3.609 l 36.182,3.49 c 0.107,0.01 0.214,0.014 0.322,0.015 v 4.711 l 0.015,0.005 V 0 h 0.134 c 4.795,6.12 9.232,12.569 13.487,19.449 -5.651,9.62 -12.575,18.217 -19.976,26.182 -6.864,-3.455 -13.531,-7.369 -19.828,-11.534 -3.151,3.132 -6.7,5.694 -10.186,8.372 -3.425,2.751 -7.285,4.768 -10.946,7.118 1.09,8.117 1.629,16.108 1.846,24.448 -9.446,4.754 -19.519,7.906 -29.708,10.17 -4.068,-6.837 -7.788,-14.241 -11.028,-21.479 -3.842,0.642 -7.702,0.88 -11.567,0.926 v 0.006 c -0.027,0 -0.052,-0.006 -0.075,-0.006 -0.024,0 -0.049,0.006 -0.073,0.006 V 63.652 C 93.903,63.606 90.046,63.368 86.203,62.726 82.965,69.964 79.247,77.368 75.173,84.205 64.989,81.941 54.915,78.789 45.47,74.035 45.686,65.695 46.225,57.704 47.318,49.587 43.65,47.237 39.795,45.22 36.369,42.469 32.888,39.791 29.333,37.229 26.181,34.097 19.884,38.262 13.219,42.176 6.353,45.631 -1.048,37.666 -7.968,29.069 -13.621,19.449 -9.368,12.569 -4.928,6.12 -0.134,0 Z"
+ style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path84-6"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g86-7"
+ transform="matrix(0.06307836,0,0,-0.06307664,11.62285,1047.9836)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 -1.121,-16.063 c -0.135,-1.936 -1.675,-3.477 -3.611,-3.616 l -38.555,-2.751 c -0.094,-0.007 -0.188,-0.01 -0.281,-0.01 -1.916,0 -3.569,1.406 -3.852,3.33 l -2.211,14.994 H -81.09 l -2.211,-14.994 c -0.297,-2.018 -2.101,-3.469 -4.133,-3.32 l -38.555,2.751 c -1.936,0.139 -3.476,1.68 -3.611,3.616 L -130.721,0 -163.268,3.138 c 0.015,-3.498 0.06,-7.33 0.06,-8.093 0,-34.374 43.605,-50.896 97.781,-51.086 h 0.066 0.067 c 54.176,0.19 97.766,16.712 97.766,51.086 0,0.777 0.047,4.593 0.063,8.093 z"
+ style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path88-5"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g90-3"
+ transform="matrix(0.06307836,0,0,-0.06307664,5.6393685,1045.0806)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c 0,-12.052 -9.765,-21.815 -21.813,-21.815 -12.042,0 -21.81,9.763 -21.81,21.815 0,12.044 9.768,21.802 21.81,21.802 C -9.765,21.802 0,12.044 0,0"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path92-5"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g94-6"
+ transform="matrix(0.06307836,0,0,-0.06307664,5.3082938,1045.1623)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c 0,-7.994 -6.479,-14.473 -14.479,-14.473 -7.996,0 -14.479,6.479 -14.479,14.473 0,7.994 6.483,14.479 14.479,14.479 C -6.479,14.479 0,7.994 0,0"
+ style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path96-2"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g98-9"
+ transform="matrix(0.06307836,0,0,-0.06307664,7.4998997,1046.5818)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c -3.878,0 -7.021,2.858 -7.021,6.381 v 20.081 c 0,3.52 3.143,6.381 7.021,6.381 3.878,0 7.028,-2.861 7.028,-6.381 V 6.381 C 7.028,2.858 3.878,0 0,0"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path100-1"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g102-2"
+ transform="matrix(0.06307836,0,0,-0.06307664,9.3606615,1045.0806)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c 0,-12.052 9.765,-21.815 21.815,-21.815 12.041,0 21.808,9.763 21.808,21.815 0,12.044 -9.767,21.802 -21.808,21.802 C 9.765,21.802 0,12.044 0,0"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path104-7"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g106-0"
+ transform="matrix(0.06307836,0,0,-0.06307664,9.6918191,1045.1623)"
+ style="stroke-width:19.8168869">
+ <path
+ d="m 0,0 c 0,-7.994 6.477,-14.473 14.471,-14.473 8.002,0 14.479,6.479 14.479,14.473 0,7.994 -6.477,14.479 -14.479,14.479 C 6.477,14.479 0,7.994 0,0"
+ style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:19.8168869"
+ id="path108-9"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ inkscape:connector-curvature="0"
+ id="path4392"
+ d="m 4.3227149,1042.5597 a 2.5297459,2.5296773 0 0 0 -2.5297461,2.5297 2.5297459,2.5296773 0 0 0 2.5297461,2.5297 2.5297459,2.5296773 0 0 0 2.5297463,-2.5297 2.5297459,2.5296773 0 0 0 -2.5297463,-2.5297 z m 0,0.5084 a 2.0213759,2.021321 0 0 1 2.0213758,2.0213 2.0213759,2.021321 0 0 1 -2.0213758,2.0213 2.0213759,2.021321 0 0 1 -2.0213757,-2.0213 2.0213759,2.021321 0 0 1 2.0213757,-2.0213 z"
+ style="opacity:1;fill:#414042;fill-opacity:1;stroke:none;stroke-width:1.94780529;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter4200);enable-background:new" />
+ <path
+ style="opacity:1;fill:#414042;fill-opacity:1;stroke:none;stroke-width:1.94780529;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter4200);enable-background:new"
+ d="m 10.679126,1042.5597 a 2.5297459,2.5296773 0 0 0 -2.5297472,2.5297 2.5297459,2.5296773 0 0 0 2.5297472,2.5297 2.5297459,2.5296773 0 0 0 2.529744,-2.5297 2.5297459,2.5296773 0 0 0 -2.529744,-2.5297 z m 0,0.5084 a 2.0213759,2.021321 0 0 1 2.021373,2.0213 2.0213759,2.021321 0 0 1 -2.021373,2.0213 2.0213759,2.021321 0 0 1 -2.0213767,-2.0213 2.0213759,2.021321 0 0 1 2.0213767,-2.0213 z"
+ id="path4403"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:1;fill:#414042;fill-opacity:1;stroke:none;stroke-width:5.625;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.44162436"
+ id="rect4160"
+ width="2.3136585"
+ height="0.53352129"
+ x="6.3440895"
+ y="1043.9767" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_hslider_bg.svg b/editor/icons/source/icon_hslider_bg.svg
new file mode 100644
index 0000000000..10bea12ab8
--- /dev/null
+++ b/editor/icons/source/icon_hslider_bg.svg
@@ -0,0 +1,79 @@
+<?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.1 unknown"
+ sodipodi:docname="icon_hslider_bg.svg"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/2x/icon_hslider_bg.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="4.166346"
+ inkscape:cy="6.5721301"
+ 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="929"
+ inkscape:window-height="897"
+ inkscape:window-x="436"
+ inkscape:window-y="155"
+ inkscape:window-maximized="0"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3623)">
+ <path
+ style="fill:#000000;fill-opacity:0.19607843;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 4 5 A 3 3 0 0 0 1 8 A 3 3 0 0 0 4 11 L 12 11 A 3 3 0 0 0 15 8 A 3 3 0 0 0 12 5 L 4 5 z "
+ transform="translate(0,1036.3623)"
+ id="path814" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_hsplitter.svg b/editor/icons/source/icon_hsplitter.svg
new file mode 100644
index 0000000000..01c893fc56
--- /dev/null
+++ b/editor/icons/source/icon_hsplitter.svg
@@ -0,0 +1,79 @@
+<?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="8"
+ height="64"
+ viewBox="0 0 8 64"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="hsplitter.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.313709"
+ inkscape:cx="-2.0338296"
+ inkscape:cy="39.22669"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-988.3622)">
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:0.39215687;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 4,990.3622 v 60"
+ id="path814"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_mini_matrix32.svg b/editor/icons/source/icon_mini_matrix32.svg
new file mode 100644
index 0000000000..5159ea0b87
--- /dev/null
+++ b/editor/icons/source/icon_mini_matrix32.svg
@@ -0,0 +1,145 @@
+<?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="12"
+ viewBox="0 0 16 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ 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_mini_matrix32.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="1.5471383"
+ inkscape:cy="5.978497"
+ 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:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ style="fill:#ddf4aa;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 8 2 L 8 4 L 9 4 L 10 4 A 1 1 0 0 1 9 5 L 9 7 A 1 1 0 0 1 10 8 A 1 1 0 0 1 9 9 L 8 9 L 8 11 L 9 11 A 3 3 0 0 0 11.597656 9.5 A 3 3 0 0 0 11.597656 6.5 A 3 3 0 0 0 11.232422 5.9980469 A 3 3 0 0 0 11.597656 5.5 A 3 3 0 0 0 11.994141 4 L 12 4 L 12 2 L 9 2 L 8 2 z "
+ transform="translate(0,1040.3622)"
+ id="path4753" />
+ <rect
+ y="1048.3622"
+ x="11"
+ height="2"
+ width="5"
+ id="rect4763"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ sodipodi:open="true"
+ d="m 13,1050.3622 a 2,2 0 0 1 -1.732051,-1 2,2 0 0 1 0,-2 2,2 0 0 1 1.732051,-1"
+ sodipodi:end="4.712389"
+ sodipodi:start="1.5707963"
+ sodipodi:ry="2"
+ sodipodi:rx="2"
+ sodipodi:cy="1048.3622"
+ sodipodi:cx="13"
+ sodipodi:type="arc"
+ id="path4765"
+ style="fill:#c4ec69;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="path4767"
+ d="m 13,1042.3622 0,2 a 1,1 0 0 1 1,1 1,1 0 0 1 -1,1 l 0,2 a 3,3 0 0 0 2.597656,-1.5 3,3 0 0 0 0,-3 3,3 0 0 0 -2.597656,-1.5 z"
+ style="fill:#c4ec69;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:#c4ec69;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 2,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ id="path4771"
+ inkscape:connector-curvature="0" />
+ <rect
+ y="-1050.3622"
+ x="3"
+ height="3"
+ width="2"
+ id="rect4773"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="scale(1,-1)" />
+ <rect
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4775"
+ width="2"
+ height="5.9999828"
+ x="0"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1050.3622"
+ x="3"
+ height="5.9999828"
+ width="2"
+ id="rect4777"
+ style="fill:#c4ec69;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="path4779"
+ d="m 5,1044.3622 a 3,3 0 0 1 3,3 l -2,0 a 1.0000174,1.0000174 0 0 0 -1,-1 l 0,-2 z"
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#c4ec69;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4781"
+ width="2"
+ height="3.0000002"
+ x="6"
+ y="-1050.3622"
+ transform="scale(1,-1)" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_option_arrow.svg b/editor/icons/source/icon_option_arrow.svg
new file mode 100644
index 0000000000..5cd943e9e3
--- /dev/null
+++ b/editor/icons/source/icon_option_arrow.svg
@@ -0,0 +1,80 @@
+<?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="12"
+ height="12"
+ viewBox="0 0 12 12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="option_arrow.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="45.254834"
+ inkscape:cx="3.1667338"
+ inkscape:cy="5.9875884"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ inkscape:connector-curvature="0"
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:0.78431374;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+ d="m 9.9999996,1043.3583 c -0.2637796,0.01 -0.5144012,0.1165 -0.697265,0.3067 l -3.292969,3.2929 -3.2929688,-3.2929 C 2.5285367,1043.4714 2.2700113,1043.3622 2,1043.3622 c -0.8974208,2e-4 -1.34038281,1.0909 -0.6972656,1.7168 l 4,4 c 0.3905299,0.3904 1.0235325,0.3904 1.4140624,0 l 4.0000002,-4 c 0.657344,-0.6321 0.194906,-1.7422 -0.7167974,-1.7207 z"
+ id="path4484"
+ sodipodi:nodetypes="cccccccccc" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_particles_shader.svg b/editor/icons/source/icon_particles_shader.svg
new file mode 100644
index 0000000000..b4c2ef7ccd
--- /dev/null
+++ b/editor/icons/source/icon_particles_shader.svg
@@ -0,0 +1,159 @@
+<?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.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_node_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_particles_shader.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4253">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ id="path4255"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4199">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4201"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4208">
+ <path
+ style="opacity:1;fill:#a5b7f5;fill-opacity:0.98823529;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ d="M 8,1037.3622 A 4.4999948,4.9999847 0 0 0 3.5859375,1041.3934 3,3 0 0 0 1,1044.3622 a 3,3 0 0 0 3,3 l 8,0 a 3,3 0 0 0 3,-3 3,3 0 0 0 -2.589844,-2.9668 A 4.4999948,4.9999847 0 0 0 8,1037.3622 Z m -4,11 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 z m 8,0 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 z m -4,1 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 z"
+ id="path4210"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.999999"
+ inkscape:cx="8.2922739"
+ inkscape:cy="6.6952763"
+ 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="true"
+ 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:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336"
+ 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.3622)">
+ <g
+ id="g4271"
+ clip-path="url(#clipPath4208)"
+ transform="translate(0,1.8694115e-5)">
+ <rect
+ y="1037.3622"
+ x="0"
+ height="2.0000031"
+ width="16"
+ id="rect4159"
+ style="fill:#ff7070;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#ffeb70;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4161"
+ width="16"
+ height="2.0000029"
+ x="0"
+ y="1039.3622" />
+ <rect
+ style="fill:#9dff70;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4163"
+ width="16"
+ height="1.9999999"
+ x="0"
+ y="1041.3622" />
+ <rect
+ y="1043.3622"
+ x="0"
+ height="2.0000024"
+ width="16"
+ id="rect4165"
+ style="fill:#70ffb9;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1045.3622"
+ x="0"
+ height="2.0000021"
+ width="16"
+ id="rect4167"
+ style="fill:#70deff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#ff70ac;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4169"
+ width="16"
+ height="1.9999987"
+ x="0"
+ y="1049.3622" />
+ <rect
+ style="fill:#9f70ff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4146"
+ width="16"
+ height="2.0000021"
+ x="0"
+ y="1047.3622" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_play_button_group.svg b/editor/icons/source/icon_play_button_group.svg
new file mode 100644
index 0000000000..84bdb00505
--- /dev/null
+++ b/editor/icons/source/icon_play_button_group.svg
@@ -0,0 +1,78 @@
+<?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="32"
+ height="32"
+ viewBox="0 0 32 31.999998"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ sodipodi:docname="button_group.svg"
+ inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/button_disabled.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="16"
+ inkscape:cx="15.144473"
+ inkscape:cy="14.499068"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1">
+ <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,-1020.3623)">
+ <circle
+ style="fill:#000000;fill-opacity:0.19607843;stroke:none;stroke-width:2.54545379;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4503"
+ cx="16"
+ cy="1036.3623"
+ r="13.999995" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_scroll_bg.svg b/editor/icons/source/icon_scroll_bg.svg
new file mode 100644
index 0000000000..29604b9e14
--- /dev/null
+++ b/editor/icons/source/icon_scroll_bg.svg
@@ -0,0 +1,71 @@
+<?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="12"
+ height="12"
+ viewBox="0 0 12 11.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ sodipodi:docname="scroll_bg.svg"
+ inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/panel_bg.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="45.254836"
+ inkscape:cx="4.4464273"
+ inkscape:cy="6.9717582"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3623)" />
+</svg>
diff --git a/editor/icons/source/icon_scroll_grabber.svg b/editor/icons/source/icon_scroll_grabber.svg
new file mode 100644
index 0000000000..b9d2bbbec0
--- /dev/null
+++ b/editor/icons/source/icon_scroll_grabber.svg
@@ -0,0 +1,78 @@
+<?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="12"
+ height="12"
+ viewBox="0 0 12 11.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ sodipodi:docname="scroll_grabber.svg"
+ inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/panel_bg.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="45.254836"
+ inkscape:cx="1.3086411"
+ inkscape:cy="6.9275641"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3623)">
+ <circle
+ style="opacity:1;fill:#ffffff;fill-opacity:0.27450982;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4239"
+ cx="6"
+ cy="1046.3623"
+ r="2" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_scroll_grabber_hl.svg b/editor/icons/source/icon_scroll_grabber_hl.svg
new file mode 100644
index 0000000000..ce9a66c5bc
--- /dev/null
+++ b/editor/icons/source/icon_scroll_grabber_hl.svg
@@ -0,0 +1,82 @@
+<?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="12"
+ height="12"
+ viewBox="0 0 12 11.999999"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 unknown"
+ sodipodi:docname="icon_scroll_grabber_hl.svg"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/icon_scroll_grabber_hl.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="45.254836"
+ inkscape:cx="3.0874565"
+ inkscape:cy="5.7564185"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:window-width="1097"
+ inkscape:window-height="1076"
+ inkscape:window-x="161"
+ inkscape:window-y="200"
+ inkscape:window-maximized="0"
+ inkscape:snap-nodes="false">
+ <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,-1040.3623)">
+ <circle
+ style="opacity:1;fill:#f9f9f9;fill-opacity:0.73000002;stroke:none;stroke-width:2.24999642;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4239"
+ cx="6"
+ cy="1046.3623"
+ r="2.9999952"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/icon_scroll_grabber_hl.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_slider_grabber.svg b/editor/icons/source/icon_slider_grabber.svg
new file mode 100644
index 0000000000..b13ca5d1a9
--- /dev/null
+++ b/editor/icons/source/icon_slider_grabber.svg
@@ -0,0 +1,80 @@
+<?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.1 unknown"
+ sodipodi:docname="icon_slider_grabber.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="32"
+ inkscape:cx="3.7828436"
+ inkscape:cy="7.4986644"
+ 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="1195"
+ inkscape:window-height="722"
+ inkscape:window-x="91"
+ inkscape:window-y="633"
+ inkscape:window-maximized="0"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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
+ r="6.9999943"
+ cy="1044.3623"
+ cx="8.0000057"
+ id="circle4262"
+ style="fill:#d3d3d3;fill-opacity:1;stroke:none;stroke-width:20;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_slider_grabber_hl.svg b/editor/icons/source/icon_slider_grabber_hl.svg
new file mode 100644
index 0000000000..5d53811c55
--- /dev/null
+++ b/editor/icons/source/icon_slider_grabber_hl.svg
@@ -0,0 +1,80 @@
+<?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.1 unknown"
+ sodipodi:docname="icon_slider_grabber_hl.svg"
+ inkscape:export-filename="/mnt/2TB/Development/godot_dev/editor/icons/2x/icon_slider_grabber_hl.png"
+ inkscape:export-xdpi="192"
+ inkscape:export-ydpi="192">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="7.6841863"
+ inkscape:cy="6.0120089"
+ 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="1092"
+ inkscape:window-height="880"
+ inkscape:window-x="92"
+ inkscape:window-y="49"
+ inkscape:window-maximized="0"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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
+ r="6.9999943"
+ cy="1044.3623"
+ cx="8.0000057"
+ id="circle4262"
+ style="fill:#f9f9f9;fill-opacity:1;stroke:none;stroke-width:20;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_spatial_shader.svg b/editor/icons/source/icon_spatial_shader.svg
new file mode 100644
index 0000000000..329354b716
--- /dev/null
+++ b/editor/icons/source/icon_spatial_shader.svg
@@ -0,0 +1,165 @@
+<?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.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collision_shape.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_spatial_shader.svg">
+ <defs
+ id="defs4">
+ <clipPath
+ id="clipPath4253"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4255"
+ d="m 16.458984,1024.37 a 12.000027,12.000027 0 0 0 -3.564453,0.4004 12.000027,12.000027 0 0 0 -8.4863279,14.6973 12.000027,12.000027 0 0 0 14.6972659,8.4863 12.000027,12.000027 0 0 0 8.486328,-14.6973 12.000027,12.000027 0 0 0 -11.132813,-8.8867 z M 16.25,1029.8212 a 6.5451717,6.5451717 0 0 1 6.072266,4.8476 6.5451717,6.5451717 0 0 1 -4.628907,8.0157 6.5451717,6.5451717 0 0 1 -8.0156246,-4.6289 6.5451717,6.5451717 0 0 1 4.6289066,-8.0157 6.5451717,6.5451717 0 0 1 1.943359,-0.2187 z"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </clipPath>
+ <clipPath
+ id="clipPath4199"
+ clipPathUnits="userSpaceOnUse">
+ <path
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 16.5,1025.8622 a 11.8125,10.499999 0 0 0 -11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125001,10.5 11.8125,10.499999 0 0 0 11.8125,-10.5 11.8125,10.499999 0 0 0 -11.8125,-10.5 z m -3.375,3 a 3.375,2.9999997 0 0 1 3.375,3 3.375,2.9999997 0 0 1 -3.375,3 3.375,2.9999997 0 0 1 -3.3750001,-3 3.375,2.9999997 0 0 1 3.3750001,-3 z"
+ id="path4201"
+ inkscape:connector-curvature="0" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath4280">
+ <g
+ id="g4282"
+ inkscape:label="Layer 1"
+ transform="translate(0,1.1802001e-5)"
+ style="stroke:#fc9c9c;stroke-opacity:0.99607843">
+ <path
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+ d="M 7.9628906,1.0019531 A 1.0001,1.0001 0 0 0 7.5527344,1.1054688 l -6,3 A 1.0001,1.0001 0 0 0 1,5 l 0,6 a 1.0001,1.0001 0 0 0 0.5527344,0.894531 l 6,3 a 1.0001,1.0001 0 0 0 0.8945312,0 l 6.0000004,-3 A 1.0001,1.0001 0 0 0 15,11 L 15,5 A 1.0001,1.0001 0 0 0 14.447266,4.1054688 l -6.0000004,-3 A 1.0001,1.0001 0 0 0 7.9628906,1.0019531 Z M 8,3.1191406 11.763672,5 8,6.8828125 4.2363281,5 8,3.1191406 Z m -5,3.5 4,2 0,3.7636714 -4,-2 0,-3.7636714 z m 10,0 0,3.7636714 -4,2 0,-3.7636714 4,-2 z"
+ transform="translate(0,1036.3622)"
+ id="path4284"
+ inkscape:connector-curvature="0" />
+ </g>
+ </clipPath>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627417"
+ inkscape:cx="7.8442401"
+ inkscape:cy="13.929239"
+ 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="true"
+ 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:object-paths="false"
+ inkscape:snap-intersection-paths="false"
+ inkscape:object-nodes="false"
+ inkscape:snap-smooth-nodes="false"
+ inkscape:snap-midpoints="true">
+ <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
+ id="g4271"
+ clip-path="url(#clipPath4280)">
+ <rect
+ y="1037.3622"
+ x="0"
+ height="2.0000031"
+ width="16"
+ id="rect4159"
+ style="fill:#ff7070;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#ffeb70;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4161"
+ width="16"
+ height="2.0000029"
+ x="0"
+ y="1039.3622" />
+ <rect
+ style="fill:#9dff70;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4163"
+ width="16"
+ height="1.9999999"
+ x="0"
+ y="1041.3622" />
+ <rect
+ y="1043.3622"
+ x="0"
+ height="2.0000024"
+ width="16"
+ id="rect4165"
+ style="fill:#70ffb9;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1045.3622"
+ x="0"
+ height="2.0000021"
+ width="16"
+ id="rect4167"
+ style="fill:#70deff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="fill:#ff70ac;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4169"
+ width="16"
+ height="1.9999987"
+ x="0"
+ y="1049.3622" />
+ <rect
+ style="fill:#9f70ff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4146"
+ width="16"
+ height="2.0000021"
+ x="0"
+ y="1047.3622" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_spinbox_updown.svg b/editor/icons/source/icon_spinbox_updown.svg
new file mode 100644
index 0000000000..e29d7fe0d2
--- /dev/null
+++ b/editor/icons/source/icon_spinbox_updown.svg
@@ -0,0 +1,83 @@
+<?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.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="spinbox_updown.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="-1.901723"
+ inkscape:cy="9.1326297"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1-5"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e0e0e0;fill-opacity:0.78431374;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+ d="M 7.984375 1.0019531 A 1.0001 1.0001 0 0 0 7.2929688 1.2929688 L 3.2929688 5.2929688 A 1.0001 1.0001 0 1 0 4.7070312 6.7070312 L 8 3.4140625 L 11.292969 6.7070312 A 1.0001 1.0001 0 1 0 12.707031 5.2929688 L 8.7070312 1.2929688 A 1.0001 1.0001 0 0 0 7.984375 1.0019531 z M 11.990234 8.9863281 A 1.0001 1.0001 0 0 0 11.292969 9.2929688 L 8 12.585938 L 4.7070312 9.2929688 A 1.0001 1.0001 0 0 0 3.9902344 8.9902344 A 1.0001 1.0001 0 0 0 3.2929688 10.707031 L 7.2929688 14.707031 A 1.0001 1.0001 0 0 0 8.7070312 14.707031 L 12.707031 10.707031 A 1.0001 1.0001 0 0 0 11.990234 8.9863281 z "
+ transform="translate(0,1036.3622)"
+ id="path4484" />
+ <g
+ id="layer1-5"
+ inkscape:label="Layer 1"
+ transform="translate(14.210182,-5.3664)" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_tab_menu.svg b/editor/icons/source/icon_tab_menu.svg
new file mode 100644
index 0000000000..39e0d1f261
--- /dev/null
+++ b/editor/icons/source/icon_tab_menu.svg
@@ -0,0 +1,92 @@
+<?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.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="tab_menu.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="4.0814179"
+ inkscape:cy="8.4695645"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <circle
+ style="fill:#ffffff;fill-opacity:0.39215687;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.35294118"
+ id="path819"
+ cx="8"
+ cy="1038.3622"
+ r="2" />
+ <circle
+ r="2"
+ cy="1044.3622"
+ cx="8"
+ id="circle821"
+ style="fill:#ffffff;fill-opacity:0.39215687;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.35294118" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.39215687;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.35294118"
+ id="circle823"
+ cx="8"
+ cy="1050.3622"
+ r="2" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_texture.svg b/editor/icons/source/icon_texture.svg
new file mode 100644
index 0000000000..39e88e592b
--- /dev/null
+++ b/editor/icons/source/icon_texture.svg
@@ -0,0 +1,137 @@
+<?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.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_key.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_image_texture.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32"
+ inkscape:cx="9.9365814"
+ inkscape:cy="6.4466253"
+ 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:object-paths="false"
+ inkscape:snap-intersection-paths="false"
+ inkscape:object-nodes="false"
+ inkscape:snap-smooth-nodes="false">
+ <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)">
+ <path
+ style="opacity:1;fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ d="M 2 1 A 1 1 0 0 0 1 2 L 1 14 A 1 1 0 0 0 2 15 L 14 15 A 1 1 0 0 0 15 14 L 15 2 A 1 1 0 0 0 14 1 L 2 1 z M 3 3 L 13 3 L 13 11 L 3 11 L 3 3 z "
+ transform="translate(0,1036.3622)"
+ id="rect4156" />
+ <rect
+ y="1043.3622"
+ x="6"
+ height="1"
+ width="2"
+ id="rect4197"
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" />
+ <rect
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ id="rect4199"
+ width="2"
+ height="2.0000174"
+ x="6"
+ y="1044.3622" />
+ <rect
+ y="1045.3622"
+ x="4"
+ height="1"
+ width="2"
+ id="rect4201"
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" />
+ <rect
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ id="rect4203"
+ width="2"
+ height="2.0000174"
+ x="8"
+ y="1044.3622" />
+ <rect
+ y="1044.3622"
+ x="10"
+ height="2.0000174"
+ width="2"
+ id="rect4205"
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" />
+ <rect
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ id="rect4207"
+ width="3"
+ height="2.0000174"
+ x="8"
+ y="1042.3622" />
+ <rect
+ y="1041.3622"
+ x="9"
+ height="1"
+ width="1"
+ id="rect4217"
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843" />
+ <rect
+ style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.99607843"
+ id="rect4219"
+ width="1"
+ height="1"
+ x="5"
+ y="1044.3622" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_2_d.svg b/editor/icons/source/icon_tree_arrow_down.svg
index 54c93a45aa..1dd209720f 100644
--- a/editor/icons/source/icon_2_d.svg
+++ b/editor/icons/source/icon_tree_arrow_down.svg
@@ -9,16 +9,16 @@
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"
+ width="12"
+ height="12"
+ viewBox="0 0 12 12"
id="svg2"
version="1.1"
inkscape:version="0.92.1 r"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
inkscape:export-xdpi="45"
inkscape:export-ydpi="45"
- sodipodi:docname="icon_2_d.svg">
+ sodipodi:docname="arrow_down.svg">
<defs
id="defs4" />
<sodipodi:namedview
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="22.627418"
- inkscape:cx="1.7654173"
- inkscape:cy="7.2653991"
+ inkscape:zoom="22.627417"
+ inkscape:cx="1.7981958"
+ inkscape:cy="7.5815407"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -47,7 +47,6 @@
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:grid
@@ -70,24 +69,12 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1036.3622)">
+ transform="translate(0,-1040.3622)">
<path
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 2,1040.3622 2,-2 2,2"
- id="path4485"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.39215687"
+ d="m 3,1045.3622 3,3 3,-3"
+ id="path814"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
- <path
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 4,1039.3622 v 9 h 9"
- id="path4487"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccc" />
- <path
- sodipodi:nodetypes="ccc"
- inkscape:connector-curvature="0"
- id="path4489"
- d="m 12,1046.3622 2,2 -2,2"
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>
diff --git a/editor/icons/source/icon_3_d.svg b/editor/icons/source/icon_tree_arrow_right.svg
index 3147d14dc1..43134ba1b1 100644
--- a/editor/icons/source/icon_3_d.svg
+++ b/editor/icons/source/icon_tree_arrow_right.svg
@@ -9,16 +9,16 @@
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"
+ width="12"
+ height="12"
+ viewBox="0 0 12 12"
id="svg2"
version="1.1"
inkscape:version="0.92.1 r"
- inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
inkscape:export-xdpi="45"
inkscape:export-ydpi="45"
- sodipodi:docname="icon_3_d.svg">
+ sodipodi:docname="arrow_right.svg">
<defs
id="defs4" />
<sodipodi:namedview
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="32.000001"
- inkscape:cx="7.1007207"
- inkscape:cy="6.155123"
+ inkscape:zoom="45.254836"
+ inkscape:cx="4.0845752"
+ inkscape:cy="5.8802612"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -47,7 +47,6 @@
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:grid
@@ -70,36 +69,12 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-1036.3622)">
+ transform="translate(0,-1040.3622)">
<path
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 2.0050708,1040.3622 2,-2 2,2"
- id="path4485"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.39215687"
+ d="m 4,1049.3622 3.0000202,-3 -3.0000202,-3"
+ id="path814"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
- <path
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 4.0050708,1039.3622 v 9 h 9.0000002"
- id="path4487"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccc" />
- <path
- sodipodi:nodetypes="ccc"
- inkscape:connector-curvature="0"
- id="path4489"
- d="m 12.005071,1046.3622 2,2 -2,2"
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 4.0050708,1048.3622 8.0000002,-8"
- id="path4496"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
- <path
- sodipodi:nodetypes="ccc"
- inkscape:connector-curvature="0"
- id="path4498"
- d="m 10.176644,1039.3622 h 2.828427 v 2.8284"
- style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>
diff --git a/editor/icons/source/icon_unchecked.svg b/editor/icons/source/icon_unchecked.svg
new file mode 100644
index 0000000000..053cbe6de5
--- /dev/null
+++ b/editor/icons/source/icon_unchecked.svg
@@ -0,0 +1,77 @@
+<?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.1 r"
+ sodipodi:docname="unchecked.svg"
+ inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/unchecked.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="32"
+ inkscape:cx="4.8224661"
+ inkscape:cy="8.2065809"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3623)">
+ <path
+ style="opacity:1;fill:#e0e0e0;fill-opacity:0.78431374;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 4 2 A 2 2 0 0 0 2 4 L 2 12 A 2 2 0 0 0 4 14 L 12 14 A 2 2 0 0 0 14 12 L 14 4 A 2 2 0 0 0 12 2 L 4 2 z M 4.8007812 4 L 11.199219 4 A 0.8000012 0.8000012 0 0 1 12 4.8007812 L 12 11.199219 A 0.8000012 0.8000012 0 0 1 11.199219 12 L 4.8007812 12 A 0.8000012 0.8000012 0 0 1 4 11.199219 L 4 4.8007812 A 0.8000012 0.8000012 0 0 1 4.8007812 4 z "
+ transform="translate(0,1036.3623)"
+ id="circle4178" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_vslider_bg.svg b/editor/icons/source/icon_vslider_bg.svg
new file mode 100644
index 0000000000..b34dddc2d0
--- /dev/null
+++ b/editor/icons/source/icon_vslider_bg.svg
@@ -0,0 +1,85 @@
+<?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.1 r"
+ sodipodi:docname="vslider_bg.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.537518"
+ inkscape:cy="7.6498812"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3623)">
+ <g
+ id="layer1-5"
+ inkscape:label="Layer 1"
+ transform="rotate(90,8,1044.3623)">
+ <path
+ id="path814"
+ transform="translate(0,1036.3623)"
+ d="m 4,5 a 3,3 0 0 0 -3,3 3,3 0 0 0 3,3 h 8 A 3,3 0 0 0 15,8 3,3 0 0 0 12,5 Z"
+ style="fill:#000000;fill-opacity:0.19607843;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_vsplit_bg.svg b/editor/icons/source/icon_vsplit_bg.svg
new file mode 100644
index 0000000000..e11940cf53
--- /dev/null
+++ b/editor/icons/source/icon_vsplit_bg.svg
@@ -0,0 +1,79 @@
+<?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="8"
+ height="8"
+ viewBox="0 0 8 7.9999995"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="vsplit_bg.svg"
+ inkscape:export-filename="/home/djrm/Projects/godot/scene/resources/default_theme/panel_bg.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="64.000003"
+ inkscape:cx="-1.1524794"
+ inkscape:cy="3.8847002"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ 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: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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1044.3623)">
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:0.09803922;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4213"
+ width="8"
+ height="7.999999"
+ x="0"
+ y="1044.3623" />
+ </g>
+</svg>
diff --git a/editor/icons/source/icon_vsplitter.svg b/editor/icons/source/icon_vsplitter.svg
new file mode 100644
index 0000000000..80f7c2ce12
--- /dev/null
+++ b/editor/icons/source/icon_vsplitter.svg
@@ -0,0 +1,79 @@
+<?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="64"
+ height="8"
+ viewBox="0 0 64 8"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.1 r"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_collapse.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="vsplitter.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="32.000001"
+ inkscape:cx="59.744611"
+ inkscape:cy="0.46378871"
+ 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="1600"
+ inkscape:window-height="836"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1044.3622)">
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:0.39215687;stroke-miterlimit:4;stroke-dasharray:none"
+ d="M 2,1048.3622 H 62"
+ id="path814"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>
diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp
new file mode 100644
index 0000000000..6dee5da538
--- /dev/null
+++ b/editor/import/editor_import_plugin.cpp
@@ -0,0 +1,152 @@
+/*************************************************************************/
+/* editor_import_plugin.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "editor_import_plugin.h"
+#include "core/script_language.h"
+
+EditorImportPlugin::EditorImportPlugin() {
+}
+
+String EditorImportPlugin::get_importer_name() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_importer_name")), "");
+ return get_script_instance()->call("get_importer_name");
+}
+
+String EditorImportPlugin::get_visible_name() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_visible_name")), "");
+ return get_script_instance()->call("get_visible_name");
+}
+
+void EditorImportPlugin::get_recognized_extensions(List<String> *p_extensions) const {
+ ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_recognized_extensions")));
+ Array extensions = get_script_instance()->call("get_recognized_extensions");
+ for (int i = 0; i < extensions.size(); i++) {
+ p_extensions->push_back(extensions[i]);
+ }
+}
+
+String EditorImportPlugin::get_preset_name(int p_idx) const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_name")), "");
+ return get_script_instance()->call("get_preset_name", p_idx);
+}
+
+int EditorImportPlugin::get_preset_count() {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_preset_count")), 0);
+ return get_script_instance()->call("get_preset_count");
+}
+
+String EditorImportPlugin::get_save_extension() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_save_extension")), "");
+ return get_script_instance()->call("get_save_extension");
+}
+
+String EditorImportPlugin::get_resource_type() const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_resource_type")), "");
+ return get_script_instance()->call("get_resource_type");
+}
+
+void EditorImportPlugin::get_import_options(List<ResourceImporter::ImportOption> *r_options, int p_preset) const {
+
+ ERR_FAIL_COND(!(get_script_instance() && get_script_instance()->has_method("get_import_options")));
+ Array needed;
+ needed.push_back("name");
+ needed.push_back("default_value");
+ Array options = get_script_instance()->call("get_import_options", p_preset);
+ for (int i = 0; i < options.size(); i++) {
+ Dictionary d = options[i];
+ ERR_FAIL_COND(!d.has_all(needed));
+ String name = d["name"];
+ Variant default_value = d["default_value"];
+
+ PropertyHint hint = PROPERTY_HINT_NONE;
+ if (d.has("property_hint")) {
+ hint = (PropertyHint)d["property_hint"].operator int64_t();
+ }
+
+ String hint_string;
+ if (d.has("hint_string")) {
+ hint_string = d["hint_string"];
+ }
+
+ uint32_t usage = PROPERTY_USAGE_DEFAULT;
+ if (d.has("usage")) {
+ usage = d["usage"];
+ }
+
+ ImportOption option(PropertyInfo(default_value.get_type(), name, hint, hint_string, usage), default_value);
+ r_options->push_back(option);
+ }
+}
+
+bool EditorImportPlugin::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("get_option_visibility")), true);
+ Dictionary d;
+ Map<StringName, Variant>::Element *E = p_options.front();
+ while (E) {
+ d[E->key()] = E->get();
+ E = E->next();
+ }
+ return get_script_instance()->call("get_option_visibility", p_option, d);
+}
+
+Error EditorImportPlugin::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) {
+
+ ERR_FAIL_COND_V(!(get_script_instance() && get_script_instance()->has_method("import")), ERR_UNAVAILABLE);
+ Dictionary options;
+ Array platform_variants, gen_files;
+
+ Map<StringName, Variant>::Element *E = p_options.front();
+ while (E) {
+ options[E->key()] = E->get();
+ E = E->next();
+ }
+ Error err = (Error)get_script_instance()->call("import", p_source_file, p_save_path, options, platform_variants, gen_files).operator int64_t();
+
+ for (int i = 0; i < platform_variants.size(); i++) {
+ r_platform_variants->push_back(platform_variants[i]);
+ }
+ for (int i = 0; i < gen_files.size(); i++) {
+ r_gen_files->push_back(gen_files[i]);
+ }
+ return err;
+}
+
+void EditorImportPlugin::_bind_methods() {
+
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_importer_name"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_visible_name"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "get_preset_count"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_preset_name", PropertyInfo(Variant::INT, "preset")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_recognized_extensions"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::ARRAY, "get_import_options", PropertyInfo(Variant::INT, "preset")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_save_extension"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_resource_type"));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "get_option_visibility", PropertyInfo(Variant::STRING, "option"), PropertyInfo(Variant::DICTIONARY, "options")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::INT, "import", PropertyInfo(Variant::STRING, "source_file"), PropertyInfo(Variant::STRING, "save_path"), PropertyInfo(Variant::DICTIONARY, "options"), PropertyInfo(Variant::ARRAY, "r_platform_variants"), PropertyInfo(Variant::ARRAY, "r_gen_files")));
+}
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
new file mode 100644
index 0000000000..3c16b79713
--- /dev/null
+++ b/editor/import/editor_import_plugin.h
@@ -0,0 +1,54 @@
+/*************************************************************************/
+/* editor_import_plugin.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef EDITOR_IMPORT_PLUGIN_H
+#define EDITOR_IMPORT_PLUGIN_H
+
+#include "io/resource_import.h"
+
+class EditorImportPlugin : public ResourceImporter {
+ GDCLASS(EditorImportPlugin, Reference)
+protected:
+ static void _bind_methods();
+
+public:
+ EditorImportPlugin();
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_preset_name(int p_idx) const;
+ virtual int get_preset_count();
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files);
+};
+
+#endif //EDITOR_IMPORT_PLUGIN_H
diff --git a/editor/import/resource_importer_csv_translation.cpp b/editor/import/resource_importer_csv_translation.cpp
index ea43477dc3..85d446f38a 100644
--- a/editor/import/resource_importer_csv_translation.cpp
+++ b/editor/import/resource_importer_csv_translation.cpp
@@ -54,7 +54,7 @@ String ResourceImporterCSVTranslation::get_save_extension() const {
String ResourceImporterCSVTranslation::get_resource_type() const {
- return "StreamCSVTranslation";
+ return "Translation";
}
bool ResourceImporterCSVTranslation::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index f0dcc4a298..c115f0014a 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -181,7 +181,7 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "detect_3d"), p_preset == PRESET_DETECT));
}
-void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable, bool p_detect_3d, bool p_detect_srgb) {
+void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String &p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable, bool p_detect_3d, bool p_detect_srgb) {
FileAccess *f = FileAccess::open(p_to_path, FileAccess::WRITE);
f->store_8('G');
@@ -189,8 +189,8 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
f->store_8('S');
f->store_8('T'); //godot streamable texture
- f->store_32(p_image.get_width());
- f->store_32(p_image.get_height());
+ f->store_32(p_image->get_width());
+ f->store_32(p_image->get_height());
f->store_32(p_texture_flags);
uint32_t format = 0;
@@ -207,14 +207,14 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
switch (p_compress_mode) {
case COMPRESS_LOSSLESS: {
- Image image = p_image;
+ Ref<Image> image = p_image->duplicate();
if (p_mipmaps) {
- image.generate_mipmaps();
+ image->generate_mipmaps();
} else {
- image.clear_mipmaps();
+ image->clear_mipmaps();
}
- int mmc = image.get_mipmap_count() + 1;
+ int mmc = image->get_mipmap_count() + 1;
format |= StreamTexture::FORMAT_BIT_LOSSLESS;
f->store_32(format);
@@ -223,7 +223,7 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
for (int i = 0; i < mmc; i++) {
if (i > 0) {
- image.shrink_x2();
+ image->shrink_x2();
}
PoolVector<uint8_t> data = Image::lossless_packer(image);
@@ -236,14 +236,14 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
} break;
case COMPRESS_LOSSY: {
- Image image = p_image;
+ Ref<Image> image = p_image->duplicate();
if (p_mipmaps) {
- image.generate_mipmaps();
+ image->generate_mipmaps();
} else {
- image.clear_mipmaps();
+ image->clear_mipmaps();
}
- int mmc = image.get_mipmap_count() + 1;
+ int mmc = image->get_mipmap_count() + 1;
format |= StreamTexture::FORMAT_BIT_LOSSY;
f->store_32(format);
@@ -252,7 +252,7 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
for (int i = 0; i < mmc; i++) {
if (i > 0) {
- image.shrink_x2();
+ image->shrink_x2();
}
PoolVector<uint8_t> data = Image::lossy_packer(image, p_lossy_quality);
@@ -265,15 +265,15 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
} break;
case COMPRESS_VIDEO_RAM: {
- Image image = p_image;
- image.generate_mipmaps();
- image.compress(p_vram_compression);
+ Ref<Image> image = p_image->duplicate();
+ image->generate_mipmaps();
+ image->compress(p_vram_compression);
- format |= image.get_format();
+ format |= image->get_format();
f->store_32(format);
- PoolVector<uint8_t> data = image.get_data();
+ PoolVector<uint8_t> data = image->get_data();
int dl = data.size();
PoolVector<uint8_t>::Read r = data.read();
f->store_buffer(r.ptr(), dl);
@@ -281,17 +281,17 @@ void ResourceImporterTexture::_save_stex(const Image &p_image, const String &p_t
} break;
case COMPRESS_UNCOMPRESSED: {
- Image image = p_image;
+ Ref<Image> image = p_image->duplicate();
if (p_mipmaps) {
- image.generate_mipmaps();
+ image->generate_mipmaps();
} else {
- image.clear_mipmaps();
+ image->clear_mipmaps();
}
- format |= image.get_format();
+ format |= image->get_format();
f->store_32(format);
- PoolVector<uint8_t> data = image.get_data();
+ PoolVector<uint8_t> data = image->get_data();
int dl = data.size();
PoolVector<uint8_t>::Read r = data.read();
@@ -317,8 +317,9 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
bool stream = p_options["stream"];
int size_limit = p_options["size_limit"];
- Image image;
- Error err = ImageLoader::load_image(p_source_file, &image);
+ Ref<Image> image;
+ image.instance();
+ Error err = ImageLoader::load_image(p_source_file, image);
if (err != OK)
return err;
@@ -336,28 +337,28 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
if (srgb == 1)
tex_flags |= Texture::FLAG_CONVERT_TO_LINEAR;
- if (size_limit > 0 && (image.get_width() > size_limit || image.get_height() > size_limit)) {
+ if (size_limit > 0 && (image->get_width() > size_limit || image->get_height() > size_limit)) {
//limit size
- if (image.get_width() >= image.get_height()) {
+ if (image->get_width() >= image->get_height()) {
int new_width = size_limit;
- int new_height = image.get_height() * new_width / image.get_width();
+ int new_height = image->get_height() * new_width / image->get_width();
- image.resize(new_width, new_height, Image::INTERPOLATE_CUBIC);
+ image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC);
} else {
int new_height = size_limit;
- int new_width = image.get_width() * new_height / image.get_height();
+ int new_width = image->get_width() * new_height / image->get_height();
- image.resize(new_width, new_height, Image::INTERPOLATE_CUBIC);
+ image->resize(new_width, new_height, Image::INTERPOLATE_CUBIC);
}
}
if (fix_alpha_border) {
- image.fix_alpha_edges();
+ image->fix_alpha_edges();
}
if (premult_alpha) {
- image.premultiply_alpha();
+ image->premultiply_alpha();
}
bool detect_3d = p_options["detect_3d"];
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index 196eb48469..e782fc2978 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -30,7 +30,9 @@
#ifndef RESOURCEIMPORTTEXTURE_H
#define RESOURCEIMPORTTEXTURE_H
+#include "image.h"
#include "io/resource_import.h"
+
class StreamTexture;
class ResourceImporterTexture : public ResourceImporter {
@@ -78,7 +80,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- void _save_stex(const Image &p_image, const String &p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable, bool p_detect_3d, bool p_detect_srgb);
+ void _save_stex(const Ref<Image> &p_image, const String &p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable, bool p_detect_3d, bool p_detect_srgb);
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL);
diff --git a/editor/io_plugins/editor_texture_import_plugin.cpp b/editor/io_plugins/editor_texture_import_plugin.cpp
index d9b4a95045..e860866d24 100644
--- a/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -680,7 +680,7 @@ EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin*
};
- mode_check[i]=memnew( CheckBox );
+ mode_check[i]=memnew(CheckBox);
bg->add_child(mode_check[i]);
mode_check[i]->set_text(mode_name[i]);
mode_check[i]->connect("pressed",this,"_mode_changed",varray(i));
diff --git a/editor/pane_drag.cpp b/editor/pane_drag.cpp
index 69a1f07fba..22b306f941 100644
--- a/editor/pane_drag.cpp
+++ b/editor/pane_drag.cpp
@@ -29,11 +29,12 @@
/*************************************************************************/
#include "pane_drag.h"
-void PaneDrag::_gui_input(const InputEvent &p_input) {
+void PaneDrag::_gui_input(const Ref<InputEvent> &p_input) {
- if (p_input.type == InputEvent::MOUSE_MOTION && p_input.mouse_motion.button_mask & BUTTON_MASK_LEFT) {
+ Ref<InputEventMouseMotion> mm = p_input;
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
- emit_signal("dragged", Point2(p_input.mouse_motion.relative_x, p_input.mouse_motion.relative_y));
+ emit_signal("dragged", Point2(mm->get_relative().x, mm->get_relative().y));
}
}
diff --git a/editor/pane_drag.h b/editor/pane_drag.h
index bd26621c83..7bd9feb63b 100644
--- a/editor/pane_drag.h
+++ b/editor/pane_drag.h
@@ -39,7 +39,7 @@ class PaneDrag : public Control {
bool mouse_over;
protected:
- void _gui_input(const InputEvent &p_input);
+ void _gui_input(const Ref<InputEvent> &p_input);
void _notification(int p_what);
virtual Size2 get_minimum_size() const;
static void _bind_methods();
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index b4398427f8..17fb953f3f 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -51,7 +51,7 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) {
}
}
-void AnimationPlayerEditor::_gui_input(InputEvent p_event) {
+void AnimationPlayerEditor::_gui_input(Ref<InputEvent> p_event) {
}
void AnimationPlayerEditor::_notification(int p_what) {
@@ -118,7 +118,14 @@ void AnimationPlayerEditor::_notification(int p_what) {
blend_editor.next->connect("item_selected", this, "_blend_editor_next_changed");
- // nodename->set_icon(get_icon("AnimationPlayer", "EditorIcons"));
+ /*
+ anim_editor_load->set_normal_texture( get_icon("AnimGet","EditorIcons"));
+ anim_editor_store->set_normal_texture( get_icon("AnimSet","EditorIcons"));
+ anim_editor_load->set_pressed_texture( get_icon("AnimGet","EditorIcons"));
+ anim_editor_store->set_pressed_texture( get_icon("AnimSet","EditorIcons"));
+ anim_editor_load->set_hover_texture( get_icon("AnimGetHl","EditorIcons"));
+ anim_editor_store->set_hover_texture( get_icon("AnimSetHl","EditorIcons"));
+*/
get_tree()->connect("node_removed", this, "_node_removed");
}
@@ -781,10 +788,6 @@ void AnimationPlayerEditor::_update_player() {
player->get_animation_list(&animlist);
animation->clear();
- if (player)
- nodename->set_text(player->get_name());
- else
- nodename->set_text(TTR("No player selected"));
add_anim->set_disabled(player == NULL);
load_anim->set_disabled(player == NULL);
@@ -1157,14 +1160,15 @@ void AnimationPlayerEditor::_animation_save_menu(int p_option) {
}
}
-void AnimationPlayerEditor::_unhandled_key_input(const InputEvent &p_ev) {
+void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
- if (is_visible_in_tree() && p_ev.type == InputEvent::KEY && p_ev.key.pressed && !p_ev.key.echo && !p_ev.key.mod.alt && !p_ev.key.mod.control && !p_ev.key.mod.meta) {
+ Ref<InputEventKey> k = p_ev;
+ if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) {
- switch (p_ev.key.scancode) {
+ switch (k->get_scancode()) {
case KEY_A: {
- if (!p_ev.key.mod.shift)
+ if (!k->get_shift())
_play_bw_from_pressed();
else
_play_bw_pressed();
@@ -1173,7 +1177,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const InputEvent &p_ev) {
_stop_pressed();
} break;
case KEY_D: {
- if (!p_ev.key.mod.shift)
+ if (!k->get_shift())
_play_from_pressed();
else
_play_pressed();
@@ -1358,14 +1362,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
//tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM);
hb->add_child(tool_anim);
- hb->add_child(memnew(VSeparator));
- nodename_icon = memnew(TextureRect);
- nodename_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
- hb->add_child(nodename_icon);
- nodename = memnew(Label);
- hb->add_child(nodename);
pin = memnew(ToolButton);
- pin->set_tooltip(TTR("Keep this animation selected?"));
pin->set_toggle_mode(true);
hb->add_child(pin);
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index d80f9dccf2..ceaa73569a 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -85,8 +85,6 @@ class AnimationPlayerEditor : public VBoxContainer {
Button *remove_anim;
MenuButton *tool_anim;
ToolButton *pin;
- Label *nodename;
- TextureRect *nodename_icon;
SpinBox *frame;
LineEdit *scale;
LineEdit *name;
@@ -160,7 +158,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_key_editor_anim_len_changed(float p_new);
void _animation_key_editor_anim_step_changed(float p_len);
- void _unhandled_key_input(const InputEvent &p_ev);
+ void _unhandled_key_input(const Ref<InputEvent> &p_ev);
void _animation_tool_menu(int p_option);
void _animation_save_menu(int p_option);
@@ -168,7 +166,7 @@ class AnimationPlayerEditor : public VBoxContainer {
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
void _node_removed(Node *p_node);
static void _bind_methods();
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index e126cdf40f..fccd527ed6 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -735,139 +735,139 @@ void AnimationTreeEditor::_node_edit_property(const StringName& p_node) {
}
#endif
-void AnimationTreeEditor::_gui_input(InputEvent p_event) {
+void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
- switch (p_event.type) {
+ Ref<InputEventMouseButton> mb = p_event;
- case InputEvent::MOUSE_BUTTON: {
+ if (mb.is_valid()) {
- if (p_event.mouse_button.pressed) {
+ if (mb->is_pressed()) {
- if (p_event.mouse_button.button_index == 1) {
- click_pos = Point2(p_event.mouse_button.x, p_event.mouse_button.y);
- click_motion = click_pos;
- click_type = _locate_click(click_pos, &click_node, &click_slot);
- if (click_type != CLICK_NONE) {
+ if (mb->get_button_index() == 1) {
+ click_pos = Point2(mb->get_pos().x, mb->get_pos().y);
+ click_motion = click_pos;
+ click_type = _locate_click(click_pos, &click_node, &click_slot);
+ if (click_type != CLICK_NONE) {
- order.erase(click_node);
- order.push_back(click_node);
- update();
- }
+ order.erase(click_node);
+ order.push_back(click_node);
+ update();
+ }
- switch (click_type) {
- case CLICK_INPUT_SLOT: {
- click_pos = _get_slot_pos(click_node, true, click_slot);
- } break;
- case CLICK_OUTPUT_SLOT: {
- click_pos = _get_slot_pos(click_node, false, click_slot);
- } break;
- case CLICK_PARAMETER: {
-
- edited_node = click_node;
- renaming_edit = false;
- _popup_edit_dialog();
- //open editor
- //_node_edit_property(click_node);
- } break;
- default: {}
- }
+ switch (click_type) {
+ case CLICK_INPUT_SLOT: {
+ click_pos = _get_slot_pos(click_node, true, click_slot);
+ } break;
+ case CLICK_OUTPUT_SLOT: {
+ click_pos = _get_slot_pos(click_node, false, click_slot);
+ } break;
+ case CLICK_PARAMETER: {
+
+ edited_node = click_node;
+ renaming_edit = false;
+ _popup_edit_dialog();
+ //open editor
+ //_node_edit_property(click_node);
+ } break;
+ default: {}
}
- if (p_event.mouse_button.button_index == 2) {
-
- if (click_type != CLICK_NONE) {
- click_type = CLICK_NONE;
- update();
- } else {
- // try to disconnect/remove
-
- Point2 rclick_pos = Point2(p_event.mouse_button.x, p_event.mouse_button.y);
- rclick_type = _locate_click(rclick_pos, &rclick_node, &rclick_slot);
- if (rclick_type == CLICK_INPUT_SLOT || rclick_type == CLICK_OUTPUT_SLOT) {
-
- node_popup->clear();
- node_popup->add_item(TTR("Disconnect"), NODE_DISCONNECT);
- if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION) {
- node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT);
- if (rclick_type == CLICK_INPUT_SLOT) {
- if (anim_tree->transition_node_has_input_auto_advance(rclick_node, rclick_slot))
- node_popup->add_item(TTR("Clear Auto-Advance"), NODE_CLEAR_AUTOADVANCE);
- else
- node_popup->add_item(TTR("Set Auto-Advance"), NODE_SET_AUTOADVANCE);
- node_popup->add_item(TTR("Delete Input"), NODE_DELETE_INPUT);
- }
- }
+ }
+ if (mb->get_button_index() == 2) {
- node_popup->set_position(rclick_pos + get_global_position());
- node_popup->popup();
+ if (click_type != CLICK_NONE) {
+ click_type = CLICK_NONE;
+ update();
+ } else {
+ // try to disconnect/remove
+
+ Point2 rclick_pos = Point2(mb->get_pos().x, mb->get_pos().y);
+ rclick_type = _locate_click(rclick_pos, &rclick_node, &rclick_slot);
+ if (rclick_type == CLICK_INPUT_SLOT || rclick_type == CLICK_OUTPUT_SLOT) {
+
+ node_popup->clear();
+ node_popup->add_item(TTR("Disconnect"), NODE_DISCONNECT);
+ if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION) {
+ node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT);
+ if (rclick_type == CLICK_INPUT_SLOT) {
+ if (anim_tree->transition_node_has_input_auto_advance(rclick_node, rclick_slot))
+ node_popup->add_item(TTR("Clear Auto-Advance"), NODE_CLEAR_AUTOADVANCE);
+ else
+ node_popup->add_item(TTR("Set Auto-Advance"), NODE_SET_AUTOADVANCE);
+ node_popup->add_item(TTR("Delete Input"), NODE_DELETE_INPUT);
+ }
}
- if (rclick_type == CLICK_NODE) {
- node_popup->clear();
- node_popup->add_item(TTR("Rename"), NODE_RENAME);
- node_popup->add_item(TTR("Remove"), NODE_ERASE);
- if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION)
- node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT);
- node_popup->set_position(rclick_pos + get_global_position());
- node_popup->popup();
- }
+ node_popup->set_position(rclick_pos + get_global_position());
+ node_popup->popup();
}
- }
- } else {
- if (p_event.mouse_button.button_index == 1 && click_type != CLICK_NONE) {
+ if (rclick_type == CLICK_NODE) {
+ node_popup->clear();
+ node_popup->add_item(TTR("Rename"), NODE_RENAME);
+ node_popup->add_item(TTR("Remove"), NODE_ERASE);
+ if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION)
+ node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT);
+ node_popup->set_position(rclick_pos + get_global_position());
+ node_popup->popup();
+ }
+ }
+ }
+ } else {
- switch (click_type) {
- case CLICK_INPUT_SLOT:
- case CLICK_OUTPUT_SLOT: {
+ if (mb->get_button_index() == 1 && click_type != CLICK_NONE) {
- Point2 dst_click_pos = Point2(p_event.mouse_button.x, p_event.mouse_button.y);
- StringName id;
- int slot;
- ClickType dst_click_type = _locate_click(dst_click_pos, &id, &slot);
+ switch (click_type) {
+ case CLICK_INPUT_SLOT:
+ case CLICK_OUTPUT_SLOT: {
- if (dst_click_type == CLICK_INPUT_SLOT && click_type == CLICK_OUTPUT_SLOT) {
+ Point2 dst_click_pos = Point2(mb->get_pos().x, mb->get_pos().y);
+ StringName id;
+ int slot;
+ ClickType dst_click_type = _locate_click(dst_click_pos, &id, &slot);
- anim_tree->connect_nodes(click_node, id, slot);
- }
- if (click_type == CLICK_INPUT_SLOT && dst_click_type == CLICK_OUTPUT_SLOT) {
+ if (dst_click_type == CLICK_INPUT_SLOT && click_type == CLICK_OUTPUT_SLOT) {
- anim_tree->connect_nodes(id, click_node, click_slot);
- }
+ anim_tree->connect_nodes(click_node, id, slot);
+ }
+ if (click_type == CLICK_INPUT_SLOT && dst_click_type == CLICK_OUTPUT_SLOT) {
- } break;
- case CLICK_NODE: {
- Point2 new_pos = anim_tree->node_get_pos(click_node) + (click_motion - click_pos);
- if (new_pos.x < 5)
- new_pos.x = 5;
- if (new_pos.y < 5)
- new_pos.y = 5;
- anim_tree->node_set_pos(click_node, new_pos);
-
- } break;
- default: {}
- }
+ anim_tree->connect_nodes(id, click_node, click_slot);
+ }
- click_type = CLICK_NONE;
- update();
+ } break;
+ case CLICK_NODE: {
+ Point2 new_pos = anim_tree->node_get_pos(click_node) + (click_motion - click_pos);
+ if (new_pos.x < 5)
+ new_pos.x = 5;
+ if (new_pos.y < 5)
+ new_pos.y = 5;
+ anim_tree->node_set_pos(click_node, new_pos);
+
+ } break;
+ default: {}
}
+
+ click_type = CLICK_NONE;
+ update();
}
}
+ }
- case InputEvent::MOUSE_MOTION: {
+ Ref<InputEventMouseMotion> mm = p_event;
- if (p_event.mouse_motion.button_mask & 1 && click_type != CLICK_NONE) {
+ if (mm.is_valid()) {
- click_motion = Point2(p_event.mouse_button.x, p_event.mouse_button.y);
- update();
- }
- if ((p_event.mouse_motion.button_mask & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
+ if (mm->get_button_mask() & 1 && click_type != CLICK_NONE) {
- h_scroll->set_value(h_scroll->get_value() - p_event.mouse_motion.relative_x);
- v_scroll->set_value(v_scroll->get_value() - p_event.mouse_motion.relative_y);
- update();
- }
+ click_motion = Point2(mm->get_pos().x, mm->get_pos().y);
+ update();
+ }
+ if ((mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
- } break;
+ h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
+ v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
+ update();
+ }
}
}
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index 8bbe22387b..785f042dd9 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -155,7 +155,7 @@ class AnimationTreeEditor : public Control {
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
public:
diff --git a/editor/plugins/baked_light_baker.h b/editor/plugins/baked_light_baker.h
index 5f32e236c0..123812fc07 100644
--- a/editor/plugins/baked_light_baker.h
+++ b/editor/plugins/baked_light_baker.h
@@ -31,7 +31,7 @@
#define BAKED_LIGHT_BAKER_H
#include "os/thread.h"
-#include "scene/3d/baked_light_instance.h"
+
#include "scene/3d/light.h"
#include "scene/3d/mesh_instance.h"
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 27be6ea8f0..a626dffc3c 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -204,17 +204,19 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) {
undo_redo->commit_action();
}
-void CanvasItemEditor::_unhandled_key_input(const InputEvent &p_ev) {
+void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
+
+ Ref<InputEventKey> k = p_ev;
if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack())
return;
- if (p_ev.key.mod.control)
+ if (k->get_control())
return;
- if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode == KEY_V && drag == DRAG_NONE && can_move_pivot) {
+ if (k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_V && drag == DRAG_NONE && can_move_pivot) {
- if (p_ev.key.mod.shift) {
+ if (k->get_shift()) {
//move drag pivot
drag = DRAG_PIVOT;
} else if (!Input::get_singleton()->is_mouse_button_pressed(0)) {
@@ -958,9 +960,9 @@ bool CanvasItemEditor::get_remove_list(List<Node *> *p_list) {
return false; //!p_list->empty();
}
-void CanvasItemEditor::_list_select(const InputEventMouseButton &b) {
+void CanvasItemEditor::_list_select(const Ref<InputEventMouseButton> &b) {
- Point2 click = Point2(b.x, b.y);
+ Point2 click = b->get_pos();
Node *scene = editor->get_edited_scene();
if (!scene)
@@ -982,7 +984,7 @@ void CanvasItemEditor::_list_select(const InputEventMouseButton &b) {
CanvasItem *item = selection_results[0].item;
selection_results.clear();
- additive_selection = b.mod.shift;
+ additive_selection = b->get_shift();
if (!_select(item, click, additive_selection, false))
return;
@@ -1012,9 +1014,9 @@ void CanvasItemEditor::_list_select(const InputEventMouseButton &b) {
"\nType: " + item->get_class() + "\nPath: " + node_path);
}
- additive_selection = b.mod.shift;
+ additive_selection = b->get_shift();
- selection_menu->set_global_position(Vector2(b.global_x, b.global_y));
+ selection_menu->set_global_position(b->get_global_pos());
selection_menu->popup();
selection_menu->call_deferred("grab_click_focus");
selection_menu->set_invalidate_click_until_motion();
@@ -1023,7 +1025,7 @@ void CanvasItemEditor::_list_select(const InputEventMouseButton &b) {
}
}
-void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
+void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
{
@@ -1039,19 +1041,19 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
}
}
- if (p_event.type == InputEvent::MOUSE_BUTTON) {
+ Ref<InputEventMouseButton> b = p_event;
- const InputEventMouseButton &b = p_event.mouse_button;
+ if (b.is_valid()) {
- if (b.button_index == BUTTON_WHEEL_DOWN) {
+ if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
if (zoom < MIN_ZOOM)
return;
float prev_zoom = zoom;
- zoom = zoom * (1 - (0.05 * b.factor));
+ zoom = zoom * (1 - (0.05 * b->get_factor()));
{
- Point2 ofs(b.x, b.y);
+ Point2 ofs = b->get_pos();
ofs = ofs / prev_zoom - ofs / zoom;
h_scroll->set_value(h_scroll->get_value() + ofs.x);
v_scroll->set_value(v_scroll->get_value() + ofs.y);
@@ -1061,15 +1063,15 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
return;
}
- if (b.button_index == BUTTON_WHEEL_UP) {
+ if (b->get_button_index() == BUTTON_WHEEL_UP) {
if (zoom > MAX_ZOOM)
return;
float prev_zoom = zoom;
- zoom = zoom * ((0.95 + (0.05 * b.factor)) / 0.95);
+ zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95);
{
- Point2 ofs(b.x, b.y);
+ Point2 ofs = b->get_pos();
ofs = ofs / prev_zoom - ofs / zoom;
h_scroll->set_value(h_scroll->get_value() + ofs.x);
v_scroll->set_value(v_scroll->get_value() + ofs.y);
@@ -1080,9 +1082,9 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
return;
}
- if (b.button_index == BUTTON_RIGHT) {
+ if (b->get_button_index() == BUTTON_RIGHT) {
- if (b.pressed && (tool == TOOL_SELECT && b.mod.alt)) {
+ if (b->is_pressed() && (tool == TOOL_SELECT && b->get_alt())) {
_list_select(b);
return;
@@ -1129,7 +1131,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
} else if (box_selecting) {
box_selecting = false;
viewport->update();
- } else if (b.pressed) {
+ } else if (b->is_pressed()) {
#if 0
ref_item = NULL;
Node* scene = get_scene()->get_root_node()->cast_to<EditorNode>()->get_edited_scene();
@@ -1145,16 +1147,16 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
return;
*/
- if (b.button_index == BUTTON_LEFT && tool == TOOL_LIST_SELECT) {
- if (b.pressed)
+ if (b->get_button_index() == BUTTON_LEFT && tool == TOOL_LIST_SELECT) {
+ if (b->is_pressed())
_list_select(b);
return;
}
- if (b.button_index == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) {
- if (b.pressed) {
+ if (b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) {
+ if (b->is_pressed()) {
- Point2 mouse_pos(b.x, b.y);
+ Point2 mouse_pos = b->get_pos();
mouse_pos = transform.affine_inverse().xform(mouse_pos);
mouse_pos = snap_point(mouse_pos);
_edit_set_pivot(mouse_pos);
@@ -1162,10 +1164,10 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
return;
}
- if (tool == TOOL_PAN || b.button_index != BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE))
+ if (tool == TOOL_PAN || b->get_button_index() != BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE))
return;
- if (!b.pressed) {
+ if (!b->is_pressed()) {
if (drag != DRAG_NONE) {
@@ -1227,7 +1229,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
if (box_selecting) {
#if 0
- if ( ! b.mod.shift ) _clear_canvas_items();
+ if ( ! b->get_shift() ) _clear_canvas_items();
if ( box_selection_end() ) return;
#endif
@@ -1272,8 +1274,8 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
E->get().to
};
- Vector2 p = Geometry::get_closest_point_to_segment_2d(Vector2(b.x, b.y), s);
- float d = p.distance_to(Vector2(b.x, b.y));
+ Vector2 p = Geometry::get_closest_point_to_segment_2d(b->get_pos(), s);
+ float d = p.distance_to(b->get_pos());
if (d < bone_width && d < closest_dist) {
Cbone = E;
closest_dist = d;
@@ -1340,9 +1342,9 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
ERR_FAIL_COND(!se);
- Point2 click(b.x, b.y);
+ Point2 click = b->get_pos();
- if ((b.mod.control && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
+ if ((b->get_control() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
drag = DRAG_ROTATE;
drag_from = transform.affine_inverse().xform(click);
@@ -1361,7 +1363,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
if (tool == TOOL_SELECT) {
drag = _find_drag_type(xform, rect, click, drag_point_from);
- if (b.doubleclick) {
+ if (b->is_doubleclick()) {
if (canvas_item->get_filename() != "" && canvas_item != editor->get_edited_scene()) {
@@ -1386,9 +1388,9 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
//multi canvas_item edit
- Point2 click = Point2(b.x, b.y);
+ Point2 click = b->get_pos();
- if ((b.mod.alt || tool == TOOL_MOVE) && get_item_count()) {
+ if ((b->get_alt() || tool == TOOL_MOVE) && get_item_count()) {
_prepare_drag(click);
viewport->update();
return;
@@ -1433,37 +1435,36 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
};
c = n->cast_to<CanvasItem>();
#if 0
- if ( b.pressed ) box_selection_start( click );
+ if ( b->is_pressed() ) box_selection_start( click );
#endif
- additive_selection = b.mod.shift;
+ additive_selection = b->get_shift();
if (!_select(c, click, additive_selection))
return;
}
- if (p_event.type == InputEvent::MOUSE_MOTION) {
+ Ref<InputEventMouseMotion> m = p_event;
+ if (m.is_valid()) {
if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
viewport->call_deferred("grab_focus");
- const InputEventMouseMotion &m = p_event.mouse_motion;
-
if (box_selecting) {
- box_selecting_to = transform.affine_inverse().xform(Point2(m.x, m.y));
+ box_selecting_to = transform.affine_inverse().xform(m->get_pos());
viewport->update();
return;
}
if (drag == DRAG_NONE) {
- if ((m.button_mask & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m.button_mask & BUTTON_MASK_MIDDLE || (m.button_mask & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
+ if ((m->get_button_mask() & BUTTON_MASK_LEFT && tool == TOOL_PAN) || m->get_button_mask() & BUTTON_MASK_MIDDLE || (m->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
Point2i relative;
if (bool(EditorSettings::get_singleton()->get("editors/2d/warped_mouse_panning"))) {
relative = Input::get_singleton()->warp_mouse_motion(m, viewport->get_global_rect());
} else {
- relative = Point2i(m.relative_x, m.relative_y);
+ relative = m->get_relative();
}
h_scroll->set_value(h_scroll->get_value() - relative.x / zoom);
@@ -1496,7 +1497,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
}
Vector2 dfrom = drag_from;
- Vector2 dto = transform.affine_inverse().xform(Point2(m.x, m.y));
+ Vector2 dto = transform.affine_inverse().xform(m->get_pos());
if (canvas_item->has_meta("_edit_lock_"))
continue;
@@ -1530,8 +1531,8 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
continue;
}
- bool uniform = m.mod.shift;
- bool symmetric = m.mod.alt;
+ bool uniform = m->get_shift();
+ bool symmetric = m->get_alt();
dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0));
@@ -1765,25 +1766,25 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) {
}
}
- if (p_event.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_event;
- const InputEventKey &k = p_event.key;
+ if (k.is_valid()) {
- if (k.pressed && drag == DRAG_NONE) {
+ if (k->is_pressed() && drag == DRAG_NONE) {
KeyMoveMODE move_mode = MOVE_VIEW_BASE;
- if (k.mod.alt) move_mode = MOVE_LOCAL_BASE;
- if (k.mod.control || k.mod.meta) move_mode = MOVE_LOCAL_WITH_ROT;
-
- if (k.scancode == KEY_UP)
- _key_move(Vector2(0, -1), k.mod.shift, move_mode);
- else if (k.scancode == KEY_DOWN)
- _key_move(Vector2(0, 1), k.mod.shift, move_mode);
- else if (k.scancode == KEY_LEFT)
- _key_move(Vector2(-1, 0), k.mod.shift, move_mode);
- else if (k.scancode == KEY_RIGHT)
- _key_move(Vector2(1, 0), k.mod.shift, move_mode);
- else if (k.scancode == KEY_ESCAPE) {
+ if (k->get_alt()) move_mode = MOVE_LOCAL_BASE;
+ if (k->get_control() || k->get_metakey()) move_mode = MOVE_LOCAL_WITH_ROT;
+
+ if (k->get_scancode() == KEY_UP)
+ _key_move(Vector2(0, -1), k->get_shift(), move_mode);
+ else if (k->get_scancode() == KEY_DOWN)
+ _key_move(Vector2(0, 1), k->get_shift(), move_mode);
+ else if (k->get_scancode() == KEY_LEFT)
+ _key_move(Vector2(-1, 0), k->get_shift(), move_mode);
+ else if (k->get_scancode() == KEY_RIGHT)
+ _key_move(Vector2(1, 0), k->get_shift(), move_mode);
+ else if (k->get_scancode() == KEY_ESCAPE) {
editor_selection->clear();
viewport->update();
} else
@@ -1837,7 +1838,7 @@ void CanvasItemEditor::_viewport_draw() {
if (h_scroll->is_visible_in_tree())
size.height -= h_scroll->get_size().height;
- get_stylebox("EditorFocus", "EditorStyles")->draw(ci, Rect2(Point2(), size));
+ get_stylebox("Focus", "EditorStyles")->draw(ci, Rect2(Point2(), size));
}
Ref<Texture> lock = get_icon("Lock", "EditorIcons");
@@ -3123,7 +3124,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
editor_selection->connect("selection_changed", this, "update");
hb = memnew(HBoxContainer);
- hb->add_style_override("bg", editor->get_gui_base()->get_stylebox("panel", "PanelContainer"));
add_child(hb);
hb->set_area_as_parent_rect();
@@ -3300,8 +3300,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
animation_hb->hide();
key_loc_button = memnew(Button("loc"));
- key_loc_button = memnew(Button("loc"));
- key_loc_button->set_flat(true);
key_loc_button->set_toggle_mode(true);
key_loc_button->set_pressed(true);
key_loc_button->set_focus_mode(FOCUS_NONE);
@@ -3310,7 +3308,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
key_loc_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_POS));
animation_hb->add_child(key_loc_button);
key_rot_button = memnew(Button("rot"));
- key_rot_button->set_flat(true);
key_rot_button->set_toggle_mode(true);
key_rot_button->set_pressed(true);
key_rot_button->set_focus_mode(FOCUS_NONE);
@@ -3319,14 +3316,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
key_rot_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_ROT));
animation_hb->add_child(key_rot_button);
key_scale_button = memnew(Button("scl"));
- key_scale_button->set_flat(true);
key_scale_button->set_toggle_mode(true);
key_scale_button->set_focus_mode(FOCUS_NONE);
key_scale_button->add_color_override("font_color", Color(1, 0.6, 0.6));
key_scale_button->add_color_override("font_color_pressed", Color(0.6, 1, 0.6));
key_scale_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_SCALE));
animation_hb->add_child(key_scale_button);
- key_insert_button = memnew(ToolButton);
+ key_insert_button = memnew(Button);
key_insert_button->set_focus_mode(FOCUS_NONE);
key_insert_button->connect("pressed", this, "_popup_callback", varray(ANIM_INSERT_KEY));
key_insert_button->set_tooltip(TTR("Insert Keys"));
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 7f09b92f4c..22fa5b5db8 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -322,7 +322,7 @@ class CanvasItemEditor : public VBoxContainer {
void _clear_canvas_items();
void _visibility_changed(ObjectID p_canvas_item);
void _key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE p_move_mode);
- void _list_select(const InputEventMouseButton &b);
+ void _list_select(const Ref<InputEventMouseButton> &b);
DragType _find_drag_type(const Transform2D &p_xform, const Rect2 &p_local_rect, const Point2 &p_click, Vector2 &r_point);
void _prepare_drag(const Point2 &p_click_pos);
@@ -352,9 +352,9 @@ class CanvasItemEditor : public VBoxContainer {
int get_item_count();
void _keying_changed();
- void _unhandled_key_input(const InputEvent &p_ev);
+ void _unhandled_key_input(const Ref<InputEvent> &p_ev);
- void _viewport_gui_input(const InputEvent &p_event);
+ void _viewport_gui_input(const Ref<InputEvent> &p_event);
void _viewport_draw();
void _focus_selection(int p_op);
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index ae426ba29e..b7cfcaae02 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -94,213 +94,208 @@ void CollisionPolygon2DEditor::_wip_close() {
edited_point = -1;
}
-bool CollisionPolygon2DEditor::forward_gui_input(const InputEvent &p_event) {
+bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node)
return false;
- switch (p_event.type) {
+ Ref<InputEventMouseButton> mb;
- case InputEvent::MOUSE_BUTTON: {
+ if (mb.is_valid()) {
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- const InputEventMouseButton &mb = p_event.mouse_button;
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Vector<Vector2> poly = node->get_polygon();
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
+ //first check if a point is to be added (segment split)
+ real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
- Vector<Vector2> poly = node->get_polygon();
+ switch (mode) {
- //first check if a point is to be added (segment split)
- real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+ case MODE_CREATE: {
- switch (mode) {
+ if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- case MODE_CREATE: {
+ if (!wip_active) {
- if (mb.button_index == BUTTON_LEFT && mb.pressed) {
+ wip.clear();
+ wip.push_back(cpoint);
+ wip_active = true;
+ edited_point_pos = cpoint;
+ canvas_item_editor->get_viewport_control()->update();
+ edited_point = 1;
+ return true;
+ } else {
- if (!wip_active) {
+ if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
+ //wip closed
+ _wip_close();
- wip.clear();
- wip.push_back(cpoint);
- wip_active = true;
- edited_point_pos = cpoint;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
return true;
} else {
- if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint);
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
+ wip.push_back(cpoint);
+ edited_point = wip.size();
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
- //add wip point
- }
+ //add wip point
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && wip_active) {
- _wip_close();
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close();
+ }
- } break;
-
- case MODE_EDIT: {
+ } break;
- if (mb.button_index == BUTTON_LEFT) {
- if (mb.pressed) {
+ case MODE_EDIT: {
- if (mb.mod.control) {
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- if (poly.size() < 3) {
+ if (mb->get_control()) {
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
-
- //search edges
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 points[2] = { xform.xform(poly[i]),
- xform.xform(poly[(i + 1) % poly.size()]) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
-
- if (closest_idx >= 0) {
+ if (poly.size() < 3) {
- pre_move_edit = poly;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
- edited_point = closest_idx + 1;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->set_polygon(poly);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_undo_method(node, "set_polygon", poly);
+ poly.push_back(cpoint);
+ undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
- //look for points to move
+ //search edges
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
+ Vector2 points[2] = { xform.xform(poly[i]),
+ xform.xform(poly[(i + 1) % poly.size()]) };
- Vector2 cp = xform.xform(poly[i]);
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
+ if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
+ continue; //not valid to reuse point
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
}
+ }
- if (closest_idx >= 0) {
+ if (closest_idx >= 0) {
- pre_move_edit = poly;
- edited_point = closest_idx;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
+ pre_move_edit = poly;
+ poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
+ edited_point = closest_idx + 1;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ node->set_polygon(poly);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
} else {
- if (edited_point != -1) {
+ //look for points to move
- //apply
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos;
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ Vector2 cp = xform.xform(poly[i]);
- edited_point = -1;
- return true;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
}
- }
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && edited_point == -1) {
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
- Vector2 cp = xform.xform(poly[i]);
+ if (closest_idx >= 0) {
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
+ pre_move_edit = poly;
+ edited_point = closest_idx;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
}
+ } else {
+
+ if (edited_point != -1) {
- if (closest_idx >= 0) {
+ //apply
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.remove(closest_idx);
+ ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
+ poly[edited_point] = edited_point_pos;
+ undo_redo->create_action(TTR("Edit Poly"));
undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->commit_action();
+
+ edited_point = -1;
return true;
}
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
- } break;
- }
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- } break;
- case InputEvent::MOUSE_MOTION: {
+ Vector2 cp = xform.xform(poly[i]);
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
- if (edited_point != -1 && (wip_active || mm.button_mask & BUTTON_MASK_LEFT)) {
+ if (closest_idx >= 0) {
- Vector2 gpoint = Point2(mm.x, mm.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ undo_redo->add_undo_method(node, "set_polygon", poly);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
+ }
- canvas_item_editor->get_viewport_control()->update();
- }
+ } break;
+ }
+ }
- } break;
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
+
+ Vector2 gpoint = mm->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+
+ canvas_item_editor->get_viewport_control()->update();
+ }
}
return false;
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.h b/editor/plugins/collision_polygon_2d_editor_plugin.h
index babe653581..382c0d6c37 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -80,7 +80,7 @@ protected:
static void _bind_methods();
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
CollisionPolygon2DEditor(EditorNode *p_editor);
};
@@ -93,7 +93,7 @@ class CollisionPolygon2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "CollisionPolygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp
index fdb1bf984e..c89e6f59a4 100644
--- a/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -131,7 +131,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
- Vector2 gpoint=Point2(mb.x,mb.y);
+ Vector2 gpoint=Point2(mb->get_pos().x,mb->get_pos().y);
Vector3 ray_from = p_camera->project_ray_origin(gpoint);
Vector3 ray_dir = p_camera->project_ray_normal(gpoint);
@@ -156,7 +156,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
case MODE_CREATE: {
- if (mb.button_index==BUTTON_LEFT && mb.pressed) {
+ if (mb->get_button_index()==BUTTON_LEFT && mb->is_pressed()) {
if (!wip_active) {
@@ -186,7 +186,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
//add wip point
}
}
- } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && wip_active) {
+ } else if (mb->get_button_index()==BUTTON_RIGHT && mb->is_pressed() && wip_active) {
_wip_close();
}
@@ -196,10 +196,10 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
case MODE_EDIT: {
- if (mb.button_index==BUTTON_LEFT) {
- if (mb.pressed) {
+ if (mb->get_button_index()==BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- if (mb.mod.control) {
+ if (mb->get_control()) {
if (poly.size() < 3) {
@@ -297,7 +297,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } if (mb->get_button_index()==BUTTON_RIGHT && mb->is_pressed() && edited_point==-1) {
@@ -344,7 +344,7 @@ bool CollisionPolygonEditor::forward_spatial_gui_input(Camera* p_camera,const In
const InputEventMouseMotion &mm=p_event.mouse_motion;
- if (edited_point!=-1 && (wip_active || mm.button_mask&BUTTON_MASK_LEFT)) {
+ if (edited_point!=-1 && (wip_active || mm->get_button_mask()&BUTTON_MASK_LEFT)) {
Vector2 gpoint = Point2(mm.x,mm.y);
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 70cc81efb0..e2184c6158 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -302,7 +302,7 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) {
undo_redo->commit_action();
}
-bool CollisionShape2DEditor::forward_gui_input(const InputEvent &p_event) {
+bool CollisionShape2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node) {
return false;
@@ -316,68 +316,66 @@ bool CollisionShape2DEditor::forward_gui_input(const InputEvent &p_event) {
return false;
}
- switch (p_event.type) {
- case InputEvent::MOUSE_BUTTON: {
- const InputEventMouseButton &mb = p_event.mouse_button;
+ Ref<InputEventMouseButton> mb = p_event;
- Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ if (mb.is_valid()) {
- Point2 gpoint(mb.x, mb.y);
+ Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- if (mb.button_index == BUTTON_LEFT) {
- if (mb.pressed) {
- for (int i = 0; i < handles.size(); i++) {
- if (gt.xform(handles[i]).distance_to(gpoint) < 8) {
- edit_handle = i;
+ Point2 gpoint(mb->get_pos().x, mb->get_pos().y);
- break;
- }
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
+ for (int i = 0; i < handles.size(); i++) {
+ if (gt.xform(handles[i]).distance_to(gpoint) < 8) {
+ edit_handle = i;
+
+ break;
}
+ }
- if (edit_handle == -1) {
- pressed = false;
+ if (edit_handle == -1) {
+ pressed = false;
- return false;
- }
+ return false;
+ }
- original = get_handle_value(edit_handle);
- pressed = true;
+ original = get_handle_value(edit_handle);
+ pressed = true;
- return true;
+ return true;
- } else {
- if (pressed) {
- commit_handle(edit_handle, original);
+ } else {
+ if (pressed) {
+ commit_handle(edit_handle, original);
- edit_handle = -1;
- pressed = false;
+ edit_handle = -1;
+ pressed = false;
- return true;
- }
+ return true;
}
}
+ }
- return false;
-
- } break;
+ return false;
+ }
- case InputEvent::MOUSE_MOTION: {
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ Ref<InputEventMouseMotion> mm = p_event;
- if (edit_handle == -1 || !pressed) {
- return false;
- }
+ if (mm.is_valid()) {
- Point2 gpoint = Point2(mm.x, mm.y);
- Point2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
+ if (edit_handle == -1 || !pressed) {
+ return false;
+ }
- set_handle(edit_handle, cpoint);
+ Point2 gpoint = mm->get_pos();
+ Point2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
- return true;
+ set_handle(edit_handle, cpoint);
- } break;
+ return true;
}
return false;
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index bbd94516a8..09aefc65c0 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -74,7 +74,7 @@ protected:
static void _bind_methods();
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_node);
CollisionShape2DEditor(EditorNode *p_editor);
@@ -87,7 +87,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return collision_shape_2d_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_shape_2d_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "CollisionShape2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index f3ad5c0fd1..6dd94863a1 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -33,9 +33,10 @@
#include "os/keyboard.h"
#include "spatial_editor_plugin.h"
-void CurveTextureEdit::_gui_input(const InputEvent &p_event) {
+void CurveTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode == KEY_DELETE && grabbed != -1) {
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && grabbed != -1) {
points.remove(grabbed);
grabbed = -1;
@@ -44,7 +45,9 @@ void CurveTextureEdit::_gui_input(const InputEvent &p_event) {
accept_event();
}
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.pressed) {
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
update();
Ref<Font> font = get_font("font", "Label");
@@ -54,7 +57,7 @@ void CurveTextureEdit::_gui_input(const InputEvent &p_event) {
Vector2 size = get_size();
size.y -= font_h;
- Point2 p = Vector2(p_event.mouse_button.x, p_event.mouse_button.y) / size;
+ Point2 p = Vector2(mb->get_pos().x, mb->get_pos().y) / size;
p.y = CLAMP(1.0 - p.y, 0, 1) * (max - min) + min;
grabbed = -1;
grabbing = true;
@@ -90,7 +93,7 @@ void CurveTextureEdit::_gui_input(const InputEvent &p_event) {
emit_signal("curve_changed");
}
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && !p_event.mouse_button.pressed) {
+ if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
if (grabbing) {
grabbing = false;
@@ -99,14 +102,16 @@ void CurveTextureEdit::_gui_input(const InputEvent &p_event) {
update();
}
- if (p_event.type == InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) {
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid() && grabbing && grabbed != -1) {
Ref<Font> font = get_font("font", "Label");
int font_h = font->get_height();
Vector2 size = get_size();
size.y -= font_h;
- Point2 p = Vector2(p_event.mouse_motion.x, p_event.mouse_motion.y) / size;
+ Point2 p = mm->get_pos() / size;
p.y = CLAMP(1.0 - p.y, 0, 1) * (max - min) + min;
p.x = CLAMP(p.x, 0.0, 1.0);
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index ebe05539aa..4e75ba407c 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -54,7 +54,7 @@ class CurveTextureEdit : public Control {
void _plot_curve(const Vector2 &p_a, const Vector2 &p_b, const Vector2 &p_c, const Vector2 &p_d);
protected:
- void _gui_input(const InputEvent &p_event);
+ void _gui_input(const Ref<InputEvent> &p_event);
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/plugins/gradient_texture_editor_plugin.cpp b/editor/plugins/gradient_texture_editor_plugin.cpp
index 41dd64d931..40f7de478d 100644
--- a/editor/plugins/gradient_texture_editor_plugin.cpp
+++ b/editor/plugins/gradient_texture_editor_plugin.cpp
@@ -48,7 +48,8 @@ GradientTextureEdit::GradientTextureEdit() {
add_child(popup);
checker = Ref<ImageTexture>(memnew(ImageTexture));
- checker->create_from_image(Image(checker_bg_png), ImageTexture::FLAG_REPEAT);
+ Ref<Image> checker_bg = memnew(Image(checker_bg_png));
+ checker->create_from_image(checker_bg, ImageTexture::FLAG_REPEAT);
}
int GradientTextureEdit::_get_point_from_pos(int x) {
@@ -76,9 +77,11 @@ void GradientTextureEdit::_show_color_picker() {
GradientTextureEdit::~GradientTextureEdit() {
}
-void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
+void GradientTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode == KEY_DELETE && grabbed != -1) {
+ Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && grabbed != -1) {
points.remove(grabbed);
grabbed = -1;
@@ -88,16 +91,17 @@ void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
accept_event();
}
+ Ref<InputEventMouseButton> mb = p_event;
//Show color picker on double click.
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.doubleclick && p_event.mouse_button.pressed) {
- grabbed = _get_point_from_pos(p_event.mouse_button.x);
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_doubleclick() && mb->is_pressed()) {
+ grabbed = _get_point_from_pos(mb->get_pos().x);
_show_color_picker();
accept_event();
}
//Delete point on right click
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 2 && p_event.mouse_button.pressed) {
- grabbed = _get_point_from_pos(p_event.mouse_button.x);
+ if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
+ grabbed = _get_point_from_pos(mb->get_pos().x);
if (grabbed != -1) {
points.remove(grabbed);
grabbed = -1;
@@ -109,9 +113,9 @@ void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
}
//Hold alt key to duplicate selected color
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.pressed && p_event.key.mod.alt) {
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && mb->get_alt()) {
- int x = p_event.mouse_button.x;
+ int x = mb->get_pos().x;
grabbed = _get_point_from_pos(x);
if (grabbed != -1) {
@@ -133,10 +137,10 @@ void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
}
}
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.pressed) {
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
update();
- int x = p_event.mouse_button.x;
+ int x = mb->get_pos().x;
int total_w = get_size().width - get_size().height - 3;
//Check if color selector was clicked.
@@ -201,7 +205,7 @@ void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
emit_signal("ramp_changed");
}
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && !p_event.mouse_button.pressed) {
+ if (mb.is_valid() && mb->get_button_index() == 1 && !mb->is_pressed()) {
if (grabbing) {
grabbing = false;
@@ -210,15 +214,17 @@ void GradientTextureEdit::_gui_input(const InputEvent &p_event) {
update();
}
- if (p_event.type == InputEvent::MOUSE_MOTION && grabbing) {
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid() && grabbing) {
int total_w = get_size().width - get_size().height - 3;
- int x = p_event.mouse_motion.x;
+ int x = mm->get_pos().x;
float newofs = CLAMP(x / float(total_w), 0, 1);
//Snap to nearest point if holding shift
- if (p_event.key.mod.shift) {
+ if (mm->get_shift()) {
float snap_treshhold = 0.03;
float smallest_ofs = snap_treshhold;
bool founded = false;
diff --git a/editor/plugins/gradient_texture_editor_plugin.h b/editor/plugins/gradient_texture_editor_plugin.h
index cb2f6b4061..842d586541 100644
--- a/editor/plugins/gradient_texture_editor_plugin.h
+++ b/editor/plugins/gradient_texture_editor_plugin.h
@@ -53,7 +53,7 @@ class GradientTextureEdit : public Control {
void _show_color_picker();
protected:
- void _gui_input(const InputEvent &p_event);
+ void _gui_input(const Ref<InputEvent> &p_event);
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 73b615d817..9c9e010b47 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -98,225 +98,223 @@ void LightOccluder2DEditor::_wip_close(bool p_closed) {
edited_point = -1;
}
-bool LightOccluder2DEditor::forward_gui_input(const InputEvent &p_event) {
+bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node)
return false;
if (node->get_occluder_polygon().is_null()) {
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.pressed) {
+ Ref<InputEventMouseButton> mb = p_event;
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
create_poly->set_text("No OccluderPolygon2D resource on this node.\nCreate and assign one?");
create_poly->popup_centered_minsize();
}
- return (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1);
+ return (mb.is_valid() && mb->get_button_index() == 1);
}
- switch (p_event.type) {
- case InputEvent::MOUSE_BUTTON: {
+ Ref<InputEventMouseButton> mb = p_event;
- const InputEventMouseButton &mb = p_event.mouse_button;
+ if (mb.is_valid()) {
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
- Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon());
+ Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon());
- //first check if a point is to be added (segment split)
- real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+ //first check if a point is to be added (segment split)
+ real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
- switch (mode) {
+ switch (mode) {
- case MODE_CREATE: {
+ case MODE_CREATE: {
- if (mb.button_index == BUTTON_LEFT && mb.pressed) {
+ if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- if (!wip_active) {
+ if (!wip_active) {
- wip.clear();
- wip.push_back(cpoint);
- wip_active = true;
- edited_point_pos = cpoint;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
- return true;
- } else {
+ wip.clear();
+ wip.push_back(cpoint);
+ wip_active = true;
+ edited_point_pos = cpoint;
+ canvas_item_editor->get_viewport_control()->update();
+ edited_point = 1;
+ return true;
+ } else {
- if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
- //wip closed
- _wip_close(true);
+ if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
+ //wip closed
+ _wip_close(true);
- return true;
- } else if (wip.size() > 1 && xform.xform(wip[wip.size() - 1]).distance_to(gpoint) < grab_treshold) {
- //wip closed
- _wip_close(false);
- return true;
+ return true;
+ } else if (wip.size() > 1 && xform.xform(wip[wip.size() - 1]).distance_to(gpoint) < grab_treshold) {
+ //wip closed
+ _wip_close(false);
+ return true;
- } else {
+ } else {
- wip.push_back(cpoint);
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
+ wip.push_back(cpoint);
+ edited_point = wip.size();
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
- //add wip point
- }
+ //add wip point
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && wip_active) {
- _wip_close(true);
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close(true);
+ }
- } break;
-
- case MODE_EDIT: {
-
- if (mb.button_index == BUTTON_LEFT) {
- if (mb.pressed) {
-
- if (mb.mod.control) {
+ } break;
- if (poly.size() < 3) {
+ case MODE_EDIT: {
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- //search edges
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 points[2] = { xform.xform(poly[i]),
- xform.xform(poly[(i + 1) % poly.size()]) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
+ if (mb->get_control()) {
- if (closest_idx >= 0) {
+ if (poly.size() < 3) {
- pre_move_edit = poly;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
- edited_point = closest_idx + 1;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->get_occluder_polygon()->set_polygon(Variant(poly));
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
+ poly.push_back(cpoint);
+ undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
- //look for points to move
+ //search edges
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
+ Vector2 points[2] = { xform.xform(poly[i]),
+ xform.xform(poly[(i + 1) % poly.size()]) };
- Vector2 cp = xform.xform(poly[i]);
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
+ if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
+ continue; //not valid to reuse point
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
}
+ }
- if (closest_idx >= 0) {
+ if (closest_idx >= 0) {
- pre_move_edit = poly;
- edited_point = closest_idx;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
+ pre_move_edit = poly;
+ poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
+ edited_point = closest_idx + 1;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ node->get_occluder_polygon()->set_polygon(Variant(poly));
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
} else {
- if (edited_point != -1) {
+ //look for points to move
- //apply
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos;
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
- undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ Vector2 cp = xform.xform(poly[i]);
- edited_point = -1;
- return true;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
}
- }
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && edited_point == -1) {
-
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
- Vector2 cp = xform.xform(poly[i]);
+ if (closest_idx >= 0) {
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
+ pre_move_edit = poly;
+ edited_point = closest_idx;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
}
+ } else {
+
+ if (edited_point != -1) {
- if (closest_idx >= 0) {
+ //apply
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
- poly.remove(closest_idx);
+ ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
+ poly[edited_point] = edited_point_pos;
+ undo_redo->create_action(TTR("Edit Poly"));
undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
+ undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", pre_move_edit);
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->commit_action();
+
+ edited_point = -1;
return true;
}
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
- } break;
- }
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- } break;
- case InputEvent::MOUSE_MOTION: {
+ Vector2 cp = xform.xform(poly[i]);
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
- if (edited_point != -1 && (wip_active || mm.button_mask & BUTTON_MASK_LEFT)) {
+ if (closest_idx >= 0) {
- Vector2 gpoint = Point2(mm.x, mm.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ undo_redo->add_undo_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node->get_occluder_polygon().ptr(), "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
+ }
- canvas_item_editor->get_viewport_control()->update();
- }
+ } break;
+ }
+ }
- } break;
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
+
+ Vector2 gpoint = mm->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+
+ canvas_item_editor->get_viewport_control()->update();
+ }
}
return false;
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h
index 8e0817e61e..d6579fc94c 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -84,7 +84,7 @@ protected:
public:
Vector2 snap_point(const Vector2 &p_point) const;
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
LightOccluder2DEditor(EditorNode *p_editor);
};
@@ -97,7 +97,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 4df0d2605a..3497af3602 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -75,7 +75,7 @@ int Line2DEditor::get_point_index_at(Vector2 gpos) {
return -1;
}
-bool Line2DEditor::forward_gui_input(const InputEvent &p_event) {
+bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node)
return false;
@@ -83,75 +83,74 @@ bool Line2DEditor::forward_gui_input(const InputEvent &p_event) {
if (!node->is_visible())
return false;
- switch (p_event.type) {
-
- case InputEvent::MOUSE_BUTTON: {
-
- const InputEventMouseButton &mb = p_event.mouse_button;
-
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = mouse_to_local_pos(gpoint, mb.mod.alt);
-
- if (mb.pressed && _dragging == false) {
- int i = get_point_index_at(gpoint);
- if (i != -1) {
- if (mb.button_index == BUTTON_LEFT && !mb.mod.shift && mode == MODE_EDIT) {
- _dragging = true;
- action_point = i;
- moving_from = node->get_point_pos(i);
- moving_screen_from = gpoint;
- } else if ((mb.button_index == BUTTON_RIGHT && mode == MODE_EDIT) || (mb.button_index == BUTTON_LEFT && mode == MODE_DELETE)) {
- undo_redo->create_action(TTR("Remove Point from Line2D"));
- undo_redo->add_do_method(node, "remove_point", i);
- undo_redo->add_undo_method(node, "add_point", node->get_point_pos(i), i);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- }
- return true;
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid()) {
+
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint = mouse_to_local_pos(gpoint, mb->get_alt());
+
+ if (mb->is_pressed() && _dragging == false) {
+ int i = get_point_index_at(gpoint);
+ if (i != -1) {
+ if (mb->get_button_index() == BUTTON_LEFT && !mb->get_shift() && mode == MODE_EDIT) {
+ _dragging = true;
+ action_point = i;
+ moving_from = node->get_point_pos(i);
+ moving_screen_from = gpoint;
+ } else if ((mb->get_button_index() == BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == BUTTON_LEFT && mode == MODE_DELETE)) {
+ undo_redo->create_action(TTR("Remove Point from Line2D"));
+ undo_redo->add_do_method(node, "remove_point", i);
+ undo_redo->add_undo_method(node, "add_point", node->get_point_pos(i), i);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
}
+ return true;
}
+ }
- if (mb.pressed && mb.button_index == BUTTON_LEFT && ((mb.mod.command && mode == MODE_EDIT) || mode == MODE_CREATE)) {
+ if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
- undo_redo->create_action(TTR("Add Point to Line2D"));
- undo_redo->add_do_method(node, "add_point", cpoint);
- undo_redo->add_undo_method(node, "remove_point", node->get_point_count());
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Add Point to Line2D"));
+ undo_redo->add_do_method(node, "add_point", cpoint);
+ undo_redo->add_undo_method(node, "remove_point", node->get_point_count());
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- _dragging = true;
- action_point = node->get_point_count() - 1;
- moving_from = node->get_point_pos(action_point);
- moving_screen_from = gpoint;
+ _dragging = true;
+ action_point = node->get_point_count() - 1;
+ moving_from = node->get_point_pos(action_point);
+ moving_screen_from = gpoint;
- canvas_item_editor->get_viewport_control()->update();
+ canvas_item_editor->get_viewport_control()->update();
- return true;
- }
+ return true;
+ }
- if (!mb.pressed && mb.button_index == BUTTON_LEFT && _dragging) {
- undo_redo->create_action(TTR("Move Point in Line2D"));
- undo_redo->add_do_method(node, "set_point_pos", action_point, cpoint);
- undo_redo->add_undo_method(node, "set_point_pos", action_point, moving_from);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- _dragging = false;
- return true;
- }
- } break;
-
- case InputEvent::MOUSE_MOTION: {
- if (_dragging) {
- const InputEventMouseMotion &mm = p_event.mouse_motion;
- Vector2 cpoint = mouse_to_local_pos(Vector2(mm.x, mm.y), mm.mod.alt);
- node->set_point_pos(action_point, cpoint);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } break;
+ if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && _dragging) {
+ undo_redo->create_action(TTR("Move Point in Line2D"));
+ undo_redo->add_do_method(node, "set_point_pos", action_point, cpoint);
+ undo_redo->add_undo_method(node, "set_point_pos", action_point, moving_from);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ _dragging = false;
+ return true;
+ }
+ }
+
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (_dragging) {
+ Vector2 cpoint = mouse_to_local_pos(mm->get_pos(), mm->get_alt());
+ node->set_point_pos(action_point, cpoint);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+ }
}
return false;
diff --git a/editor/plugins/line_2d_editor_plugin.h b/editor/plugins/line_2d_editor_plugin.h
index 7477f7eee5..3a1f841556 100644
--- a/editor/plugins/line_2d_editor_plugin.h
+++ b/editor/plugins/line_2d_editor_plugin.h
@@ -43,7 +43,7 @@ class Line2DEditor : public HBoxContainer {
GDCLASS(Line2DEditor, HBoxContainer)
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_line2d);
Line2DEditor(EditorNode *p_editor);
@@ -95,7 +95,7 @@ class Line2DEditorPlugin : public EditorPlugin {
public:
virtual bool forward_canvas_gui_input(
const Transform2D &p_canvas_xform,
- const InputEvent &p_event) {
+ const Ref<InputEvent> &p_event) {
return line2d_editor->forward_gui_input(p_event);
}
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index 61da860cab..f377d3a7cc 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -33,10 +33,10 @@
void MeshEditor::_gui_input(InputEvent p_event) {
- if (p_event.type==InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) {
+ if (p_event.type==InputEvent::MOUSE_MOTION && p_event->get_button_mask()&BUTTON_MASK_LEFT) {
- rot_x-=p_event.mouse_motion.relative_y*0.01;
- rot_y-=p_event.mouse_motion.relative_x*0.01;
+ rot_x-=p_event->get_relative().y*0.01;
+ rot_y-=p_event->get_relative().x*0.01;
if (rot_x<-Math_PI/2)
rot_x=-Math_PI/2;
else if (rot_x>Math_PI/2) {
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index be8c46f379..a7fc1d5adb 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -112,263 +112,262 @@ void NavigationPolygonEditor::_wip_close() {
edited_point = -1;
}
-bool NavigationPolygonEditor::forward_gui_input(const InputEvent &p_event) {
+bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node)
return false;
if (node->get_navigation_polygon().is_null()) {
- if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1 && p_event.mouse_button.pressed) {
+
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
create_nav->set_text("No NavigationPolygon resource on this node.\nCreate and assign one?");
create_nav->popup_centered_minsize();
}
- return (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 1);
+ return (mb.is_valid() && mb->get_button_index() == 1);
}
- switch (p_event.type) {
+ Ref<InputEventMouseButton> mb = p_event;
- case InputEvent::MOUSE_BUTTON: {
+ if (mb.is_valid()) {
- const InputEventMouseButton &mb = p_event.mouse_button;
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
+ //first check if a point is to be added (segment split)
+ real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
- //first check if a point is to be added (segment split)
- real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+ switch (mode) {
- switch (mode) {
+ case MODE_CREATE: {
- case MODE_CREATE: {
+ if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- if (mb.button_index == BUTTON_LEFT && mb.pressed) {
+ if (!wip_active) {
- if (!wip_active) {
+ wip.clear();
+ wip.push_back(cpoint);
+ wip_active = true;
+ edited_point_pos = cpoint;
+ edited_outline = -1;
+ canvas_item_editor->get_viewport_control()->update();
+ edited_point = 1;
+ return true;
+ } else {
+
+ if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
+ //wip closed
+ _wip_close();
- wip.clear();
- wip.push_back(cpoint);
- wip_active = true;
- edited_point_pos = cpoint;
- edited_outline = -1;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
return true;
} else {
- if (wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_treshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint);
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
+ wip.push_back(cpoint);
+ edited_point = wip.size();
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
- //add wip point
- }
+ //add wip point
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && wip_active) {
- _wip_close();
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close();
+ }
- } break;
+ } break;
- case MODE_EDIT: {
+ case MODE_EDIT: {
- if (mb.button_index == BUTTON_LEFT) {
- if (mb.pressed) {
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- if (mb.mod.control) {
+ if (mb->get_control()) {
- //search edges
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
+ //search edges
+ int closest_outline = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
+ for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
+ PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
+ int pc = points.size();
+ PoolVector<Vector2>::Read poly = points.read();
- for (int i = 0; i < pc; i++) {
+ for (int i = 0; i < pc; i++) {
- Vector2 points[2] = { xform.xform(poly[i]),
- xform.xform(poly[(i + 1) % pc]) };
+ Vector2 points[2] = { xform.xform(poly[i]),
+ xform.xform(poly[(i + 1) % pc]) };
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
+ if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
+ continue; //not valid to reuse point
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_outline = j;
- closest_pos = cp;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_outline = j;
+ closest_pos = cp;
+ closest_idx = i;
}
}
+ }
- if (closest_idx >= 0) {
-
- pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
- PoolVector<Point2> poly = pre_move_edit;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
- edited_point = closest_idx + 1;
- edited_outline = closest_outline;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->get_navigation_polygon()->set_outline(closest_outline, poly);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
+ if (closest_idx >= 0) {
+
+ pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
+ PoolVector<Point2> poly = pre_move_edit;
+ poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
+ edited_point = closest_idx + 1;
+ edited_outline = closest_outline;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ node->get_navigation_polygon()->set_outline(closest_outline, poly);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+ }
+ } else {
- //look for points to move
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
+ //look for points to move
+ int closest_outline = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
+ for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
+ PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
+ int pc = points.size();
+ PoolVector<Vector2>::Read poly = points.read();
- for (int i = 0; i < pc; i++) {
+ for (int i = 0; i < pc; i++) {
- Vector2 cp = xform.xform(poly[i]);
+ Vector2 cp = xform.xform(poly[i]);
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_outline = j;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_outline = j;
+ closest_idx = i;
}
}
+ }
- if (closest_idx >= 0) {
+ if (closest_idx >= 0) {
- pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
- edited_point = closest_idx;
- edited_outline = closest_outline;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
+ pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
+ edited_point = closest_idx;
+ edited_outline = closest_outline;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
- } else {
+ }
+ } else {
- if (edited_point != -1) {
+ if (edited_point != -1) {
- //apply
+ //apply
- PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline);
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly.set(edited_point, edited_point_pos);
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, poly);
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, pre_move_edit);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(edited_outline);
+ ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
+ poly.set(edited_point, edited_point_pos);
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, poly);
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", edited_outline, pre_move_edit);
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- edited_point = -1;
- return true;
- }
+ edited_point = -1;
+ return true;
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && edited_point == -1) {
+ }
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
- int closest_outline = -1;
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
+ int closest_outline = -1;
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
- for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
+ for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {
- PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
+ PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);
- int pc = points.size();
- PoolVector<Vector2>::Read poly = points.read();
+ int pc = points.size();
+ PoolVector<Vector2>::Read poly = points.read();
- for (int i = 0; i < pc; i++) {
+ for (int i = 0; i < pc; i++) {
- Vector2 cp = xform.xform(poly[i]);
+ Vector2 cp = xform.xform(poly[i]);
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_outline = j;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_outline = j;
+ closest_idx = i;
}
}
+ }
- if (closest_idx >= 0) {
-
- PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline);
-
- if (poly.size() > 3) {
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- } else {
-
- undo_redo->create_action(TTR("Remove Poly And Point"));
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "add_outline_at_index", poly, closest_outline);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "remove_outline", closest_outline);
- undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- }
- return true;
+ if (closest_idx >= 0) {
+
+ PoolVector<Vector2> poly = node->get_navigation_polygon()->get_outline(closest_outline);
+
+ if (poly.size() > 3) {
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "set_outline", closest_outline, poly);
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ } else {
+
+ undo_redo->create_action(TTR("Remove Poly And Point"));
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "add_outline_at_index", poly, closest_outline);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "remove_outline", closest_outline);
+ undo_redo->add_do_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_undo_method(node->get_navigation_polygon().ptr(), "make_polygons_from_outlines");
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
}
+ return true;
}
+ }
- } break;
- }
-
- } break;
- case InputEvent::MOUSE_MOTION: {
+ } break;
+ }
+ }
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ Ref<InputEventMouseMotion> mm = p_event;
- if (edited_point != -1 && (wip_active || mm.button_mask & BUTTON_MASK_LEFT)) {
+ if (mm.is_valid()) {
- Vector2 gpoint = Point2(mm.x, mm.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+ if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
- canvas_item_editor->get_viewport_control()->update();
- }
+ Vector2 gpoint = mm->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
- } break;
+ canvas_item_editor->get_viewport_control()->update();
+ }
}
return false;
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 6de77b5ef3..62a83983fd 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -85,7 +85,7 @@ protected:
static void _bind_methods();
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
NavigationPolygonEditor(EditorNode *p_editor);
};
@@ -98,7 +98,7 @@ class NavigationPolygonEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "NavigationPolygonInstance"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 35743ce0b3..c6c85d8be2 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -64,17 +64,18 @@ void Particles2DEditorPlugin::_file_selected(const String &p_file) {
int epc = epoints->get_value();
- Image img;
- Error err = ImageLoader::load_image(p_file, &img);
+ Ref<Image> img;
+ img.instance();
+ Error err = ImageLoader::load_image(p_file, img);
ERR_EXPLAIN(TTR("Error loading image:") + " " + p_file);
ERR_FAIL_COND(err != OK);
- img.convert(Image::FORMAT_LA8);
- ERR_FAIL_COND(img.get_format() != Image::FORMAT_LA8);
- Size2i s = Size2(img.get_width(), img.get_height());
+ img->convert(Image::FORMAT_LA8);
+ ERR_FAIL_COND(img->get_format() != Image::FORMAT_LA8);
+ Size2i s = Size2(img->get_width(), img->get_height());
ERR_FAIL_COND(s.width == 0 || s.height == 0);
- PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t> data = img->get_data();
PoolVector<uint8_t>::Read r = data.read();
Vector<Point2i> valid_positions;
@@ -98,7 +99,7 @@ void Particles2DEditorPlugin::_file_selected(const String &p_file) {
epoints.resize(epc);
PoolVector<Point2>::Write w = epoints.write();
- Size2 extents = Size2(img.get_width() * 0.5, img.get_height() * 0.5);
+ Size2 extents = Size2(img->get_width() * 0.5, img->get_height() * 0.5);
for (int i = 0; i < epc; i++) {
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 4c84e831c1..dc2da80b06 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -329,7 +329,7 @@ void ParticlesEditor::_generate_emission_points() {
copymem(iw.ptr(), r.ptr(), point_count * sizeof(float) * 3);
}
- Image image(w, h, false, Image::FORMAT_RGBF, point_img);
+ Ref<Image> image = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img));
Ref<ImageTexture> tex;
tex.instance();
@@ -354,7 +354,7 @@ void ParticlesEditor::_generate_emission_points() {
copymem(iw.ptr(), r.ptr(), point_count * sizeof(float) * 3);
}
- Image image2(w, h, false, Image::FORMAT_RGBF, point_img2);
+ Ref<Image> image2 = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img2));
Ref<ImageTexture> tex2;
tex2.instance();
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index e00111b565..f8d250334c 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -58,8 +58,7 @@ void Path2DEditor::_node_removed(Node *p_node) {
}
}
-bool Path2DEditor::forward_gui_input(const InputEvent &p_event) {
-
+bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node)
return false;
@@ -69,70 +68,52 @@ bool Path2DEditor::forward_gui_input(const InputEvent &p_event) {
if (!node->get_curve().is_valid())
return false;
- switch (p_event.type) {
-
- case InputEvent::MOUSE_BUTTON: {
-
- const InputEventMouseButton &mb = p_event.mouse_button;
-
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Ref<InputEventMouseButton> mb = p_event;
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = !mb.mod.alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
+ if (mb.is_valid()) {
- //first check if a point is to be added (segment split)
- real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- // Test move point!!
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint =
+ !mb->get_alt() ?
+ canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) :
+ node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
- if (mb.pressed && action == ACTION_NONE) {
+ real_t grab_threshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
- Ref<Curve2D> curve = node->get_curve();
+ if (mb->is_pressed() && action == ACTION_NONE) {
- for (int i = 0; i < curve->get_point_count(); i++) {
+ Ref<Curve2D> curve = node->get_curve();
- bool pointunder = false;
+ for (int i = 0; i < curve->get_point_count(); i++) {
- {
- Point2 p = xform.xform(curve->get_point_pos(i));
- if (gpoint.distance_to(p) < grab_treshold) {
+ real_t dist_to_p = gpoint.distance_to(xform.xform(curve->get_point_pos(i)));
+ real_t dist_to_p_out = gpoint.distance_to(xform.xform(curve->get_point_pos(i) + curve->get_point_out(i)));
+ real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_pos(i) + curve->get_point_in(i)));
- if (mb.button_index == BUTTON_LEFT && !mb.mod.shift && mode == MODE_EDIT) {
+ // Check for point movement start (for point + in/out controls).
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (!mb->get_shift() && mode == MODE_EDIT) {
+ // Point can only be moved in edit mode.
+ if (dist_to_p < grab_threshold) {
- action = ACTION_MOVING_POINT;
- action_point = i;
- moving_from = curve->get_point_pos(i);
- moving_screen_from = gpoint;
- return true;
- } else if ((mb.button_index == BUTTON_RIGHT && mode == MODE_EDIT) || (mb.button_index == BUTTON_LEFT && mode == MODE_DELETE)) {
-
- undo_redo->create_action(TTR("Remove Point from Curve"));
- undo_redo->add_do_method(curve.ptr(), "remove_point", i);
- undo_redo->add_undo_method(curve.ptr(), "add_point", curve->get_point_pos(i), curve->get_point_in(i), curve->get_point_out(i), i);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- } else
- pointunder = true;
+ action = ACTION_MOVING_POINT;
+ action_point = i;
+ moving_from = curve->get_point_pos(i);
+ moving_screen_from = gpoint;
+ return true;
}
- }
-
- if (mb.button_index == BUTTON_LEFT && i < (curve->get_point_count() - 1)) {
- Point2 p = xform.xform(curve->get_point_pos(i) + curve->get_point_out(i));
- if (gpoint.distance_to(p) < grab_treshold && (mode == MODE_EDIT || mode == MODE_EDIT_CURVE)) {
+ } else if (mode == MODE_EDIT || mode == MODE_EDIT_CURVE) {
+ // In/out controls can be moved in multiple modes.
+ if (dist_to_p_out < grab_threshold && i < (curve->get_point_count() - 1)) {
action = ACTION_MOVING_OUT;
action_point = i;
moving_from = curve->get_point_out(i);
moving_screen_from = gpoint;
return true;
- }
- }
-
- if (mb.button_index == BUTTON_LEFT && i > 0) {
- Point2 p = xform.xform(curve->get_point_pos(i) + curve->get_point_in(i));
- if (gpoint.distance_to(p) < grab_treshold && (mode == MODE_EDIT || mode == MODE_EDIT_CURVE)) {
+ } else if (dist_to_p_in < grab_threshold && i > 0) {
action = ACTION_MOVING_IN;
action_point = i;
@@ -141,314 +122,362 @@ bool Path2DEditor::forward_gui_input(const InputEvent &p_event) {
return true;
}
}
+ }
+
+ // Check for point deletion.
+ if ((mb->get_button_index() == BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == BUTTON_LEFT && mode == MODE_DELETE)) {
+ if (dist_to_p < grab_threshold) {
- if (pointunder)
+ undo_redo->create_action(TTR("Remove Point from Curve"));
+ undo_redo->add_do_method(curve.ptr(), "remove_point", i);
+ undo_redo->add_undo_method(curve.ptr(), "add_point", curve->get_point_pos(i), curve->get_point_in(i), curve->get_point_out(i), i);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
return true;
+ } else if (dist_to_p_out < grab_threshold) {
+
+ undo_redo->create_action(TTR("Remove Out-Control from Curve"));
+ undo_redo->add_do_method(curve.ptr(), "set_point_out", i, Vector2());
+ undo_redo->add_undo_method(curve.ptr(), "set_point_out", i, curve->get_point_out(i));
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ } else if (dist_to_p_in < grab_threshold) {
+
+ undo_redo->create_action(TTR("Remove In-Control from Curve"));
+ undo_redo->add_do_method(curve.ptr(), "set_point_in", i, Vector2());
+ undo_redo->add_undo_method(curve.ptr(), "set_point_in", i, curve->get_point_in(i));
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
}
}
+ }
- // Test add point in empty space!
+ // Check for point creation.
+ if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
- if (mb.pressed && mb.button_index == BUTTON_LEFT && ((mb.mod.command && mode == MODE_EDIT) || mode == MODE_CREATE)) {
+ Ref<Curve2D> curve = node->get_curve();
- Ref<Curve2D> curve = node->get_curve();
+ undo_redo->create_action(TTR("Add Point to Curve"));
+ undo_redo->add_do_method(curve.ptr(), "add_point", cpoint);
+ undo_redo->add_undo_method(curve.ptr(), "remove_point", curve->get_point_count());
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- undo_redo->create_action(TTR("Add Point to Curve"));
- undo_redo->add_do_method(curve.ptr(), "add_point", cpoint);
- undo_redo->add_undo_method(curve.ptr(), "remove_point", curve->get_point_count());
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ action = ACTION_MOVING_POINT;
+ action_point = curve->get_point_count() - 1;
+ moving_from = curve->get_point_pos(action_point);
+ moving_screen_from = gpoint;
- action = ACTION_MOVING_POINT;
- action_point = curve->get_point_count() - 1;
- moving_from = curve->get_point_pos(action_point);
- moving_screen_from = gpoint;
+ canvas_item_editor->get_viewport_control()->update();
- canvas_item_editor->get_viewport_control()->update();
+ return true;
+ }
- return true;
- }
+ // Check for point movement completion.
+ if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && action != ACTION_NONE) {
- if (!mb.pressed && mb.button_index == BUTTON_LEFT && action != ACTION_NONE) {
+ Ref<Curve2D> curve = node->get_curve();
- Ref<Curve2D> curve = node->get_curve();
+ Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
+ switch (action) {
- Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
- switch (action) {
+ case ACTION_NONE:
+ // N/A, handled in above condition.
+ break;
- case ACTION_MOVING_POINT: {
+ case ACTION_MOVING_POINT: {
- undo_redo->create_action(TTR("Move Point in Curve"));
- undo_redo->add_do_method(curve.ptr(), "set_point_pos", action_point, cpoint);
- undo_redo->add_undo_method(curve.ptr(), "set_point_pos", action_point, moving_from);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Move Point in Curve"));
+ undo_redo->add_do_method(curve.ptr(), "set_point_pos", action_point, cpoint);
+ undo_redo->add_undo_method(curve.ptr(), "set_point_pos", action_point, moving_from);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- } break;
- case ACTION_MOVING_IN: {
+ } break;
- undo_redo->create_action(TTR("Move In-Control in Curve"));
- undo_redo->add_do_method(curve.ptr(), "set_point_in", action_point, new_pos);
- undo_redo->add_undo_method(curve.ptr(), "set_point_in", action_point, moving_from);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ case ACTION_MOVING_IN: {
- } break;
- case ACTION_MOVING_OUT: {
+ undo_redo->create_action(TTR("Move In-Control in Curve"));
+ undo_redo->add_do_method(curve.ptr(), "set_point_in", action_point, new_pos);
+ undo_redo->add_undo_method(curve.ptr(), "set_point_in", action_point, moving_from);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- undo_redo->create_action(TTR("Move Out-Control in Curve"));
- undo_redo->add_do_method(curve.ptr(), "set_point_out", action_point, new_pos);
- undo_redo->add_undo_method(curve.ptr(), "set_point_out", action_point, moving_from);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ } break;
- } break;
- }
+ case ACTION_MOVING_OUT: {
- action = ACTION_NONE;
+ undo_redo->create_action(TTR("Move Out-Control in Curve"));
+ undo_redo->add_do_method(curve.ptr(), "set_point_out", action_point, new_pos);
+ undo_redo->add_undo_method(curve.ptr(), "set_point_out", action_point, moving_from);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
- return true;
+ } break;
}
+ action = ACTION_NONE;
+
+ return true;
+ }
+
#if 0
- switch(mode) {
+ switch(mode) {
- case MODE_CREATE: {
+ case MODE_CREATE: {
- if (mb.button_index==BUTTON_LEFT && mb.pressed) {
+ if (mb->get_button_index()==BUTTON_LEFT && mb->is_pressed()) {
- if (!wip_active) {
+ if (!wip_active) {
- wip.clear();
- wip.push_back( canvas_item_editor->snap_point(cpoint) );
- wip_active=true;
- edited_point_pos=canvas_item_editor->snap_point(cpoint);
- canvas_item_editor->update();
- edited_point=1;
- return true;
- } else {
+ wip.clear();
+ wip.push_back( canvas_item_editor->snap_point(cpoint) );
+ wip_active=true;
+ edited_point_pos=canvas_item_editor->snap_point(cpoint);
+ canvas_item_editor->update();
+ edited_point=1;
+ return true;
+ } else {
+ if (wip.size()>1 && xform.xform(wip[0]).distance_to(gpoint)<grab_treshold) {
+ //wip closed
+ _wip_close();
- if (wip.size()>1 && xform.xform(wip[0]).distance_to(gpoint)<grab_treshold) {
- //wip closed
- _wip_close();
- return true;
- } else {
+ return true;
+ } else {
- wip.push_back( canvas_item_editor->snap_point(cpoint) );
- edited_point=wip.size();
- canvas_item_editor->update();
- return true;
+ wip.push_back( canvas_item_editor->snap_point(cpoint) );
+ edited_point=wip.size();
+ canvas_item_editor->update();
+ return true;
- //add wip point
- }
+ //add wip point
}
- } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && wip_active) {
- _wip_close();
}
+ } else if (mb->get_button_index()==BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close();
+ }
+ } break;
+ case MODE_EDIT: {
- } break;
-
- case MODE_EDIT: {
-
- if (mb.button_index==BUTTON_LEFT) {
- if (mb.pressed) {
-
- if (mb.mod.control) {
-
+ if (mb->get_button_index()==BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- if (poly.size() < 3) {
+ if (mb->get_control()) {
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node,"set_polygon",poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node,"set_polygon",poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->commit_action();
- return true;
- }
- //search edges
- int closest_idx=-1;
- Vector2 closest_pos;
- real_t closest_dist=1e10;
- for(int i=0;i<poly.size();i++) {
+ if (poly.size() < 3) {
- Vector2 points[2] ={ xform.xform(poly[i]),
- xform.xform(poly[(i+1)%poly.size()]) };
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_undo_method(node,"set_polygon",poly);
+ poly.push_back(cpoint);
+ undo_redo->add_do_method(node,"set_polygon",poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->commit_action();
+ return true;
+ }
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint,points);
- if (cp.distance_squared_to(points[0])<CMP_EPSILON2 || cp.distance_squared_to(points[1])<CMP_EPSILON2)
- continue; //not valid to reuse point
+ //search edges
+ int closest_idx=-1;
+ Vector2 closest_pos;
+ real_t closest_dist=1e10;
+ for(int i=0;i<poly.size();i++) {
- real_t d = cp.distance_to(gpoint);
- if (d<closest_dist && d<grab_treshold) {
+ if (d<closest_dist && d<grab_threshold) {
closest_dist=d;
closest_pos=cp;
closest_idx=i;
}
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint,points);
+ if (cp.distance_squared_to(points[0])<CMP_EPSILON2 || cp.distance_squared_to(points[1])<CMP_EPSILON2)
+ continue; //not valid to reuse point
+ real_t d = cp.distance_to(gpoint);
+ if (d<closest_dist && d<grab_treshold) {
+ closest_dist=d;
+ closest_pos=cp;
+ closest_idx=i;
}
- if (closest_idx>=0) {
- pre_move_edit=poly;
- poly.insert(closest_idx+1,canvas_item_editor->snap_point(xform.affine_inverse().xform(closest_pos)));
- edited_point=closest_idx+1;
- edited_point_pos=canvas_item_editor->snap_point(xform.affine_inverse().xform(closest_pos));
- node->set_polygon(poly);
- canvas_item_editor->update();
- return true;
- }
- } else {
-
- //look for points to move
+ }
- int closest_idx=-1;
- Vector2 closest_pos;
- real_t closest_dist=1e10;
- for(int i=0;i<poly.size();i++) {
+ if (closest_idx>=0) {
- Vector2 cp =xform.xform(poly[i]);
+ pre_move_edit=poly;
+ poly.insert(closest_idx+1,canvas_item_editor->snap_point(xform.affine_inverse().xform(closest_pos)));
+ edited_point=closest_idx+1;
+ edited_point_pos=canvas_item_editor->snap_point(xform.affine_inverse().xform(closest_pos));
+ node->set_polygon(poly);
+ canvas_item_editor->update();
+ return true;
+ }
+ } else {
real_t d = cp.distance_to(gpoint);
- if (d<closest_dist && d<grab_treshold) {
+ if (d<closest_dist && d<grab_threshold) {
closest_dist=d;
closest_pos=cp;
closest_idx=i;
}
- }
+ int closest_idx=-1;
+ Vector2 closest_pos;
+ real_t closest_dist=1e10;
+ for(int i=0;i<poly.size();i++) {
- if (closest_idx>=0) {
+ Vector2 cp =xform.xform(poly[i]);
- pre_move_edit=poly;
- edited_point=closest_idx;
- edited_point_pos=xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->update();
- return true;
+ real_t d = cp.distance_to(gpoint);
+ if (d<closest_dist && d<grab_treshold) {
+ closest_dist=d;
+ closest_pos=cp;
+ closest_idx=i;
}
- }
- } else {
- if (edited_point!=-1) {
+ }
- //apply
+ if (closest_idx>=0) {
- ERR_FAIL_INDEX_V(edited_point,poly.size(),false);
- poly[edited_point]=edited_point_pos;
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node,"set_polygon",poly);
- undo_redo->add_undo_method(node,"set_polygon",pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->commit_action();
-
- edited_point=-1;
+ pre_move_edit=poly;
+ edited_point=closest_idx;
+ edited_point_pos=xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->update();
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } else {
+ if (edited_point!=-1) {
+ //apply
- int closest_idx=-1;
- Vector2 closest_pos;
- real_t closest_dist=1e10;
- for(int i=0;i<poly.size();i++) {
+ ERR_FAIL_INDEX_V(edited_point,poly.size(),false);
+ poly[edited_point]=edited_point_pos;
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_do_method(node,"set_polygon",poly);
+ undo_redo->add_undo_method(node,"set_polygon",pre_move_edit);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->commit_action();
- Vector2 cp =xform.xform(poly[i]);
+ edited_point=-1;
+ return true;
+ }
+ }
+ } if (mb->get_button_index()==BUTTON_RIGHT && mb->is_pressed() && edited_point==-1) {
real_t d = cp.distance_to(gpoint);
- if (d<closest_dist && d<grab_treshold) {
+ if (d<closest_dist && d<grab_threshold) {
closest_dist=d;
closest_pos=cp;
closest_idx=i;
}
- }
+ int closest_idx=-1;
+ Vector2 closest_pos;
+ real_t closest_dist=1e10;
+ for(int i=0;i<poly.size();i++) {
- if (closest_idx>=0) {
+ Vector2 cp =xform.xform(poly[i]);
-
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node,"set_polygon",poly);
- poly.remove(closest_idx);
- undo_redo->add_do_method(node,"set_polygon",poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
- undo_redo->commit_action();
- return true;
+ real_t d = cp.distance_to(gpoint);
+ if (d<closest_dist && d<grab_treshold) {
+ closest_dist=d;
+ closest_pos=cp;
+ closest_idx=i;
}
}
+ if (closest_idx>=0) {
- } break;
- }
-
-#endif
- } break;
- case InputEvent::MOUSE_MOTION: {
-
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ undo_redo->add_undo_method(node,"set_polygon",poly);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node,"set_polygon",poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(),"update");
+ undo_redo->commit_action();
+ return true;
+ }
- if (action != ACTION_NONE) {
+ }
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Vector2 gpoint = Point2(mm.x, mm.y);
- Vector2 cpoint = !mm.mod.alt ? canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) : node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
+ } break;
+ }
+#endif
+ }
- Ref<Curve2D> curve = node->get_curve();
+ Ref<InputEventMouseMotion> mm = p_event;
- Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
+ if (mm.is_valid()) {
- switch (action) {
+ if (action != ACTION_NONE) {
+ // Handle point/control movement.
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Vector2 gpoint = mm->get_pos();
+ Vector2 cpoint =
+ !mm->get_alt() ?
+ canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) :
+ node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
- case ACTION_MOVING_POINT: {
+ Ref<Curve2D> curve = node->get_curve();
- curve->set_point_pos(action_point, cpoint);
- } break;
- case ACTION_MOVING_IN: {
+ Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
- curve->set_point_in(action_point, new_pos);
+ switch (action) {
- } break;
- case ACTION_MOVING_OUT: {
+ case ACTION_NONE:
+ // N/A, handled in above condition.
+ break;
- curve->set_point_out(action_point, new_pos);
+ case ACTION_MOVING_POINT: {
+ curve->set_point_pos(action_point, cpoint);
+ } break;
- } break;
- }
+ case ACTION_MOVING_IN: {
+ curve->set_point_in(action_point, new_pos);
+ } break;
- canvas_item_editor->get_viewport_control()->update();
- return true;
+ case ACTION_MOVING_OUT: {
+ curve->set_point_out(action_point, new_pos);
+ } break;
}
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
+ }
+
#if 0
- if (edited_point!=-1 && (wip_active || mm.button_mask&BUTTON_MASK_LEFT)) {
+ if (edited_point!=-1 && (wip_active || mm->get_button_mask()&BUTTON_MASK_LEFT)) {
- Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Vector2 gpoint = Point2(mm.x,mm.y);
- edited_point_pos = canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint));
- canvas_item_editor->update();
+ Vector2 gpoint = Point2(mm.x,mm.y);
+ edited_point_pos = canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint));
+ canvas_item_editor->update();
- }
+ }
#endif
- } break;
}
return false;
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 67c6f3c8cb..70911444ad 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -95,7 +95,7 @@ protected:
static void _bind_methods();
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_path2d);
Path2DEditor(EditorNode *p_editor);
};
@@ -108,7 +108,7 @@ class Path2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return path2d_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return path2d_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp
index 9c95cee388..12b6dce798 100644
--- a/editor/plugins/path_editor_plugin.cpp
+++ b/editor/plugins/path_editor_plugin.cpp
@@ -303,9 +303,9 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEve
if (p_event.type==InputEvent::MOUSE_BUTTON) {
const InputEventMouseButton &mb=p_event.mouse_button;
- Point2 mbpos(mb.x,mb.y);
+ Point2 mbpos(mb->get_pos().x,mb->get_pos().y);
- if (mb.pressed && mb.button_index==BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb.mod.control))) {
+ if (mb->is_pressed() && mb->get_button_index()==BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
//click into curve, break it down
Vector3Array v3a = c->tesselate();
int idx=0;
@@ -405,26 +405,40 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera* p_camera,const InputEve
//add new at pos
}
- } else if (mb.pressed && ((mb.button_index==BUTTON_LEFT && curve_del->is_pressed()) || (mb.button_index==BUTTON_RIGHT && curve_edit->is_pressed()))) {
+ } else if (mb->is_pressed() && ((mb->get_button_index()==BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index()==BUTTON_RIGHT && curve_edit->is_pressed()))) {
- int erase_idx=-1;
for(int i=0;i<c->get_point_count();i++) {
- //find the offset and point index of the place to break up
- if (p_camera->unproject_position(gt.xform(c->get_point_pos(i))).distance_to(mbpos)<click_dist) {
-
- erase_idx=i;
- break;
- }
- }
+ real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_pos(i))).distance_to(mbpos);
+ real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_out(i))).distance_to(mbpos);
+ real_t dist_to_p_in = p_camera->unproject_position(gt.xform(c->get_point_pos(i) + c->get_point_in(i))).distance_to(mbpos);
+
+ // Find the offset and point index of the place to break up.
+ // Also check for the control points.
+ if (dist_to_p < click_dist) {
+
+ UndoRedo *ur = editor->get_undo_redo();
+ ur->create_action(TTR("Remove Path Point"));
+ ur->add_do_method(c.ptr(),"remove_point",i);
+ ur->add_undo_method(c.ptr(),"add_point",c->get_point_pos(i),c->get_point_in(i),c->get_point_out(i),i);
+ ur->commit_action();
+ return true;
+ } else if (dist_to_p_out < click_dist) {
- if (erase_idx!=-1) {
+ UndoRedo *ur = editor->get_undo_redo();
+ ur->create_action(TTR("Remove Out-Control Point"));
+ ur->add_do_method(c.ptr(),"set_point_out",i,Vector3());
+ ur->add_undo_method(c.ptr(),"set_point_out",i,c->get_point_out(i));
+ ur->commit_action();
+ return true;
+ } else if (dist_to_p_in < click_dist) {
- UndoRedo *ur = editor->get_undo_redo();
- ur->create_action(TTR("Remove Path Point"));
- ur->add_do_method(c.ptr(),"remove_point",erase_idx);
- ur->add_undo_method(c.ptr(),"add_point",c->get_point_pos(erase_idx),c->get_point_in(erase_idx),c->get_point_out(erase_idx),erase_idx);
- ur->commit_action();
- return true;
+ UndoRedo *ur = editor->get_undo_redo();
+ ur->create_action(TTR("Remove In-Control Point"));
+ ur->add_do_method(c.ptr(),"set_point_in",i,Vector3());
+ ur->add_undo_method(c.ptr(),"set_point_in",i,c->get_point_in(i));
+ ur->commit_action();
+ return true;
+ }
}
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 896a26c8e8..c2edc608ab 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -201,213 +201,209 @@ void Polygon2DEditor::_wip_close() {
edited_point = -1;
}
-bool Polygon2DEditor::forward_gui_input(const InputEvent &p_event) {
+bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (node == NULL)
return false;
- switch (p_event.type) {
+ Ref<InputEventMouseButton> mb = p_event;
- case InputEvent::MOUSE_BUTTON: {
+ if (mb.is_valid()) {
- const InputEventMouseButton &mb = p_event.mouse_button;
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
- Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
+ Vector2 gpoint = mb->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
- Vector2 gpoint = Point2(mb.x, mb.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
+ Vector<Vector2> poly = Variant(node->get_polygon());
- Vector<Vector2> poly = Variant(node->get_polygon());
+ //first check if a point is to be added (segment split)
+ real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
- //first check if a point is to be added (segment split)
- real_t grab_treshold = EDITOR_DEF("editors/poly_editor/point_grab_radius", 8);
+ switch (mode) {
- switch (mode) {
+ case MODE_CREATE: {
- case MODE_CREATE: {
+ if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
- if (mb.button_index == BUTTON_LEFT && mb.pressed) {
+ if (!wip_active) {
- if (!wip_active) {
+ wip.clear();
+ wip.push_back(cpoint - node->get_offset());
+ wip_active = true;
+ edited_point_pos = cpoint;
+ canvas_item_editor->get_viewport_control()->update();
+ edited_point = 1;
+ return true;
+ } else {
+
+ if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_treshold) {
+ //wip closed
+ _wip_close();
- wip.clear();
- wip.push_back(cpoint - node->get_offset());
- wip_active = true;
- edited_point_pos = cpoint;
- canvas_item_editor->get_viewport_control()->update();
- edited_point = 1;
return true;
} else {
- if (wip.size() > 1 && xform.xform(wip[0] + node->get_offset()).distance_to(gpoint) < grab_treshold) {
- //wip closed
- _wip_close();
-
- return true;
- } else {
-
- wip.push_back(cpoint - node->get_offset());
- edited_point = wip.size();
- canvas_item_editor->get_viewport_control()->update();
- return true;
+ wip.push_back(cpoint - node->get_offset());
+ edited_point = wip.size();
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
- //add wip point
- }
+ //add wip point
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && wip_active) {
- _wip_close();
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+ _wip_close();
+ }
- } break;
-
- case MODE_EDIT: {
-
- if (mb.button_index == BUTTON_LEFT) {
- if (mb.pressed) {
-
- if (mb.mod.control) {
+ } break;
- if (poly.size() < 3) {
+ case MODE_EDIT: {
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.push_back(cpoint);
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
- return true;
- }
+ if (mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed()) {
- //search edges
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
-
- Vector2 points[2] = { xform.xform(poly[i] + node->get_offset()),
- xform.xform(poly[(i + 1) % poly.size()] + node->get_offset()) };
-
- Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
- if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
- continue; //not valid to reuse point
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
- }
+ if (mb->get_control()) {
- if (closest_idx >= 0) {
+ if (poly.size() < 3) {
- pre_move_edit = poly;
- poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos) - node->get_offset());
- edited_point = closest_idx + 1;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- node->set_polygon(Variant(poly));
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
- } else {
+ undo_redo->create_action(TTR("Edit Poly"));
+ undo_redo->add_undo_method(node, "set_polygon", poly);
+ poly.push_back(cpoint);
+ undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
- //look for points to move
+ //search edges
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
+ Vector2 points[2] = { xform.xform(poly[i] + node->get_offset()),
+ xform.xform(poly[(i + 1) % poly.size()] + node->get_offset()) };
- Vector2 cp = xform.xform(poly[i] + node->get_offset());
+ Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
+ if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
+ continue; //not valid to reuse point
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
- }
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
}
+ }
- if (closest_idx >= 0) {
+ if (closest_idx >= 0) {
- pre_move_edit = poly;
- edited_point = closest_idx;
- edited_point_pos = xform.affine_inverse().xform(closest_pos);
- canvas_item_editor->get_viewport_control()->update();
- return true;
- }
+ pre_move_edit = poly;
+ poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos) - node->get_offset());
+ edited_point = closest_idx + 1;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ node->set_polygon(Variant(poly));
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
} else {
- if (edited_point != -1) {
+ //look for points to move
- //apply
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
- poly[edited_point] = edited_point_pos - node->get_offset();
- undo_redo->create_action(TTR("Edit Poly"));
- undo_redo->add_do_method(node, "set_polygon", poly);
- undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
- undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
- undo_redo->commit_action();
+ Vector2 cp = xform.xform(poly[i] + node->get_offset());
- edited_point = -1;
- return true;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
}
- }
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed && edited_point == -1) {
- int closest_idx = -1;
- Vector2 closest_pos;
- real_t closest_dist = 1e10;
- for (int i = 0; i < poly.size(); i++) {
+ if (closest_idx >= 0) {
- Vector2 cp = xform.xform(poly[i] + node->get_offset());
-
- real_t d = cp.distance_to(gpoint);
- if (d < closest_dist && d < grab_treshold) {
- closest_dist = d;
- closest_pos = cp;
- closest_idx = i;
+ pre_move_edit = poly;
+ edited_point = closest_idx;
+ edited_point_pos = xform.affine_inverse().xform(closest_pos);
+ canvas_item_editor->get_viewport_control()->update();
+ return true;
}
}
+ } else {
+
+ if (edited_point != -1) {
- if (closest_idx >= 0) {
+ //apply
- undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
- undo_redo->add_undo_method(node, "set_polygon", poly);
- poly.remove(closest_idx);
+ ERR_FAIL_INDEX_V(edited_point, poly.size(), false);
+ poly[edited_point] = edited_point_pos - node->get_offset();
+ undo_redo->create_action(TTR("Edit Poly"));
undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_undo_method(node, "set_polygon", pre_move_edit);
undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
undo_redo->commit_action();
+
+ edited_point = -1;
return true;
}
}
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
- } break;
- }
+ int closest_idx = -1;
+ Vector2 closest_pos;
+ real_t closest_dist = 1e10;
+ for (int i = 0; i < poly.size(); i++) {
- } break;
- case InputEvent::MOUSE_MOTION: {
+ Vector2 cp = xform.xform(poly[i] + node->get_offset());
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ real_t d = cp.distance_to(gpoint);
+ if (d < closest_dist && d < grab_treshold) {
+ closest_dist = d;
+ closest_pos = cp;
+ closest_idx = i;
+ }
+ }
- if (edited_point != -1 && (wip_active || mm.button_mask & BUTTON_MASK_LEFT)) {
+ if (closest_idx >= 0) {
- Vector2 gpoint = Point2(mm.x, mm.y);
- Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
- cpoint = canvas_item_editor->snap_point(cpoint);
- edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+ undo_redo->create_action(TTR("Edit Poly (Remove Point)"));
+ undo_redo->add_undo_method(node, "set_polygon", poly);
+ poly.remove(closest_idx);
+ undo_redo->add_do_method(node, "set_polygon", poly);
+ undo_redo->add_do_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->add_undo_method(canvas_item_editor->get_viewport_control(), "update");
+ undo_redo->commit_action();
+ return true;
+ }
+ }
- canvas_item_editor->get_viewport_control()->update();
- }
+ } break;
+ }
+ }
- } break;
+ Ref<InputEventMouseMotion> mm = p_event;
+
+ if (mm.is_valid()) {
+
+ if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
+
+ Vector2 gpoint = mm->get_pos();
+ Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+ cpoint = canvas_item_editor->snap_point(cpoint);
+ edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+
+ canvas_item_editor->get_viewport_control()->update();
+ }
}
return false;
@@ -455,31 +451,31 @@ void Polygon2DEditor::_uv_mode(int p_mode) {
}
}
-void Polygon2DEditor::_uv_input(const InputEvent &p_input) {
+void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
Transform2D mtx;
mtx.elements[2] = -uv_draw_ofs;
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
- if (p_input.type == InputEvent::MOUSE_BUTTON) {
+ Ref<InputEventMouseButton> mb = p_input;
- const InputEventMouseButton &mb = p_input.mouse_button;
+ if (mb.is_valid()) {
- if (mb.button_index == BUTTON_LEFT) {
+ if (mb->get_button_index() == BUTTON_LEFT) {
- if (mb.pressed) {
+ if (mb->is_pressed()) {
- uv_drag_from = Vector2(mb.x, mb.y);
+ uv_drag_from = Vector2(mb->get_pos().x, mb->get_pos().y);
uv_drag = true;
uv_prev = node->get_uv();
uv_move_current = uv_mode;
if (uv_move_current == UV_MODE_EDIT_POINT) {
- if (mb.mod.shift && mb.mod.command)
+ if (mb->get_shift() && mb->get_command())
uv_move_current = UV_MODE_SCALE;
- else if (mb.mod.shift)
+ else if (mb->get_shift())
uv_move_current = UV_MODE_MOVE;
- else if (mb.mod.command)
+ else if (mb->get_command())
uv_move_current = UV_MODE_ROTATE;
}
@@ -489,7 +485,7 @@ void Polygon2DEditor::_uv_input(const InputEvent &p_input) {
for (int i = 0; i < uv_prev.size(); i++) {
Vector2 tuv = mtx.xform(uv_prev[i]);
- if (tuv.distance_to(Vector2(mb.x, mb.y)) < 8) {
+ if (tuv.distance_to(Vector2(mb->get_pos().x, mb->get_pos().y)) < 8) {
uv_drag_from = tuv;
uv_drag_index = i;
}
@@ -511,7 +507,7 @@ void Polygon2DEditor::_uv_input(const InputEvent &p_input) {
uv_drag = false;
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed) {
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
if (uv_drag) {
@@ -520,27 +516,28 @@ void Polygon2DEditor::_uv_input(const InputEvent &p_input) {
uv_edit_draw->update();
}
- } else if (mb.button_index == BUTTON_WHEEL_UP && mb.pressed) {
+ } else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
- uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb.factor)));
- } else if (mb.button_index == BUTTON_WHEEL_DOWN && mb.pressed) {
+ uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb->get_factor())));
+ } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
- uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb.factor)));
+ uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb->get_factor())));
}
+ }
- } else if (p_input.type == InputEvent::MOUSE_MOTION) {
+ Ref<InputEventMouseMotion> mm = p_input;
- const InputEventMouseMotion &mm = p_input.mouse_motion;
+ if (mm.is_valid()) {
- if (mm.button_mask & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
+ if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- Vector2 drag(mm.relative_x, mm.relative_y);
+ Vector2 drag(mm->get_relative().x, mm->get_relative().y);
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);
} else if (uv_drag) {
- Vector2 uv_drag_to = snap_point(Vector2(mm.x, mm.y));
+ Vector2 uv_drag_to = mm->get_pos();
Vector2 drag = mtx.affine_inverse().xform(uv_drag_to) - mtx.affine_inverse().xform(uv_drag_from);
switch (uv_move_current) {
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 00926bf2d1..0901cc9082 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -113,7 +113,7 @@ class Polygon2DEditor : public HBoxContainer {
Vector2 snap_step;
void _uv_scroll_changed(float);
- void _uv_input(const InputEvent &p_input);
+ void _uv_input(const Ref<InputEvent> &p_input);
void _uv_draw();
void _uv_mode(int p_mode);
void _wip_close();
@@ -135,7 +135,7 @@ protected:
Vector2 snap_point(Vector2 p_target) const;
public:
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
Polygon2DEditor(EditorNode *p_editor);
};
@@ -148,7 +148,7 @@ class Polygon2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "Polygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 3b8d655af7..ea7a84d2f4 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -33,7 +33,7 @@
#include "global_config.h"
#include "io/resource_loader.h"
-void ResourcePreloaderEditor::_gui_input(InputEvent p_event) {
+void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
}
void ResourcePreloaderEditor::_notification(int p_what) {
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index fad3ba93f1..1f54620ba4 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -70,7 +70,7 @@ class ResourcePreloaderEditor : public PanelContainer {
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
public:
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index a5414325d0..d369064050 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -164,14 +164,16 @@ void ScriptEditorQuickOpen::_text_changed(const String &p_newtext) {
_update_search();
}
-void ScriptEditorQuickOpen::_sbox_input(const InputEvent &p_ie) {
+void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP ||
- p_ie.key.scancode == KEY_DOWN ||
- p_ie.key.scancode == KEY_PAGEUP ||
- p_ie.key.scancode == KEY_PAGEDOWN)) {
+ Ref<InputEventKey> k = p_ie;
- search_options->call("_gui_input", p_ie);
+ if (k.is_valid() && (k->get_scancode() == KEY_UP ||
+ k->get_scancode() == KEY_DOWN ||
+ k->get_scancode() == KEY_PAGEUP ||
+ k->get_scancode() == KEY_PAGEDOWN)) {
+
+ search_options->call("_gui_input", k);
search_box->accept_event();
}
}
@@ -1037,7 +1039,7 @@ void ScriptEditor::_notification(int p_what) {
EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");
help_search->set_icon(get_icon("Help", "EditorIcons"));
- site_search->set_icon(get_icon("Godot", "EditorIcons"));
+ site_search->set_icon(get_icon("GodotDocs", "EditorIcons"));
class_search->set_icon(get_icon("ClassList", "EditorIcons"));
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
@@ -1048,6 +1050,7 @@ void ScriptEditor::_notification(int p_what) {
get_tree()->connect("tree_changed", this, "_tree_changed");
editor->connect("request_help", this, "_request_help");
+ editor->connect("request_help_search", this, "_help_search");
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -1374,8 +1377,7 @@ void ScriptEditor::_update_script_colors() {
int non_zero_hist_size = (hist_size == 0) ? 1 : hist_size;
float v = Math::ease((edit_pass - pass) / float(non_zero_hist_size), 0.4);
- //script_list->set_item_custom_bg_color(i, hot_color.linear_interpolate(cold_color, v));
- script_list->set_item_custom_font_color(i, hot_color.linear_interpolate(cold_color, v));
+ script_list->set_item_custom_bg_color(i, hot_color.linear_interpolate(cold_color, v));
}
}
}
@@ -1778,8 +1780,8 @@ void ScriptEditor::_script_split_dragged(float) {
_save_layout();
}
-void ScriptEditor::_unhandled_input(const InputEvent &p_event) {
- if (p_event.key.pressed || !is_visible_in_tree()) return;
+void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
+ if (p_event->is_pressed() || !is_visible_in_tree()) return;
if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) {
int next_tab = script_list->get_current() + 1;
next_tab %= script_list->get_item_count();
@@ -2112,7 +2114,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_split->set_split_offset(140);
tab_container = memnew(TabContainer);
- tab_container->add_style_override("panel", p_editor->get_gui_base()->get_stylebox("EditorBG", "EditorStyles"));
+ tab_container->add_style_override("panel", p_editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
tab_container->set_tabs_visible(false);
script_split->add_child(tab_container);
@@ -2431,8 +2433,8 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("text_editor/open_scripts/script_temperature_enabled", true);
EDITOR_DEF("text_editor/open_scripts/highlight_current_script", true);
EDITOR_DEF("text_editor/open_scripts/script_temperature_history_size", 15);
- EDITOR_DEF("text_editor/open_scripts/script_temperature_hot_color", Color::html("ff5446"));
- EDITOR_DEF("text_editor/open_scripts/script_temperature_cold_color", Color::html("647b93"));
+ EDITOR_DEF("text_editor/open_scripts/script_temperature_hot_color", Color(1, 0, 0, 0.3));
+ EDITOR_DEF("text_editor/open_scripts/script_temperature_cold_color", Color(0, 0, 1, 0.3));
EDITOR_DEF("text_editor/open_scripts/current_script_background_color", Color(0.81, 0.81, 0.14, 0.63));
EDITOR_DEF("text_editor/open_scripts/group_help_pages", true);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/open_scripts/sort_scripts_by", PROPERTY_HINT_ENUM, "Name,Path"));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 983847ddaf..fb2f108277 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -54,7 +54,7 @@ class ScriptEditorQuickOpen : public ConfirmationDialog {
void _update_search();
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
Vector<String> functions;
void _confirmed();
@@ -288,7 +288,7 @@ class ScriptEditor : public VBoxContainer {
void _script_split_dragged(float);
- void _unhandled_input(const InputEvent &p_event);
+ void _unhandled_input(const Ref<InputEvent> &p_event);
void _help_search(String p_text);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 3bb1c7852b..2d3a14e525 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -124,7 +124,6 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_keyword_color("Transform", basetype_color);
text_edit->add_keyword_color("Color", basetype_color);
text_edit->add_keyword_color("Image", basetype_color);
- text_edit->add_keyword_color("InputEvent", basetype_color);
text_edit->add_keyword_color("Rect2", basetype_color);
text_edit->add_keyword_color("NodePath", basetype_color);
@@ -1227,15 +1226,18 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}
}
-void ScriptTextEditor::_text_edit_gui_input(const InputEvent &ev) {
- if (ev.type == InputEvent::MOUSE_BUTTON) {
- InputEventMouseButton mb = ev.mouse_button;
- if (mb.button_index == BUTTON_RIGHT && !mb.pressed) {
+void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
+
+ Ref<InputEventMouseButton> mb = ev;
+
+ if (mb.is_valid()) {
+
+ if (mb->get_button_index() == BUTTON_RIGHT && !mb->is_pressed()) {
int col, row;
TextEdit *tx = code_editor->get_text_edit();
- tx->_get_mouse_pos(Point2i(mb.global_x, mb.global_y) - tx->get_global_position(), row, col);
- Vector2 mpos = Vector2(mb.global_x, mb.global_y) - tx->get_global_position();
+ tx->_get_mouse_pos(mb->get_global_pos() - tx->get_global_position(), row, col);
+ Vector2 mpos = mb->get_global_pos() - tx->get_global_position();
bool have_selection = (tx->get_selection_text().length() > 0);
bool have_color = (tx->get_word_at_pos(mpos) == "Color");
if (have_color) {
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 77bce59f2e..fdae03949c 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -106,7 +106,7 @@ protected:
void _edit_option(int p_op);
void _make_context_menu(bool p_selection, bool p_color);
- void _text_edit_gui_input(const InputEvent &ev);
+ void _text_edit_gui_input(const Ref<InputEvent> &ev);
void _color_changed(const Color &p_color);
void _goto_line(int p_line) { goto_line(p_line); }
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
index 0fd28a0b59..9c65ef667a 100644
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/editor/plugins/shader_graph_editor_plugin.cpp
@@ -40,7 +40,7 @@
void GraphColorRampEdit::_gui_input(const InputEvent& p_event) {
- if (p_event.type==InputEvent::KEY && p_event.key.pressed && p_event.key.scancode==KEY_DELETE && grabbed!=-1) {
+ if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) {
points.remove(grabbed);
grabbed=-1;
@@ -49,10 +49,10 @@ void GraphColorRampEdit::_gui_input(const InputEvent& p_event) {
accept_event();
}
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1 && p_event.mouse_button.pressed) {
+ if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
update();
- int x = p_event.mouse_button.x;
+ int x = p_event->get_pos().x;
int total_w = get_size().width-get_size().height-3;
if (x>total_w+3) {
@@ -132,7 +132,7 @@ void GraphColorRampEdit::_gui_input(const InputEvent& p_event) {
}
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1 && !p_event.mouse_button.pressed) {
+ if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) {
if (grabbing) {
grabbing=false;
@@ -319,7 +319,7 @@ GraphColorRampEdit::GraphColorRampEdit(){
void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
- if (p_event.type==InputEvent::KEY && p_event.key.pressed && p_event.key.scancode==KEY_DELETE && grabbed!=-1) {
+ if (p_event.type==InputEvent::KEY && p_event->is_pressed() && p_event->get_scancode()==KEY_DELETE && grabbed!=-1) {
points.remove(grabbed);
grabbed=-1;
@@ -328,10 +328,10 @@ void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
accept_event();
}
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1 && p_event.mouse_button.pressed) {
+ if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && p_event->is_pressed()) {
update();
- Point2 p = Vector2(p_event.mouse_button.x,p_event.mouse_button.y)/get_size();
+ Point2 p = Vector2(p_event->get_pos().x,p_event->get_pos().y)/get_size();
p.y=1.0-p.y;
grabbed=-1;
grabbing=true;
@@ -371,7 +371,7 @@ void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
}
- if (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1 && !p_event.mouse_button.pressed) {
+ if (p_event.type==InputEvent::MOUSE_BUTTON && p_event->get_button_index()==1 && !p_event->is_pressed()) {
if (grabbing) {
grabbing=false;
@@ -382,7 +382,7 @@ void GraphCurveMapEdit::_gui_input(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_MOTION && grabbing && grabbed != -1) {
- Point2 p = Vector2(p_event.mouse_button.x,p_event.mouse_button.y)/get_size();
+ Point2 p = Vector2(p_event->get_pos().x,p_event->get_pos().y)/get_size();
p.y=1.0-p.y;
p.x = CLAMP(p.x,0.0,1.0);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 0bd4d7d6d2..c4595b477e 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -531,12 +531,12 @@ static int _get_key_modifier(const String &p_property) {
return 0;
}
-bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hilite_only) {
+bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only) {
if (!spatial_editor->is_gizmo_visible())
return false;
if (get_selected_count() == 0) {
- if (p_hilite_only)
+ if (p_highlight_only)
spatial_editor->select_gizmo_highlight_axis(-1);
return false;
}
@@ -569,7 +569,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hil
if (col_axis != -1) {
- if (p_hilite_only) {
+ if (p_highlight_only) {
spatial_editor->select_gizmo_highlight_axis(col_axis);
@@ -609,7 +609,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hil
if (col_axis != -1) {
- if (p_hilite_only) {
+ if (p_highlight_only) {
spatial_editor->select_gizmo_highlight_axis(col_axis + 3);
} else {
@@ -622,7 +622,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hil
}
}
- if (p_hilite_only)
+ if (p_highlight_only)
spatial_editor->select_gizmo_highlight_axis(-1);
return false;
@@ -634,9 +634,9 @@ void SpatialEditorViewport::_smouseenter() {
surface->grab_focus();
}
-void SpatialEditorViewport::_list_select(InputEventMouseButton b) {
+void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
- _find_items_at_pos(Vector2(b.x, b.y), clicked_includes_current, selection_results, b.mod.shift);
+ _find_items_at_pos(b->get_pos(), clicked_includes_current, selection_results, b->get_shift());
Node *scene = editor->get_edited_scene();
@@ -649,7 +649,7 @@ void SpatialEditorViewport::_list_select(InputEventMouseButton b) {
}
}
- clicked_wants_append = b.mod.shift;
+ clicked_wants_append = b->get_shift();
if (selection_results.size() == 1) {
@@ -684,13 +684,13 @@ void SpatialEditorViewport::_list_select(InputEventMouseButton b) {
selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_class() + "\nPath: " + node_path);
}
- selection_menu->set_global_position(Vector2(b.global_x, b.global_y));
+ selection_menu->set_global_position(b->get_global_pos());
selection_menu->popup();
selection_menu->call_deferred("grab_click_focus");
selection_menu->set_invalidate_click_until_motion();
}
}
-void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
+void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (previewing)
return; //do NONE
@@ -707,800 +707,802 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
}
}
- switch (p_event.type) {
- case InputEvent::MOUSE_BUTTON: {
+ Ref<InputEventMouseButton> b = p_event;
- const InputEventMouseButton &b = p_event.mouse_button;
+ if (b.is_valid()) {
- switch (b.button_index) {
+ switch (b->get_button_index()) {
- case BUTTON_WHEEL_UP: {
- scale_cursor_distance(is_freelook_active() ? ZOOM_MULTIPLIER : 1.0 / ZOOM_MULTIPLIER);
- } break;
+ case BUTTON_WHEEL_UP: {
+ scale_cursor_distance(is_freelook_active() ? ZOOM_MULTIPLIER : 1.0 / ZOOM_MULTIPLIER);
+ } break;
- case BUTTON_WHEEL_DOWN: {
- scale_cursor_distance(is_freelook_active() ? 1.0 / ZOOM_MULTIPLIER : ZOOM_MULTIPLIER);
- } break;
+ case BUTTON_WHEEL_DOWN: {
+ scale_cursor_distance(is_freelook_active() ? 1.0 / ZOOM_MULTIPLIER : ZOOM_MULTIPLIER);
+ } break;
- case BUTTON_RIGHT: {
+ case BUTTON_RIGHT: {
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
- if (b.pressed && _edit.gizmo.is_valid()) {
- //restore
- _edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_initial_value, true);
- _edit.gizmo = Ref<SpatialEditorGizmo>();
- }
+ if (b->is_pressed() && _edit.gizmo.is_valid()) {
+ //restore
+ _edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_initial_value, true);
+ _edit.gizmo = Ref<SpatialEditorGizmo>();
+ }
- if (_edit.mode == TRANSFORM_NONE && b.pressed) {
+ if (_edit.mode == TRANSFORM_NONE && b->is_pressed()) {
- if (b.mod.alt) {
+ if (b->get_alt()) {
- if (nav_scheme == NAVIGATION_MAYA)
- break;
+ if (nav_scheme == NAVIGATION_MAYA)
+ break;
- _list_select(b);
- return;
- }
+ _list_select(b);
+ return;
}
+ }
- if (_edit.mode != TRANSFORM_NONE && b.pressed) {
- //cancel motion
- _edit.mode = TRANSFORM_NONE;
- //_validate_selection();
+ if (_edit.mode != TRANSFORM_NONE && b->is_pressed()) {
+ //cancel motion
+ _edit.mode = TRANSFORM_NONE;
+ //_validate_selection();
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
- continue;
+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
- sp->set_global_transform(se->original);
- }
- surface->update();
- //VisualServer::get_singleton()->poly_clear(indicators);
- set_message(TTR("Transform Aborted."), 3);
+ sp->set_global_transform(se->original);
}
+ surface->update();
+ //VisualServer::get_singleton()->poly_clear(indicators);
+ set_message(TTR("Transform Aborted."), 3);
+ }
- freelook_active = b.pressed;
+ freelook_active = b->is_pressed();
- } break;
- case BUTTON_MIDDLE: {
+ } break;
+ case BUTTON_MIDDLE: {
- if (b.pressed && _edit.mode != TRANSFORM_NONE) {
+ if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) {
- switch (_edit.plane) {
+ switch (_edit.plane) {
- case TRANSFORM_VIEW: {
+ case TRANSFORM_VIEW: {
- _edit.plane = TRANSFORM_X_AXIS;
- set_message(TTR("X-Axis Transform."), 2);
- name = "";
- _update_name();
- } break;
- case TRANSFORM_X_AXIS: {
+ _edit.plane = TRANSFORM_X_AXIS;
+ set_message(TTR("X-Axis Transform."), 2);
+ name = "";
+ _update_name();
+ } break;
+ case TRANSFORM_X_AXIS: {
- _edit.plane = TRANSFORM_Y_AXIS;
- set_message(TTR("Y-Axis Transform."), 2);
+ _edit.plane = TRANSFORM_Y_AXIS;
+ set_message(TTR("Y-Axis Transform."), 2);
- } break;
- case TRANSFORM_Y_AXIS: {
+ } break;
+ case TRANSFORM_Y_AXIS: {
- _edit.plane = TRANSFORM_Z_AXIS;
- set_message(TTR("Z-Axis Transform."), 2);
+ _edit.plane = TRANSFORM_Z_AXIS;
+ set_message(TTR("Z-Axis Transform."), 2);
- } break;
- case TRANSFORM_Z_AXIS: {
+ } break;
+ case TRANSFORM_Z_AXIS: {
- _edit.plane = TRANSFORM_VIEW;
- set_message(TTR("View Plane Transform."), 2);
+ _edit.plane = TRANSFORM_VIEW;
+ set_message(TTR("View Plane Transform."), 2);
- } break;
- }
+ } break;
}
- } break;
- case BUTTON_LEFT: {
+ }
+ } break;
+ case BUTTON_LEFT: {
- if (b.pressed) {
+ if (b->is_pressed()) {
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
- if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b.mod.alt) {
- break;
- }
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) {
+ break;
+ }
- if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_LIST_SELECT) {
- _list_select(b);
- break;
- }
+ if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_LIST_SELECT) {
+ _list_select(b);
+ break;
+ }
- _edit.mouse_pos = Point2(b.x, b.y);
- _edit.snap = false;
- _edit.mode = TRANSFORM_NONE;
+ _edit.mouse_pos = b->get_pos();
+ _edit.snap = false;
+ _edit.mode = TRANSFORM_NONE;
- //gizmo has priority over everything
+ //gizmo has priority over everything
- bool can_select_gizmos = true;
+ bool can_select_gizmos = true;
- {
- int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
- can_select_gizmos = view_menu->get_popup()->is_item_checked(idx);
- }
+ {
+ int idx = view_menu->get_popup()->get_item_index(VIEW_GIZMOS);
+ can_select_gizmos = view_menu->get_popup()->is_item_checked(idx);
+ }
- if (can_select_gizmos && spatial_editor->get_selected()) {
+ if (can_select_gizmos && spatial_editor->get_selected()) {
- Ref<SpatialEditorGizmo> seg = spatial_editor->get_selected()->get_gizmo();
- if (seg.is_valid()) {
- int handle = -1;
- Vector3 point;
- Vector3 normal;
- bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, b.mod.shift);
- if (inters && handle != -1) {
+ Ref<SpatialEditorGizmo> seg = spatial_editor->get_selected()->get_gizmo();
+ if (seg.is_valid()) {
+ int handle = -1;
+ Vector3 point;
+ Vector3 normal;
+ bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, b->get_shift());
+ if (inters && handle != -1) {
- _edit.gizmo = seg;
- _edit.gizmo_handle = handle;
- //_edit.gizmo_initial_pos=seg->get_handle_pos(gizmo_handle);
- _edit.gizmo_initial_value = seg->get_handle_value(handle);
- break;
- }
+ _edit.gizmo = seg;
+ _edit.gizmo_handle = handle;
+ //_edit.gizmo_initial_pos=seg->get_handle_pos(gizmo_handle);
+ _edit.gizmo_initial_value = seg->get_handle_value(handle);
+ break;
}
}
+ }
- if (_gizmo_select(_edit.mouse_pos))
- break;
+ if (_gizmo_select(_edit.mouse_pos))
+ break;
- clicked = 0;
- clicked_includes_current = false;
+ clicked = 0;
+ clicked_includes_current = false;
- if ((spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT && b.mod.control) || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_ROTATE) {
+ if ((spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SELECT && b->get_control()) || spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_ROTATE) {
- /* HANDLE ROTATION */
- if (get_selected_count() == 0)
- break; //bye
- //handle rotate
- _edit.mode = TRANSFORM_ROTATE;
- _compute_edit(Point2(b.x, b.y));
- break;
- }
+ /* HANDLE ROTATION */
+ if (get_selected_count() == 0)
+ break; //bye
+ //handle rotate
+ _edit.mode = TRANSFORM_ROTATE;
+ _compute_edit(b->get_pos());
+ break;
+ }
- if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_MOVE) {
+ if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_MOVE) {
- if (get_selected_count() == 0)
- break; //bye
- //handle rotate
- _edit.mode = TRANSFORM_TRANSLATE;
- _compute_edit(Point2(b.x, b.y));
- break;
- }
+ if (get_selected_count() == 0)
+ break; //bye
+ //handle rotate
+ _edit.mode = TRANSFORM_TRANSLATE;
+ _compute_edit(b->get_pos());
+ break;
+ }
- if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SCALE) {
+ if (spatial_editor->get_tool_mode() == SpatialEditor::TOOL_MODE_SCALE) {
- if (get_selected_count() == 0)
- break; //bye
- //handle rotate
- _edit.mode = TRANSFORM_SCALE;
- _compute_edit(Point2(b.x, b.y));
- break;
- }
+ if (get_selected_count() == 0)
+ break; //bye
+ //handle rotate
+ _edit.mode = TRANSFORM_SCALE;
+ _compute_edit(b->get_pos());
+ break;
+ }
- // todo scale
+ // todo scale
- int gizmo_handle = -1;
+ int gizmo_handle = -1;
- clicked = _select_ray(Vector2(b.x, b.y), b.mod.shift, clicked_includes_current, &gizmo_handle, b.mod.shift);
+ clicked = _select_ray(b->get_pos(), b->get_shift(), clicked_includes_current, &gizmo_handle, b->get_shift());
- //clicking is always deferred to either move or release
+ //clicking is always deferred to either move or release
- clicked_wants_append = b.mod.shift;
+ clicked_wants_append = b->get_shift();
- if (!clicked) {
+ if (!clicked) {
- if (!clicked_wants_append)
- _clear_selected();
+ if (!clicked_wants_append)
+ _clear_selected();
- //default to regionselect
- cursor.region_select = true;
- cursor.region_begin = Point2(b.x, b.y);
- cursor.region_end = Point2(b.x, b.y);
- }
+ //default to regionselect
+ cursor.region_select = true;
+ cursor.region_begin = b->get_pos();
+ cursor.region_end = b->get_pos();
+ }
- if (clicked && gizmo_handle >= 0) {
+ if (clicked && gizmo_handle >= 0) {
- Object *obj = ObjectDB::get_instance(clicked);
- if (obj) {
+ Object *obj = ObjectDB::get_instance(clicked);
+ if (obj) {
- Spatial *spa = obj->cast_to<Spatial>();
- if (spa) {
+ Spatial *spa = obj->cast_to<Spatial>();
+ if (spa) {
- Ref<SpatialEditorGizmo> seg = spa->get_gizmo();
- if (seg.is_valid()) {
+ Ref<SpatialEditorGizmo> seg = spa->get_gizmo();
+ if (seg.is_valid()) {
- _edit.gizmo = seg;
- _edit.gizmo_handle = gizmo_handle;
- //_edit.gizmo_initial_pos=seg->get_handle_pos(gizmo_handle);
- _edit.gizmo_initial_value = seg->get_handle_value(gizmo_handle);
- //print_line("GIZMO: "+itos(gizmo_handle)+" FROMPOS: "+_edit.orig_gizmo_pos);
- break;
- }
+ _edit.gizmo = seg;
+ _edit.gizmo_handle = gizmo_handle;
+ //_edit.gizmo_initial_pos=seg->get_handle_pos(gizmo_handle);
+ _edit.gizmo_initial_value = seg->get_handle_value(gizmo_handle);
+ //print_line("GIZMO: "+itos(gizmo_handle)+" FROMPOS: "+_edit.orig_gizmo_pos);
+ break;
}
}
- //_compute_edit(Point2(b.x,b.y)); //in case a motion happens..
}
+ //_compute_edit(Point2(b.x,b.y)); //in case a motion happens..
+ }
- surface->update();
- } else {
+ surface->update();
+ } else {
- if (_edit.gizmo.is_valid()) {
+ if (_edit.gizmo.is_valid()) {
- _edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_initial_value, false);
- _edit.gizmo = Ref<SpatialEditorGizmo>();
- break;
- }
- if (clicked) {
- _select_clicked(clicked_wants_append, true);
- //clickd processing was deferred
- clicked = 0;
- }
+ _edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_initial_value, false);
+ _edit.gizmo = Ref<SpatialEditorGizmo>();
+ break;
+ }
+ if (clicked) {
+ _select_clicked(clicked_wants_append, true);
+ //clickd processing was deferred
+ clicked = 0;
+ }
- if (cursor.region_select) {
- _select_region();
- cursor.region_select = false;
- surface->update();
- }
+ if (cursor.region_select) {
+ _select_region();
+ cursor.region_select = false;
+ surface->update();
+ }
- if (_edit.mode != TRANSFORM_NONE) {
+ if (_edit.mode != TRANSFORM_NONE) {
- static const char *_transform_name[4] = { "None", "Rotate", "Translate", "Scale" };
- undo_redo->create_action(_transform_name[_edit.mode]);
+ static const char *_transform_name[4] = { "None", "Rotate", "Translate", "Scale" };
+ undo_redo->create_action(_transform_name[_edit.mode]);
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
- continue;
+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
- undo_redo->add_do_method(sp, "set_global_transform", sp->get_global_transform());
- undo_redo->add_undo_method(sp, "set_global_transform", se->original);
- }
- undo_redo->commit_action();
- _edit.mode = TRANSFORM_NONE;
- //VisualServer::get_singleton()->poly_clear(indicators);
- set_message("");
+ undo_redo->add_do_method(sp, "set_global_transform", sp->get_global_transform());
+ undo_redo->add_undo_method(sp, "set_global_transform", se->original);
}
-
- surface->update();
+ undo_redo->commit_action();
+ _edit.mode = TRANSFORM_NONE;
+ //VisualServer::get_singleton()->poly_clear(indicators);
+ set_message("");
}
- } break;
- }
- } break;
- case InputEvent::MOUSE_MOTION: {
- const InputEventMouseMotion &m = p_event.mouse_motion;
- _edit.mouse_pos = Point2(p_event.mouse_motion.x, p_event.mouse_motion.y);
+ surface->update();
+ }
- if (spatial_editor->get_selected()) {
+ } break;
+ }
+ }
- Ref<SpatialEditorGizmo> seg = spatial_editor->get_selected()->get_gizmo();
- if (seg.is_valid()) {
+ Ref<InputEventMouseMotion> m = p_event;
- int selected_handle = -1;
+ if (m.is_valid()) {
- int handle = -1;
- Vector3 point;
- Vector3 normal;
- bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, false);
- if (inters && handle != -1) {
+ _edit.mouse_pos = m->get_pos();
- selected_handle = handle;
- }
+ if (spatial_editor->get_selected()) {
- if (selected_handle != spatial_editor->get_over_gizmo_handle()) {
- spatial_editor->set_over_gizmo_handle(selected_handle);
- spatial_editor->get_selected()->update_gizmo();
- if (selected_handle != -1)
- spatial_editor->select_gizmo_highlight_axis(-1);
- }
- }
- }
+ Ref<SpatialEditorGizmo> seg = spatial_editor->get_selected()->get_gizmo();
+ if (seg.is_valid()) {
+
+ int selected_handle = -1;
+
+ int handle = -1;
+ Vector3 point;
+ Vector3 normal;
+ bool inters = seg->intersect_ray(camera, _edit.mouse_pos, point, normal, &handle, false);
+ if (inters && handle != -1) {
- if (spatial_editor->get_over_gizmo_handle() == -1 && !(m.button_mask & 1) && !_edit.gizmo.is_valid()) {
+ selected_handle = handle;
+ }
- _gizmo_select(_edit.mouse_pos, true);
+ if (selected_handle != spatial_editor->get_over_gizmo_handle()) {
+ spatial_editor->set_over_gizmo_handle(selected_handle);
+ spatial_editor->get_selected()->update_gizmo();
+ if (selected_handle != -1)
+ spatial_editor->select_gizmo_highlight_axis(-1);
+ }
}
+ }
- NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
- NavigationMode nav_mode = NAVIGATION_NONE;
+ if (spatial_editor->get_over_gizmo_handle() == -1 && !(m->get_button_mask() & 1) && !_edit.gizmo.is_valid()) {
- if (_edit.gizmo.is_valid()) {
+ _gizmo_select(_edit.mouse_pos, true);
+ }
- _edit.gizmo->set_handle(_edit.gizmo_handle, camera, Vector2(m.x, m.y));
- Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle);
- String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
- set_message(n + ": " + String(v));
+ NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation_scheme").operator int();
+ NavigationMode nav_mode = NAVIGATION_NONE;
- } else if (m.button_mask & BUTTON_MASK_LEFT) {
+ if (_edit.gizmo.is_valid()) {
- if (nav_scheme == NAVIGATION_MAYA && m.mod.alt) {
- nav_mode = NAVIGATION_ORBIT;
- } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.shift) {
- nav_mode = NAVIGATION_PAN;
- } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.control) {
- nav_mode = NAVIGATION_ZOOM;
- } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt) {
- nav_mode = NAVIGATION_ORBIT;
- } else {
- if (clicked) {
+ _edit.gizmo->set_handle(_edit.gizmo_handle, camera, m->get_pos());
+ Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle);
+ String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
+ set_message(n + ": " + String(v));
- if (!clicked_includes_current) {
+ } else if (m->get_button_mask() & BUTTON_MASK_LEFT) {
- _select_clicked(clicked_wants_append, true);
- //clickd processing was deferred
- }
+ if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
+ nav_mode = NAVIGATION_ORBIT;
+ } else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) {
+ nav_mode = NAVIGATION_PAN;
+ } else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_control()) {
+ nav_mode = NAVIGATION_ZOOM;
+ } else if (nav_scheme == NAVIGATION_MODO && m->get_alt()) {
+ nav_mode = NAVIGATION_ORBIT;
+ } else {
+ if (clicked) {
- _compute_edit(_edit.mouse_pos);
- clicked = 0;
+ if (!clicked_includes_current) {
- _edit.mode = TRANSFORM_TRANSLATE;
+ _select_clicked(clicked_wants_append, true);
+ //clickd processing was deferred
}
- if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
+ _compute_edit(_edit.mouse_pos);
+ clicked = 0;
- cursor.region_end = Point2(m.x, m.y);
- surface->update();
- return;
- }
+ _edit.mode = TRANSFORM_TRANSLATE;
+ }
- if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE)
- break;
+ if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
- Vector3 ray_pos = _get_ray_pos(Vector2(m.x, m.y));
- Vector3 ray = _get_ray(Vector2(m.x, m.y));
+ cursor.region_end = m->get_pos();
+ surface->update();
+ return;
+ }
- switch (_edit.mode) {
+ if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE)
+ return;
- case TRANSFORM_SCALE: {
+ Vector3 ray_pos = _get_ray_pos(m->get_pos());
+ Vector3 ray = _get_ray(m->get_pos());
- Plane plane = Plane(_edit.center, _get_camera_normal());
+ switch (_edit.mode) {
- Vector3 intersection;
- if (!plane.intersects_ray(ray_pos, ray, &intersection))
- break;
+ case TRANSFORM_SCALE: {
- Vector3 click;
- if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
- break;
+ Plane plane = Plane(_edit.center, _get_camera_normal());
- float center_click_dist = click.distance_to(_edit.center);
- float center_inters_dist = intersection.distance_to(_edit.center);
- if (center_click_dist == 0)
- break;
+ Vector3 intersection;
+ if (!plane.intersects_ray(ray_pos, ray, &intersection))
+ break;
- float scale = (center_inters_dist / center_click_dist) * 100.0;
+ Vector3 click;
+ if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
+ break;
- if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ float center_click_dist = click.distance_to(_edit.center);
+ float center_inters_dist = intersection.distance_to(_edit.center);
+ if (center_click_dist == 0)
+ break;
- scale = Math::stepify(scale, spatial_editor->get_scale_snap());
- }
+ float scale = (center_inters_dist / center_click_dist) * 100.0;
- set_message(vformat(TTR("Scaling to %s%%."), String::num(scale, 1)));
- scale /= 100.0;
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
- Transform r;
- r.basis.scale(Vector3(scale, scale, scale));
+ scale = Math::stepify(scale, spatial_editor->get_scale_snap());
+ }
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ set_message(vformat(TTR("Scaling to %s%%."), String::num(scale, 1)));
+ scale /= 100.0;
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ Transform r;
+ r.basis.scale(Vector3(scale, scale, scale));
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
- continue;
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Transform original = se->original;
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- Transform base = Transform(Basis(), _edit.center);
- Transform t = base * (r * (base.inverse() * original));
+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
- sp->set_global_transform(t);
- }
+ Transform original = se->original;
- surface->update();
+ Transform base = Transform(Basis(), _edit.center);
+ Transform t = base * (r * (base.inverse() * original));
- } break;
+ sp->set_global_transform(t);
+ }
- case TRANSFORM_TRANSLATE: {
+ surface->update();
- Vector3 motion_mask;
- Plane plane;
+ } break;
- switch (_edit.plane) {
- case TRANSFORM_VIEW:
- motion_mask = Vector3(0, 0, 0);
- plane = Plane(_edit.center, _get_camera_normal());
- break;
- case TRANSFORM_X_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0);
- plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
- break;
- case TRANSFORM_Y_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(1);
- plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
- break;
- case TRANSFORM_Z_AXIS:
- motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2);
- plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
- break;
- }
+ case TRANSFORM_TRANSLATE: {
- Vector3 intersection;
- if (!plane.intersects_ray(ray_pos, ray, &intersection))
- break;
+ Vector3 motion_mask;
+ Plane plane;
- Vector3 click;
- if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
+ switch (_edit.plane) {
+ case TRANSFORM_VIEW:
+ motion_mask = Vector3(0, 0, 0);
+ plane = Plane(_edit.center, _get_camera_normal());
+ break;
+ case TRANSFORM_X_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(0);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
+ break;
+ case TRANSFORM_Y_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(1);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
break;
+ case TRANSFORM_Z_AXIS:
+ motion_mask = spatial_editor->get_gizmo_transform().basis.get_axis(2);
+ plane = Plane(_edit.center, motion_mask.cross(motion_mask.cross(_get_camera_normal())).normalized());
+ break;
+ }
- //_validate_selection();
- Vector3 motion = intersection - click;
- if (motion_mask != Vector3()) {
- motion = motion_mask.dot(motion) * motion_mask;
- }
+ Vector3 intersection;
+ if (!plane.intersects_ray(ray_pos, ray, &intersection))
+ break;
- float snap = 0;
+ Vector3 click;
+ if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
+ break;
- if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ //_validate_selection();
+ Vector3 motion = intersection - click;
+ if (motion_mask != Vector3()) {
+ motion = motion_mask.dot(motion) * motion_mask;
+ }
- snap = spatial_editor->get_translate_snap();
- motion.snap(snap);
- }
+ float snap = 0;
- //set_message("Translating: "+motion);
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ snap = spatial_editor->get_translate_snap();
+ motion.snap(snap);
+ }
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ //set_message("Translating: "+motion);
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp) {
- continue;
- }
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se) {
- continue;
- }
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Transform t = se->original;
- t.origin += motion;
- sp->set_global_transform(t);
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp) {
+ continue;
}
- } break;
- case TRANSFORM_ROTATE: {
+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se) {
+ continue;
+ }
- Plane plane;
+ Transform t = se->original;
+ t.origin += motion;
+ sp->set_global_transform(t);
+ }
+ } break;
- switch (_edit.plane) {
- case TRANSFORM_VIEW:
- plane = Plane(_edit.center, _get_camera_normal());
- break;
- case TRANSFORM_X_AXIS:
- plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(0));
- break;
- case TRANSFORM_Y_AXIS:
- plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(1));
- break;
- case TRANSFORM_Z_AXIS:
- plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(2));
- break;
- }
+ case TRANSFORM_ROTATE: {
- Vector3 intersection;
- if (!plane.intersects_ray(ray_pos, ray, &intersection))
- break;
+ Plane plane;
- Vector3 click;
- if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
+ switch (_edit.plane) {
+ case TRANSFORM_VIEW:
+ plane = Plane(_edit.center, _get_camera_normal());
+ break;
+ case TRANSFORM_X_AXIS:
+ plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(0));
break;
+ case TRANSFORM_Y_AXIS:
+ plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(1));
+ break;
+ case TRANSFORM_Z_AXIS:
+ plane = Plane(_edit.center, spatial_editor->get_gizmo_transform().basis.get_axis(2));
+ break;
+ }
+
+ Vector3 intersection;
+ if (!plane.intersects_ray(ray_pos, ray, &intersection))
+ break;
- Vector3 y_axis = (click - _edit.center).normalized();
- Vector3 x_axis = plane.normal.cross(y_axis).normalized();
+ Vector3 click;
+ if (!plane.intersects_ray(_edit.click_ray_pos, _edit.click_ray, &click))
+ break;
- float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center));
- if (_edit.snap || spatial_editor->is_snap_enabled()) {
+ Vector3 y_axis = (click - _edit.center).normalized();
+ Vector3 x_axis = plane.normal.cross(y_axis).normalized();
- float snap = spatial_editor->get_rotate_snap();
+ float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center));
+ if (_edit.snap || spatial_editor->is_snap_enabled()) {
- if (snap) {
- angle = Math::rad2deg(angle) + snap * 0.5; //else it wont reach +180
- angle -= Math::fmod(angle, snap);
- set_message(vformat(TTR("Rotating %s degrees."), rtos(angle)));
- angle = Math::deg2rad(angle);
- } else
- set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
+ float snap = spatial_editor->get_rotate_snap();
- } else {
+ if (snap) {
+ angle = Math::rad2deg(angle) + snap * 0.5; //else it wont reach +180
+ angle -= Math::fmod(angle, snap);
+ set_message(vformat(TTR("Rotating %s degrees."), rtos(angle)));
+ angle = Math::deg2rad(angle);
+ } else
set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
- }
- Transform r;
- r.basis.rotate(plane.normal, angle);
+ } else {
+ set_message(vformat(TTR("Rotating %s degrees."), rtos(Math::rad2deg(angle))));
+ }
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ Transform r;
+ r.basis.rotate(plane.normal, angle);
+
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
- if (!se)
- continue;
+ SpatialEditorSelectedItem *se = editor_selection->get_node_editor_data<SpatialEditorSelectedItem>(sp);
+ if (!se)
+ continue;
- Transform original = se->original;
+ Transform original = se->original;
- Transform base = Transform(Basis(), _edit.center);
- Transform t = base * r * base.inverse() * original;
+ Transform base = Transform(Basis(), _edit.center);
+ Transform t = base * r * base.inverse() * original;
- sp->set_global_transform(t);
- }
+ sp->set_global_transform(t);
+ }
- surface->update();
- /*
- VisualServer::get_singleton()->poly_clear(indicators);
-
- Vector<Vector3> points;
- Vector<Vector3> empty;
- Vector<Color> colors;
- points.push_back(intersection);
- points.push_back(_edit.original.origin);
- colors.push_back( Color(255,155,100) );
- colors.push_back( Color(255,155,100) );
- VisualServer::get_singleton()->poly_add_primitive(indicators,points,empty,colors,empty);
- */
- } break;
- default: {}
- }
+ surface->update();
+ /*
+ VisualServer::get_singleton()->poly_clear(indicators);
+
+ Vector<Vector3> points;
+ Vector<Vector3> empty;
+ Vector<Color> colors;
+ points.push_back(intersection);
+ points.push_back(_edit.original.origin);
+ colors.push_back( Color(255,155,100) );
+ colors.push_back( Color(255,155,100) );
+ VisualServer::get_singleton()->poly_add_primitive(indicators,points,empty,colors,empty);
+ */
+ } break;
+ default: {}
}
+ }
- } else if (m.button_mask & BUTTON_MASK_RIGHT) {
+ } else if (m->get_button_mask() & BUTTON_MASK_RIGHT) {
- if (nav_scheme == NAVIGATION_MAYA && m.mod.alt) {
- nav_mode = NAVIGATION_ZOOM;
- } else {
- nav_mode = NAVIGATION_LOOK;
- }
+ if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
+ nav_mode = NAVIGATION_ZOOM;
+ } else {
+ nav_mode = NAVIGATION_LOOK;
+ }
- } else if (m.button_mask & BUTTON_MASK_MIDDLE) {
-
- if (nav_scheme == NAVIGATION_GODOT) {
-
- int mod = 0;
- if (m.mod.shift)
- mod = KEY_SHIFT;
- if (m.mod.alt)
- mod = KEY_ALT;
- if (m.mod.control)
- mod = KEY_CONTROL;
- if (m.mod.meta)
- mod = KEY_META;
-
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
- nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
- nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
- nav_mode = NAVIGATION_ORBIT;
-
- } else if (nav_scheme == NAVIGATION_MAYA) {
- if (m.mod.alt)
- nav_mode = NAVIGATION_PAN;
- }
+ } else if (m->get_button_mask() & BUTTON_MASK_MIDDLE) {
+
+ if (nav_scheme == NAVIGATION_GODOT) {
- } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
- // Handle trackpad (no external mouse) use case
int mod = 0;
- if (m.mod.shift)
+ if (m->get_shift())
mod = KEY_SHIFT;
- if (m.mod.alt)
+ if (m->get_alt())
mod = KEY_ALT;
- if (m.mod.control)
+ if (m->get_control())
mod = KEY_CONTROL;
- if (m.mod.meta)
+ if (m->get_metakey())
mod = KEY_META;
- if (mod) {
- if (mod == _get_key_modifier("editors/3d/pan_modifier"))
- nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
- nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
- nav_mode = NAVIGATION_ORBIT;
- }
+ if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ nav_mode = NAVIGATION_PAN;
+ else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ nav_mode = NAVIGATION_ZOOM;
+ else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ nav_mode = NAVIGATION_ORBIT;
+
+ } else if (nav_scheme == NAVIGATION_MAYA) {
+ if (m->get_alt())
+ nav_mode = NAVIGATION_PAN;
}
- switch (nav_mode) {
- case NAVIGATION_PAN: {
+ } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) {
+ // Handle trackpad (no external mouse) use case
+ int mod = 0;
+ if (m->get_shift())
+ mod = KEY_SHIFT;
+ if (m->get_alt())
+ mod = KEY_ALT;
+ if (m->get_control())
+ mod = KEY_CONTROL;
+ if (m->get_metakey())
+ mod = KEY_META;
+
+ if (mod) {
+ if (mod == _get_key_modifier("editors/3d/pan_modifier"))
+ nav_mode = NAVIGATION_PAN;
+ else if (mod == _get_key_modifier("editors/3d/zoom_modifier"))
+ nav_mode = NAVIGATION_ZOOM;
+ else if (mod == _get_key_modifier("editors/3d/orbit_modifier"))
+ nav_mode = NAVIGATION_ORBIT;
+ }
+ }
- real_t pan_speed = 1 / 150.0;
- int pan_speed_modifier = 10;
- if (nav_scheme == NAVIGATION_MAYA && m.mod.shift)
- pan_speed *= pan_speed_modifier;
+ switch (nav_mode) {
+ case NAVIGATION_PAN: {
- Point2i relative = _get_warped_mouse_motion(m);
+ real_t pan_speed = 1 / 150.0;
+ int pan_speed_modifier = 10;
+ if (nav_scheme == NAVIGATION_MAYA && m->get_shift())
+ pan_speed *= pan_speed_modifier;
- Transform camera_transform;
-
- camera_transform.translate(cursor.pos);
- camera_transform.basis.rotate(Vector3(1, 0, 0), -cursor.x_rot);
- camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
- Vector3 translation(-relative.x * pan_speed, relative.y * pan_speed, 0);
- translation *= cursor.distance / DISTANCE_DEFAULT;
- camera_transform.translate(translation);
- cursor.pos = camera_transform.origin;
-
- } break;
-
- case NAVIGATION_ZOOM: {
- real_t zoom_speed = 1 / 80.0;
- int zoom_speed_modifier = 10;
- if (nav_scheme == NAVIGATION_MAYA && m.mod.shift)
- zoom_speed *= zoom_speed_modifier;
-
- NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/zoom_style").operator int();
- if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
- if (m.relative_x > 0)
- scale_cursor_distance(1 - m.relative_x * zoom_speed);
- else if (m.relative_x < 0)
- scale_cursor_distance(1.0 / (1 + m.relative_x * zoom_speed));
- } else {
- if (m.relative_y > 0)
- scale_cursor_distance(1 + m.relative_y * zoom_speed);
- else if (m.relative_y < 0)
- scale_cursor_distance(1.0 / (1 - m.relative_y * zoom_speed));
- }
+ Point2i relative = _get_warped_mouse_motion(m);
+
+ Transform camera_transform;
+
+ camera_transform.translate(cursor.pos);
+ camera_transform.basis.rotate(Vector3(1, 0, 0), -cursor.x_rot);
+ camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
+ Vector3 translation(-relative.x * pan_speed, relative.y * pan_speed, 0);
+ translation *= cursor.distance / DISTANCE_DEFAULT;
+ camera_transform.translate(translation);
+ cursor.pos = camera_transform.origin;
+
+ } break;
+
+ case NAVIGATION_ZOOM: {
+ real_t zoom_speed = 1 / 80.0;
+ int zoom_speed_modifier = 10;
+ if (nav_scheme == NAVIGATION_MAYA && m->get_shift())
+ zoom_speed *= zoom_speed_modifier;
+
+ NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/zoom_style").operator int();
+ if (zoom_style == NAVIGATION_ZOOM_HORIZONTAL) {
+ if (m->get_relative().x > 0)
+ scale_cursor_distance(1 - m->get_relative().x * zoom_speed);
+ else if (m->get_relative().x < 0)
+ scale_cursor_distance(1.0 / (1 + m->get_relative().x * zoom_speed));
+ } else {
+ if (m->get_relative().y > 0)
+ scale_cursor_distance(1 + m->get_relative().y * zoom_speed);
+ else if (m->get_relative().y < 0)
+ scale_cursor_distance(1.0 / (1 - m->get_relative().y * zoom_speed));
+ }
+
+ } break;
- } break;
+ case NAVIGATION_ORBIT: {
+ Point2i relative = _get_warped_mouse_motion(m);
+ cursor.x_rot += relative.y / 80.0;
+ cursor.y_rot += relative.x / 80.0;
+ if (cursor.x_rot > Math_PI / 2.0)
+ cursor.x_rot = Math_PI / 2.0;
+ if (cursor.x_rot < -Math_PI / 2.0)
+ cursor.x_rot = -Math_PI / 2.0;
+ name = "";
+ _update_name();
+ } break;
- case NAVIGATION_ORBIT: {
+ case NAVIGATION_LOOK: {
+ // Freelook only works properly in perspective.
+ // It technically works too in ortho, but it's awful for a user due to fov being near zero
+ if (!orthogonal) {
Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 80.0;
- cursor.y_rot += relative.x / 80.0;
+ cursor.x_rot += relative.y / 120.0;
+ cursor.y_rot += relative.x / 120.0;
if (cursor.x_rot > Math_PI / 2.0)
cursor.x_rot = Math_PI / 2.0;
if (cursor.x_rot < -Math_PI / 2.0)
cursor.x_rot = -Math_PI / 2.0;
+
+ // Look is like Orbit, except the cursor translates, not the camera
+ Transform camera_transform = to_camera_transform(cursor);
+ Vector3 pos = camera_transform.xform(Vector3(0, 0, 0));
+ Vector3 diff = camera->get_translation() - pos;
+ cursor.pos += diff;
+
name = "";
_update_name();
- } break;
-
- case NAVIGATION_LOOK: {
- // Freelook only works properly in perspective.
- // It technically works too in ortho, but it's awful for a user due to fov being near zero
- if (!orthogonal) {
- Point2i relative = _get_warped_mouse_motion(m);
- cursor.x_rot += relative.y / 120.0;
- cursor.y_rot += relative.x / 120.0;
- if (cursor.x_rot > Math_PI / 2.0)
- cursor.x_rot = Math_PI / 2.0;
- if (cursor.x_rot < -Math_PI / 2.0)
- cursor.x_rot = -Math_PI / 2.0;
-
- // Look is like Orbit, except the cursor translates, not the camera
- Transform camera_transform = to_camera_transform(cursor);
- Vector3 pos = camera_transform.xform(Vector3(0, 0, 0));
- Vector3 diff = camera->get_translation() - pos;
- cursor.pos += diff;
-
- name = "";
- _update_name();
- }
+ }
- } break;
+ } break;
- default: {}
- }
- } break;
- case InputEvent::KEY: {
- const InputEventKey &k = p_event.key;
- if (!k.pressed)
- break;
+ default: {}
+ }
+ }
- if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
- if (_edit.mode != TRANSFORM_NONE) {
- _edit.snap = true;
- }
- }
- if (ED_IS_SHORTCUT("spatial_editor/bottom_view", p_event)) {
- cursor.y_rot = 0;
- cursor.x_rot = -Math_PI / 2.0;
- set_message(TTR("Bottom View."), 2);
- name = TTR("Bottom");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/top_view", p_event)) {
- cursor.y_rot = 0;
- cursor.x_rot = Math_PI / 2.0;
- set_message(TTR("Top View."), 2);
- name = TTR("Top");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/rear_view", p_event)) {
- cursor.x_rot = 0;
- cursor.y_rot = Math_PI;
- set_message(TTR("Rear View."), 2);
- name = TTR("Rear");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/front_view", p_event)) {
- cursor.x_rot = 0;
- cursor.y_rot = 0;
- set_message(TTR("Front View."), 2);
- name = TTR("Front");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/left_view", p_event)) {
- cursor.x_rot = 0;
- cursor.y_rot = Math_PI / 2.0;
- set_message(TTR("Left View."), 2);
- name = TTR("Left");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/right_view", p_event)) {
- cursor.x_rot = 0;
- cursor.y_rot = -Math_PI / 2.0;
- set_message(TTR("Right View."), 2);
- name = TTR("Right");
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/switch_perspective_orthogonal", p_event)) {
- _menu_option(orthogonal ? VIEW_PERSPECTIVE : VIEW_ORTHOGONAL);
- _update_name();
- }
- if (ED_IS_SHORTCUT("spatial_editor/insert_anim_key", p_event)) {
- if (!get_selected_count() || _edit.mode != TRANSFORM_NONE)
- break;
+ Ref<InputEventKey> k = p_event;
- if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
- set_message(TTR("Keying is disabled (no key inserted)."));
- break;
- }
+ if (k.is_valid()) {
+ if (!k->is_pressed())
+ return;
+
+ if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
+ if (_edit.mode != TRANSFORM_NONE) {
+ _edit.snap = true;
+ }
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/bottom_view", p_event)) {
+ cursor.y_rot = 0;
+ cursor.x_rot = -Math_PI / 2.0;
+ set_message(TTR("Bottom View."), 2);
+ name = TTR("Bottom");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/top_view", p_event)) {
+ cursor.y_rot = 0;
+ cursor.x_rot = Math_PI / 2.0;
+ set_message(TTR("Top View."), 2);
+ name = TTR("Top");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/rear_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot = Math_PI;
+ set_message(TTR("Rear View."), 2);
+ name = TTR("Rear");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/front_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot = 0;
+ set_message(TTR("Front View."), 2);
+ name = TTR("Front");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/left_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot = Math_PI / 2.0;
+ set_message(TTR("Left View."), 2);
+ name = TTR("Left");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/right_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot = -Math_PI / 2.0;
+ set_message(TTR("Right View."), 2);
+ name = TTR("Right");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/switch_perspective_orthogonal", p_event)) {
+ _menu_option(orthogonal ? VIEW_PERSPECTIVE : VIEW_ORTHOGONAL);
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/insert_anim_key", p_event)) {
+ if (!get_selected_count() || _edit.mode != TRANSFORM_NONE)
+ return;
- List<Node *> &selection = editor_selection->get_selected_node_list();
+ if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
+ set_message(TTR("Keying is disabled (no key inserted)."));
+ return;
+ }
- for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
+ List<Node *> &selection = editor_selection->get_selected_node_list();
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
+ for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
- emit_signal("transform_key_request", sp, "", sp->get_transform());
- }
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- set_message(TTR("Animation Key Inserted."));
+ emit_signal("transform_key_request", sp, "", sp->get_transform());
}
- if (k.scancode == KEY_SPACE) {
- if (!k.pressed) emit_signal("toggle_maximize_view", this);
- }
+ set_message(TTR("Animation Key Inserted."));
+ }
- } break;
+ if (k->get_scancode() == KEY_SPACE) {
+ if (!k->is_pressed()) emit_signal("toggle_maximize_view", this);
+ }
}
}
@@ -1526,12 +1528,12 @@ void SpatialEditorViewport::scale_cursor_distance(real_t scale) {
surface->update();
}
-Point2i SpatialEditorViewport::_get_warped_mouse_motion(const InputEventMouseMotion &p_ev_mouse_motion) const {
+Point2i SpatialEditorViewport::_get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const {
Point2i relative;
if (bool(EditorSettings::get_singleton()->get("editors/3d/warped_mouse_panning"))) {
relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect());
} else {
- relative = Point2i(p_ev_mouse_motion.relative_x, p_ev_mouse_motion.relative_y);
+ relative = p_ev_mouse_motion->get_relative();
}
return relative;
}
@@ -1545,13 +1547,13 @@ void SpatialEditorViewport::_update_freelook(real_t delta) {
Vector3 right = camera->get_transform().basis.xform(Vector3(1, 0, 0));
Vector3 up = camera->get_transform().basis.xform(Vector3(0, 1, 0));
- int key_left = ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A)->get_shortcut().key.scancode;
- int key_right = ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D)->get_shortcut().key.scancode;
- int key_forward = ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W)->get_shortcut().key.scancode;
- int key_backwards = ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S)->get_shortcut().key.scancode;
- int key_up = ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q)->get_shortcut().key.scancode;
- int key_down = ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E)->get_shortcut().key.scancode;
- int key_speed_modifier = ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT)->get_shortcut().key.scancode;
+ int key_left = ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_right = ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_forward = ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_backwards = ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_up = ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_Q)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_down = ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_E)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
+ int key_speed_modifier = ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT)->get_shortcut()->cast_to<InputEventKey>()->get_scancode();
Vector3 velocity;
bool pressed = false;
@@ -1766,7 +1768,7 @@ void SpatialEditorViewport::_draw() {
if (surface->has_focus()) {
Size2 size = surface->get_size();
Rect2 r = Rect2(Point2(), size);
- get_stylebox("EditorFocus", "EditorStyles")->draw(surface->get_canvas_item(), r);
+ get_stylebox("Focus", "EditorStyles")->draw(surface->get_canvas_item(), r);
}
RID ci = surface->get_canvas_item();
@@ -3274,7 +3276,7 @@ bool SpatialEditor::is_any_freelook_active() const {
return false;
}
-void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
+void SpatialEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack())
return;
@@ -3294,43 +3296,39 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
}
#endif
- switch (p_event.type) {
-
- case InputEvent::KEY: {
+ Ref<InputEventKey> k = p_event;
- // Note: need to check is_echo because first person movement keys might still be held
- if (!is_any_freelook_active() && !p_event.is_echo()) {
+ if (k.is_valid()) {
- const InputEventKey &k = p_event.key;
+ // Note: need to check is_echo because first person movement keys might still be held
+ if (!is_any_freelook_active() && !p_event->is_echo()) {
- if (!k.pressed)
- break;
+ if (!k->is_pressed())
+ return;
- if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event))
- _menu_item_pressed(MENU_TOOL_SELECT);
+ if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event))
+ _menu_item_pressed(MENU_TOOL_SELECT);
- else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event))
- _menu_item_pressed(MENU_TOOL_MOVE);
+ else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event))
+ _menu_item_pressed(MENU_TOOL_MOVE);
- else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event))
- _menu_item_pressed(MENU_TOOL_ROTATE);
+ else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event))
+ _menu_item_pressed(MENU_TOOL_ROTATE);
- else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
- _menu_item_pressed(MENU_TOOL_SCALE);
+ else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
+ _menu_item_pressed(MENU_TOOL_SCALE);
- else if (ED_IS_SHORTCUT("spatial_editor/display_wireframe", p_event)) {
- if (k.mod.shift || k.mod.control || k.mod.command)
- break;
+ else if (ED_IS_SHORTCUT("spatial_editor/display_wireframe", p_event)) {
+ if (k->get_shift() || k->get_control() || k->get_command())
+ return;
- if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME))) {
- _menu_item_pressed(MENU_VIEW_DISPLAY_NORMAL);
- } else {
- _menu_item_pressed(MENU_VIEW_DISPLAY_WIREFRAME);
- }
+ if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME))) {
+ _menu_item_pressed(MENU_VIEW_DISPLAY_NORMAL);
+ } else {
+ _menu_item_pressed(MENU_VIEW_DISPLAY_WIREFRAME);
}
}
-
- } break;
+ }
}
}
void SpatialEditor::_notification(int p_what) {
@@ -3547,12 +3545,13 @@ void SpatialEditor::_update_default_light_angle() {
}
}
-void SpatialEditor::_default_light_angle_input(const InputEvent &p_event) {
+void SpatialEditor::_default_light_angle_input(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::MOUSE_MOTION && p_event.mouse_motion.button_mask & (0x1 | 0x2 | 0x4)) {
+ Ref<InputEventMouseMotion> mm = p_event;
+ if (mm.is_valid() && mm->get_button_mask() & (0x1 | 0x2 | 0x4)) {
- settings_default_light_rot_y = Math::fposmod(settings_default_light_rot_y - p_event.mouse_motion.relative_x * 0.01, Math_PI * 2.0);
- settings_default_light_rot_x = Math::fposmod(settings_default_light_rot_x - p_event.mouse_motion.relative_y * 0.01, Math_PI * 2.0);
+ settings_default_light_rot_y = Math::fposmod(settings_default_light_rot_y - mm->get_relative().x * 0.01, Math_PI * 2.0);
+ settings_default_light_rot_x = Math::fposmod(settings_default_light_rot_x - mm->get_relative().y * 0.01, Math_PI * 2.0);
_update_default_light_angle();
}
}
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 01435028ac..1f76d9bfb8 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -142,7 +142,7 @@ private:
Vector3 _get_screen_to_space(const Vector3 &p_vector3);
void _select_region();
- bool _gizmo_select(const Vector2 &p_screenpos, bool p_hilite_only = false);
+ bool _gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only = false);
float get_znear() const;
float get_zfar() const;
@@ -236,7 +236,7 @@ private:
void _draw();
void _smouseenter();
- void _sinput(const InputEvent &p_ie);
+ void _sinput(const Ref<InputEvent> &p_ie);
void _update_freelook(real_t delta);
SpatialEditor *spatial_editor;
@@ -249,8 +249,8 @@ private:
void _finish_gizmo_instances();
void _selection_result_pressed(int);
void _selection_menu_hide();
- void _list_select(InputEventMouseButton b);
- Point2i _get_warped_mouse_motion(const InputEventMouseMotion &p_ev_mouse_motion) const;
+ void _list_select(Ref<InputEventMouseButton> b);
+ Point2i _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const;
protected:
void _notification(int p_what);
@@ -428,7 +428,7 @@ private:
ViewportContainer *settings_light_base;
Viewport *settings_light_vp;
ColorPickerButton *settings_ambient_color;
- Image settings_light_dir_image;
+ Ref<Image> settings_light_dir_image;
void _xform_dialog_action();
void _menu_item_pressed(int p_option);
@@ -464,14 +464,14 @@ private:
void _update_ambient_light_color(const Color &p_color);
void _update_default_light_angle();
- void _default_light_angle_input(const InputEvent &p_event);
+ void _default_light_angle_input(const Ref<InputEvent> &p_event);
bool is_any_freelook_active() const;
protected:
void _notification(int p_what);
//void _gui_input(InputEvent p_event);
- void _unhandled_key_input(InputEvent p_event);
+ void _unhandled_key_input(Ref<InputEvent> p_event);
static void _bind_methods();
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index c7c77fa960..d06c065f4f 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -34,7 +34,7 @@
#include "io/resource_loader.h"
#include "scene/3d/sprite_3d.h"
-void SpriteFramesEditor::_gui_input(InputEvent p_event) {
+void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
}
void SpriteFramesEditor::_notification(int p_what) {
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index 3778e4ca55..c9081c599a 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -100,7 +100,7 @@ class SpriteFramesEditor : public PanelContainer {
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
public:
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 62977d86ea..3b705aae24 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -33,7 +33,7 @@
#include "global_config.h"
#include "io/resource_loader.h"
-void TextureEditor::_gui_input(InputEvent p_event) {
+void TextureEditor::_gui_input(Ref<InputEvent> p_event) {
}
void TextureEditor::_notification(int p_what) {
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index 8750ce4d5e..9382983538 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -42,7 +42,7 @@ class TextureEditor : public Control {
protected:
void _notification(int p_what);
- void _gui_input(InputEvent p_event);
+ void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
public:
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 4c49b467d8..799bfbf358 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -202,7 +202,7 @@ void TextureRegionEditor::_region_draw() {
}
}
-void TextureRegionEditor::_region_input(const InputEvent &p_input) {
+void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
Transform2D mtx;
mtx.elements[2] = -draw_ofs;
mtx.scale_basis(Vector2(draw_zoom, draw_zoom));
@@ -218,13 +218,12 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
mtx.xform(rect.pos + Vector2(0, rect.size.y / 2)) + Vector2(-4, 0)
};
- if (p_input.type == InputEvent::MOUSE_BUTTON) {
+ Ref<InputEventMouseButton> mb;
+ if (mb.is_valid()) {
- const InputEventMouseButton &mb = p_input.mouse_button;
+ if (mb->get_button_index() == BUTTON_LEFT) {
- if (mb.button_index == BUTTON_LEFT) {
-
- if (mb.pressed) {
+ if (mb->is_pressed()) {
if (node_patch9 || obj_styleBox.is_valid()) {
edited_margin = -1;
float margins[4];
@@ -245,26 +244,26 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
mtx.basis_xform(rect.pos + Vector2(margins[2], 0)) - draw_ofs,
mtx.basis_xform(rect.pos + rect.size - Vector2(margins[3], 0)) - draw_ofs
};
- if (Math::abs(mb.y - pos[0].y) < 8) {
+ if (Math::abs(mb->get_pos().y - pos[0].y) < 8) {
edited_margin = 0;
prev_margin = margins[0];
- } else if (Math::abs(mb.y - pos[1].y) < 8) {
+ } else if (Math::abs(mb->get_pos().y - pos[1].y) < 8) {
edited_margin = 1;
prev_margin = margins[1];
- } else if (Math::abs(mb.x - pos[2].x) < 8) {
+ } else if (Math::abs(mb->get_pos().x - pos[2].x) < 8) {
edited_margin = 2;
prev_margin = margins[2];
- } else if (Math::abs(mb.x - pos[3].x) < 8) {
+ } else if (Math::abs(mb->get_pos().x - pos[3].x) < 8) {
edited_margin = 3;
prev_margin = margins[3];
}
if (edited_margin >= 0) {
- drag_from = Vector2(mb.x, mb.y);
+ drag_from = Vector2(mb->get_pos().x, mb->get_pos().y);
drag = true;
}
}
if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
- Vector2 point = mtx.affine_inverse().xform(Vector2(mb.x, mb.y));
+ Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_pos().x, mb->get_pos().y));
for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
if (E->get().has_point(point)) {
rect = E->get();
@@ -302,7 +301,7 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
}
}
} else if (edited_margin < 0) {
- drag_from = mtx.affine_inverse().xform(Vector2(mb.x, mb.y));
+ drag_from = mtx.affine_inverse().xform(Vector2(mb->get_pos().x, mb->get_pos().y));
if (snap_mode == SNAP_PIXEL)
drag_from = drag_from.snapped(Vector2(1, 1));
else if (snap_mode == SNAP_GRID)
@@ -319,7 +318,7 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
for (int i = 0; i < 8; i++) {
Vector2 tuv = endpoints[i];
- if (tuv.distance_to(Vector2(mb.x, mb.y)) < 8) {
+ if (tuv.distance_to(Vector2(mb->get_pos().x, mb->get_pos().y)) < 8) {
drag_index = i;
}
}
@@ -369,7 +368,7 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
creating = false;
}
- } else if (mb.button_index == BUTTON_RIGHT && mb.pressed) {
+ } else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
if (drag) {
drag = false;
@@ -387,18 +386,20 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
drag_index = -1;
}
}
- } else if (mb.button_index == BUTTON_WHEEL_UP && mb.pressed) {
+ } else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
_zoom_in();
- } else if (mb.button_index == BUTTON_WHEEL_DOWN && mb.pressed) {
+ } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
_zoom_out();
}
- } else if (p_input.type == InputEvent::MOUSE_MOTION) {
+ }
+
+ Ref<InputEventMouseMotion> mm = p_input;
- const InputEventMouseMotion &mm = p_input.mouse_motion;
+ if (mm.is_valid()) {
- if (mm.button_mask & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
+ if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- Vector2 draged(mm.relative_x, mm.relative_y);
+ Vector2 draged(mm->get_relative().x, mm->get_relative().y);
hscroll->set_value(hscroll->get_value() - draged.x);
vscroll->set_value(vscroll->get_value() - draged.y);
@@ -407,13 +408,13 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
if (edited_margin >= 0) {
float new_margin;
if (edited_margin == 0)
- new_margin = prev_margin + (mm.y - drag_from.y) / draw_zoom;
+ new_margin = prev_margin + (mm->get_pos().y - drag_from.y) / draw_zoom;
else if (edited_margin == 1)
- new_margin = prev_margin - (mm.y - drag_from.y) / draw_zoom;
+ new_margin = prev_margin - (mm->get_pos().y - drag_from.y) / draw_zoom;
else if (edited_margin == 2)
- new_margin = prev_margin + (mm.x - drag_from.x) / draw_zoom;
+ new_margin = prev_margin + (mm->get_pos().x - drag_from.x) / draw_zoom;
else if (edited_margin == 3)
- new_margin = prev_margin - (mm.x - drag_from.x) / draw_zoom;
+ new_margin = prev_margin - (mm->get_pos().x - drag_from.x) / draw_zoom;
if (new_margin < 0)
new_margin = 0;
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
@@ -422,7 +423,7 @@ void TextureRegionEditor::_region_input(const InputEvent &p_input) {
if (obj_styleBox.is_valid())
obj_styleBox->set_margin_size(m[edited_margin], new_margin);
} else {
- Vector2 new_pos = mtx.affine_inverse().xform(Vector2(mm.x, mm.y));
+ Vector2 new_pos = mtx.affine_inverse().xform(mm->get_pos());
if (snap_mode == SNAP_PIXEL)
new_pos = new_pos.snapped(Vector2(1, 1));
else if (snap_mode == SNAP_GRID)
@@ -678,12 +679,13 @@ void TextureRegionEditor::_edit_region() {
}
autoslice_cache.clear();
- Image i;
- if (i.load(texture->get_path()) == OK) {
+ Ref<Image> i;
+ i.instance();
+ if (i->load(texture->get_path()) == OK) {
BitMap bm;
bm.create_from_image_alpha(i);
- for (int y = 0; y < i.get_height(); y++) {
- for (int x = 0; x < i.get_width(); x++) {
+ for (int y = 0; y < i->get_height(); y++) {
+ for (int x = 0; x < i->get_width(); x++) {
if (bm.get_bit(Point2(x, y))) {
bool found = false;
for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 093e2f7d01..cb0b9fc372 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -122,7 +122,7 @@ protected:
public:
void _edit_region();
void _region_draw();
- void _region_input(const InputEvent &p_input);
+ void _region_input(const Ref<InputEvent> &p_input);
void _scroll_changed(float);
void edit(Object *p_obj);
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 9f99a9b978..9f7a41b8b6 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -179,14 +179,16 @@ void TileMapEditor::_text_changed(const String &p_text) {
_update_palette();
}
-void TileMapEditor::_sbox_input(const InputEvent &p_ie) {
+void TileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY && (p_ie.key.scancode == KEY_UP ||
- p_ie.key.scancode == KEY_DOWN ||
- p_ie.key.scancode == KEY_PAGEUP ||
- p_ie.key.scancode == KEY_PAGEDOWN)) {
+ Ref<InputEventKey> k = p_ie;
- palette->call("_gui_input", p_ie);
+ if (k.is_valid() && (k->get_scancode() == KEY_UP ||
+ k->get_scancode() == KEY_DOWN ||
+ k->get_scancode() == KEY_PAGEUP ||
+ k->get_scancode() == KEY_PAGEDOWN)) {
+
+ palette->call("_gui_input", k);
search_box->accept_event();
}
}
@@ -622,7 +624,7 @@ static inline Vector<Point2i> line(int x0, int x1, int y0, int y1) {
return points;
}
-bool TileMapEditor::forward_gui_input(const InputEvent &p_event) {
+bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree())
return false;
@@ -630,464 +632,459 @@ bool TileMapEditor::forward_gui_input(const InputEvent &p_event) {
Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform();
Transform2D xform_inv = xform.affine_inverse();
- switch (p_event.type) {
-
- case InputEvent::MOUSE_BUTTON: {
-
- const InputEventMouseButton &mb = p_event.mouse_button;
-
- if (mb.button_index == BUTTON_LEFT) {
+ Ref<InputEventMouseButton> mb = p_event;
- if (mb.pressed) {
+ if (mb.is_valid()) {
+ if (mb->get_button_index() == BUTTON_LEFT) {
- if (Input::get_singleton()->is_key_pressed(KEY_SPACE))
- return false; //drag
+ if (mb->is_pressed()) {
- if (tool == TOOL_NONE) {
+ if (Input::get_singleton()->is_key_pressed(KEY_SPACE))
+ return false; //drag
- if (mb.mod.shift) {
+ if (tool == TOOL_NONE) {
- if (mb.mod.control)
- tool = TOOL_RECTANGLE_PAINT;
- else
- tool = TOOL_LINE_PAINT;
+ if (mb->get_shift()) {
- selection_active = false;
- rectangle_begin = over_tile;
+ if (mb->get_control())
+ tool = TOOL_RECTANGLE_PAINT;
+ else
+ tool = TOOL_LINE_PAINT;
- return true;
- }
+ selection_active = false;
+ rectangle_begin = over_tile;
- if (mb.mod.control) {
+ return true;
+ }
- tool = TOOL_PICKING;
- _pick_tile(over_tile);
+ if (mb->get_control()) {
- return true;
- }
+ tool = TOOL_PICKING;
+ _pick_tile(over_tile);
- tool = TOOL_PAINTING;
+ return true;
}
- if (tool == TOOL_PAINTING) {
-
- int id = get_selected_tile();
+ tool = TOOL_PAINTING;
+ }
- if (id != TileMap::INVALID_CELL) {
+ if (tool == TOOL_PAINTING) {
- tool = TOOL_PAINTING;
+ int id = get_selected_tile();
- paint_undo.clear();
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
+ if (id != TileMap::INVALID_CELL) {
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
- }
- } else if (tool == TOOL_PICKING) {
+ tool = TOOL_PAINTING;
- _pick_tile(over_tile);
- } else if (tool == TOOL_SELECTING) {
+ paint_undo.clear();
+ paint_undo[over_tile] = _get_op_from_cell(over_tile);
- selection_active = true;
- rectangle_begin = over_tile;
+ _set_cell(over_tile, id, flip_h, flip_v, transpose);
}
+ } else if (tool == TOOL_PICKING) {
- return true;
+ _pick_tile(over_tile);
+ } else if (tool == TOOL_SELECTING) {
- } else {
+ selection_active = true;
+ rectangle_begin = over_tile;
+ }
+
+ return true;
- if (tool != TOOL_NONE) {
+ } else {
- if (tool == TOOL_PAINTING) {
+ if (tool != TOOL_NONE) {
- int id = get_selected_tile();
+ if (tool == TOOL_PAINTING) {
- if (id != TileMap::INVALID_CELL && paint_undo.size()) {
+ int id = get_selected_tile();
- undo_redo->create_action(TTR("Paint TileMap"));
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ if (id != TileMap::INVALID_CELL && paint_undo.size()) {
- Point2 p = E->key();
- undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose);
- undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
- undo_redo->commit_action();
+ undo_redo->create_action(TTR("Paint TileMap"));
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- paint_undo.clear();
+ Point2 p = E->key();
+ undo_redo->add_do_method(node, "set_cellv", p, id, flip_h, flip_v, transpose);
+ undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
}
- } else if (tool == TOOL_LINE_PAINT) {
-
- int id = get_selected_tile();
+ undo_redo->commit_action();
- if (id != TileMap::INVALID_CELL) {
+ paint_undo.clear();
+ }
+ } else if (tool == TOOL_LINE_PAINT) {
- undo_redo->create_action("Line Draw");
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ int id = get_selected_tile();
- _set_cell(E->key(), id, flip_h, flip_v, transpose, true);
- }
- undo_redo->commit_action();
+ if (id != TileMap::INVALID_CELL) {
- paint_undo.clear();
+ undo_redo->create_action("Line Draw");
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- canvas_item_editor->update();
+ _set_cell(E->key(), id, flip_h, flip_v, transpose, true);
}
- } else if (tool == TOOL_RECTANGLE_PAINT) {
-
- int id = get_selected_tile();
-
- if (id != TileMap::INVALID_CELL) {
+ undo_redo->commit_action();
- undo_redo->create_action("Rectangle Paint");
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ paint_undo.clear();
- _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true);
- }
- }
- undo_redo->commit_action();
+ canvas_item_editor->update();
+ }
+ } else if (tool == TOOL_RECTANGLE_PAINT) {
- canvas_item_editor->update();
- }
- } else if (tool == TOOL_DUPLICATING) {
+ int id = get_selected_tile();
- Point2 ofs = over_tile - rectangle.pos;
+ if (id != TileMap::INVALID_CELL) {
- undo_redo->create_action(TTR("Duplicate"));
- for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
+ undo_redo->create_action("Rectangle Paint");
+ for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
+ for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
- _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true);
+ _set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true);
+ }
}
undo_redo->commit_action();
- copydata.clear();
-
canvas_item_editor->update();
+ }
+ } else if (tool == TOOL_DUPLICATING) {
- } else if (tool == TOOL_SELECTING) {
+ Point2 ofs = over_tile - rectangle.pos;
- canvas_item_editor->update();
+ undo_redo->create_action(TTR("Duplicate"));
+ for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
- } else if (tool == TOOL_BUCKET) {
+ _set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose, true);
+ }
+ undo_redo->commit_action();
- Dictionary pop;
- pop["id"] = node->get_cell(over_tile.x, over_tile.y);
- pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
- pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
- pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
+ copydata.clear();
+
+ canvas_item_editor->update();
- PoolVector<Vector2> points = _bucket_fill(over_tile);
+ } else if (tool == TOOL_SELECTING) {
- if (points.size() == 0)
- return false;
+ canvas_item_editor->update();
- Dictionary op;
- op["id"] = get_selected_tile();
- op["flip_h"] = flip_h;
- op["flip_v"] = flip_v;
- op["transpose"] = transpose;
+ } else if (tool == TOOL_BUCKET) {
- undo_redo->create_action("Bucket Fill");
+ Dictionary pop;
+ pop["id"] = node->get_cell(over_tile.x, over_tile.y);
+ pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
+ pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
+ pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
- undo_redo->add_do_method(this, "_fill_points", points, op);
- undo_redo->add_undo_method(this, "_fill_points", points, pop);
+ PoolVector<Vector2> points = _bucket_fill(over_tile);
- undo_redo->commit_action();
- }
+ if (points.size() == 0)
+ return false;
- tool = TOOL_NONE;
+ Dictionary op;
+ op["id"] = get_selected_tile();
+ op["flip_h"] = flip_h;
+ op["flip_v"] = flip_v;
+ op["transpose"] = transpose;
- return true;
+ undo_redo->create_action("Bucket Fill");
+
+ undo_redo->add_do_method(this, "_fill_points", points, op);
+ undo_redo->add_undo_method(this, "_fill_points", points, pop);
+
+ undo_redo->commit_action();
}
- }
- } else if (mb.button_index == BUTTON_RIGHT) {
- if (mb.pressed) {
+ tool = TOOL_NONE;
- if (tool == TOOL_SELECTING || selection_active) {
+ return true;
+ }
+ }
+ } else if (mb->get_button_index() == BUTTON_RIGHT) {
- tool = TOOL_NONE;
- selection_active = false;
+ if (mb->is_pressed()) {
- canvas_item_editor->update();
+ if (tool == TOOL_SELECTING || selection_active) {
- return true;
- }
+ tool = TOOL_NONE;
+ selection_active = false;
- if (tool == TOOL_DUPLICATING) {
+ canvas_item_editor->update();
- tool = TOOL_NONE;
- copydata.clear();
+ return true;
+ }
- canvas_item_editor->update();
+ if (tool == TOOL_DUPLICATING) {
- return true;
- }
+ tool = TOOL_NONE;
+ copydata.clear();
- if (tool == TOOL_NONE) {
+ canvas_item_editor->update();
- paint_undo.clear();
+ return true;
+ }
- Point2 local = node->world_to_map(xform_inv.xform(Point2(mb.x, mb.y)));
+ if (tool == TOOL_NONE) {
- if (mb.mod.shift) {
+ paint_undo.clear();
- if (mb.mod.control)
- tool = TOOL_RECTANGLE_ERASE;
- else
- tool = TOOL_LINE_ERASE;
+ Point2 local = node->world_to_map(xform_inv.xform(mb->get_pos()));
- selection_active = false;
- rectangle_begin = local;
- } else {
+ if (mb->get_shift()) {
- tool = TOOL_ERASING;
+ if (mb->get_control())
+ tool = TOOL_RECTANGLE_ERASE;
+ else
+ tool = TOOL_LINE_ERASE;
- paint_undo[local] = _get_op_from_cell(local);
- _set_cell(local, TileMap::INVALID_CELL);
- }
+ selection_active = false;
+ rectangle_begin = local;
+ } else {
- return true;
+ tool = TOOL_ERASING;
+
+ paint_undo[local] = _get_op_from_cell(local);
+ _set_cell(local, TileMap::INVALID_CELL);
}
- } else {
- if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
+ return true;
+ }
- if (paint_undo.size()) {
- undo_redo->create_action(TTR("Erase TileMap"));
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ } else {
+ if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
- Point2 p = E->key();
- undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false);
- undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
+ if (paint_undo.size()) {
+ undo_redo->create_action(TTR("Erase TileMap"));
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- undo_redo->commit_action();
- paint_undo.clear();
+ Point2 p = E->key();
+ undo_redo->add_do_method(node, "set_cellv", p, TileMap::INVALID_CELL, false, false, false);
+ undo_redo->add_undo_method(node, "set_cellv", p, E->get().idx, E->get().xf, E->get().yf, E->get().tr);
}
- if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
- canvas_item_editor->update();
- }
+ undo_redo->commit_action();
+ paint_undo.clear();
+ }
- tool = TOOL_NONE;
+ if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
+ canvas_item_editor->update();
+ }
- return true;
+ tool = TOOL_NONE;
- } else if (tool == TOOL_BUCKET) {
+ return true;
- Dictionary pop;
- pop["id"] = node->get_cell(over_tile.x, over_tile.y);
- pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
- pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
- pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
+ } else if (tool == TOOL_BUCKET) {
- PoolVector<Vector2> points = _bucket_fill(over_tile, true);
+ Dictionary pop;
+ pop["id"] = node->get_cell(over_tile.x, over_tile.y);
+ pop["flip_h"] = node->is_cell_x_flipped(over_tile.x, over_tile.y);
+ pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y);
+ pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y);
- if (points.size() == 0)
- return false;
+ PoolVector<Vector2> points = _bucket_fill(over_tile, true);
- undo_redo->create_action("Bucket Fill");
+ if (points.size() == 0)
+ return false;
- undo_redo->add_do_method(this, "_erase_points", points);
- undo_redo->add_undo_method(this, "_fill_points", points, pop);
+ undo_redo->create_action("Bucket Fill");
- undo_redo->commit_action();
- }
+ undo_redo->add_do_method(this, "_erase_points", points);
+ undo_redo->add_undo_method(this, "_fill_points", points, pop);
+
+ undo_redo->commit_action();
}
}
- } break;
- case InputEvent::MOUSE_MOTION: {
+ }
+ }
- const InputEventMouseMotion &mm = p_event.mouse_motion;
+ Ref<InputEventMouseMotion> mm = p_event;
- Point2i new_over_tile = node->world_to_map(xform_inv.xform(Point2(mm.x, mm.y)));
+ if (mm.is_valid()) {
- if (new_over_tile != over_tile) {
+ Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_pos()));
- over_tile = new_over_tile;
- canvas_item_editor->update();
- }
+ if (new_over_tile != over_tile) {
- int tile_under = node->get_cell(over_tile.x, over_tile.y);
- String tile_name = "none";
+ over_tile = new_over_tile;
+ canvas_item_editor->update();
+ }
- if (node->get_tileset()->has_tile(tile_under))
- tile_name = node->get_tileset()->tile_get_name(tile_under);
- tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
+ int tile_under = node->get_cell(over_tile.x, over_tile.y);
+ String tile_name = "none";
- if (tool == TOOL_PAINTING) {
+ if (node->get_tileset()->has_tile(tile_under))
+ tile_name = node->get_tileset()->tile_get_name(tile_under);
+ tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
- int id = get_selected_tile();
- if (id != TileMap::INVALID_CELL) {
+ if (tool == TOOL_PAINTING) {
- if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
- }
-
- _set_cell(over_tile, id, flip_h, flip_v, transpose);
+ int id = get_selected_tile();
+ if (id != TileMap::INVALID_CELL) {
- return true;
+ if (!paint_undo.has(over_tile)) {
+ paint_undo[over_tile] = _get_op_from_cell(over_tile);
}
- }
- if (tool == TOOL_SELECTING) {
-
- _select(rectangle_begin, over_tile);
+ _set_cell(over_tile, id, flip_h, flip_v, transpose);
return true;
}
+ }
- if (tool == TOOL_LINE_PAINT || tool == TOOL_LINE_ERASE) {
+ if (tool == TOOL_SELECTING) {
- int id = get_selected_tile();
- bool erasing = (tool == TOOL_LINE_ERASE);
+ _select(rectangle_begin, over_tile);
- if (erasing && paint_undo.size()) {
+ return true;
+ }
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ if (tool == TOOL_LINE_PAINT || tool == TOOL_LINE_ERASE) {
- _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
- }
+ int id = get_selected_tile();
+ bool erasing = (tool == TOOL_LINE_ERASE);
- paint_undo.clear();
+ if (erasing && paint_undo.size()) {
+
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+
+ _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
+ }
+ }
- if (id != TileMap::INVALID_CELL) {
+ paint_undo.clear();
- Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y);
+ if (id != TileMap::INVALID_CELL) {
- for (int i = 0; i < points.size(); i++) {
+ Vector<Point2i> points = line(rectangle_begin.x, over_tile.x, rectangle_begin.y, over_tile.y);
- paint_undo[points[i]] = _get_op_from_cell(points[i]);
+ for (int i = 0; i < points.size(); i++) {
- if (erasing)
- _set_cell(points[i], TileMap::INVALID_CELL);
- }
+ paint_undo[points[i]] = _get_op_from_cell(points[i]);
- canvas_item_editor->update();
+ if (erasing)
+ _set_cell(points[i], TileMap::INVALID_CELL);
}
- return true;
+ canvas_item_editor->update();
}
- if (tool == TOOL_RECTANGLE_PAINT || tool == TOOL_RECTANGLE_ERASE) {
- _select(rectangle_begin, over_tile);
+ return true;
+ }
+ if (tool == TOOL_RECTANGLE_PAINT || tool == TOOL_RECTANGLE_ERASE) {
- if (tool == TOOL_RECTANGLE_ERASE) {
+ _select(rectangle_begin, over_tile);
- if (paint_undo.size()) {
+ if (tool == TOOL_RECTANGLE_ERASE) {
- for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ if (paint_undo.size()) {
- _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
- }
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+
+ _set_cell(E->key(), E->get().idx, E->get().xf, E->get().yf, E->get().tr);
}
+ }
- paint_undo.clear();
+ paint_undo.clear();
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
+ for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
- Point2i tile = Point2i(j, i);
- paint_undo[tile] = _get_op_from_cell(tile);
+ Point2i tile = Point2i(j, i);
+ paint_undo[tile] = _get_op_from_cell(tile);
- _set_cell(tile, TileMap::INVALID_CELL);
- }
+ _set_cell(tile, TileMap::INVALID_CELL);
}
}
-
- return true;
}
- if (tool == TOOL_ERASING) {
-
- if (!paint_undo.has(over_tile)) {
- paint_undo[over_tile] = _get_op_from_cell(over_tile);
- }
- _set_cell(over_tile, TileMap::INVALID_CELL);
+ return true;
+ }
+ if (tool == TOOL_ERASING) {
- return true;
+ if (!paint_undo.has(over_tile)) {
+ paint_undo[over_tile] = _get_op_from_cell(over_tile);
}
- if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- _pick_tile(over_tile);
+ _set_cell(over_tile, TileMap::INVALID_CELL);
- return true;
- }
- } break;
- case InputEvent::KEY: {
+ return true;
+ }
+ if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
- const InputEventKey &k = p_event.key;
+ _pick_tile(over_tile);
- if (!k.pressed)
- break;
+ return true;
+ }
+ }
- if (k.scancode == KEY_ESCAPE) {
+ Ref<InputEventKey> k = p_event;
- if (tool == TOOL_DUPLICATING)
- copydata.clear();
- else if (tool == TOOL_SELECTING || selection_active)
- selection_active = false;
+ if (k.is_valid() && k->is_pressed()) {
- tool = TOOL_NONE;
+ if (k->get_scancode() == KEY_ESCAPE) {
- canvas_item_editor->update();
+ if (tool == TOOL_DUPLICATING)
+ copydata.clear();
+ else if (tool == TOOL_SELECTING || selection_active)
+ selection_active = false;
- return true;
- }
+ tool = TOOL_NONE;
- if (tool != TOOL_NONE || !mouse_over)
- return false;
+ canvas_item_editor->update();
- if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) {
- _menu_option(OPTION_ERASE_SELECTION);
+ return true;
+ }
- return true;
- }
- if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) {
- tool = TOOL_SELECTING;
- selection_active = false;
+ if (tool != TOOL_NONE || !mouse_over)
+ return false;
- canvas_item_editor->update();
+ if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) {
+ _menu_option(OPTION_ERASE_SELECTION);
- return true;
- }
- if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) {
- _update_copydata();
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) {
+ tool = TOOL_SELECTING;
+ selection_active = false;
- if (selection_active) {
- tool = TOOL_DUPLICATING;
+ canvas_item_editor->update();
- canvas_item_editor->update();
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) {
+ _update_copydata();
- return true;
- }
- }
- if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) {
- search_box->select_all();
- search_box->grab_focus();
+ if (selection_active) {
+ tool = TOOL_DUPLICATING;
- return true;
- }
- if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) {
- flip_h = !flip_h;
- mirror_x->set_pressed(flip_h);
- canvas_item_editor->update();
- return true;
- }
- if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) {
- flip_v = !flip_v;
- mirror_y->set_pressed(flip_v);
- canvas_item_editor->update();
- return true;
- }
- if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) {
- transpose = !transpose;
- transp->set_pressed(transpose);
canvas_item_editor->update();
+
return true;
}
- } break;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) {
+ search_box->select_all();
+ search_box->grab_focus();
+
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) {
+ flip_h = !flip_h;
+ mirror_x->set_pressed(flip_h);
+ canvas_item_editor->update();
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) {
+ flip_v = !flip_v;
+ mirror_y->set_pressed(flip_v);
+ canvas_item_editor->update();
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) {
+ transpose = !transpose;
+ transp->set_pressed(transpose);
+ canvas_item_editor->update();
+ return true;
+ }
}
return false;
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 3eedb6c941..981d5c66a1 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -158,7 +158,7 @@ class TileMapEditor : public VBoxContainer {
void _text_entered(const String &p_text);
void _text_changed(const String &p_text);
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _update_palette();
void _canvas_draw();
void _menu_option(int p_option);
@@ -179,7 +179,7 @@ protected:
public:
HBoxContainer *get_toolbar() const { return toolbar; }
- bool forward_gui_input(const InputEvent &p_event);
+ bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_tile_map);
TileMapEditor(EditorNode *p_editor);
@@ -193,7 +193,7 @@ class TileMapEditorPlugin : public EditorPlugin {
TileMapEditor *tile_map_editor;
public:
- virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) { return tile_map_editor->forward_gui_input(p_event); }
+ virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) { return tile_map_editor->forward_gui_input(p_event); }
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index e79cbd0d35..0b088f7171 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -37,24 +37,18 @@ void TileSetEditor::edit(const Ref<TileSet> &p_tileset) {
tileset = p_tileset;
}
-void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
-
- if (!p_merge)
- p_library->clear();
+void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
- for (int i = 0; i < scene->get_child_count(); i++) {
+ for (int i = 0; i < p_node->get_child_count(); i++) {
- Node *child = scene->get_child(i);
+ Node *child = p_node->get_child(i);
if (!child->cast_to<Sprite>()) {
if (child->get_child_count() > 0) {
- child = child->get_child(0);
- if (!child->cast_to<Sprite>()) {
- continue;
- }
+ _import_node(child, p_library);
+ }
- } else
- continue;
+ continue;
}
Sprite *mi = child->cast_to<Sprite>();
@@ -138,6 +132,14 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
}
}
+void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
+
+ if (!p_merge)
+ p_library->clear();
+
+ _import_node(scene, p_library);
+}
+
void TileSetEditor::_menu_confirm() {
switch (option) {
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index 42084c05a3..d04ebc7197 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -59,6 +59,7 @@ class TileSetEditor : public Control {
void _menu_confirm();
void _name_dialog_confirm(const String &name);
+ static void _import_node(Node *p_node, Ref<TileSet> p_library);
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
protected:
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 40ffb8e246..d58454a223 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -754,6 +754,7 @@ ProjectExportDialog::ProjectExportDialog() {
settings_vb->add_child(runnable);
sections = memnew(TabContainer);
+ sections->set_tab_align(TabContainer::ALIGN_LEFT);
settings_vb->add_child(sections);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 289655e9da..50b518afba 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -503,14 +503,16 @@ void ProjectManager::_update_project_buttons() {
run_btn->set_disabled(!has_runnable_scene);
}
-void ProjectManager::_panel_input(const InputEvent &p_ev, Node *p_hb) {
+void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
- if (p_ev.type == InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index == BUTTON_LEFT) {
+ Ref<InputEventMouseButton> mb = p_ev;
+
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
String clicked = p_hb->get_meta("name");
String clicked_main_scene = p_hb->get_meta("main_scene");
- if (p_ev.key.mod.shift && selected_list.size() > 0 && last_clicked != "" && clicked != last_clicked) {
+ if (mb->get_shift() && selected_list.size() > 0 && last_clicked != "" && clicked != last_clicked) {
int clicked_id = -1;
int last_clicked_id = -1;
@@ -527,7 +529,7 @@ void ProjectManager::_panel_input(const InputEvent &p_ev, Node *p_hb) {
for (int i = 0; i < scroll_childs->get_child_count(); ++i) {
HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
if (!hb) continue;
- if (i != clicked_id && (i < min || i > max) && !p_ev.key.mod.control) {
+ if (i != clicked_id && (i < min || i > max) && !mb->get_control()) {
selected_list.erase(hb->get_meta("name"));
} else if (i >= min && i <= max) {
selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
@@ -535,14 +537,14 @@ void ProjectManager::_panel_input(const InputEvent &p_ev, Node *p_hb) {
}
}
- } else if (selected_list.has(clicked) && p_ev.key.mod.control) {
+ } else if (selected_list.has(clicked) && mb->get_control()) {
selected_list.erase(clicked);
} else {
last_clicked = clicked;
- if (p_ev.key.mod.control || selected_list.size() == 0) {
+ if (mb->get_control() || selected_list.size() == 0) {
selected_list.insert(clicked, clicked_main_scene);
} else {
selected_list.clear();
@@ -552,23 +554,23 @@ void ProjectManager::_panel_input(const InputEvent &p_ev, Node *p_hb) {
_update_project_buttons();
- if (p_ev.mouse_button.doubleclick)
+ if (mb->is_doubleclick())
_open_project(); //open if doubleclicked
}
}
-void ProjectManager::_unhandled_input(const InputEvent &p_ev) {
+void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
- if (p_ev.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_ev;
- const InputEventKey &k = p_ev.key;
+ if (k.is_valid()) {
- if (!k.pressed)
+ if (!k->is_pressed())
return;
bool scancode_handled = true;
- switch (k.scancode) {
+ switch (k->get_scancode()) {
case KEY_RETURN: {
@@ -606,7 +608,7 @@ void ProjectManager::_unhandled_input(const InputEvent &p_ev) {
} break;
case KEY_UP: {
- if (k.mod.shift)
+ if (k->get_shift())
break;
if (selected_list.size()) {
@@ -645,7 +647,7 @@ void ProjectManager::_unhandled_input(const InputEvent &p_ev) {
}
case KEY_DOWN: {
- if (k.mod.shift)
+ if (k->get_shift())
break;
bool found = selected_list.empty();
@@ -679,7 +681,7 @@ void ProjectManager::_unhandled_input(const InputEvent &p_ev) {
} break;
case KEY_F: {
- if (k.mod.command)
+ if (k->get_command())
this->project_filter->search_box->grab_focus();
else
scancode_handled = false;
@@ -806,11 +808,12 @@ void ProjectManager::_load_recent_projects() {
if (cf->has_section_key("application", "icon")) {
String appicon = cf->get_value("application", "icon");
if (appicon != "") {
- Image img;
- Error err = img.load(appicon.replace_first("res://", path + "/"));
+ Ref<Image> img;
+ img.instance();
+ Error err = img->load(appicon.replace_first("res://", path + "/"));
if (err == OK) {
- img.resize(64, 64);
+ img->resize(64, 64);
Ref<ImageTexture> it = memnew(ImageTexture);
it->create_from_image(img);
icon = it;
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 5be28ce2f0..27886132c5 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -91,8 +91,8 @@ class ProjectManager : public Control {
void _install_project(const String &p_zip_path, const String &p_title);
void _panel_draw(Node *p_hb);
- void _panel_input(const InputEvent &p_ev, Node *p_hb);
- void _unhandled_input(const InputEvent &p_ev);
+ void _panel_input(const Ref<InputEvent> &p_ev, Node *p_hb);
+ void _unhandled_input(const Ref<InputEvent> &p_ev);
void _favorite_pressed(Node *p_hb);
void _files_dropped(PoolStringArray p_files, int p_screen);
void _scan_multiple_folders(PoolStringArray p_files);
diff --git a/editor/project_settings.cpp b/editor/project_settings.cpp
index 152e72ca44..1c4ca3cb58 100644
--- a/editor/project_settings.cpp
+++ b/editor/project_settings.cpp
@@ -78,15 +78,15 @@ void ProjectSettings::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
globals_editor->edit(GlobalConfig::get_singleton());
- search_button->set_icon(get_icon("Search", "EditorIcons"));
+ search_button->set_icon(get_icon("Zoom", "EditorIcons"));
clear_button->set_icon(get_icon("Close", "EditorIcons"));
translation_list->connect("button_pressed", this, "_translation_delete");
_update_actions();
- popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), InputEvent::KEY); //"Key " - because the word 'key' has already been used as a key animation
- popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), InputEvent::JOYPAD_BUTTON);
- popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), InputEvent::JOYPAD_MOTION);
- popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), InputEvent::MOUSE_BUTTON);
+ popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
+ popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
+ popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
+ popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
List<String> tfn;
ResourceLoader::get_recognized_extensions_for_type("Translation", &tfn);
@@ -106,6 +106,9 @@ void ProjectSettings::_notification(int p_what) {
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
} break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ _update_actions();
+ } break;
}
}
@@ -175,54 +178,74 @@ void ProjectSettings::_action_edited() {
void ProjectSettings::_device_input_add() {
- InputEvent ie;
+ Ref<InputEvent> ie;
String name = add_at;
Variant old_val = GlobalConfig::get_singleton()->get(name);
Array arr = old_val;
- ie.device = device_id->get_value();
-
- ie.type = add_type;
+ // ie.device = device_id->get_value();
+ // ie.type = add_type;
switch (add_type) {
- case InputEvent::MOUSE_BUTTON: {
+ case INPUT_MOUSE_BUTTON: {
- ie.mouse_button.button_index = device_index->get_selected() + 1;
+ Ref<InputEventMouseButton> mb;
+ mb.instance();
+ mb->set_button_index(device_index->get_selected() + 1);
+ mb->set_device(device_id->get_value());
for (int i = 0; i < arr.size(); i++) {
- InputEvent aie = arr[i];
- if (aie.device == ie.device && aie.type == InputEvent::MOUSE_BUTTON && aie.mouse_button.button_index == ie.mouse_button.button_index) {
+ Ref<InputEventMouseButton> aie = arr[i];
+ if (aie.is_null())
+ continue;
+ if (aie->get_device() == mb->get_device() && aie->get_button_index() == mb->get_button_index()) {
return;
}
}
+ ie = mb;
+
} break;
- case InputEvent::JOYPAD_MOTION: {
+ case INPUT_JOY_MOTION: {
- ie.joy_motion.axis = device_index->get_selected() >> 1;
- ie.joy_motion.axis_value = device_index->get_selected() & 1 ? 1 : -1;
+ Ref<InputEventJoypadMotion> jm;
+ jm.instance();
+ jm->set_axis(device_index->get_selected() >> 1);
+ jm->set_axis_value(device_index->get_selected() & 1 ? 1 : -1);
+ jm->set_device(device_id->get_value());
for (int i = 0; i < arr.size(); i++) {
- InputEvent aie = arr[i];
- if (aie.device == ie.device && aie.type == InputEvent::JOYPAD_MOTION && aie.joy_motion.axis == ie.joy_motion.axis && aie.joy_motion.axis_value == ie.joy_motion.axis_value) {
+ Ref<InputEventJoypadMotion> aie = arr[i];
+ if (aie.is_null())
+ continue;
+ if (aie->get_device() == jm->get_device() && aie->get_axis() == jm->get_axis() && aie->get_axis_value() == jm->get_axis_value()) {
return;
}
}
+ ie = jm;
+
} break;
- case InputEvent::JOYPAD_BUTTON: {
+ case INPUT_JOY_BUTTON: {
+
+ Ref<InputEventJoypadButton> jb;
+ jb.instance();
- ie.joy_button.button_index = device_index->get_selected();
+ jb->set_button_index(device_index->get_selected());
+ jb->set_device(device_id->get_value());
for (int i = 0; i < arr.size(); i++) {
- InputEvent aie = arr[i];
- if (aie.device == ie.device && aie.type == InputEvent::JOYPAD_BUTTON && aie.joy_button.button_index == ie.joy_button.button_index) {
+ Ref<InputEventJoypadButton> aie = arr[i];
+ if (aie.is_null())
+ continue;
+ if (aie->get_device() == jb->get_device() && aie->get_button_index() == jb->get_button_index()) {
return;
}
}
+ ie = jb;
} break;
default: {}
@@ -244,13 +267,17 @@ void ProjectSettings::_device_input_add() {
void ProjectSettings::_press_a_key_confirm() {
- if (last_wait_for_key.type != InputEvent::KEY)
+ if (last_wait_for_key.is_null())
return;
- InputEvent ie;
- ie.type = InputEvent::KEY;
- ie.key.scancode = last_wait_for_key.key.scancode;
- ie.key.mod = last_wait_for_key.key.mod;
+ Ref<InputEventKey> ie;
+ ie.instance();
+ ie->set_scancode(last_wait_for_key->get_scancode());
+ ie->set_shift(last_wait_for_key->get_shift());
+ ie->set_alt(last_wait_for_key->get_alt());
+ ie->set_control(last_wait_for_key->get_control());
+ ie->set_metakey(last_wait_for_key->get_metakey());
+
String name = add_at;
Variant old_val = GlobalConfig::get_singleton()->get(name);
@@ -258,8 +285,10 @@ void ProjectSettings::_press_a_key_confirm() {
for (int i = 0; i < arr.size(); i++) {
- InputEvent aie = arr[i];
- if (aie.type == InputEvent::KEY && aie.key.scancode == ie.key.scancode && aie.key.mod == ie.key.mod) {
+ Ref<InputEventKey> aie = arr[i];
+ if (aie.is_null())
+ continue;
+ if (aie->get_scancode_with_modifiers() == ie->get_scancode_with_modifiers()) {
return;
}
}
@@ -278,7 +307,7 @@ void ProjectSettings::_press_a_key_confirm() {
_show_last_added(ie, name);
}
-void ProjectSettings::_show_last_added(const InputEvent &p_event, const String &p_name) {
+void ProjectSettings::_show_last_added(const Ref<InputEvent> &p_event, const String &p_name) {
TreeItem *r = input_editor->get_root();
String name = p_name;
@@ -311,19 +340,21 @@ void ProjectSettings::_show_last_added(const InputEvent &p_event, const String &
if (found) input_editor->ensure_cursor_is_visible();
}
-void ProjectSettings::_wait_for_key(const InputEvent &p_event) {
+void ProjectSettings::_wait_for_key(const Ref<InputEvent> &p_event) {
+
+ Ref<InputEventKey> k = p_event;
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode != 0) {
+ if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) {
last_wait_for_key = p_event;
- String str = keycode_get_string(p_event.key.scancode).capitalize();
- if (p_event.key.mod.meta)
+ String str = keycode_get_string(k->get_scancode()).capitalize();
+ if (k->get_metakey())
str = TTR("Meta+") + str;
- if (p_event.key.mod.shift)
+ if (k->get_shift())
str = TTR("Shift+") + str;
- if (p_event.key.mod.alt)
+ if (k->get_alt())
str = TTR("Alt+") + str;
- if (p_event.key.mod.control)
+ if (k->get_control())
str = TTR("Control+") + str;
press_a_key_label->set_text(str);
@@ -333,18 +364,18 @@ void ProjectSettings::_wait_for_key(const InputEvent &p_event) {
void ProjectSettings::_add_item(int p_item) {
- add_type = InputEvent::Type(p_item);
+ add_type = InputType(p_item);
switch (add_type) {
- case InputEvent::KEY: {
+ case INPUT_KEY: {
press_a_key_label->set_text(TTR("Press a Key.."));
- last_wait_for_key = InputEvent();
+ last_wait_for_key = Ref<InputEvent>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
press_a_key->grab_focus();
} break;
- case InputEvent::MOUSE_BUTTON: {
+ case INPUT_MOUSE_BUTTON: {
device_id->set_value(0);
device_index_label->set_text(TTR("Mouse Button Index:"));
@@ -360,7 +391,7 @@ void ProjectSettings::_add_item(int p_item) {
device_index->add_item(TTR("Button 9"));
device_input->popup_centered_minsize(Size2(350, 95));
} break;
- case InputEvent::JOYPAD_MOTION: {
+ case INPUT_JOY_MOTION: {
device_id->set_value(0);
device_index_label->set_text(TTR("Joypad Axis Index:"));
@@ -373,7 +404,7 @@ void ProjectSettings::_add_item(int p_item) {
device_input->popup_centered_minsize(Size2(350, 95));
} break;
- case InputEvent::JOYPAD_BUTTON: {
+ case INPUT_JOY_BUTTON: {
device_id->set_value(0);
device_index_label->set_text(TTR("Joypad Button Index:"));
@@ -493,65 +524,70 @@ void ProjectSettings::_update_actions() {
for (int i = 0; i < actions.size(); i++) {
- if (actions[i].get_type() != Variant::INPUT_EVENT)
+ Ref<InputEvent> ie = actions[i];
+ if (ie.is_null())
continue;
- InputEvent ie = actions[i];
TreeItem *action = input_editor->create_item(item);
- switch (ie.type) {
-
- case InputEvent::KEY: {
-
- String str = keycode_get_string(ie.key.scancode).capitalize();
- if (ie.key.mod.meta)
- str = TTR("Meta+") + str;
- if (ie.key.mod.shift)
- str = TTR("Shift+") + str;
- if (ie.key.mod.alt)
- str = TTR("Alt+") + str;
- if (ie.key.mod.control)
- str = TTR("Control+") + str;
-
- action->set_text(0, str);
- action->set_icon(0, get_icon("Keyboard", "EditorIcons"));
-
- } break;
- case InputEvent::JOYPAD_BUTTON: {
-
- String str = TTR("Device") + " " + itos(ie.device) + ", " + TTR("Button") + " " + itos(ie.joy_button.button_index);
- if (ie.joy_button.button_index >= 0 && ie.joy_button.button_index < JOY_BUTTON_MAX)
- str += String() + " (" + _button_names[ie.joy_button.button_index] + ").";
- else
- str += ".";
-
- action->set_text(0, str);
- action->set_icon(0, get_icon("JoyButton", "EditorIcons"));
- } break;
- case InputEvent::MOUSE_BUTTON: {
-
- String str = TTR("Device") + " " + itos(ie.device) + ", ";
- switch (ie.mouse_button.button_index) {
- case BUTTON_LEFT: str += TTR("Left Button."); break;
- case BUTTON_RIGHT: str += TTR("Right Button."); break;
- case BUTTON_MIDDLE: str += TTR("Middle Button."); break;
- case BUTTON_WHEEL_UP: str += TTR("Wheel Up."); break;
- case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down."); break;
- default: str += TTR("Button") + " " + itos(ie.mouse_button.button_index) + ".";
- }
-
- action->set_text(0, str);
- action->set_icon(0, get_icon("Mouse", "EditorIcons"));
- } break;
- case InputEvent::JOYPAD_MOTION: {
-
- int ax = ie.joy_motion.axis;
- int n = 2 * ax + (ie.joy_motion.axis_value < 0 ? 0 : 1);
- String desc = _axis_names[n];
- String str = TTR("Device") + " " + itos(ie.device) + ", " + TTR("Axis") + " " + itos(ax) + " " + (ie.joy_motion.axis_value < 0 ? "-" : "+") + desc + ".";
- action->set_text(0, str);
- action->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
- } break;
+ Ref<InputEventKey> k = ie;
+ if (k.is_valid()) {
+
+ String str = keycode_get_string(k->get_scancode()).capitalize();
+ if (k->get_metakey())
+ str = TTR("Meta+") + str;
+ if (k->get_shift())
+ str = TTR("Shift+") + str;
+ if (k->get_alt())
+ str = TTR("Alt+") + str;
+ if (k->get_control())
+ str = TTR("Control+") + str;
+
+ action->set_text(0, str);
+ action->set_icon(0, get_icon("Keyboard", "EditorIcons"));
+ }
+
+ Ref<InputEventJoypadButton> jb = ie;
+
+ if (jb.is_valid()) {
+
+ String str = TTR("Device") + " " + itos(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index());
+ if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX)
+ str += String() + " (" + _button_names[jb->get_button_index()] + ").";
+ else
+ str += ".";
+
+ action->set_text(0, str);
+ action->set_icon(0, get_icon("JoyButton", "EditorIcons"));
+ }
+
+ Ref<InputEventMouseButton> mb = ie;
+
+ if (mb.is_valid()) {
+ String str = TTR("Device") + " " + itos(mb->get_device()) + ", ";
+ switch (mb->get_button_index()) {
+ case BUTTON_LEFT: str += TTR("Left Button."); break;
+ case BUTTON_RIGHT: str += TTR("Right Button."); break;
+ case BUTTON_MIDDLE: str += TTR("Middle Button."); break;
+ case BUTTON_WHEEL_UP: str += TTR("Wheel Up."); break;
+ case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down."); break;
+ default: str += TTR("Button") + " " + itos(mb->get_button_index()) + ".";
+ }
+
+ action->set_text(0, str);
+ action->set_icon(0, get_icon("Mouse", "EditorIcons"));
+ }
+
+ Ref<InputEventJoypadMotion> jm = ie;
+
+ if (jm.is_valid()) {
+
+ int ax = jm->get_axis();
+ int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
+ String desc = _axis_names[n];
+ String str = TTR("Device") + " " + itos(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc + ".";
+ action->set_text(0, str);
+ action->set_icon(0, get_icon("JoyAxis", "EditorIcons"));
}
action->add_button(0, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove"));
action->set_metadata(0, i);
@@ -1174,6 +1210,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
data = p_data;
tab_container = memnew(TabContainer);
+ tab_container->set_tab_align(TabContainer::ALIGN_LEFT);
add_child(tab_container);
//set_child_rect(tab_container);
@@ -1415,6 +1452,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
//translations
TabContainer *translations = memnew(TabContainer);
+ translations->set_tab_align(TabContainer::ALIGN_LEFT);
translations->set_name(TTR("Localization"));
tab_container->add_child(translations);
diff --git a/editor/project_settings.h b/editor/project_settings.h
index a5a9e04250..47fb45cf8e 100644
--- a/editor/project_settings.h
+++ b/editor/project_settings.h
@@ -43,10 +43,17 @@
class ProjectSettings : public AcceptDialog {
GDCLASS(ProjectSettings, AcceptDialog);
+ enum InputType {
+ INPUT_KEY,
+ INPUT_JOY_BUTTON,
+ INPUT_JOY_MOTION,
+ INPUT_MOUSE_BUTTON
+ };
+
TabContainer *tab_container;
Timer *timer;
- InputEvent::Type add_type;
+ InputType add_type;
String add_at;
EditorData *data;
@@ -77,7 +84,7 @@ class ProjectSettings : public AcceptDialog {
bool setting;
bool updating_translations;
- InputEvent last_wait_for_key;
+ Ref<InputEventKey> last_wait_for_key;
EditorFileDialog *translation_file_open;
Tree *translation_list;
@@ -108,9 +115,9 @@ class ProjectSettings : public AcceptDialog {
void _action_selected();
void _action_edited();
void _action_button_pressed(Object *p_obj, int p_column, int p_id);
- void _wait_for_key(const InputEvent &p_event);
+ void _wait_for_key(const Ref<InputEvent> &p_event);
void _press_a_key_confirm();
- void _show_last_added(const InputEvent &p_event, const String &p_name);
+ void _show_last_added(const Ref<InputEvent> &p_event, const String &p_name);
void _settings_prop_edited(const String &p_name);
void _settings_changed();
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 3dd9ba080c..1c8a1c0ee0 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -609,12 +609,9 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
type = Variant::Type(Variant::Type(i));
}
}
- InputEvent::Type iet = InputEvent::NONE;
- if (hint_text.find(".") != -1) {
- iet = InputEvent::Type(int(hint_text.get_slice(".", 1).to_int()));
- }
+
if (type)
- property_select->select_property_from_basic_type(type, iet, v);
+ property_select->select_property_from_basic_type(type, v);
updating = false;
return false;
@@ -861,15 +858,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
*/
} break;
- case Variant::IMAGE: {
-
- List<String> names;
- names.push_back(TTR("New"));
- names.push_back(TTR("Load"));
- names.push_back(TTR("Clear"));
- config_action_buttons(names);
- } break;
case Variant::NODE_PATH: {
List<String> names;
@@ -987,9 +976,6 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
return false;
} break;
- case Variant::INPUT_EVENT: {
-
- } break;
case Variant::DICTIONARY: {
} break;
@@ -1061,16 +1047,6 @@ void CustomPropertyEditor::_file_selected(String p_file) {
emit_signal("variant_changed");
hide();
} break;
- case Variant::IMAGE: {
-
- Image image;
- Error err = ImageLoader::load_image(p_file, &image);
- ERR_EXPLAIN(TTR("Couldn't load image"));
- ERR_FAIL_COND(err);
- v = image;
- emit_signal("variant_changed");
- hide();
- } break;
default: {}
}
}
@@ -1387,36 +1363,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
}
} break;
- case Variant::IMAGE: {
-
- if (p_which == 0) {
- //new image too difficult
- ERR_PRINT("New Image Unimplemented");
- } else if (p_which == 1) {
-
- file->set_access(EditorFileDialog::ACCESS_RESOURCES);
- file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- List<String> extensions;
- ImageLoader::get_recognized_extensions(&extensions);
-
- file->clear_filters();
-
- for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
-
- file->add_filter("*." + E->get() + " ; " + E->get().to_upper());
- }
-
- file->popup_centered_ratio();
-
- } else if (p_which == 2) {
-
- v = Image();
- emit_signal("variant_changed");
- hide();
- }
-
- } break;
default: {};
}
}
@@ -1448,11 +1395,13 @@ void CustomPropertyEditor::_scroll_modified(double p_value) {
*/
}
-void CustomPropertyEditor::_drag_easing(const InputEvent &p_ev) {
+void CustomPropertyEditor::_drag_easing(const Ref<InputEvent> &p_ev) {
+
+ Ref<InputEventMouseMotion> mm = p_ev;
- if (p_ev.type == InputEvent::MOUSE_MOTION && p_ev.mouse_motion.button_mask & BUTTON_MASK_LEFT) {
+ if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
- float rel = p_ev.mouse_motion.relative_x;
+ float rel = mm->get_relative().x;
if (rel == 0)
return;
@@ -1481,8 +1430,8 @@ void CustomPropertyEditor::_drag_easing(const InputEvent &p_ev) {
//emit_signal("variant_changed");
emit_signal("variant_changed");
}
- if (p_ev.type == InputEvent::MOUSE_BUTTON && p_ev.mouse_button.button_index == BUTTON_LEFT) {
- }
+ // if (p_ev.type == Ref<InputEvent>::MOUSE_BUTTON && p_ev->get_button_index() == BUTTON_LEFT) {
+ // }
}
void CustomPropertyEditor::_draw_easing() {
@@ -1756,17 +1705,12 @@ void CustomPropertyEditor::_modified(String p_string) {
emit_signal("variant_changed");
*/
} break;
- case Variant::IMAGE: {
- } break;
case Variant::NODE_PATH: {
v = NodePath(value_editor[0]->get_text());
emit_signal("variant_changed");
} break;
- case Variant::INPUT_EVENT: {
-
- } break;
case Variant::DICTIONARY: {
} break;
@@ -2357,15 +2301,6 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p
//p_item->set_text(1,obj->get(p_name));
} break;
- case Variant::IMAGE: {
-
- Image img = obj->get(p_name);
- if (img.empty())
- p_item->set_text(1, "[Image (empty)]");
- else
- p_item->set_text(1, "[Image " + itos(img.get_width()) + "x" + itos(img.get_height()) + "-" + String(Image::get_format_name(img.get_format())) + "]");
-
- } break;
case Variant::NODE_PATH: {
p_item->set_text(1, obj->get(p_name));
@@ -2750,6 +2685,10 @@ void PropertyEditor::_notification(int p_what) {
changing = false;
}
+
+ if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
+ update_tree();
+ }
}
TreeItem *PropertyEditor::get_parent_node(String p_path, HashMap<String, TreeItem *> &item_paths, TreeItem *root) {
@@ -3588,19 +3527,7 @@ void PropertyEditor::update_tree() {
item->set_icon(0, get_icon("Color", "EditorIcons"));
} break;
- case Variant::IMAGE: {
-
- item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
- item->set_editable(1, !read_only);
- Image img = obj->get(p.name);
- if (img.empty())
- item->set_text(1, "[Image (empty)]");
- else
- item->set_text(1, "[Image " + itos(img.get_width()) + "x" + itos(img.get_height()) + "-" + String(Image::get_format_name(img.get_format())) + "]");
- if (show_type_icons)
- item->set_icon(0, get_icon("Image", "EditorIcons"));
- } break;
case Variant::NODE_PATH: {
item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
@@ -3922,17 +3849,12 @@ void PropertyEditor::_item_edited() {
case Variant::COLOR: {
//_edit_set(name,item->get_custom_bg_color(0));
} break;
- case Variant::IMAGE: {
- } break;
case Variant::NODE_PATH: {
_edit_set(name, NodePath(item->get_text(1)), refresh_all);
} break;
- case Variant::INPUT_EVENT: {
-
- } break;
case Variant::DICTIONARY: {
} break;
diff --git a/editor/property_editor.h b/editor/property_editor.h
index b88ba38e19..c02c301acf 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -134,7 +134,7 @@ class CustomPropertyEditor : public Popup {
void _draw_easing();
void _menu_option(int p_which);
- void _drag_easing(const InputEvent &p_ev);
+ void _drag_easing(const Ref<InputEvent> &p_ev);
void _node_path_selected(NodePath p_path);
void show_value_editors(int p_amount);
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 565d25e0e5..47e5994e3f 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -37,17 +37,19 @@ void PropertySelector::_text_changed(const String &p_newtext) {
_update_search();
}
-void PropertySelector::_sbox_input(const InputEvent &p_ie) {
+void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_ie;
- switch (p_ie.key.scancode) {
+ if (k.is_valid()) {
+
+ switch (k->get_scancode()) {
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", p_ie);
+ search_options->call("_gui_input", k);
search_box->accept_event();
TreeItem *root = search_options->get_root();
@@ -89,14 +91,8 @@ void PropertySelector::_update_search() {
instance->get_property_list(&props, true);
} else if (type != Variant::NIL) {
Variant v;
- if (type == Variant::INPUT_EVENT) {
- InputEvent ie;
- ie.type = event_type;
- v = ie;
- } else {
- Variant::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
- }
+ Variant::CallError ce;
+ v = Variant::construct(type, NULL, 0, ce);
v.get_property_list(&props);
} else {
@@ -136,11 +132,9 @@ void PropertySelector::_update_search() {
Control::get_icon("MiniMatrix3", "EditorIcons"),
Control::get_icon("MiniTransform", "EditorIcons"),
Control::get_icon("MiniColor", "EditorIcons"),
- Control::get_icon("MiniImage", "EditorIcons"),
Control::get_icon("MiniPath", "EditorIcons"),
Control::get_icon("MiniRid", "EditorIcons"),
Control::get_icon("MiniObject", "EditorIcons"),
- Control::get_icon("MiniInput", "EditorIcons"),
Control::get_icon("MiniDictionary", "EditorIcons"),
Control::get_icon("MiniArray", "EditorIcons"),
Control::get_icon("MiniRawArray", "EditorIcons"),
@@ -326,22 +320,7 @@ void PropertySelector::_item_selected() {
String name = item->get_metadata(0);
String class_type;
- if (properties && type == Variant::INPUT_EVENT) {
-
- switch (event_type) {
- case InputEvent::NONE: class_type = "InputEvent"; break;
- case InputEvent::KEY: class_type = "InputEventKey"; break;
- case InputEvent::MOUSE_MOTION: class_type = "InputEventMouseMotion"; break;
- case InputEvent::MOUSE_BUTTON: class_type = "InputEventMouseButton"; break;
- case InputEvent::JOYPAD_MOTION: class_type = "InputEventJoypadMotion"; break;
- case InputEvent::JOYPAD_BUTTON: class_type = "InputEventJoypadButton"; break;
- case InputEvent::SCREEN_TOUCH: class_type = "InputEventScreenTouch"; break;
- case InputEvent::SCREEN_DRAG: class_type = "InputEventScreenDrag"; break;
- case InputEvent::ACTION: class_type = "InputEventAction"; break;
- default: {}
- }
-
- } else if (type) {
+ if (type) {
class_type = Variant::get_type_name(type);
} else {
@@ -515,13 +494,12 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script,
search_box->grab_focus();
_update_search();
}
-void PropertySelector::select_property_from_basic_type(Variant::Type p_type, InputEvent::Type p_event_type, const String &p_current) {
+void PropertySelector::select_property_from_basic_type(Variant::Type p_type, const String &p_current) {
ERR_FAIL_COND(p_type == Variant::NIL);
base_type = "";
selected = p_current;
type = p_type;
- event_type = p_event_type;
script = 0;
properties = true;
instance = NULL;
diff --git a/editor/property_selector.h b/editor/property_selector.h
index 6dc2592176..def791a3fd 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -42,7 +42,7 @@ class PropertySelector : public ConfirmationDialog {
void _update_search();
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _confirmed();
void _text_changed(const String &p_newtext);
@@ -52,7 +52,6 @@ class PropertySelector : public ConfirmationDialog {
bool properties;
String selected;
Variant::Type type;
- InputEvent::Type event_type;
String base_type;
ObjectID script;
Object *instance;
@@ -71,7 +70,7 @@ public:
void select_property_from_base_type(const String &p_base, const String &p_current = "");
void select_property_from_script(const Ref<Script> &p_script, const String &p_current = "");
- void select_property_from_basic_type(Variant::Type p_type, InputEvent::Type p_event_type, const String &p_current = "");
+ void select_property_from_basic_type(Variant::Type p_type, const String &p_current = "");
void select_property_from_instance(Object *p_instance, const String &p_current = "");
PropertySelector();
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index 6edcd60188..ef875bbead 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -89,7 +89,7 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
args.push_back("-m");
Ref<ImageTexture> t = memnew(ImageTexture);
- t->create_from_image(*p_image, 0);
+ t->create_from_image(Ref<Image>(p_image), 0);
ResourceSaver::save(src_img, t);
Error err = OS::get_singleton()->execute(ttpath, args, true);
@@ -101,7 +101,7 @@ static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
ERR_EXPLAIN(TTR("Can't load back converted image using PVRTC tool:") + " " + dst_img);
ERR_FAIL_COND(t.is_null());
- *p_image = t->get_data();
+ p_image->copy_internals_from(t->get_data());
}
static void _compress_pvrtc2(Image *p_image) {
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index 7fce485f3a..7fb9666afb 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -77,17 +77,18 @@ void EditorQuickOpen::_text_changed(const String &p_newtext) {
_update_search();
}
-void EditorQuickOpen::_sbox_input(const InputEvent &p_ie) {
+void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
- if (p_ie.type == InputEvent::KEY) {
+ Ref<InputEventKey> k = p_ie;
+ if (k.is_valid()) {
- switch (p_ie.key.scancode) {
+ switch (k->get_scancode()) {
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", p_ie);
+ search_options->call("_gui_input", k);
search_box->accept_event();
TreeItem *root = search_options->get_root();
diff --git a/editor/quick_open.h b/editor/quick_open.h
index 0e5766033f..44f8c025e6 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -47,7 +47,7 @@ class EditorQuickOpen : public ConfirmationDialog {
void _update_search();
- void _sbox_input(const InputEvent &p_ie);
+ void _sbox_input(const Ref<InputEvent> &p_ie);
void _parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture> > > &list);
float _path_cmp(String search, String path) const;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 835243e401..0f05cc79ff 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -52,19 +52,21 @@ void SceneTreeDock::_nodes_drag_begin() {
}
}
-void SceneTreeDock::_input(InputEvent p_event) {
+void SceneTreeDock::_input(Ref<InputEvent> p_event) {
- if (p_event.type == InputEvent::MOUSE_BUTTON && !p_event.mouse_button.pressed && p_event.mouse_button.button_index == BUTTON_LEFT) {
+ Ref<InputEventMouseButton> mb = p_event;
+
+ if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
restore_script_editor_on_drag = false; //lost chance
}
}
-void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
+void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
if (get_viewport()->get_modal_stack_top())
return; //ignore because of modal window
- if (!p_event.key.pressed || p_event.key.echo)
+ if (!p_event->is_pressed() || p_event->is_echo())
return;
if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
@@ -680,8 +682,6 @@ void SceneTreeDock::_notification(int p_what) {
button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons"));
button_clear_script->set_icon(get_icon("ScriptRemove", "EditorIcons"));
- filter_icon->set_texture(get_icon("Zoom", "EditorIcons"));
-
filter_icon->set_texture(get_icon("Search", "EditorIcons"));
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", this, "_selection_changed");
@@ -1829,6 +1829,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
filter->set_h_size_flags(SIZE_EXPAND_FILL);
filter_hbc->add_child(filter);
filter_icon = memnew(TextureRect);
+ filter_icon->set_custom_minimum_size(Size2(24 * EDSCALE, 0));
filter_hbc->add_child(filter_icon);
filter_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
filter->connect("text_changed", this, "_filter_changed");
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index de6b81d44a..f190025dd6 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -133,8 +133,8 @@ class SceneTreeDock : public VBoxContainer {
void _node_prerenamed(Node *p_node, const String &p_new_name);
void _nodes_drag_begin();
- void _input(InputEvent p_event);
- void _unhandled_key_input(InputEvent p_event);
+ void _input(Ref<InputEvent> p_event);
+ void _unhandled_key_input(Ref<InputEvent> p_event);
void _import_subscene();
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 1e86d8db4b..2220e3330f 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -539,10 +539,12 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Margins */
empty_h = memnew(Control);
+ empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
empty_v = memnew(Control);
+ empty_v->set_name("empty_v");
empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index ebf4b1cf3a..a2bb3a0879 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1019,6 +1019,11 @@ void ScriptEditorDebugger::_notification(int p_what) {
}
} break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
+ tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
+ tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
+ } break;
}
}
@@ -1574,9 +1579,10 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
editor = p_editor;
tabs = memnew(TabContainer);
- tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("EditorPanelDebugger", "EditorStyles"));
- tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("EditorTabFGDebugger", "EditorStyles"));
- tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("EditorTabBGDebugger", "EditorStyles"));
+ tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
+ tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
+ tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
tabs->set_area_as_parent_rect();
add_child(tabs);
@@ -1601,13 +1607,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
step = memnew(Button);
- step->set_flat(true);
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
step->connect("pressed", this, "debug_step");
next = memnew(Button);
- next->set_flat(true);
hbc->add_child(next);
next->set_tooltip(TTR("Step Over"));
next->connect("pressed", this, "debug_next");
@@ -1615,13 +1619,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
dobreak = memnew(Button);
- dobreak->set_flat(true);
hbc->add_child(dobreak);
dobreak->set_tooltip(TTR("Break"));
dobreak->connect("pressed", this, "debug_break");
docontinue = memnew(Button);
- docontinue->set_flat(true);
hbc->add_child(docontinue);
docontinue->set_tooltip(TTR("Continue"));
docontinue->connect("pressed", this, "debug_continue");
@@ -1629,13 +1631,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
//hbc->add_child( memnew( VSeparator) );
back = memnew(Button);
- back->set_flat(true);
hbc->add_child(back);
back->set_tooltip(TTR("Inspect Previous Instance"));
back->hide();
forward = memnew(Button);
- forward->set_flat(true);
hbc->add_child(forward);
forward->set_tooltip(TTR("Inspect Next Instance"));
forward->hide();
@@ -1798,7 +1798,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_total->set_custom_minimum_size(Size2(100, 1) * EDSCALE);
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew(Button);
- vmem_refresh->set_flat(true);
vmem_hb->add_child(vmem_refresh);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed", this, "_video_mem_request");
@@ -1831,35 +1830,30 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ // misc
-
- GridContainer *grid_cont = memnew(GridContainer);
- grid_cont->set_h_size_flags(SIZE_EXPAND_FILL);
- grid_cont->set_name(TTR("Misc"));
- grid_cont->set_columns(2);
- tabs->add_child(grid_cont);
-
- grid_cont->add_child(memnew(Label(TTR("Clicked Control:"))));
+ VBoxContainer *info_left = memnew(VBoxContainer);
+ info_left->set_h_size_flags(SIZE_EXPAND_FILL);
+ info_left->set_name(TTR("Misc"));
+ tabs->add_child(info_left);
clicked_ctrl = memnew(LineEdit);
- grid_cont->add_child(clicked_ctrl);
-
- grid_cont->add_child(memnew(Label(TTR("Clicked Control Type:"))));
+ info_left->add_margin_child(TTR("Clicked Control:"), clicked_ctrl);
clicked_ctrl_type = memnew(LineEdit);
- grid_cont->add_child(clicked_ctrl_type);
+ info_left->add_margin_child(TTR("Clicked Control Type:"), clicked_ctrl_type);
live_edit_root = memnew(LineEdit);
- live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL);
{
- grid_cont->add_child(memnew(Label(TTR("Live Edit Root:"))));
-
HBoxContainer *lehb = memnew(HBoxContainer);
- lehb->set_h_size_flags(SIZE_EXPAND_FILL);
- lehb->add_child(live_edit_root);
+ Label *l = memnew(Label(TTR("Live Edit Root:")));
+ lehb->add_child(l);
+ l->set_h_size_flags(SIZE_EXPAND_FILL);
le_set = memnew(Button(TTR("Set From Tree")));
lehb->add_child(le_set);
le_clear = memnew(Button(TTR("Clear")));
lehb->add_child(le_clear);
- grid_cont->add_child(lehb);
+ 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);
}
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 8c87857944..563de78415 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -148,7 +148,7 @@ void EditorSettingsDialog::_update_shortcuts() {
if (!sc->has_meta("original"))
continue;
- InputEvent original = sc->get_meta("original");
+ Ref<InputEvent> original = sc->get_meta("original");
String section_name = E->get().get_slice("/", 0);
@@ -170,7 +170,7 @@ void EditorSettingsDialog::_update_shortcuts() {
item->set_text(0, sc->get_name());
item->set_text(1, sc->get_as_text());
- if (!sc->is_shortcut(original) && !(sc->get_shortcut().type == InputEvent::NONE && original.type == InputEvent::NONE)) {
+ if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) {
item->add_button(1, get_icon("Reload", "EditorIcons"), 2);
}
item->add_button(1, get_icon("Edit", "EditorIcons"), 0);
@@ -199,7 +199,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
if (p_idx == 0) {
press_a_key_label->set_text(TTR("Press a Key.."));
- last_wait_for_key = InputEvent();
+ last_wait_for_key = Ref<InputEventKey>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
press_a_key->grab_focus();
press_a_key->get_ok()->set_focus_mode(FOCUS_NONE);
@@ -212,7 +212,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action("Erase Shortcut");
- ur->add_do_method(sc.ptr(), "set_shortcut", InputEvent());
+ ur->add_do_method(sc.ptr(), "set_shortcut", Ref<InputEvent>());
ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
ur->add_do_method(this, "_update_shortcuts");
ur->add_undo_method(this, "_update_shortcuts");
@@ -223,7 +223,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
if (!sc.is_valid())
return; //pointless, there is nothing
- InputEvent original = sc->get_meta("original");
+ Ref<InputEvent> original = sc->get_meta("original");
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action("Restore Shortcut");
@@ -237,19 +237,21 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
}
}
-void EditorSettingsDialog::_wait_for_key(const InputEvent &p_event) {
+void EditorSettingsDialog::_wait_for_key(const Ref<InputEvent> &p_event) {
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode != 0) {
+ Ref<InputEventKey> k = p_event;
- last_wait_for_key = p_event;
- String str = keycode_get_string(p_event.key.scancode).capitalize();
- if (p_event.key.mod.meta)
+ if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) {
+
+ last_wait_for_key = k;
+ String str = keycode_get_string(k->get_scancode()).capitalize();
+ if (k->get_metakey())
str = TTR("Meta+") + str;
- if (p_event.key.mod.shift)
+ if (k->get_shift())
str = TTR("Shift+") + str;
- if (p_event.key.mod.alt)
+ if (k->get_alt())
str = TTR("Alt+") + str;
- if (p_event.key.mod.control)
+ if (k->get_control())
str = TTR("Control+") + str;
press_a_key_label->set_text(str);
@@ -259,13 +261,16 @@ void EditorSettingsDialog::_wait_for_key(const InputEvent &p_event) {
void EditorSettingsDialog::_press_a_key_confirm() {
- if (last_wait_for_key.type != InputEvent::KEY)
+ if (last_wait_for_key.is_null())
return;
- InputEvent ie;
- ie.type = InputEvent::KEY;
- ie.key.scancode = last_wait_for_key.key.scancode;
- ie.key.mod = last_wait_for_key.key.mod;
+ Ref<InputEventKey> ie;
+ ie.instance();
+ ie->set_scancode(last_wait_for_key->get_scancode());
+ ie->set_shift(last_wait_for_key->get_shift());
+ ie->set_control(last_wait_for_key->get_control());
+ ie->set_alt(last_wait_for_key->get_alt());
+ ie->set_metakey(last_wait_for_key->get_metakey());
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured);
@@ -300,6 +305,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
set_resizable(true);
tabs = memnew(TabContainer);
+ tabs->set_tab_align(TabContainer::ALIGN_LEFT);
add_child(tabs);
//set_child_rect(tabs);
diff --git a/editor/settings_config_dialog.h b/editor/settings_config_dialog.h
index 7b6e8862dc..cda191ac36 100644
--- a/editor/settings_config_dialog.h
+++ b/editor/settings_config_dialog.h
@@ -54,7 +54,7 @@ class EditorSettingsDialog : public AcceptDialog {
ConfirmationDialog *press_a_key;
Label *press_a_key_label;
- InputEvent last_wait_for_key;
+ Ref<InputEventKey> last_wait_for_key;
String shortcut_configured;
String shortcut_filter;
@@ -68,7 +68,7 @@ class EditorSettingsDialog : public AcceptDialog {
void _notification(int p_what);
void _press_a_key_confirm();
- void _wait_for_key(const InputEvent &p_event);
+ void _wait_for_key(const Ref<InputEvent> &p_event);
void _clear_shortcut_search_box();
void _clear_search_box();