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

store ID and selectability in GLTF without relying on name #937

Merged
merged 4 commits into from
Jan 10, 2023

Conversation

andrewheumann
Copy link
Member

@andrewheumann andrewheumann commented Jan 9, 2023

BACKGROUND:

  • In early days of Elements, the name of the object in the GLTF wasn't utilized for anything. Over time, the Hypar front end has evolved to rely on parsing out critical information from the name — specifically, the element Id, and whether or not it is meant to be selectable.

DESCRIPTION:

  • Establishes an ad-hoc gltf extension called HYPAR_info which contains information necessary for the hypar front end to connect element data to GLTF mesh objects.

TESTING:

  • I added a test which verifies that the data is written correctly to the GLTF.
  • I have an in-progress explore branch which can read this info if it's present.

REQUIRED:

  • All changes are up to date in CHANGELOG.md.

This change is Reviewable

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 7 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @andrewheumann)


Elements/src/Serialization/glTF/NodeUtilities.cs line 171 at r2 (raw file):

        }

        internal static int CreateNodeForMesh(int meshId, List<glTFLoader.Schema.Node> nodes, Guid elementId, Transform transform = null)

seems like elementId this should also be optional with default=null since it's optional in all other methods that take an elementId? Is there some reason we are sure to have a value here but not in the other methods?


Elements/src/Serialization/glTF/NodeUtilities.cs line 195 at r2 (raw file):

            if (selectable.HasValue)
            {
                node.Extensions["HYPAR_info"] = new Dictionary<string, object>

nit. I think my code preference would be to make the dictionary with the "id", optionally add the "selectable" property and then always assign the dictionary to the dictionary to Extensions["HYPAR_info"] once the correct dictionary is built. feels like a more extensible pattern.

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly just nits.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @andrewheumann)

Copy link
Member Author

@andrewheumann andrewheumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @wynged)


Elements/src/Serialization/glTF/NodeUtilities.cs line 171 at r2 (raw file):

Previously, wynged (Eric Wassail) wrote…

seems like elementId this should also be optional with default=null since it's optional in all other methods that take an elementId? Is there some reason we are sure to have a value here but not in the other methods?

Done.


Elements/src/Serialization/glTF/NodeUtilities.cs line 195 at r2 (raw file):

Previously, wynged (Eric Wassail) wrote…

nit. I think my code preference would be to make the dictionary with the "id", optionally add the "selectable" property and then always assign the dictionary to the dictionary to Extensions["HYPAR_info"] once the correct dictionary is built. feels like a more extensible pattern.

Done.

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

@andrewheumann andrewheumann merged commit b1e5498 into master Jan 10, 2023
@andrewheumann andrewheumann deleted the stop-storing-info-in-name branch January 10, 2023 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants