summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_bezier_editor.cpp2
-rw-r--r--editor/animation_track_editor.cpp8
-rw-r--r--editor/code_editor.cpp8
-rw-r--r--editor/debugger/editor_debugger_node.cpp8
-rw-r--r--editor/debugger/editor_performance_profiler.cpp2
-rw-r--r--editor/editor_audio_buses.cpp2
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_help.cpp4
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_layouts_dialog.cpp16
-rw-r--r--editor/editor_node.cpp16
-rw-r--r--editor/editor_properties.cpp10
-rw-r--r--editor/editor_properties_array_dict.cpp2
-rw-r--r--editor/editor_spin_slider.cpp6
-rw-r--r--editor/editor_themes.cpp128
-rw-r--r--editor/find_in_files.cpp16
-rw-r--r--editor/groups_editor.cpp4
-rw-r--r--editor/input_map_editor.cpp14
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp10
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp18
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp4
-rw-r--r--editor/plugins/camera_3d_editor_plugin.cpp24
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp274
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h78
-rw-r--r--editor/plugins/material_editor_plugin.cpp4
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp38
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp8
-rw-r--r--editor/plugins/script_text_editor.cpp12
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp12
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp12
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp62
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp16
-rw-r--r--editor/progress_dialog.cpp12
-rw-r--r--editor/project_manager.cpp14
-rw-r--r--editor/property_editor.cpp40
-rw-r--r--editor/scene_tree_dock.cpp4
-rw-r--r--editor/scene_tree_editor.cpp4
-rw-r--r--editor/settings_config_dialog.cpp6
45 files changed, 458 insertions, 458 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 25ff7f884a..6530e27dcd 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -1164,7 +1164,7 @@ AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
- play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->set_anchors_and_offsets_preset(PRESET_WIDE);
play_position->connect("draw", callable_mp(this, &AnimationBezierTrackEdit::_play_position_draw));
set_focus_mode(FOCUS_CLICK);
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index ec411c6415..9b2cc686e3 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1745,7 +1745,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
- play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->set_anchors_and_offsets_preset(PRESET_WIDE);
play_position->connect("draw", callable_mp(this, &AnimationTimelineEdit::_play_position_draw));
add_track = memnew(MenuButton);
@@ -2720,7 +2720,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
add_child(path_popup);
path = memnew(LineEdit);
path_popup->add_child(path);
- path->set_anchors_and_margins_preset(PRESET_WIDE);
+ path->set_anchors_and_offsets_preset(PRESET_WIDE);
path->connect("text_entered", callable_mp(this, &AnimationTrackEdit::_path_entered));
}
@@ -2973,7 +2973,7 @@ AnimationTrackEdit::AnimationTrackEdit() {
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
- play_position->set_anchors_and_margins_preset(PRESET_WIDE);
+ play_position->set_anchors_and_offsets_preset(PRESET_WIDE);
play_position->connect("draw", callable_mp(this, &AnimationTrackEdit::_play_position_draw));
set_focus_mode(FOCUS_CLICK);
set_mouse_filter(MOUSE_FILTER_PASS); //scroll has to work too for selection
@@ -5661,7 +5661,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
info_message->set_align(Label::ALIGN_CENTER);
info_message->set_autowrap(true);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
+ info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
main_panel->add_child(info_message);
timeline = memnew(AnimationTimelineEdit);
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 3dd0977478..bca2979e72 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -66,10 +66,10 @@ GotoLineDialog::GotoLineDialog() {
set_title(TTR("Go to Line"));
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
add_child(vbc);
Label *l = memnew(Label);
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 276df45972..118b8f9f2e 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -55,8 +55,8 @@ EditorDebuggerNode::EditorDebuggerNode() {
singleton = this;
}
- add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
- add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
+ add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_LEFT));
+ add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_RIGHT));
tabs = memnew(TabContainer);
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
@@ -226,8 +226,8 @@ void EditorDebuggerNode::_notification(int p_what) {
switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
if (tabs->get_tab_count() > 1) {
- add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT));
- add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT));
+ add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_LEFT));
+ add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(SIDE_RIGHT));
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles"));
}
diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp
index 44c5f83e9a..2068d42eb7 100644
--- a/editor/debugger/editor_performance_profiler.cpp
+++ b/editor/debugger/editor_performance_profiler.cpp
@@ -382,7 +382,7 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
info_message->set_align(Label::ALIGN_CENTER);
info_message->set_autowrap(true);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
+ info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
monitor_draw->add_child(info_message);
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index d81dc05a75..d768f00c3b 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -922,7 +922,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
bus_options = memnew(MenuButton);
bus_options->set_shortcut_context(this);
bus_options->set_h_size_flags(SIZE_SHRINK_END);
- bus_options->set_anchor(MARGIN_RIGHT, 0.0);
+ bus_options->set_anchor(SIDE_RIGHT, 0.0);
bus_options->set_tooltip(TTR("Bus options"));
hbc->add_child(bus_options);
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 05bc2edefb..ecb659e7d3 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -876,7 +876,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
no_profile_selected_help = memnew(Label(TTR("Create or import a profile to edit available classes and properties.")));
// Add some spacing above the help label.
Ref<StyleBoxEmpty> sb = memnew(StyleBoxEmpty);
- sb->set_default_margin(MARGIN_TOP, 20 * EDSCALE);
+ sb->set_default_margin(SIDE_TOP, 20 * EDSCALE);
no_profile_selected_help->add_theme_style_override("normal", sb);
no_profile_selected_help->set_align(Label::ALIGN_CENTER);
no_profile_selected_help->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 41010b6a86..1592549e0c 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -160,8 +160,8 @@ void EditorHelp::_class_desc_resized() {
const int display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5;
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox("normal", "RichTextLabel")->duplicate();
- class_desc_stylebox->set_default_margin(MARGIN_LEFT, display_margin);
- class_desc_stylebox->set_default_margin(MARGIN_RIGHT, display_margin);
+ class_desc_stylebox->set_default_margin(SIDE_LEFT, display_margin);
+ class_desc_stylebox->set_default_margin(SIDE_RIGHT, display_margin);
class_desc->add_theme_style_override("normal", class_desc_stylebox);
}
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index dd136c046f..a36b5f5a6a 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -220,7 +220,7 @@ void EditorProperty::_notification(int p_what) {
Size2 size = get_size();
if (bottom_editor) {
- size.height = bottom_editor->get_margin(MARGIN_TOP);
+ size.height = bottom_editor->get_offset(SIDE_TOP);
} else if (label_reference) {
size.height = label_reference->get_size().height;
}
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index c50fe81217..74f45fa628 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -100,24 +100,24 @@ void EditorLayoutsDialog::_post_popup() {
EditorLayoutsDialog::EditorLayoutsDialog() {
makevb = memnew(VBoxContainer);
add_child(makevb);
- makevb->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
- makevb->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
+ makevb->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
+ makevb->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
layout_names = memnew(ItemList);
makevb->add_child(layout_names);
layout_names->set_visible(true);
- layout_names->set_margin(MARGIN_TOP, 5);
- layout_names->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
- layout_names->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
+ layout_names->set_offset(SIDE_TOP, 5);
+ layout_names->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
+ layout_names->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
layout_names->set_select_mode(ItemList::SELECT_MULTI);
layout_names->set_allow_rmb_select(true);
name = memnew(LineEdit);
makevb->add_child(name);
- name->set_margin(MARGIN_TOP, 5);
- name->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5);
- name->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5);
+ name->set_offset(SIDE_TOP, 5);
+ name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5);
+ name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5);
name->connect("gui_input", callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
name->connect("focus_entered", callable_mp(layout_names, &ItemList::unselect_all));
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9e6f9b2ec6..ca8b278ab8 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4018,16 +4018,16 @@ void EditorNode::_dock_make_float() {
window->set_title(dock->get_name());
Panel *p = memnew(Panel);
p->set_mode(Panel::MODE_FOREGROUND);
- p->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ p->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
window->add_child(p);
MarginContainer *margin = memnew(MarginContainer);
- margin->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ margin->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
margin->add_theme_constant_override("margin_right", borders.width);
margin->add_theme_constant_override("margin_top", borders.height);
margin->add_theme_constant_override("margin_left", borders.width);
margin->add_theme_constant_override("margin_bottom", borders.height);
window->add_child(margin);
- dock->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ dock->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
margin->add_child(dock);
window->set_wrap_controls(true);
window->set_size(dock_size);
@@ -5791,11 +5791,11 @@ EditorNode::EditorNode() {
theme_base = memnew(Control);
add_child(theme_base);
- theme_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ theme_base->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
gui_base = memnew(Panel);
theme_base->add_child(gui_base);
- gui_base->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ gui_base->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
theme_base->set_theme(theme);
gui_base->set_theme(theme);
@@ -5807,13 +5807,13 @@ EditorNode::EditorNode() {
gui_base->add_child(progress_dialog);
// take up all screen
- gui_base->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
- gui_base->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
+ gui_base->set_anchor(SIDE_RIGHT, Control::ANCHOR_END);
+ gui_base->set_anchor(SIDE_BOTTOM, Control::ANCHOR_END);
gui_base->set_end(Point2(0, 0));
main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
- main_vbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8);
+ main_vbox->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8);
main_vbox->add_theme_constant_override("separation", 8 * EDSCALE);
menu_hb = memnew(HBoxContainer);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 523e65babe..f432d52bf6 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2590,7 +2590,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T
}
if (p_preview.is_valid()) {
- preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_theme_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_theme_constant("hseparation", "Button"));
+ preview->set_offset(SIDE_LEFT, assign->get_icon()->get_width() + assign->get_theme_stylebox("normal")->get_default_margin(SIDE_LEFT) + get_theme_constant("hseparation", "Button"));
if (type == "GradientTexture") {
preview->set_stretch_mode(TextureRect::STRETCH_SCALE);
assign->set_custom_minimum_size(Size2(1, 1));
@@ -3167,10 +3167,10 @@ EditorPropertyResource::EditorPropertyResource() {
preview = memnew(TextureRect);
preview->set_expand(true);
- preview->set_anchors_and_margins_preset(PRESET_WIDE);
- preview->set_margin(MARGIN_TOP, 1);
- preview->set_margin(MARGIN_BOTTOM, -1);
- preview->set_margin(MARGIN_RIGHT, -1);
+ preview->set_anchors_and_offsets_preset(PRESET_WIDE);
+ preview->set_offset(SIDE_TOP, 1);
+ preview->set_offset(SIDE_BOTTOM, -1);
+ preview->set_offset(SIDE_RIGHT, -1);
assign->add_child(preview);
assign->connect("gui_input", callable_mp(this, &EditorPropertyResource::_button_input));
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 56fbfbd0c2..c2c309fc32 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -975,7 +975,7 @@ void EditorPropertyDictionary::update_property() {
Ref<StyleBoxFlat> flat;
flat.instance();
for (int j = 0; j < 4; j++) {
- flat->set_default_margin(Margin(j), 2 * EDSCALE);
+ flat->set_default_margin(Side(j), 2 * EDSCALE);
}
flat->set_bg_color(get_theme_color("prop_subsection", "Editor"));
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index d72510d40d..4a37d26a26 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -202,7 +202,7 @@ void EditorSpinSlider::_notification(int p_what) {
// EditorSpinSliders with a label have more space on the left, so add an
// higher margin to match the location where the text begins.
// The margin values below were determined by empirical testing.
- stylebox->set_default_margin(MARGIN_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE);
+ stylebox->set_default_margin(SIDE_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE);
value_input->add_theme_style_override("normal", stylebox);
}
@@ -256,7 +256,7 @@ void EditorSpinSlider::_notification(int p_what) {
if (get_step() == 1) {
Ref<Texture2D> updown2 = get_theme_icon("updown", "SpinBox");
int updown_vofs = (get_size().height - updown2->get_height()) / 2;
- updown_offset = get_size().width - sb->get_margin(MARGIN_RIGHT) - updown2->get_width();
+ updown_offset = get_size().width - sb->get_margin(SIDE_RIGHT) - updown2->get_width();
Color c(1, 1, 1);
if (hover_updown) {
c *= Color(1.2, 1.2, 1.2);
@@ -500,7 +500,7 @@ EditorSpinSlider::EditorSpinSlider() {
value_input = memnew(LineEdit);
value_input_popup->add_child(value_input);
value_input_popup->set_wrap_controls(true);
- value_input->set_anchors_and_margins_preset(PRESET_WIDE);
+ value_input->set_anchors_and_offsets_preset(PRESET_WIDE);
value_input_popup->connect("popup_hide", callable_mp(this, &EditorSpinSlider::_value_input_closed));
value_input->connect("text_entered", callable_mp(this, &EditorSpinSlider::_value_input_entered));
value_input->connect("focus_exited", callable_mp(this, &EditorSpinSlider::_value_focus_exited));
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 35de38fad2..7582c2073f 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -44,34 +44,34 @@
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture2D> p_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(p_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_margin_size(SIDE_LEFT, p_left * EDSCALE);
+ style->set_margin_size(SIDE_RIGHT, p_right * EDSCALE);
+ style->set_margin_size(SIDE_BOTTOM, p_botton * EDSCALE);
+ style->set_margin_size(SIDE_TOP, p_top * EDSCALE);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_botton * EDSCALE);
+ style->set_default_margin(SIDE_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);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
return style;
}
static Ref<StyleBoxFlat> make_flat_stylebox(Color p_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(p_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);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
return style;
}
@@ -477,10 +477,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float extra_spacing = EDITOR_GET("interface/theme/additional_spacing");
Ref<StyleBoxFlat> style_widget = style_default->duplicate();
- style_widget->set_default_margin(MARGIN_LEFT, (extra_spacing + 6) * EDSCALE);
- style_widget->set_default_margin(MARGIN_TOP, (extra_spacing + default_margin_size) * EDSCALE);
- style_widget->set_default_margin(MARGIN_RIGHT, (extra_spacing + 6) * EDSCALE);
- style_widget->set_default_margin(MARGIN_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE);
+ style_widget->set_default_margin(SIDE_LEFT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(SIDE_TOP, (extra_spacing + default_margin_size) * EDSCALE);
+ style_widget->set_default_margin(SIDE_RIGHT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(SIDE_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE);
style_widget->set_bg_color(dark_color_1);
style_widget->set_border_color(dark_color_2);
@@ -500,10 +500,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// style for windows, popups, etc..
Ref<StyleBoxFlat> style_popup = style_default->duplicate();
const int popup_margin_size = default_margin_size * EDSCALE * 2;
- style_popup->set_default_margin(MARGIN_LEFT, popup_margin_size);
- style_popup->set_default_margin(MARGIN_TOP, popup_margin_size);
- style_popup->set_default_margin(MARGIN_RIGHT, popup_margin_size);
- style_popup->set_default_margin(MARGIN_BOTTOM, popup_margin_size);
+ style_popup->set_default_margin(SIDE_LEFT, popup_margin_size);
+ style_popup->set_default_margin(SIDE_TOP, popup_margin_size);
+ style_popup->set_default_margin(SIDE_RIGHT, popup_margin_size);
+ style_popup->set_default_margin(SIDE_BOTTOM, popup_margin_size);
style_popup->set_border_color(contrast_color_1);
style_popup->set_border_width_all(MAX(EDSCALE, border_width));
const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1);
@@ -536,13 +536,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate();
style_tab_selected->set_border_width_all(border_width);
- style_tab_selected->set_border_width(MARGIN_BOTTOM, 0);
+ style_tab_selected->set_border_width(SIDE_BOTTOM, 0);
style_tab_selected->set_border_color(dark_color_3);
- style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width);
- style_tab_selected->set_default_margin(MARGIN_LEFT, tab_default_margin_side);
- style_tab_selected->set_default_margin(MARGIN_RIGHT, tab_default_margin_side);
- style_tab_selected->set_default_margin(MARGIN_BOTTOM, tab_default_margin_vertical);
- style_tab_selected->set_default_margin(MARGIN_TOP, tab_default_margin_vertical);
+ style_tab_selected->set_expand_margin_size(SIDE_BOTTOM, border_width);
+ style_tab_selected->set_default_margin(SIDE_LEFT, tab_default_margin_side);
+ style_tab_selected->set_default_margin(SIDE_RIGHT, tab_default_margin_side);
+ style_tab_selected->set_default_margin(SIDE_BOTTOM, tab_default_margin_vertical);
+ style_tab_selected->set_default_margin(SIDE_TOP, tab_default_margin_vertical);
style_tab_selected->set_bg_color(tab_color);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate();
@@ -580,7 +580,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate();
style_menu_hover_border->set_draw_center(false);
style_menu_hover_border->set_border_width_all(0);
- style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width);
+ style_menu_hover_border->set_border_width(SIDE_BOTTOM, border_width);
style_menu_hover_border->set_border_color(accent_color);
Ref<StyleBoxFlat> style_menu_hover_bg = style_widget->duplicate();
@@ -668,10 +668,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Checkbox
Ref<StyleBoxFlat> sb_checkbox = style_menu->duplicate();
- sb_checkbox->set_default_margin(MARGIN_LEFT, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_RIGHT, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_BOTTOM, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_LEFT, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_RIGHT, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_BOTTOM, default_margin_size * EDSCALE);
theme->set_stylebox("normal", "CheckBox", sb_checkbox);
theme->set_stylebox("pressed", "CheckBox", sb_checkbox);
@@ -697,10 +697,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// PopupMenu
const int popup_menu_margin_size = default_margin_size * 1.5 * EDSCALE;
Ref<StyleBoxFlat> style_popup_menu = style_popup->duplicate();
- style_popup_menu->set_default_margin(MARGIN_LEFT, popup_menu_margin_size);
- style_popup_menu->set_default_margin(MARGIN_TOP, popup_menu_margin_size);
- style_popup_menu->set_default_margin(MARGIN_RIGHT, popup_menu_margin_size);
- style_popup_menu->set_default_margin(MARGIN_BOTTOM, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_LEFT, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_TOP, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_RIGHT, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_BOTTOM, popup_menu_margin_size);
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
theme->set_stylebox("separator", "PopupMenu", style_popup_separator);
@@ -724,9 +724,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE);
Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1.lerp(accent_color, 0.08), 2, 0, 2, 2);
- sub_inspector_bg->set_border_width(MARGIN_LEFT, 2);
- sub_inspector_bg->set_border_width(MARGIN_RIGHT, 2);
- sub_inspector_bg->set_border_width(MARGIN_BOTTOM, 2);
+ sub_inspector_bg->set_border_width(SIDE_LEFT, 2);
+ sub_inspector_bg->set_border_width(SIDE_RIGHT, 2);
+ sub_inspector_bg->set_border_width(SIDE_BOTTOM, 2);
sub_inspector_bg->set_border_color(accent_color * Color(1, 1, 1, 0.3));
sub_inspector_bg->set_draw_center(true);
@@ -866,17 +866,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel->set_border_color(dark_color_3);
style_content_panel->set_border_width_all(border_width);
// compensate the border
- style_content_panel->set_default_margin(MARGIN_TOP, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_TOP, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_RIGHT, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_BOTTOM, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_LEFT, margin_size_extra * EDSCALE);
// this is the stylebox used in 3d and 2d viewports (no borders)
Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width * 2);
- style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
- style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width * 2);
- style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_LEFT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ style_content_panel_vp->set_default_margin(SIDE_RIGHT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_BOTTOM, border_width * 2);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
@@ -887,13 +887,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Debugger
Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate();
- style_panel_debugger->set_border_width(MARGIN_BOTTOM, 0);
+ style_panel_debugger->set_border_width(SIDE_BOTTOM, 0);
theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate();
- int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height(theme->get_font_size("tab_fg", "TabContainer")) + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(MARGIN_TOP);
- style_panel_invisible_top->set_expand_margin_size(MARGIN_TOP, -stylebox_offset);
- style_panel_invisible_top->set_default_margin(MARGIN_TOP, 0);
+ int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height(theme->get_font_size("tab_fg", "TabContainer")) + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(SIDE_TOP);
+ style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset);
+ style_panel_invisible_top->set_default_margin(SIDE_TOP, 0);
theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top);
// LineEdit
@@ -958,8 +958,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// WindowDialog
Ref<StyleBoxFlat> style_window = style_popup->duplicate();
style_window->set_border_color(tab_color);
- style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE);
+ style_window->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ style_window->set_expand_margin_size(SIDE_TOP, 24 * EDSCALE);
theme->set_stylebox("panel", "Window", style_default);
theme->set_stylebox("panel_window", "Window", style_window);
@@ -1055,10 +1055,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
float v = MAX(border_size * EDSCALE, 1.0);
- style_tooltip->set_default_margin(MARGIN_LEFT, v);
- style_tooltip->set_default_margin(MARGIN_TOP, v);
- style_tooltip->set_default_margin(MARGIN_RIGHT, v);
- style_tooltip->set_default_margin(MARGIN_BOTTOM, v);
+ style_tooltip->set_default_margin(SIDE_LEFT, v);
+ style_tooltip->set_default_margin(SIDE_TOP, v);
+ style_tooltip->set_default_margin(SIDE_RIGHT, v);
+ style_tooltip->set_default_margin(SIDE_BOTTOM, v);
style_tooltip->set_bg_color(Color(mono_color.r, mono_color.g, mono_color.b, 0.9));
style_tooltip->set_border_width_all(border_width);
style_tooltip->set_border_color(mono_color);
@@ -1155,10 +1155,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
smgraphsbselected->set_shadow_color(shadow_color);
if (use_gn_headers) {
- graphsb->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbcomment->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbcommentselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ graphsb->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbselected->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbcomment->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbcommentselected->set_border_width(SIDE_TOP, 24 * EDSCALE);
}
theme->set_stylebox("frame", "GraphNode", graphsb);
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 076b873eac..e8588bbed5 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -294,10 +294,10 @@ FindInFilesDialog::FindInFilesDialog() {
set_title(TTR("Find in Files"));
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
add_child(vbc);
GridContainer *gc = memnew(GridContainer);
@@ -551,10 +551,10 @@ FindInFilesPanel::FindInFilesPanel() {
add_child(_finder);
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
- vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
+ vbc->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0);
+ vbc->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0);
add_child(vbc);
{
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 32c50321d7..1eaf7d70b7 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -413,7 +413,7 @@ GroupDialog::GroupDialog() {
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
- vbc->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
+ vbc->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
@@ -534,7 +534,7 @@ GroupDialog::GroupDialog() {
group_empty->set_autowrap(true);
group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
nodes_to_remove->add_child(group_empty);
- group_empty->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
+ group_empty->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
set_title(TTR("Group Editor"));
diff --git a/editor/input_map_editor.cpp b/editor/input_map_editor.cpp
index 83adccb752..249b9770b1 100644
--- a/editor/input_map_editor.cpp
+++ b/editor/input_map_editor.cpp
@@ -921,10 +921,10 @@ InputMapEditor::InputMapEditor() {
inputmap_changed = "inputmap_changed";
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 0);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, 0);
- vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 0);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 0);
+ vbc->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, 0);
+ vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 0);
+ vbc->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, 0);
add_child(vbc);
HBoxContainer *hbc = memnew(HBoxContainer);
@@ -986,10 +986,10 @@ InputMapEditor::InputMapEditor() {
l = memnew(Label);
l->set_text(TTR("Press a Key..."));
- l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ l->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
- l->set_margin(MARGIN_TOP, 20);
- l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30);
+ l->set_offset(SIDE_TOP, 20);
+ l->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_BEGIN, 30);
press_a_key->add_child(l);
press_a_key_label = l;
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 38648b5f0a..a20bbd2b62 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -127,7 +127,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
- node->set_offset(blend_tree->get_node_position(E->get()) * EDSCALE);
+ node->set_position_offset(blend_tree->get_node_position(E->get()) * EDSCALE);
node->set_title(agnode->get_caption());
node->set_name(E->get());
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index c59e056f4f..6fa1792c67 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1291,18 +1291,18 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
state_machine_play_pos = memnew(Control);
state_machine_draw->add_child(state_machine_play_pos);
state_machine_play_pos->set_mouse_filter(MOUSE_FILTER_PASS); //pass all to parent
- state_machine_play_pos->set_anchors_and_margins_preset(PRESET_WIDE);
+ state_machine_play_pos->set_anchors_and_offsets_preset(PRESET_WIDE);
state_machine_play_pos->connect("draw", callable_mp(this, &AnimationNodeStateMachineEditor::_state_machine_pos_draw));
v_scroll = memnew(VScrollBar);
state_machine_draw->add_child(v_scroll);
- v_scroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
+ v_scroll->set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
v_scroll->connect("value_changed", callable_mp(this, &AnimationNodeStateMachineEditor::_scroll_changed));
h_scroll = memnew(HScrollBar);
state_machine_draw->add_child(h_scroll);
- h_scroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
- h_scroll->set_margin(MARGIN_RIGHT, -v_scroll->get_size().x * EDSCALE);
+ h_scroll->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
+ h_scroll->set_offset(SIDE_RIGHT, -v_scroll->get_size().x * EDSCALE);
h_scroll->connect("value_changed", callable_mp(this, &AnimationNodeStateMachineEditor::_scroll_changed));
error_panel = memnew(PanelContainer);
@@ -1328,7 +1328,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
add_child(name_edit_popup);
name_edit = memnew(LineEdit);
name_edit_popup->add_child(name_edit);
- name_edit->set_anchors_and_margins_preset(PRESET_WIDE);
+ name_edit->set_anchors_and_offsets_preset(PRESET_WIDE);
name_edit->connect("text_entered", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited));
name_edit->connect("focus_exited", callable_mp(this, &AnimationNodeStateMachineEditor::_name_edited_focus_out));
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index ba798a7826..bd70e649e6 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -87,10 +87,10 @@ void EditorAssetLibraryItem::_bind_methods() {
EditorAssetLibraryItem::EditorAssetLibraryItem() {
Ref<StyleBoxEmpty> border;
border.instance();
- border->set_default_margin(MARGIN_LEFT, 5 * EDSCALE);
- border->set_default_margin(MARGIN_RIGHT, 5 * EDSCALE);
- border->set_default_margin(MARGIN_BOTTOM, 5 * EDSCALE);
- border->set_default_margin(MARGIN_TOP, 5 * EDSCALE);
+ border->set_default_margin(SIDE_LEFT, 5 * EDSCALE);
+ border->set_default_margin(SIDE_RIGHT, 5 * EDSCALE);
+ border->set_default_margin(SIDE_BOTTOM, 5 * EDSCALE);
+ border->set_default_margin(SIDE_TOP, 5 * EDSCALE);
add_theme_style_override("panel", border);
HBoxContainer *hb = memnew(HBoxContainer);
@@ -1400,10 +1400,10 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
Ref<StyleBoxEmpty> border2;
border2.instance();
- border2->set_default_margin(MARGIN_LEFT, 15 * EDSCALE);
- border2->set_default_margin(MARGIN_RIGHT, 35 * EDSCALE);
- border2->set_default_margin(MARGIN_BOTTOM, 15 * EDSCALE);
- border2->set_default_margin(MARGIN_TOP, 15 * EDSCALE);
+ border2->set_default_margin(SIDE_LEFT, 15 * EDSCALE);
+ border2->set_default_margin(SIDE_RIGHT, 35 * EDSCALE);
+ border2->set_default_margin(SIDE_BOTTOM, 15 * EDSCALE);
+ border2->set_default_margin(SIDE_TOP, 15 * EDSCALE);
PanelContainer *library_vb_border = memnew(PanelContainer);
library_scroll->add_child(library_vb_border);
@@ -1493,7 +1493,7 @@ AssetLibraryEditorPlugin::AssetLibraryEditorPlugin(EditorNode *p_node) {
addon_library = memnew(EditorAssetLibrary);
addon_library->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(addon_library);
- addon_library->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ addon_library->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
addon_library->hide();
}
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index 998916349c..5041cf9f32 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -202,7 +202,7 @@ AudioStreamEditor::AudioStreamEditor() {
add_child(_player);
VBoxContainer *vbox = memnew(VBoxContainer);
- vbox->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_MINSIZE, 0);
+ vbox->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_MINSIZE, 0);
add_child(vbox);
_preview = memnew(ColorRect);
@@ -211,7 +211,7 @@ AudioStreamEditor::AudioStreamEditor() {
vbox->add_child(_preview);
_indicator = memnew(Control);
- _indicator->set_anchors_and_margins_preset(PRESET_WIDE);
+ _indicator->set_anchors_and_offsets_preset(PRESET_WIDE);
_indicator->connect("draw", callable_mp(this, &AudioStreamEditor::_draw_indicator));
_indicator->connect("gui_input", callable_mp(this, &AudioStreamEditor::_on_input_indicator));
_preview->add_child(_indicator);
diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp
index 48f9f208a5..9a5cfd35cd 100644
--- a/editor/plugins/camera_3d_editor_plugin.cpp
+++ b/editor/plugins/camera_3d_editor_plugin.cpp
@@ -69,12 +69,12 @@ Camera3DEditor::Camera3DEditor() {
preview->set_text(TTR("Preview"));
preview->set_toggle_mode(true);
- preview->set_anchor(MARGIN_LEFT, Control::ANCHOR_END);
- preview->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
- preview->set_margin(MARGIN_LEFT, -60);
- preview->set_margin(MARGIN_RIGHT, 0);
- preview->set_margin(MARGIN_TOP, 0);
- preview->set_margin(MARGIN_BOTTOM, 10);
+ preview->set_anchor(SIDE_LEFT, Control::ANCHOR_END);
+ preview->set_anchor(SIDE_RIGHT, Control::ANCHOR_END);
+ preview->set_offset(SIDE_LEFT, -60);
+ preview->set_offset(SIDE_RIGHT, 0);
+ preview->set_offset(SIDE_TOP, 0);
+ preview->set_offset(SIDE_BOTTOM, 10);
preview->connect("pressed", callable_mp(this, &Camera3DEditor::_pressed));
}
@@ -100,12 +100,12 @@ Camera3DEditorPlugin::Camera3DEditorPlugin(EditorNode *p_node) {
/* camera_editor = memnew( CameraEditor );
editor->get_viewport()->add_child(camera_editor);
- camera_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
- camera_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
- camera_editor->set_margin(MARGIN_LEFT,60);
- camera_editor->set_margin(MARGIN_RIGHT,0);
- camera_editor->set_margin(MARGIN_TOP,0);
- camera_editor->set_margin(MARGIN_BOTTOM,10);
+ camera_editor->set_anchor(SIDE_LEFT,Control::ANCHOR_END);
+ camera_editor->set_anchor(SIDE_RIGHT,Control::ANCHOR_END);
+ camera_editor->set_offset(SIDE_LEFT,60);
+ camera_editor->set_offset(SIDE_RIGHT,0);
+ camera_editor->set_offset(SIDE_TOP,0);
+ camera_editor->set_offset(SIDE_BOTTOM,10);
camera_editor->hide();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index ac037f829f..5073cbd0b9 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -366,8 +366,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
// Self anchors
if ((is_snap_active && snap_node_anchors && (p_modes & SNAP_NODE_ANCHORS)) || (p_forced_modes & SNAP_NODE_ANCHORS)) {
if (const Control *c = Object::cast_to<Control>(p_self_canvas_item)) {
- Point2 begin = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_LEFT), c->get_anchor(MARGIN_TOP))));
- Point2 end = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(MARGIN_RIGHT), c->get_anchor(MARGIN_BOTTOM))));
+ Point2 begin = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(SIDE_LEFT), c->get_anchor(SIDE_TOP))));
+ Point2 end = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(c->get_anchor(SIDE_RIGHT), c->get_anchor(SIDE_BOTTOM))));
_snap_if_closer_point(p_target, output, snap_target, begin, SNAP_TARGET_SELF_ANCHORS, rotation);
_snap_if_closer_point(p_target, output, snap_target, end, SNAP_TARGET_SELF_ANCHORS, rotation);
}
@@ -1628,10 +1628,10 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
Control *control = Object::cast_to<Control>(selection[0]);
if (control && _is_node_movable(control)) {
Vector2 anchor_pos[4];
- anchor_pos[0] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_TOP));
- anchor_pos[1] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_TOP));
- anchor_pos[2] = Vector2(control->get_anchor(MARGIN_RIGHT), control->get_anchor(MARGIN_BOTTOM));
- anchor_pos[3] = Vector2(control->get_anchor(MARGIN_LEFT), control->get_anchor(MARGIN_BOTTOM));
+ anchor_pos[0] = Vector2(control->get_anchor(SIDE_LEFT), control->get_anchor(SIDE_TOP));
+ anchor_pos[1] = Vector2(control->get_anchor(SIDE_RIGHT), control->get_anchor(SIDE_TOP));
+ anchor_pos[2] = Vector2(control->get_anchor(SIDE_RIGHT), control->get_anchor(SIDE_BOTTOM));
+ anchor_pos[3] = Vector2(control->get_anchor(SIDE_LEFT), control->get_anchor(SIDE_BOTTOM));
Rect2 anchor_rects[4];
for (int i = 0; i < 4; i++) {
@@ -1681,8 +1681,8 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
Transform2D xform = control->get_global_transform_with_canvas().affine_inverse();
Point2 previous_anchor;
- previous_anchor.x = (drag_type == DRAG_ANCHOR_TOP_LEFT || drag_type == DRAG_ANCHOR_BOTTOM_LEFT) ? control->get_anchor(MARGIN_LEFT) : control->get_anchor(MARGIN_RIGHT);
- previous_anchor.y = (drag_type == DRAG_ANCHOR_TOP_LEFT || drag_type == DRAG_ANCHOR_TOP_RIGHT) ? control->get_anchor(MARGIN_TOP) : control->get_anchor(MARGIN_BOTTOM);
+ previous_anchor.x = (drag_type == DRAG_ANCHOR_TOP_LEFT || drag_type == DRAG_ANCHOR_BOTTOM_LEFT) ? control->get_anchor(SIDE_LEFT) : control->get_anchor(SIDE_RIGHT);
+ previous_anchor.y = (drag_type == DRAG_ANCHOR_TOP_LEFT || drag_type == DRAG_ANCHOR_TOP_RIGHT) ? control->get_anchor(SIDE_TOP) : control->get_anchor(SIDE_BOTTOM);
previous_anchor = xform.affine_inverse().xform(_anchor_to_position(control, previous_anchor));
Vector2 new_anchor = xform.xform(snap_point(previous_anchor + (drag_to - drag_from), SNAP_GRID | SNAP_OTHER_NODES, SNAP_NODE_PARENT | SNAP_NODE_SIDES | SNAP_NODE_CENTER, control));
@@ -1695,44 +1695,44 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
switch (drag_type) {
case DRAG_ANCHOR_TOP_LEFT:
if (!use_single_axis || !use_y) {
- control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
+ control->set_anchor(SIDE_LEFT, new_anchor.x, false, false);
}
if (!use_single_axis || use_y) {
- control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
+ control->set_anchor(SIDE_TOP, new_anchor.y, false, false);
}
break;
case DRAG_ANCHOR_TOP_RIGHT:
if (!use_single_axis || !use_y) {
- control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
+ control->set_anchor(SIDE_RIGHT, new_anchor.x, false, false);
}
if (!use_single_axis || use_y) {
- control->set_anchor(MARGIN_TOP, new_anchor.y, false, false);
+ control->set_anchor(SIDE_TOP, new_anchor.y, false, false);
}
break;
case DRAG_ANCHOR_BOTTOM_RIGHT:
if (!use_single_axis || !use_y) {
- control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, false);
+ control->set_anchor(SIDE_RIGHT, new_anchor.x, false, false);
}
if (!use_single_axis || use_y) {
- control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
+ control->set_anchor(SIDE_BOTTOM, new_anchor.y, false, false);
}
break;
case DRAG_ANCHOR_BOTTOM_LEFT:
if (!use_single_axis || !use_y) {
- control->set_anchor(MARGIN_LEFT, new_anchor.x, false, false);
+ control->set_anchor(SIDE_LEFT, new_anchor.x, false, false);
}
if (!use_single_axis || use_y) {
- control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false);
+ control->set_anchor(SIDE_BOTTOM, new_anchor.y, false, false);
}
break;
case DRAG_ANCHOR_ALL:
if (!use_single_axis || !use_y) {
- control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true);
- control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true);
+ control->set_anchor(SIDE_LEFT, new_anchor.x, false, true);
+ control->set_anchor(SIDE_RIGHT, new_anchor.x, false, true);
}
if (!use_single_axis || use_y) {
- control->set_anchor(MARGIN_TOP, new_anchor.y, false, true);
- control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true);
+ control->set_anchor(SIDE_TOP, new_anchor.y, false, true);
+ control->set_anchor(SIDE_BOTTOM, new_anchor.y, false, true);
}
break;
default:
@@ -2780,37 +2780,37 @@ void CanvasItemEditor::_update_cursor() {
viewport->set_default_cursor_shape(c);
}
-void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Margin p_side) {
+void CanvasItemEditor::_draw_text_at_position(Point2 p_position, String p_string, Side p_side) {
Color color = get_theme_color("font_color", "Editor");
color.a = 0.8;
Ref<Font> font = get_theme_font("font", "Label");
int font_size = get_theme_font_size("font_size", "Label");
Size2 text_size = font->get_string_size(p_string, font_size);
switch (p_side) {
- case MARGIN_LEFT:
+ case SIDE_LEFT:
p_position += Vector2(-text_size.x - 5, text_size.y / 2);
break;
- case MARGIN_TOP:
+ case SIDE_TOP:
p_position += Vector2(-text_size.x / 2, -5);
break;
- case MARGIN_RIGHT:
+ case SIDE_RIGHT:
p_position += Vector2(5, text_size.y / 2);
break;
- case MARGIN_BOTTOM:
+ case SIDE_BOTTOM:
p_position += Vector2(-text_size.x / 2, text_size.y + 5);
break;
}
viewport->draw_string(font, p_position, p_string, HALIGN_LEFT, -1, font_size, color);
}
-void CanvasItemEditor::_draw_margin_at_position(int p_value, Point2 p_position, Margin p_side) {
+void CanvasItemEditor::_draw_margin_at_position(int p_value, Point2 p_position, Side p_side) {
String str = TS->format_number(vformat("%d " + TTR("px"), p_value));
if (p_value != 0) {
_draw_text_at_position(p_position, str, p_side);
}
}
-void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side) {
+void CanvasItemEditor::_draw_percentage_at_position(float p_value, Point2 p_position, Side p_side) {
String str = TS->format_number(vformat("%.1f ", p_value * 100.0)) + TS->percent_sign();
if (p_value != 0) {
_draw_text_at_position(p_position, str, p_side);
@@ -3185,10 +3185,10 @@ void CanvasItemEditor::_draw_control_anchors(Control *control) {
if (tool == TOOL_SELECT && !Object::cast_to<Container>(control->get_parent())) {
// Compute the anchors
float anchors_values[4];
- anchors_values[0] = control->get_anchor(MARGIN_LEFT);
- anchors_values[1] = control->get_anchor(MARGIN_TOP);
- anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
- anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+ anchors_values[0] = control->get_anchor(SIDE_LEFT);
+ anchors_values[1] = control->get_anchor(SIDE_TOP);
+ anchors_values[2] = control->get_anchor(SIDE_RIGHT);
+ anchors_values[3] = control->get_anchor(SIDE_BOTTOM);
Vector2 anchors_pos[4];
for (int i = 0; i < 4; i++) {
@@ -3224,10 +3224,10 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
// Compute the anchors
float anchors_values[4];
- anchors_values[0] = control->get_anchor(MARGIN_LEFT);
- anchors_values[1] = control->get_anchor(MARGIN_TOP);
- anchors_values[2] = control->get_anchor(MARGIN_RIGHT);
- anchors_values[3] = control->get_anchor(MARGIN_BOTTOM);
+ anchors_values[0] = control->get_anchor(SIDE_LEFT);
+ anchors_values[1] = control->get_anchor(SIDE_TOP);
+ anchors_values[2] = control->get_anchor(SIDE_RIGHT);
+ anchors_values[3] = control->get_anchor(SIDE_BOTTOM);
Vector2 anchors[4];
Vector2 anchors_pos[4];
@@ -3280,19 +3280,19 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
float percent_val;
percent_val = anchors_values[(dragged_anchor + 2) % 4] - anchors_values[dragged_anchor];
percent_val = (dragged_anchor >= 2) ? -percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Margin)((dragged_anchor + 1) % 4));
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 1) % 4]) / 2, (Side)((dragged_anchor + 1) % 4));
percent_val = anchors_values[(dragged_anchor + 3) % 4] - anchors_values[(dragged_anchor + 1) % 4];
percent_val = ((dragged_anchor + 1) % 4 >= 2) ? -percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Margin)(dragged_anchor));
+ _draw_percentage_at_position(percent_val, (anchors_pos[dragged_anchor] + anchors_pos[(dragged_anchor + 3) % 4]) / 2, (Side)(dragged_anchor));
percent_val = anchors_values[(dragged_anchor + 1) % 4];
percent_val = ((dragged_anchor + 1) % 4 >= 2) ? ANCHOR_END - percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Margin)(dragged_anchor));
+ _draw_percentage_at_position(percent_val, (line_starts[dragged_anchor] + anchors_pos[dragged_anchor]) / 2, (Side)(dragged_anchor));
percent_val = anchors_values[dragged_anchor];
percent_val = (dragged_anchor >= 2) ? ANCHOR_END - percent_val : percent_val;
- _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Margin)((dragged_anchor + 1) % 4));
+ _draw_percentage_at_position(percent_val, (line_ends[(dragged_anchor + 1) % 4] + anchors_pos[dragged_anchor]) / 2, (Side)((dragged_anchor + 1) % 4));
}
// Draw the margin values and the node width/height when dragging control side
@@ -3302,22 +3302,22 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
Rect2 parent_rect = control->get_parent_anchorable_rect();
- node_pos_in_parent[0] = control->get_anchor(MARGIN_LEFT) * parent_rect.size.width + control->get_margin(MARGIN_LEFT) + parent_rect.position.x;
- node_pos_in_parent[1] = control->get_anchor(MARGIN_TOP) * parent_rect.size.height + control->get_margin(MARGIN_TOP) + parent_rect.position.y;
- node_pos_in_parent[2] = control->get_anchor(MARGIN_RIGHT) * parent_rect.size.width + control->get_margin(MARGIN_RIGHT) + parent_rect.position.x;
- node_pos_in_parent[3] = control->get_anchor(MARGIN_BOTTOM) * parent_rect.size.height + control->get_margin(MARGIN_BOTTOM) + parent_rect.position.y;
+ node_pos_in_parent[0] = control->get_anchor(SIDE_LEFT) * parent_rect.size.width + control->get_offset(SIDE_LEFT) + parent_rect.position.x;
+ node_pos_in_parent[1] = control->get_anchor(SIDE_TOP) * parent_rect.size.height + control->get_offset(SIDE_TOP) + parent_rect.position.y;
+ node_pos_in_parent[2] = control->get_anchor(SIDE_RIGHT) * parent_rect.size.width + control->get_offset(SIDE_RIGHT) + parent_rect.position.x;
+ node_pos_in_parent[3] = control->get_anchor(SIDE_BOTTOM) * parent_rect.size.height + control->get_offset(SIDE_BOTTOM) + parent_rect.position.y;
Point2 start, end;
switch (drag_type) {
case DRAG_LEFT:
case DRAG_TOP_LEFT:
case DRAG_BOTTOM_LEFT:
- _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), SIDE_BOTTOM);
[[fallthrough]];
case DRAG_MOVE:
start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio));
- end = start - Vector2(control->get_margin(MARGIN_LEFT), 0);
- _draw_margin_at_position(control->get_margin(MARGIN_LEFT), parent_transform.xform((start + end) / 2), MARGIN_TOP);
+ end = start - Vector2(control->get_offset(SIDE_LEFT), 0);
+ _draw_margin_at_position(control->get_offset(SIDE_LEFT), parent_transform.xform((start + end) / 2), SIDE_TOP);
viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE));
break;
default:
@@ -3327,12 +3327,12 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_RIGHT:
case DRAG_TOP_RIGHT:
case DRAG_BOTTOM_RIGHT:
- _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), MARGIN_BOTTOM);
+ _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), SIDE_BOTTOM);
[[fallthrough]];
case DRAG_MOVE:
start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio));
- end = start - Vector2(control->get_margin(MARGIN_RIGHT), 0);
- _draw_margin_at_position(control->get_margin(MARGIN_RIGHT), parent_transform.xform((start + end) / 2), MARGIN_BOTTOM);
+ end = start - Vector2(control->get_offset(SIDE_RIGHT), 0);
+ _draw_margin_at_position(control->get_offset(SIDE_RIGHT), parent_transform.xform((start + end) / 2), SIDE_BOTTOM);
viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE));
break;
default:
@@ -3342,12 +3342,12 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_TOP:
case DRAG_TOP_LEFT:
case DRAG_TOP_RIGHT:
- _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), MARGIN_RIGHT);
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), SIDE_RIGHT);
[[fallthrough]];
case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]);
- end = start - Vector2(0, control->get_margin(MARGIN_TOP));
- _draw_margin_at_position(control->get_margin(MARGIN_TOP), parent_transform.xform((start + end) / 2), MARGIN_LEFT);
+ end = start - Vector2(0, control->get_offset(SIDE_TOP));
+ _draw_margin_at_position(control->get_offset(SIDE_TOP), parent_transform.xform((start + end) / 2), SIDE_LEFT);
viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE));
break;
default:
@@ -3357,12 +3357,12 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) {
case DRAG_BOTTOM:
case DRAG_BOTTOM_LEFT:
case DRAG_BOTTOM_RIGHT:
- _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), MARGIN_RIGHT);
+ _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), SIDE_RIGHT);
[[fallthrough]];
case DRAG_MOVE:
start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]);
- end = start - Vector2(0, control->get_margin(MARGIN_BOTTOM));
- _draw_margin_at_position(control->get_margin(MARGIN_BOTTOM), parent_transform.xform((start + end) / 2), MARGIN_RIGHT);
+ end = start - Vector2(0, control->get_offset(SIDE_BOTTOM));
+ _draw_margin_at_position(control->get_offset(SIDE_BOTTOM), parent_transform.xform((start + end) / 2), SIDE_RIGHT);
viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE));
break;
default:
@@ -3941,7 +3941,7 @@ void CanvasItemEditor::_draw_viewport() {
group_button->set_disabled(selection.empty());
ungroup_button->set_visible(all_group);
- info_overlay->set_margin(MARGIN_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
+ info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
_draw_grid();
_draw_ruler_tool();
@@ -4019,17 +4019,17 @@ void CanvasItemEditor::_notification(int p_what) {
Vector2 pivot;
pivot = control->get_pivot_offset();
- anchors[MARGIN_LEFT] = control->get_anchor(MARGIN_LEFT);
- anchors[MARGIN_RIGHT] = control->get_anchor(MARGIN_RIGHT);
- anchors[MARGIN_TOP] = control->get_anchor(MARGIN_TOP);
- anchors[MARGIN_BOTTOM] = control->get_anchor(MARGIN_BOTTOM);
+ anchors[SIDE_LEFT] = control->get_anchor(SIDE_LEFT);
+ anchors[SIDE_RIGHT] = control->get_anchor(SIDE_RIGHT);
+ anchors[SIDE_TOP] = control->get_anchor(SIDE_TOP);
+ anchors[SIDE_BOTTOM] = control->get_anchor(SIDE_BOTTOM);
- if (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]) {
+ if (pivot != se->prev_pivot || anchors[SIDE_LEFT] != se->prev_anchors[SIDE_LEFT] || anchors[SIDE_RIGHT] != se->prev_anchors[SIDE_RIGHT] || anchors[SIDE_TOP] != se->prev_anchors[SIDE_TOP] || anchors[SIDE_BOTTOM] != se->prev_anchors[SIDE_BOTTOM]) {
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];
+ se->prev_anchors[SIDE_LEFT] = anchors[SIDE_LEFT];
+ se->prev_anchors[SIDE_RIGHT] = anchors[SIDE_RIGHT];
+ se->prev_anchors[SIDE_TOP] = anchors[SIDE_TOP];
+ se->prev_anchors[SIDE_BOTTOM] = anchors[SIDE_BOTTOM];
viewport->update();
}
nb_control++;
@@ -4100,8 +4100,8 @@ void CanvasItemEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
select_sb->set_texture(get_theme_icon("EditorRect2D", "EditorIcons"));
for (int i = 0; i < 4; i++) {
- select_sb->set_margin_size(Margin(i), 4);
- select_sb->set_default_margin(Margin(i), 4);
+ select_sb->set_margin_size(Side(i), 4);
+ select_sb->set_default_margin(Side(i), 4);
}
AnimationPlayerEditor::singleton->get_track_editor()->connect("visibility_changed", callable_mp(this, &CanvasItemEditor::_keying_changed));
@@ -4158,26 +4158,26 @@ void CanvasItemEditor::_notification(int p_what) {
PopupMenu *p = presets_menu->get_popup();
p->clear();
- p->add_icon_item(get_theme_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_AND_MARGINS_PRESET_TOP_LEFT);
- p->add_icon_item(get_theme_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT);
- p->add_icon_item(get_theme_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT);
- p->add_icon_item(get_theme_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT);
+ p->add_icon_item(get_theme_icon("ControlAlignTopLeft", "EditorIcons"), TTR("Top Left"), ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT);
+ p->add_icon_item(get_theme_icon("ControlAlignTopRight", "EditorIcons"), TTR("Top Right"), ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT);
+ p->add_icon_item(get_theme_icon("ControlAlignBottomRight", "EditorIcons"), TTR("Bottom Right"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT);
+ p->add_icon_item(get_theme_icon("ControlAlignBottomLeft", "EditorIcons"), TTR("Bottom Left"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT);
p->add_separator();
- p->add_icon_item(get_theme_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT);
- p->add_icon_item(get_theme_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_AND_MARGINS_PRESET_CENTER_TOP);
- p->add_icon_item(get_theme_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT);
- p->add_icon_item(get_theme_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM);
- p->add_icon_item(get_theme_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_AND_MARGINS_PRESET_CENTER);
+ p->add_icon_item(get_theme_icon("ControlAlignLeftCenter", "EditorIcons"), TTR("Center Left"), ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT);
+ p->add_icon_item(get_theme_icon("ControlAlignTopCenter", "EditorIcons"), TTR("Center Top"), ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP);
+ p->add_icon_item(get_theme_icon("ControlAlignRightCenter", "EditorIcons"), TTR("Center Right"), ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT);
+ p->add_icon_item(get_theme_icon("ControlAlignBottomCenter", "EditorIcons"), TTR("Center Bottom"), ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM);
+ p->add_icon_item(get_theme_icon("ControlAlignCenter", "EditorIcons"), TTR("Center"), ANCHORS_AND_OFFSETS_PRESET_CENTER);
p->add_separator();
- p->add_icon_item(get_theme_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE);
- p->add_icon_item(get_theme_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_AND_MARGINS_PRESET_TOP_WIDE);
- p->add_icon_item(get_theme_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE);
- p->add_icon_item(get_theme_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE);
- p->add_icon_item(get_theme_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE);
- p->add_icon_item(get_theme_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE);
+ p->add_icon_item(get_theme_icon("ControlAlignLeftWide", "EditorIcons"), TTR("Left Wide"), ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE);
+ p->add_icon_item(get_theme_icon("ControlAlignTopWide", "EditorIcons"), TTR("Top Wide"), ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE);
+ p->add_icon_item(get_theme_icon("ControlAlignRightWide", "EditorIcons"), TTR("Right Wide"), ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE);
+ p->add_icon_item(get_theme_icon("ControlAlignBottomWide", "EditorIcons"), TTR("Bottom Wide"), ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE);
+ p->add_icon_item(get_theme_icon("ControlVcenterWide", "EditorIcons"), TTR("VCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE);
+ p->add_icon_item(get_theme_icon("ControlHcenterWide", "EditorIcons"), TTR("HCenter Wide"), ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE);
p->add_separator();
- p->add_icon_item(get_theme_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_AND_MARGINS_PRESET_WIDE);
- p->add_icon_item(get_theme_icon("Anchor", "EditorIcons"), TTR("Keep Ratio"), ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO);
+ p->add_icon_item(get_theme_icon("ControlAlignWide", "EditorIcons"), TTR("Full Rect"), ANCHORS_AND_OFFSETS_PRESET_WIDE);
+ p->add_icon_item(get_theme_icon("Anchor", "EditorIcons"), TTR("Keep Ratio"), ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO);
p->add_separator();
p->add_submenu_item(TTR("Anchors only"), "Anchors");
p->set_item_icon(21, get_theme_icon("Anchor", "EditorIcons"));
@@ -4396,7 +4396,7 @@ void CanvasItemEditor::_popup_warning_depop(Control *p_control) {
timer->queue_delete();
p_control->hide();
popup_temporarily_timers.erase(p_control);
- info_overlay->set_margin(MARGIN_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
+ info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
}
void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const float p_duration) {
@@ -4414,7 +4414,7 @@ void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const floa
timer->start(p_duration);
p_control->show();
- info_overlay->set_margin(MARGIN_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
+ info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
}
void CanvasItemEditor::_update_scroll(float) {
@@ -4427,10 +4427,10 @@ void CanvasItemEditor::_update_scroll(float) {
viewport->update();
}
-void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_preset) {
+void CanvasItemEditor::_set_anchors_and_offsets_preset(Control::LayoutPreset p_preset) {
List<Node *> selection = editor_selection->get_selected_node_list();
- undo_redo->create_action(TTR("Change Anchors and Margins"));
+ undo_redo->create_action(TTR("Change Anchors and Offsets"));
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Control *control = Object::cast_to<Control>(E->get());
@@ -4468,20 +4468,20 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p
anchor_mode_button->set_pressed(anchors_mode);
}
-void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() {
+void CanvasItemEditor::_set_anchors_and_offsets_to_keep_ratio() {
List<Node *> selection = editor_selection->get_selected_node_list();
- undo_redo->create_action(TTR("Change Anchors and Margins"));
+ undo_redo->create_action(TTR("Change Anchors and Offsets"));
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Control *control = Object::cast_to<Control>(E->get());
if (control) {
Point2 top_left_anchor = _position_to_anchor(control, Point2());
Point2 bottom_right_anchor = _position_to_anchor(control, control->get_size());
- undo_redo->add_do_method(control, "set_anchor", MARGIN_LEFT, top_left_anchor.x, false, true);
- undo_redo->add_do_method(control, "set_anchor", MARGIN_RIGHT, bottom_right_anchor.x, false, true);
- undo_redo->add_do_method(control, "set_anchor", MARGIN_TOP, top_left_anchor.y, false, true);
- undo_redo->add_do_method(control, "set_anchor", MARGIN_BOTTOM, bottom_right_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_LEFT, top_left_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_RIGHT, bottom_right_anchor.x, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_TOP, top_left_anchor.y, false, true);
+ undo_redo->add_do_method(control, "set_anchor", SIDE_BOTTOM, bottom_right_anchor.y, false, true);
undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
@@ -4934,56 +4934,56 @@ void CanvasItemEditor::_popup_callback(int p_op) {
undo_redo->add_undo_method(viewport, "update", Variant());
undo_redo->commit_action();
} break;
- case ANCHORS_AND_MARGINS_PRESET_TOP_LEFT: {
- _set_anchors_and_margins_preset(PRESET_TOP_LEFT);
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_LEFT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT: {
- _set_anchors_and_margins_preset(PRESET_TOP_RIGHT);
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_RIGHT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT: {
- _set_anchors_and_margins_preset(PRESET_BOTTOM_LEFT);
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_LEFT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT: {
- _set_anchors_and_margins_preset(PRESET_BOTTOM_RIGHT);
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_RIGHT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT: {
- _set_anchors_and_margins_preset(PRESET_CENTER_LEFT);
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_LEFT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT: {
- _set_anchors_and_margins_preset(PRESET_CENTER_RIGHT);
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_RIGHT);
} break;
- case ANCHORS_AND_MARGINS_PRESET_CENTER_TOP: {
- _set_anchors_and_margins_preset(PRESET_CENTER_TOP);
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_TOP);
} break;
- case ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM: {
- _set_anchors_and_margins_preset(PRESET_CENTER_BOTTOM);
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER_BOTTOM);
} break;
- case ANCHORS_AND_MARGINS_PRESET_CENTER: {
- _set_anchors_and_margins_preset(PRESET_CENTER);
+ case ANCHORS_AND_OFFSETS_PRESET_CENTER: {
+ _set_anchors_and_offsets_preset(PRESET_CENTER);
} break;
- case ANCHORS_AND_MARGINS_PRESET_TOP_WIDE: {
- _set_anchors_and_margins_preset(PRESET_TOP_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_TOP_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE: {
- _set_anchors_and_margins_preset(PRESET_LEFT_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_LEFT_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE: {
- _set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE: {
- _set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE: {
- _set_anchors_and_margins_preset(PRESET_VCENTER_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_VCENTER_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE: {
- _set_anchors_and_margins_preset(PRESET_HCENTER_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE: {
+ _set_anchors_and_offsets_preset(PRESET_HCENTER_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_WIDE: {
- _set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ case ANCHORS_AND_OFFSETS_PRESET_WIDE: {
+ _set_anchors_and_offsets_preset(Control::PRESET_WIDE);
} break;
- case ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO: {
- _set_anchors_and_margins_to_keep_ratio();
+ case ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO: {
+ _set_anchors_and_offsets_to_keep_ratio();
} break;
case ANCHORS_PRESET_TOP_LEFT: {
@@ -5572,12 +5572,12 @@ void CanvasItemEditor::add_control_to_info_overlay(Control *p_control) {
p_control->set_h_size_flags(p_control->get_h_size_flags() & ~Control::SIZE_EXPAND_FILL);
info_overlay->add_child(p_control);
- info_overlay->set_margin(MARGIN_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
+ info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
}
void CanvasItemEditor::remove_control_from_info_overlay(Control *p_control) {
info_overlay->remove_child(p_control);
- info_overlay->set_margin(MARGIN_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
+ info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10);
}
void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) {
@@ -5674,7 +5674,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
hb = memnew(HBoxContainer);
add_child(hb);
- hb->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ hb->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
bottom_split = memnew(VSplitContainer);
add_child(bottom_split);
@@ -5695,7 +5695,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
SubViewportContainer *scene_tree = memnew(SubViewportContainer);
viewport_scrollable->add_child(scene_tree);
scene_tree->set_stretch(true);
- scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ scene_tree->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
scene_tree->add_child(p_editor->get_scene_root());
controls_vb = memnew(VBoxContainer);
@@ -5709,16 +5709,16 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
viewport = memnew(CanvasItemEditorViewport(p_editor, this));
viewport_scrollable->add_child(viewport);
viewport->set_mouse_filter(MOUSE_FILTER_PASS);
- viewport->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ viewport->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
viewport->set_clip_contents(true);
viewport->set_focus_mode(FOCUS_ALL);
viewport->connect("draw", callable_mp(this, &CanvasItemEditor::_draw_viewport));
viewport->connect("gui_input", callable_mp(this, &CanvasItemEditor::_gui_input_viewport));
info_overlay = memnew(VBoxContainer);
- info_overlay->set_anchors_and_margins_preset(Control::PRESET_BOTTOM_LEFT);
- info_overlay->set_margin(MARGIN_LEFT, 10);
- info_overlay->set_margin(MARGIN_BOTTOM, -15);
+ info_overlay->set_anchors_and_offsets_preset(Control::PRESET_BOTTOM_LEFT);
+ info_overlay->set_offset(SIDE_LEFT, 10);
+ info_overlay->set_offset(SIDE_BOTTOM, -15);
info_overlay->set_v_grow_direction(Control::GROW_DIRECTION_BEGIN);
info_overlay->add_theme_constant_override("separation", 10);
viewport_scrollable->add_child(info_overlay);
@@ -6140,7 +6140,7 @@ CanvasItemEditorPlugin::CanvasItemEditorPlugin(EditorNode *p_node) {
canvas_item_editor = memnew(CanvasItemEditor(editor));
canvas_item_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
editor->get_viewport()->add_child(canvas_item_editor);
- canvas_item_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ canvas_item_editor->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
canvas_item_editor->hide();
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index c4a1dca593..f5da953810 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -119,23 +119,23 @@ private:
UNLOCK_SELECTED,
GROUP_SELECTED,
UNGROUP_SELECTED,
- ANCHORS_AND_MARGINS_PRESET_TOP_LEFT,
- ANCHORS_AND_MARGINS_PRESET_TOP_RIGHT,
- ANCHORS_AND_MARGINS_PRESET_BOTTOM_LEFT,
- ANCHORS_AND_MARGINS_PRESET_BOTTOM_RIGHT,
- ANCHORS_AND_MARGINS_PRESET_CENTER_LEFT,
- ANCHORS_AND_MARGINS_PRESET_CENTER_RIGHT,
- ANCHORS_AND_MARGINS_PRESET_CENTER_TOP,
- ANCHORS_AND_MARGINS_PRESET_CENTER_BOTTOM,
- ANCHORS_AND_MARGINS_PRESET_CENTER,
- ANCHORS_AND_MARGINS_PRESET_TOP_WIDE,
- ANCHORS_AND_MARGINS_PRESET_LEFT_WIDE,
- ANCHORS_AND_MARGINS_PRESET_RIGHT_WIDE,
- ANCHORS_AND_MARGINS_PRESET_BOTTOM_WIDE,
- ANCHORS_AND_MARGINS_PRESET_VCENTER_WIDE,
- ANCHORS_AND_MARGINS_PRESET_HCENTER_WIDE,
- ANCHORS_AND_MARGINS_PRESET_WIDE,
- ANCHORS_AND_MARGINS_PRESET_KEEP_RATIO,
+ ANCHORS_AND_OFFSETS_PRESET_TOP_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_TOP_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_LEFT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_RIGHT,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_TOP,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER_BOTTOM,
+ ANCHORS_AND_OFFSETS_PRESET_CENTER,
+ ANCHORS_AND_OFFSETS_PRESET_TOP_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_LEFT_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_RIGHT_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_BOTTOM_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_VCENTER_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_HCENTER_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_WIDE,
+ ANCHORS_AND_OFFSETS_PRESET_KEEP_RATIO,
ANCHORS_PRESET_TOP_LEFT,
ANCHORS_PRESET_TOP_RIGHT,
ANCHORS_PRESET_BOTTOM_LEFT,
@@ -152,22 +152,22 @@ private:
ANCHORS_PRESET_VCENTER_WIDE,
ANCHORS_PRESET_HCENTER_WIDE,
ANCHORS_PRESET_WIDE,
- MARGINS_PRESET_TOP_LEFT,
- MARGINS_PRESET_TOP_RIGHT,
- MARGINS_PRESET_BOTTOM_LEFT,
- MARGINS_PRESET_BOTTOM_RIGHT,
- MARGINS_PRESET_CENTER_LEFT,
- MARGINS_PRESET_CENTER_RIGHT,
- MARGINS_PRESET_CENTER_TOP,
- MARGINS_PRESET_CENTER_BOTTOM,
- MARGINS_PRESET_CENTER,
- MARGINS_PRESET_TOP_WIDE,
- MARGINS_PRESET_LEFT_WIDE,
- MARGINS_PRESET_RIGHT_WIDE,
- MARGINS_PRESET_BOTTOM_WIDE,
- MARGINS_PRESET_VCENTER_WIDE,
- MARGINS_PRESET_HCENTER_WIDE,
- MARGINS_PRESET_WIDE,
+ OFFSETS_PRESET_TOP_LEFT,
+ OFFSETS_PRESET_TOP_RIGHT,
+ OFFSETS_PRESET_BOTTOM_LEFT,
+ OFFSETS_PRESET_BOTTOM_RIGHT,
+ OFFSETS_PRESET_CENTER_LEFT,
+ OFFSETS_PRESET_CENTER_RIGHT,
+ OFFSETS_PRESET_CENTER_TOP,
+ OFFSETS_PRESET_CENTER_BOTTOM,
+ OFFSETS_PRESET_CENTER,
+ OFFSETS_PRESET_TOP_WIDE,
+ OFFSETS_PRESET_LEFT_WIDE,
+ OFFSETS_PRESET_RIGHT_WIDE,
+ OFFSETS_PRESET_BOTTOM_WIDE,
+ OFFSETS_PRESET_VCENTER_WIDE,
+ OFFSETS_PRESET_HCENTER_WIDE,
+ OFFSETS_PRESET_WIDE,
ANIM_INSERT_KEY,
ANIM_INSERT_KEY_EXISTING,
ANIM_INSERT_POS,
@@ -454,9 +454,9 @@ private:
void _unhandled_key_input(const Ref<InputEvent> &p_ev);
- void _draw_text_at_position(Point2 p_position, String p_string, Margin p_side);
- void _draw_margin_at_position(int p_value, Point2 p_position, Margin p_side);
- void _draw_percentage_at_position(float p_value, Point2 p_position, Margin p_side);
+ void _draw_text_at_position(Point2 p_position, String p_string, Side p_side);
+ void _draw_margin_at_position(int p_value, Point2 p_position, Side p_side);
+ void _draw_percentage_at_position(float p_value, Point2 p_position, Side p_side);
void _draw_straight_line(Point2 p_from, Point2 p_to, Color p_color);
void _draw_smart_snapping();
@@ -519,9 +519,9 @@ private:
const Node *p_current);
void _set_anchors_preset(Control::LayoutPreset p_preset);
- void _set_margins_preset(Control::LayoutPreset p_preset);
- void _set_anchors_and_margins_preset(Control::LayoutPreset p_preset);
- void _set_anchors_and_margins_to_keep_ratio();
+ void _set_offsets_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_offsets_preset(Control::LayoutPreset p_preset);
+ void _set_anchors_and_offsets_to_keep_ratio();
void _button_toggle_anchor_mode(bool p_status);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index e49cfd51f7..e45344b427 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -108,7 +108,7 @@ MaterialEditor::MaterialEditor() {
vc = memnew(SubViewportContainer);
vc->set_stretch(true);
add_child(vc);
- vc->set_anchors_and_margins_preset(PRESET_WIDE);
+ vc->set_anchors_and_offsets_preset(PRESET_WIDE);
viewport = memnew(SubViewport);
Ref<World3D> world_3d;
world_3d.instance();
@@ -155,7 +155,7 @@ MaterialEditor::MaterialEditor() {
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
- hb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
+ hb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
VBoxContainer *vb_shape = memnew(VBoxContainer);
hb->add_child(vb_shape);
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index 9d396467c3..79dbf7d522 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -137,7 +137,7 @@ MeshEditor::MeshEditor() {
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
- hb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
+ hb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2);
hb->add_spacer();
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index b11a07365c..fb34f4064a 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -298,7 +298,7 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
mesh_library_editor = memnew(MeshLibraryEditor(p_node));
p_node->get_viewport()->add_child(mesh_library_editor);
- mesh_library_editor->set_anchors_and_margins_preset(Control::PRESET_TOP_WIDE);
+ mesh_library_editor->set_anchors_and_offsets_preset(Control::PRESET_TOP_WIDE);
mesh_library_editor->set_end(Point2(0, 22));
mesh_library_editor->hide();
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index b8a4f7bc5a..59ab622994 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -337,7 +337,7 @@ MultiMeshEditor::MultiMeshEditor() {
vbc->add_margin_child(TTR("Scale:"), populate_scale);
populate_amount = memnew(SpinBox);
- populate_amount->set_anchor(MARGIN_RIGHT, ANCHOR_END);
+ populate_amount->set_anchor(SIDE_RIGHT, ANCHOR_END);
populate_amount->set_begin(Point2(20, 232));
populate_amount->set_end(Point2(-5, 237));
populate_amount->set_min(1);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 4d7be66180..610645eb9e 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2543,12 +2543,12 @@ void Node3DEditorViewport::_notification(int p_what) {
cinema_label->set_visible(show_cinema);
if (show_cinema) {
float cinema_half_width = cinema_label->get_size().width / 2.0f;
- cinema_label->set_anchor_and_margin(MARGIN_LEFT, 0.5f, -cinema_half_width);
+ cinema_label->set_anchor_and_offset(SIDE_LEFT, 0.5f, -cinema_half_width);
}
if (lock_rotation) {
float locked_half_width = locked_label->get_size().width / 2.0f;
- locked_label->set_anchor_and_margin(MARGIN_LEFT, 0.5f, -locked_half_width);
+ locked_label->set_anchor_and_offset(SIDE_LEFT, 0.5f, -locked_half_width);
}
}
@@ -3890,7 +3890,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
subviewport_container = c;
c->set_stretch(true);
add_child(c);
- c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ c->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
viewport = memnew(SubViewport);
viewport->set_disable_input(true);
@@ -3898,7 +3898,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
surface = memnew(Control);
surface->set_drag_forwarding(this);
add_child(surface);
- surface->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ surface->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
surface->set_clip_contents(true);
camera = memnew(Camera3D);
camera->set_disable_gizmo(true);
@@ -4033,19 +4033,19 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
preview_node = nullptr;
info_label = memnew(Label);
- info_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
- info_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -90 * EDSCALE);
- info_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
- info_label->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -10 * EDSCALE);
+ info_label->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE);
+ info_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -90 * EDSCALE);
+ info_label->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ info_label->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE);
info_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info_label->set_v_grow_direction(GROW_DIRECTION_BEGIN);
surface->add_child(info_label);
info_label->hide();
fps_label = memnew(Label);
- fps_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
- fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
- fps_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -10 * EDSCALE);
fps_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
fps_label->set_tooltip(TTR("Note: The FPS is estimated on a 60hz refresh rate."));
fps_label->set_mouse_filter(MOUSE_FILTER_PASS); // Otherwise tooltip doesn't show.
@@ -4053,7 +4053,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
fps_label->hide();
cinema_label = memnew(Label);
- cinema_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
+ cinema_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
cinema_label->set_h_grow_direction(GROW_DIRECTION_END);
cinema_label->set_align(Label::ALIGN_CENTER);
surface->add_child(cinema_label);
@@ -4062,8 +4062,8 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
previewing_cinema = false;
locked_label = memnew(Label);
- locked_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -20 * EDSCALE);
- locked_label->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -10 * EDSCALE);
+ locked_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -20 * EDSCALE);
+ locked_label->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE);
locked_label->set_h_grow_direction(GROW_DIRECTION_END);
locked_label->set_v_grow_direction(GROW_DIRECTION_BEGIN);
locked_label->set_align(Label::ALIGN_CENTER);
@@ -4072,7 +4072,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
locked_label->hide();
top_right_vbox = memnew(VBoxContainer);
- top_right_vbox->set_anchors_and_margins_preset(PRESET_TOP_RIGHT, PRESET_MODE_MINSIZE, 2.0 * EDSCALE);
+ top_right_vbox->set_anchors_and_offsets_preset(PRESET_TOP_RIGHT, PRESET_MODE_MINSIZE, 2.0 * EDSCALE);
top_right_vbox->set_h_grow_direction(GROW_DIRECTION_BEGIN);
rotation_control = memnew(ViewportRotationControl);
@@ -4082,9 +4082,9 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
top_right_vbox->add_child(rotation_control);
fps_label = memnew(Label);
- fps_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
- fps_label->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
- fps_label->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -10 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
+ fps_label->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -10 * EDSCALE);
fps_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
fps_label->set_tooltip(TTR("Note: The FPS value displayed is the editor's framerate.\nIt cannot be used as a reliable indication of in-game performance."));
fps_label->set_mouse_filter(MOUSE_FILTER_PASS); // Otherwise tooltip doesn't show.
@@ -6109,7 +6109,7 @@ void Node3DEditor::_toggle_maximize_view(Object *p_viewport) {
if (!maximized) {
for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) {
if (i == (uint32_t)index) {
- viewports[i]->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ viewports[i]->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
} else {
viewports[i]->hide();
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 0ccca7e06c..0584ee894b 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -86,8 +86,8 @@ void Polygon2DEditor::_notification(int p_what) {
b_snap_enable->set_icon(get_theme_icon("SnapGrid", "EditorIcons"));
uv_icon_zoom->set_texture(get_theme_icon("Zoom", "EditorIcons"));
- uv_vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
- uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
+ uv_vscroll->set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
+ uv_hscroll->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
@@ -1189,8 +1189,8 @@ void Polygon2DEditor::_uv_draw() {
Size2 vmin = uv_vscroll->get_combined_minimum_size();
// Avoid scrollbar overlapping.
- uv_hscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, uv_vscroll->is_visible() ? -vmin.width : 0);
- uv_vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, uv_hscroll->is_visible() ? -hmin.height : 0);
+ uv_hscroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, uv_vscroll->is_visible() ? -vmin.width : 0);
+ uv_vscroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, uv_hscroll->is_visible() ? -hmin.height : 0);
updating_uv_scroll = false;
}
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index e854ed4fb3..ed2c0c9f26 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -84,10 +84,10 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
set_title(TTR("Connections to method:"));
VBoxContainer *vbc = memnew(VBoxContainer);
- vbc->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
- vbc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_BEGIN, 8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -8 * EDSCALE);
+ vbc->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, -8 * EDSCALE);
add_child(vbc);
method = memnew(Label);
@@ -1679,7 +1679,7 @@ void ScriptTextEditor::_enable_code_editor() {
VSplitContainer *editor_box = memnew(VSplitContainer);
add_child(editor_box);
- editor_box->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ editor_box->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
editor_box->set_v_size_flags(SIZE_EXPAND_FILL);
editor_box->add_child(code_editor);
@@ -1809,7 +1809,7 @@ void ScriptTextEditor::_enable_code_editor() {
ScriptTextEditor::ScriptTextEditor() {
code_editor = memnew(CodeTextEditor);
code_editor->add_theme_constant_override("separation", 2);
- code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ code_editor->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
code_editor->set_code_complete_func(_code_complete_scripts, this);
code_editor->set_v_size_flags(SIZE_EXPAND_FILL);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index d24dcdef83..9bb34f4489 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -558,7 +558,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
shader_editor = memnew(ShaderTextEditor);
shader_editor->set_v_size_flags(SIZE_EXPAND_FILL);
shader_editor->add_theme_constant_override("separation", 0);
- shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ shader_editor->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
shader_editor->connect("script_changed", callable_mp(this, &ShaderEditor::apply_shaders));
EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &ShaderEditor::_editor_settings_changed));
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 9894d0e1b0..b95abe8994 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -548,7 +548,7 @@ TextEditor::TextEditor() {
code_editor->add_theme_constant_override("separation", 0);
code_editor->connect("load_theme_settings", callable_mp(this, &TextEditor::_load_theme_settings));
code_editor->connect("validate_script", callable_mp(this, &TextEditor::_validate_script));
- code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ code_editor->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
update_settings();
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index 8447a2346f..d13a865534 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -160,16 +160,16 @@ Texture3DEditor::Texture3DEditor() {
layer->set_step(1);
layer->set_max(100);
add_child(layer);
- layer->set_anchor(MARGIN_RIGHT, 1);
- layer->set_anchor(MARGIN_LEFT, 1);
+ layer->set_anchor(SIDE_RIGHT, 1);
+ layer->set_anchor(SIDE_LEFT, 1);
layer->set_h_grow_direction(GROW_DIRECTION_BEGIN);
layer->set_modulate(Color(1, 1, 1, 0.8));
info = memnew(Label);
add_child(info);
- info->set_anchor(MARGIN_RIGHT, 1);
- info->set_anchor(MARGIN_LEFT, 1);
- info->set_anchor(MARGIN_BOTTOM, 1);
- info->set_anchor(MARGIN_TOP, 1);
+ info->set_anchor(SIDE_RIGHT, 1);
+ info->set_anchor(SIDE_LEFT, 1);
+ info->set_anchor(SIDE_BOTTOM, 1);
+ info->set_anchor(SIDE_TOP, 1);
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index eafe4d546b..a807e8e99b 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -225,16 +225,16 @@ TextureLayeredEditor::TextureLayeredEditor() {
layer->set_step(1);
layer->set_max(100);
add_child(layer);
- layer->set_anchor(MARGIN_RIGHT, 1);
- layer->set_anchor(MARGIN_LEFT, 1);
+ layer->set_anchor(SIDE_RIGHT, 1);
+ layer->set_anchor(SIDE_LEFT, 1);
layer->set_h_grow_direction(GROW_DIRECTION_BEGIN);
layer->set_modulate(Color(1, 1, 1, 0.8));
info = memnew(Label);
add_child(info);
- info->set_anchor(MARGIN_RIGHT, 1);
- info->set_anchor(MARGIN_LEFT, 1);
- info->set_anchor(MARGIN_BOTTOM, 1);
- info->set_anchor(MARGIN_TOP, 1);
+ info->set_anchor(SIDE_RIGHT, 1);
+ info->set_anchor(SIDE_LEFT, 1);
+ info->set_anchor(SIDE_BOTTOM, 1);
+ info->set_anchor(SIDE_TOP, 1);
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index f599b94428..15d5c615bd 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -217,23 +217,23 @@ void TextureRegionEditor::_region_draw() {
Size2 vmin = vscroll->get_combined_minimum_size();
// Avoid scrollbar overlapping.
- hscroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
- vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
+ hscroll->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, vscroll->is_visible() ? -vmin.width : 0);
+ vscroll->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, hscroll->is_visible() ? -hmin.height : 0);
updating_scroll = false;
if (node_ninepatch || obj_styleBox.is_valid()) {
float margins[4] = { 0 };
if (node_ninepatch) {
- margins[0] = node_ninepatch->get_patch_margin(MARGIN_TOP);
- margins[1] = node_ninepatch->get_patch_margin(MARGIN_BOTTOM);
- margins[2] = node_ninepatch->get_patch_margin(MARGIN_LEFT);
- margins[3] = node_ninepatch->get_patch_margin(MARGIN_RIGHT);
+ margins[0] = node_ninepatch->get_patch_margin(SIDE_TOP);
+ margins[1] = node_ninepatch->get_patch_margin(SIDE_BOTTOM);
+ margins[2] = node_ninepatch->get_patch_margin(SIDE_LEFT);
+ margins[3] = node_ninepatch->get_patch_margin(SIDE_RIGHT);
} else if (obj_styleBox.is_valid()) {
- margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
- margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
- margins[2] = obj_styleBox->get_margin_size(MARGIN_LEFT);
- margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
+ margins[0] = obj_styleBox->get_margin_size(SIDE_TOP);
+ margins[1] = obj_styleBox->get_margin_size(SIDE_BOTTOM);
+ margins[2] = obj_styleBox->get_margin_size(SIDE_LEFT);
+ margins[3] = obj_styleBox->get_margin_size(SIDE_RIGHT);
}
Vector2 pos[4] = {
@@ -278,15 +278,15 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
edited_margin = -1;
float margins[4] = { 0 };
if (node_ninepatch) {
- margins[0] = node_ninepatch->get_patch_margin(MARGIN_TOP);
- margins[1] = node_ninepatch->get_patch_margin(MARGIN_BOTTOM);
- margins[2] = node_ninepatch->get_patch_margin(MARGIN_LEFT);
- margins[3] = node_ninepatch->get_patch_margin(MARGIN_RIGHT);
+ margins[0] = node_ninepatch->get_patch_margin(SIDE_TOP);
+ margins[1] = node_ninepatch->get_patch_margin(SIDE_BOTTOM);
+ margins[2] = node_ninepatch->get_patch_margin(SIDE_LEFT);
+ margins[3] = node_ninepatch->get_patch_margin(SIDE_RIGHT);
} else if (obj_styleBox.is_valid()) {
- margins[0] = obj_styleBox->get_margin_size(MARGIN_TOP);
- margins[1] = obj_styleBox->get_margin_size(MARGIN_BOTTOM);
- margins[2] = obj_styleBox->get_margin_size(MARGIN_LEFT);
- margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
+ margins[0] = obj_styleBox->get_margin_size(SIDE_TOP);
+ margins[1] = obj_styleBox->get_margin_size(SIDE_BOTTOM);
+ margins[2] = obj_styleBox->get_margin_size(SIDE_LEFT);
+ margins[3] = obj_styleBox->get_margin_size(SIDE_RIGHT);
}
Vector2 pos[4] = {
@@ -395,13 +395,13 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
} else if (drag) {
if (edited_margin >= 0) {
undo_redo->create_action(TTR("Set Margin"));
- static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
+ static Side side[4] = { SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT };
if (node_ninepatch) {
- undo_redo->add_do_method(node_ninepatch, "set_patch_margin", m[edited_margin], node_ninepatch->get_patch_margin(m[edited_margin]));
- undo_redo->add_undo_method(node_ninepatch, "set_patch_margin", m[edited_margin], prev_margin);
+ undo_redo->add_do_method(node_ninepatch, "set_patch_margin", side[edited_margin], node_ninepatch->get_patch_margin(side[edited_margin]));
+ undo_redo->add_undo_method(node_ninepatch, "set_patch_margin", side[edited_margin], prev_margin);
} else if (obj_styleBox.is_valid()) {
- undo_redo->add_do_method(obj_styleBox.ptr(), "set_margin_size", m[edited_margin], obj_styleBox->get_margin_size(m[edited_margin]));
- undo_redo->add_undo_method(obj_styleBox.ptr(), "set_margin_size", m[edited_margin], prev_margin);
+ undo_redo->add_do_method(obj_styleBox.ptr(), "set_margin_size", side[edited_margin], obj_styleBox->get_margin_size(side[edited_margin]));
+ undo_redo->add_undo_method(obj_styleBox.ptr(), "set_margin_size", side[edited_margin], prev_margin);
obj_styleBox->emit_signal(CoreStringNames::get_singleton()->changed);
}
edited_margin = -1;
@@ -438,12 +438,12 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (drag) {
drag = false;
if (edited_margin >= 0) {
- static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
+ static Side side[4] = { SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT };
if (node_ninepatch) {
- node_ninepatch->set_patch_margin(m[edited_margin], prev_margin);
+ node_ninepatch->set_patch_margin(side[edited_margin], prev_margin);
}
if (obj_styleBox.is_valid()) {
- obj_styleBox->set_margin_size(m[edited_margin], prev_margin);
+ obj_styleBox->set_margin_size(side[edited_margin], prev_margin);
}
edited_margin = -1;
} else {
@@ -486,12 +486,12 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (new_margin < 0) {
new_margin = 0;
}
- static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
+ static Side side[4] = { SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT };
if (node_ninepatch) {
- node_ninepatch->set_patch_margin(m[edited_margin], new_margin);
+ node_ninepatch->set_patch_margin(side[edited_margin], new_margin);
}
if (obj_styleBox.is_valid()) {
- obj_styleBox->set_margin_size(m[edited_margin], new_margin);
+ obj_styleBox->set_margin_size(side[edited_margin], new_margin);
}
} else {
Vector2 new_pos = mtx.affine_inverse().xform(mm->get_position());
@@ -772,8 +772,8 @@ void TextureRegionEditor::_notification(int p_what) {
zoom_reset->set_icon(get_theme_icon("ZoomReset", "EditorIcons"));
zoom_in->set_icon(get_theme_icon("ZoomMore", "EditorIcons"));
- vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
- hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
+ vscroll->set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE);
+ hscroll->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE);
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 189e5ec442..49eb68c93a 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -2085,7 +2085,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
info_message->set_align(Label::ALIGN_CENTER);
info_message->set_autowrap(true);
info_message->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- info_message->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
+ info_message->set_anchors_and_offsets_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE);
palette->add_child(info_message);
// Add autotile override palette.
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index da664109dc..3820416c76 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -83,10 +83,10 @@ void VisualShaderNodePlugin::_bind_methods() {
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);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
return style;
}
@@ -283,7 +283,7 @@ VisualShader::Type VisualShaderGraphPlugin::get_shader_type() const {
void VisualShaderGraphPlugin::set_node_position(VisualShader::Type p_type, int p_id, const Vector2 &p_position) {
if (visual_shader->get_shader_type() == p_type && links.has(p_id)) {
- links[p_id].graph_node->set_offset(p_position);
+ links[p_id].graph_node->set_position_offset(p_position);
}
}
@@ -365,7 +365,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
expression = expression_node->get_expression();
}
- node->set_offset(visual_shader->get_node_position(p_type, p_id));
+ node->set_position_offset(visual_shader->get_node_position(p_type, p_id));
node->set_title(vsnode->get_caption());
node->set_name(itos(p_id));
@@ -1580,9 +1580,9 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p
box_size.x = gn->get_size().x;
}
}
- box_size.x -= text_box->get_margin(MARGIN_LEFT);
+ box_size.x -= text_box->get_offset(SIDE_LEFT);
box_size.x -= 28 * EDSCALE;
- box_size.y -= text_box->get_margin(MARGIN_TOP);
+ box_size.y -= text_box->get_offset(SIDE_TOP);
box_size.y -= 28 * EDSCALE;
text_box->set_custom_minimum_size(Size2(box_size.x, box_size.y));
text_box->set_size(Size2(1, 1));
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 46a656e0af..a37f4776ac 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -50,7 +50,7 @@ void BackgroundProgress::_add_task(const String &p_task, const String &p_label,
Control *ec = memnew(Control);
ec->set_h_size_flags(SIZE_EXPAND_FILL);
ec->set_v_size_flags(SIZE_EXPAND_FILL);
- t.progress->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ t.progress->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
ec->add_child(t.progress);
ec->set_custom_minimum_size(Size2(80, 5) * EDSCALE);
t.hb->add_child(ec);
@@ -141,10 +141,10 @@ void ProgressDialog::_popup() {
Ref<StyleBox> style = main->get_theme_stylebox("panel", "PopupMenu");
ms += style->get_minimum_size();
- main->set_margin(MARGIN_LEFT, style->get_margin(MARGIN_LEFT));
- main->set_margin(MARGIN_RIGHT, -style->get_margin(MARGIN_RIGHT));
- main->set_margin(MARGIN_TOP, style->get_margin(MARGIN_TOP));
- main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM));
+ main->set_offset(SIDE_LEFT, style->get_margin(SIDE_LEFT));
+ main->set_offset(SIDE_RIGHT, -style->get_margin(SIDE_RIGHT));
+ main->set_offset(SIDE_TOP, style->get_margin(SIDE_TOP));
+ main->set_offset(SIDE_BOTTOM, -style->get_margin(SIDE_BOTTOM));
//raise();
popup_centered(ms);
@@ -235,7 +235,7 @@ void ProgressDialog::_bind_methods() {
ProgressDialog::ProgressDialog() {
main = memnew(VBoxContainer);
add_child(main);
- main->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ main->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
set_exclusive(true);
last_progress_tick = 0;
singleton = this;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index ad0c9532d8..3068bdd672 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1824,7 +1824,7 @@ void ProjectManager::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
- settings_hb->set_anchors_and_margins_preset(Control::PRESET_TOP_RIGHT);
+ settings_hb->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT);
update();
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -2440,19 +2440,19 @@ ProjectManager::ProjectManager() {
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
- set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ set_anchors_and_offsets_preset(Control::PRESET_WIDE);
set_theme(create_custom_theme());
- set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ set_anchors_and_offsets_preset(Control::PRESET_WIDE);
Panel *panel = memnew(Panel);
add_child(panel);
- panel->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ panel->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
panel->add_theme_style_override("panel", get_theme_stylebox("Background", "EditorStyles"));
VBoxContainer *vb = memnew(VBoxContainer);
panel->add_child(vb);
- vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8 * EDSCALE);
+ vb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8 * EDSCALE);
Control *center_box = memnew(Control);
center_box->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@@ -2460,7 +2460,7 @@ ProjectManager::ProjectManager() {
tabs = memnew(TabContainer);
center_box->add_child(tabs);
- tabs->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
HBoxContainer *projects_hb = memnew(HBoxContainer);
@@ -2571,7 +2571,7 @@ ProjectManager::ProjectManager() {
settings_hb = memnew(HBoxContainer);
settings_hb->set_alignment(BoxContainer::ALIGN_END);
settings_hb->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN);
- settings_hb->set_anchors_and_margins_preset(Control::PRESET_TOP_RIGHT);
+ settings_hb->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT);
Label *version_label = memnew(Label);
String hash = String(VERSION_HASH);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 847af0f2c2..d45ee1eae1 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -456,14 +456,14 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
set_size(Vector2(4, 4) * EDSCALE + checks20gc->get_position() + checks20gc->get_size());
} else if (hint == PROPERTY_HINT_EXP_EASING) {
- easing_draw->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, 5 * EDSCALE);
- easing_draw->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -30 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, 3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -3 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_END, -25 * EDSCALE);
- type_button->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -7 * EDSCALE);
+ easing_draw->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5 * EDSCALE);
+ easing_draw->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5 * EDSCALE);
+ easing_draw->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_BEGIN, 5 * EDSCALE);
+ easing_draw->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, -30 * EDSCALE);
+ type_button->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 3 * EDSCALE);
+ type_button->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -3 * EDSCALE);
+ type_button->set_anchor_and_offset(SIDE_TOP, Control::ANCHOR_END, -25 * EDSCALE);
+ type_button->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_END, -7 * EDSCALE);
type_button->set_text(TTR("Preset..."));
type_button->get_popup()->clear();
type_button->get_popup()->add_item(TTR("Linear"), EASING_LINEAR);
@@ -536,10 +536,10 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
int button_margin = text_edit->get_theme_constant("button_margin", "Dialogs");
int margin = text_edit->get_theme_constant("margin", "Dialogs");
- action_buttons[0]->set_anchor(MARGIN_LEFT, Control::ANCHOR_END);
- action_buttons[0]->set_anchor(MARGIN_TOP, Control::ANCHOR_END);
- action_buttons[0]->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
- action_buttons[0]->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
+ action_buttons[0]->set_anchor(SIDE_LEFT, Control::ANCHOR_END);
+ action_buttons[0]->set_anchor(SIDE_TOP, Control::ANCHOR_END);
+ action_buttons[0]->set_anchor(SIDE_RIGHT, Control::ANCHOR_END);
+ action_buttons[0]->set_anchor(SIDE_BOTTOM, Control::ANCHOR_END);
action_buttons[0]->set_begin(Point2(-70 * EDSCALE, -button_margin + 5 * EDSCALE));
action_buttons[0]->set_end(Point2(-margin, -margin));
action_buttons[0]->set_text(TTR("Close"));
@@ -1661,10 +1661,10 @@ void CustomPropertyEditor::_focus_exit() {
void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) {
Ref<StyleBox> sb = action_buttons[0]->get_theme_stylebox("panel");
- int margin_top = sb->get_margin(MARGIN_TOP);
- int margin_left = sb->get_margin(MARGIN_LEFT);
- int margin_bottom = sb->get_margin(MARGIN_BOTTOM);
- int margin_right = sb->get_margin(MARGIN_RIGHT);
+ int margin_top = sb->get_margin(SIDE_TOP);
+ int margin_left = sb->get_margin(SIDE_LEFT);
+ int margin_bottom = sb->get_margin(SIDE_BOTTOM);
+ int margin_right = sb->get_margin(SIDE_RIGHT);
int max_width = 0;
int height = 0;
@@ -1794,8 +1794,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
text_edit = memnew(TextEdit);
add_child(text_edit);
- text_edit->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
- text_edit->set_margin(MARGIN_BOTTOM, -30);
+ text_edit->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
+ text_edit->set_offset(SIDE_BOTTOM, -30);
text_edit->hide();
text_edit->connect("text_changed", callable_mp(this, &CustomPropertyEditor::_text_edit_changed));
@@ -1853,12 +1853,12 @@ CustomPropertyEditor::CustomPropertyEditor() {
spinbox = memnew(SpinBox);
add_child(spinbox);
- spinbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
+ spinbox->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
spinbox->connect("value_changed", callable_mp(this, &CustomPropertyEditor::_range_modified));
slider = memnew(HSlider);
add_child(slider);
- slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
+ slider->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
slider->connect("value_changed", callable_mp(this, &CustomPropertyEditor::_range_modified));
create_dialog = nullptr;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 72703623ab..91ae81dea2 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1015,7 +1015,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
break;
case TOOL_CREATE_USER_INTERFACE: {
Control *node = memnew(Control);
- node->set_anchors_and_margins_preset(PRESET_WIDE); //more useful for resizable UIs.
+ node->set_anchors_and_offsets_preset(PRESET_WIDE); //more useful for resizable UIs.
new_node = node;
} break;
@@ -1107,7 +1107,7 @@ void SceneTreeDock::_notification(int p_what) {
node_shortcuts_toggle->set_toggle_mode(true);
node_shortcuts_toggle->set_tooltip(TTR("Switch to Favorite Nodes"));
node_shortcuts_toggle->set_pressed(EDITOR_GET("_use_favorites_root_selection"));
- node_shortcuts_toggle->set_anchors_and_margins_preset(Control::PRESET_CENTER_RIGHT);
+ node_shortcuts_toggle->set_anchors_and_offsets_preset(Control::PRESET_CENTER_RIGHT);
node_shortcuts_toggle->connect("pressed", callable_mp(this, &SceneTreeDock::_update_create_root_dialog));
top_row->add_child(node_shortcuts_toggle);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 685833da55..40fc5c02fc 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -1150,8 +1150,8 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope
}
tree = memnew(Tree);
- tree->set_anchor(MARGIN_RIGHT, ANCHOR_END);
- tree->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
+ tree->set_anchor(SIDE_RIGHT, ANCHOR_END);
+ tree->set_anchor(SIDE_BOTTOM, ANCHOR_END);
tree->set_begin(Point2(0, p_label ? 18 : 0));
tree->set_end(Point2(0, 0));
tree->add_theme_constant_override("button_margin", 0);
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index a29b6aded7..c152c2625f 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -471,10 +471,10 @@ EditorSettingsDialog::EditorSettingsDialog() {
Label *l = memnew(Label);
l->set_text(TTR("Press a Key..."));
- l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
+ l->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
- l->set_margin(MARGIN_TOP, 20);
- l->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 30);
+ l->set_offset(SIDE_TOP, 20);
+ l->set_anchor_and_offset(SIDE_BOTTOM, Control::ANCHOR_BEGIN, 30);
press_a_key_label = l;
press_a_key->add_child(l);
press_a_key->connect("window_input", callable_mp(this, &EditorSettingsDialog::_wait_for_key));