Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTF: Move unique name generation code to GLTFState #80803

Closed

Conversation

aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Aug 20, 2023

This PR moves the _gen_unique_name method from GLTFDocument into GLTFState and renames it to generate_unique_name. Without this PR, it is not possible for GLTFDocumentExtension classes to generate unique names, so it's not possible to provide the same uniqueness guarantee as GLTFDocument itself.

This PR also cleans up the code a bit, replacing the while (true) and break; code with a simple for loop. I tested it and it functions exactly the same as before, just now the code is easier to read.

Note: Per Lyuma's request, I have removed the exposing in this PR, so this PR is just moving the method and making it available to in-engine C++ code. We can expose it in a future PR.

@aaronfranke aaronfranke added this to the 4.2 milestone Aug 20, 2023
@aaronfranke aaronfranke requested a review from a team as a code owner August 20, 2023 04:28
@aaronfranke aaronfranke force-pushed the gltf-gen-unique-name branch from 0c7f2b9 to 0b92b5d Compare August 20, 2023 05:21
@aaronfranke aaronfranke changed the title GLTF: Move unique name generation code to GLTFState and expose it GLTF: Move unique name generation code to GLTFState Aug 20, 2023
@fire
Copy link
Member

fire commented Aug 20, 2023

@lyuma mentioned some comments on this

@aaronfranke aaronfranke modified the milestones: 4.2, 4.3 Sep 29, 2023
@akien-mga akien-mga requested a review from lyuma December 6, 2023 10:29
@akien-mga
Copy link
Member

akien-mga commented Dec 6, 2023

I have no strong opinion either way, but this seems to introduce an inconsistency with other similar helper methods:

String _gen_unique_animation_name(Ref<GLTFState> p_state, const String &p_name);
String _gen_unique_bone_name(Ref<GLTFState> p_state, const GLTFSkeletonIndex p_skel_i, const String &p_name);

@aaronfranke aaronfranke marked this pull request as draft December 6, 2023 17:04
@aaronfranke aaronfranke deleted the gltf-gen-unique-name branch March 27, 2024 02:28
@AThousandShips AThousandShips removed this from the 4.3 milestone Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants