summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/SCsub28
-rw-r--r--editor/animation_editor.cpp8
-rw-r--r--editor/editor_audio_buses.cpp2
-rw-r--r--editor/editor_fonts.cpp4
-rw-r--r--editor/editor_node.cpp44
-rw-r--r--editor/editor_run.cpp20
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp80
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp8
-rw-r--r--editor/plugins/script_editor_plugin.cpp62
-rw-r--r--editor/plugins/script_editor_plugin.h8
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp18
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp74
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp98
-rw-r--r--editor/project_settings.cpp4
-rw-r--r--editor/property_editor.cpp30
-rw-r--r--editor/scene_tree_editor.cpp8
-rw-r--r--editor/script_editor_debugger.cpp10
21 files changed, 329 insertions, 189 deletions
diff --git a/editor/SCsub b/editor/SCsub
index d7392f8249..c46e443534 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -141,6 +141,30 @@ def make_translations_header(target, source, env):
g.write("#endif")
+def make_authors_header(target, source, env):
+
+ src = source[0].srcnode().abspath
+ dst = target[0].srcnode().abspath
+ f = open(src, "rb")
+ g = open(dst, "wb")
+
+ g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ g.write("#ifndef _EDITOR_AUTHORS_H\n")
+ g.write("#define _EDITOR_AUTHORS_H\n")
+ g.write("static const char *dev_names[] = {\n")
+
+ name_count = -1
+ for line in f:
+ if name_count >= 0:
+ if line.startswith(" "):
+ g.write("\t\"" + line.strip() + "\",\n")
+ name_count += 1
+ elif line.strip() == "## Developers":
+ name_count = 0
+ g.write("\t0\n")
+ g.write("};\n")
+ g.write("#define AUTHORS_COUNT " + str(name_count) + "\n")
+ g.write("#endif\n")
if (env["tools"] == "yes"):
@@ -188,6 +212,10 @@ if (env["tools"] == "yes"):
env.Depends('#editor/builtin_fonts.h', flist)
env.Command('#editor/builtin_fonts.h', flist, make_fonts_header)
+ # Authors
+ env.Depends('#editor/authors.h', "../AUTHORS.md")
+ env.Command('#editor/authors.h', "../AUTHORS.md", make_authors_header)
+
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index ebfc0326d2..1798e66e8a 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -76,7 +76,7 @@ private:
Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
sb->draw(ci, r);
r.size -= sb->get_minimum_size();
- r.pos += sb->get_offset();
+ r.position += sb->get_offset();
//VisualServer::get_singleton()->canvas_item_add
Ref<Font> f = get_font("font", "Label");
@@ -111,7 +111,7 @@ private:
iflp = 1.0 - iflp;
}
- VisualServer::get_singleton()->canvas_item_add_line(ci, r.pos + Point2(iflp * r.size.width, prev * r.size.height), r.pos + Point2(ifl * r.size.width, h * r.size.height), mcolor);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, r.position + Point2(iflp * r.size.width, prev * r.size.height), r.position + Point2(ifl * r.size.width, h * r.size.height), mcolor);
prev = h;
}
@@ -138,7 +138,7 @@ private:
iflp = 1.0 - iflp;
}
- VisualServer::get_singleton()->canvas_item_add_line(ci, r.pos + Point2(iflp * r.size.width, prev * r.size.height), r.pos + Point2(ifl * r.size.width, h * r.size.height), color);
+ VisualServer::get_singleton()->canvas_item_add_line(ci, r.position + Point2(iflp * r.size.width, prev * r.size.height), r.position + Point2(ifl * r.size.width, h * r.size.height), color);
prev = h;
}
}
@@ -2076,7 +2076,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
Rect2 area(ofs.x, ofs.y + ((int(mpos.y) / h) + 1) * h, name_limit, h);
track_name->set_text(animation->track_get_path(idx));
- track_name->set_position(te->get_global_position() + area.pos);
+ track_name->set_position(te->get_global_position() + area.position);
track_name->set_size(area.size);
track_name->show_modal();
track_name->grab_focus();
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 42adf3abcf..ef7007c7a6 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -342,7 +342,7 @@ void EditorAudioBus::_effect_edited() {
if (effect->get_metadata(0) == Variant()) {
Rect2 area = effects->get_item_rect(effect);
- effect_options->set_position(effects->get_global_position() + area.pos + Vector2(0, area.size.y));
+ effect_options->set_position(effects->get_global_position() + area.position + Vector2(0, area.size.y));
effect_options->popup();
//add effect
} else {
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index dc4c2b21bc..0873b90f22 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -49,8 +49,8 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p
int chr = c[0];
Rect2 frect;
- frect.pos.x = c[1];
- frect.pos.y = c[2];
+ frect.position.x = c[1];
+ frect.position.y = c[2];
frect.size.x = c[3];
frect.size.y = c[4];
Point2 align(c[5], c[6] + p_valign);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 08cf5b2693..d139cd0d66 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -30,6 +30,7 @@
#include "editor_node.h"
#include "animation_editor.h"
+#include "authors.h"
#include "bind/core_bind.h"
#include "class_db.h"
#include "core/io/resource_loader.h"
@@ -3846,7 +3847,7 @@ void EditorNode::_dock_select_draw() {
unusable.a = 0.1;
Rect2 unr(s.x * 2, 0, s.x * 2, s.y * 2);
- unr.pos += Vector2(2, 5);
+ unr.position += Vector2(2, 5);
unr.size -= Vector2(4, 7);
dock_select->draw_rect(unr, unusable);
@@ -3899,7 +3900,7 @@ void EditorNode::_dock_select_draw() {
Rect2 r(ofs, s);
dock_select_rect[i] = r;
- r.pos += Vector2(2, 5);
+ r.position += Vector2(2, 5);
r.size -= Vector2(4, 7);
if (i == dock_select_rect_over) {
@@ -5874,14 +5875,49 @@ EditorNode::EditorNode() {
about->get_ok()->set_text(TTR("Thanks!"));
about->set_hide_on_ok(true);
gui_base->add_child(about);
+ VBoxContainer *vbc = memnew(VBoxContainer);
HBoxContainer *hbc = memnew(HBoxContainer);
- about->add_child(hbc);
+ hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->set_alignment(BoxContainer::ALIGN_CENTER);
+ about->add_child(vbc);
+ vbc->add_child(hbc);
Label *about_text = memnew(Label);
- about_text->set_text(VERSION_FULL_NAME "\n(c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
+ about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n");
TextureRect *logo = memnew(TextureRect);
logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
hbc->add_child(logo);
hbc->add_child(about_text);
+ TabContainer *tc = memnew(TabContainer);
+ tc->set_custom_minimum_size(Vector2(740, 300));
+ vbc->add_child(tc);
+ ScrollContainer *dev_base = memnew(ScrollContainer);
+ dev_base->set_name(TTR("Developers"));
+ tc->add_child(dev_base);
+ HBoxContainer *dev_hbc = memnew(HBoxContainer);
+ dev_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ dev_base->add_child(dev_hbc);
+ for (int i = 0; i < 3; i++) {
+ Label *dev_label = memnew(Label);
+ dev_label->set_h_size_flags(Control::SIZE_EXPAND);
+ dev_label->set_v_size_flags(Control::SIZE_FILL);
+ dev_hbc->add_child(dev_label);
+ }
+ int dev_name_index = 0;
+ int dev_name_column = 0;
+ const int dev_index_max = AUTHORS_COUNT / 3 + (AUTHORS_COUNT % 3 == 0 ? 0 : 1);
+ String dev_name = "";
+ const char **dev_names_ptr = dev_names;
+ while (*dev_names_ptr) {
+ dev_name += String::utf8(*dev_names_ptr++);
+ if (++dev_name_index == dev_index_max || !*dev_names_ptr) {
+ dev_hbc->get_child(dev_name_column)->cast_to<Label>()->set_text(dev_name);
+ dev_name_column++;
+ dev_name = "";
+ dev_name_index = 0;
+ } else {
+ dev_name += "\n";
+ }
+ }
warning = memnew(AcceptDialog);
gui_base->add_child(warning);
diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp
index e0ebe985cd..c97dc9a88e 100644
--- a/editor/editor_run.cpp
+++ b/editor/editor_run.cpp
@@ -73,17 +73,17 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
}
Rect2 screen_rect;
- screen_rect.pos = OS::get_singleton()->get_screen_position(screen);
+ screen_rect.position = OS::get_singleton()->get_screen_position(screen);
screen_rect.size = OS::get_singleton()->get_screen_size(screen);
Size2 desired_size;
- desired_size.x = GlobalConfig::get_singleton()->get("display/width");
- desired_size.y = GlobalConfig::get_singleton()->get("display/height");
+ desired_size.x = GlobalConfig::get_singleton()->get("display/window/width");
+ desired_size.y = GlobalConfig::get_singleton()->get("display/window/height");
Size2 test_size;
- test_size.x = GlobalConfig::get_singleton()->get("display/test_width");
- test_size.y = GlobalConfig::get_singleton()->get("display/test_height");
+ test_size.x = GlobalConfig::get_singleton()->get("display/window/test_width");
+ test_size.y = GlobalConfig::get_singleton()->get("display/window/test_height");
if (test_size.x > 0 && test_size.y > 0) {
desired_size = test_size;
@@ -95,21 +95,21 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
case 0: { // default
args.push_back("-p");
- args.push_back(itos(screen_rect.pos.x) + "x" + itos(screen_rect.pos.y));
+ args.push_back(itos(screen_rect.position.x) + "x" + itos(screen_rect.position.y));
} break;
case 1: { // centered
- Vector2 pos = screen_rect.pos + ((screen_rect.size - desired_size) / 2).floor();
+ Vector2 pos = screen_rect.position + ((screen_rect.size - desired_size) / 2).floor();
args.push_back("-p");
args.push_back(itos(pos.x) + "x" + itos(pos.y));
} break;
case 2: { // custom pos
Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position");
- pos += screen_rect.pos;
+ pos += screen_rect.position;
args.push_back("-p");
args.push_back(itos(pos.x) + "x" + itos(pos.y));
} break;
case 3: { // force maximized
- Vector2 pos = screen_rect.pos;
+ Vector2 pos = screen_rect.position;
args.push_back("-p");
args.push_back(itos(pos.x) + "x" + itos(pos.y));
args.push_back("-mx");
@@ -117,7 +117,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li
} break;
case 4: { // force fullscreen
- Vector2 pos = screen_rect.pos;
+ Vector2 pos = screen_rect.position;
args.push_back("-p");
args.push_back(itos(pos.x) + "x" + itos(pos.y));
args.push_back("-f");
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index df12c7c75f..3dab1707a1 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -556,6 +556,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("text_editor/line_numbers/line_length_guideline_column", 80);
hints["text_editor/line_numbers/line_length_guideline_column"] = PropertyInfo(Variant::INT, "text_editor/line_numbers/line_length_guideline_column", PROPERTY_HINT_RANGE, "20, 160, 10");
+ set("text_editor/open_scripts/show_members_overview", true);
+
set("text_editor/files/trim_trailing_whitespace_on_save", false);
set("text_editor/completion/idle_parse_delay", 2);
set("text_editor/tools/create_signal_callbacks", true);
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 3977519e94..d67832e10b 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -876,7 +876,7 @@ void AnimationTreeEditor::_draw_cos_line(const Vector2 &p_from, const Vector2 &p
static const int steps = 20;
Rect2 r;
- r.pos = p_from;
+ r.position = p_from;
r.expand_to(p_to);
Vector2 sign = Vector2((p_from.x < p_to.x) ? 1 : -1, (p_from.y < p_to.y) ? 1 : -1);
bool flip = sign.x * sign.y < 0;
@@ -888,7 +888,7 @@ void AnimationTreeEditor::_draw_cos_line(const Vector2 &p_from, const Vector2 &p
float c = -Math::cos(d * Math_PI) * 0.5 + 0.5;
if (flip)
c = 1.0 - c;
- Vector2 p = r.pos + Vector2(d * r.size.width, c * r.size.height);
+ Vector2 p = r.position + Vector2(d * r.size.width, c * r.size.height);
if (i > 0) {
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 3e6adfe27a..e6c08a9009 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -536,10 +536,10 @@ void CanvasItemEditor::_find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_n
Rect2 rect = c->get_item_rect();
Transform2D xform = p_parent_xform * p_canvas_xform * c->get_transform();
- if (p_rect.has_point(xform.xform(rect.pos)) &&
- p_rect.has_point(xform.xform(rect.pos + Vector2(rect.size.x, 0))) &&
- p_rect.has_point(xform.xform(rect.pos + Vector2(rect.size.x, rect.size.y))) &&
- p_rect.has_point(xform.xform(rect.pos + Vector2(0, rect.size.y)))) {
+ if (p_rect.has_point(xform.xform(rect.position)) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, 0))) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, rect.size.y))) &&
+ p_rect.has_point(xform.xform(rect.position + Vector2(0, rect.size.y)))) {
r_items->push_back(c);
}
@@ -652,7 +652,7 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE
// drag = transform.affine_inverse().basis_xform(p_dir); // zoom sensitive
drag = canvas_item->get_global_transform_with_canvas().affine_inverse().basis_xform(drag);
Rect2 local_rect = canvas_item->get_item_rect();
- local_rect.pos += drag;
+ local_rect.position += drag;
undo_redo->add_do_method(canvas_item, "edit_set_rect", local_rect);
} else { // p_move_mode==MOVE_LOCAL_BASE || p_move_mode==MOVE_LOCAL_WITH_ROT
@@ -680,7 +680,7 @@ Point2 CanvasItemEditor::_find_topleftmost_point() {
Vector2 tl = Point2(1e10, 1e10);
Rect2 r2;
- r2.pos = tl;
+ r2.position = tl;
List<Node *> &selection = editor_selection->get_selected_node_list();
@@ -695,13 +695,13 @@ Point2 CanvasItemEditor::_find_topleftmost_point() {
Rect2 rect = canvas_item->get_item_rect();
Transform2D xform = canvas_item->get_global_transform_with_canvas();
- r2.expand_to(xform.xform(rect.pos));
- r2.expand_to(xform.xform(rect.pos + Vector2(rect.size.x, 0)));
- r2.expand_to(xform.xform(rect.pos + rect.size));
- r2.expand_to(xform.xform(rect.pos + Vector2(0, rect.size.y)));
+ r2.expand_to(xform.xform(rect.position));
+ r2.expand_to(xform.xform(rect.position + Vector2(rect.size.x, 0)));
+ r2.expand_to(xform.xform(rect.position + rect.size));
+ r2.expand_to(xform.xform(rect.position + Vector2(0, rect.size.y)));
}
- return r2.pos;
+ return r2.position;
}
int CanvasItemEditor::get_item_count() {
@@ -759,18 +759,18 @@ CanvasItemEditor::DragType CanvasItemEditor::_find_drag_type(const Transform2D &
Vector2 endpoints[4] = {
- xform.xform(rect.pos),
- xform.xform(rect.pos + Vector2(rect.size.x, 0)),
- xform.xform(rect.pos + rect.size),
- xform.xform(rect.pos + Vector2(0, rect.size.y))
+ xform.xform(rect.position),
+ xform.xform(rect.position + Vector2(rect.size.x, 0)),
+ xform.xform(rect.position + rect.size),
+ xform.xform(rect.position + Vector2(0, rect.size.y))
};
Vector2 endpointsl[4] = {
- xforml.xform(rect.pos),
- xforml.xform(rect.pos + Vector2(rect.size.x, 0)),
- xforml.xform(rect.pos + rect.size),
- xforml.xform(rect.pos + Vector2(0, rect.size.y))
+ xforml.xform(rect.position),
+ xforml.xform(rect.position + Vector2(rect.size.x, 0)),
+ xforml.xform(rect.position + rect.size),
+ xforml.xform(rect.position + Vector2(0, rect.size.y))
};
DragType dragger[] = {
@@ -1552,8 +1552,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
canvas_item->get_global_transform_with_canvas().affine_inverse().xform(dfrom);
Rect2 local_rect = canvas_item->get_item_rect();
- Vector2 begin = local_rect.pos;
- Vector2 end = local_rect.pos + local_rect.size;
+ Vector2 begin = local_rect.position;
+ Vector2 end = local_rect.position + local_rect.size;
Vector2 minsize = canvas_item->edit_get_minimum_size();
if (uniform) {
@@ -1645,7 +1645,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (!dragging_bone) {
- local_rect.pos = begin;
+ local_rect.position = begin;
local_rect.size = end - begin;
canvas_item->edit_set_rect(local_rect);
@@ -1868,10 +1868,10 @@ void CanvasItemEditor::_viewport_draw() {
Vector2 endpoints[4] = {
- xform.xform(rect.pos),
- xform.xform(rect.pos + Vector2(rect.size.x, 0)),
- xform.xform(rect.pos + rect.size),
- xform.xform(rect.pos + Vector2(0, rect.size.y))
+ xform.xform(rect.position),
+ xform.xform(rect.position + Vector2(rect.size.x, 0)),
+ xform.xform(rect.position + rect.size),
+ xform.xform(rect.position + Vector2(0, rect.size.y))
};
Color c = Color(1, 0.6, 0.4, 0.7);
@@ -2212,7 +2212,7 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2 &r_rect, cons
lock.group = c->has_meta("_edit_group_");
if (lock.group || lock.lock) {
- lock.pos = xform.xform(rect.pos);
+ lock.pos = xform.xform(rect.position);
lock_list.push_back(lock);
}
@@ -2228,10 +2228,10 @@ void CanvasItemEditor::_find_canvas_items_span(Node *p_node, Rect2 &r_rect, cons
bone_list[id].last_pass = bone_last_frame;
}
- r_rect.expand_to(xform.xform(rect.pos));
- r_rect.expand_to(xform.xform(rect.pos + Point2(rect.size.x, 0)));
- r_rect.expand_to(xform.xform(rect.pos + Point2(0, rect.size.y)));
- r_rect.expand_to(xform.xform(rect.pos + rect.size));
+ r_rect.expand_to(xform.xform(rect.position));
+ r_rect.expand_to(xform.xform(rect.position + Point2(rect.size.x, 0)));
+ r_rect.expand_to(xform.xform(rect.position + Point2(0, rect.size.y)));
+ r_rect.expand_to(xform.xform(rect.position + rect.size));
}
}
@@ -2277,19 +2277,19 @@ void CanvasItemEditor::_update_scrollbars() {
//expand area so it's easier to do animations and stuff at 0,0
canvas_item_rect.size += screen_rect * 2;
- canvas_item_rect.pos -= screen_rect;
+ canvas_item_rect.position -= screen_rect;
Point2 ofs;
if (canvas_item_rect.size.height <= (local_rect.size.y / zoom)) {
v_scroll->hide();
- ofs.y = canvas_item_rect.pos.y;
+ ofs.y = canvas_item_rect.position.y;
} else {
v_scroll->show();
- v_scroll->set_min(canvas_item_rect.pos.y);
- v_scroll->set_max(canvas_item_rect.pos.y + canvas_item_rect.size.y);
+ v_scroll->set_min(canvas_item_rect.position.y);
+ v_scroll->set_max(canvas_item_rect.position.y + canvas_item_rect.size.y);
v_scroll->set_page(local_rect.size.y / zoom);
if (first_update) {
//so 0,0 is visible
@@ -2304,12 +2304,12 @@ void CanvasItemEditor::_update_scrollbars() {
if (canvas_item_rect.size.width <= (local_rect.size.x / zoom)) {
h_scroll->hide();
- ofs.x = canvas_item_rect.pos.x;
+ ofs.x = canvas_item_rect.position.x;
} else {
h_scroll->show();
- h_scroll->set_min(canvas_item_rect.pos.x);
- h_scroll->set_max(canvas_item_rect.pos.x + canvas_item_rect.size.x);
+ h_scroll->set_min(canvas_item_rect.position.x);
+ h_scroll->set_max(canvas_item_rect.position.x + canvas_item_rect.size.x);
h_scroll->set_page(local_rect.size.x / zoom);
ofs.x = h_scroll->get_value();
}
@@ -2977,7 +2977,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
Transform2D t(angle, Vector2(0.f, 0.f));
item_rect = t.xform(item_rect);
- Rect2 canvas_item_rect(pos + scale * item_rect.pos, scale * item_rect.size);
+ Rect2 canvas_item_rect(pos + scale * item_rect.position, scale * item_rect.size);
if (count == 1) {
rect = canvas_item_rect;
} else {
@@ -2988,7 +2988,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
if (p_op == VIEW_CENTER_TO_SELECTION) {
- center = rect.pos + rect.size / 2;
+ center = rect.position + rect.size / 2;
Vector2 offset = viewport->get_size() / 2 - editor->get_scene_root()->get_global_canvas_transform().xform(center);
h_scroll->set_value(h_scroll->get_value() - offset.x / zoom);
v_scroll->set_value(v_scroll->get_value() - offset.y / zoom);
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index d9963a422a..dd13ca0e63 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -675,14 +675,14 @@ void Polygon2DEditor::_uv_draw() {
rect = rect.grow(200);
updating_uv_scroll = true;
- uv_hscroll->set_min(rect.pos.x);
- uv_hscroll->set_max(rect.pos.x + rect.size.x);
+ uv_hscroll->set_min(rect.position.x);
+ uv_hscroll->set_max(rect.position.x + rect.size.x);
uv_hscroll->set_page(uv_edit_draw->get_size().x);
uv_hscroll->set_value(uv_draw_ofs.x);
uv_hscroll->set_step(0.001);
- uv_vscroll->set_min(rect.pos.y);
- uv_vscroll->set_max(rect.pos.y + rect.size.y);
+ uv_vscroll->set_min(rect.position.y);
+ uv_vscroll->set_max(rect.position.y + rect.size.y);
uv_vscroll->set_page(uv_edit_draw->get_size().y);
uv_vscroll->set_value(uv_draw_ofs.y);
uv_vscroll->set_step(0.001);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index fde6d83aa8..f3941d6a16 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -410,7 +410,9 @@ void ScriptEditor::_go_to_tab(int p_idx) {
c->set_meta("__editor_pass", ++edit_pass);
_update_history_arrows();
_update_script_colors();
+ _update_members_overview();
_update_selected_editor_menu();
+ _update_members_overview_visibility();
}
void ScriptEditor::_add_recent_script(String p_path) {
@@ -540,6 +542,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) {
_update_history_arrows();
_update_script_names();
+ _update_members_overview_visibility();
_save_layout();
}
@@ -1025,6 +1028,7 @@ void ScriptEditor::_notification(int p_what) {
editor->connect("script_add_function_request", this, "_add_callback");
editor->connect("resource_saved", this, "_res_saved_callback");
script_list->connect("item_selected", this, "_script_selected");
+ members_overview->connect("item_selected", this, "_members_overview_selected");
script_split->connect("dragged", this, "_script_split_dragged");
autosave_timer->connect("timeout", this, "_autosave_scripts");
{
@@ -1273,6 +1277,16 @@ void ScriptEditor::ensure_focus_current() {
se->ensure_focus();
}
+void ScriptEditor::_members_overview_selected(int p_idx) {
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
+ if (!se) {
+ return;
+ }
+ se->goto_line(members_overview->get_item_metadata(p_idx));
+ se->ensure_focus();
+}
+
void ScriptEditor::_script_selected(int p_idx) {
grab_focus_block = !Input::get_singleton()->is_mouse_button_pressed(1); //amazing hack, simply amazing
@@ -1342,6 +1356,37 @@ struct _ScriptEditorItemData {
}
};
+void ScriptEditor::_update_members_overview_visibility() {
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
+ if (!se) {
+ members_overview->set_visible(false);
+ return;
+ }
+
+ if (members_overview_enabled && se->show_members_overview()) {
+ members_overview->set_visible(true);
+ } else {
+ members_overview->set_visible(false);
+ }
+}
+
+void ScriptEditor::_update_members_overview() {
+ members_overview->clear();
+
+ Node *current = tab_container->get_child(tab_container->get_current_tab());
+ ScriptEditorBase *se = current->cast_to<ScriptEditorBase>();
+ if (!se) {
+ return;
+ }
+
+ Vector<String> functions = se->get_functions();
+ for (int i = 0; i < functions.size(); i++) {
+ members_overview->add_item(functions[i].get_slice(":", 0));
+ members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1);
+ }
+}
+
void ScriptEditor::_update_script_colors() {
bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_enabled");
@@ -1485,6 +1530,7 @@ void ScriptEditor::_update_script_names() {
}
}
+ _update_members_overview();
_update_script_colors();
}
@@ -1733,6 +1779,9 @@ void ScriptEditor::_editor_settings_changed() {
convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/indent/convert_indent_on_save");
use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type");
+ members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview");
+ _update_members_overview_visibility();
+
float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs");
if (autosave_time > 0) {
autosave_timer->set_wait_time(autosave_time);
@@ -2084,6 +2133,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_editor_settings_changed", &ScriptEditor::_editor_settings_changed);
ClassDB::bind_method("_update_script_names", &ScriptEditor::_update_script_names);
ClassDB::bind_method("_tree_changed", &ScriptEditor::_tree_changed);
+ ClassDB::bind_method("_members_overview_selected", &ScriptEditor::_members_overview_selected);
ClassDB::bind_method("_script_selected", &ScriptEditor::_script_selected);
ClassDB::bind_method("_script_created", &ScriptEditor::_script_created);
ClassDB::bind_method("_script_split_dragged", &ScriptEditor::_script_split_dragged);
@@ -2105,6 +2155,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
waiting_update_names = false;
pending_auto_reload = false;
auto_reload_running_scripts = false;
+ members_overview_enabled = true;
editor = p_editor;
menu_hb = memnew(HBoxContainer);
@@ -2114,10 +2165,19 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
add_child(script_split);
script_split->set_v_size_flags(SIZE_EXPAND_FILL);
+ list_split = memnew(VSplitContainer);
+ script_split->add_child(list_split);
+ list_split->set_v_size_flags(SIZE_EXPAND_FILL);
+
script_list = memnew(ItemList);
- script_split->add_child(script_list);
+ list_split->add_child(script_list);
script_list->set_custom_minimum_size(Size2(0, 0));
script_split->set_split_offset(140);
+ list_split->set_split_offset(500);
+
+ members_overview = memnew(ItemList);
+ list_split->add_child(members_overview);
+ members_overview->set_custom_minimum_size(Size2(0, 0));
tab_container = memnew(TabContainer);
tab_container->add_style_override("panel", p_editor->get_gui_base()->get_stylebox("ScriptPanel", "EditorStyles"));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 455a888f0e..e036d1ed9c 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -102,6 +102,8 @@ public:
virtual void set_debugger_active(bool p_active) = 0;
virtual bool can_lose_focus_on_node_selection() { return true; }
+ virtual bool show_members_overview() = 0;
+
virtual void set_tooltip_request_func(String p_method, Object *p_obj) = 0;
virtual Control *get_edit_menu() = 0;
@@ -179,6 +181,9 @@ class ScriptEditor : public VBoxContainer {
ItemList *script_list;
HSplitContainer *script_split;
+ ItemList *members_overview;
+ bool members_overview_enabled;
+ VSplitContainer *list_split;
TabContainer *tab_container;
EditorFileDialog *file_dialog;
ConfirmationDialog *erase_tab_confirm;
@@ -278,8 +283,11 @@ class ScriptEditor : public VBoxContainer {
void _editor_settings_changed();
void _autosave_scripts();
+ void _update_members_overview_visibility();
+ void _update_members_overview();
void _update_script_names();
+ void _members_overview_selected(int p_idx);
void _script_selected(int p_idx);
void _find_scripts(Node *p_base, Node *p_current, Set<Ref<Script> > &used);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 70bda39947..9f76119374 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -218,6 +218,10 @@ void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_
code_editor->get_text_edit()->cursor_set_column(1);
}
+bool ScriptTextEditor::show_members_overview() {
+ return true;
+}
+
void ScriptTextEditor::update_settings() {
code_editor->update_editor_settings();
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index fdae03949c..ba40645161 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -149,6 +149,8 @@ public:
virtual void add_callback(const String &p_function, PoolStringArray p_args);
virtual void update_settings();
+ virtual bool show_members_overview();
+
virtual void set_tooltip_request_func(String p_method, Object *p_obj);
virtual void set_debugger_active(bool p_active);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index c60adf9e7b..3536ecd094 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1752,10 +1752,10 @@ static void stroke_rect(CanvasItem *ci, Rect2 rect, Color color, real_t width =
// a---b
// | |
// c---d
- Vector2 a(rect.pos);
- Vector2 b(rect.pos.x + rect.size.x, rect.pos.y);
- Vector2 c(rect.pos.x, rect.pos.y + rect.size.y);
- Vector2 d(rect.pos + rect.size);
+ Vector2 a(rect.position);
+ Vector2 b(rect.position.x + rect.size.x, rect.position.y);
+ Vector2 c(rect.position.x, rect.position.y + rect.size.y);
+ Vector2 d(rect.position + rect.size);
ci->draw_line(a, b, color, width);
ci->draw_line(b, d, color, width);
@@ -1804,15 +1804,15 @@ void SpatialEditorViewport::_draw() {
case Camera::KEEP_WIDTH: {
draw_rect.size = Size2(s.width, s.width / aspect);
- draw_rect.pos.x = 0;
- draw_rect.pos.y = (s.height - draw_rect.size.y) * 0.5;
+ draw_rect.position.x = 0;
+ draw_rect.position.y = (s.height - draw_rect.size.y) * 0.5;
} break;
case Camera::KEEP_HEIGHT: {
draw_rect.size = Size2(s.height * aspect, s.height);
- draw_rect.pos.y = 0;
- draw_rect.pos.x = (s.width - draw_rect.size.x) * 0.5;
+ draw_rect.position.y = 0;
+ draw_rect.position.x = (s.width - draw_rect.size.x) * 0.5;
} break;
}
@@ -1846,7 +1846,7 @@ void SpatialEditorViewport::_draw() {
real_t sy = r.size.y * logscale_t;
surface->draw_rect(r, Color(1, 1, 1, 0.2));
- surface->draw_rect(Rect2(r.pos.x, r.pos.y + r.size.y - sy, r.size.x, sy), Color(1, 1, 1, 0.6));
+ surface->draw_rect(Rect2(r.position.x, r.position.y + r.size.y - sy, r.size.x, sy), Color(1, 1, 1, 0.6));
stroke_rect(surface, r.grow(1), Color(0, 0, 0, 0.7));
}
}
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index 6382164628..976a7b6271 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -114,10 +114,10 @@ void TextureRegionEditor::_region_draw() {
for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
Rect2 r = E->get();
Vector2 endpoints[4] = {
- mtx.basis_xform(r.pos),
- mtx.basis_xform(r.pos + Vector2(r.size.x, 0)),
- mtx.basis_xform(r.pos + r.size),
- mtx.basis_xform(r.pos + Vector2(0, r.size.y))
+ mtx.basis_xform(r.position),
+ mtx.basis_xform(r.position + Vector2(r.size.x, 0)),
+ mtx.basis_xform(r.position + r.size),
+ mtx.basis_xform(r.position + Vector2(0, r.size.y))
};
for (int i = 0; i < 4; i++) {
int next = (i + 1) % 4;
@@ -132,10 +132,10 @@ void TextureRegionEditor::_region_draw() {
scroll_rect.expand_to(mtx.basis_xform(edit_draw->get_size()));
Vector2 endpoints[4] = {
- mtx.basis_xform(rect.pos),
- mtx.basis_xform(rect.pos + Vector2(rect.size.x, 0)),
- mtx.basis_xform(rect.pos + rect.size),
- mtx.basis_xform(rect.pos + Vector2(0, rect.size.y))
+ mtx.basis_xform(rect.position),
+ mtx.basis_xform(rect.position + Vector2(rect.size.x, 0)),
+ mtx.basis_xform(rect.position + rect.size),
+ mtx.basis_xform(rect.position + Vector2(0, rect.size.y))
};
Color color(0.9, 0.5, 0.5);
for (int i = 0; i < 4; i++) {
@@ -162,14 +162,14 @@ void TextureRegionEditor::_region_draw() {
scroll_rect = scroll_rect.grow(200);
updating_scroll = true;
- hscroll->set_min(scroll_rect.pos.x);
- hscroll->set_max(scroll_rect.pos.x + scroll_rect.size.x);
+ hscroll->set_min(scroll_rect.position.x);
+ hscroll->set_max(scroll_rect.position.x + scroll_rect.size.x);
hscroll->set_page(edit_draw->get_size().x);
hscroll->set_value(draw_ofs.x);
hscroll->set_step(0.001);
- vscroll->set_min(scroll_rect.pos.y);
- vscroll->set_max(scroll_rect.pos.y + scroll_rect.size.y);
+ vscroll->set_min(scroll_rect.position.y);
+ vscroll->set_max(scroll_rect.position.y + scroll_rect.size.y);
vscroll->set_page(edit_draw->get_size().y);
vscroll->set_value(draw_ofs.y);
vscroll->set_step(0.001);
@@ -208,14 +208,14 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
mtx.scale_basis(Vector2(draw_zoom, draw_zoom));
Vector2 endpoints[8] = {
- mtx.xform(rect.pos) + Vector2(-4, -4),
- mtx.xform(rect.pos + Vector2(rect.size.x / 2, 0)) + Vector2(0, -4),
- mtx.xform(rect.pos + Vector2(rect.size.x, 0)) + Vector2(4, -4),
- mtx.xform(rect.pos + Vector2(rect.size.x, rect.size.y / 2)) + Vector2(4, 0),
- mtx.xform(rect.pos + rect.size) + Vector2(4, 4),
- mtx.xform(rect.pos + Vector2(rect.size.x / 2, rect.size.y)) + Vector2(0, 4),
- mtx.xform(rect.pos + Vector2(0, rect.size.y)) + Vector2(-4, 4),
- mtx.xform(rect.pos + Vector2(0, rect.size.y / 2)) + Vector2(-4, 0)
+ mtx.xform(rect.position) + Vector2(-4, -4),
+ mtx.xform(rect.position + Vector2(rect.size.x / 2, 0)) + Vector2(0, -4),
+ mtx.xform(rect.position + Vector2(rect.size.x, 0)) + Vector2(4, -4),
+ mtx.xform(rect.position + Vector2(rect.size.x, rect.size.y / 2)) + Vector2(4, 0),
+ mtx.xform(rect.position + rect.size) + Vector2(4, 4),
+ mtx.xform(rect.position + Vector2(rect.size.x / 2, rect.size.y)) + Vector2(0, 4),
+ mtx.xform(rect.position + Vector2(0, rect.size.y)) + Vector2(-4, 4),
+ mtx.xform(rect.position + Vector2(0, rect.size.y / 2)) + Vector2(-4, 0)
};
Ref<InputEventMouseButton> mb;
@@ -239,10 +239,10 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
}
Vector2 pos[4] = {
- mtx.basis_xform(rect.pos + Vector2(0, margins[0])) - draw_ofs,
- mtx.basis_xform(rect.pos + rect.size - Vector2(0, margins[1])) - draw_ofs,
- mtx.basis_xform(rect.pos + Vector2(margins[2], 0)) - draw_ofs,
- mtx.basis_xform(rect.pos + rect.size - Vector2(margins[3], 0)) - draw_ofs
+ mtx.basis_xform(rect.position + Vector2(0, margins[0])) - draw_ofs,
+ mtx.basis_xform(rect.position + rect.size - Vector2(0, margins[1])) - draw_ofs,
+ mtx.basis_xform(rect.position + Vector2(margins[2], 0)) - draw_ofs,
+ mtx.basis_xform(rect.position + rect.size - Vector2(margins[3], 0)) - draw_ofs
};
if (Math::abs(mb->get_position().y - pos[0].y) < 8) {
edited_margin = 0;
@@ -277,8 +277,8 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
r = obj_styleBox->get_region_rect();
else if (atlas_tex.is_valid())
r = atlas_tex->get_region();
- rect.expand_to(r.pos);
- rect.expand_to(r.pos + r.size);
+ rect.expand_to(r.position);
+ rect.expand_to(r.position + r.size);
}
undo_redo->create_action("Set Region Rect");
if (node_sprite) {
@@ -439,49 +439,49 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
switch (drag_index) {
case 0: {
- Vector2 p = rect_prev.pos + rect_prev.size;
+ Vector2 p = rect_prev.position + rect_prev.size;
rect = Rect2(p, Size2());
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 1: {
- Vector2 p = rect_prev.pos + Vector2(0, rect_prev.size.y);
+ Vector2 p = rect_prev.position + Vector2(0, rect_prev.size.y);
rect = Rect2(p, Size2(rect_prev.size.x, 0));
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 2: {
- Vector2 p = rect_prev.pos + Vector2(0, rect_prev.size.y);
+ Vector2 p = rect_prev.position + Vector2(0, rect_prev.size.y);
rect = Rect2(p, Size2());
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 3: {
- Vector2 p = rect_prev.pos;
+ Vector2 p = rect_prev.position;
rect = Rect2(p, Size2(0, rect_prev.size.y));
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 4: {
- Vector2 p = rect_prev.pos;
+ Vector2 p = rect_prev.position;
rect = Rect2(p, Size2());
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 5: {
- Vector2 p = rect_prev.pos;
+ Vector2 p = rect_prev.position;
rect = Rect2(p, Size2(rect_prev.size.x, 0));
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 6: {
- Vector2 p = rect_prev.pos + Vector2(rect_prev.size.x, 0);
+ Vector2 p = rect_prev.position + Vector2(rect_prev.size.x, 0);
rect = Rect2(p, Size2());
rect.expand_to(new_pos);
apply_rect(rect);
} break;
case 7: {
- Vector2 p = rect_prev.pos + Vector2(rect_prev.size.x, 0);
+ Vector2 p = rect_prev.position + Vector2(rect_prev.size.x, 0);
rect = Rect2(p, Size2(0, rect_prev.size.y));
rect.expand_to(new_pos);
apply_rect(rect);
@@ -693,7 +693,7 @@ void TextureRegionEditor::_edit_region() {
if (grown.has_point(Point2(x, y))) {
E->get().expand_to(Point2(x, y));
E->get().expand_to(Point2(x + 1, y + 1));
- x = E->get().pos.x + E->get().size.x - 1;
+ x = E->get().position.x + E->get().size.x - 1;
bool merged = true;
while (merged) {
merged = false;
@@ -706,8 +706,8 @@ void TextureRegionEditor::_edit_region() {
if (F == E)
continue;
if (E->get().grow(1).intersects(F->get())) {
- E->get().expand_to(F->get().pos);
- E->get().expand_to(F->get().pos + F->get().size);
+ E->get().expand_to(F->get().position);
+ E->get().expand_to(F->get().position + F->get().size);
if (F->prev()) {
F = F->prev();
autoslice_cache.erase(F->next());
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 282670e695..d12b979121 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -98,8 +98,8 @@ void TileMapEditor::_menu_option(int p_option) {
return;
undo_redo->create_action("Erase Selection");
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
_set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false, true);
}
@@ -333,7 +333,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
}
Rect2i r = node->get_item_rect();
- r.pos = r.pos / node->get_cell_size();
+ r.position = r.position / node->get_cell_size();
r.size = r.size / node->get_cell_size();
int area = r.get_area();
@@ -349,7 +349,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
invalidate_cache = true;
}
// Tile ID changed or position wasn't visited by the previous fill
- int loc = (p_start.x - r.get_pos().x) + (p_start.y - r.get_pos().y) * r.get_size().x;
+ int loc = (p_start.x - r.position.x) + (p_start.y - r.position.y) * r.get_size().x;
if (prev_id != bucket_cache_tile || !bucket_cache_visited[loc]) {
invalidate_cache = true;
}
@@ -380,7 +380,7 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
if (node->get_cell(n.x, n.y) == prev_id) {
if (preview) {
- int loc = (n.x - r.get_pos().x) + (n.y - r.get_pos().y) * r.get_size().x;
+ int loc = (n.x - r.position.x) + (n.y - r.position.y) * r.get_size().x;
if (bucket_cache_visited[loc])
continue;
bucket_cache_visited[loc] = true;
@@ -441,7 +441,7 @@ void TileMapEditor::_select(const Point2i &p_from, const Point2i &p_to) {
SWAP(begin.y, end.y);
}
- rectangle.pos = begin;
+ rectangle.position = begin;
rectangle.size = end - begin;
canvas_item_editor->update();
@@ -460,7 +460,7 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h
Size2 sc = p_xform.get_scale();
Rect2 rect = Rect2();
- rect.pos = node->map_to_world(p_point) + node->get_cell_draw_offset();
+ rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset();
if (r.has_no_area()) {
rect.size = t->get_size();
@@ -490,42 +490,42 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h
if (node->get_tile_origin() == TileMap::TILE_ORIGIN_TOP_LEFT) {
- rect.pos += tile_ofs;
+ rect.position += tile_ofs;
} else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_BOTTOM_LEFT) {
Size2 cell_size = node->get_cell_size();
- rect.pos += tile_ofs;
+ rect.position += tile_ofs;
if (p_transpose) {
if (p_flip_h)
- rect.pos.x -= cell_size.x;
+ rect.position.x -= cell_size.x;
else
- rect.pos.x += cell_size.x;
+ rect.position.x += cell_size.x;
} else {
if (p_flip_v)
- rect.pos.y -= cell_size.y;
+ rect.position.y -= cell_size.y;
else
- rect.pos.y += cell_size.y;
+ rect.position.y += cell_size.y;
}
} else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_CENTER) {
- rect.pos += node->get_cell_size() / 2;
+ rect.position += node->get_cell_size() / 2;
Vector2 s = r.size;
Vector2 center = (s / 2) - tile_ofs;
if (p_flip_h)
- rect.pos.x -= s.x - center.x;
+ rect.position.x -= s.x - center.x;
else
- rect.pos.x -= center.x;
+ rect.position.x -= center.x;
if (p_flip_v)
- rect.pos.y -= s.y - center.y;
+ rect.position.y -= s.y - center.y;
else
- rect.pos.y -= center.y;
+ rect.position.y -= center.y;
}
- rect.pos = p_xform.xform(rect.pos);
+ rect.position = p_xform.xform(rect.position);
rect.size *= sc;
if (r.has_no_area())
@@ -560,9 +560,9 @@ void TileMapEditor::_update_copydata() {
if (!selection_active)
return;
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
TileData tcd;
@@ -737,8 +737,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (id != TileMap::INVALID_CELL) {
undo_redo->create_action("Rectangle Paint");
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
_set_cell(Point2i(j, i), id, flip_h, flip_v, transpose, true);
}
@@ -749,7 +749,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
} else if (tool == TOOL_DUPLICATING) {
- Point2 ofs = over_tile - rectangle.pos;
+ Point2 ofs = over_tile - rectangle.position;
undo_redo->create_action(TTR("Duplicate"));
for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
@@ -985,8 +985,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo.clear();
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
Point2i tile = Point2i(j, i);
paint_undo[tile] = _get_op_from_cell(tile);
@@ -1103,7 +1103,7 @@ void TileMapEditor::_canvas_draw() {
Size2 screen_size = canvas_item_editor->get_size();
{
Rect2 aabb;
- aabb.pos = node->world_to_map(xform_inv.xform(Vector2()));
+ aabb.position = node->world_to_map(xform_inv.xform(Vector2()));
aabb.expand_to(node->world_to_map(xform_inv.xform(Vector2(0, screen_size.height))));
aabb.expand_to(node->world_to_map(xform_inv.xform(Vector2(screen_size.width, 0))));
aabb.expand_to(node->world_to_map(xform_inv.xform(screen_size)));
@@ -1113,10 +1113,10 @@ void TileMapEditor::_canvas_draw() {
int max_lines = 2000; //avoid crash if size too smal
- for (int i = (si.pos.x) - 1; i <= (si.pos.x + si.size.x); i++) {
+ for (int i = (si.position.x) - 1; i <= (si.position.x + si.size.x); i++) {
- Vector2 from = xform.xform(node->map_to_world(Vector2(i, si.pos.y)));
- Vector2 to = xform.xform(node->map_to_world(Vector2(i, si.pos.y + si.size.y + 1)));
+ Vector2 from = xform.xform(node->map_to_world(Vector2(i, si.position.y)));
+ Vector2 to = xform.xform(node->map_to_world(Vector2(i, si.position.y + si.size.y + 1)));
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
canvas_item_editor->draw_line(from, to, col, 1);
@@ -1127,9 +1127,9 @@ void TileMapEditor::_canvas_draw() {
int max_lines = 10000; //avoid crash if size too smal
- for (int i = (si.pos.x) - 1; i <= (si.pos.x + si.size.x); i++) {
+ for (int i = (si.position.x) - 1; i <= (si.position.x + si.size.x); i++) {
- for (int j = (si.pos.y) - 1; j <= (si.pos.y + si.size.y); j++) {
+ for (int j = (si.position.y) - 1; j <= (si.position.y + si.size.y); j++) {
Vector2 ofs;
if (ABS(j) & 1) {
@@ -1151,10 +1151,10 @@ void TileMapEditor::_canvas_draw() {
if (node->get_half_offset() != TileMap::HALF_OFFSET_Y) {
- for (int i = (si.pos.y) - 1; i <= (si.pos.y + si.size.y); i++) {
+ for (int i = (si.position.y) - 1; i <= (si.position.y + si.size.y); i++) {
- Vector2 from = xform.xform(node->map_to_world(Vector2(si.pos.x, i)));
- Vector2 to = xform.xform(node->map_to_world(Vector2(si.pos.x + si.size.x + 1, i)));
+ Vector2 from = xform.xform(node->map_to_world(Vector2(si.position.x, i)));
+ Vector2 to = xform.xform(node->map_to_world(Vector2(si.position.x + si.size.x + 1, i)));
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
canvas_item_editor->draw_line(from, to, col, 1);
@@ -1164,9 +1164,9 @@ void TileMapEditor::_canvas_draw() {
}
} else {
- for (int i = (si.pos.y) - 1; i <= (si.pos.y + si.size.y); i++) {
+ for (int i = (si.position.y) - 1; i <= (si.position.y + si.size.y); i++) {
- for (int j = (si.pos.x) - 1; j <= (si.pos.x + si.size.x); j++) {
+ for (int j = (si.position.x) - 1; j <= (si.position.x + si.size.x); j++) {
Vector2 ofs;
if (ABS(j) & 1) {
@@ -1188,10 +1188,10 @@ void TileMapEditor::_canvas_draw() {
if (selection_active) {
Vector<Vector2> points;
- points.push_back(xform.xform(node->map_to_world((rectangle.pos))));
- points.push_back(xform.xform(node->map_to_world((rectangle.pos + Point2(rectangle.size.x + 1, 0)))));
- points.push_back(xform.xform(node->map_to_world((rectangle.pos + Point2(rectangle.size.x + 1, rectangle.size.y + 1)))));
- points.push_back(xform.xform(node->map_to_world((rectangle.pos + Point2(0, rectangle.size.y + 1)))));
+ points.push_back(xform.xform(node->map_to_world((rectangle.position))));
+ points.push_back(xform.xform(node->map_to_world((rectangle.position + Point2(rectangle.size.x + 1, 0)))));
+ points.push_back(xform.xform(node->map_to_world((rectangle.position + Point2(rectangle.size.x + 1, rectangle.size.y + 1)))));
+ points.push_back(xform.xform(node->map_to_world((rectangle.position + Point2(0, rectangle.size.y + 1)))));
canvas_item_editor->draw_colored_polygon(points, Color(0.2, 0.8, 1, 0.4));
}
@@ -1248,8 +1248,8 @@ void TileMapEditor::_canvas_draw() {
if (id == TileMap::INVALID_CELL)
return;
- for (int i = rectangle.pos.y; i <= rectangle.pos.y + rectangle.size.y; i++) {
- for (int j = rectangle.pos.x; j <= rectangle.pos.x + rectangle.size.x; j++) {
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
_draw_cell(id, Point2i(j, i), flip_h, flip_v, transpose, xform);
}
@@ -1264,7 +1264,7 @@ void TileMapEditor::_canvas_draw() {
if (ts.is_null())
return;
- Point2 ofs = over_tile - rectangle.pos;
+ Point2 ofs = over_tile - rectangle.position;
for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {
@@ -1277,13 +1277,13 @@ void TileMapEditor::_canvas_draw() {
}
Rect2i duplicate = rectangle;
- duplicate.pos = over_tile;
+ duplicate.position = over_tile;
Vector<Vector2> points;
- points.push_back(xform.xform(node->map_to_world(duplicate.pos)));
- points.push_back(xform.xform(node->map_to_world((duplicate.pos + Point2(duplicate.size.x + 1, 0)))));
- points.push_back(xform.xform(node->map_to_world((duplicate.pos + Point2(duplicate.size.x + 1, duplicate.size.y + 1)))));
- points.push_back(xform.xform(node->map_to_world((duplicate.pos + Point2(0, duplicate.size.y + 1)))));
+ points.push_back(xform.xform(node->map_to_world(duplicate.position)));
+ points.push_back(xform.xform(node->map_to_world((duplicate.position + Point2(duplicate.size.x + 1, 0)))));
+ points.push_back(xform.xform(node->map_to_world((duplicate.position + Point2(duplicate.size.x + 1, duplicate.size.y + 1)))));
+ points.push_back(xform.xform(node->map_to_world((duplicate.position + Point2(0, duplicate.size.y + 1)))));
canvas_item_editor->draw_colored_polygon(points, Color(0.2, 1.0, 0.8, 0.2));
diff --git a/editor/project_settings.cpp b/editor/project_settings.cpp
index 1c4ca3cb58..8ef7bd427f 100644
--- a/editor/project_settings.cpp
+++ b/editor/project_settings.cpp
@@ -430,8 +430,8 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_
if (p_id == 1) {
Point2 ofs = input_editor->get_global_position();
Rect2 ir = input_editor->get_item_rect(ti);
- ir.pos.y -= input_editor->get_scroll().y;
- ofs += ir.pos + ir.size;
+ ir.position.y -= input_editor->get_scroll().y;
+ ofs += ir.position + ir.size;
ofs.x -= 100;
popup_add->set_position(ofs);
popup_add->popup();
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index b113d1b7ad..d1b79ea7aa 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -678,8 +678,8 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
field_names.push_back("h");
config_value_editors(4, 4, 10, field_names);
Rect2 r = v;
- value_editor[0]->set_text(String::num(r.pos.x));
- value_editor[1]->set_text(String::num(r.pos.y));
+ value_editor[0]->set_text(String::num(r.position.x));
+ value_editor[1]->set_text(String::num(r.position.y));
value_editor[2]->set_text(String::num(r.size.x));
value_editor[3]->set_text(String::num(r.size.y));
} break;
@@ -1539,13 +1539,13 @@ void CustomPropertyEditor::_modified(String p_string) {
Rect2 r2;
if (evaluator) {
- r2.pos.x = evaluator->eval(value_editor[0]->get_text());
- r2.pos.y = evaluator->eval(value_editor[1]->get_text());
+ r2.position.x = evaluator->eval(value_editor[0]->get_text());
+ r2.position.y = evaluator->eval(value_editor[1]->get_text());
r2.size.x = evaluator->eval(value_editor[2]->get_text());
r2.size.y = evaluator->eval(value_editor[3]->get_text());
} else {
- r2.pos.x = value_editor[0]->get_text().to_double();
- r2.pos.y = value_editor[1]->get_text().to_double();
+ r2.position.x = value_editor[0]->get_text().to_double();
+ r2.position.y = value_editor[1]->get_text().to_double();
r2.size.x = value_editor[2]->get_text().to_double();
r2.size.y = value_editor[3]->get_text().to_double();
}
@@ -3674,7 +3674,7 @@ void PropertyEditor::_draw_transparency(Object *t, const Rect2 &p_rect) {
// make a little space between consecutive color fields
Rect2 area = p_rect;
- area.pos.y += 1;
+ area.position.y += 1;
area.size.height -= 2;
area.size.width -= arrow->get_size().width + 5;
tree->draw_texture_rect(get_icon("Transparent", "EditorIcons"), area, true);
@@ -3942,7 +3942,7 @@ void PropertyEditor::_custom_editor_request(bool p_arrow) {
int hint = d.has("hint") ? d["hint"].operator int() : -1;
String hint_text = d.has("hint_text") ? d["hint_text"] : "";
Rect2 where = tree->get_custom_popup_rect();
- custom_editor->set_position(where.pos);
+ custom_editor->set_position(where.position);
if (custom_editor->edit(obj, name, type, v, hint, hint_text)) {
custom_editor->popup();
@@ -4049,9 +4049,9 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
Variant v = obj->get(n);
custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht);
Rect2 where = tree->get_item_rect(ti, 1);
- where.pos -= tree->get_scroll();
- where.pos += tree->get_global_position();
- custom_editor->set_position(where.pos);
+ where.position -= tree->get_scroll();
+ where.position += tree->get_global_position();
+ custom_editor->set_position(where.position);
custom_editor->popup();
} else if (t == Variant::STRING) {
@@ -4062,9 +4062,9 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
if (h == PROPERTY_HINT_FILE || h == PROPERTY_HINT_DIR || h == PROPERTY_HINT_GLOBAL_DIR || h == PROPERTY_HINT_GLOBAL_FILE) {
Rect2 where = tree->get_item_rect(ti, 1);
- where.pos -= tree->get_scroll();
- where.pos += tree->get_global_position();
- custom_editor->set_position(where.pos);
+ where.position -= tree->get_scroll();
+ where.position += tree->get_global_position();
+ custom_editor->set_position(where.position);
custom_editor->popup();
} else {
custom_editor->popup_centered_ratio();
@@ -4140,7 +4140,7 @@ void PropertyEditor::_draw_flags(Object *t, const Rect2 &p_rect) {
if (i == 1)
ofs.y += bsize + 1;
- ofs += p_rect.pos;
+ ofs += p_rect.position;
for (int j = 0; j < 10; j++) {
Point2 o = ofs + Point2(j * (bsize + 1), 0);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 2945abbd8c..d4e5714c0d 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -161,17 +161,17 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
if (p_id == BUTTON_SUBSCENE) {
//open scene request
Rect2 item_rect = tree->get_item_rect(item, 0);
- item_rect.pos.y -= tree->get_scroll().y;
- item_rect.pos += tree->get_global_position();
+ item_rect.position.y -= tree->get_scroll().y;
+ item_rect.position += tree->get_global_position();
if (n == get_scene_node()) {
- inheritance_menu->set_position(item_rect.pos + Vector2(0, item_rect.size.y));
+ inheritance_menu->set_position(item_rect.position + Vector2(0, item_rect.size.y));
inheritance_menu->set_size(Vector2(item_rect.size.x, 0));
inheritance_menu->popup();
instance_node = n->get_instance_ID();
} else {
- instance_menu->set_position(item_rect.pos + Vector2(0, item_rect.size.y));
+ instance_menu->set_position(item_rect.position + Vector2(0, item_rect.size.y));
instance_menu->set_size(Vector2(item_rect.size.x, 0));
if (EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(n))
instance_menu->set_item_checked(0, true);
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index a2bb3a0879..7f1e6023bf 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -790,19 +790,19 @@ void ScriptEditorDebugger::_performance_draw() {
Point2i p(i % cols, i / cols);
Rect2i r(p * s, s);
- r.pos += Point2(margin, margin);
+ r.position += Point2(margin, margin);
r.size -= Point2(margin, margin) * 2.0;
perf_draw->draw_style_box(graph_sb, r);
- r.pos += graph_sb->get_offset();
+ r.position += graph_sb->get_offset();
r.size -= graph_sb->get_minimum_size();
int pi = which[i];
Color c = Color(0.7, 0.9, 0.5);
c.set_hsv(Math::fmod(c.get_h() + pi * 0.7654, 1), c.get_s(), c.get_v());
c.a = 0.8;
- perf_draw->draw_string(graph_font, r.pos + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
+ perf_draw->draw_string(graph_font, r.position + Point2(0, graph_font->get_ascent()), perf_items[pi]->get_text(0), c, r.size.x);
c.a = 0.6;
- perf_draw->draw_string(graph_font, r.pos + Point2(graph_font->get_char_size('X').width, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
+ perf_draw->draw_string(graph_font, r.position + Point2(graph_font->get_char_size('X').width, graph_font->get_ascent() + graph_font->get_height()), perf_items[pi]->get_text(1), c, r.size.y);
float spacing = point_sep / float(cols);
float from = r.size.width;
@@ -819,7 +819,7 @@ void ScriptEditorDebugger::_performance_draw() {
c.a = 0.7;
if (E != perf_history.front())
- perf_draw->draw_line(r.pos + Point2(from, h), r.pos + Point2(from + spacing, prev), c, 2.0);
+ perf_draw->draw_line(r.position + Point2(from, h), r.position + Point2(from + spacing, prev), c, 2.0);
prev = h;
E = E->next();
from -= spacing;