Added release function to PoolVector::Access.

For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
This commit is contained in:
Ibrahn Sahir 2019-07-05 18:08:43 +01:00
parent 0b6b49a897
commit 4e4697b1c4
41 changed files with 102 additions and 114 deletions

View file

@ -1932,13 +1932,15 @@ PoolVector<uint8_t> _File::get_buffer(int p_length) const {
ERR_FAIL_COND_V(p_length < 0, data);
if (p_length == 0)
return data;
Error err = data.resize(p_length);
ERR_FAIL_COND_V(err != OK, data);
PoolVector<uint8_t>::Write w = data.write();
int len = f->get_buffer(&w[0], p_length);
ERR_FAIL_COND_V(len < 0, PoolVector<uint8_t>());
w = PoolVector<uint8_t>::Write();
w.release();
if (len < p_length)
data.resize(p_length);
@ -2113,11 +2115,11 @@ void _File::store_var(const Variant &p_var, bool p_full_objects) {
PoolVector<uint8_t> buff;
buff.resize(len);
PoolVector<uint8_t>::Write w = buff.write();
PoolVector<uint8_t>::Write w = buff.write();
err = encode_variant(p_var, &w[0], len, p_full_objects);
ERR_FAIL_COND(err != OK);
w = PoolVector<uint8_t>::Write();
w.release();
store_32(len);
store_buffer(buff);

View file

@ -495,8 +495,8 @@ void Image::convert(Format p_new_format) {
case FORMAT_RGBA8 | (FORMAT_RGB8 << 8): _convert<3, true, 3, false, false, false>(width, height, rptr, wptr); break;
}
r = PoolVector<uint8_t>::Read();
w = PoolVector<uint8_t>::Write();
r.release();
w.release();
bool gen_mipmaps = mipmaps;
@ -1091,8 +1091,8 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
} break;
}
r = PoolVector<uint8_t>::Read();
w = PoolVector<uint8_t>::Write();
r.release();
w.release();
if (interpolate_mipmaps) {
dst._copy_internals_from(dst2);
@ -2394,7 +2394,7 @@ void Image::lock() {
void Image::unlock() {
write_lock = PoolVector<uint8_t>::Write();
write_lock.release();
}
Color Image::get_pixelv(const Point2 &p_src) const {

View file

@ -558,8 +558,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
w[i] = buf[i];
}
w = PoolVector<uint8_t>::Write();
}
r_variant = data;
@ -590,8 +588,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
w[i] = decode_uint32(&buf[i * 4]);
}
w = PoolVector<int>::Write();
}
r_variant = Variant(data);
if (r_len) {
@ -618,8 +614,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
w[i] = decode_float(&buf[i * 4]);
}
w = PoolVector<float>::Write();
}
r_variant = data;

View file

@ -410,7 +410,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
PoolVector<uint8_t>::Write w = array.write();
f->get_buffer(w.ptr(), len);
_advance_padding(len);
w = PoolVector<uint8_t>::Write();
w.release();
r_v = array;
} break;
@ -432,7 +432,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
}
#endif
w = PoolVector<int>::Write();
w.release();
r_v = array;
} break;
case VARIANT_REAL_ARRAY: {
@ -454,7 +454,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
#endif
w = PoolVector<real_t>::Write();
w.release();
r_v = array;
} break;
case VARIANT_STRING_ARRAY: {
@ -465,7 +465,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
PoolVector<String>::Write w = array.write();
for (uint32_t i = 0; i < len; i++)
w[i] = get_unicode_string();
w = PoolVector<String>::Write();
w.release();
r_v = array;
} break;
@ -493,7 +493,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
ERR_EXPLAIN("Vector2 size is NOT 8!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
w = PoolVector<Vector2>::Write();
w.release();
r_v = array;
} break;
@ -521,7 +521,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
ERR_EXPLAIN("Vector3 size is NOT 12!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
w = PoolVector<Vector3>::Write();
w.release();
r_v = array;
} break;
@ -549,7 +549,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
ERR_EXPLAIN("Color size is NOT 16!");
ERR_FAIL_V(ERR_UNAVAILABLE);
}
w = PoolVector<Color>::Write();
w.release();
r_v = array;
} break;
#ifndef DISABLE_DEPRECATED
@ -584,7 +584,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
PoolVector<uint8_t>::Write w = imgdata.write();
f->get_buffer(w.ptr(), datalen);
_advance_padding(datalen);
w = PoolVector<uint8_t>::Write();
w.release();
Ref<Image> image;
image.instance();
@ -597,7 +597,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
data.resize(f->get_32());
PoolVector<uint8_t>::Write w = data.write();
f->get_buffer(w.ptr(), data.size());
w = PoolVector<uint8_t>::Write();
w.release();
Ref<Image> image;

