Merge pull request #107469 from Ivorforce/vector-localvector-explicit-span-conversions

Remove implicit conversions between `LocalVector` and `Vector`
This commit is contained in:
Thaddeus Crews 2025-09-30 11:19:17 -05:00
commit 21fd4faf1b
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
19 changed files with 52 additions and 52 deletions

View file

@ -318,7 +318,7 @@ public:
insert(i, p_val); insert(i, p_val);
} }
operator Vector<T>() const { explicit operator Vector<T>() const {
Vector<T> ret; Vector<T> ret;
ret.resize(count); ret.resize(count);
T *w = ret.ptrw(); T *w = ret.ptrw();

View file

@ -1563,8 +1563,8 @@ void TextureStorage::texture_replace(RID p_texture, RID p_by_texture) {
tex_to->tex_id = 0; tex_to->tex_id = 0;
} }
Vector<RID> proxies_to_update = tex_to->proxies; Vector<RID> proxies_to_update = Vector<RID>(tex_to->proxies);
Vector<RID> proxies_to_redirect = tex_from->proxies; Vector<RID> proxies_to_redirect = Vector<RID>(tex_from->proxies);
*tex_to = *tex_from; *tex_to = *tex_from;

View file

@ -162,15 +162,15 @@ Ref<ArrayMesh> SpringBoneSimulator3DGizmoPlugin::get_joints_mesh(Skeleton3D *p_s
continue; continue;
} }
bones[0] = current_bone; bones[0] = current_bone;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
axis = global_pose.xform(axis * p_simulator->get_end_bone_length(i)); axis = global_pose.xform(axis * p_simulator->get_end_bone_length(i));
draw_line(surface_tool, global_pose.origin, axis, bone_color); draw_line(surface_tool, global_pose.origin, axis, bone_color);
draw_sphere(surface_tool, global_pose.basis, axis, p_simulator->get_joint_radius(i, j), bone_color); draw_sphere(surface_tool, global_pose.basis, axis, p_simulator->get_joint_radius(i, j), bone_color);
} else { } else {
bones[0] = current_bone; bones[0] = current_bone;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
if (j == 0) { if (j == 0) {
// Draw rotation axis vector if not ROTATION_AXIS_ALL. // Draw rotation axis vector if not ROTATION_AXIS_ALL.
SpringBoneSimulator3D::RotationAxis rotation_axis = p_simulator->get_joint_rotation_axis(i, j); SpringBoneSimulator3D::RotationAxis rotation_axis = p_simulator->get_joint_rotation_axis(i, j);

View file

@ -1706,12 +1706,12 @@ Ref<ArrayMesh> Skeleton3DGizmoPlugin::get_bones_mesh(Skeleton3D *p_skeleton, int
case 0: { // Wire shape. case 0: { // Wire shape.
surface_tool->set_color(current_bone_color); surface_tool->set_color(current_bone_color);
bones[0] = current_bone_idx; bones[0] = current_bone_idx;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v0); surface_tool->add_vertex(v0);
bones[0] = child_bone_idx; bones[0] = child_bone_idx;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v1); surface_tool->add_vertex(v1);
} break; } break;
@ -1737,19 +1737,19 @@ Ref<ArrayMesh> Skeleton3DGizmoPlugin::get_bones_mesh(Skeleton3D *p_skeleton, int
point += axis * dist * 0.1; point += axis * dist * 0.1;
bones[0] = current_bone_idx; bones[0] = current_bone_idx;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v0); surface_tool->add_vertex(v0);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(point); surface_tool->add_vertex(point);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(point); surface_tool->add_vertex(point);
bones[0] = child_bone_idx; bones[0] = child_bone_idx;
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v1); surface_tool->add_vertex(v1);
points[point_idx++] = point; points[point_idx++] = point;
} }
@ -1758,11 +1758,11 @@ Ref<ArrayMesh> Skeleton3DGizmoPlugin::get_bones_mesh(Skeleton3D *p_skeleton, int
SWAP(points[1], points[2]); SWAP(points[1], points[2]);
bones[0] = current_bone_idx; bones[0] = current_bone_idx;
for (int j = 0; j < 6; j++) { for (int j = 0; j < 6; j++) {
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(points[j]); surface_tool->add_vertex(points[j]);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(points[(j + 1) % 6]); surface_tool->add_vertex(points[(j + 1) % 6]);
} }
} break; } break;
@ -1772,11 +1772,11 @@ Ref<ArrayMesh> Skeleton3DGizmoPlugin::get_bones_mesh(Skeleton3D *p_skeleton, int
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
bones[0] = current_bone_idx; bones[0] = current_bone_idx;
surface_tool->set_color(axis_colors[j]); surface_tool->set_color(axis_colors[j]);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v0); surface_tool->add_vertex(v0);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v0 + (p_skeleton->get_bone_global_rest(current_bone_idx).basis.inverse())[j].normalized() * dist * bone_axis_length); surface_tool->add_vertex(v0 + (p_skeleton->get_bone_global_rest(current_bone_idx).basis.inverse())[j].normalized() * dist * bone_axis_length);
if (j == closest) { if (j == closest) {
@ -1789,11 +1789,11 @@ Ref<ArrayMesh> Skeleton3DGizmoPlugin::get_bones_mesh(Skeleton3D *p_skeleton, int
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {
bones[0] = child_bone_idx; bones[0] = child_bone_idx;
surface_tool->set_color(axis_colors[j]); surface_tool->set_color(axis_colors[j]);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v1); surface_tool->add_vertex(v1);
surface_tool->set_bones(bones); surface_tool->set_bones(Vector<int>(bones));
surface_tool->set_weights(weights); surface_tool->set_weights(Vector<float>(weights));
surface_tool->add_vertex(v1 + (p_skeleton->get_bone_global_rest(child_bone_idx).basis.inverse())[j].normalized() * dist * bone_axis_length); surface_tool->add_vertex(v1 + (p_skeleton->get_bone_global_rest(child_bone_idx).basis.inverse())[j].normalized() * dist * bone_axis_length);
if (j == closest) { if (j == closest) {

View file

@ -665,7 +665,7 @@ String GDScriptWorkspace::get_file_uri(const String &p_path) const {
} }
// Always return file URI's with authority part (encoding drive letters with leading slash), to maintain compat with RFC-1738 which required it. // Always return file URI's with authority part (encoding drive letters with leading slash), to maintain compat with RFC-1738 which required it.
return "file:///" + String("/").join(encoded_parts); return "file:///" + String("/").join(Vector<String>(encoded_parts));
} }
void GDScriptWorkspace::publish_diagnostics(const String &p_path) { void GDScriptWorkspace::publish_diagnostics(const String &p_path) {

View file

@ -2988,9 +2988,9 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> p_state) {
} }
} }
gltf_texcoord_key = vformat("TEXCOORD_%d", texcoord_i); gltf_texcoord_key = vformat("TEXCOORD_%d", texcoord_i);
attributes[gltf_texcoord_key] = _encode_accessor_as_vec2(p_state, first_channel, true); attributes[gltf_texcoord_key] = _encode_accessor_as_vec2(p_state, Vector<Vector2>(first_channel), true);
gltf_texcoord_key = vformat("TEXCOORD_%d", texcoord_i + 1); gltf_texcoord_key = vformat("TEXCOORD_%d", texcoord_i + 1);
attributes[gltf_texcoord_key] = _encode_accessor_as_vec2(p_state, second_channel, true); attributes[gltf_texcoord_key] = _encode_accessor_as_vec2(p_state, Vector<Vector2>(second_channel), true);
} }
} }
{ {

View file

@ -239,7 +239,7 @@ void AudioStreamMP3::set_data(const Vector<uint8_t> &p_data) {
} }
Vector<uint8_t> AudioStreamMP3::get_data() const { Vector<uint8_t> AudioStreamMP3::get_data() const {
return data; return Vector<uint8_t>(data);
} }
void AudioStreamMP3::set_loop(bool p_enable) { void AudioStreamMP3::set_loop(bool p_enable) {

View file

@ -103,7 +103,7 @@ Vector<uint8_t> WaylandThread::_read_fd(int fd) {
data.resize(bytes_read + chunk_size); data.resize(bytes_read + chunk_size);
} }
return data; return Vector<uint8_t>(data);
} }
// Based on the wayland book's shared memory boilerplate (PD/CC0). // Based on the wayland book's shared memory boilerplate (PD/CC0).

