diff options
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 24 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/cube_grid_theme_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/gradient_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/gradient_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/line_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 7 |
13 files changed, 74 insertions, 36 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4f3472bf03..3b74601e78 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -409,7 +409,7 @@ bool CanvasItemEditor::_is_part_of_subscene(CanvasItem *p_item) { return item_owner && item_owner != scene_node && p_item != scene_node && item_owner->get_filename() != ""; } -void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit) { +void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit) { if (!p_node) return; if (Object::cast_to<Viewport>(p_node)) @@ -1881,7 +1881,7 @@ void CanvasItemEditor::_viewport_draw() { if (snap_show_grid) { //Draw the grid Size2 s = viewport->get_size(); - int last_cell; + int last_cell = 0; Transform2D xform = transform.affine_inverse(); Vector2 grid_offset; @@ -2257,17 +2257,17 @@ void CanvasItemEditor::_notification(int p_what) { anchors[MARGIN_RIGHT] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_RIGHT); anchors[MARGIN_TOP] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_TOP); anchors[MARGIN_BOTTOM] = Object::cast_to<Control>(canvas_item)->get_anchor(MARGIN_BOTTOM); - } - if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) { - viewport->update(); - se->prev_rect = r; - se->prev_xform = xform; - se->prev_pivot = pivot; - se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT]; - se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT]; - se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP]; - se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM]; + if (r != se->prev_rect || xform != se->prev_xform || pivot != se->prev_pivot || anchors[MARGIN_LEFT] != se->prev_anchors[MARGIN_LEFT] || anchors[MARGIN_RIGHT] != se->prev_anchors[MARGIN_RIGHT] || anchors[MARGIN_TOP] != se->prev_anchors[MARGIN_TOP] || anchors[MARGIN_BOTTOM] != se->prev_anchors[MARGIN_BOTTOM]) { + viewport->update(); + se->prev_rect = r; + se->prev_xform = xform; + se->prev_pivot = pivot; + se->prev_anchors[MARGIN_LEFT] = anchors[MARGIN_LEFT]; + se->prev_anchors[MARGIN_RIGHT] = anchors[MARGIN_RIGHT]; + se->prev_anchors[MARGIN_TOP] = anchors[MARGIN_TOP]; + se->prev_anchors[MARGIN_BOTTOM] = anchors[MARGIN_BOTTOM]; + } } } diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 8f67d641f5..da217007ea 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -291,7 +291,7 @@ class CanvasItemEditor : public VBoxContainer { int handle_len; bool _is_part_of_subscene(CanvasItem *p_item); - void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit = 0); + void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0); void _find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, List<CanvasItem *> *r_items); void _select_click_on_empty_area(Point2 p_click_pos, bool p_append, bool p_box_selection); diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp index 08b38c2ca2..decf8b2bb4 100644 --- a/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -88,7 +88,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, if (mesh.is_null()) continue; - int id = p_library->find_item_name(mi->get_name()); + int id = p_library->find_item_by_name(mi->get_name()); if (id < 0) { id = p_library->get_last_unused_item_id(); diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index abd2559d1f..51f00e5751 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* color_ramp_editor_plugin.cpp */ +/* gradient_editor_plugin.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h index c169fa0947..ff7bf858c7 100644 --- a/editor/plugins/gradient_editor_plugin.h +++ b/editor/plugins/gradient_editor_plugin.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* color_ramp_editor_plugin.h */ +/* gradient_editor_plugin.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index a5f854e1b1..84620a75a5 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -211,7 +211,7 @@ void Line2DEditor::_bind_methods() { } void Line2DEditor::_mode_selected(int p_mode) { - for (unsigned int i = 0; i < _MODE_COUNT; ++i) { + for (int i = 0; i < _MODE_COUNT; ++i) { toolbar_buttons[i]->set_pressed(i == p_mode); } mode = Mode(p_mode); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index a3195c05d6..f7008298f0 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -659,7 +659,7 @@ void Polygon2DEditor::_uv_draw() { if (snap_show_grid) { Size2 s = uv_edit_draw->get_size(); - int last_cell; + int last_cell = 0; if (snap_step.x != 0) { for (int i = 0; i < s.width; i++) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 5015fab5ea..dbc3bff873 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -972,6 +972,14 @@ void ScriptEditor::_menu_option(int p_option) { EditorNode::get_singleton()->show_warning("Can't obtain the script for running"); break; } + + current->apply_code(); + Error err = scr->reload(false); //hard reload script before running always + + if (err != OK) { + EditorNode::get_singleton()->show_warning("Script failed reloading, check console for errors."); + return; + } if (!scr->is_tool()) { EditorNode::get_singleton()->show_warning("Script is not in tool mode, will not be able to run"); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index a1cfda3b1a..fae57eb5d2 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -115,17 +115,29 @@ void ScriptTextEditor::_load_theme_settings() { //colorize core types Color basetype_color = EDITOR_DEF("text_editor/highlighting/base_type_color", Color(0.3, 0.3, 0.0)); + text_edit->add_keyword_color("String", basetype_color); text_edit->add_keyword_color("Vector2", basetype_color); + text_edit->add_keyword_color("Rect2", basetype_color); + text_edit->add_keyword_color("Transform2D", basetype_color); text_edit->add_keyword_color("Vector3", basetype_color); + text_edit->add_keyword_color("Rect3", basetype_color); + text_edit->add_keyword_color("Basis", basetype_color); text_edit->add_keyword_color("Plane", basetype_color); - text_edit->add_keyword_color("Quat", basetype_color); - text_edit->add_keyword_color("AABB", basetype_color); - text_edit->add_keyword_color("Matrix3", basetype_color); text_edit->add_keyword_color("Transform", basetype_color); + text_edit->add_keyword_color("Quat", basetype_color); text_edit->add_keyword_color("Color", basetype_color); - text_edit->add_keyword_color("Image", basetype_color); - text_edit->add_keyword_color("Rect2", basetype_color); + text_edit->add_keyword_color("Object", basetype_color); text_edit->add_keyword_color("NodePath", basetype_color); + text_edit->add_keyword_color("RID", basetype_color); + text_edit->add_keyword_color("Dictionary", basetype_color); + text_edit->add_keyword_color("Array", basetype_color); + text_edit->add_keyword_color("PoolByteArray", basetype_color); + text_edit->add_keyword_color("PoolIntArray", basetype_color); + text_edit->add_keyword_color("PoolRealArray", basetype_color); + text_edit->add_keyword_color("PoolStringArray", basetype_color); + text_edit->add_keyword_color("PoolVector2Array", basetype_color); + text_edit->add_keyword_color("PoolVector3Array", basetype_color); + text_edit->add_keyword_color("PoolColorArray", basetype_color); //colorize engine types Color type_color = EDITOR_DEF("text_editor/highlighting/engine_type_color", Color(0.0, 0.2, 0.4)); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 8672892b5a..13b0391a87 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -280,6 +280,7 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); shader_editor->get_text_edit()->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type")); + shader_editor->get_text_edit()->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent")); shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index bc5c700959..d9fc2f32f7 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2958,7 +2958,7 @@ void SpatialEditor::update_transform_gizmo() { gizmo.transform.origin = pcenter; gizmo.transform.basis = gizmo_basis; - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->update_transform_gizmo_view(); } } @@ -3108,7 +3108,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) { Array vp = d["viewports"]; ERR_FAIL_COND(vp.size() > 4); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->set_state(vp[i]); } } @@ -3505,7 +3505,7 @@ void SpatialEditor::_init_indicators() { gizmo_hl = Ref<SpatialMaterial>(memnew(SpatialMaterial)); gizmo_hl->set_flag(SpatialMaterial::FLAG_UNSHADED, true); - gizmo_hl->set_flag(SpatialMaterial::FLAG_ONTOP, true); + gizmo_hl->set_on_top_of_alpha(); gizmo_hl->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); gizmo_hl->set_albedo(Color(1, 1, 1, gizmo_alph + 0.2f)); gizmo_hl->set_cull_mode(SpatialMaterial::CULL_DISABLED); @@ -3518,7 +3518,7 @@ void SpatialEditor::_init_indicators() { Ref<SpatialMaterial> mat = memnew(SpatialMaterial); mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); - mat->set_flag(SpatialMaterial::FLAG_ONTOP, true); + mat->set_on_top_of_alpha(); mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); Color col; col[i] = 1.0; @@ -3613,7 +3613,7 @@ void SpatialEditor::_init_indicators() { Ref<SpatialMaterial> plane_mat = memnew(SpatialMaterial); plane_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true); - plane_mat->set_flag(SpatialMaterial::FLAG_ONTOP, true); + plane_mat->set_on_top_of_alpha(); plane_mat->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); plane_mat->set_cull_mode(SpatialMaterial::CULL_DISABLED); Color col; @@ -3852,15 +3852,15 @@ void SpatialEditor::_toggle_maximize_view(Object *p_viewport) { if (!maximized) { - for (int i = 0; i < VIEWPORTS_COUNT; i++) { - if (i == index) + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { + if (i == (uint32_t)index) viewports[i]->set_area_as_parent_rect(); else viewports[i]->hide(); } } else { - for (int i = 0; i < VIEWPORTS_COUNT; i++) + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) viewports[i]->show(); if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT))) @@ -3904,7 +3904,7 @@ void SpatialEditor::clear() { settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.1)); settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500.0)); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->reset(); } @@ -3917,7 +3917,7 @@ void SpatialEditor::clear() { } } - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(SpatialEditorViewport::VIEW_AUDIO_LISTENER), i == 0); viewports[i]->viewport->set_as_audio_listener(i == 0); @@ -4074,7 +4074,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { viewport_base = memnew(SpatialEditorViewportContainer); shader_split->add_child(viewport_base); viewport_base->set_v_size_flags(SIZE_EXPAND_FILL); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i] = memnew(SpatialEditorViewport(this, editor, i)); viewports[i]->connect("toggle_maximize_view", this, "_toggle_maximize_view"); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index c2c26bfe6c..7b40f69082 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -244,8 +244,22 @@ void SpriteFramesEditor::_down_pressed() { void SpriteFramesEditor::_delete_pressed() { + ERR_FAIL_COND(!frames->has_animation(edited_anim)); + if (tree->get_current() < 0) return; + + int to_delete = tree->get_current(); + if (to_delete < 0 || to_delete >= frames->get_frame_count(edited_anim)) { + return; + } + + undo_redo->create_action(TTR("Delete Resource")); + undo_redo->add_do_method(frames, "remove_frame", edited_anim, to_delete); + undo_redo->add_undo_method(frames, "add_frame", edited_anim, frames->get_frame(edited_anim, to_delete), to_delete); + undo_redo->add_do_method(this, "_update_library"); + undo_redo->add_undo_method(this, "_update_library"); + undo_redo->commit_action(); } void SpriteFramesEditor::_animation_select() { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 82b507bd49..38d1350b07 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -67,7 +67,7 @@ void TextureRegionEditor::_region_draw() { if (snap_mode == SNAP_GRID) { Size2 s = edit_draw->get_size(); - int last_cell; + int last_cell = 0; if (snap_step.x != 0) { if (snap_separation.x == 0) @@ -406,7 +406,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { } else if (drag) { if (edited_margin >= 0) { - float new_margin; + float new_margin = 0; if (edited_margin == 0) new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom; else if (edited_margin == 1) @@ -415,6 +415,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) { new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom; else if (edited_margin == 3) new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom; + else + ERR_PRINT("Unexpected edited_margin"); + if (new_margin < 0) new_margin = 0; static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT }; |