Conversation
Summary of ChangesHello @tatsuya-ogawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the library by introducing full support for VRM 1.0 models. It includes a sophisticated migration mechanism that translates the newer VRM 1.0 data into the library's established VRM 0.x internal structures, ensuring seamless integration with existing rendering and animation pipelines. The accompanying example applications have been updated to showcase this new capability, providing a clear demonstration of loading and interacting with both VRM 0.x and VRM 1.0 models. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for VRM 1.0 models by adding new model assets, updating project configurations, and implementing migration logic from VRM 1.0 to VRM 0.x structures. The example applications have been updated to allow switching between VRM 0.x and VRM 1.0 models, demonstrating the new functionality. The changes also include necessary adjustments to material handling in RealityKit to ensure consistent rendering of MToon and unlit materials.
| radius: sphere.radius | ||
| ) | ||
| } else if let capsule = collider.shape.capsule { | ||
| // Approximate capsule as sphere (head) |
There was a problem hiding this comment.
| let mirror = Mirror(reflecting: vrm1.humanBones) | ||
| for child in mirror.children { | ||
| guard let label = child.label, | ||
| let humanBone1 = child.value as? VRM1.Humanoid.HumanBones.HumanBone?, | ||
| let node = humanBone1?.node else { continue } |
There was a problem hiding this comment.
Using Mirror for iterating over vrm1.humanBones can be less performant and more fragile than an explicit mapping, especially if the structure of HumanBones changes in future VRM 1.0 revisions. While it works for direct property name to bone name mapping, it's generally not considered a best practice for production code due to its dynamic nature and potential for runtime errors if property names don't match expectations.
tattn
left a comment
There was a problem hiding this comment.
@tatsuya-ogawa Thank you again for this very valuable pull request!
I’ve left some comments, so please take a look when you have a chance.
| materialPropertyNameMap = materialProperties.reduce(into: [:]) { $0[$1.name] = $1 } | ||
|
|
||
| if extensions.keys.contains("VRMC_vrm") { | ||
| // VRM 1.0 Support |
There was a problem hiding this comment.
Currently, the VRM 0.x specification is described in VRM.swift, and the VRM 1.x specification is described in VRM1.swift.
Since this library was originally created before VRM 1.0, it has kept this naming scheme.
As a future direction, I was considering renaming the current VRM.swift to VRM0.swift, then introducing a new VRM.swift to abstract away the differences between model versions.
Do you think implementing this approach would be difficult?
There was a problem hiding this comment.
I don’t think that will be difficult.This PR preserves the existing interface as much as possible, which should make future PRs easier to migrate.
There was a problem hiding this comment.
OK. After merging, I’ll make some minor I/F adjustments to move toward these changes. Thank you!
4e1daf0 to
d8b23bd
Compare
tattn
left a comment
There was a problem hiding this comment.
@tatsuya-ogawa
I noticed a few points of concern in the migration process, so I’d like to check with you.
|
@codex please review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 775d164bab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Picker("Model", selection: $appModel.selectedModelName) { | ||
| ForEach(AppModel.ModelName.allCases) { model in | ||
| Text(model.displayName).tag(model) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Fix mismatched braces in new Picker
The new Picker block closes twice (} at lines 20–21), which prematurely ends the Picker and the VStack body. This causes a Swift compile error (Expected '}' in …) and prevents the Vision example from building at all once this change is applied. Removing the extra closing braces so the .pickerStyle modifier attaches to the Picker fixes the build.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
VisionPro Example does not show model.I am cheking.
There was a problem hiding this comment.
even main branch does not show models.
There was a problem hiding this comment.
This version can show models.
8afb5f9
checking difference from main branch.
|
@tatsuya-ogawa Oh, Thank you for the notice! |
7c96b8b to
141fb79
Compare
|
Thank you for adding the job to the workflow! |
tattn
left a comment
There was a problem hiding this comment.
Since I’d like to adjust the examples and refine the API with future use in mind before merging into the main branch, I plan to merge this into feature/vrm1.0 for now.
Thank you very much for your help with the review and other support — it was extremely helpful!
* vrm1.0 support (#40) * vrm1.0 support * Update Example/VisionExample/VisionExampleApp.swift Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * displayName * displayName * Update Example/VisionExample/ContentView.swift Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * materialName * SpringBone * revert Sources/VRMKit/VRM/Node.swift * revert Sources/VRMKit/VRM/VRM1.swift * Revert "revert Sources/VRMKit/VRM/VRM1.swift" This reverts commit b66fe1c. * Revert "revert Sources/VRMKit/VRM/Node.swift" This reverts commit 445e5f6. * fix test * fix BlendShape * fix comment * remove comments * fix comment * mac example * add testcase * remove unnecessary comment * SwiftTesting * revert VRM1Tests.swift * Revert "revert VRM1Tests.swift" This reverts commit 6abaf87. * refactor testcase * allowedUserName * texture transform * fix build error * add example build pipeline --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: VRM files to example project resources * Flip the model direction for visionOS example Co-authored-by: tatsuya-ogawa <tatsuya-ogawa@users.noreply.github.com> * New interfaces - Updated VRM.MaterialProperty to VRM0.MaterialProperty for consistency. - Removed VRMFileProtocol as it is no longer needed. - Migrated VRM1 structures to VRM0 equivalents in VRMMigration.swift. - Adjusted VRMLoader to support loading VRM0 thumbnails. - Modified Humanoid and SecondaryAnimation classes to use VRM0 types. - Updated tests to validate VRM0 functionality and migration from VRM1. - Removed deprecated VRM1SceneLoader and related methods. - Added new tests for VRM0 to ensure proper functionality and migration. * feat: Add UIUserInterfaceStyle key for dark mode support in Info.plist * feat: Improve shader handling for MToon and Unlit variants in VRMEntityLoader #42 (comment) --------- Co-authored-by: tatsuya-ogawa <tatsuya-ogawa@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
VRM 1.0 Support & Migration Logic
Description
This PR introduces initial support for VRM 1.0 models, including a migration layer to bridge VRM 1.0 data to the existing VRM 0.x based internal architecture. It also includes a sample VRM 1.0 model and updates the example apps to demonstrate loading.
Changes
VRMKit Core
VRMMigration.swiftto map VRM 1.0 data (meta, expressions, materials) to the existing internal VRM structure.Node.swift,VRM.swift, andVRM1.swiftto accommodate VRM 1.0 specific fields.Example Apps
VisionExample,MacExample, andVRMExampleto support loading the new VRM 1.0 model (likely via a toggle or updated loader logic).Project Configuration
Note