View file

@ -172,7 +172,7 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
replaces["$GODOT_CONFIG"] = str_config; replaces["$GODOT_CONFIG"] = str_config;
replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(get_project_setting(p_preset, "application/boot_splash/bg_color")).to_html(false); replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(get_project_setting(p_preset, "application/boot_splash/bg_color")).to_html(false);
LocalVector<String> godot_splash_classes; Vector<String> godot_splash_classes;
godot_splash_classes.push_back("show-image--" + String(get_project_setting(p_preset, "application/boot_splash/show_image"))); godot_splash_classes.push_back("show-image--" + String(get_project_setting(p_preset, "application/boot_splash/show_image")));
godot_splash_classes.push_back("fullsize--" + String(get_project_setting(p_preset, "application/boot_splash/fullsize"))); godot_splash_classes.push_back("fullsize--" + String(get_project_setting(p_preset, "application/boot_splash/fullsize")));
godot_splash_classes.push_back("use-filter--" + String(get_project_setting(p_preset, "application/boot_splash/use_filter"))); godot_splash_classes.push_back("use-filter--" + String(get_project_setting(p_preset, "application/boot_splash/use_filter")));

View file

@ -139,7 +139,7 @@ void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
void AnimationNode::blend_animation(const StringName &p_animation, AnimationMixer::PlaybackInfo p_playback_info) { void AnimationNode::blend_animation(const StringName &p_animation, AnimationMixer::PlaybackInfo p_playback_info) {
ERR_FAIL_NULL(process_state); ERR_FAIL_NULL(process_state);
p_playback_info.track_weights = node_state.track_weights; p_playback_info.track_weights = Vector<real_t>(node_state.track_weights);
process_state->tree->make_animation_instance(p_animation, p_playback_info); process_state->tree->make_animation_instance(p_animation, p_playback_info);
} }

