From 0445460d0b0e7194cf6e7ec39ed84d0e63add47c Mon Sep 17 00:00:00 2001 From: naoji3x Date: Sat, 9 Sep 2023 09:04:50 +0900 Subject: [PATCH 1/5] Add VRMWatchKit, VRMWatchSceneKit and WatchExample --- Sources/VRMSceneKit/SceneData.swift | 4 + VRMKit.xcodeproj/project.pbxproj | 683 +++++++++++++++++- .../xcschemes/VRMWatchKit.xcscheme | 66 ++ .../xcschemes/VRMWatchSceneKit.xcscheme | 66 ++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 13 + .../Assets.xcassets/Contents.json | 6 + WatchExample Watch App/ContentView.swift | 82 +++ .../Preview Assets.xcassets/Contents.json | 6 + WatchExample Watch App/WatchExampleApp.swift | 18 + 10 files changed, 954 insertions(+), 1 deletion(-) create mode 100644 VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchKit.xcscheme create mode 100644 VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchSceneKit.xcscheme create mode 100644 WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 WatchExample Watch App/Assets.xcassets/Contents.json create mode 100644 WatchExample Watch App/ContentView.swift create mode 100644 WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 WatchExample Watch App/WatchExampleApp.swift diff --git a/Sources/VRMSceneKit/SceneData.swift b/Sources/VRMSceneKit/SceneData.swift index e96aeae..2f8345d 100644 --- a/Sources/VRMSceneKit/SceneData.swift +++ b/Sources/VRMSceneKit/SceneData.swift @@ -16,8 +16,10 @@ final class SceneData { var cameras: [SCNCamera?] var nodes: [SCNNode?] var skins: [SCNSkinner?] +#if !os(watchOS) var animationChannels: [[CAAnimation?]?] var animationSamplers: [[CAAnimation?]?] +#endif var meshes: [SCNNode?] var accessors: [Any?] var durations: [CFTimeInterval?] @@ -32,8 +34,10 @@ final class SceneData { cameras = Array(repeating: nil, count: vrm.cameras?.count ?? 0) nodes = Array(repeating: nil, count: vrm.nodes?.count ?? 0) skins = Array(repeating: nil, count: vrm.skins?.count ?? 0) +#if !os(watchOS) animationChannels = Array(repeating: nil, count: vrm.animations?.count ?? 0) animationSamplers = Array(repeating: nil, count: vrm.animations?.count ?? 0) +#endif meshes = Array(repeating: nil, count: vrm.meshes?.count ?? 0) accessors = Array(repeating: nil, count: vrm.accessors?.count ?? 0) durations = Array(repeating: nil, count: vrm.accessors?.count ?? 0) diff --git a/VRMKit.xcodeproj/project.pbxproj b/VRMKit.xcodeproj/project.pbxproj index e8e6091..906fedd 100644 --- a/VRMKit.xcodeproj/project.pbxproj +++ b/VRMKit.xcodeproj/project.pbxproj @@ -96,6 +96,84 @@ 37DD503623AD513200A4CEFF /* VRMSpringBoneColliderGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503223AD4D3C00A4CEFF /* VRMSpringBoneColliderGroup.swift */; }; 37DD503723AD515E00A4CEFF /* SCNVector3+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503423AD4FE700A4CEFF /* SCNVector3+.swift */; }; 37DD503923AD535E00A4CEFF /* VRMSpringBone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503823AD535E00A4CEFF /* VRMSpringBone.swift */; }; + 5CED00882AAB5C9E00CE286A /* Color4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7F9A21440488007A5C6C /* Color4.swift */; }; + 5CED00892AAB5C9E00CE286A /* Mesh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FB2214419B0007A5C6C /* Mesh.swift */; }; + 5CED008A2AAB5C9E00CE286A /* VRM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FD6214425AD007A5C6C /* VRM.swift */; }; + 5CED008B2AAB5C9E00CE286A /* Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FC121441DAE007A5C6C /* Asset.swift */; }; + 5CED008C2AAB5C9E00CE286A /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FA821441253007A5C6C /* Image.swift */; }; + 5CED008D2AAB5C9E00CE286A /* Color3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FBB21441C64007A5C6C /* Color3.swift */; }; + 5CED008E2AAB5C9E00CE286A /* BinaryGLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FC921441F6E007A5C6C /* BinaryGLTF.swift */; }; + 5CED008F2AAB5C9E00CE286A /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FBF21441D89007A5C6C /* Buffer.swift */; }; + 5CED00902AAB5C9E00CE286A /* InternalFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FDF2144306A007A5C6C /* InternalFunction.swift */; }; + 5CED00912AAB5C9E00CE286A /* Accessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FC521441DFD007A5C6C /* Accessor.swift */; }; + 5CED00922AAB5C9E00CE286A /* GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7F9E2144088A007A5C6C /* GLTF.swift */; }; + 5CED00932AAB5C9E00CE286A /* Node.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FB0214412CD007A5C6C /* Node.swift */; }; + 5CED00942AAB5C9E00CE286A /* Matrix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FA4214410B4007A5C6C /* Matrix.swift */; }; + 5CED00952AAB5C9E00CE286A /* Skin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FAC21441288007A5C6C /* Skin.swift */; }; + 5CED00962AAB5C9E00CE286A /* BufferView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FBD21441D73007A5C6C /* BufferView.swift */; }; + 5CED00972AAB5C9E00CE286A /* DictionaryDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FDA21442EE5007A5C6C /* DictionaryDecoder.swift */; }; + 5CED00982AAB5C9E00CE286A /* GlobalFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FCB21441FD8007A5C6C /* GlobalFunction.swift */; }; + 5CED00992AAB5C9E00CE286A /* Vector3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FA021440D7E007A5C6C /* Vector3.swift */; }; + 5CED009A2AAB5C9E00CE286A /* Texture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FAE2144129B007A5C6C /* Texture.swift */; }; + 5CED009B2AAB5C9E00CE286A /* TextureInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FB921441BCA007A5C6C /* TextureInfo.swift */; }; + 5CED009C2AAB5C9E00CE286A /* Vector4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FA221440D9A007A5C6C /* Vector4.swift */; }; + 5CED009D2AAB5C9E00CE286A /* Material.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FB721441B89007A5C6C /* Material.swift */; }; + 5CED009E2AAB5C9E00CE286A /* VRMLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725F32146F5E6003AA5D7 /* VRMLoader.swift */; }; + 5CED009F2AAB5C9E00CE286A /* CodableDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FB521441B00007A5C6C /* CodableDictionary.swift */; }; + 5CED00A02AAB5C9E00CE286A /* Camera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FA621441238007A5C6C /* Camera.swift */; }; + 5CED00A12AAB5C9E00CE286A /* CodableAny.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7F962143F0A8007A5C6C /* CodableAny.swift */; }; + 5CED00A22AAB5C9E00CE286A /* VRMError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FCD21442010007A5C6C /* VRMError.swift */; }; + 5CED00A32AAB5C9E00CE286A /* Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FC321441DCE007A5C6C /* Animation.swift */; }; + 5CED00A42AAB5C9E00CE286A /* Sampler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FC721441E6F007A5C6C /* Sampler.swift */; }; + 5CED00A52AAB5C9E00CE286A /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FDD2144300F007A5C6C /* Storage.swift */; }; + 5CED00A62AAB5C9E00CE286A /* Scene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FAA21441276007A5C6C /* Scene.swift */; }; + 5CED00A72AAB5C9E00CE286A /* AnyCodingKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24CF7FE121443087007A5C6C /* AnyCodingKey.swift */; }; + 5CED00A82AAB5C9E00CE286A /* VRMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24EE14942215CE1F00A14305 /* VRMExtension.swift */; }; + 5CED00AB2AAB5C9E00CE286A /* VRMKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 24CF7F7E2143EEDB007A5C6C /* VRMKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5CED00B42AAB5CAD00CE286A /* VRMSpringBoneColliderGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503223AD4D3C00A4CEFF /* VRMSpringBoneColliderGroup.swift */; }; + 5CED00B52AAB5CAD00CE286A /* SCNGeometryElement+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725C32146F207003AA5D7 /* SCNGeometryElement+GLTF.swift */; }; + 5CED00B62AAB5CAD00CE286A /* SCNCamera+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725B92146F185003AA5D7 /* SCNCamera+GLTF.swift */; }; + 5CED00B72AAB5CAD00CE286A /* GLTF+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725FA21481FF9003AA5D7 /* GLTF+.swift */; }; + 5CED00B82AAB5CAD00CE286A /* GLTF2SCN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725B72146F165003AA5D7 /* GLTF2SCN.swift */; }; + 5CED00B92AAB5CAD00CE286A /* SCNMorpher+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 248D3AA4220EBADC00D50019 /* SCNMorpher+GLTF.swift */; }; + 5CED00BA2AAB5CAD00CE286A /* VRMError+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725F821481886003AA5D7 /* VRMError+.swift */; }; + 5CED00BB2AAB5CAD00CE286A /* SCNVector3+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503423AD4FE700A4CEFF /* SCNVector3+.swift */; }; + 5CED00BC2AAB5CAD00CE286A /* Collection+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725D12146F323003AA5D7 /* Collection+.swift */; }; + 5CED00BD2AAB5CAD00CE286A /* SceneKit+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725CD2146F2B4003AA5D7 /* SceneKit+.swift */; }; + 5CED00BE2AAB5CAD00CE286A /* SCNNode+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725C72146F240003AA5D7 /* SCNNode+GLTF.swift */; }; + 5CED00BF2AAB5CAD00CE286A /* Humanoid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCF3322108FE300E4C87F /* Humanoid.swift */; }; + 5CED00C02AAB5CAD00CE286A /* BlendShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCEE3220FF95D00E4C87F /* BlendShape.swift */; }; + 5CED00C12AAB5CAD00CE286A /* SCNMaterialProperty+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725BD2146F1BB003AA5D7 /* SCNMaterialProperty+GLTF.swift */; }; + 5CED00C22AAB5CAD00CE286A /* SceneData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725B12146F0F2003AA5D7 /* SceneData.swift */; }; + 5CED00C32AAB5CAD00CE286A /* InverseBindMatrix+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCF35221096A600E4C87F /* InverseBindMatrix+GLTF.swift */; }; + 5CED00C42AAB5CAD00CE286A /* Timer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3719EF3B23B7E55300BA5067 /* Timer.swift */; }; + 5CED00C52AAB5CAD00CE286A /* Data+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725C12146F1EE003AA5D7 /* Data+GLTF.swift */; }; + 5CED00C62AAB5CAD00CE286A /* RenderUpdatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3719EF3823B7E3CA00BA5067 /* RenderUpdatable.swift */; }; + 5CED00C72AAB5CAD00CE286A /* GlobalFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725CB2146F28B003AA5D7 /* GlobalFunction.swift */; }; + 5CED00C82AAB5CAD00CE286A /* VRMSceneLoader+convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725F52146FABE003AA5D7 /* VRMSceneLoader+convenience.swift */; }; + 5CED00C92AAB5CAD00CE286A /* SCNMaterial+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725BF2146F1D7003AA5D7 /* SCNMaterial+GLTF.swift */; }; + 5CED00CA2AAB5CAD00CE286A /* VRMSceneLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725AF2146F0BC003AA5D7 /* VRMSceneLoader.swift */; }; + 5CED00CB2AAB5CAD00CE286A /* VRMNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCF4E22115FA000E4C87F /* VRMNode.swift */; }; + 5CED00CC2AAB5CAD00CE286A /* VRMScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCF50221160E600E4C87F /* VRMScene.swift */; }; + 5CED00CD2AAB5CAD00CE286A /* SCNSkinner+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247DCF372210A1F100E4C87F /* SCNSkinner+GLTF.swift */; }; + 5CED00CE2AAB5CAD00CE286A /* SCNNode+UnityTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3755420323B74D8B00D81B4D /* SCNNode+UnityTransform.swift */; }; + 5CED00CF2AAB5CAD00CE286A /* UIImage+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725BB2146F19D003AA5D7 /* UIImage+GLTF.swift */; }; + 5CED00D02AAB5CAD00CE286A /* SCNGeometrySource+GLTF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725C52146F224003AA5D7 /* SCNGeometrySource+GLTF.swift */; }; + 5CED00D12AAB5CAD00CE286A /* simd+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3733358323F898D400EC746D /* simd+.swift */; }; + 5CED00D22AAB5CAD00CE286A /* VRMSpringBone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DD503823AD535E00A4CEFF /* VRMSpringBone.swift */; }; + 5CED00D62AAB5CAD00CE286A /* VRMSceneKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 245725952146EF99003AA5D7 /* VRMSceneKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5CED00DD2AAB5FD400CE286A /* VRMWatchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */; }; + 5CED00DE2AAB5FD400CE286A /* VRMWatchKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5CED00EA2AAB62CD00CE286A /* WatchExample Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 5CED00E92AAB62CD00CE286A /* WatchExample Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 5CED00EF2AAB62CE00CE286A /* WatchExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CED00EE2AAB62CE00CE286A /* WatchExampleApp.swift */; }; + 5CED00F12AAB62CE00CE286A /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CED00F02AAB62CE00CE286A /* ContentView.swift */; }; + 5CED00F32AAB62CE00CE286A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5CED00F22AAB62CE00CE286A /* Assets.xcassets */; }; + 5CED00F62AAB62CE00CE286A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5CED00F52AAB62CE00CE286A /* Preview Assets.xcassets */; }; + 5CED00FE2AAB644300CE286A /* VRMWatchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */; }; + 5CED00FF2AAB644300CE286A /* VRMWatchKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5CED01022AAB644300CE286A /* VRMWatchSceneKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00DB2AAB5CAD00CE286A /* VRMWatchSceneKit.framework */; }; + 5CED01032AAB644300CE286A /* VRMWatchSceneKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5CED00DB2AAB5CAD00CE286A /* VRMWatchSceneKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 5CED01072AAB65DB00CE286A /* AliciaSolid.vrm in Resources */ = {isa = PBXBuildFile; fileRef = 24CF7FD121442111007A5C6C /* AliciaSolid.vrm */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -127,6 +205,34 @@ remoteGlobalIDString = 24CF7F7A2143EEDB007A5C6C; remoteInfo = VRMKit; }; + 5CED00DF2AAB5FD400CE286A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 24CF7F722143EEDB007A5C6C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5CED00862AAB5C9E00CE286A; + remoteInfo = VRMWatchKit; + }; + 5CED00EB2AAB62CD00CE286A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 24CF7F722143EEDB007A5C6C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5CED00E82AAB62CD00CE286A; + remoteInfo = "WatchExample Watch App"; + }; + 5CED01002AAB644300CE286A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 24CF7F722143EEDB007A5C6C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5CED00862AAB5C9E00CE286A; + remoteInfo = VRMWatchKit; + }; + 5CED01042AAB644300CE286A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 24CF7F722143EEDB007A5C6C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5CED00B22AAB5CAD00CE286A; + remoteInfo = VRMWatchSceneKit; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -142,6 +248,40 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; + 5CED00E12AAB5FD400CE286A /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 5CED00DE2AAB5FD400CE286A /* VRMWatchKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00FA2AAB62CE00CE286A /* Embed Watch Content */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; + dstSubfolderSpec = 16; + files = ( + 5CED00EA2AAB62CD00CE286A /* WatchExample Watch App.app in Embed Watch Content */, + ); + name = "Embed Watch Content"; + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED01062AAB644300CE286A /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 5CED01032AAB644300CE286A /* VRMWatchSceneKit.framework in Embed Frameworks */, + 5CED00FF2AAB644300CE286A /* VRMWatchKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -236,6 +376,14 @@ 37DD503223AD4D3C00A4CEFF /* VRMSpringBoneColliderGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VRMSpringBoneColliderGroup.swift; sourceTree = ""; }; 37DD503423AD4FE700A4CEFF /* SCNVector3+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SCNVector3+.swift"; sourceTree = ""; }; 37DD503823AD535E00A4CEFF /* VRMSpringBone.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VRMSpringBone.swift; sourceTree = ""; }; + 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VRMWatchKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5CED00DB2AAB5CAD00CE286A /* VRMWatchSceneKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VRMWatchSceneKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5CED00E42AAB62CD00CE286A /* WatchExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WatchExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5CED00E92AAB62CD00CE286A /* WatchExample Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "WatchExample Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 5CED00EE2AAB62CE00CE286A /* WatchExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchExampleApp.swift; sourceTree = ""; }; + 5CED00F02AAB62CE00CE286A /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 5CED00F22AAB62CE00CE286A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 5CED00F52AAB62CE00CE286A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -279,6 +427,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5CED00A92AAB5C9E00CE286A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00D32AAB5CAD00CE286A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00DD2AAB5FD400CE286A /* VRMWatchKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00E62AAB62CD00CE286A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED01022AAB644300CE286A /* VRMWatchSceneKit.framework in Frameworks */, + 5CED00FE2AAB644300CE286A /* VRMWatchKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -409,6 +581,7 @@ 24CF7F7D2143EEDB007A5C6C /* Sources */, 24CF7F882143EEDB007A5C6C /* Tests */, 245725D82146F47A003AA5D7 /* Example */, + 5CED00ED2AAB62CE00CE286A /* WatchExample Watch App */, 24CF7F7C2143EEDB007A5C6C /* Products */, 245725AD2146F09C003AA5D7 /* Frameworks */, ); @@ -422,6 +595,10 @@ 245725932146EF99003AA5D7 /* VRMSceneKit.framework */, 2457259B2146EF99003AA5D7 /* VRMSceneKitTests.xctest */, 245725D72146F47A003AA5D7 /* VRMExample.app */, + 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */, + 5CED00DB2AAB5CAD00CE286A /* VRMWatchSceneKit.framework */, + 5CED00E42AAB62CD00CE286A /* WatchExample.app */, + 5CED00E92AAB62CD00CE286A /* WatchExample Watch App.app */, ); name = Products; sourceTree = ""; @@ -515,6 +692,25 @@ path = Helper; sourceTree = ""; }; + 5CED00ED2AAB62CE00CE286A /* WatchExample Watch App */ = { + isa = PBXGroup; + children = ( + 5CED00EE2AAB62CE00CE286A /* WatchExampleApp.swift */, + 5CED00F02AAB62CE00CE286A /* ContentView.swift */, + 5CED00F22AAB62CE00CE286A /* Assets.xcassets */, + 5CED00F42AAB62CE00CE286A /* Preview Content */, + ); + path = "WatchExample Watch App"; + sourceTree = ""; + }; + 5CED00F42AAB62CE00CE286A /* Preview Content */ = { + isa = PBXGroup; + children = ( + 5CED00F52AAB62CE00CE286A /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -534,6 +730,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5CED00AA2AAB5C9E00CE286A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00AB2AAB5C9E00CE286A /* VRMKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00D52AAB5CAD00CE286A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00D62AAB5CAD00CE286A /* VRMSceneKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -629,13 +841,88 @@ productReference = 24CF7F842143EEDB007A5C6C /* VRMKitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 5CED00862AAB5C9E00CE286A /* VRMWatchKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5CED00AD2AAB5C9E00CE286A /* Build configuration list for PBXNativeTarget "VRMWatchKit" */; + buildPhases = ( + 5CED00872AAB5C9E00CE286A /* Sources */, + 5CED00A92AAB5C9E00CE286A /* Frameworks */, + 5CED00AA2AAB5C9E00CE286A /* Headers */, + 5CED00AC2AAB5C9E00CE286A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = VRMWatchKit; + productName = VRMKit; + productReference = 5CED00B02AAB5C9E00CE286A /* VRMWatchKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 5CED00B22AAB5CAD00CE286A /* VRMWatchSceneKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5CED00D82AAB5CAD00CE286A /* Build configuration list for PBXNativeTarget "VRMWatchSceneKit" */; + buildPhases = ( + 5CED00B32AAB5CAD00CE286A /* Sources */, + 5CED00D32AAB5CAD00CE286A /* Frameworks */, + 5CED00D52AAB5CAD00CE286A /* Headers */, + 5CED00D72AAB5CAD00CE286A /* Resources */, + 5CED00E12AAB5FD400CE286A /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 5CED00E02AAB5FD400CE286A /* PBXTargetDependency */, + ); + name = VRMWatchSceneKit; + productName = VRMSceneKit; + productReference = 5CED00DB2AAB5CAD00CE286A /* VRMWatchSceneKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 5CED00E32AAB62CD00CE286A /* WatchExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5CED00FB2AAB62CE00CE286A /* Build configuration list for PBXNativeTarget "WatchExample" */; + buildPhases = ( + 5CED00E22AAB62CD00CE286A /* Resources */, + 5CED00FA2AAB62CE00CE286A /* Embed Watch Content */, + ); + buildRules = ( + ); + dependencies = ( + 5CED00EC2AAB62CD00CE286A /* PBXTargetDependency */, + ); + name = WatchExample; + productName = WatchExample; + productReference = 5CED00E42AAB62CD00CE286A /* WatchExample.app */; + productType = "com.apple.product-type.application.watchapp2-container"; + }; + 5CED00E82AAB62CD00CE286A /* WatchExample Watch App */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5CED00F72AAB62CE00CE286A /* Build configuration list for PBXNativeTarget "WatchExample Watch App" */; + buildPhases = ( + 5CED00E52AAB62CD00CE286A /* Sources */, + 5CED00E62AAB62CD00CE286A /* Frameworks */, + 5CED00E72AAB62CD00CE286A /* Resources */, + 5CED01062AAB644300CE286A /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 5CED01012AAB644300CE286A /* PBXTargetDependency */, + 5CED01052AAB644300CE286A /* PBXTargetDependency */, + ); + name = "WatchExample Watch App"; + productName = "WatchExample Watch App"; + productReference = 5CED00E92AAB62CD00CE286A /* WatchExample Watch App.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 24CF7F722143EEDB007A5C6C /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0940; + LastSwiftUpdateCheck = 1430; LastUpgradeCheck = 1240; ORGANIZATIONNAME = tattn; TargetAttributes = { @@ -659,6 +946,12 @@ CreatedOnToolsVersion = 9.4.1; LastSwiftMigration = 1020; }; + 5CED00E32AAB62CD00CE286A = { + CreatedOnToolsVersion = 14.3.1; + }; + 5CED00E82AAB62CD00CE286A = { + CreatedOnToolsVersion = 14.3.1; + }; }; }; buildConfigurationList = 24CF7F752143EEDB007A5C6C /* Build configuration list for PBXProject "VRMKit" */; @@ -679,6 +972,10 @@ 245725922146EF99003AA5D7 /* VRMSceneKit */, 2457259A2146EF99003AA5D7 /* VRMSceneKitTests */, 245725D62146F47A003AA5D7 /* VRMExample */, + 5CED00862AAB5C9E00CE286A /* VRMWatchKit */, + 5CED00B22AAB5CAD00CE286A /* VRMWatchSceneKit */, + 5CED00E32AAB62CD00CE286A /* WatchExample */, + 5CED00E82AAB62CD00CE286A /* WatchExample Watch App */, ); }; /* End PBXProject section */ @@ -725,6 +1022,37 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5CED00AC2AAB5C9E00CE286A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00D72AAB5CAD00CE286A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00E22AAB62CD00CE286A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00E72AAB62CD00CE286A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED01072AAB65DB00CE286A /* AliciaSolid.vrm in Resources */, + 5CED00F62AAB62CE00CE286A /* Preview Assets.xcassets in Resources */, + 5CED00F32AAB62CE00CE286A /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -837,6 +1165,93 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5CED00872AAB5C9E00CE286A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00882AAB5C9E00CE286A /* Color4.swift in Sources */, + 5CED00892AAB5C9E00CE286A /* Mesh.swift in Sources */, + 5CED008A2AAB5C9E00CE286A /* VRM.swift in Sources */, + 5CED008B2AAB5C9E00CE286A /* Asset.swift in Sources */, + 5CED008C2AAB5C9E00CE286A /* Image.swift in Sources */, + 5CED008D2AAB5C9E00CE286A /* Color3.swift in Sources */, + 5CED008E2AAB5C9E00CE286A /* BinaryGLTF.swift in Sources */, + 5CED008F2AAB5C9E00CE286A /* Buffer.swift in Sources */, + 5CED00902AAB5C9E00CE286A /* InternalFunction.swift in Sources */, + 5CED00912AAB5C9E00CE286A /* Accessor.swift in Sources */, + 5CED00922AAB5C9E00CE286A /* GLTF.swift in Sources */, + 5CED00932AAB5C9E00CE286A /* Node.swift in Sources */, + 5CED00942AAB5C9E00CE286A /* Matrix.swift in Sources */, + 5CED00952AAB5C9E00CE286A /* Skin.swift in Sources */, + 5CED00962AAB5C9E00CE286A /* BufferView.swift in Sources */, + 5CED00972AAB5C9E00CE286A /* DictionaryDecoder.swift in Sources */, + 5CED00982AAB5C9E00CE286A /* GlobalFunction.swift in Sources */, + 5CED00992AAB5C9E00CE286A /* Vector3.swift in Sources */, + 5CED009A2AAB5C9E00CE286A /* Texture.swift in Sources */, + 5CED009B2AAB5C9E00CE286A /* TextureInfo.swift in Sources */, + 5CED009C2AAB5C9E00CE286A /* Vector4.swift in Sources */, + 5CED009D2AAB5C9E00CE286A /* Material.swift in Sources */, + 5CED009E2AAB5C9E00CE286A /* VRMLoader.swift in Sources */, + 5CED009F2AAB5C9E00CE286A /* CodableDictionary.swift in Sources */, + 5CED00A02AAB5C9E00CE286A /* Camera.swift in Sources */, + 5CED00A12AAB5C9E00CE286A /* CodableAny.swift in Sources */, + 5CED00A22AAB5C9E00CE286A /* VRMError.swift in Sources */, + 5CED00A32AAB5C9E00CE286A /* Animation.swift in Sources */, + 5CED00A42AAB5C9E00CE286A /* Sampler.swift in Sources */, + 5CED00A52AAB5C9E00CE286A /* Storage.swift in Sources */, + 5CED00A62AAB5C9E00CE286A /* Scene.swift in Sources */, + 5CED00A72AAB5C9E00CE286A /* AnyCodingKey.swift in Sources */, + 5CED00A82AAB5C9E00CE286A /* VRMExtension.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00B32AAB5CAD00CE286A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00B42AAB5CAD00CE286A /* VRMSpringBoneColliderGroup.swift in Sources */, + 5CED00B52AAB5CAD00CE286A /* SCNGeometryElement+GLTF.swift in Sources */, + 5CED00B62AAB5CAD00CE286A /* SCNCamera+GLTF.swift in Sources */, + 5CED00B72AAB5CAD00CE286A /* GLTF+.swift in Sources */, + 5CED00B82AAB5CAD00CE286A /* GLTF2SCN.swift in Sources */, + 5CED00B92AAB5CAD00CE286A /* SCNMorpher+GLTF.swift in Sources */, + 5CED00BA2AAB5CAD00CE286A /* VRMError+.swift in Sources */, + 5CED00BB2AAB5CAD00CE286A /* SCNVector3+.swift in Sources */, + 5CED00BC2AAB5CAD00CE286A /* Collection+.swift in Sources */, + 5CED00BD2AAB5CAD00CE286A /* SceneKit+.swift in Sources */, + 5CED00BE2AAB5CAD00CE286A /* SCNNode+GLTF.swift in Sources */, + 5CED00BF2AAB5CAD00CE286A /* Humanoid.swift in Sources */, + 5CED00C02AAB5CAD00CE286A /* BlendShape.swift in Sources */, + 5CED00C12AAB5CAD00CE286A /* SCNMaterialProperty+GLTF.swift in Sources */, + 5CED00C22AAB5CAD00CE286A /* SceneData.swift in Sources */, + 5CED00C32AAB5CAD00CE286A /* InverseBindMatrix+GLTF.swift in Sources */, + 5CED00C42AAB5CAD00CE286A /* Timer.swift in Sources */, + 5CED00C52AAB5CAD00CE286A /* Data+GLTF.swift in Sources */, + 5CED00C62AAB5CAD00CE286A /* RenderUpdatable.swift in Sources */, + 5CED00C72AAB5CAD00CE286A /* GlobalFunction.swift in Sources */, + 5CED00C82AAB5CAD00CE286A /* VRMSceneLoader+convenience.swift in Sources */, + 5CED00C92AAB5CAD00CE286A /* SCNMaterial+GLTF.swift in Sources */, + 5CED00CA2AAB5CAD00CE286A /* VRMSceneLoader.swift in Sources */, + 5CED00CB2AAB5CAD00CE286A /* VRMNode.swift in Sources */, + 5CED00CC2AAB5CAD00CE286A /* VRMScene.swift in Sources */, + 5CED00CD2AAB5CAD00CE286A /* SCNSkinner+GLTF.swift in Sources */, + 5CED00CE2AAB5CAD00CE286A /* SCNNode+UnityTransform.swift in Sources */, + 5CED00CF2AAB5CAD00CE286A /* UIImage+GLTF.swift in Sources */, + 5CED00D02AAB5CAD00CE286A /* SCNGeometrySource+GLTF.swift in Sources */, + 5CED00D12AAB5CAD00CE286A /* simd+.swift in Sources */, + 5CED00D22AAB5CAD00CE286A /* VRMSpringBone.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5CED00E52AAB62CD00CE286A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5CED00F12AAB62CE00CE286A /* ContentView.swift in Sources */, + 5CED00EF2AAB62CE00CE286A /* WatchExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -860,6 +1275,26 @@ target = 24CF7F7A2143EEDB007A5C6C /* VRMKit */; targetProxy = 24CF7F862143EEDB007A5C6C /* PBXContainerItemProxy */; }; + 5CED00E02AAB5FD400CE286A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5CED00862AAB5C9E00CE286A /* VRMWatchKit */; + targetProxy = 5CED00DF2AAB5FD400CE286A /* PBXContainerItemProxy */; + }; + 5CED00EC2AAB62CD00CE286A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5CED00E82AAB62CD00CE286A /* WatchExample Watch App */; + targetProxy = 5CED00EB2AAB62CD00CE286A /* PBXContainerItemProxy */; + }; + 5CED01012AAB644300CE286A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5CED00862AAB5C9E00CE286A /* VRMWatchKit */; + targetProxy = 5CED01002AAB644300CE286A /* PBXContainerItemProxy */; + }; + 5CED01052AAB644300CE286A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5CED00B22AAB5CAD00CE286A /* VRMWatchSceneKit */; + targetProxy = 5CED01042AAB644300CE286A /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -1218,6 +1653,216 @@ }; name = Release; }; + 5CED00AE2AAB5C9E00CE286A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Sources/VRMKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "watchos watchsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Debug; + }; + 5CED00AF2AAB5C9E00CE286A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Sources/VRMKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "watchos watchsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Release; + }; + 5CED00D92AAB5CAD00CE286A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Sources/VRMSceneKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMSceneKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "watchos watchsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Debug; + }; + 5CED00DA2AAB5CAD00CE286A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Sources/VRMSceneKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMSceneKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "watchos watchsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Release; + }; + 5CED00F82AAB62CE00CE286A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"WatchExample Watch App/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKWatchOnly = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.WatchExample.WatchExample.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 9.4; + }; + name = Debug; + }; + 5CED00F92AAB62CE00CE286A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"WatchExample Watch App/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKWatchOnly = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.WatchExample.WatchExample.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 9.4; + }; + name = Release; + }; + 5CED00FC2AAB62CE00CE286A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.WatchExample.WatchExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 5CED00FD2AAB62CE00CE286A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.WatchExample.WatchExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1275,6 +1920,42 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 5CED00AD2AAB5C9E00CE286A /* Build configuration list for PBXNativeTarget "VRMWatchKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5CED00AE2AAB5C9E00CE286A /* Debug */, + 5CED00AF2AAB5C9E00CE286A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5CED00D82AAB5CAD00CE286A /* Build configuration list for PBXNativeTarget "VRMWatchSceneKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5CED00D92AAB5CAD00CE286A /* Debug */, + 5CED00DA2AAB5CAD00CE286A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5CED00F72AAB62CE00CE286A /* Build configuration list for PBXNativeTarget "WatchExample Watch App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5CED00F82AAB62CE00CE286A /* Debug */, + 5CED00F92AAB62CE00CE286A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5CED00FB2AAB62CE00CE286A /* Build configuration list for PBXNativeTarget "WatchExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5CED00FC2AAB62CE00CE286A /* Debug */, + 5CED00FD2AAB62CE00CE286A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 24CF7F722143EEDB007A5C6C /* Project object */; diff --git a/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchKit.xcscheme b/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchKit.xcscheme new file mode 100644 index 0000000..81eaa63 --- /dev/null +++ b/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchKit.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchSceneKit.xcscheme b/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchSceneKit.xcscheme new file mode 100644 index 0000000..0591cf9 --- /dev/null +++ b/VRMKit.xcodeproj/xcshareddata/xcschemes/VRMWatchSceneKit.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json b/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json b/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..49c81cd --- /dev/null +++ b/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "watchos", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchExample Watch App/Assets.xcassets/Contents.json b/WatchExample Watch App/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/WatchExample Watch App/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchExample Watch App/ContentView.swift b/WatchExample Watch App/ContentView.swift new file mode 100644 index 0000000..7ae57d1 --- /dev/null +++ b/WatchExample Watch App/ContentView.swift @@ -0,0 +1,82 @@ +// +// ContentView.swift +// WatchExample Watch App +// +// Created by Naoto Komiya on 2023/09/08. +// Copyright © 2023 tattn. All rights reserved. +// + +// +// ContentView.swift +// WatchSample Watch App +// +// Created by Naoto Komiya on 2023/09/05. +// Copyright © 2023 tattn. All rights reserved. +// + +import SwiftUI +import SceneKit +import VRMWatchKit +import VRMWatchSceneKit + +class Renderer : NSObject, SCNSceneRendererDelegate { + func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { + (renderer.scene as! VRMScene).vrmNode.update(at: time) + } +} + +struct ContentView: View { + var scene: VRMScene? + var renderer: Renderer = Renderer() + + private func setupScene(_ scene: SCNScene) { + let cameraNode = SCNNode() + cameraNode.camera = SCNCamera() + cameraNode.camera?.automaticallyAdjustsZRange = true + scene.rootNode.addChildNode(cameraNode) + + cameraNode.position = SCNVector3(0, 1.4, -0.4) + cameraNode.rotation = SCNVector4(0, 1, 0, Float.pi) + } + + init() { + do { + let loader = try VRMSceneLoader(named: "AliciaSolid.vrm") + scene = try loader.loadScene() + if(scene != nil) { + setupScene(scene!) + let node = scene!.vrmNode + node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180) + node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180) + + node.runAction(SCNAction.repeatForever(SCNAction.sequence([ + SCNAction.wait(duration: 3.0), + SCNAction.customAction(duration: 0.5, action: {(node, time)->Void in + let vrmNode = node as! VRMNode + return vrmNode.setBlendShape(value: time/0.5, for: .preset(.blink)) + }), + SCNAction.customAction(duration: 0.5, action: {(node, time)->Void in + let vrmNode = node as! VRMNode + return vrmNode.setBlendShape(value: 1.0-time/0.5, for: .preset(.blink)) + }), + ]))) + } + } catch { + print(error) + } + } + + var body: some View { + VStack { + SceneView(scene: scene, delegate: renderer).padding(.vertical,-45) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json b/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WatchExample Watch App/WatchExampleApp.swift b/WatchExample Watch App/WatchExampleApp.swift new file mode 100644 index 0000000..c0fe907 --- /dev/null +++ b/WatchExample Watch App/WatchExampleApp.swift @@ -0,0 +1,18 @@ +// +// WatchExampleApp.swift +// WatchExample Watch App +// +// Created by Naoto Komiya on 2023/09/08. +// Copyright © 2023 tattn. All rights reserved. +// + +import SwiftUI + +@main +struct WatchExample_Watch_AppApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} From 92182cb53d4901c3700532f5074e1c6b300ac11f Mon Sep 17 00:00:00 2001 From: "tattn (Tatsuya Tanaka)" Date: Sun, 10 Sep 2023 13:52:14 +0900 Subject: [PATCH 2/5] Move to the new project struct --- .../xcshareddata/xcschemes/VRMKit.xcscheme | 47 +--- .../xcschemes/VRMSceneKit.xcscheme | 47 +--- Example/Example.xcodeproj/project.pbxproj | 202 +++++++++++++++++- .../xcschemes/VRMExample.xcscheme | 77 +++++++ .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../WatchExample Watch App}/ContentView.swift | 22 +- .../Preview Assets.xcassets/Contents.json | 0 .../WatchExampleApp.swift | 0 Package.swift | 2 +- Sources/VRMSceneKit/SceneData.swift | 2 +- 12 files changed, 305 insertions(+), 94 deletions(-) rename {Example/Example.xcodeproj => .swiftpm/xcode}/xcshareddata/xcschemes/VRMKit.xcscheme (54%) rename {Example/Example.xcodeproj => .swiftpm/xcode}/xcshareddata/xcschemes/VRMSceneKit.xcscheme (54%) create mode 100644 Example/Example.xcodeproj/xcshareddata/xcschemes/VRMExample.xcscheme rename {WatchExample Watch App => Example/WatchExample Watch App}/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename {WatchExample Watch App => Example/WatchExample Watch App}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {WatchExample Watch App => Example/WatchExample Watch App}/Assets.xcassets/Contents.json (100%) rename {WatchExample Watch App => Example/WatchExample Watch App}/ContentView.swift (91%) rename {WatchExample Watch App => Example/WatchExample Watch App}/Preview Content/Preview Assets.xcassets/Contents.json (100%) rename {WatchExample Watch App => Example/WatchExample Watch App}/WatchExampleApp.swift (100%) diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMKit.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/VRMKit.xcscheme similarity index 54% rename from Example/Example.xcodeproj/xcshareddata/xcschemes/VRMKit.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/VRMKit.xcscheme index 2832546..3c9bebf 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMKit.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/VRMKit.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -14,10 +14,10 @@ buildForAnalyzing = "YES"> + ReferencedContainer = "container:"> @@ -26,28 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> - - - - + ReferencedContainer = "container:"> diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMSceneKit.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/VRMSceneKit.xcscheme similarity index 54% rename from Example/Example.xcodeproj/xcshareddata/xcschemes/VRMSceneKit.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/VRMSceneKit.xcscheme index 389bc9c..fb3a3af 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMSceneKit.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/VRMSceneKit.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -14,10 +14,10 @@ buildForAnalyzing = "YES"> + ReferencedContainer = "container:"> @@ -26,28 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> - - - - + ReferencedContainer = "container:"> diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 46f9674..5259f6e 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -10,6 +10,14 @@ 067C5C502AAD6D8B00F8FBB3 /* VRMKit in Frameworks */ = {isa = PBXBuildFile; productRef = 067C5C4F2AAD6D8B00F8FBB3 /* VRMKit */; }; 067C5C522AAD6D8B00F8FBB3 /* VRMSceneKit in Frameworks */ = {isa = PBXBuildFile; productRef = 067C5C512AAD6D8B00F8FBB3 /* VRMSceneKit */; }; 067C5C542AAD6EC600F8FBB3 /* AliciaSolid.vrm in Resources */ = {isa = PBXBuildFile; fileRef = 067C5C532AAD6EC600F8FBB3 /* AliciaSolid.vrm */; }; + 06F0BD6F2AAD81A30089488C /* WatchExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F0BD6E2AAD81A30089488C /* WatchExampleApp.swift */; }; + 06F0BD712AAD81A30089488C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F0BD702AAD81A30089488C /* ContentView.swift */; }; + 06F0BD732AAD81A40089488C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 06F0BD722AAD81A40089488C /* Assets.xcassets */; }; + 06F0BD762AAD81A40089488C /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 06F0BD752AAD81A40089488C /* Preview Assets.xcassets */; }; + 06F0BD792AAD81A40089488C /* WatchExample Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 06F0BD6C2AAD81A30089488C /* WatchExample Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 06F0BD7F2AAD82120089488C /* VRMKit in Frameworks */ = {isa = PBXBuildFile; productRef = 06F0BD7E2AAD82120089488C /* VRMKit */; }; + 06F0BD812AAD82120089488C /* VRMSceneKit in Frameworks */ = {isa = PBXBuildFile; productRef = 06F0BD802AAD82120089488C /* VRMSceneKit */; }; + 06F0BD822AAD82B00089488C /* AliciaSolid.vrm in Resources */ = {isa = PBXBuildFile; fileRef = 067C5C532AAD6EC600F8FBB3 /* AliciaSolid.vrm */; }; 245725DA2146F47A003AA5D7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725D92146F47A003AA5D7 /* AppDelegate.swift */; }; 245725DC2146F47A003AA5D7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725DB2146F47A003AA5D7 /* ViewController.swift */; }; 245725DF2146F47B003AA5D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 245725DD2146F47B003AA5D7 /* Main.storyboard */; }; @@ -17,7 +25,28 @@ 245725E42146F47D003AA5D7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 245725E22146F47D003AA5D7 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 06F0BD772AAD81A40089488C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 24CF7F722143EEDB007A5C6C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 06F0BD6B2AAD81A30089488C; + remoteInfo = "WatchExample Watch App"; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ + 06F0BD7A2AAD81A40089488C /* Embed Watch Content */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; + dstSubfolderSpec = 16; + files = ( + 06F0BD792AAD81A40089488C /* WatchExample Watch App.app in Embed Watch Content */, + ); + name = "Embed Watch Content"; + runOnlyForDeploymentPostprocessing = 0; + }; 245725F12146F496003AA5D7 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -33,6 +62,11 @@ /* Begin PBXFileReference section */ 067C5C4E2AAD6D7700F8FBB3 /* VRMKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = VRMKit; path = ..; sourceTree = ""; }; 067C5C532AAD6EC600F8FBB3 /* AliciaSolid.vrm */ = {isa = PBXFileReference; lastKnownFileType = file; name = AliciaSolid.vrm; path = ../../Tests/VRMKitTests/Assets/AliciaSolid.vrm; sourceTree = ""; }; + 06F0BD6C2AAD81A30089488C /* WatchExample Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "WatchExample Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 06F0BD6E2AAD81A30089488C /* WatchExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchExampleApp.swift; sourceTree = ""; }; + 06F0BD702AAD81A30089488C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 06F0BD722AAD81A40089488C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 06F0BD752AAD81A40089488C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 245725D72146F47A003AA5D7 /* VRMExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VRMExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 245725D92146F47A003AA5D7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 245725DB2146F47A003AA5D7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -43,6 +77,15 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 06F0BD692AAD81A30089488C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F0BD812AAD82120089488C /* VRMSceneKit in Frameworks */, + 06F0BD7F2AAD82120089488C /* VRMKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 245725D42146F47A003AA5D7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -63,6 +106,25 @@ name = Packages; sourceTree = ""; }; + 06F0BD6D2AAD81A30089488C /* WatchExample Watch App */ = { + isa = PBXGroup; + children = ( + 06F0BD6E2AAD81A30089488C /* WatchExampleApp.swift */, + 06F0BD702AAD81A30089488C /* ContentView.swift */, + 06F0BD722AAD81A40089488C /* Assets.xcassets */, + 06F0BD742AAD81A40089488C /* Preview Content */, + ); + path = "WatchExample Watch App"; + sourceTree = ""; + }; + 06F0BD742AAD81A40089488C /* Preview Content */ = { + isa = PBXGroup; + children = ( + 06F0BD752AAD81A40089488C /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; 245725AD2146F09C003AA5D7 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -89,6 +151,7 @@ children = ( 067C5C4D2AAD6D7700F8FBB3 /* Packages */, 245725D82146F47A003AA5D7 /* Example */, + 06F0BD6D2AAD81A30089488C /* WatchExample Watch App */, 24CF7F7C2143EEDB007A5C6C /* Products */, 245725AD2146F09C003AA5D7 /* Frameworks */, ); @@ -98,6 +161,7 @@ isa = PBXGroup; children = ( 245725D72146F47A003AA5D7 /* VRMExample.app */, + 06F0BD6C2AAD81A30089488C /* WatchExample Watch App.app */, ); name = Products; sourceTree = ""; @@ -105,6 +169,27 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 06F0BD6B2AAD81A30089488C /* WatchExample Watch App */ = { + isa = PBXNativeTarget; + buildConfigurationList = 06F0BD7D2AAD81A40089488C /* Build configuration list for PBXNativeTarget "WatchExample Watch App" */; + buildPhases = ( + 06F0BD682AAD81A30089488C /* Sources */, + 06F0BD692AAD81A30089488C /* Frameworks */, + 06F0BD6A2AAD81A30089488C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "WatchExample Watch App"; + packageProductDependencies = ( + 06F0BD7E2AAD82120089488C /* VRMKit */, + 06F0BD802AAD82120089488C /* VRMSceneKit */, + ); + productName = "WatchExample Watch App"; + productReference = 06F0BD6C2AAD81A30089488C /* WatchExample Watch App.app */; + productType = "com.apple.product-type.application"; + }; 245725D62146F47A003AA5D7 /* VRMExample */ = { isa = PBXNativeTarget; buildConfigurationList = 245725E62146F47D003AA5D7 /* Build configuration list for PBXNativeTarget "VRMExample" */; @@ -113,10 +198,12 @@ 245725D42146F47A003AA5D7 /* Frameworks */, 245725D52146F47A003AA5D7 /* Resources */, 245725F12146F496003AA5D7 /* Embed Frameworks */, + 06F0BD7A2AAD81A40089488C /* Embed Watch Content */, ); buildRules = ( ); dependencies = ( + 06F0BD782AAD81A40089488C /* PBXTargetDependency */, ); name = VRMExample; packageProductDependencies = ( @@ -134,10 +221,13 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastSwiftUpdateCheck = 0940; + LastSwiftUpdateCheck = 1430; LastUpgradeCheck = 1430; ORGANIZATIONNAME = tattn; TargetAttributes = { + 06F0BD6B2AAD81A30089488C = { + CreatedOnToolsVersion = 14.3.1; + }; 245725D62146F47A003AA5D7 = { CreatedOnToolsVersion = 9.4.1; LastSwiftMigration = 1020; @@ -158,11 +248,22 @@ projectRoot = ""; targets = ( 245725D62146F47A003AA5D7 /* VRMExample */, + 06F0BD6B2AAD81A30089488C /* WatchExample Watch App */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 06F0BD6A2AAD81A30089488C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F0BD762AAD81A40089488C /* Preview Assets.xcassets in Resources */, + 06F0BD822AAD82B00089488C /* AliciaSolid.vrm in Resources */, + 06F0BD732AAD81A40089488C /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 245725D52146F47A003AA5D7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -177,6 +278,15 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 06F0BD682AAD81A30089488C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F0BD712AAD81A30089488C /* ContentView.swift in Sources */, + 06F0BD6F2AAD81A30089488C /* WatchExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 245725D32146F47A003AA5D7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -188,6 +298,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 06F0BD782AAD81A40089488C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 06F0BD6B2AAD81A30089488C /* WatchExample Watch App */; + targetProxy = 06F0BD772AAD81A40089488C /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 245725DD2146F47B003AA5D7 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -208,6 +326,69 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 06F0BD7B2AAD81A40089488C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"WatchExample Watch App/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = com.github.tattn.VRMExample; + INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMExample.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Debug; + }; + 06F0BD7C2AAD81A40089488C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"WatchExample Watch App/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = WatchExample; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = com.github.tattn.VRMExample; + INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.github.tattn.VRMExample.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Release; + }; 245725E72146F47D003AA5D7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -306,6 +487,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 8.0; }; name = Debug; }; @@ -365,12 +547,22 @@ VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 8.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 06F0BD7D2AAD81A40089488C /* Build configuration list for PBXNativeTarget "WatchExample Watch App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06F0BD7B2AAD81A40089488C /* Debug */, + 06F0BD7C2AAD81A40089488C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 245725E62146F47D003AA5D7 /* Build configuration list for PBXNativeTarget "VRMExample" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -400,6 +592,14 @@ isa = XCSwiftPackageProductDependency; productName = VRMSceneKit; }; + 06F0BD7E2AAD82120089488C /* VRMKit */ = { + isa = XCSwiftPackageProductDependency; + productName = VRMKit; + }; + 06F0BD802AAD82120089488C /* VRMSceneKit */ = { + isa = XCSwiftPackageProductDependency; + productName = VRMSceneKit; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 24CF7F722143EEDB007A5C6C /* Project object */; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMExample.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMExample.xcscheme new file mode 100644 index 0000000..26769fa --- /dev/null +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/VRMExample.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json rename to Example/WatchExample Watch App/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example/WatchExample Watch App/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/WatchExample Watch App/Assets.xcassets/Contents.json b/Example/WatchExample Watch App/Assets.xcassets/Contents.json similarity index 100% rename from WatchExample Watch App/Assets.xcassets/Contents.json rename to Example/WatchExample Watch App/Assets.xcassets/Contents.json diff --git a/WatchExample Watch App/ContentView.swift b/Example/WatchExample Watch App/ContentView.swift similarity index 91% rename from WatchExample Watch App/ContentView.swift rename to Example/WatchExample Watch App/ContentView.swift index 7ae57d1..5a2c515 100644 --- a/WatchExample Watch App/ContentView.swift +++ b/Example/WatchExample Watch App/ContentView.swift @@ -6,18 +6,10 @@ // Copyright © 2023 tattn. All rights reserved. // -// -// ContentView.swift -// WatchSample Watch App -// -// Created by Naoto Komiya on 2023/09/05. -// Copyright © 2023 tattn. All rights reserved. -// - import SwiftUI import SceneKit -import VRMWatchKit -import VRMWatchSceneKit +import VRMKit +import VRMSceneKit class Renderer : NSObject, SCNSceneRendererDelegate { func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { @@ -28,7 +20,7 @@ class Renderer : NSObject, SCNSceneRendererDelegate { struct ContentView: View { var scene: VRMScene? var renderer: Renderer = Renderer() - + private func setupScene(_ scene: SCNScene) { let cameraNode = SCNNode() cameraNode.camera = SCNCamera() @@ -38,7 +30,7 @@ struct ContentView: View { cameraNode.position = SCNVector3(0, 1.4, -0.4) cameraNode.rotation = SCNVector4(0, 1, 0, Float.pi) } - + init() { do { let loader = try VRMSceneLoader(named: "AliciaSolid.vrm") @@ -48,7 +40,7 @@ struct ContentView: View { let node = scene!.vrmNode node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180) node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180) - + node.runAction(SCNAction.repeatForever(SCNAction.sequence([ SCNAction.wait(duration: 3.0), SCNAction.customAction(duration: 0.5, action: {(node, time)->Void in @@ -65,14 +57,14 @@ struct ContentView: View { print(error) } } - + var body: some View { VStack { SceneView(scene: scene, delegate: renderer).padding(.vertical,-45) } .frame(maxWidth: .infinity, maxHeight: .infinity) } - + } struct ContentView_Previews: PreviewProvider { diff --git a/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json b/Example/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json similarity index 100% rename from WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json rename to Example/WatchExample Watch App/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/WatchExample Watch App/WatchExampleApp.swift b/Example/WatchExample Watch App/WatchExampleApp.swift similarity index 100% rename from WatchExample Watch App/WatchExampleApp.swift rename to Example/WatchExample Watch App/WatchExampleApp.swift diff --git a/Package.swift b/Package.swift index a93d4df..5e5f5ac 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "VRMKit", - platforms: [.iOS(.v15)], + platforms: [.iOS(.v15), .watchOS(.v8)], products: [ .library(name: "VRMKit", targets: ["VRMKit"]), .library(name: "VRMSceneKit", targets: ["VRMSceneKit"]) diff --git a/Sources/VRMSceneKit/SceneData.swift b/Sources/VRMSceneKit/SceneData.swift index 2f8345d..bf2d38d 100644 --- a/Sources/VRMSceneKit/SceneData.swift +++ b/Sources/VRMSceneKit/SceneData.swift @@ -6,9 +6,9 @@ // Copyright © 2018年 tattn. All rights reserved. // -import Foundation import VRMKit import SceneKit +import UIKit final class SceneData { var scene: VRMScene? From 0c646b332a26455334ca3a47b62f91bb18080620 Mon Sep 17 00:00:00 2001 From: "tattn (Tatsuya Tanaka)" Date: Sun, 10 Sep 2023 14:16:39 +0900 Subject: [PATCH 3/5] Clean code --- Example/Example.xcodeproj/project.pbxproj | 4 ++ .../WatchExample Watch App/ContentView.swift | 59 +++--------------- .../WatchExample Watch App/ViewModel.swift | 62 +++++++++++++++++++ 3 files changed, 74 insertions(+), 51 deletions(-) create mode 100644 Example/WatchExample Watch App/ViewModel.swift diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 5259f6e..6ff366f 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 06F0BD7F2AAD82120089488C /* VRMKit in Frameworks */ = {isa = PBXBuildFile; productRef = 06F0BD7E2AAD82120089488C /* VRMKit */; }; 06F0BD812AAD82120089488C /* VRMSceneKit in Frameworks */ = {isa = PBXBuildFile; productRef = 06F0BD802AAD82120089488C /* VRMSceneKit */; }; 06F0BD822AAD82B00089488C /* AliciaSolid.vrm in Resources */ = {isa = PBXBuildFile; fileRef = 067C5C532AAD6EC600F8FBB3 /* AliciaSolid.vrm */; }; + 06F0BD842AAD844E0089488C /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F0BD832AAD844E0089488C /* ViewModel.swift */; }; 245725DA2146F47A003AA5D7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725D92146F47A003AA5D7 /* AppDelegate.swift */; }; 245725DC2146F47A003AA5D7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 245725DB2146F47A003AA5D7 /* ViewController.swift */; }; 245725DF2146F47B003AA5D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 245725DD2146F47B003AA5D7 /* Main.storyboard */; }; @@ -67,6 +68,7 @@ 06F0BD702AAD81A30089488C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 06F0BD722AAD81A40089488C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 06F0BD752AAD81A40089488C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 06F0BD832AAD844E0089488C /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 245725D72146F47A003AA5D7 /* VRMExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VRMExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 245725D92146F47A003AA5D7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 245725DB2146F47A003AA5D7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -111,6 +113,7 @@ children = ( 06F0BD6E2AAD81A30089488C /* WatchExampleApp.swift */, 06F0BD702AAD81A30089488C /* ContentView.swift */, + 06F0BD832AAD844E0089488C /* ViewModel.swift */, 06F0BD722AAD81A40089488C /* Assets.xcassets */, 06F0BD742AAD81A40089488C /* Preview Content */, ); @@ -283,6 +286,7 @@ buildActionMask = 2147483647; files = ( 06F0BD712AAD81A30089488C /* ContentView.swift in Sources */, + 06F0BD842AAD844E0089488C /* ViewModel.swift in Sources */, 06F0BD6F2AAD81A30089488C /* WatchExampleApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/WatchExample Watch App/ContentView.swift b/Example/WatchExample Watch App/ContentView.swift index 5a2c515..5aaefda 100644 --- a/Example/WatchExample Watch App/ContentView.swift +++ b/Example/WatchExample Watch App/ContentView.swift @@ -8,63 +8,20 @@ import SwiftUI import SceneKit -import VRMKit -import VRMSceneKit - -class Renderer : NSObject, SCNSceneRendererDelegate { - func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { - (renderer.scene as! VRMScene).vrmNode.update(at: time) - } -} struct ContentView: View { - var scene: VRMScene? - var renderer: Renderer = Renderer() - - private func setupScene(_ scene: SCNScene) { - let cameraNode = SCNNode() - cameraNode.camera = SCNCamera() - cameraNode.camera?.automaticallyAdjustsZRange = true - scene.rootNode.addChildNode(cameraNode) - - cameraNode.position = SCNVector3(0, 1.4, -0.4) - cameraNode.rotation = SCNVector4(0, 1, 0, Float.pi) - } - - init() { - do { - let loader = try VRMSceneLoader(named: "AliciaSolid.vrm") - scene = try loader.loadScene() - if(scene != nil) { - setupScene(scene!) - let node = scene!.vrmNode - node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180) - node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180) - - node.runAction(SCNAction.repeatForever(SCNAction.sequence([ - SCNAction.wait(duration: 3.0), - SCNAction.customAction(duration: 0.5, action: {(node, time)->Void in - let vrmNode = node as! VRMNode - return vrmNode.setBlendShape(value: time/0.5, for: .preset(.blink)) - }), - SCNAction.customAction(duration: 0.5, action: {(node, time)->Void in - let vrmNode = node as! VRMNode - return vrmNode.setBlendShape(value: 1.0-time/0.5, for: .preset(.blink)) - }), - ]))) - } - } catch { - print(error) - } - } + @StateObject private var viewModel = ViewModel() var body: some View { - VStack { - SceneView(scene: scene, delegate: renderer).padding(.vertical,-45) + SceneView( + scene: viewModel.scene, + delegate: viewModel.renderer + ) + .ignoresSafeArea() + .onAppear { + viewModel.loadModelIfNeeded() } - .frame(maxWidth: .infinity, maxHeight: .infinity) } - } struct ContentView_Previews: PreviewProvider { diff --git a/Example/WatchExample Watch App/ViewModel.swift b/Example/WatchExample Watch App/ViewModel.swift new file mode 100644 index 0000000..17f2d53 --- /dev/null +++ b/Example/WatchExample Watch App/ViewModel.swift @@ -0,0 +1,62 @@ +// +// ViewModel.swift +// WatchExample Watch App +// +// Created by Tatsuya Tanaka on 2023/09/10. +// Copyright © 2023 tattn. All rights reserved. +// + +import Foundation +import VRMSceneKit +import SceneKit + +final class Renderer: NSObject, SCNSceneRendererDelegate { + func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { + (renderer.scene as! VRMScene).vrmNode.update(at: time) + } +} + +final class ViewModel: ObservableObject { + @Published private(set) var scene: VRMScene? + let renderer = Renderer() + + func loadModelIfNeeded() { + guard scene == nil else { return } + + do { + let loader = try VRMSceneLoader(named: "AliciaSolid.vrm") + let scene = try loader.loadScene() + setupScene(scene) + + let node = scene.vrmNode + node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180) + node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180) + + node.runAction(.repeatForever(.sequence([ + .wait(duration: 3.0), + .customAction(duration: 0.5) { node, time in + let vrmNode = node as! VRMNode + return vrmNode.setBlendShape(value: time / 0.5, for: .preset(.blink)) + }, + .customAction(duration: 0.5) { node, time in + let vrmNode = node as! VRMNode + return vrmNode.setBlendShape(value: 1.0 - time / 0.5, for: .preset(.blink)) + }, + ]))) + } catch { + print(error) + } + } + + private func setupScene(_ scene: VRMScene) { + self.scene = scene + + let cameraNode = SCNNode() + cameraNode.camera = SCNCamera() + cameraNode.camera?.automaticallyAdjustsZRange = true + scene.rootNode.addChildNode(cameraNode) + + cameraNode.position = SCNVector3(0, 1.4, -0.4) + cameraNode.rotation = SCNVector4(0, 1, 0, Float.pi) + } +} From 0cf2be2ecb5f290669af14e0334dbd3593258d34 Mon Sep 17 00:00:00 2001 From: "tattn (Tatsuya Tanaka)" Date: Sun, 10 Sep 2023 14:22:23 +0900 Subject: [PATCH 4/5] Enable tests for watchOS --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 54734aa..b8b4812 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iPhone,iOS-16) +PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,Watch,watchOS-9) -test: test-package test-vrmkit test-vrmscenekit +test: test-package test-package: - xcodebuild test -scheme VRMKit-Package -destination platform="$(PLATFORM_IOS)" + for platform in "$(PLATFORM_IOS)" "$(PLATFORM_WATCHOS)"; do\ + xcodebuild test -scheme VRMKit-Package -destination platform="$$platform" || exit 1;\ + done define udid_for $(shell xcrun simctl list --json devices available $(1) | jq -r 'last(.devices | to_entries | sort_by(.key) | .[] | select(.key | contains("$(2)"))) | .value | last.udid') From 266cbe57950bb5312c8d2fead705a40575b167fe Mon Sep 17 00:00:00 2001 From: Tatsuya Tanaka Date: Sun, 10 Sep 2023 14:33:16 +0900 Subject: [PATCH 5/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a608ac8..9347050 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ For "VRM", please refer to [this page](https://dwango.github.io/en/vrm/). - Swift 5.7+ - iOS 15.0+ +- watchOS 8.0+ (Experimental) # Installation