View file

@ -79,7 +79,7 @@ Array StreamPeer::_get_data(int p_bytes) {
PoolVector<uint8_t>::Write w = data.write();
Error err = get_data(&w[0], p_bytes);
w = PoolVector<uint8_t>::Write();
w.release();
ret.push_back(err);
ret.push_back(data);
return ret;
@ -101,7 +101,7 @@ Array StreamPeer::_get_partial_data(int p_bytes) {
PoolVector<uint8_t>::Write w = data.write();
int received;
Error err = get_partial_data(&w[0], p_bytes, received);
w = PoolVector<uint8_t>::Write();
w.release();
if (err != OK) {
data.resize(0);

View file

@ -182,7 +182,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
int max_alloc = fc;
_create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc);
bw = PoolVector<BVH>::Write(); //clearup
bw.release(); //clearup
bvh.resize(max_alloc); //resize back
valid = true;
@ -751,7 +751,7 @@ PoolVector<Face3> TriangleMesh::get_faces() const {
}
}
w = PoolVector<Face3>::Write();
w.release();
return faces;
}

View file

@ -301,6 +301,10 @@ public:
virtual ~Access() {
_unref();
}
void release() {
_unref();
}
};
class Read : public Access {

View file

@ -2418,9 +2418,6 @@ Variant::Variant(const PoolVector<Face3> &p_face_array) {
for (int j = 0; j < 3; j++)
w[i * 3 + j] = r[i].vertex[j];
}
r = PoolVector<Face3>::Read();
w = PoolVector<Vector3>::Write();
}
type = NIL;

View file

@ -319,7 +319,7 @@ struct _VariantCall {
retval.resize(len);
PoolByteArray::Write w = retval.write();
copymem(w.ptr(), charstr.ptr(), len);
w = PoolVector<uint8_t>::Write();
w.release();
r_ret = retval;
}
@ -334,7 +334,7 @@ struct _VariantCall {
retval.resize(len);
PoolByteArray::Write w = retval.write();
copymem(w.ptr(), charstr.ptr(), len);
w = PoolVector<uint8_t>::Write();
w.release();
r_ret = retval;
}

View file

@ -807,7 +807,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
}
}
wb = PoolVector<uint8_t>::Write();
wb.release();
data.resize(data_size);
@ -871,7 +871,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &temp_framebuffer);
wb = PoolVector<uint8_t>::Write();
wb.release();
data.resize(data_size);
@ -2155,8 +2155,8 @@ static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array,
dst_offset += dst_size[i];
}
r = PoolVector<uint8_t>::Read();
w = PoolVector<uint8_t>::Write();
r.release();
w.release();
return ret;
}

View file

@ -1459,8 +1459,8 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo
#else
PoolVector<RasterizerGLES3Particle> particle_vector;
particle_vector.resize(particles->amount);
PoolVector<RasterizerGLES3Particle>::Write w = particle_vector.write();
particle_array = w.ptr();
PoolVector<RasterizerGLES3Particle>::Write particle_writer = particle_vector.write();
particle_array = particle_writer.ptr();
glGetBufferSubData(GL_ARRAY_BUFFER, 0, particles->amount * sizeof(RasterizerGLES3Particle), particle_array);
#endif
@ -1477,7 +1477,7 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo
#ifndef __EMSCRIPTEN__
glUnmapBuffer(GL_ARRAY_BUFFER);
#else
w = PoolVector<RasterizerGLES3Particle>::Write();
particle_writer.release();
particle_array = NULL;
{
PoolVector<RasterizerGLES3Particle>::Read r = particle_vector.read();

View file

@ -1173,7 +1173,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
glDeleteFramebuffers(1, &tmp_fbo);
}
wb = PoolVector<uint8_t>::Write();
wb.release();
data.resize(data_size);
@ -1248,7 +1248,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
img_format = real_format;
}
wb = PoolVector<uint8_t>::Write();
wb.release();
data.resize(data_size);
@ -1316,7 +1316,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &temp_framebuffer);
wb = PoolVector<uint8_t>::Write();
wb.release();
data.resize(data_size);
@ -6337,7 +6337,7 @@ AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) {
}
#if defined(GLES_OVER_GL) || defined(__EMSCRIPTEN__)
r = PoolVector<uint8_t>::Read();
r.release();
vector = PoolVector<uint8_t>();
#else
glUnmapBuffer(GL_ARRAY_BUFFER);

