Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c8d5da7
vrm1.0 support
tatsuya-ogawa Jan 26, 2026
6c880bd
Update Example/VisionExample/VisionExampleApp.swift
tatsuya-ogawa Jan 31, 2026
85a140f
displayName
tatsuya-ogawa Jan 31, 2026
b6a0b7f
displayName
tatsuya-ogawa Jan 31, 2026
04b327f
Update Example/VisionExample/ContentView.swift
tatsuya-ogawa Jan 31, 2026
7e8607f
materialName
tatsuya-ogawa Jan 31, 2026
0ea686a
SpringBone
tatsuya-ogawa Jan 31, 2026
445e5f6
revert Sources/VRMKit/VRM/Node.swift
tatsuya-ogawa Jan 31, 2026
b66fe1c
revert Sources/VRMKit/VRM/VRM1.swift
tatsuya-ogawa Jan 31, 2026
6371170
Revert "revert Sources/VRMKit/VRM/VRM1.swift"
tatsuya-ogawa Jan 31, 2026
51d4ff6
Revert "revert Sources/VRMKit/VRM/Node.swift"
tatsuya-ogawa Jan 31, 2026
4b5e8fd
fix test
tatsuya-ogawa Jan 31, 2026
58c01fa
fix BlendShape
tatsuya-ogawa Feb 1, 2026
c058dd8
Merge branch 'main' of github.com:tatsuya-ogawa/VRMKit into feature/v…
tatsuya-ogawa Feb 2, 2026
d8b23bd
fix comment
tatsuya-ogawa Feb 2, 2026
8b9b966
remove comments
tatsuya-ogawa Feb 2, 2026
d1cb5f3
fix comment
tatsuya-ogawa Feb 2, 2026
9451a52
mac example
tatsuya-ogawa Feb 2, 2026
dee4292
add testcase
tatsuya-ogawa Feb 2, 2026
e51ea67
remove unnecessary comment
tatsuya-ogawa Feb 2, 2026
84d9113
SwiftTesting
tatsuya-ogawa Feb 3, 2026
6abaf87
revert VRM1Tests.swift
tatsuya-ogawa Feb 3, 2026
9dd2db8
Revert "revert VRM1Tests.swift"
tatsuya-ogawa Feb 3, 2026
9876270
refactor testcase
tatsuya-ogawa Feb 3, 2026
4e407c4
allowedUserName
tatsuya-ogawa Feb 3, 2026
775d164
texture transform
tatsuya-ogawa Feb 3, 2026
cfb1b65
fix build error
tatsuya-ogawa Feb 3, 2026
141fb79
add example build pipeline
tatsuya-ogawa Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
materialName
  • Loading branch information
tatsuya-ogawa committed Jan 31, 2026
commit 7e8607fec36cb569a818f23e857c00090eba88ae
2 changes: 1 addition & 1 deletion Sources/VRMKit/VRM/VRM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct VRM: VRMFile {
humanoid = Humanoid(vrm1: vrm1.humanoid)

// BlendShapeMaster
blendShapeMaster = BlendShapeMaster(vrm1: vrm1.expressions)
blendShapeMaster = BlendShapeMaster(vrm1: vrm1.expressions, gltf: gltf)

// FirstPerson
firstPerson = FirstPerson(vrm1: vrm1.firstPerson, lookAt: vrm1.lookAt)
Expand Down
24 changes: 11 additions & 13 deletions Sources/VRMKit/VRM/VRMMigration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}

public extension VRM.BlendShapeMaster {
init(vrm1: VRM1.Expressions?) {
init(vrm1: VRM1.Expressions?, gltf: BinaryGLTF) {
guard let expressions = vrm1 else {
self.init(blendShapeGroups: [])
return
Expand All @@ -86,19 +86,17 @@
VRM.BlendShapeMaster.BlendShapeGroup.Bind(index: $0.index, mesh: $0.node, weight: $0.weight)
}

let materialValues = expression.materialColorBinds?.map {
VRM.BlendShapeMaster.BlendShapeGroup.MaterialValueBind(materialName: "", // We need material NAME, but VRM1 bind has material INDEX.
// This is a problem. Material migration needs access to GLTF to resolve names.
// For now, we arguably can't populate this correctly without looking up GLTF.
// We will leave it empty or try to resolve later/outside?
// `MaterialValueBind` expects `materialName`.
// We can map it if we have access to GLTF.
// But this init extension only sees `vrm1`.
propertyName: $0.type.rawValue,
targetValue: $0.targetValue)
let materialValues = expression.materialColorBinds?.compactMap { bind -> VRM.BlendShapeMaster.BlendShapeGroup.MaterialValueBind? in
guard let materials = gltf.jsonData.materials, bind.material < materials.count else { return nil }
// VRM1 bind refers to material by index. Resolve the name from GLTF.
let materialName = materials[bind.material].name ?? ""

return VRM.BlendShapeMaster.BlendShapeGroup.MaterialValueBind(
materialName: materialName,
propertyName: bind.type.rawValue,
targetValue: bind.targetValue
)
}
// Wait, standard `init` for structs implies we can't easily access external context unless passed.
// We should change the call site to `try VRM.migrateBlendShapes(vrm1: vrm1, gltf: gltf)`.

groups.append(BlendShapeGroup(
binds: binds,
Expand Down Expand Up @@ -296,7 +294,7 @@

// Map MToon parameters to VRM 0.x MaterialProperty
var floatProperties: [String: Double] = [:]
var keywordMap: [String: Bool] = [:]

Check warning on line 297 in Sources/VRMKit/VRM/VRMMigration.swift

View workflow job for this annotation

GitHub Actions / Test package (watchOS)

variable 'keywordMap' was never mutated; consider changing to 'let' constant

Check warning on line 297 in Sources/VRMKit/VRM/VRMMigration.swift

View workflow job for this annotation

GitHub Actions / Test package (iOS)

variable 'keywordMap' was never mutated; consider changing to 'let' constant

Check warning on line 297 in Sources/VRMKit/VRM/VRMMigration.swift

View workflow job for this annotation

GitHub Actions / Test package (xrOS)

variable 'keywordMap' was never mutated; consider changing to 'let' constant
var textureProperties: [String: Int] = [:]
var vectorProperties: [String: [Double]] = [:] // VRM0.x expects [Double] (array of 4)

Expand Down
Loading