Use const ref parameters in the GLTF module
This commit is contained in:
@ -1606,7 +1606,7 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> p_state) {
|
||||
if (import_mesh.is_null()) {
|
||||
continue;
|
||||
}
|
||||
Array instance_materials = gltf_mesh->get_instance_materials();
|
||||
const Array &instance_materials = gltf_mesh->get_instance_materials();
|
||||
Array primitives;
|
||||
Dictionary mesh_dict;
|
||||
Array target_names;
|
||||
@ -4013,7 +4013,7 @@ Error GLTFDocument::_create_skins(Ref<GLTFState> p_state) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool GLTFDocument::_skins_are_same(const Ref<Skin> p_skin_a, const Ref<Skin> p_skin_b) {
|
||||
bool GLTFDocument::_skins_are_same(const Ref<Skin> &p_skin_a, const Ref<Skin> &p_skin_b) {
|
||||
if (p_skin_a->get_bind_count() != p_skin_b->get_bind_count()) {
|
||||
return false;
|
||||
}
|
||||
@ -4926,7 +4926,7 @@ void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex
|
||||
#ifndef MODULE_GRIDMAP_ENABLED
|
||||
ERR_FAIL_MSG("gridmap module is disabled.");
|
||||
#else
|
||||
Array cells = p_grid_map->get_used_cells();
|
||||
const Array &cells = p_grid_map->get_used_cells();
|
||||
for (int32_t k = 0; k < cells.size(); k++) {
|
||||
GLTFNode *new_gltf_node = memnew(GLTFNode);
|
||||
p_gltf_node->children.push_back(p_state->nodes.size());
|
||||
@ -5647,7 +5647,7 @@ T GLTFDocument::_interpolate_track(const Vector<double> &p_times, const Vector<T
|
||||
ERR_FAIL_V(p_values[0]);
|
||||
}
|
||||
|
||||
NodePath GLTFDocument::_find_material_node_path(Ref<GLTFState> p_state, Ref<Material> p_material) {
|
||||
NodePath GLTFDocument::_find_material_node_path(Ref<GLTFState> p_state, const Ref<Material> &p_material) {
|
||||
int mesh_index = 0;
|
||||
for (Ref<GLTFMesh> gltf_mesh : p_state->meshes) {
|
||||
TypedArray<Material> materials = gltf_mesh->get_instance_materials();
|
||||
@ -7163,7 +7163,7 @@ void GLTFDocument::_convert_animation(Ref<GLTFState> p_state, AnimationPlayer *p
|
||||
}
|
||||
}
|
||||
|
||||
Error GLTFDocument::_parse(Ref<GLTFState> p_state, String p_path, Ref<FileAccess> p_file) {
|
||||
Error GLTFDocument::_parse(Ref<GLTFState> p_state, const String &p_path, Ref<FileAccess> p_file) {
|
||||
Error err;
|
||||
if (p_file.is_null()) {
|
||||
return FAILED;
|
||||
@ -7231,14 +7231,14 @@ Dictionary _serialize_texture_transform_uv(Vector2 p_offset, Vector2 p_scale) {
|
||||
return extension;
|
||||
}
|
||||
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv1(Ref<BaseMaterial3D> p_material) {
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv1(const Ref<BaseMaterial3D> &p_material) {
|
||||
ERR_FAIL_COND_V(p_material.is_null(), Dictionary());
|
||||
Vector3 offset = p_material->get_uv1_offset();
|
||||
Vector3 scale = p_material->get_uv1_scale();
|
||||
return _serialize_texture_transform_uv(Vector2(offset.x, offset.y), Vector2(scale.x, scale.y));
|
||||
}
|
||||
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv2(Ref<BaseMaterial3D> p_material) {
|
||||
Dictionary GLTFDocument::_serialize_texture_transform_uv2(const Ref<BaseMaterial3D> &p_material) {
|
||||
ERR_FAIL_COND_V(p_material.is_null(), Dictionary());
|
||||
Vector3 offset = p_material->get_uv2_offset();
|
||||
Vector3 scale = p_material->get_uv2_scale();
|
||||
@ -7789,7 +7789,7 @@ Error GLTFDocument::append_from_scene(Node *p_node, Ref<GLTFState> p_state, uint
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) {
|
||||
Error GLTFDocument::append_from_buffer(const PackedByteArray &p_bytes, const String &p_base_path, Ref<GLTFState> p_state, uint32_t p_flags) {
|
||||
Ref<GLTFState> state = p_state;
|
||||
ERR_FAIL_COND_V(state.is_null(), FAILED);
|
||||
// TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire
|
||||
@ -7813,7 +7813,7 @@ Error GLTFDocument::append_from_buffer(PackedByteArray p_bytes, String p_base_pa
|
||||
return OK;
|
||||
}
|
||||
|
||||
Error GLTFDocument::append_from_file(String p_path, Ref<GLTFState> p_state, uint32_t p_flags, String p_base_path) {
|
||||
Error GLTFDocument::append_from_file(const String &p_path, Ref<GLTFState> p_state, uint32_t p_flags, const String &p_base_path) {
|
||||
Ref<GLTFState> state = p_state;
|
||||
// TODO Add missing texture and missing .bin file paths to r_missing_deps 2021-09-10 fire
|
||||
if (state == Ref<GLTFState>()) {
|
||||
|
||||
Reference in New Issue
Block a user