View file

@ -340,7 +340,7 @@ void EditorProfiler::_update_plot() {
}
}
wr = PoolVector<uint8_t>::Write();
wr.release();
Ref<Image> img;
img.instance();

View file

@ -676,7 +676,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S
}
}
imgdata = PoolVector<uint8_t>::Write();
imgdata.release();
//post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));

View file

@ -144,7 +144,7 @@ void MultiMeshEditor::_populate() {
}
}
w = PoolVector<Face3>::Write();
w.release();
PoolVector<Face3> faces = geometry;
ERR_EXPLAIN(TTR("Parent has no solid faces to populate."));

View file

@ -197,7 +197,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) {
}
}
w = PoolVector<Face3>::Write();
w.release();
emission_dialog->popup_centered(Size2(300, 130));
}

View file

@ -1491,7 +1491,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
w[i] = current_shape[i] - shape_anchor;
}
w = PoolVector<Vector2>::Write();
w.release();
undo_redo->create_action(TTR("Edit Occlusion Polygon"));
undo_redo->add_do_method(edited_occlusion_shape.ptr(), "set_polygon", polygon);
@ -1514,7 +1514,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
indices.push_back(i);
}
w = PoolVector<Vector2>::Write();
w.release();
undo_redo->create_action(TTR("Edit Navigation Polygon"));
undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon);
@ -2785,7 +2785,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) {
w[i] = current_shape[i] - shape_anchor;
}
w = PoolVector<Vector2>::Write();
w.release();
shape->set_polygon(polygon);
undo_redo->create_action(TTR("Create Occlusion Polygon"));
@ -2813,7 +2813,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) {
indices.push_back(i);
}
w = PoolVector<Vector2>::Write();
w.release();
shape->set_vertices(polygon);
shape->add_polygon(indices);

View file

@ -436,10 +436,10 @@ void CSGShape::_update_shape() {
}
// unset write access
surfaces.write[i].verticesw = PoolVector<Vector3>::Write();
surfaces.write[i].normalsw = PoolVector<Vector3>::Write();
surfaces.write[i].uvsw = PoolVector<Vector2>::Write();
surfaces.write[i].tansw = PoolVector<float>::Write();
surfaces.write[i].verticesw.release();
surfaces.write[i].normalsw.release();
surfaces.write[i].uvsw.release();
surfaces.write[i].tansw.release();
if (surfaces[i].last_added == 0)
continue;

View file

@ -388,8 +388,8 @@ void image_decompress_cvtt(Image *p_image) {
h >>= 1;
}
rb = PoolVector<uint8_t>::Read();
wb = PoolVector<uint8_t>::Write();
rb.release();
wb.release();
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}

View file

@ -251,7 +251,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
src_data.resize(size);
PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(), size);
wb = PoolVector<uint8_t>::Write();
} else if (info.palette) {
@ -296,8 +295,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
if (colsize == 4)
wb[dst_ofs + 3] = palette[src_ofs + 3];
}
wb = PoolVector<uint8_t>::Write();
} else {
//uncompressed generic...
@ -444,8 +441,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
default: {
}
}
wb = PoolVector<uint8_t>::Write();
}
Ref<Image> img = memnew(Image(width, height, mipmaps - 1, info.format, src_data));

View file

@ -80,7 +80,7 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path,
src_data.resize(size);
PoolVector<uint8_t>::Write wb = src_data.write();
f->get_buffer(wb.ptr(), size);
wb = PoolVector<uint8_t>::Write();
wb.release();
int mipmaps = h.format;
int width = h.origWidth;

View file

@ -96,7 +96,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p
else
fmt = Image::FORMAT_RGB8;
dw = PoolVector<uint8_t>::Write();
dw.release();
p_image->create(image_width, image_height, 0, fmt, data);
return OK;
@ -117,8 +117,6 @@ Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
Error err = jpeg_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len);
w = PoolVector<uint8_t>::Write();
return err;
}

View file

@ -153,7 +153,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
ERR_FAIL_V(RES());
}
w = PoolVector<uint8_t>::Write();
w.release();
int tex_flags = Texture::FLAG_FILTER | Texture::FLAG_REPEAT;
@ -655,8 +655,8 @@ static void _pvrtc_decompress(Image *p_img) {
decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr());
w = PoolVector<uint8_t>::Write();
r = PoolVector<uint8_t>::Read();
w.release();
r.release();
bool make_mipmaps = p_img->has_mipmaps();
p_img->create(p_img->get_width(), p_img->get_height(), false, Image::FORMAT_RGBA8, newdata);

