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 | |
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')
32 files changed, 199 insertions, 223 deletions
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index b2d132b3da..2d038d11ad 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -150,7 +150,7 @@ void AbstractPolygon2DEditor::_action_add_polygon(const Variant &p_polygon) { void AbstractPolygon2DEditor::_action_remove_polygon(int p_idx) { - _action_set_polygon(p_idx, _get_polygon(p_idx), PoolVector<Vector2>()); + _action_set_polygon(p_idx, _get_polygon(p_idx), Vector<Vector2>()); } void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_polygon) { @@ -256,7 +256,7 @@ void AbstractPolygon2DEditor::_wip_close() { undo_redo->create_action(TTR("Create Polygon")); _action_add_polygon(wip); if (_has_uv()) { - undo_redo->add_do_method(_get_node(), "set_uv", PoolVector<Vector2>()); + undo_redo->add_do_method(_get_node(), "set_uv", Vector<Vector2>()); undo_redo->add_undo_method(_get_node(), "set_uv", _get_node()->get("uv")); } _commit_action(); @@ -584,7 +584,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl if (wip_active && wip_destructive && j != -1) continue; - PoolVector<Vector2> points; + Vector<Vector2> points; Vector2 offset; if (wip_active && j == edited_point.polygon) { @@ -703,7 +703,7 @@ void AbstractPolygon2DEditor::_bind_methods() { void AbstractPolygon2DEditor::remove_point(const Vertex &p_vertex) { - PoolVector<Vector2> vertices = _get_polygon(p_vertex.polygon); + Vector<Vector2> vertices = _get_polygon(p_vertex.polygon); if (vertices.size() > (_is_line() ? 2 : 3)) { @@ -744,7 +744,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_point(const for (int j = 0; j < n_polygons; j++) { - PoolVector<Vector2> points = _get_polygon(j); + Vector<Vector2> points = _get_polygon(j); const Vector2 offset = _get_offset(j); const int n_points = points.size(); @@ -777,7 +777,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c for (int j = 0; j < n_polygons; j++) { - PoolVector<Vector2> points = _get_polygon(j); + Vector<Vector2> points = _get_polygon(j); const Vector2 offset = _get_offset(j); const int n_points = points.size(); const int n_segments = n_points - (_is_line() ? 1 : 0); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index a479703527..3d47dd46db 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -166,9 +166,8 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const // Overlay and thumbnail need the same format for `blend_rect` to work. thumbnail->convert(Image::FORMAT_RGBA8); - thumbnail->lock(); + thumbnail->blend_rect(overlay, overlay->get_used_rect(), overlay_pos); - thumbnail->unlock(); Ref<ImageTexture> tex; tex.instance(); @@ -322,7 +321,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { } /////////////////////////////////////////////////////////////////////////////////// -void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { String error_text; @@ -710,12 +709,12 @@ void EditorAssetLibrary::_select_asset(int p_id) { _api_request("asset/" + itos(p_id), REQUESTING_ASSET); } -void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id) { +void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedByteArray &p_data, int p_queue_id) { Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { bool image_set = false; - PoolByteArray image_data = p_data; + PackedByteArray image_data = p_data; if (use_cache) { String cache_filename_base = EditorSettings::get_singleton()->get_cache_dir().plus_file("assetimage_" + image_queue[p_queue_id].image_url.md5_text()); @@ -723,12 +722,12 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt FileAccess *file = FileAccess::open(cache_filename_base + ".data", FileAccess::READ); if (file) { - PoolByteArray cached_data; + PackedByteArray cached_data; int len = file->get_32(); cached_data.resize(len); - PoolByteArray::Write w = cached_data.write(); - file->get_buffer(w.ptr(), len); + uint8_t *w = cached_data.ptrw(); + file->get_buffer(w, len); image_data = cached_data; file->close(); @@ -737,17 +736,17 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } int len = image_data.size(); - PoolByteArray::Read r = image_data.read(); + const uint8_t *r = image_data.ptr(); Ref<Image> image = Ref<Image>(memnew(Image)); uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; uint8_t jpg_signature[3] = { 255, 216, 255 }; - if (r.ptr()) { + if (r) { if ((memcmp(&r[0], &png_signature[0], 8) == 0) && Image::_png_mem_loader_func) { - image->copy_internals_from(Image::_png_mem_loader_func(r.ptr(), len)); + image->copy_internals_from(Image::_png_mem_loader_func(r, len)); } else if ((memcmp(&r[0], &jpg_signature[0], 3) == 0) && Image::_jpg_mem_loader_func) { - image->copy_internals_from(Image::_jpg_mem_loader_func(r.ptr(), len)); + image->copy_internals_from(Image::_jpg_mem_loader_func(r, len)); } } @@ -790,7 +789,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } } -void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data, int p_queue_id) { +void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data, int p_queue_id) { ERR_FAIL_COND(!image_queue.has(p_queue_id)); @@ -811,11 +810,11 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons } int len = p_data.size(); - PoolByteArray::Read r = p_data.read(); + const uint8_t *r = p_data.ptr(); file = FileAccess::open(cache_filename_base + ".data", FileAccess::WRITE); if (file) { file->store_32(len); - file->store_buffer(r.ptr(), len); + file->store_buffer(r, len); file->close(); memdelete(file); } @@ -899,7 +898,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag add_child(iq.request); - _image_update(true, false, PoolByteArray(), iq.queue_id); + _image_update(true, false, PackedByteArray(), iq.queue_id); _update_image_queue(); } @@ -1068,14 +1067,14 @@ void EditorAssetLibrary::_api_request(const String &p_request, RequestType p_req request->request(host + "/" + p_request + p_arguments); } -void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { +void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data) { String str; { int datalen = p_data.size(); - PoolByteArray::Read r = p_data.read(); - str.parse_utf8((const char *)r.ptr(), datalen); + const uint8_t *r = p_data.ptr(); + str.parse_utf8((const char *)r, datalen); } bool error_abort = true; diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index e13d8a6149..536a855d03 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -156,7 +156,7 @@ class EditorAssetLibraryItemDownload : public PanelContainer { void _close(); void _install(); void _make_request(); - void _http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); protected: void _notification(int p_what); @@ -250,8 +250,8 @@ class EditorAssetLibrary : public PanelContainer { int last_queue_id; Map<int, ImageQueue> image_queue; - void _image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id); - void _image_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data, int p_queue_id); + void _image_update(bool use_cache, bool final, const PackedByteArray &p_data, int p_queue_id); + void _image_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data, int p_queue_id); void _request_image(ObjectID p_for, String p_image_url, ImageType p_type, int p_image_index); void _update_image_queue(); @@ -286,8 +286,8 @@ class EditorAssetLibrary : public PanelContainer { void _rerun_search(int p_ignore); void _search_text_entered(const String &p_text = ""); void _api_request(const String &p_request, RequestType p_request_type, const String &p_arguments = ""); - void _http_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); - void _http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); + void _http_request_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); + void _http_download_completed(int p_status, int p_code, const PackedStringArray &headers, const PackedByteArray &p_data); void _repository_changed(int p_repository_id); void _support_toggled(int p_support); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index f7a3b50052..3ab7fdb39c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5987,7 +5987,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & if (default_type == "NinePatchRect") { editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size); } else if (default_type == "Polygon2D") { - PoolVector<Vector2> list; + Vector<Vector2> list; list.push_back(Vector2(0, 0)); list.push_back(Vector2(texture_size.width, 0)); list.push_back(Vector2(texture_size.width, texture_size.height)); diff --git a/editor/plugins/collision_polygon_editor_plugin.cpp b/editor/plugins/collision_polygon_editor_plugin.cpp index 3de67589ee..9aa9b6cda5 100644 --- a/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/editor/plugins/collision_polygon_editor_plugin.cpp @@ -470,11 +470,11 @@ void Polygon3DEditor::_polygon_draw() { Array a; a.resize(Mesh::ARRAY_MAX); - PoolVector<Vector3> va; + Vector<Vector3> va; { va.resize(poly.size()); - PoolVector<Vector3>::Write w = va.write(); + Vector3 *w = va.ptrw(); for (int i = 0; i < poly.size(); i++) { Vector2 p, p2; diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 655048c271..80f5e26d48 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -118,8 +118,8 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { int vpc = 0; { - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); for (int i = 0; i < s.width; i++) { for (int j = 0; j < s.height; j++) { @@ -198,9 +198,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); if (capture_colors) { - PoolColorArray pca; + PackedColorArray pca; pca.resize(vpc); - PoolColorArray::Write pcaw = pca.write(); + Color *pcaw = pca.ptrw(); for (int i = 0; i < vpc; i += 1) { Color color; color.r = valid_colors[i * 4 + 0] / 255.0f; @@ -214,9 +214,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { if (valid_normals.size()) { particles->set_emission_shape(CPUParticles2D::EMISSION_SHAPE_DIRECTED_POINTS); - PoolVector2Array norms; + PackedVector2Array norms; norms.resize(valid_normals.size()); - PoolVector2Array::Write normsw = norms.write(); + Vector2 *normsw = norms.ptrw(); for (int i = 0; i < valid_normals.size(); i += 1) { normsw[i] = valid_normals[i]; } @@ -226,9 +226,9 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { } { - PoolVector2Array points; + PackedVector2Array points; points.resize(valid_positions.size()); - PoolVector2Array::Write pointsw = points.write(); + Vector2 *pointsw = points.ptrw(); for (int i = 0; i < valid_positions.size(); i += 1) { pointsw[i] = valid_positions[i]; } diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp index 2074ba6b99..be3e9cd8e0 100644 --- a/editor/plugins/cpu_particles_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_editor_plugin.cpp @@ -80,8 +80,8 @@ void CPUParticlesEditor::edit(CPUParticles *p_particles) { void CPUParticlesEditor::_generate_emission_points() { /// hacer codigo aca - PoolVector<Vector3> points; - PoolVector<Vector3> normals; + Vector<Vector3> points; + Vector<Vector3> normals; if (!_generate(points, normals)) { return; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 0af983f780..62a3ff9b58 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -802,8 +802,6 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons im.create(thumbnail_size, thumbnail_size / 2, 0, Image::FORMAT_RGBA8); - im.lock(); - Color bg_color(0.1, 0.1, 0.1, 1.0); for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size / 2; j++) { @@ -844,8 +842,6 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons prev_y = y; } - im.unlock(); - Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); ptex->create_from_image(img_ref); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 6e8aef0aea..3c173ab783 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -47,8 +47,6 @@ void post_process_preview(Ref<Image> p_image) { if (p_image->get_format() != Image::FORMAT_RGBA8) p_image->convert(Image::FORMAT_RGBA8); - p_image->lock(); - const int w = p_image->get_width(); const int h = p_image->get_height(); @@ -70,8 +68,6 @@ void post_process_preview(Ref<Image> p_image) { } } } - - p_image->unlock(); } bool EditorTexturePreviewPlugin::handles(const String &p_type) const { @@ -207,19 +203,19 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size return Ref<Texture2D>(); } - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(bm->get_size().width * bm->get_size().height); { - PoolVector<uint8_t>::Write w = data.write(); + uint8_t *w = data.ptrw(); for (int i = 0; i < bm->get_size().width; i++) { for (int j = 0; j < bm->get_size().height; j++) { if (bm->get_bit(Point2i(i, j))) { - w[j * bm->get_size().width + i] = 255; + w[j * (int)bm->get_size().width + i] = 255; } else { - w[j * bm->get_size().width + i] = 0; + w[j * (int)bm->get_size().width + i] = 0; } } } @@ -396,10 +392,10 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() { int lons = 32; float radius = 1.0; - PoolVector<Vector3> vertices; - PoolVector<Vector3> normals; - PoolVector<Vector2> uvs; - PoolVector<float> tangents; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<Vector2> uvs; + Vector<float> tangents; Basis tt = Basis(Vector3(0, 1, 0), Math_PI * 0.5); for (int i = 1; i <= lats; i++) { @@ -522,8 +518,6 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"); - img->lock(); - if (bg_color.a == 0) bg_color = Color(0, 0, 0, 0); bg_color.a = MAX(bg_color.a, 0.2); // some background @@ -593,8 +587,6 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size col++; } - img->unlock(); - post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); @@ -617,14 +609,14 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const Ref<AudioStream> stream = p_from; ERR_FAIL_COND_V(stream.is_null(), Ref<Texture2D>()); - PoolVector<uint8_t> img; + Vector<uint8_t> img; int w = p_size.x; int h = p_size.y; img.resize(w * h * 3); - PoolVector<uint8_t>::Write imgdata = img.write(); - uint8_t *imgw = imgdata.ptr(); + uint8_t *imgdata = img.ptrw(); + uint8_t *imgw = imgdata; Ref<AudioStreamPlayback> playback = stream->instance_playback(); ERR_FAIL_COND_V(playback.is_null(), Ref<Texture2D>()); @@ -680,7 +672,6 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const } } - imgdata.release(); //post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index aaba6406c7..574646956e 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -327,24 +327,24 @@ void MeshInstanceEditor::_create_uv_lines(int p_layer) { continue; Array a = mesh->surface_get_arrays(i); - PoolVector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; + Vector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2]; if (uv.size() == 0) { err_dialog->set_text(TTR("Model has no UV in this layer")); err_dialog->popup_centered_minsize(); return; } - PoolVector<Vector2>::Read r = uv.read(); + const Vector2 *r = uv.ptr(); - PoolVector<int> indices = a[Mesh::ARRAY_INDEX]; - PoolVector<int>::Read ri; + Vector<int> indices = a[Mesh::ARRAY_INDEX]; + const int *ri; int ic; bool use_indices; if (indices.size()) { ic = indices.size(); - ri = indices.read(); + ri = indices.ptr(); use_indices = true; } else { ic = uv.size(); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index ddd27b5e97..4b7fd6399b 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -124,7 +124,7 @@ void MultiMeshEditor::_populate() { Transform geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform(); - PoolVector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); + Vector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID); if (geometry.size() == 0) { @@ -136,7 +136,7 @@ void MultiMeshEditor::_populate() { //make all faces local int gc = geometry.size(); - PoolVector<Face3>::Write w = geometry.write(); + Face3 *w = geometry.ptrw(); for (int i = 0; i < gc; i++) { for (int j = 0; j < 3; j++) { @@ -144,13 +144,11 @@ void MultiMeshEditor::_populate() { } } - w.release(); - - PoolVector<Face3> faces = geometry; + Vector<Face3> faces = geometry; int facecount = faces.size(); ERR_FAIL_COND_MSG(!facecount, "Parent has no solid faces to populate."); - PoolVector<Face3>::Read r = faces.read(); + const Face3 *r = faces.ptr(); float area_accum = 0; Map<float, int> triangle_area_map; diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 3a48673d8e..2e149a0f65 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -191,8 +191,8 @@ void Particles2DEditorPlugin::_generate_emission_mask() { int vpc = 0; { - PoolVector<uint8_t> data = img->get_data(); - PoolVector<uint8_t>::Read r = data.read(); + Vector<uint8_t> data = img->get_data(); + const uint8_t *r = data.ptr(); for (int i = 0; i < s.width; i++) { for (int j = 0; j < s.height; j++) { @@ -270,7 +270,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { ERR_FAIL_COND_MSG(valid_positions.size() == 0, "No pixels with transparency > 128 in image..."); - PoolVector<uint8_t> texdata; + Vector<uint8_t> texdata; int w = 2048; int h = (vpc / 2048) + 1; @@ -278,8 +278,8 @@ void Particles2DEditorPlugin::_generate_emission_mask() { texdata.resize(w * h * 2 * sizeof(float)); { - PoolVector<uint8_t>::Write tw = texdata.write(); - float *twf = (float *)tw.ptr(); + uint8_t *tw = texdata.ptrw(); + float *twf = (float *)tw; for (int i = 0; i < vpc; i++) { twf[i * 2 + 0] = valid_positions[i].x; @@ -299,11 +299,11 @@ void Particles2DEditorPlugin::_generate_emission_mask() { if (capture_colors) { - PoolVector<uint8_t> colordata; + Vector<uint8_t> colordata; colordata.resize(w * h * 4); //use RG texture { - PoolVector<uint8_t>::Write tw = colordata.write(); + uint8_t *tw = colordata.ptrw(); for (int i = 0; i < vpc * 4; i++) { tw[i] = valid_colors[i]; @@ -321,12 +321,12 @@ void Particles2DEditorPlugin::_generate_emission_mask() { if (valid_normals.size()) { pm->set_emission_shape(ParticlesMaterial::EMISSION_SHAPE_DIRECTED_POINTS); - PoolVector<uint8_t> normdata; + Vector<uint8_t> normdata; normdata.resize(w * h * 2 * sizeof(float)); //use RG texture { - PoolVector<uint8_t>::Write tw = normdata.write(); - float *twf = (float *)tw.ptr(); + uint8_t *tw = normdata.ptrw(); + float *twf = (float *)tw; for (int i = 0; i < vpc; i++) { twf[i * 2 + 0] = valid_normals[i].x; twf[i * 2 + 1] = valid_normals[i].y; diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index cb29e11b9d..940874846f 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "scene/3d/cpu_particles.h" #include "scene/resources/particles_material.h" -bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vector3> &normals) { +bool ParticlesEditorBase::_generate(Vector<Vector3> &points, Vector<Vector3> &normals) { bool use_normals = emission_fill->get_selected() == 1; @@ -93,7 +93,7 @@ bool ParticlesEditorBase::_generate(PoolVector<Vector3> &points, PoolVector<Vect return false; } - PoolVector<Face3>::Read r = geometry.read(); + const Face3 *r = geometry.ptr(); AABB aabb; @@ -191,7 +191,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { Transform geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform(); int gc = geometry.size(); - PoolVector<Face3>::Write w = geometry.write(); + Face3 *w = geometry.ptrw(); for (int i = 0; i < gc; i++) { for (int j = 0; j < 3; j++) { @@ -199,8 +199,6 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { } } - w.release(); - emission_dialog->popup_centered(Size2(300, 130)); } @@ -379,8 +377,8 @@ void ParticlesEditor::edit(Particles *p_particles) { void ParticlesEditor::_generate_emission_points() { /// hacer codigo aca - PoolVector<Vector3> points; - PoolVector<Vector3> normals; + Vector<Vector3> points; + Vector<Vector3> normals; if (!_generate(points, normals)) { return; @@ -391,14 +389,14 @@ void ParticlesEditor::_generate_emission_points() { int w = 2048; int h = (point_count / 2048) + 1; - PoolVector<uint8_t> point_img; + Vector<uint8_t> point_img; point_img.resize(w * h * 3 * sizeof(float)); { - PoolVector<uint8_t>::Write iw = point_img.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); - PoolVector<Vector3>::Read r = points.read(); - float *wf = (float *)iw.ptr(); + uint8_t *iw = point_img.ptrw(); + zeromem(iw, w * h * 3 * sizeof(float)); + const Vector3 *r = points.ptr(); + float *wf = (float *)iw; for (int i = 0; i < point_count; i++) { wf[i * 3 + 0] = r[i].x; wf[i * 3 + 1] = r[i].y; @@ -420,14 +418,14 @@ void ParticlesEditor::_generate_emission_points() { material->set_emission_point_count(point_count); material->set_emission_point_texture(tex); - PoolVector<uint8_t> point_img2; + Vector<uint8_t> point_img2; point_img2.resize(w * h * 3 * sizeof(float)); { - PoolVector<uint8_t>::Write iw = point_img2.write(); - zeromem(iw.ptr(), w * h * 3 * sizeof(float)); - PoolVector<Vector3>::Read r = normals.read(); - float *wf = (float *)iw.ptr(); + uint8_t *iw = point_img2.ptrw(); + zeromem(iw, w * h * 3 * sizeof(float)); + const Vector3 *r = normals.ptr(); + float *wf = (float *)iw; for (int i = 0; i < point_count; i++) { wf[i * 3 + 0] = r[i].x; wf[i * 3 + 1] = r[i].y; diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h index 4b20d00670..5419b7d3d5 100644 --- a/editor/plugins/particles_editor_plugin.h +++ b/editor/plugins/particles_editor_plugin.h @@ -53,9 +53,9 @@ protected: SpinBox *emission_amount; OptionButton *emission_fill; - PoolVector<Face3> geometry; + Vector<Face3> geometry; - bool _generate(PoolVector<Vector3> &points, PoolVector<Vector3> &normals); + bool _generate(Vector<Vector3> &points, Vector<Vector3> &normals); virtual void _generate_emission_points() = 0; void _node_selected(const NodePath &p_path); diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 92f21d8428..75c9776f0f 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -229,14 +229,14 @@ void PathSpatialGizmo::redraw() { if (c.is_null()) return; - PoolVector<Vector3> v3a = c->tessellate(); - //PoolVector<Vector3> v3a=c->get_baked_points(); + Vector<Vector3> v3a = c->tessellate(); + //Vector<Vector3> v3a=c->get_baked_points(); int v3s = v3a.size(); if (v3s == 0) return; Vector<Vector3> v3p; - PoolVector<Vector3>::Read r = v3a.read(); + const Vector3 *r = v3a.ptr(); // BUG: the following won't work when v3s, avoid drawing as a temporary workaround. for (int i = 0; i < v3s - 1; i++) { @@ -315,7 +315,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { //click into curve, break it down - PoolVector<Vector3> v3a = c->tessellate(); + Vector<Vector3> v3a = c->tessellate(); int idx = 0; int rc = v3a.size(); int closest_seg = -1; @@ -323,7 +323,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp float closest_d = 1e20; if (rc >= 2) { - PoolVector<Vector3>::Read r = v3a.read(); + const Vector3 *r = v3a.ptr(); if (p_camera->unproject_position(gt.xform(c->get_point_position(0))).distance_to(mbpos) < click_dist) return false; //nope, existing 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)); diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h index 1454a03325..2b00b50e5c 100644 --- a/editor/plugins/polygon_2d_editor_plugin.h +++ b/editor/plugins/polygon_2d_editor_plugin.h @@ -88,7 +88,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { Label *bone_paint_radius_label; bool bone_painting; int bone_painting_bone; - PoolVector<float> prev_weights; + Vector<float> prev_weights; Vector2 bone_paint_pos; AcceptDialog *grid_settings; @@ -97,10 +97,10 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { Vector2 uv_draw_ofs; float uv_draw_zoom; - PoolVector<Vector2> points_prev; - PoolVector<Vector2> uv_create_uv_prev; - PoolVector<Vector2> uv_create_poly_prev; - PoolVector<Color> uv_create_colors_prev; + Vector<Vector2> points_prev; + Vector<Vector2> uv_create_uv_prev; + Vector<Vector2> uv_create_poly_prev; + Vector<Color> uv_create_colors_prev; int uv_create_prev_internal_vertices; Array uv_create_bones_prev; Array polygons_prev; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 76312df20a..f12be18c21 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2309,7 +2309,7 @@ void ScriptEditor::_editor_stop() { } } -void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PoolStringArray &p_args) { +void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PackedStringArray &p_args) { ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); @@ -3099,7 +3099,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) { editor->make_bottom_panel_item_visible(find_in_files); } -void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) { +void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) { _test_script_times_on_disk(); _update_modified_scripts_for_external_editor(); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 4087b7cd55..ec84bcb461 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -107,7 +107,7 @@ public: virtual void tag_saved_version() = 0; virtual void reload(bool p_soft) {} virtual void get_breakpoints(List<int> *p_breakpoints) = 0; - virtual void add_callback(const String &p_function, PoolStringArray p_args) = 0; + virtual void add_callback(const String &p_function, PackedStringArray p_args) = 0; virtual void update_settings() = 0; virtual void set_debugger_active(bool p_active) = 0; virtual bool can_lose_focus_on_node_selection() { return true; } @@ -321,7 +321,7 @@ class ScriptEditor : public PanelContainer { int edit_pass; - void _add_callback(Object *p_obj, const String &p_function, const PoolStringArray &p_args); + void _add_callback(Object *p_obj, const String &p_function, const PackedStringArray &p_args); void _res_saved_callback(const Ref<Resource> &p_res); bool trim_trailing_whitespace_on_save; @@ -408,7 +408,7 @@ class ScriptEditor : public PanelContainer { void _on_replace_in_files_requested(String text); void _on_find_in_files_result_selected(String fpath, int line_number, int begin, int end); void _start_find_in_files(bool with_replace); - void _on_find_in_files_modified_files(PoolStringArray paths); + void _on_find_in_files_modified_files(PackedStringArray paths); static void _open_script_request(const String &p_path); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 778febaf8a..9f1e2f0353 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -306,13 +306,13 @@ void ScriptTextEditor::_set_theme_for_script() { text_edit->add_keyword_color("RID", basetype_color); text_edit->add_keyword_color("Dictionary", basetype_color); text_edit->add_keyword_color("Array", basetype_color); - text_edit->add_keyword_color("PoolByteArray", basetype_color); - text_edit->add_keyword_color("PoolIntArray", basetype_color); - text_edit->add_keyword_color("PoolRealArray", basetype_color); - text_edit->add_keyword_color("PoolStringArray", basetype_color); - text_edit->add_keyword_color("PoolVector2Array", basetype_color); - text_edit->add_keyword_color("PoolVector3Array", basetype_color); - text_edit->add_keyword_color("PoolColorArray", basetype_color); + text_edit->add_keyword_color("PackedByteArray", basetype_color); + text_edit->add_keyword_color("PackedIntArray", basetype_color); + text_edit->add_keyword_color("PackedRealArray", basetype_color); + text_edit->add_keyword_color("PackedStringArray", basetype_color); + text_edit->add_keyword_color("PackedVector2Array", basetype_color); + text_edit->add_keyword_color("PackedVector3Array", basetype_color); + text_edit->add_keyword_color("PackedColorArray", basetype_color); //colorize engine types List<StringName> types; @@ -424,7 +424,7 @@ void ScriptTextEditor::_notification(int p_what) { } } -void ScriptTextEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void ScriptTextEditor::add_callback(const String &p_function, PackedStringArray p_args) { String code = code_editor->get_text_edit()->get_text(); int pos = script->get_language()->find_function(p_function, code); @@ -1212,7 +1212,7 @@ void ScriptTextEditor::_edit_option(int p_op) { Expression expression; Vector<String> lines = code_editor->get_text_edit()->get_selection_text().split("\n"); - PoolStringArray results; + PackedStringArray results; for (int i = 0; i < lines.size(); i++) { String line = lines[i]; @@ -1221,17 +1221,17 @@ void ScriptTextEditor::_edit_option(int p_op) { if (expression.parse(line) == OK) { Variant result = expression.execute(Array(), Variant(), false); if (expression.get_error_text() == "") { - results.append(whitespace + result.get_construct_string()); + results.push_back(whitespace + result.get_construct_string()); } else { - results.append(line); + results.push_back(line); } } else { - results.append(line); + results.push_back(line); } } code_editor->get_text_edit()->begin_complex_operation(); //prevents creating a two-step undo - code_editor->get_text_edit()->insert_text_at_cursor(results.join("\n")); + code_editor->get_text_edit()->insert_text_at_cursor(String("\n").join(results)); code_editor->get_text_edit()->end_complex_operation(); } break; case SEARCH_FIND: { diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 359f0b0019..e23160d029 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -220,7 +220,7 @@ public: virtual void reload(bool p_soft); virtual void get_breakpoints(List<int> *p_breakpoints); - virtual void add_callback(const String &p_function, PoolStringArray p_args); + virtual void add_callback(const String &p_function, PackedStringArray p_args); virtual void update_settings(); virtual bool show_members_overview(); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index e916f6f028..88b4f011ee 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -5181,8 +5181,8 @@ void SpatialEditor::_update_gizmos_menu_theme() { void SpatialEditor::_init_grid() { - PoolVector<Color> grid_colors[3]; - PoolVector<Vector3> grid_points[3]; + Vector<Color> grid_colors[3]; + Vector<Vector3> grid_points[3]; Color primary_grid_color = EditorSettings::get_singleton()->get("editors/3d/primary_grid_color"); Color secondary_grid_color = EditorSettings::get_singleton()->get("editors/3d/secondary_grid_color"); diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 2736bbfd3a..e69440b5bb 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -358,13 +358,13 @@ void SpriteEditor::_convert_to_polygon_2d_node() { for (int i = 0; i < computed_outline_lines.size(); i++) total_point_count += computed_outline_lines[i].size(); - PoolVector2Array polygon; + PackedVector2Array polygon; polygon.resize(total_point_count); - PoolVector2Array::Write polygon_write = polygon.write(); + Vector2 *polygon_write = polygon.ptrw(); - PoolVector2Array uvs; + PackedVector2Array uvs; uvs.resize(total_point_count); - PoolVector2Array::Write uvs_write = uvs.write(); + Vector2 *uvs_write = uvs.ptrw(); int current_point_index = 0; @@ -376,9 +376,9 @@ void SpriteEditor::_convert_to_polygon_2d_node() { Vector<Vector2> outline = computed_outline_lines[i]; Vector<Vector2> uv_outline = outline_lines[i]; - PoolIntArray pia; + PackedIntArray pia; pia.resize(outline.size()); - PoolIntArray::Write pia_write = pia.write(); + int *pia_write = pia.ptrw(); for (int pi = 0; pi < outline.size(); pi++) { polygon_write[current_point_index] = outline[pi]; @@ -442,9 +442,9 @@ void SpriteEditor::_create_light_occluder_2d_node() { Ref<OccluderPolygon2D> polygon; polygon.instance(); - PoolVector2Array a; + PackedVector2Array a; a.resize(outline.size()); - PoolVector2Array::Write aw = a.write(); + Vector2 *aw = a.ptrw(); for (int io = 0; io < outline.size(); io++) { aw[io] = outline[io]; } diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 2d756af213..9e8ce7ac4a 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -245,7 +245,7 @@ void SpriteFramesEditor::_notification(int p_what) { } } -void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, int p_at_pos) { +void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_at_pos) { ERR_FAIL_COND(!frames->has_animation(edited_anim)); @@ -852,7 +852,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da if (String(d["type"]) == "files") { - PoolVector<String> files = d["files"]; + Vector<String> files = d["files"]; _file_load_request(files, at_pos); } diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h index aa683605ed..1fa93b5c47 100644 --- a/editor/plugins/sprite_frames_editor_plugin.h +++ b/editor/plugins/sprite_frames_editor_plugin.h @@ -86,7 +86,7 @@ class SpriteFramesEditor : public HSplitContainer { void _load_pressed(); void _load_scene_pressed(); - void _file_load_request(const PoolVector<String> &p_path, int p_at_pos = -1); + void _file_load_request(const Vector<String> &p_path, int p_at_pos = -1); void _copy_pressed(); void _paste_pressed(); void _empty_pressed(); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 69f1bcfa2e..357af5ecd8 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -185,7 +185,7 @@ void TextEditor::set_edited_resource(const RES &p_res) { code_editor->update_line_and_column(); } -void TextEditor::add_callback(const String &p_function, PoolStringArray p_args) { +void TextEditor::add_callback(const String &p_function, PackedStringArray p_args) { } void TextEditor::set_debugger_active(bool p_active) { diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index c976cd87f1..c80052e7ba 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -147,7 +147,7 @@ public: virtual bool can_lose_focus_on_node_selection() { return true; } virtual void set_debugger_active(bool p_active); virtual void set_tooltip_request_func(String p_method, Object *p_obj); - virtual void add_callback(const String &p_function, PoolStringArray p_args); + virtual void add_callback(const String &p_function, PackedStringArray p_args); virtual Control *get_edit_menu(); virtual void clear_edit_menu(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 425a759dac..145263a5ab 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -598,7 +598,7 @@ void TileMapEditor::_pick_tile(const Point2 &p_pos) { CanvasItemEditor::get_singleton()->update_viewport(); } -PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { +Vector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase, bool preview) { int prev_id = node->get_cell(p_start.x, p_start.y); Vector<int> ids; @@ -607,14 +607,14 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era ids = get_selected_tiles(); if (ids.size() == 0 || ids[0] == TileMap::INVALID_CELL) - return PoolVector<Vector2>(); + return Vector<Vector2>(); } else if (prev_id == TileMap::INVALID_CELL) { - return PoolVector<Vector2>(); + return Vector<Vector2>(); } if (ids.size() == 1 && ids[0] == prev_id) { // Same ID, nothing to change - return PoolVector<Vector2>(); + return Vector<Vector2>(); } Rect2i r = node->get_used_rect(); @@ -640,14 +640,14 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era if (invalidate_cache) { for (int i = 0; i < area; ++i) bucket_cache_visited[i] = false; - bucket_cache = PoolVector<Vector2>(); + bucket_cache = Vector<Vector2>(); bucket_cache_tile = prev_id; bucket_cache_rect = r; bucket_queue.clear(); } } - PoolVector<Vector2> points; + Vector<Vector2> points; Vector<Vector2> non_preview_cache; int count = 0; int limit = 0; @@ -698,10 +698,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era return preview ? bucket_cache : points; } -void TileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op) { +void TileMapEditor::_fill_points(const Vector<Vector2> &p_points, const Dictionary &p_op) { int len = p_points.size(); - PoolVector<Vector2>::Read pr = p_points.read(); + const Vector2 *pr = p_points.ptr(); Vector<int> ids = p_op["id"]; bool xf = p_op["flip_h"]; @@ -716,10 +716,10 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> &p_points, const Dict node->update_dirty_bitmask(); } -void TileMapEditor::_erase_points(const PoolVector<Vector2> &p_points) { +void TileMapEditor::_erase_points(const Vector<Vector2> &p_points) { int len = p_points.size(); - PoolVector<Vector2>::Read pr = p_points.read(); + const Vector2 *pr = p_points.ptr(); for (int i = 0; i < len; i++) { @@ -882,8 +882,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Point2i &p_autotile_coord, const Transform2D &p_xform) { - PoolVector<Vector2> points = _bucket_fill(p_point, false, true); - PoolVector<Vector2>::Read pr = points.read(); + Vector<Vector2> points = _bucket_fill(p_point, false, true); + const Vector2 *pr = points.ptr(); int len = points.size(); for (int i = 0; i < len; ++i) { @@ -1109,7 +1109,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { } else if (tool == TOOL_BUCKET) { - PoolVector<Vector2> points = _bucket_fill(over_tile); + Vector<Vector2> points = _bucket_fill(over_tile); if (points.size() == 0) return false; @@ -1216,7 +1216,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) { pop["flip_v"] = node->is_cell_y_flipped(over_tile.x, over_tile.y); pop["transpose"] = node->is_cell_transposed(over_tile.x, over_tile.y); - PoolVector<Vector2> points = _bucket_fill(over_tile, true); + Vector<Vector2> points = _bucket_fill(over_tile, true); if (points.size() == 0) return false; diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 927f0887bb..74969d3e64 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -123,7 +123,7 @@ class TileMapEditor : public VBoxContainer { bool *bucket_cache_visited; Rect2i bucket_cache_rect; int bucket_cache_tile; - PoolVector<Vector2> bucket_cache; + Vector<Vector2> bucket_cache; List<Point2i> bucket_queue; struct CellOp { @@ -164,10 +164,10 @@ class TileMapEditor : public VBoxContainer { void _pick_tile(const Point2 &p_pos); - PoolVector<Vector2> _bucket_fill(const Point2i &p_start, bool erase = false, bool preview = false); + Vector<Vector2> _bucket_fill(const Point2i &p_start, bool erase = false, bool preview = false); - void _fill_points(const PoolVector<Vector2> &p_points, const Dictionary &p_op); - void _erase_points(const PoolVector<Vector2> &p_points); + void _fill_points(const Vector<Vector2> &p_points, const Dictionary &p_op); + void _erase_points(const Vector<Vector2> &p_points); void _select(const Point2i &p_from, const Point2i &p_to); void _erase_selection(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index ce865510b4..4fea504f7d 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -251,7 +251,7 @@ void TileSetEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, C if (String(d["type"]) == "files") { - PoolVector<String> files = d["files"]; + Vector<String> files = d["files"]; _on_textures_added(files); } @@ -750,7 +750,7 @@ void TileSetEditor::_on_texture_list_selected(int p_index) { workspace->update(); } -void TileSetEditor::_on_textures_added(const PoolStringArray &p_paths) { +void TileSetEditor::_on_textures_added(const PackedStringArray &p_paths) { int invalid_count = 0; for (int i = 0; i < p_paths.size(); i++) { Ref<Texture2D> t = Ref<Texture2D>(ResourceLoader::load(p_paths[i])); @@ -1618,16 +1618,14 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { if (dragging_point >= 0) { dragging_point = -1; - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; } - w.release(); - undo_redo->create_action(TTR("Edit Occlusion Polygon")); undo_redo->add_do_method(edited_occlusion_shape.ptr(), "set_polygon", polygon); undo_redo->add_undo_method(edited_occlusion_shape.ptr(), "set_polygon", edited_occlusion_shape->get_polygon()); @@ -1639,18 +1637,16 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { if (dragging_point >= 0) { dragging_point = -1; - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; Vector<int> indices; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; indices.push_back(i); } - w.release(); - undo_redo->create_action(TTR("Edit Navigation Polygon")); undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon); undo_redo->add_undo_method(edited_navigation_shape.ptr(), "set_vertices", edited_navigation_shape->get_vertices()); @@ -1983,7 +1979,7 @@ void TileSetEditor::_set_edited_shape_points(const Vector<Vector2> &points) { undo_redo->add_do_method(convex.ptr(), "set_points", points); undo_redo->add_undo_method(convex.ptr(), "set_points", _get_edited_shape_points()); } else if (concave.is_valid()) { - PoolVector2Array segments; + PackedVector2Array segments; for (int i = 0; i < points.size() - 1; i++) { segments.push_back(points[i]); segments.push_back(points[i + 1]); @@ -2782,7 +2778,7 @@ void TileSetEditor::draw_polygon_shapes() { colors.push_back(c_bg); } } else { - PoolVector<Vector2> vertices = shape->get_vertices(); + Vector<Vector2> vertices = shape->get_vertices(); for (int j = 0; j < shape->get_polygon(0).size(); j++) { polygon.push_back(vertices[shape->get_polygon(0)[j]] + anchor); colors.push_back(c_bg); @@ -2830,7 +2826,7 @@ void TileSetEditor::draw_polygon_shapes() { colors.push_back(c_bg); } } else { - PoolVector<Vector2> vertices = shape->get_vertices(); + Vector<Vector2> vertices = shape->get_vertices(); for (int j = 0; j < shape->get_polygon(0).size(); j++) { polygon.push_back(vertices[shape->get_polygon(0)[j]] + anchor); colors.push_back(c_bg); @@ -2917,15 +2913,14 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { } else if (edit_mode == EDITMODE_OCCLUSION) { Ref<OccluderPolygon2D> shape = memnew(OccluderPolygon2D); - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; } - w.release(); shape->set_polygon(polygon); undo_redo->create_action(TTR("Create Occlusion Polygon")); @@ -2943,17 +2938,16 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { } else if (edit_mode == EDITMODE_NAVIGATION) { Ref<NavigationPolygon> shape = memnew(NavigationPolygon); - PoolVector<Vector2> polygon; + Vector<Vector2> polygon; Vector<int> indices; polygon.resize(current_shape.size()); - PoolVector<Vector2>::Write w = polygon.write(); + Vector2 *w = polygon.ptrw(); for (int i = 0; i < current_shape.size(); i++) { w[i] = current_shape[i] - shape_anchor; indices.push_back(i); } - w.release(); shape->set_vertices(polygon); shape->add_polygon(indices); @@ -2975,7 +2969,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { void TileSetEditor::select_coord(const Vector2 &coord) { _update_tile_data(); - current_shape = PoolVector2Array(); + current_shape = PackedVector2Array(); if (get_current_tile() == -1) return; Rect2 current_tile_region = tileset->tile_get_region(get_current_tile()); @@ -3006,7 +3000,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) { current_shape.resize(0); if (edited_navigation_shape.is_valid()) { if (edited_navigation_shape->get_polygon_count() > 0) { - PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); + Vector<Vector2> vertices = edited_navigation_shape->get_vertices(); for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + current_tile_region.position); } @@ -3055,7 +3049,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) { current_shape.resize(0); if (edited_navigation_shape.is_valid()) { if (edited_navigation_shape->get_polygon_count() > 0) { - PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices(); + Vector<Vector2> vertices = edited_navigation_shape->get_vertices(); for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) { current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor); } diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 26340824a0..7b49e2ece2 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -123,7 +123,7 @@ class TileSetEditor : public HSplitContainer { Rect2 edited_region; bool draw_edited_region; Vector2 edited_shape_coord; - PoolVector2Array current_shape; + PackedVector2Array current_shape; Map<Vector2i, SubtileData> current_tile_data; Map<Vector2, uint32_t> bitmask_map_copy; @@ -178,7 +178,7 @@ class TileSetEditor : public HSplitContainer { Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - void _file_load_request(const PoolVector<String> &p_path, int p_at_pos = -1); + void _file_load_request(const Vector<String> &p_path, int p_at_pos = -1); protected: static void _bind_methods(); @@ -195,7 +195,7 @@ private: void _on_tileset_toolbar_button_pressed(int p_index); void _on_tileset_toolbar_confirm(); void _on_texture_list_selected(int p_index); - void _on_textures_added(const PoolStringArray &p_paths); + void _on_textures_added(const PackedStringArray &p_paths); void _on_edit_mode_changed(int p_edit_mode); void _on_workspace_mode_changed(int p_workspace_mode); void _on_workspace_overlay_draw(); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index ecc140d7d2..6c8c1b44dc 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2164,10 +2164,10 @@ void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da saved_node_pos_dirty = true; _add_node(idx, add_options[idx].sub_func); } else if (d.has("files")) { - if (d["files"].get_type() == Variant::POOL_STRING_ARRAY) { + if (d["files"].get_type() == Variant::PACKED_STRING_ARRAY) { int j = 0; - PoolStringArray arr = d["files"]; + PackedStringArray arr = d["files"]; for (int i = 0; i < arr.size(); i++) { String type = ResourceLoader::get_resource_type(arr[i]); |