diff options
author | Sergey Pusnei <sergey.pusnei@gmail.com> | 2017-03-29 11:29:38 -0400 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-04-10 08:27:34 +0200 |
commit | 8589ca390373ae2e84d93b4a75640277e38e9780 (patch) | |
tree | 4c66a5b3927649c737b631c05ed88e866455e566 /scene | |
parent | 1c480698ce0e881cbd28f1f0ddba95cee74ca834 (diff) |
Rename [gs]et_pos to [gs]et_position for Controls
Control set_pos -> set_position
Control set_global_pos -> set_global_position
[gs]et_mouse_pos -> [gs]et_mouse_position
[gs]et_global_mouse_pos -> [gs]et_global_mouse_position
fixes #8005
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/canvas_item.cpp | 8 | ||||
-rw-r--r-- | scene/2d/canvas_item.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 2 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 2 | ||||
-rw-r--r-- | scene/gui/color_ramp_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/container.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 34 | ||||
-rw-r--r-- | scene/gui/control.h | 8 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 16 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 20 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/menu_button.cpp | 6 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 2 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 16 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 18 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 4 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 24 | ||||
-rw-r--r-- | scene/io/resource_format_wav.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 14 | ||||
-rw-r--r-- | scene/main/viewport.h | 2 |
21 files changed, 95 insertions, 95 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 8c8ac835e8..f699c8f0e8 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -695,16 +695,16 @@ InputEvent CanvasItem::make_input_local(const InputEvent &p_event) const { return p_event.xform_by((get_canvas_transform() * get_global_transform()).affine_inverse()); } -Vector2 CanvasItem::get_global_mouse_pos() const { +Vector2 CanvasItem::get_global_mouse_position() const { ERR_FAIL_COND_V(!get_viewport(), Vector2()); - return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_pos()); + return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_position()); } Vector2 CanvasItem::get_local_mouse_pos() const { ERR_FAIL_COND_V(!get_viewport(), Vector2()); - return get_global_transform().affine_inverse().xform(get_global_mouse_pos()); + return get_global_transform().affine_inverse().xform(get_global_mouse_position()); } void CanvasItem::_bind_methods() { @@ -771,7 +771,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_viewport_rect"), &CanvasItem::get_viewport_rect); ClassDB::bind_method(D_METHOD("get_canvas_transform"), &CanvasItem::get_canvas_transform); ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos); - ClassDB::bind_method(D_METHOD("get_global_mouse_pos"), &CanvasItem::get_global_mouse_pos); + ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas); ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index ce72f7e0c9..72fe5b93da 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -212,7 +212,7 @@ public: InputEvent make_input_local(const InputEvent &pevent) const; Vector2 make_canvas_pos_local(const Vector2 &screen_point) const; - Vector2 get_global_mouse_pos() const; + Vector2 get_global_mouse_position() const; Vector2 get_local_mouse_pos() const; void set_notify_local_transform(bool p_enable); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index d6c68a1d82..c4ea42d461 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -611,7 +611,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NONE: pa->object->set(pa->prop,pa->value_accum); break; //you are not speshul - case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_pos(pa->value_accum); break; + case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_position(pa->value_accum); break; case SP_NODE2D_ROT: static_cast<Node2D*>(pa->object)->set_rot(Math::deg2rad(pa->value_accum)); break; case SP_NODE2D_SCALE: static_cast<Node2D*>(pa->object)->set_scale(pa->value_accum); break; }*/ diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 8a94d4918f..adb5e2f0b6 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -591,7 +591,7 @@ void ColorPickerButton::_color_changed(const Color &p_color) { void ColorPickerButton::pressed() { Size2 ms = Size2(300, picker->get_combined_minimum_size().height + 10); - popup->set_pos(get_global_pos() - Size2(0, ms.height)); + popup->set_position(get_global_position() - Size2(0, ms.height)); popup->set_size(ms); popup->popup(); picker->set_focus_on_line_edit(); diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/color_ramp_edit.cpp index 0bc9205175..c6f73fe6e6 100644 --- a/scene/gui/color_ramp_edit.cpp +++ b/scene/gui/color_ramp_edit.cpp @@ -62,7 +62,7 @@ void ColorRampEdit::_show_color_picker() { return; Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10); picker->set_pick_color(points[grabbed].color); - popup->set_pos(get_global_pos() - Vector2(ms.width - get_size().width, ms.height)); + popup->set_position(get_global_position() - Vector2(ms.width - get_size().width, ms.height)); popup->set_size(ms); popup->popup(); } diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index d3096d7806..c428d524a4 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -107,7 +107,7 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) { for (int i = 0; i < 4; i++) p_child->set_anchor(Margin(i), ANCHOR_BEGIN); - p_child->set_pos(r.pos); + p_child->set_position(r.pos); p_child->set_size(r.size); p_child->set_rotation(0); p_child->set_scale(Vector2(1, 1)); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bda54181c7..e62a993651 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -58,7 +58,7 @@ void Control::edit_set_state(const Variant &p_state) { Dictionary s = p_state; Rect2 state = s["rect"]; - set_pos(state.pos); + set_position(state.pos); set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); @@ -96,13 +96,13 @@ void Control::edit_set_rect(const Rect2 &p_edit_rect) { postxf.set_rotation_and_scale(data.rotation, data.scale); Vector2 new_pos = postxf.xform(p_edit_rect.pos); - Vector2 pos = get_pos() + new_pos; + Vector2 pos = get_position() + new_pos; Rect2 new_rect = get_rect(); new_rect.pos = pos.snapped(Vector2(1, 1)); new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1)); - set_pos(new_rect.pos); + set_position(new_rect.pos); set_size(new_rect.size); } @@ -353,7 +353,7 @@ void Control::remove_child_notify(Node *p_child) { void Control::_update_canvas_item_transform() { - Transform2D xform = Transform2D(data.rotation, get_pos()); + Transform2D xform = Transform2D(data.rotation, get_position()); xform.scale_basis(data.scale); VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform); } @@ -1390,12 +1390,12 @@ Size2 Control::get_end() const { return Size2(data.margin[2], data.margin[3]); } -Point2 Control::get_global_pos() const { +Point2 Control::get_global_position() const { return get_global_transform().get_origin(); } -void Control::set_global_pos(const Point2 &p_point) { +void Control::set_global_position(const Point2 &p_point) { Transform2D inv; @@ -1404,10 +1404,10 @@ void Control::set_global_pos(const Point2 &p_point) { inv = data.parent_canvas_item->get_global_transform().affine_inverse(); } - set_pos(inv.xform(p_point)); + set_position(inv.xform(p_point)); } -void Control::set_pos(const Size2 &p_point) { +void Control::set_position(const Size2 &p_point) { float pw = _get_parent_range(0); float ph = _get_parent_range(1); @@ -1459,7 +1459,7 @@ void Control::set_size(const Size2 &p_size) { _size_changed(); } -Size2 Control::get_pos() const { +Size2 Control::get_position() const { return data.pos_cache; } @@ -1471,7 +1471,7 @@ Size2 Control::get_size() const { Rect2 Control::get_global_rect() const { - return Rect2(get_global_pos(), get_size()); + return Rect2(get_global_position(), get_size()); } Rect2 Control::get_window_rect() const { @@ -1483,7 +1483,7 @@ Rect2 Control::get_window_rect() const { Rect2 Control::get_rect() const { - return Rect2(get_pos(), get_size()); + return Rect2(get_position(), get_size()); } Rect2 Control::get_item_rect() const { @@ -1886,7 +1886,7 @@ Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const { Transform2D Control::get_transform() const { - Transform2D xform = Transform2D(data.rotation, get_pos()); + Transform2D xform = Transform2D(data.rotation, get_position()); xform.scale_basis(data.scale); return xform; } @@ -2315,10 +2315,10 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin); ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin); ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end); - ClassDB::bind_method(D_METHOD("set_pos", "pos"), &Control::set_pos); + ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position); ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size); ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size); - ClassDB::bind_method(D_METHOD("set_global_pos", "pos"), &Control::set_global_pos); + ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position); ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation); ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg); // TODO: Obsolete this method (old name) properly (GH-4397) @@ -2327,7 +2327,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("get_margin", "margin"), &Control::get_margin); ClassDB::bind_method(D_METHOD("get_begin"), &Control::get_begin); ClassDB::bind_method(D_METHOD("get_end"), &Control::get_end); - ClassDB::bind_method(D_METHOD("get_pos"), &Control::get_pos); + ClassDB::bind_method(D_METHOD("get_position"), &Control::get_position); ClassDB::bind_method(D_METHOD("get_size"), &Control::get_size); ClassDB::bind_method(D_METHOD("get_rotation"), &Control::get_rotation); ClassDB::bind_method(D_METHOD("get_rotation_deg"), &Control::get_rotation_deg); @@ -2336,7 +2336,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("get_scale"), &Control::get_scale); ClassDB::bind_method(D_METHOD("get_custom_minimum_size"), &Control::get_custom_minimum_size); ClassDB::bind_method(D_METHOD("get_parent_area_size"), &Control::get_size); - ClassDB::bind_method(D_METHOD("get_global_pos"), &Control::get_global_pos); + ClassDB::bind_method(D_METHOD("get_global_position"), &Control::get_global_position); ClassDB::bind_method(D_METHOD("get_rect"), &Control::get_rect); ClassDB::bind_method(D_METHOD("get_global_rect"), &Control::get_global_rect); ClassDB::bind_method(D_METHOD("set_area_as_parent_rect", "margin"), &Control::set_area_as_parent_rect, DEFVAL(0)); @@ -2438,7 +2438,7 @@ void Control::_bind_methods() { ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_BOTTOM); ADD_GROUP("Rect", "rect_"); - ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_pos", "get_pos"); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_deg", "get_rotation_deg"); diff --git a/scene/gui/control.h b/scene/gui/control.h index 9075c5a6ed..5834d1550a 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -277,12 +277,12 @@ public: Point2 get_begin() const; Point2 get_end() const; - void set_pos(const Point2 &p_point); + void set_position(const Point2 &p_point); void set_size(const Size2 &p_size); - void set_global_pos(const Point2 &p_point); + void set_global_position(const Point2 &p_point); - Point2 get_pos() const; - Point2 get_global_pos() const; + Point2 get_position() const; + Point2 get_global_position() const; Size2 get_size() const; Rect2 get_rect() const; Rect2 get_global_rect() const; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index c53b2bdb21..2ec72a2948 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -46,7 +46,7 @@ void WindowDialog::_fix_size() { // Perhaps this should be called when the viewport resizes as well or windows go out of bounds... // Ensure the whole window is visible. - Point2i pos = get_global_pos(); + Point2i pos = get_global_position(); Size2i size = get_size(); Size2i viewport_size = get_viewport_rect().size; @@ -59,7 +59,7 @@ void WindowDialog::_fix_size() { pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right)); pos.y = MAX(top, MIN(pos.y, viewport_size.y - size.y - bottom)); - set_global_pos(pos); + set_global_position(pos); // Also resize the window to fit if a resize should be possible at all. if (resizable) { @@ -98,8 +98,8 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { // Begin a possible dragging operation. drag_type = _drag_hit_test(Point2(p_event.mouse_button.x, p_event.mouse_button.y)); if (drag_type != DRAG_NONE) - drag_offset = get_global_mouse_pos() - get_pos(); - drag_offset_far = get_pos() + get_size() - get_global_mouse_pos(); + drag_offset = get_global_mouse_position() - get_position(); + drag_offset_far = get_position() + get_size() - get_global_mouse_position(); } else if (drag_type != DRAG_NONE && !p_event.mouse_button.pressed) { // End a dragging operation. drag_type = DRAG_NONE; @@ -136,7 +136,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { set_default_cursor_shape(cursor); } else { // Update while in a dragging operation. - Point2 global_pos = get_global_mouse_pos(); + Point2 global_pos = get_global_mouse_position(); global_pos.y = MAX(global_pos.y, 0); // Ensure title bar stays visible. Rect2 rect = get_rect(); @@ -164,7 +164,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { } set_size(rect.size); - set_pos(rect.pos); + set_position(rect.pos); } } } @@ -416,14 +416,14 @@ void AcceptDialog::_update_child_rects() { if (c == hbc || c == label || c == get_close_button() || c->is_set_as_toplevel()) continue; - c->set_pos(cpos); + c->set_position(cpos); c->set_size(csize); } cpos.y += csize.y + margin; csize.y = hminsize.y; - hbc->set_pos(cpos); + hbc->set_position(cpos); hbc->set_size(csize); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 76baf20526..0c092a4e17 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -140,13 +140,13 @@ void GraphEdit::_update_scroll_offset() { Point2 pos = gn->get_offset() * zoom; pos -= Point2(h_scroll->get_value(), v_scroll->get_value()); - gn->set_pos(pos); + gn->set_position(pos); if (gn->get_scale() != Vector2(zoom, zoom)) { gn->set_scale(Vector2(zoom, zoom)); } } - connections_layer->set_pos(-Point2(h_scroll->get_value(), v_scroll->get_value())); + connections_layer->set_position(-Point2(h_scroll->get_value(), v_scroll->get_value())); set_block_minimum_size_adjust(false); awaiting_scroll_offset_update = false; } @@ -350,14 +350,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); if (pos.distance_to(p_point) < grab_r) return true; } for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); if (pos.distance_to(p_point) < grab_r) { return true; } @@ -383,7 +383,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); if (pos.distance_to(mpos) < grab_r) { if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) { @@ -430,7 +430,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); if (pos.distance_to(mpos) < grab_r) { @@ -497,7 +497,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { if (!connecting_out) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); int type = gn->get_connection_output_type(j); if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) { @@ -512,7 +512,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); int type = gn->get_connection_input_type(j); if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) { connecting_target = true; @@ -704,7 +704,7 @@ void GraphEdit::_top_layer_draw() { pos = from->get_connection_output_pos(connecting_index); else pos = from->get_connection_input_pos(connecting_index); - pos += from->get_pos(); + pos += from->get_position(); Vector2 topos; topos = connecting_to; @@ -1229,7 +1229,7 @@ GraphEdit::GraphEdit() { HBoxContainer *zoom_hb = memnew(HBoxContainer); top_layer->add_child(zoom_hb); - zoom_hb->set_pos(Vector2(10, 10)); + zoom_hb->set_position(Vector2(10, 10)); zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 30bc4d1663..9abf9649c0 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -51,7 +51,7 @@ void LineEdit::_gui_input(InputEvent p_event) { const InputEventMouseButton &b = p_event.mouse_button; if (b.pressed && b.button_index == BUTTON_RIGHT) { - menu->set_pos(get_global_transform().xform(get_local_mouse_pos())); + menu->set_position(get_global_transform().xform(get_local_mouse_pos())); menu->set_size(Vector2(1, 1)); menu->popup(); grab_focus(); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 16277ed0d0..cf468f2257 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -50,10 +50,10 @@ void MenuButton::pressed() { emit_signal("about_to_show"); Size2 size = get_size(); - Point2 gp = get_global_pos(); - popup->set_global_pos(gp + Size2(0, size.height)); + Point2 gp = get_global_position(); + popup->set_global_position(gp + Size2(0, size.height)); popup->set_size(Size2(size.width, 0)); - popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_pos()), get_size())); + popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size())); popup->popup(); popup->call_deferred("grab_click_focus"); popup->set_invalidate_click_until_motion(); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 0bb68e7fa1..0806d35d48 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -87,7 +87,7 @@ void OptionButton::_selected(int p_which) { void OptionButton::pressed() { Size2 size = get_size(); - popup->set_global_pos(get_global_pos() + Size2(0, size.height)); + popup->set_global_position(get_global_position() + Size2(0, size.height)); popup->set_size(Size2(size.width, 0)); popup->popup(); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 523633166c..7d0b91a366 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -58,12 +58,12 @@ void Popup::_notification(int p_what) { void Popup::_fix_size() { #if 0 - Point2 pos = get_pos(); + Point2 pos = get_position(); Size2 size = get_size(); Point2 window_size = window==this ? get_parent_area_size() :window->get_size(); #else - Point2 pos = get_global_pos(); + Point2 pos = get_global_position(); Size2 size = get_size(); Point2 window_size = get_viewport_rect().size; @@ -79,10 +79,10 @@ void Popup::_fix_size() { pos.y = 0; #if 0 if (pos!=get_pos()) - set_pos(pos); + set_position(pos); #else - if (pos != get_pos()) - set_global_pos(pos); + if (pos != get_position()) + set_global_position(pos); #endif } @@ -171,7 +171,7 @@ void Popup::popup_centered(const Size2 &p_size) { rect.size = p_size == Size2() ? get_size() : p_size; rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_pos(rect.pos); + set_position(rect.pos); set_size(rect.size); show_modal(exclusive); @@ -194,7 +194,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) { Point2 window_size = get_viewport_rect().size; rect.size = (window_size * p_screen_ratio).floor(); rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_pos(rect.pos); + set_position(rect.pos); set_size(rect.size); show_modal(exclusive); @@ -216,7 +216,7 @@ void Popup::popup(const Rect2 &bounds) { // Fit the popup into the optionally provided bounds. if (!bounds.has_no_area()) { - set_pos(bounds.pos); + set_position(bounds.pos); set_size(bounds.size); } _fix_size(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index de16f3c525..6ac6eac655 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -169,7 +169,7 @@ void PopupMenu::_activate_submenu(int over) { if (pm->is_visible_in_tree()) return; //already visible! - Point2 p = get_global_pos(); + Point2 p = get_global_position(); Rect2 pr(p, get_size()); Ref<StyleBox> style = get_stylebox("panel"); @@ -179,13 +179,13 @@ void PopupMenu::_activate_submenu(int over) { if (pos.x + size.width > get_viewport_rect().size.width) pos.x = p.x - size.width; - pm->set_pos(pos); + pm->set_position(pos); pm->popup(); PopupMenu *pum = pm->cast_to<PopupMenu>(); if (pum) { - pr.pos -= pum->get_global_pos(); + pr.pos -= pum->get_global_position(); pum->clear_autohide_areas(); pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y, pr.size.x, items[over]._ofs_cache)); if (over < items.size() - 1) { @@ -266,15 +266,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) { case BUTTON_WHEEL_DOWN: { - if (get_global_pos().y + get_size().y > get_viewport_rect().size.y) { + if (get_global_position().y + get_size().y > get_viewport_rect().size.y) { int vseparation = get_constant("vseparation"); Ref<Font> font = get_font("font"); - Point2 pos = get_pos(); + Point2 pos = get_position(); int s = (vseparation + font->get_height()) * 3; pos.y -= s; - set_pos(pos); + set_position(pos); //update hover InputEvent ie; @@ -286,15 +286,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) { } break; case BUTTON_WHEEL_UP: { - if (get_global_pos().y < 0) { + if (get_global_position().y < 0) { int vseparation = get_constant("vseparation"); Ref<Font> font = get_font("font"); - Point2 pos = get_pos(); + Point2 pos = get_position(); int s = (vseparation + font->get_height()) * 3; pos.y += s; - set_pos(pos); + set_position(pos); //update hover InputEvent ie; diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 0ef6fbdebd..0c7a58dc16 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -79,11 +79,11 @@ void TabContainer::_gui_input(const InputEvent &p_event) { if (popup && pos.x > size.width - menu->get_width()) { emit_signal("pre_popup_pressed"); - Vector2 popup_pos = get_global_pos(); + Vector2 popup_pos = get_global_position(); popup_pos.x += size.width - popup->get_size().width; popup_pos.y += menu->get_height(); - popup->set_global_pos(popup_pos); + popup->set_global_position(popup_pos); popup->popup(); return; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 80c6a23b61..69a90535df 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -360,7 +360,7 @@ void TextEdit::_click_selection_held() { if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) { - Point2 mp = Input::get_singleton()->get_mouse_pos() - get_global_pos(); + Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position(); int row, col; _get_mouse_pos(Point2i(mp.x, mp.y), row, col); @@ -1586,7 +1586,7 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) { if (mb.button_index == BUTTON_RIGHT && context_menu_enabled) { - menu->set_pos(get_global_transform().xform(get_local_mouse_pos())); + menu->set_position(get_global_transform().xform(get_local_mouse_pos())); menu->set_size(Vector2(1, 1)); menu->popup(); grab_focus(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1cfaa58b92..bc7b7485d8 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1041,7 +1041,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 cache.selected->draw(ci, r); } if (text_editor->is_visible_in_tree()) { - text_editor->set_pos(get_global_pos() + r.pos); + text_editor->set_position(get_global_position() + r.pos); } } @@ -1503,7 +1503,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool cache.click_id = c.buttons[j].id; cache.click_item = p_item; cache.click_column = col; - cache.click_pos = get_global_mouse_pos() - get_global_pos(); + cache.click_pos = get_global_mouse_position() - get_global_position(); update(); //emit_signal("button_pressed"); return -1; @@ -1627,7 +1627,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } popup_menu->set_size(Size2(col_width, 0)); - popup_menu->set_pos(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); + popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); popup_menu->popup(); popup_edited_item = p_item; popup_edited_item_col = col; @@ -1693,7 +1693,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool case TreeItem::CELL_MODE_CUSTOM: { edited_item = p_item; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); + custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2)))); bring_up_editor = false; @@ -1710,7 +1710,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool popup_edited_item = p_item; popup_edited_item_col = col; - pressing_item_rect = Rect2(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); + pressing_item_rect = Rect2(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); pressing_for_editor_text = editor_text; pressing_for_editor = true; @@ -2379,7 +2379,7 @@ bool Tree::edit_selected() { edited_item = s; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + rect.pos, rect.size); + custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size); emit_signal("custom_popup_edited", false); item_edited(col, s); @@ -2394,7 +2394,7 @@ bool Tree::edit_selected() { } popup_menu->set_size(Size2(rect.size.width, 0)); - popup_menu->set_pos(get_global_pos() + rect.pos + Point2i(0, rect.size.height)); + popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height)); popup_menu->popup(); popup_edited_item = s; popup_edited_item_col = col; @@ -2402,8 +2402,8 @@ bool Tree::edit_selected() { } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - Point2i textedpos = get_global_pos() + rect.pos; - text_editor->set_pos(textedpos); + Point2i textedpos = get_global_position() + rect.pos; + text_editor->set_position(textedpos); text_editor->set_size(rect.size); text_editor->clear(); text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step))); @@ -2411,7 +2411,7 @@ bool Tree::edit_selected() { if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - value_editor->set_pos(textedpos + Point2i(0, text_editor->get_size().height)); + value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height)); value_editor->set_size(Size2(rect.size.width, 1)); value_editor->show_modal(); updating_value_editor = true; @@ -2529,7 +2529,7 @@ void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_DRAG_BEGIN) { single_select_defer = NULL; - if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) { + if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) { scrolling = true; set_fixed_process(true); } @@ -2577,7 +2577,7 @@ void Tree::_notification(int p_what) { } if (scrolling) { - Point2 point = get_viewport()->get_mouse_pos() - get_global_pos(); + Point2 point = get_viewport()->get_mouse_position() - get_global_position(); if (point.x < cache.scroll_border) { point.x -= cache.scroll_border; } else if (point.x > get_size().width - cache.scroll_border) { diff --git a/scene/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp index 53eefd26fe..dabbb79de3 100644 --- a/scene/io/resource_format_wav.cpp +++ b/scene/io/resource_format_wav.cpp @@ -98,7 +98,7 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original /* chunk size */ uint32_t chunksize=file->get_32(); - uint32_t file_pos=file->get_pos(); //save file pos, so we can skip to next chunk safely + uint32_t file_pos=file->get_position(); //save file pos, so we can skip to next chunk safely if (file->eof_reached()) { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 31c9cb15a8..406640275c 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1444,9 +1444,9 @@ void Viewport::_vp_unhandled_input(const InputEvent &p_ev) { unhandled_input(ev); } -Vector2 Viewport::get_mouse_pos() const { +Vector2 Viewport::get_mouse_position() const { - return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos() - _get_window_offset()); + return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_position() - _get_window_offset()); } void Viewport::warp_mouse(const Vector2 &p_pos) { @@ -1538,7 +1538,7 @@ void Viewport::_gui_show_tooltip() { else if (r.pos.y < 0) r.pos.y = 0; - gui.tooltip_popup->set_global_pos(r.pos); + gui.tooltip_popup->set_global_position(r.pos); gui.tooltip_popup->set_size(r.size); gui.tooltip_popup->raise(); @@ -1640,7 +1640,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ Control *c = p_node->cast_to<Control>(); if (c) { - //print_line("at "+String(c->get_path())+" POS "+c->get_pos()+" bt "+p_xform); + //print_line("at "+String(c->get_path())+" POS "+c->get_position()+" bt "+p_xform); } //subwindows first!! @@ -1993,7 +1993,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { gui.mouse_over = over; if (gui.drag_preview) { - gui.drag_preview->set_pos(mpos); + gui.drag_preview->set_position(mpos); } if (!over) { @@ -2237,7 +2237,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) { memdelete(gui.drag_preview); } p_control->set_as_toplevel(true); - p_control->set_pos(gui.last_mouse_pos); + p_control->set_position(gui.last_mouse_pos); p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport p_control->raise(); if (gui.drag_preview) { @@ -2649,7 +2649,7 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("is_audio_listener_2d", "enable"), &Viewport::is_audio_listener_2d); ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect); - ClassDB::bind_method(D_METHOD("get_mouse_pos"), &Viewport::get_mouse_pos); + ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse); ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 242ee4b4e6..d784fc8ee9 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -400,7 +400,7 @@ public: void set_attach_to_screen_rect(const Rect2 &p_rect); Rect2 get_attach_to_screen_rect() const; - Vector2 get_mouse_pos() const; + Vector2 get_mouse_position() const; void warp_mouse(const Vector2 &p_pos); void set_physics_object_picking(bool p_enable); |