View file

@ -198,8 +198,8 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::Compres
h = MAX(h / 2, 1);
}
rb = PoolVector<uint8_t>::Read();
wb = PoolVector<uint8_t>::Write();
rb.release();
wb.release();
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}

View file

@ -188,7 +188,7 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) {
ogg_stream = stb_vorbis_open_memory((const unsigned char *)src_datar.ptr(), src_data_len, &error, &ogg_alloc);
if (!ogg_stream && error == VORBIS_outofmem) {
w = PoolVector<char>::Write();
w.release();
alloc_try *= 2;
} else {

View file

@ -123,7 +123,7 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t
rasterizer.rasterize(svg_image, 0, 0, p_scale * upscale, (unsigned char *)dw.ptr(), w, h, w * 4);
dw = PoolVector<uint8_t>::Write();
dw.release();
p_image->create(w, h, false, Image::FORMAT_RGBA8, dst_image);
if (upsample)
p_image->shrink_x2();

View file

@ -199,7 +199,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
}
}
image_data_w = PoolVector<uint8_t>::Write();
image_data_w.release();
p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data);

View file

@ -235,7 +235,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
p_image->create(exr_image.width, exr_image.height, false, format, imgdata);
w = PoolVector<uint8_t>::Write();
w.release();
FreeEXRHeader(&exr_header);
FreeEXRImage(&exr_image);

View file

@ -71,7 +71,7 @@ static PoolVector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_q
w[3] = 'P';
copymem(&w[4], dst_buff, dst_size);
free(dst_buff);
w = PoolVector<uint8_t>::Write();
w.release();
return dst;
}
@ -110,7 +110,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec, Ref<Image>());
dst_w = PoolVector<uint8_t>::Write();
dst_w.release();
Ref<Image> img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image));
return img;
@ -137,7 +137,7 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p
} else {
errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w.ptr(), datasize, 3 * features.width) == NULL;
}
dst_w = PoolVector<uint8_t>::Write();
dst_w.release();
//ERR_EXPLAIN("Error decoding webp!");
ERR_FAIL_COND_V(errdec, ERR_FILE_CORRUPT);
@ -171,8 +171,6 @@ Error ImageLoaderWEBP::load_image(Ref<Image> p_image, FileAccess *f, bool p_forc
Error err = webp_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len);
w = PoolVector<uint8_t>::Write();
return err;
}

View file

@ -289,7 +289,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr, 0, fCount, w.ptr());
w = PoolVector<int>::Write();
w.release();
return sarr;
};
@ -302,7 +302,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
PoolVector<uint8_t>::Write w = sarr.write();
env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr()));
w = PoolVector<uint8_t>::Write();
w.release();
return sarr;
};
@ -514,7 +514,7 @@ public:
PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr, 0, fCount, w.ptr());
w = PoolVector<int>::Write();
w.release();
ret = sarr;
env->DeleteLocalRef(arr);
} break;
@ -528,7 +528,7 @@ public:
PoolVector<float>::Write w = sarr.write();
env->GetFloatArrayRegion(arr, 0, fCount, w.ptr());
w = PoolVector<float>::Write();
w.release();
ret = sarr;
env->DeleteLocalRef(arr);
} break;

View file

@ -70,7 +70,7 @@ void CollisionPolygon2D::_build_polygon() {
w[(i << 1) + 1] = polygon[(i + 1) % polygon.size()];
}
w = PoolVector<Vector2>::Write();
w.release();
concave->set_segments(segments);
parent->shape_owner_add_shape(owner_id, concave);

View file

@ -1275,7 +1275,7 @@ PoolVector<int> TileMap::_get_tile_data() const {
idx += 3;
}
w = PoolVector<int>::Write();
w.release();
return data;
}

View file

