diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-17 18:06:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-18 10:10:36 +0100 |
commit | 3205a92ad872f918c8322cdcd1434c231a1fd251 (patch) | |
tree | db44242ca27432eb8ea849679752d0835d2ae41a /editor/plugins/polygon_2d_editor_plugin.cpp | |
parent | fb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff) |
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
Diffstat (limited to 'editor/plugins/polygon_2d_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 14e22625d9..8b0adbafa2 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -125,12 +125,12 @@ void Polygon2DEditor::_sync_bones() { } else { for (int i = 0; i < skeleton->get_bone_count(); i++) { NodePath path = skeleton->get_path_to(skeleton->get_bone(i)); - PoolVector<float> weights; + Vector<float> weights; int wc = node->get_polygon().size(); for (int j = 0; j < prev_bones.size(); j += 2) { NodePath pvp = prev_bones[j]; - PoolVector<float> pv = prev_bones[j + 1]; + Vector<float> pv = prev_bones[j + 1]; if (pvp == path && pv.size() == wc) { weights = pv; } @@ -138,7 +138,7 @@ void Polygon2DEditor::_sync_bones() { if (weights.size() == 0) { //create them weights.resize(node->get_polygon().size()); - PoolVector<float>::Write w = weights.write(); + float *w = weights.ptrw(); for (int j = 0; j < wc; j++) { w[j] = 0.0; } @@ -293,8 +293,8 @@ void Polygon2DEditor::_menu_option(int p_option) { return; } - PoolVector<Vector2> points = node->get_polygon(); - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> points = node->get_polygon(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() != points.size()) { undo_redo->create_action(TTR("Create UV Map")); undo_redo->add_do_method(node, "set_uv", points); @@ -312,10 +312,10 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_POLYGON_TO_UV: { - PoolVector<Vector2> points = node->get_polygon(); + Vector<Vector2> points = node->get_polygon(); if (points.size() == 0) break; - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> uvs = node->get_uv(); undo_redo->create_action(TTR("Create UV Map")); undo_redo->add_do_method(node, "set_uv", points); undo_redo->add_undo_method(node, "set_uv", uvs); @@ -325,8 +325,8 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_TO_POLYGON: { - PoolVector<Vector2> points = node->get_polygon(); - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> points = node->get_polygon(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() == 0) break; @@ -339,11 +339,11 @@ void Polygon2DEditor::_menu_option(int p_option) { } break; case UVEDIT_UV_CLEAR: { - PoolVector<Vector2> uvs = node->get_uv(); + Vector<Vector2> uvs = node->get_uv(); if (uvs.size() == 0) break; undo_redo->create_action(TTR("Create UV Map")); - undo_redo->add_do_method(node, "set_uv", PoolVector<Vector2>()); + undo_redo->add_do_method(node, "set_uv", Vector<Vector2>()); undo_redo->add_undo_method(node, "set_uv", uvs); undo_redo->add_do_method(uv_edit_draw, "update"); undo_redo->add_undo_method(uv_edit_draw, "update"); @@ -567,7 +567,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { undo_redo->add_do_method(node, "set_vertex_colors", uv_create_colors_prev); undo_redo->add_undo_method(node, "set_vertex_colors", node->get_vertex_colors()); for (int i = 0; i < node->get_bone_count(); i++) { - PoolVector<float> bonew = node->get_bone_weights(i); + Vector<float> bonew = node->get_bone_weights(i); bonew.push_back(0); undo_redo->add_do_method(node, "set_bone_weights", i, bonew); undo_redo->add_undo_method(node, "set_bone_weights", i, node->get_bone_weights(i)); @@ -622,7 +622,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { undo_redo->add_do_method(node, "set_vertex_colors", uv_create_colors_prev); undo_redo->add_undo_method(node, "set_vertex_colors", node->get_vertex_colors()); for (int i = 0; i < node->get_bone_count(); i++) { - PoolVector<float> bonew = node->get_bone_weights(i); + Vector<float> bonew = node->get_bone_weights(i); bonew.remove(closest); undo_redo->add_do_method(node, "set_bone_weights", i, bonew); undo_redo->add_undo_method(node, "set_bone_weights", i, node->get_bone_weights(i)); @@ -712,7 +712,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { int erase_index = -1; for (int i = polygons.size() - 1; i >= 0; i--) { - PoolVector<int> points = polygons[i]; + Vector<int> points = polygons[i]; Vector<Vector2> polys; polys.resize(points.size()); for (int j = 0; j < polys.size(); j++) { @@ -832,7 +832,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } break; case UV_MODE_EDIT_POINT: { - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; uv_new.set(point_drag_index, uv_new[point_drag_index] + drag); if (uv_edit_mode[0]->is_pressed()) { //edit uv @@ -843,7 +843,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } break; case UV_MODE_MOVE: { - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) uv_new.set(i, uv_new[i] + drag); @@ -856,7 +856,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { case UV_MODE_ROTATE: { Vector2 center; - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) center += points_prev[i]; @@ -879,7 +879,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { case UV_MODE_SCALE: { Vector2 center; - PoolVector<Vector2> uv_new = points_prev; + Vector<Vector2> uv_new = points_prev; for (int i = 0; i < uv_new.size(); i++) center += points_prev[i]; @@ -914,7 +914,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } if (bone_painting) { - PoolVector<float> painted_weights = node->get_bone_weights(bone_painting_bone); + Vector<float> painted_weights = node->get_bone_weights(bone_painting_bone); { int pc = painted_weights.size(); @@ -925,9 +925,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { amount = -amount; } - PoolVector<float>::Write w = painted_weights.write(); - PoolVector<float>::Read r = prev_weights.read(); - PoolVector<Vector2>::Read rv = points_prev.read(); + float *w = painted_weights.ptrw(); + const float *r = prev_weights.ptr(); + const Vector2 *rv = points_prev.ptr(); for (int i = 0; i < pc; i++) { if (mtx.xform(rv[i]).distance_to(bone_paint_pos) < radius) { @@ -1024,14 +1024,14 @@ void Polygon2DEditor::_uv_draw() { Array polygons = node->get_polygons(); - PoolVector<Vector2> uvs; + Vector<Vector2> uvs; if (uv_edit_mode[0]->is_pressed()) { //edit uv uvs = node->get_uv(); } else { //edit polygon uvs = node->get_polygon(); } - PoolVector<float>::Read weight_r; + const float *weight_r; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1045,7 +1045,7 @@ void Polygon2DEditor::_uv_draw() { if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) { - weight_r = node->get_bone_weights(bone_selected).read(); + weight_r = node->get_bone_weights(bone_selected).ptr(); } } @@ -1094,7 +1094,7 @@ void Polygon2DEditor::_uv_draw() { for (int i = 0; i < polygons.size(); i++) { - PoolVector<int> points = polygons[i]; + Vector<int> points = polygons[i]; Vector<Vector2> polypoints; for (int j = 0; j < points.size(); j++) { int next = (j + 1) % points.size(); @@ -1116,7 +1116,7 @@ void Polygon2DEditor::_uv_draw() { for (int i = 0; i < uvs.size(); i++) { - if (weight_r.ptr()) { + if (weight_r) { Vector2 draw_pos = mtx.xform(uvs[i]); float weight = weight_r[i]; uv_edit_draw->draw_rect(Rect2(draw_pos - Vector2(2, 2) * EDSCALE, Vector2(5, 5) * EDSCALE), Color(weight, weight, weight, 1.0), Math::round(EDSCALE)); |