View file

@ -622,7 +622,7 @@ void SceneDebugger::_send_object_ids(const Vector<ObjectID> &p_ids, bool p_updat
} }
if (p_update_selection) { if (p_update_selection) {
RuntimeNodeSelect::get_singleton()->_set_selected_nodes(nodes); RuntimeNodeSelect::get_singleton()->_set_selected_nodes(Vector<Node *>(nodes));
} }
if (objs_missing) { if (objs_missing) {
@ -2004,7 +2004,7 @@ void RuntimeNodeSelect::_send_ids(const Vector<Node *> &p_picked_nodes, bool p_i
EngineDebugger::get_singleton()->send_message("remote_objects_selected", message); EngineDebugger::get_singleton()->send_message("remote_objects_selected", message);
} }
_set_selected_nodes(nodes); _set_selected_nodes(Vector<Node *>(nodes));
} }
void RuntimeNodeSelect::_set_selected_nodes(const Vector<Node *> &p_nodes) { void RuntimeNodeSelect::_set_selected_nodes(const Vector<Node *> &p_nodes) {

View file

@ -1615,7 +1615,7 @@ void GraphEdit::_draw_minimap_connection_line(const Vector2 &p_from_graph_positi
colors.push_back(p_from_color.lerp(p_to_color, normalized_curve_position)); colors.push_back(p_from_color.lerp(p_to_color, normalized_curve_position));
} }
minimap->draw_polyline_colors(points, colors, 0.5, lines_antialiased); minimap->draw_polyline_colors(points, Vector<Color>(colors), 0.5, lines_antialiased);
} }
void GraphEdit::_update_connections() { void GraphEdit::_update_connections() {

View file

@ -6422,7 +6422,7 @@ void TileData::set_collision_polygon_points(int p_layer_id, int p_polygon_index,
Vector<Vector2> TileData::get_collision_polygon_points(int p_layer_id, int p_polygon_index) const { Vector<Vector2> TileData::get_collision_polygon_points(int p_layer_id, int p_polygon_index) const {
ERR_FAIL_INDEX_V(p_layer_id, physics.size(), Vector<Vector2>()); ERR_FAIL_INDEX_V(p_layer_id, physics.size(), Vector<Vector2>());
ERR_FAIL_INDEX_V(p_polygon_index, physics[p_layer_id].polygons.size(), Vector<Vector2>()); ERR_FAIL_INDEX_V(p_polygon_index, physics[p_layer_id].polygons.size(), Vector<Vector2>());
return physics[p_layer_id].polygons[p_polygon_index].polygon; return Vector<Vector2>(physics[p_layer_id].polygons[p_polygon_index].polygon);
} }
void TileData::set_collision_polygon_one_way(int p_layer_id, int p_polygon_index, bool p_one_way) { void TileData::set_collision_polygon_one_way(int p_layer_id, int p_polygon_index, bool p_one_way) {

View file

@ -65,7 +65,7 @@ Ref<ArrayMesh> ConvexPolygonShape3D::get_debug_arraymesh_faces(const Color &p_mo
Geometry3D::MeshData md; Geometry3D::MeshData md;
Error err = ConvexHullComputer::convex_hull(hull_points, md); Error err = ConvexHullComputer::convex_hull(hull_points, md);
if (err == OK) { if (err == OK) {
verts = md.vertices; verts = Vector<Vector3>(md.vertices);
for (int i = 0; i < verts.size(); i++) { for (int i = 0; i < verts.size(); i++) {
colors.push_back(p_modulate); colors.push_back(p_modulate);
} }

View file

@ -898,7 +898,7 @@ Ref<ConvexPolygonShape3D> ImporterMesh::create_convex_shape(bool p_clean, bool p
Geometry3D::MeshData md; Geometry3D::MeshData md;
Error err = ConvexHullComputer::convex_hull(vertices, md); Error err = ConvexHullComputer::convex_hull(vertices, md);
if (err == OK) { if (err == OK) {
shape->set_points(md.vertices); shape->set_points(Vector<Vector3>(md.vertices));
return shape; return shape;
} else { } else {
ERR_PRINT("Convex shape cleaning failed, falling back to simpler process."); ERR_PRINT("Convex shape cleaning failed, falling back to simpler process.");

View file

@ -525,7 +525,7 @@ void AudioStreamWAV::set_data(const Vector<uint8_t> &p_data) {
} }
Vector<uint8_t> AudioStreamWAV::get_data() const { Vector<uint8_t> AudioStreamWAV::get_data() const {
return data; return Vector<uint8_t>(data);
} }
Error AudioStreamWAV::save_to_wav(const String &p_path) { Error AudioStreamWAV::save_to_wav(const String &p_path) {

View file

@ -564,7 +564,7 @@ Ref<ConvexPolygonShape3D> Mesh::create_convex_shape(bool p_clean, bool p_simplif
Geometry3D::MeshData md; Geometry3D::MeshData md;
Error err = ConvexHullComputer::convex_hull(vertices, md); Error err = ConvexHullComputer::convex_hull(vertices, md);
if (err == OK) { if (err == OK) {
shape->set_points(md.vertices); shape->set_points(Vector<Vector3>(md.vertices));
return shape; return shape;
} else { } else {
ERR_PRINT("Convex shape cleaning failed, falling back to simpler process."); ERR_PRINT("Convex shape cleaning failed, falling back to simpler process.");

View file

@ -4421,7 +4421,7 @@ static RD::FramebufferFormatID _get_depth_framebuffer_format_for_pipeline(bool p
passes.ptrw()[0].depth_attachment = 0; passes.ptrw()[0].depth_attachment = 0;
return RD::get_singleton()->framebuffer_format_create_multipass(attachments, passes); return RD::get_singleton()->framebuffer_format_create_multipass(Vector<RD::AttachmentFormat>(attachments), passes);
} }
static RD::FramebufferFormatID _get_shadow_cubemap_framebuffer_format_for_pipeline() { static RD::FramebufferFormatID _get_shadow_cubemap_framebuffer_format_for_pipeline() {
@ -4433,7 +4433,7 @@ static RD::FramebufferFormatID _get_shadow_cubemap_framebuffer_format_for_pipeli
attachment.usage_flags = RendererRD::LightStorage::get_cubemap_depth_usage_bits(); attachment.usage_flags = RendererRD::LightStorage::get_cubemap_depth_usage_bits();
attachments.push_back(attachment); attachments.push_back(attachment);
return RD::get_singleton()->framebuffer_format_create(attachments); return RD::get_singleton()->framebuffer_format_create(Vector<RD::AttachmentFormat>(attachments));
} }
static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline(bool p_use_16_bits) { static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline(bool p_use_16_bits) {
@ -4445,7 +4445,7 @@ static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline
attachment.usage_flags = RendererRD::LightStorage::get_shadow_atlas_depth_usage_bits(); attachment.usage_flags = RendererRD::LightStorage::get_shadow_atlas_depth_usage_bits();
attachments.push_back(attachment); attachments.push_back(attachment);
return RD::get_singleton()->framebuffer_format_create(attachments); return RD::get_singleton()->framebuffer_format_create(Vector<RD::AttachmentFormat>(attachments));
} }
static RD::FramebufferFormatID _get_reflection_probe_depth_framebuffer_format_for_pipeline() { static RD::FramebufferFormatID _get_reflection_probe_depth_framebuffer_format_for_pipeline() {
@ -4457,7 +4457,7 @@ static RD::FramebufferFormatID _get_reflection_probe_depth_framebuffer_format_fo
attachment.usage_flags = RendererRD::LightStorage::get_reflection_probe_depth_usage_bits(); attachment.usage_flags = RendererRD::LightStorage::get_reflection_probe_depth_usage_bits();
attachments.push_back(attachment); attachments.push_back(attachment);
return RD::get_singleton()->framebuffer_format_create(attachments); return RD::get_singleton()->framebuffer_format_create(Vector<RD::AttachmentFormat>(attachments));
} }
void RenderForwardClustered::_mesh_compile_pipeline_for_surface(SceneShaderForwardClustered::ShaderData *p_shader, void *p_mesh_surface, bool p_ubershader, bool p_instanced_surface, RS::PipelineSource p_source, SceneShaderForwardClustered::ShaderData::PipelineKey &r_pipeline_key, Vector<ShaderPipelinePair> *r_pipeline_pairs) { void RenderForwardClustered::_mesh_compile_pipeline_for_surface(SceneShaderForwardClustered::ShaderData *p_shader, void *p_mesh_surface, bool p_ubershader, bool p_instanced_surface, RS::PipelineSource p_source, SceneShaderForwardClustered::ShaderData::PipelineKey &r_pipeline_key, Vector<ShaderPipelinePair> *r_pipeline_pairs) {

View file

@ -3095,7 +3095,7 @@ static RD::FramebufferFormatID _get_shadow_cubemap_framebuffer_format_for_pipeli
attachment.usage_flags = RendererRD::LightStorage::get_cubemap_depth_usage_bits(); attachment.usage_flags = RendererRD::LightStorage::get_cubemap_depth_usage_bits();
attachments.push_back(attachment); attachments.push_back(attachment);
return RD::get_singleton()->framebuffer_format_create(attachments); return RD::get_singleton()->framebuffer_format_create(Vector<RD::AttachmentFormat>(attachments));
} }
static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline(bool p_use_16_bits) { static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline(bool p_use_16_bits) {
@ -3107,7 +3107,7 @@ static RD::FramebufferFormatID _get_shadow_atlas_framebuffer_format_for_pipeline
attachment.usage_flags = RendererRD::LightStorage::get_shadow_atlas_depth_usage_bits(); attachment.usage_flags = RendererRD::LightStorage::get_shadow_atlas_depth_usage_bits();
attachments.push_back(attachment); attachments.push_back(attachment);
return RD::get_singleton()->framebuffer_format_create(attachments); return RD::get_singleton()->framebuffer_format_create(Vector<RD::AttachmentFormat>(attachments));
} }
void RenderForwardMobile::_mesh_compile_pipeline_for_surface(SceneShaderForwardMobile::ShaderData *p_shader, void *p_mesh_surface, bool p_instanced_surface, RS::PipelineSource p_source, SceneShaderForwardMobile::ShaderData::PipelineKey &r_pipeline_key, Vector<ShaderPipelinePair> *r_pipeline_pairs) { void RenderForwardMobile::_mesh_compile_pipeline_for_surface(SceneShaderForwardMobile::ShaderData *p_shader, void *p_mesh_surface, bool p_instanced_surface, RS::PipelineSource p_source, SceneShaderForwardMobile::ShaderData::PipelineKey &r_pipeline_key, Vector<ShaderPipelinePair> *r_pipeline_pairs) {