@ -73,7 +73,7 @@ void SoftBodyVisualServerHandler::open() {
}
void SoftBodyVisualServerHandler::close() {
write_buffer = PoolVector<uint8_t>::Write();
write_buffer.release();
}
void SoftBodyVisualServerHandler::commit_changes() {

View file

@ -254,7 +254,7 @@ Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const {
facesw[j] = vtx;
}
facesw = PoolVector<Vector3>::Write();
facesw.release();
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
triangle_mesh->create(faces);

View file

@ -403,7 +403,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
w[idx++] = scale.z;
}
w = PoolVector<real_t>::Write();
w.release();
r_ret = keys;
return true;
@ -438,8 +438,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
wti = PoolVector<float>::Write();
wtr = PoolVector<float>::Write();
wti.release();
wtr.release();
d["times"] = key_times;
d["transitions"] = key_transitions;
@ -478,8 +478,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
wti = PoolVector<float>::Write();
wtr = PoolVector<float>::Write();
wti.release();
wtr.release();
d["times"] = key_times;
d["transitions"] = key_transitions;
@ -523,8 +523,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
wti = PoolVector<float>::Write();
wpo = PoolVector<float>::Write();
wti.release();
wpo.release();
d["times"] = key_times;
d["points"] = key_points;
@ -562,7 +562,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
idx++;
}
wti = PoolVector<float>::Write();
wti.release();
d["times"] = key_times;
d["clips"] = clips;
@ -595,8 +595,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
wcl[i] = vls[i].value;
}
wti = PoolVector<float>::Write();
wcl = PoolVector<String>::Write();
wti.release();
wcl.release();
d["times"] = key_times;
d["clips"] = clips;

View file

@ -55,7 +55,7 @@ void DynamicFontData::lock() {
void DynamicFontData::unlock() {
fr = PoolVector<uint8_t>::Read();
fr.release();
}
void DynamicFontData::set_font_data(const PoolVector<uint8_t> &p_font) {

View file

@ -98,7 +98,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
}
}
facesw = PoolVector<Vector3>::Write();
facesw.release();
triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh));
triangle_mesh->create(faces);
@ -436,7 +436,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
r[i] = t;
}
r = PoolVector<Vector3>::Write();
r.release();
arrays[ARRAY_VERTEX] = vertices;
if (!has_indices) {
@ -452,7 +452,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
iw[j + 2] = j + 1;
}
iw = PoolVector<int>::Write();
iw.release();
arrays[ARRAY_INDEX] = new_indices;
} else {
@ -461,7 +461,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
SWAP(ir[j + 1], ir[j + 2]);
}
ir = PoolVector<int>::Write();
ir.release();
arrays[ARRAY_INDEX] = indices;
}
}

View file

@ -307,7 +307,7 @@ Array SurfaceTool::commit_to_arrays() {
}
}
w = PoolVector<Vector3>::Write();
w.release();
a[i] = array;
} break;
@ -335,7 +335,7 @@ Array SurfaceTool::commit_to_arrays() {
}
}
w = PoolVector<Vector2>::Write();
w.release();
a[i] = array;
} break;
case Mesh::ARRAY_TANGENT: {
@ -358,7 +358,7 @@ Array SurfaceTool::commit_to_arrays() {
w[idx + 3] = d < 0 ? -1 : 1;
}
w = PoolVector<float>::Write();
w.release();
a[i] = array;
} break;
@ -375,7 +375,7 @@ Array SurfaceTool::commit_to_arrays() {
w[idx] = v.color;
}
w = PoolVector<Color>::Write();
w.release();
a[i] = array;
} break;
case Mesh::ARRAY_BONES: {
@ -396,7 +396,7 @@ Array SurfaceTool::commit_to_arrays() {
}
}
w = PoolVector<int>::Write();
w.release();
a[i] = array;
} break;
@ -418,7 +418,7 @@ Array SurfaceTool::commit_to_arrays() {
}
}
w = PoolVector<float>::Write();
w.release();
a[i] = array;
} break;
@ -436,7 +436,7 @@ Array SurfaceTool::commit_to_arrays() {
w[idx] = E->get();
}
w = PoolVector<int>::Write();
w.release();
a[i] = array;
} break;

View file

@ -1524,8 +1524,8 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) {
_aabb.merge_with(bvh_arrayw[i].aabb);
}
w = PoolVector<Face>::Write();
vw = PoolVector<Vector3>::Write();
w.release();
vw.release();
int count = 0;
_VolumeSW_BVH *bvh_tree = _volume_sw_build_bvh(bvh_arrayw, src_face_count, count);

View file

@ -986,7 +986,7 @@ Variant ConcavePolygonShape2DSW::get_data() const {
w[(i << 1) + 1] = points[segments[i].points[1]];
}
w = PoolVector<Vector2>::Write();
w.release();
return rsegments;
}

View file

@ -2396,7 +2396,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
mipmap.resize(size);
PoolVector<uint8_t>::Write w = mipmap.write();
zeromem(w.ptr(), size);
w = PoolVector<uint8_t>::Write();
w.release();
probe->dynamic.mipmaps_3d.push_back(mipmap);