diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_settings.cpp | 1 | ||||
-rw-r--r-- | editor/editor_vcs_interface.cpp | 10 | ||||
-rw-r--r-- | editor/editor_vcs_interface.h | 4 | ||||
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 36 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 4 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 13 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 4 |
10 files changed, 49 insertions, 31 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index a3a02dbd4c..87e8a53e94 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -727,6 +727,7 @@ static Dictionary _get_builtin_script_templates() { templates["no_comments.gd"] = "extends %BASE%\n" "\n" + "\n" "func _ready()%VOID_RETURN%:\n" "%TS%pass\n"; diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp index 4df2a06736..766f9c3913 100644 --- a/editor/editor_vcs_interface.cpp +++ b/editor/editor_vcs_interface.cpp @@ -36,7 +36,7 @@ void EditorVCSInterface::_bind_methods() { // Proxy end points that act as fallbacks to unavailability of a function in the VCS addon ClassDB::bind_method(D_METHOD("_initialize", "project_root_path"), &EditorVCSInterface::_initialize); - ClassDB::bind_method(D_METHOD("_get_is_vcs_intialized"), &EditorVCSInterface::_get_is_vcs_intialized); + ClassDB::bind_method(D_METHOD("_is_vcs_initialized"), &EditorVCSInterface::_is_vcs_initialized); ClassDB::bind_method(D_METHOD("_get_vcs_name"), &EditorVCSInterface::_get_vcs_name); ClassDB::bind_method(D_METHOD("_shut_down"), &EditorVCSInterface::_shut_down); ClassDB::bind_method(D_METHOD("_get_project_name"), &EditorVCSInterface::_get_project_name); @@ -50,7 +50,7 @@ void EditorVCSInterface::_bind_methods() { // API methods that redirect calls to the proxy end points ClassDB::bind_method(D_METHOD("initialize", "project_root_path"), &EditorVCSInterface::initialize); - ClassDB::bind_method(D_METHOD("get_is_vcs_intialized"), &EditorVCSInterface::get_is_vcs_intialized); + ClassDB::bind_method(D_METHOD("is_vcs_initialized"), &EditorVCSInterface::is_vcs_initialized); ClassDB::bind_method(D_METHOD("get_modified_files_data"), &EditorVCSInterface::get_modified_files_data); ClassDB::bind_method(D_METHOD("stage_file", "file_path"), &EditorVCSInterface::stage_file); ClassDB::bind_method(D_METHOD("unstage_file", "file_path"), &EditorVCSInterface::unstage_file); @@ -67,7 +67,7 @@ bool EditorVCSInterface::_initialize(String p_project_root_path) { return true; } -bool EditorVCSInterface::_get_is_vcs_intialized() { +bool EditorVCSInterface::_is_vcs_initialized() { return false; } @@ -112,9 +112,9 @@ bool EditorVCSInterface::initialize(String p_project_root_path) { return is_initialized; } -bool EditorVCSInterface::get_is_vcs_intialized() { +bool EditorVCSInterface::is_vcs_initialized() { - return call("_get_is_vcs_intialized"); + return call("_is_vcs_initialized"); } Dictionary EditorVCSInterface::get_modified_files_data() { diff --git a/editor/editor_vcs_interface.h b/editor/editor_vcs_interface.h index 896193ed92..394a18f974 100644 --- a/editor/editor_vcs_interface.h +++ b/editor/editor_vcs_interface.h @@ -48,7 +48,7 @@ protected: // Implemented by addons as end points for the proxy functions bool _initialize(String p_project_root_path); - bool _get_is_vcs_intialized(); + bool _is_vcs_initialized(); Dictionary _get_modified_files_data(); void _stage_file(String p_file_path); void _unstage_file(String p_file_path); @@ -66,7 +66,7 @@ public: // Proxy functions to the editor for use bool initialize(String p_project_root_path); - bool get_is_vcs_intialized(); + bool is_vcs_initialized(); Dictionary get_modified_files_data(); void stage_file(String p_file_path); void unstage_file(String p_file_path); diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index fcf0e4af6f..30e2aae020 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -229,6 +229,7 @@ Error EditorSceneImporterGLTF::_parse_scenes(GLTFState &state) { ERR_FAIL_COND_V(!state.json.has("scenes"), ERR_FILE_CORRUPT); const Array &scenes = state.json["scenes"]; + ERR_FAIL_COND_V(!scenes.size(), ERR_FILE_CORRUPT); for (int i = 0; i < 1; i++) { //only first scene is imported const Dictionary &s = scenes[i]; ERR_FAIL_COND_V(!s.has("nodes"), ERR_UNAVAILABLE); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 336d908637..20b4cf43bf 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -794,6 +794,7 @@ bool CanvasItemEditor::_select_click_on_item(CanvasItem *item, Point2 p_click_po editor_selection->add_node(item); // Reselect if (Engine::get_singleton()->is_editor_hint()) { + selected_from_canvas = true; editor->call("edit_node", item); } } @@ -3671,7 +3672,7 @@ void CanvasItemEditor::_notification(int p_what) { int nb_having_pivot = 0; // Update the viewport if the canvas_item changes - List<CanvasItem *> selection = _get_edited_canvas_items(); + List<CanvasItem *> selection = _get_edited_canvas_items(true); for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get(); CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item); @@ -3911,6 +3912,11 @@ void CanvasItemEditor::_selection_changed() { } anchors_mode = (nbValidControls == nbAnchorsMode); anchor_mode_button->set_pressed(anchors_mode); + + if (!selected_from_canvas) { + drag_type = DRAG_NONE; + } + selected_from_canvas = false; } void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { @@ -3971,9 +3977,9 @@ void CanvasItemEditor::_update_scrollbars() { updating_scroll = true; // Move the zoom buttons - Point2 zoom_hb_begin = Point2(5, 5); - zoom_hb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2(); - zoom_hb->set_begin(zoom_hb_begin); + Point2 controls_vb_begin = Point2(5, 5); + controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2(); + controls_vb->set_begin(controls_vb_begin); // Move and resize the scrollbars Size2 size = viewport->get_size(); @@ -5253,6 +5259,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { snap_target[0] = SNAP_TARGET_NONE; snap_target[1] = SNAP_TARGET_NONE; + selected_from_canvas = false; anchors_mode = false; skeleton_show_bones = true; @@ -5310,6 +5317,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE); scene_tree->add_child(p_editor->get_scene_root()); + controls_vb = memnew(VBoxContainer); + controls_vb->set_begin(Point2(5, 5)); + + zoom_hb = memnew(HBoxContainer); + // Bring the zoom percentage closer to the zoom buttons + zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE)); + controls_vb->add_child(zoom_hb); + viewport = memnew(CanvasItemEditorViewport(p_editor, this)); viewport_scrollable->add_child(viewport); viewport->set_mouse_filter(MOUSE_FILTER_PASS); @@ -5353,11 +5368,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { v_scroll->connect("value_changed", this, "_update_scroll"); v_scroll->hide(); - zoom_hb = memnew(HBoxContainer); - viewport->add_child(zoom_hb); - zoom_hb->set_begin(Point2(5, 5)); - // Bring the zoom percentage closer to the zoom buttons - zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE)); + viewport->add_child(controls_vb); zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); @@ -5744,8 +5755,6 @@ void CanvasItemEditorViewport::_on_change_type_closed() { } void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const { - label->set_position(get_global_position() + Point2(14, 14) * EDSCALE); - label_desc->set_position(label->get_position() + Point2(0, label->get_size().height)); bool add_preview = false; for (int i = 0; i < files.size(); i++) { String path = files[i]; @@ -6167,7 +6176,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte label->add_color_override("font_color_shadow", Color(0, 0, 0, 1)); label->add_constant_override("shadow_as_outline", 1 * EDSCALE); label->hide(); - editor->get_gui_base()->add_child(label); + canvas_item_editor->get_controls_container()->add_child(label); label_desc = memnew(Label); label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type")); @@ -6176,7 +6185,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte label_desc->add_constant_override("shadow_as_outline", 1 * EDSCALE); label_desc->add_constant_override("line_spacing", 0); label_desc->hide(); - editor->get_gui_base()->add_child(label_desc); + canvas_item_editor->get_controls_container()->add_child(label_desc); + VS::get_singleton()->canvas_set_disable_scale(true); } diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 3fdf00d611..74adb882d1 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -252,6 +252,7 @@ private: Point2 view_offset; Point2 previous_update_view_offset; + bool selected_from_canvas; bool anchors_mode; Point2 grid_offset; @@ -530,6 +531,7 @@ private: void _button_toggle_anchor_mode(bool p_status); + VBoxContainer *controls_vb; HBoxContainer *zoom_hb; void _zoom_on_position(float p_zoom, Point2 p_position = Point2()); void _update_zoom_label(); @@ -627,6 +629,8 @@ public: Control *get_viewport_control() { return viewport; } + Control *get_controls_container() { return controls_vb; } + void update_viewport(); Tool get_current_tool() { return tool; } diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 783797ada4..aa3bd74c49 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "version_control_editor_plugin.h" + #include "core/script_language.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" @@ -398,9 +399,9 @@ void VersionControlEditorPlugin::shut_down() { } } -bool VersionControlEditorPlugin::get_is_vcs_intialized() const { +bool VersionControlEditorPlugin::is_vcs_initialized() const { - return EditorVCSInterface::get_singleton() ? EditorVCSInterface::get_singleton()->get_is_vcs_intialized() : false; + return EditorVCSInterface::get_singleton() ? EditorVCSInterface::get_singleton()->is_vcs_initialized() : false; } const String VersionControlEditorPlugin::get_vcs_name() const { diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h index 450ebccce1..f9f8437e15 100644 --- a/editor/plugins/version_control_editor_plugin.h +++ b/editor/plugins/version_control_editor_plugin.h @@ -129,7 +129,7 @@ public: PanelContainer *get_version_control_dock() const { return version_control_dock; } List<StringName> get_available_vcs_names() const { return available_addons; } - bool get_is_vcs_intialized() const; + bool is_vcs_initialized() const; const String get_vcs_name() const; void register_editor(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 76dcd10b50..8e7aac896a 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -492,7 +492,7 @@ void ScriptEditorDebugger::_video_mem_request() { Size2 ScriptEditorDebugger::get_minimum_size() const { - Size2 ms = Control::get_minimum_size(); + Size2 ms = MarginContainer::get_minimum_size(); ms.y = MAX(ms.y, 250 * EDSCALE); return ms; } @@ -1426,11 +1426,12 @@ void ScriptEditorDebugger::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + 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_margin(MARGIN_LEFT, -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - tabs->set_margin(MARGIN_RIGHT, EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); copy->set_icon(get_icon("ActionCopy", "EditorIcons")); step->set_icon(get_icon("DebugStep", "EditorIcons")); @@ -2242,6 +2243,9 @@ void ScriptEditorDebugger::_bind_methods() { ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { + add_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + add_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); + ppeer = Ref<PacketPeerStream>(memnew(PacketPeerStream)); ppeer->set_input_buffer_max_size(1024 * 1024 * 8); //8mb should be enough editor = p_editor; @@ -2253,9 +2257,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { 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_anchors_and_margins_preset(Control::PRESET_WIDE); - tabs->set_margin(MARGIN_LEFT, -editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); - tabs->set_margin(MARGIN_RIGHT, editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); add_child(tabs); { //debugger diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 14b024d066..c885614dab 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -55,9 +55,9 @@ class EditorNetworkProfiler; class ScriptEditorDebuggerInspectedObject; -class ScriptEditorDebugger : public Control { +class ScriptEditorDebugger : public MarginContainer { - GDCLASS(ScriptEditorDebugger, Control); + GDCLASS(ScriptEditorDebugger, MarginContainer); public: enum CameraOverride { |