Initialer Upload neues Unity-Projekt

This commit is contained in:
Daniel Ocks
2025-07-21 09:11:14 +02:00
commit eeca72985b
14558 changed files with 1508140 additions and 0 deletions

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 353612abd09de3a478236e679e220759
folderAsset: yes
timeCreated: 1548282626
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_BooleanEvent : UnityEvent<SteamVR_Behaviour_Boolean, SteamVR_Input_Sources, bool> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 59250d64a1ce9a44891e9bb0b3d71e6b
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_PoseEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d77e49c3174e18045ab27a1029c6a977
timeCreated: 1548282627
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Pose_ConnectedChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, bool> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f0abecbe8a5e4e04dab8f886e1d6d070
timeCreated: 1548282627
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Pose_DeviceIndexChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, int> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bc42b626f4ef1264ebfc0393f40df5c9
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Pose_TrackingChangedEvent : UnityEvent<SteamVR_Behaviour_Pose, SteamVR_Input_Sources, ETrackingResult> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 62c981c44fe9a6046bb0766cb96bdf65
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_SingleEvent : UnityEvent<SteamVR_Behaviour_Single, SteamVR_Input_Sources, float, float> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b8fd33c9d8ff2114a8b6a59629165318
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_SkeletonEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c56ae57c82c46674ea85a60fd6ba9334
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Skeleton_ConnectedChangedEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources, bool> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 431bf7eb5ceb24a448dc44a2ed8d8243
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Skeleton_TrackingChangedEvent : UnityEvent<SteamVR_Behaviour_Skeleton, SteamVR_Input_Sources, ETrackingResult> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7461d65099840d840af0e25e6afda525
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Vector2Event : UnityEvent<SteamVR_Behaviour_Vector2, SteamVR_Input_Sources, Vector2, Vector2> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 091545c123a858440b2e32a3f299a923
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using System;
using UnityEngine;
using UnityEngine.Events;
namespace Valve.VR
{
[Serializable]
public class SteamVR_Behaviour_Vector3Event : UnityEvent<SteamVR_Behaviour_Vector3, SteamVR_Input_Sources, Vector3, Vector3> { }
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 99c31ec1b21aa424987b0162f9971dc6
timeCreated: 1548282626
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fed05885250fc2c4daab18c7df3717bf
folderAsset: yes
timeCreated: 1521243387
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7836f978f062019499564a455654e74a
timeCreated: 1521247191
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7d5e740d15d7ca249b884d30ff558bc1
folderAsset: yes
timeCreated: 1547747995
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 16f1e3ee1a373e34ea3a84a7afa0a259
folderAsset: yes
timeCreated: 1547747995
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: aa701b1f3ae438e469d0ad4f122a0633
timeCreated: 1547747996
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 2f8721c3878282b44bd0c8a689d4788c
timeCreated: 1547747995
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 426d721c1fc5bfa418c79dc808856464
timeCreated: 1547747995
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/SteamVR/Input/Editor/Resources/Icons/HandLeftIcon.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 1e898a11a01f33d4a80b04e98158023a
timeCreated: 1547857461
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 985915d4db439114797fb72a46387d71
timeCreated: 1547857461
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/SteamVR/Input/Editor/Resources/Icons/handmask.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: d1f34261d4655bc4cb5413868ae9bee2
timeCreated: 1547765671
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 2c4294febb4dfe54d98c37083da7a639
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 0f57642ec96c82446a79c525bb70b018
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: e0a60ab44553a7f4ca994dec64351d08
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 4fb892aabe590ec4fb65a57a048a093f
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: c3b3083cc66322049822d98fa4c15fd6
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,59 @@
fileFormatVersion: 2
guid: 764dada5864e19440bb07e24e684e950
timeCreated: 1547765602
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
buildTargetSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
using System;
using System.Linq;
using System.IO;
namespace Valve.VR
{
public class SteamVR_CopyExampleInputFiles : Editor
{
public const string steamVRInputExampleJSONCopiedKey = "SteamVR_Input_CopiedExamples";
public const string exampleJSONFolderParent = "Input";
public const string exampleJSONFolderName = "ExampleJSON";
[UnityEditor.Callbacks.DidReloadScripts]
private static void OnReloadScripts()
{
EditorApplication.update += Update;
}
private static void Update()
{
EditorApplication.update -= Update;
SteamVR_Input.CheckOldLocation();
CopyFiles();
}
public static void CopyFiles(bool force = false)
{
bool hasCopied = EditorPrefs.GetBool(steamVRInputExampleJSONCopiedKey, false);
if (hasCopied == false || force == true)
{
string actionsFilePath = SteamVR_Input.GetActionsFilePath();
bool exists = File.Exists(actionsFilePath);
if (exists == false)
{
string steamVRFolder = SteamVR.GetSteamVRFolderPath();
string exampleLocation = Path.Combine(steamVRFolder, exampleJSONFolderParent);
string exampleFolderPath = Path.Combine(exampleLocation, exampleJSONFolderName);
string streamingAssetsPath = SteamVR_Input.GetActionsFileFolder();
string[] files = Directory.GetFiles(exampleFolderPath, "*.json");
foreach (string file in files)
{
string filename = Path.GetFileName(file);
string newPath = Path.Combine(streamingAssetsPath, filename);
try
{
File.Copy(file, newPath, false);
Debug.Log("<b>[SteamVR]</b> Copied example input JSON to path: " + newPath);
}
catch
{
Debug.LogError("<b>[SteamVR]</b> Could not copy file: " + file + " to path: " + newPath);
}
}
EditorPrefs.SetBool(steamVRInputExampleJSONCopiedKey, true);
}
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 806facaa17de95d4794b0acbbad1268d
timeCreated: 1528159292
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,879 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
using Valve.Newtonsoft.Json;
namespace Valve.VR
{
public class SteamVR_Input_ActionManifest_Manager : AssetPostprocessor
{
private static bool importing = false;
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (importing)
return;
importing = true;
Dictionary<string, List<SteamVR_PartialInputBindings>> partials = ScanForPartials();
if (partials != null)
{
foreach (var element in partials)
{
if (element.Value != null && element.Value.Count > 0 && element.Value[0].imported == false)
ConfirmImport(element.Value);
}
}
importing = false;
}
public const string partialManifestFilename = "steamvr_partial_manifest.json";
public static void CreatePartial(string name, int version, bool overwriteOld, bool removeUnused)
{
if (SteamVR_Input.actionFile.action_sets.Any(set => set.name == "default"))
{
bool confirm = EditorUtility.DisplayDialog("Confirmation", "We don't recommend you create a partial binding manifest with an action set named 'default'. There will often be collisions with existing actions. Are you sure you want to continue creating this partial binding manifest?", "Create", "Cancel");
if (confirm == false)
return;
}
string folderName = "SteamVR_" + SteamVR_Input_ActionFile.GetCodeFriendlyName(name);
string directorySeparatorChar = System.IO.Path.DirectorySeparatorChar.ToString();
string mainFolderPath = string.Format("{0}", folderName);
string versionFolderPath = string.Format("{1}{0}{2}", directorySeparatorChar, folderName, version.ToString());
string manifestPath = string.Format("{1}{0}{2}{0}{3}", directorySeparatorChar, folderName, version.ToString(), partialManifestFilename);
if (Directory.Exists(mainFolderPath) == false)
{
Directory.CreateDirectory(mainFolderPath);
}
if (Directory.Exists(versionFolderPath) == false)
{
Directory.CreateDirectory(versionFolderPath);
}
SteamVR_PartialInputBindings partial = new SteamVR_PartialInputBindings();
partial.name = name;
partial.version = version;
partial.overwriteOld = overwriteOld;
partial.removeUnused = removeUnused;
string jsonText = JsonConvert.SerializeObject(partial, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
if (File.Exists(manifestPath))
{
FileInfo manifestFile = new FileInfo(manifestPath);
manifestFile.IsReadOnly = false;
}
File.WriteAllText(manifestPath, jsonText);
SteamVR_Input.actionFile.CopyFilesToPath(versionFolderPath, true);
EditorUtility.RevealInFinder(mainFolderPath);
}
protected static string FindLanguageInDictionary(Dictionary<string, string> dictionary)
{
foreach (var localizationMember in dictionary)
{
if (localizationMember.Key == SteamVR_Input_ActionFile_LocalizationItem.languageTagKeyName)
return localizationMember.Value;
}
return null;
}
protected static int ImportLocalization(SteamVR_Input_ActionFile currentActionsFile, SteamVR_Input_ActionFile newActionsFile, SteamVR_PartialInputBindings partialBinding)
{
int count = 0;
foreach (var newLocalDictionary in newActionsFile.localization)
{
string newLanguage = FindLanguageInDictionary(newLocalDictionary);
if (string.IsNullOrEmpty(newLanguage))
{
Debug.LogError("<b>[SteamVR Input]</b> Localization entry in partial actions file is missing a language tag: " + partialBinding.path);
continue;
}
int currentLanguage = -1;
for (int currentLanguageIndex = 0; currentLanguageIndex < currentActionsFile.localization.Count; currentLanguageIndex++)
{
string language = FindLanguageInDictionary(currentActionsFile.localization[currentLanguageIndex]);
if (newLanguage == language)
{
currentLanguage = currentLanguageIndex;
break;
}
}
if (currentLanguage == -1)
{
Dictionary<string, string> newDictionary = new Dictionary<string, string>();
foreach (var element in newLocalDictionary)
{
newDictionary.Add(element.Key, element.Value);
count++;
}
currentActionsFile.localization.Add(newDictionary);
}
else
{
foreach (var element in newLocalDictionary)
{
Dictionary<string, string> currentDictionary = currentActionsFile.localization[currentLanguage];
bool exists = currentDictionary.Any(inCurrent => inCurrent.Key == element.Key);
if (exists)
{
//todo: should we overwrite?
currentDictionary[element.Key] = element.Value;
}
else
{
currentDictionary.Add(element.Key, element.Value);
count++;
}
}
}
}
return count;
}
protected static int ImportActionSets(SteamVR_Input_ActionFile currentActionsFile, SteamVR_Input_ActionFile newActionsFile)
{
int count = 0;
foreach (var newSet in newActionsFile.action_sets)
{
if (currentActionsFile.action_sets.Any(setInCurrent => newSet.name == setInCurrent.name) == false)
{
currentActionsFile.action_sets.Add(newSet.GetCopy());
count++;
}
}
return count;
}
protected static int ImportActions(SteamVR_Input_ActionFile currentActionsFile, SteamVR_Input_ActionFile newActionsFile)
{
int count = 0;
foreach (var newAction in newActionsFile.actions)
{
if (currentActionsFile.actions.Any(actionInCurrent => newAction.name == actionInCurrent.name) == false)
{
currentActionsFile.actions.Add(newAction.GetCopy());
count++;
}
else
{
SteamVR_Input_ActionFile_Action existingAction = currentActionsFile.actions.First(actionInCurrent => newAction.name == actionInCurrent.name);
//todo: better merge? should we overwrite?
existingAction.type = newAction.type;
existingAction.scope = newAction.scope;
existingAction.skeleton = newAction.skeleton;
existingAction.requirement = newAction.requirement;
}
}
return count;
}
protected static SteamVR_Input_BindingFile GetBindingFileObject(string path)
{
if (File.Exists(path) == false)
{
Debug.LogError("<b>[SteamVR]</b> Could not access file at path: " + path);
return null;
}
string jsonText = File.ReadAllText(path);
SteamVR_Input_BindingFile importingBindingFile = JsonConvert.DeserializeObject<SteamVR_Input_BindingFile>(jsonText);
return importingBindingFile;
}
protected static void WriteBindingFileObject(SteamVR_Input_BindingFile currentBindingFile, string currentBindingPath)
{
if (File.Exists(currentBindingPath))
{
FileInfo fileInfo = new FileInfo(currentBindingPath);
fileInfo.IsReadOnly = false;
}
string newJSON = JsonConvert.SerializeObject(currentBindingFile, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(currentBindingPath, newJSON);
Debug.Log("<b>[SteamVR]</b> Added action bindings to: " + currentBindingPath);
}
protected static void ImportBindings(SteamVR_Input_ActionFile currentActionsFile, SteamVR_Input_ActionFile newActionsFile, string directory)
{
foreach (var newDefaultPath in newActionsFile.default_bindings)
{
if (currentActionsFile.default_bindings.Any(currentDefaultPath => newDefaultPath.controller_type == currentDefaultPath.controller_type) == false)
{
currentActionsFile.default_bindings.Add(newDefaultPath.GetCopy());
string bindingPath = Path.Combine(directory, newDefaultPath.binding_url);
File.Copy(bindingPath, newDefaultPath.binding_url);
}
else
{
string currentBindingDirectory = SteamVR_Input.GetActionsFileFolder();
string currentBindingPath = currentActionsFile.default_bindings.First(binding => binding.controller_type == newDefaultPath.controller_type).binding_url;
currentBindingPath = Path.Combine(currentBindingDirectory, currentBindingPath);
SteamVR_Input_BindingFile currentBindingFile = GetBindingFileObject(currentBindingPath);
if (currentBindingFile == null)
{
Debug.LogError("<b>[SteamVR]</b> There was an error deserializing the binding at path: " + currentBindingPath);
continue;
}
SteamVR_Input_BindingFile importingBindingFile = GetBindingFileObject(Path.Combine(directory, newDefaultPath.binding_url));
if (importingBindingFile == null)
{
Debug.LogError("<b>[SteamVR]</b> There was an error deserializing the binding at path: " + Path.Combine(directory, newDefaultPath.binding_url));
continue;
}
bool changed = false;
foreach (var importingActionList in importingBindingFile.bindings)
{
if (currentBindingFile.bindings.Any(binding => binding.Key == importingActionList.Key))
{
var currentSetBinding = currentBindingFile.bindings.FirstOrDefault(binding => binding.Key == importingActionList.Key);
//todo: better merge? if we don't have an exact copy of the item then we add a new one
foreach (var importingChord in importingActionList.Value.chords)
{
if (currentSetBinding.Value.chords.Any(currentChord => importingChord.Equals(currentChord)) == false)
{
changed = true;
currentSetBinding.Value.chords.Add(importingChord);
}
}
foreach (var importingHaptic in importingActionList.Value.haptics)
{
if (currentSetBinding.Value.haptics.Any(currentHaptic => importingHaptic.Equals(currentHaptic)) == false)
{
changed = true;
currentSetBinding.Value.haptics.Add(importingHaptic);
}
}
foreach (var importingPose in importingActionList.Value.poses)
{
if (currentSetBinding.Value.poses.Any(currentPose => importingPose.Equals(currentPose)) == false)
{
changed = true;
currentSetBinding.Value.poses.Add(importingPose);
}
}
foreach (var importingSkeleton in importingActionList.Value.skeleton)
{
if (currentSetBinding.Value.skeleton.Any(currentSkeleton => importingSkeleton.Equals(currentSkeleton)) == false)
{
changed = true;
currentSetBinding.Value.skeleton.Add(importingSkeleton);
}
}
foreach (var importingSource in importingActionList.Value.sources)
{
if (currentSetBinding.Value.sources.Any(currentSource => importingSource.Equals(currentSource)) == false)
{
changed = true;
currentSetBinding.Value.sources.Add(importingSource);
}
}
}
else
{
changed = true;
currentBindingFile.bindings.Add(importingActionList.Key, importingActionList.Value);
}
}
if (changed)
{
WriteBindingFileObject(currentBindingFile, currentBindingPath);
}
}
}
}
public static void CleanBindings(bool verbose = false)
{
SteamVR_Input.InitializeFile(true);
SteamVR_Input_ActionFile currentActionsFile = SteamVR_Input.actionFile;
for (int localizationIndex = 0; localizationIndex < currentActionsFile.localization.Count; localizationIndex++)
{
Dictionary<string, string> dictionary = currentActionsFile.localization[localizationIndex];
bool removed;
do
{
removed = false;
string missingAction = null;
foreach (string key in dictionary.Keys)
{
if (key == SteamVR_Input_ActionFile_LocalizationItem.languageTagKeyName)
continue;
if (currentActionsFile.actions.Any(action => string.Equals(action.name, key, StringComparison.CurrentCultureIgnoreCase)) == false)
{
missingAction = key;
}
}
if (missingAction != null)
{
removed = true;
dictionary.Remove(missingAction);
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> Removing localization entry for: " + missingAction);
}
} while (removed);
}
for (int bindingIndex = 0; bindingIndex < currentActionsFile.default_bindings.Count; bindingIndex++)
{
SteamVR_Input_ActionFile_DefaultBinding currentBinding = currentActionsFile.default_bindings[bindingIndex];
string bindingPath = Path.Combine(SteamVR_Input.GetActionsFileFolder(), currentBinding.binding_url);
if (File.Exists(bindingPath) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> Removing binding entry for missing file: '" + currentBinding.controller_type + "' at: " + bindingPath);
currentActionsFile.default_bindings.RemoveAt(bindingIndex);
bindingIndex--;
continue;
}
SteamVR_Input_BindingFile bindingFile = GetBindingFileObject(bindingPath);
if (bindingFile == null)
{
Debug.LogError("<b>[SteamVR Input]</b> Error parsing binding file for: '" + currentBinding.controller_type + "' at: " + bindingPath);
continue;
}
int changed = 0;
foreach (var actionList in bindingFile.bindings)
{
for (int itemIndex = 0; itemIndex < actionList.Value.chords.Count; itemIndex++)
{
string outputActionPath = actionList.Value.chords[itemIndex].output;
if (currentActionsFile.actions.Any(action => string.Equals(action.name, outputActionPath, StringComparison.CurrentCultureIgnoreCase)) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> " + currentBinding.controller_type + ": Removing chord binding for action: " + outputActionPath);
actionList.Value.chords.RemoveAt(itemIndex);
itemIndex--;
changed++;
}
}
for (int itemIndex = 0; itemIndex < actionList.Value.haptics.Count; itemIndex++)
{
string outputActionPath = actionList.Value.haptics[itemIndex].output;
if (currentActionsFile.actions.Any(action => string.Equals(action.name, outputActionPath, StringComparison.CurrentCultureIgnoreCase)) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> " + currentBinding.controller_type + ": Removing haptics binding for action: " + outputActionPath);
actionList.Value.haptics.RemoveAt(itemIndex);
itemIndex--;
changed++;
}
}
for (int itemIndex = 0; itemIndex < actionList.Value.poses.Count; itemIndex++)
{
string outputActionPath = actionList.Value.poses[itemIndex].output;
if (currentActionsFile.actions.Any(action => string.Equals(action.name, outputActionPath, StringComparison.CurrentCultureIgnoreCase)) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> " + currentBinding.controller_type + ": Removing pose binding for action: " + outputActionPath);
actionList.Value.poses.RemoveAt(itemIndex);
itemIndex--;
changed++;
}
}
for (int itemIndex = 0; itemIndex < actionList.Value.skeleton.Count; itemIndex++)
{
string outputActionPath = actionList.Value.skeleton[itemIndex].output;
if (currentActionsFile.actions.Any(action => string.Equals(action.name, outputActionPath, StringComparison.CurrentCultureIgnoreCase)) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> " + currentBinding.controller_type + ": Removing skeleton binding for action: " + outputActionPath);
actionList.Value.skeleton.RemoveAt(itemIndex);
itemIndex--;
changed++;
}
}
for (int itemIndex = 0; itemIndex < actionList.Value.sources.Count; itemIndex++)
{
string outputActionPath = actionList.Value.sources[itemIndex].GetOutput();
if (currentActionsFile.actions.Any(action => string.Equals(action.name, outputActionPath, StringComparison.CurrentCultureIgnoreCase)) == false)
{
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> " + currentBinding.controller_type + ": Removing source binding for action: " + outputActionPath);
actionList.Value.sources.RemoveAt(itemIndex);
itemIndex--;
changed++;
}
}
}
if (changed > 0)
{
WriteBindingFileObject(bindingFile, bindingPath);
}
}
if (SteamVR_Input.HasFileInMemoryBeenModified())
{
SteamVR_Input.actionFile.Save(SteamVR_Input.GetActionsFilePath());
if (verbose)
Debug.Log("<b>[SteamVR Input]</b> Saved new actions file: " + SteamVR_Input.GetActionsFilePath());
}
}
protected static void ImportPartialBinding(SteamVR_PartialInputBindings partialBinding)
{
SteamVR_Input.InitializeFile();
SteamVR_Input_ActionFile currentActionsFile = SteamVR_Input.actionFile;
SteamVR_Input_ActionFile newActionsFile = ReadJson<SteamVR_Input_ActionFile>(partialBinding.GetActionsPath());
/*
int sets = ImportActionSets(currentActionsFile, newActionsFile);
int locs = ImportLocalization(currentActionsFile, newActionsFile, partialBinding);
int actions = ImportActions(currentActionsFile, newActionsFile);
*/
ImportActionSets(currentActionsFile, newActionsFile);
ImportLocalization(currentActionsFile, newActionsFile, partialBinding);
ImportActions(currentActionsFile, newActionsFile);
if (SteamVR_Input.HasFileInMemoryBeenModified())
{
SteamVR_Input.actionFile.Save(SteamVR_Input.GetActionsFilePath());
Debug.Log("<b>[SteamVR]</b> Saved new actions file: " + SteamVR_Input.GetActionsFilePath());
}
ImportBindings(currentActionsFile, newActionsFile, partialBinding.GetDirectory());
partialBinding.imported = true;
partialBinding.Save();
SteamVR_Input.InitializeFile(true);
SteamVR_Input_EditorWindow.ReopenWindow();
//todo: ask first?
/*string dialogText = string.Format("{0} new action sets, {1} new actions, and {2} new localization strings have been added. Would you like to regenerate SteamVR Input code files?", sets, actions, locs);
bool confirm = EditorUtility.DisplayDialog("SteamVR Input", dialogText, "Generate", "Cancel");
if (confirm)
SteamVR_Input_Generator.BeginGeneration();
*/
SteamVR_Input_Generator.BeginGeneration();
Debug.Log("<b>[SteamVR]</b> Reloaded actions file with additional actions from " + partialBinding.name);
}
protected static void ReplaceBinding(SteamVR_PartialInputBindings partialBinding)
{
SteamVR_Input.DeleteManifestAndBindings();
string newActionsFilePath = partialBinding.GetActionsPath();
if (File.Exists(newActionsFilePath))
{
File.Copy(newActionsFilePath, SteamVR_Input.GetActionsFilePath());
}
string bindingsFolder = SteamVR_Input.GetActionsFileFolder();
SteamVR_Input_ActionFile newActionsFile = ReadJson<SteamVR_Input_ActionFile>(SteamVR_Input.GetActionsFilePath());
string partialBindingDirectory = partialBinding.GetDirectory();
foreach (var newDefaultPath in newActionsFile.default_bindings)
{
string bindingPath = Path.Combine(partialBindingDirectory, newDefaultPath.binding_url);
string newBindingPath = Path.Combine(bindingsFolder, newDefaultPath.binding_url);
File.Copy(bindingPath, newBindingPath, true);
}
partialBinding.imported = true;
partialBinding.Save();
SteamVR_Input.InitializeFile(true);
SteamVR_Input_EditorWindow.ReopenWindow();
//todo: ask first?
/*string dialogText = string.Format("{0} new action sets, {1} new actions, and {2} new localization strings have been added. Would you like to regenerate SteamVR Input code files?", sets, actions, locs);
bool confirm = EditorUtility.DisplayDialog("SteamVR Input", dialogText, "Generate", "Cancel");
if (confirm)
SteamVR_Input_Generator.BeginGeneration();
*/
SteamVR_Input_Generator.BeginGeneration();
Debug.Log("<b>[SteamVR Input]</b> Reloaded with new actions from " + partialBinding.name);
}
protected static T ReadJson<T>(string path)
{
if (File.Exists(path))
{
string jsonText = File.ReadAllText(path);
return JsonConvert.DeserializeObject<T>(jsonText);
}
return default(T);
}
protected static List<SteamVR_Input_ActionFile_Action> RemoveOldActions(List<SteamVR_PartialInputBindings> partialBindingList)
{
List<SteamVR_Input_ActionFile_Action> toRemove = new List<SteamVR_Input_ActionFile_Action>();
SteamVR_Input_ActionFile newestActionsFile = ReadJson<SteamVR_Input_ActionFile>(partialBindingList[0].GetActionsPath());
for (int partialBindingIndex = 1; partialBindingIndex < partialBindingList.Count; partialBindingIndex++)
{
SteamVR_Input_ActionFile oldActionsFile = ReadJson<SteamVR_Input_ActionFile>(partialBindingList[partialBindingIndex].GetActionsPath());
for (int oldActionIndex = 0; oldActionIndex < oldActionsFile.actions.Count; oldActionIndex++)
{
var oldAction = oldActionsFile.actions[oldActionIndex];
if (newestActionsFile.actions.Any(newAction => oldAction.Equals(newAction)) == false)
{
var existing = SteamVR_Input.actionFile.actions.FirstOrDefault(action => oldAction.Equals(action));
if (existing != null)
{
SteamVR_Input.actionFile.actions.Remove(existing);
toRemove.Add(oldAction);
}
}
}
}
return toRemove;
}
protected static List<SteamVR_Input_ActionFile_ActionSet> RemoveOldActionSets(List<SteamVR_PartialInputBindings> partialBindingList)
{
List<SteamVR_Input_ActionFile_ActionSet> toRemove = new List<SteamVR_Input_ActionFile_ActionSet>();
SteamVR_Input_ActionFile newestActionsFile = ReadJson<SteamVR_Input_ActionFile>(partialBindingList[0].GetActionsPath());
for (int partialBindingIndex = 1; partialBindingIndex < partialBindingList.Count; partialBindingIndex++)
{
SteamVR_Input_ActionFile oldActionsFile = ReadJson<SteamVR_Input_ActionFile>(partialBindingList[0].GetActionsPath());
for (int oldActionIndex = 0; oldActionIndex < oldActionsFile.action_sets.Count; oldActionIndex++)
{
var oldActionSet = oldActionsFile.action_sets[oldActionIndex];
if (newestActionsFile.action_sets.Any(newAction => oldActionSet.Equals(newAction)) == false)
{
var existing = SteamVR_Input.actionFile.action_sets.FirstOrDefault(actionSet => oldActionSet.Equals(actionSet));
if (existing != null)
{
SteamVR_Input.actionFile.action_sets.Remove(existing);
toRemove.Add(oldActionSet);
}
}
}
}
return toRemove;
}
protected static int RemoveOldLocalizations(List<SteamVR_Input_ActionFile_Action> removedActionList)
{
int count = 0;
foreach (var action in removedActionList)
{
foreach (var locDictionary in SteamVR_Input.actionFile.localization)
{
bool removed = locDictionary.Remove(action.name);
if (removed)
count++;
}
}
return count;
}
protected static void RemoveOldActionsAndSetsFromBindings(List<SteamVR_Input_ActionFile_ActionSet> setsToRemove, List<SteamVR_Input_ActionFile_Action> actionsToRemove)
{
foreach (var defaultBindingItem in SteamVR_Input.actionFile.default_bindings)
{
string currentBindingPath = defaultBindingItem.binding_url;
SteamVR_Input_BindingFile currentBindingFile = GetBindingFileObject(currentBindingPath);
if (currentBindingFile == null)
{
Debug.LogError("<b>[SteamVR]</b> There was an error deserializing the binding at path: " + currentBindingPath);
continue;
}
bool changed = false;
List<string> bindingListsToRemove = new List<string>();
foreach (var actionList in currentBindingFile.bindings)
{
if (setsToRemove.Any(set => set.name == actionList.Key))
{
bindingListsToRemove.Add(actionList.Key);
changed = true;
continue;
}
for (int chordIndex = 0; chordIndex < actionList.Value.chords.Count; chordIndex++)
{
var existingChord = actionList.Value.chords[chordIndex];
if (actionsToRemove.Any(action => action.name == existingChord.output))
{
actionList.Value.chords.Remove(existingChord);
chordIndex--;
changed = true;
}
}
for (int hapticIndex = 0; hapticIndex < actionList.Value.haptics.Count; hapticIndex++)
{
var existingHaptic = actionList.Value.haptics[hapticIndex];
if (actionsToRemove.Any(action => action.name == existingHaptic.output))
{
actionList.Value.haptics.Remove(existingHaptic);
hapticIndex--;
changed = true;
}
}
for (int poseIndex = 0; poseIndex < actionList.Value.poses.Count; poseIndex++)
{
var existingPose = actionList.Value.poses[poseIndex];
if (actionsToRemove.Any(action => action.name == existingPose.output))
{
actionList.Value.poses.Remove(existingPose);
poseIndex--;
changed = true;
}
}
for (int skeletonIndex = 0; skeletonIndex < actionList.Value.skeleton.Count; skeletonIndex++)
{
var existingSkeleton = actionList.Value.skeleton[skeletonIndex];
if (actionsToRemove.Any(action => action.name == existingSkeleton.output))
{
actionList.Value.skeleton.Remove(existingSkeleton);
skeletonIndex--;
changed = true;
}
}
for (int sourceIndex = 0; sourceIndex < actionList.Value.sources.Count; sourceIndex++)
{
var existingSource = actionList.Value.sources[sourceIndex];
if (actionsToRemove.Any(action => action.name == existingSource.GetOutput()))
{
actionList.Value.sources.Remove(existingSource);
sourceIndex--;
changed = true;
}
}
}
for (int bindingListToRemoveIndex = 0; bindingListToRemoveIndex < bindingListsToRemove.Count; bindingListToRemoveIndex++)
{
currentBindingFile.bindings.Remove(bindingListsToRemove[bindingListToRemoveIndex]);
}
if (changed)
{
WriteBindingFileObject(currentBindingFile, currentBindingPath);
}
}
}
protected static void RemoveOldPartialBindings(List<SteamVR_PartialInputBindings> partialBindingList)
{
List<SteamVR_Input_ActionFile_Action> actionsToRemove = RemoveOldActions(partialBindingList);
List<SteamVR_Input_ActionFile_ActionSet> setsToRemove = RemoveOldActionSets(partialBindingList);
int sets = setsToRemove.Count;
int actions = actionsToRemove.Count;
int locs = RemoveOldLocalizations(actionsToRemove);
string dialogText = string.Format("We've found a old {0} action sets, {1} actions, and {2} localization entries from old versions of this partial binding. Would you like to remove them from the actions file and default bindings?", sets, actions, locs);
bool confirm = EditorUtility.DisplayDialog("SteamVR Input", dialogText, "Import", "Cancel");
if (confirm)
{
RemoveOldActionsAndSetsFromBindings(setsToRemove, actionsToRemove);
SteamVR_Input.actionFile.Save(SteamVR_Input.GetActionsFilePath());
SteamVR_Input.InitializeFile(true); // reload after the save
}
else
{
SteamVR_Input.InitializeFile(true); // reload since we actually removed the actions / sets to display this message
}
}
protected const string dontAskAgainTemplate = "{0}_{1}_DontAskAgain";
protected static void ConfirmImport(List<SteamVR_PartialInputBindings> partialBindingList)
{
SteamVR_PartialInputBindings partial = partialBindingList.First();
//bool dontAskAgain = EditorPrefs.GetBool(dontAskAgainTemplate, false);
//todo: implement 'do not ask again'
string dialogText = string.Format("We've found a partial SteamVR Input binding for '{0}' version '{1}'. Would you like to import it?", partial.name, partial.version);
bool confirm = EditorUtility.DisplayDialog("SteamVR Input", dialogText, "Import", "Cancel");
if (confirm)
{
bool actionsExists = SteamVR_Input.DoesActionsFileExist();
if (actionsExists)
{
string mergeDialogText = "You have two options for importing this binding:\n Replace your current action file (delete all your actions)\n Merge the partial action file with your existing actions";
bool shouldMerge = EditorUtility.DisplayDialog("SteamVR Input", mergeDialogText, "Merge", "Replace");
if (shouldMerge)
{
ImportPartialBinding(partial);
}
else
{
ReplaceBinding(partial);
}
}
else
{
ReplaceBinding(partial);
}
if (partialBindingList.Count > 1)
{
RemoveOldPartialBindings(partialBindingList);
}
}
}
public static Dictionary<string, List<SteamVR_PartialInputBindings>> ScanForPartials()
{
string[] partialManifestPaths = Directory.GetFiles(Application.dataPath, partialManifestFilename, SearchOption.AllDirectories);
Dictionary<string, List<SteamVR_PartialInputBindings>> partialBindings = new Dictionary<string, List<SteamVR_PartialInputBindings>>();
for (int partialIndex = 0; partialIndex < partialManifestPaths.Length; partialIndex++)
{
string path = partialManifestPaths[partialIndex];
string jsonText = File.ReadAllText(path);
SteamVR_PartialInputBindings partialBinding = JsonConvert.DeserializeObject<SteamVR_PartialInputBindings>(jsonText);
partialBinding.path = path;
if (partialBindings.ContainsKey(partialBinding.name))
{
for (int versionIndex = 0; versionIndex < partialBindings[partialBinding.name].Count; versionIndex++)
{
if (partialBinding.version < partialBindings[partialBinding.name][versionIndex].version)
partialBindings[partialBinding.name].Insert(versionIndex, partialBinding);
}
}
else
{
partialBindings.Add(partialBinding.name, new List<SteamVR_PartialInputBindings>() { partialBinding });
}
}
return partialBindings;
}
}
public class SteamVR_PartialInputBindings
{
public string name;
public int version;
public bool overwriteOld;
public bool removeUnused;
public bool imported;
[JsonIgnore]
public string path { get; set; }
public string GetActionsPath()
{
return Path.Combine(GetDirectory(), "actions.json");
}
public string GetDirectory()
{
return new FileInfo(path).Directory.FullName;
}
public void Save()
{
FileInfo existingActionsFile = new FileInfo(path);
if (existingActionsFile.Exists)
{
existingActionsFile.IsReadOnly = false;
}
//SanitizeActionFile(); //todo: shouldn't we be doing this?
string json = JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
File.WriteAllText(path, json);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8c0dec2678a8ce94dbdd749500441172
timeCreated: 1540850400
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,177 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_ActionSet))]
public class SteamVR_Input_ActionSetPropertyEditor : PropertyDrawer
{
protected SteamVR_ActionSet[] actionSets;
protected string[] enumItems;
public int selectedIndex = notInitializedIndex;
protected const int notInitializedIndex = -1;
protected const int noneIndex = 0;
protected int addIndex = 1;
protected const string defaultPathTemplate = " \u26A0 Missing action set: {0}";
protected string defaultPathLabel = null;
protected void Awake()
{
actionSets = SteamVR_Input.GetActionSets();
if (actionSets != null && actionSets.Length > 0)
{
List<string> enumList = actionSets.Select(actionSet => actionSet.fullPath).ToList();
enumList.Insert(noneIndex, "None");
//replace forward slashes with backslack instead
for (int index = 0; index < enumList.Count; index++)
enumList[index] = enumList[index].Replace('/', '\\');
enumList.Add("Add...");
enumItems = enumList.ToArray();
}
else
{
enumItems = new string[] { "None", "Add..." };
}
addIndex = enumItems.Length - 1;
/*
//keep sub menus:
for (int index = 0; index < enumItems.Length; index++)
if (enumItems[index][0] == '/')
enumItems[index] = enumItems[index].Substring(1);
*/
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
float height = base.GetPropertyHeight(property, label);
SerializedProperty actionPathProperty = property.FindPropertyRelative("actionSetPath");
if (string.IsNullOrEmpty(actionPathProperty.stringValue) == false)
{
if (selectedIndex == 0)
return height * 2;
}
return height;
}
// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (SteamVR_Input.actions == null || SteamVR_Input.actions.Length == 0)
{
EditorGUI.BeginProperty(position, label, property);
EditorGUI.LabelField(position, "Please generate SteamVR Input actions");
EditorGUI.EndProperty();
return;
}
if (enumItems == null || enumItems.Length == 0)
{
Awake();
}
// Using BeginProperty / EndProperty on the parent property means that
// prefab override logic works on the entire property.
EditorGUI.BeginProperty(position, label, property);
SerializedProperty actionPathProperty = property.FindPropertyRelative("actionSetPath");
string currentPath = null;
if (actionPathProperty != null)
{
currentPath = actionPathProperty.stringValue;
if (string.IsNullOrEmpty(currentPath) == false)
{
for (int actionSetIndex = 0; actionSetIndex < actionSets.Length; actionSetIndex++)
{
if (actionSets[actionSetIndex].fullPath == currentPath)
{
selectedIndex = actionSetIndex + 1; // account for none option
break;
}
}
}
}
if (selectedIndex == notInitializedIndex)
selectedIndex = 0;
Rect labelPosition = position;
labelPosition.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelPosition, label);
Rect fieldPosition = position;
fieldPosition.x = (labelPosition.x + labelPosition.width);
fieldPosition.width = EditorGUIUtility.currentViewWidth - (labelPosition.x + labelPosition.width) - 5 - 16;
if (selectedIndex == 0 && string.IsNullOrEmpty(currentPath) == false)
{
if (defaultPathLabel == null)
defaultPathLabel = string.Format(defaultPathTemplate, currentPath);
Rect defaultLabelPosition = position;
defaultLabelPosition.y = position.y + fieldPosition.height / 2f;
EditorGUI.LabelField(defaultLabelPosition, defaultPathLabel);
}
Rect objectRect = position;
objectRect.x = fieldPosition.x + fieldPosition.width + 15;
objectRect.width = 10;
bool showInputWindow = false;
int wasSelected = selectedIndex;
selectedIndex = EditorGUI.Popup(fieldPosition, selectedIndex, enumItems);
if (selectedIndex != wasSelected)
{
if (selectedIndex == noneIndex || selectedIndex == notInitializedIndex)
{
selectedIndex = noneIndex;
actionPathProperty.stringValue = null;
}
else if (selectedIndex == addIndex)
{
selectedIndex = wasSelected; // don't change the index
showInputWindow = true;
}
else
{
int actionIndex = selectedIndex - 1; // account for none option
actionPathProperty.stringValue = actionSets[actionIndex].GetPath();
//property.objectReferenceValue = actions[actionIndex];
}
property.serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndProperty();
if (showInputWindow)
SteamVR_Input_EditorWindow.ShowWindow(); //show the input window so they can add a new actionset
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 074d66e09af4e46429424ca09a9c3402
timeCreated: 1521655060
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Boolean))]
public class SteamVR_Input_Action_Boolean_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Boolean>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 779685f855764aa449874336c160b4d0
timeCreated: 1521130773
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,187 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
public class SteamVR_Input_Action_GenericPropertyEditor<T> : PropertyDrawer where T : SteamVR_Action, new()
{
protected T[] actions;
protected string[] enumItems;
public int selectedIndex = notInitializedIndex;
protected const int notInitializedIndex = -1;
protected const int noneIndex = 0;
protected int addIndex = 1;
protected const string defaultPathTemplate = " \u26A0 Missing action: {0}";
protected string defaultPathLabel = null;
protected void Awake()
{
actions = SteamVR_Input.GetActions<T>();
if (actions != null && actions.Length > 0)
{
List<string> enumList = actions.Select(action => action.fullPath).ToList();
enumList.Insert(noneIndex, "None");
//replace forward slashes with backslack instead
for (int index = 0; index < enumList.Count; index++)
enumList[index] = enumList[index].Replace('/', '\\');
enumList.Add("Add...");
enumItems = enumList.ToArray();
}
else
{
enumItems = new string[] { "None", "Add..." };
}
addIndex = enumItems.Length - 1;
/*
//keep sub menus:
for (int index = 0; index < enumItems.Length; index++)
if (enumItems[index][0] == '/')
enumItems[index] = enumItems[index].Substring(1);
*/
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
float height = base.GetPropertyHeight(property, label);
SerializedProperty actionPathProperty = property.FindPropertyRelative("actionPath");
if (string.IsNullOrEmpty(actionPathProperty.stringValue) == false)
{
if (selectedIndex == 0)
return height * 2;
}
return height;
}
// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (SteamVR_Input.actions == null || SteamVR_Input.actions.Length == 0)
{
EditorGUI.BeginProperty(position, label, property);
EditorGUI.LabelField(position, "Please generate SteamVR Input actions");
EditorGUI.EndProperty();
return;
}
if (enumItems == null || enumItems.Length == 0)
{
Awake();
}
// Using BeginProperty / EndProperty on the parent property means that
// prefab override logic works on the entire property.
EditorGUI.BeginProperty(position, label, property);
SerializedProperty actionPathProperty = property.FindPropertyRelative("actionPath");
string currentPath = null;
if (actionPathProperty != null)
{
currentPath = actionPathProperty.stringValue;
if (string.IsNullOrEmpty(currentPath) == false)
{
SteamVR_Action existingAction = SteamVR_Action.FindExistingActionForPartialPath(currentPath);
if (existingAction != null)
{
if (currentPath != existingAction.GetPath())
{
actionPathProperty.stringValue = existingAction.GetPath();
property.serializedObject.ApplyModifiedProperties();
}
currentPath = existingAction.GetPath();
}
for (int actionsIndex = 0; actionsIndex < actions.Length; actionsIndex++)
{
if (actions[actionsIndex].fullPath == currentPath)
{
selectedIndex = actionsIndex + 1; // account for none option
break;
}
}
}
}
if (selectedIndex == notInitializedIndex)
selectedIndex = 0;
Rect labelPosition = position;
labelPosition.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelPosition, label);
Rect fieldPosition = position;
fieldPosition.x = (labelPosition.x + labelPosition.width);
fieldPosition.width = EditorGUIUtility.currentViewWidth - (labelPosition.x + labelPosition.width) - 5;
if (selectedIndex == 0 && string.IsNullOrEmpty(currentPath) == false)
{
if (defaultPathLabel == null)
defaultPathLabel = string.Format(defaultPathTemplate, currentPath);
Rect defaultLabelPosition = position;
defaultLabelPosition.y = position.y + fieldPosition.height / 2f;
EditorGUI.LabelField(defaultLabelPosition, defaultPathLabel);
}
bool showInputWindow = false;
int wasSelected = selectedIndex;
selectedIndex = EditorGUI.Popup(fieldPosition, selectedIndex, enumItems);
if (selectedIndex != wasSelected)
{
if (selectedIndex == noneIndex || selectedIndex == notInitializedIndex)
{
selectedIndex = noneIndex;
actionPathProperty.stringValue = null;
}
else if (selectedIndex == addIndex)
{
selectedIndex = wasSelected; // don't change the index
showInputWindow = true;
}
else
{
int actionIndex = selectedIndex - 1; // account for none option
actionPathProperty.stringValue = actions[actionIndex].GetPath();
//property.objectReferenceValue = actions[actionIndex];
}
property.serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndProperty();
if (showInputWindow)
SteamVR_Input_EditorWindow.ShowWindow(); //show the input window so they can add a new action
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2800414421e3d124486646cbf8206a64
timeCreated: 1520474969
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7f01bda1d81aff44b8832e1779ef392f
timeCreated: 1521130773
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bc5014b5bd4c9254885346ccb2479e34
timeCreated: 1521130774
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Pose))]
public class SteamVR_Input_Action_Pose_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Pose>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6c580c8ee65b2064b9cecf9c8a56b126
timeCreated: 1521130773
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
// removed

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ef30f8b815c7563459f9bb661516015e
timeCreated: 1521130774
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Single))]
public class SteamVR_Input_Action_Single_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Single>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4830402dc20240e4ea78925fdf5cb924
timeCreated: 1521652403
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Skeleton))]
public class SteamVR_Input_Action_Skeleton_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Skeleton>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 67e9f92e8ad511b47ac9bd0e49834d0f
timeCreated: 1521652403
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Vector2))]
public class SteamVR_Input_Action_Vector2_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Vector2>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 44945f1de2d06c843bbacc0c37a431c2
timeCreated: 1521652403
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Vector3))]
public class SteamVR_Input_Action_Vector3_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Vector3>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 08029b867fa0bbf4bb41613c2ebb449e
timeCreated: 1521652403
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
namespace Valve.VR
{
[CustomPropertyDrawer(typeof(SteamVR_Action_Vibration))]
public class SteamVR_Input_Action_Vibration_PropertyEditor : SteamVR_Input_Action_GenericPropertyEditor<SteamVR_Action_Vibration>
{
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6687413c4fe847b418c7a33716013e07
timeCreated: 1521742954
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
{
"name": "SteamVR_Input_Editor",
"references": [
"SteamVR",
"Unity.XR.OpenVR"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2476fd5d698aa614194466a3af5d192f
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 03dc30b5b3080b44ab840459bbaf7b78
timeCreated: 1521247554
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- skin: {fileID: 11400000, guid: 7836f978f062019499564a455654e74a, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,861 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Reflection;
using System.Linq.Expressions;
using UnityEditor.SceneManagement;
using UnityEditor.Callbacks;
using Valve.Newtonsoft.Json;
namespace Valve.VR
{
#pragma warning disable 0219 // variable assigned but not used.
public static class SteamVR_Input_Generator
{
public const string steamVRInputOverwriteBuildKey = "SteamVR_Input_OverwriteBuild";
public const string steamVRInputDeleteUnusedKey = "SteamVR_Input_DeleteUnused";
private const string actionSetClassNamePrefix = "SteamVR_Input_ActionSet_";
public const string generationNeedsReloadKey = "SteamVR_Input_GenerationNeedsReload";
private const string progressBarTitle = "SteamVR Input Generation";
public const string steamVRInputActionSetClassesFolder = "ActionSetClasses";
public const string steamVRInputActionsClass = "SteamVR_Input_Actions";
public const string steamVRInputActionSetsClass = "SteamVR_Input_ActionSets";
public const string steamVRInputInitializationClass = "SteamVR_Input_Initialization";
public const string steamVRActionsAssemblyDefinition = "SteamVR_Actions";
private static bool generating = false;
public static void BeginGeneration()
{
generating = true;
fileChanged = false;
SteamVR_Input_EditorWindow.SetProgressBarText("Beginning generation...", 0);
GenerationStep_CreateActionSetClasses();
GenerationStep_CreateHelperClasses();
GenerationStep_CreateInitClass();
GenerationStep_CreateAssemblyDefinition();
DeleteUnusedScripts();
if (fileChanged)
EditorPrefs.SetBool(generationNeedsReloadKey, true);
AssetDatabase.Refresh();
SteamVR_Input_EditorWindow.ClearProgressBar();
generating = false;
}
[DidReloadScripts]
private static void OnReload()
{
bool didGenerate = EditorPrefs.GetBool(generationNeedsReloadKey);
if (didGenerate)
{
EditorPrefs.SetBool(generationNeedsReloadKey, false);
if (string.IsNullOrEmpty(EditorSceneManager.GetActiveScene().path) == false)
EditorApplication.delayCall += ReloadScene;
}
}
public static void ReloadScene()
{
EditorPrefs.SetBool(generationNeedsReloadKey, false);
if (string.IsNullOrEmpty(EditorSceneManager.GetActiveScene().path) == false)
{
if (EditorSceneManager.GetActiveScene().isDirty)
{
EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
}
string previousPath = EditorSceneManager.GetActiveScene().path;
EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);
EditorSceneManager.OpenScene(previousPath); //reload open scene to avoid any weird serialization
}
}
public static bool IsGenerating()
{
return generating;
}
public static void CancelGeneration()
{
generating = false;
}
private static List<CodeTypeDeclaration> setClasses = new List<CodeTypeDeclaration>();
private static void GenerationStep_CreateInitClass()
{
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeTypeDeclaration inputClass = CreatePartialInputClass(compileUnit);
CodeMemberMethod preinitMethod = CreateStaticMethod(inputClass, SteamVR_Input_Generator_Names.preinitializeMethodName, true);
string steamVRInputClassName = typeof(SteamVR_Input).Name;
AddStaticInvokeToMethod(preinitMethod, SteamVR_Input_Generator_Names.actionsClassName, startPreInitActionSetsMethodName);
AddStaticInvokeToMethod(preinitMethod, steamVRInputClassName, initializeActionSetDictionariesMethodName);
AddStaticInvokeToMethod(preinitMethod, SteamVR_Input_Generator_Names.actionsClassName, preInitActionsMethodName);
AddStaticInvokeToMethod(preinitMethod, SteamVR_Input_Generator_Names.actionsClassName, initializeActionsArraysMethodName);
AddStaticInvokeToMethod(preinitMethod, steamVRInputClassName, initializeActionDictionariesMethodName);
AddStaticInvokeToMethod(preinitMethod, steamVRInputClassName, finishPreInitActionSetsMethodName);
// Build the output file name.
string fullSourceFilePath = GetSourceFilePath(steamVRInputInitializationClass);
CreateFile(fullSourceFilePath, compileUnit);
}
private static void GenerationStep_CreateAssemblyDefinition()
{
string fullSourceFilePath = GetSourceFilePath(steamVRActionsAssemblyDefinition, ".asmdef");
if (File.Exists(fullSourceFilePath) == false)
{
SteamVR_Input_Unity_AssemblyFile_Definition actionsAssemblyDefinitionData = new SteamVR_Input_Unity_AssemblyFile_Definition();
actionsAssemblyDefinitionData.autoReferenced = true;
string jsonText = JsonConvert.SerializeObject(actionsAssemblyDefinitionData, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Include });
File.WriteAllText(fullSourceFilePath, jsonText);
}
}
private static void GenerationStep_CreateActionSetClasses()
{
SteamVR_Input_EditorWindow.SetProgressBarText("Generating action set classes...", 0.25f);
SteamVR_Input.InitializeFile();
CreateActionsSubFolder();
setClasses = GenerateActionSetClasses();
Debug.LogFormat("<b>[SteamVR Input]</b> Created input script set classes: {0}", setClasses.Count);
}
private static void GenerationStep_CreateHelperClasses()
{
SteamVR_Input_EditorWindow.SetProgressBarText("Generating actions and actionsets classes...", 0.5f);
GenerateActionHelpers(steamVRInputActionsClass);
GenerateActionSetsHelpers(steamVRInputActionSetsClass);
string actionsFullpath = Path.Combine(GetClassPath(), steamVRInputActionsClass + ".cs");
string actionSetsFullpath = Path.Combine(GetClassPath(), steamVRInputActionSetsClass + ".cs");
Debug.LogFormat("<b>[SteamVR Input]</b> Created input script main classes: {0} and {1}", actionsFullpath, actionSetsFullpath);
}
private static void DeleteUnusedScripts()
{
string folderPath = GetSubFolderPath();
string[] files = Directory.GetFiles(folderPath);
List<string> toDelete = new List<string>();
for (int fileIndex = 0; fileIndex < files.Length; fileIndex++)
{
FileInfo file = new FileInfo(files[fileIndex]);
if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".cs.meta"))
{
bool isSet = false;
if (SteamVR_Input.actionFile.action_sets.Any(set => string.Equals(GetSetClassName(set) + ".cs", file.Name, StringComparison.CurrentCultureIgnoreCase) ||
string.Equals(GetSetClassName(set) + ".cs.meta", file.Name, StringComparison.CurrentCultureIgnoreCase)))
{
isSet = true;
}
bool isAction = false;
if (SteamVR_Input.actionFile.actions.Any(action => string.Equals(action.codeFriendlyName + ".cs", file.Name, StringComparison.CurrentCultureIgnoreCase) ||
string.Equals(action.codeFriendlyName + ".cs.meta", file.Name, StringComparison.CurrentCultureIgnoreCase)))
{
isAction = true;
}
if (isSet == false && isAction == false)
{
toDelete.Add(files[fileIndex]);
}
}
}
if (toDelete.Count > 0)
{
string filesToDelete = "";
foreach (string file in toDelete)
filesToDelete += file + "\n";
bool confirm = EditorUtility.DisplayDialog("SteamVR Input", "Would you like to delete the following unused input files:\n" + filesToDelete, "Delete", "No");
if (confirm)
{
foreach (string fileName in toDelete)
{
FileInfo file = new FileInfo(fileName);
file.IsReadOnly = false;
file.Delete();
}
}
}
}
private static void CreateActionsSubFolder()
{
string folderPath = GetSubFolderPath();
if (Directory.Exists(folderPath) == false)
{
Directory.CreateDirectory(folderPath);
}
}
public static void DeleteActionClassFiles()
{
DeleteActionClass(steamVRInputActionsClass);
DeleteActionClass(steamVRInputActionSetsClass);
string folderPath = GetSubFolderPath();
bool confirm = EditorUtility.DisplayDialog("Confirmation", "Are you absolutely sure you want to delete all code files in " + folderPath + "?", "Delete", "Cancel");
if (confirm)
{
DeleteActionObjects("*.cs*");
}
}
public static void DeleteGeneratedFolder()
{
string generatedFolderPath = GetClassPath();
string subFolderPath = GetSubFolderPath();
bool confirm = EditorUtility.DisplayDialog("Confirmation", "Are you absolutely sure you want to delete all code files in " + generatedFolderPath + "?", "Delete", "Cancel");
if (confirm)
{
DeleteActionObjects("*.cs*", generatedFolderPath);
DeleteActionObjects("*.cs*", subFolderPath);
}
}
public static void DeleteActionObjects(string filter, string folderPath = null)
{
if (folderPath == null)
folderPath = GetSubFolderPath();
string[] assets = Directory.GetFiles(folderPath, filter);
for (int assetIndex = 0; assetIndex < assets.Length; assetIndex++)
{
AssetDatabase.DeleteAsset(assets[assetIndex]);
}
Debug.LogFormat("<b>[SteamVR Input]</b> Deleted {0} files at path: {1}", assets.Length, folderPath);
}
private static void DeleteActionClass(string className)
{
string filePath = GetSourceFilePath(className);
if (File.Exists(filePath) == true)
{
AssetDatabase.DeleteAsset(filePath);
Debug.Log("<b>[SteamVR Input]</b> Deleted: " + filePath);
}
else
{
Debug.Log("<b>[SteamVR Input]</b> No file found at: " + filePath);
}
}
private static string GetTypeStringForAction(SteamVR_Input_ActionFile_Action action)
{
return GetTypeForAction(action).Name;
}
private static Type GetTypeForAction(SteamVR_Input_ActionFile_Action action)
{
string actionType = action.type.ToLower();
if (SteamVR_Input_ActionFile_ActionTypes.boolean == actionType)
{
return typeof(SteamVR_Action_Boolean);
}
if (SteamVR_Input_ActionFile_ActionTypes.vector1 == actionType)
{
return typeof(SteamVR_Action_Single);
}
if (SteamVR_Input_ActionFile_ActionTypes.vector2 == actionType)
{
return typeof(SteamVR_Action_Vector2);
}
if (SteamVR_Input_ActionFile_ActionTypes.vector3 == actionType)
{
return typeof(SteamVR_Action_Vector3);
}
if (SteamVR_Input_ActionFile_ActionTypes.pose == actionType)
{
return typeof(SteamVR_Action_Pose);
}
if (SteamVR_Input_ActionFile_ActionTypes.skeleton == actionType)
{
return typeof(SteamVR_Action_Skeleton);
}
if (SteamVR_Input_ActionFile_ActionTypes.vibration == actionType)
{
return typeof(SteamVR_Action_Vibration);
}
throw new System.Exception("unknown type (" + action.type + ") in actions file for action: " + action.name);
}
private static string GetClassPath()
{
string path = Path.Combine(SteamVR.GetSteamVRFolderParentPath(), SteamVR_Settings.instance.steamVRInputPath);
if (Directory.Exists(path) == false)
Directory.CreateDirectory(path);
return path;
}
private static string GetSubFolderPath()
{
return Path.Combine(GetClassPath(), steamVRInputActionSetClassesFolder);
}
private static string GetSourceFilePath(string classname, string suffix = ".cs")
{
string sourceFileName = string.Format("{0}{1}", classname, suffix);
return Path.Combine(GetClassPath(), sourceFileName);
}
private static bool fileChanged = false;
private static void CreateFile(string fullPath, CodeCompileUnit compileUnit)
{
// Generate the code with the C# code provider.
CSharpCodeProvider provider = new CSharpCodeProvider();
// Build the output file name.
string fullSourceFilePath = fullPath;
//Debug.Log("[SteamVR] Writing class to: " + fullSourceFilePath);
string path = GetClassPath();
string priorMD5 = null;
FileInfo file = new FileInfo(fullSourceFilePath);
if (file.Exists)
{
file.IsReadOnly = false;
priorMD5 = SteamVR_Utils.GetBadMD5HashFromFile(fullSourceFilePath);
}
// Create a TextWriter to a StreamWriter to the output file.
using (StreamWriter sw = new StreamWriter(fullSourceFilePath, false))
{
IndentedTextWriter tw = new IndentedTextWriter(sw, " ");
// Generate source code using the code provider.
provider.GenerateCodeFromCompileUnit(compileUnit, tw,
new CodeGeneratorOptions() { BracingStyle = "C" });
// Close the output file.
tw.Close();
string newMD5 = SteamVR_Utils.GetBadMD5HashFromFile(fullSourceFilePath);
if (priorMD5 != newMD5)
fileChanged = true;
}
//Debug.Log("[SteamVR] Complete! Input class at: " + fullSourceFilePath);
}
private const string getActionMethodParamName = "path";
private const string skipStateUpdatesParamName = "skipStateAndEventUpdates";
private static List<CodeTypeDeclaration> GenerateActionSetClasses()
{
List<CodeTypeDeclaration> setClasses = new List<CodeTypeDeclaration>();
for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionFile.action_sets.Count; actionSetIndex++)
{
SteamVR_Input_ActionFile_ActionSet actionSet = SteamVR_Input.actionFile.action_sets[actionSetIndex];
CodeTypeDeclaration setClass = CreateActionSetClass(actionSet);
setClasses.Add(setClass);
}
return setClasses;
}
private const string initializeActionDictionariesMethodName = "PreinitializeActionDictionaries";
private const string initializeActionSetDictionariesMethodName = "PreinitializeActionSetDictionaries";
private const string preInitActionsMethodName = "PreInitActions";
private const string initializeActionsArraysMethodName = "InitializeActionArrays";
private static void GenerateActionHelpers(string actionsClassFileName)
{
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeTypeDeclaration inputClass = CreatePartialInputClass(compileUnit);
CodeArrayCreateExpression actionsArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action)));
CodeArrayCreateExpression actionsInArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(ISteamVR_Action_In)));
CodeArrayCreateExpression actionsOutArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(ISteamVR_Action_Out)));
CodeArrayCreateExpression actionsVibrationArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Vibration)));
CodeArrayCreateExpression actionsPoseArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Pose)));
CodeArrayCreateExpression actionsSkeletonArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Skeleton)));
CodeArrayCreateExpression actionsBooleanArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Boolean)));
CodeArrayCreateExpression actionsSingleArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Single)));
CodeArrayCreateExpression actionsVector2Array = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Vector2)));
CodeArrayCreateExpression actionsVector3Array = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_Action_Vector3)));
CodeArrayCreateExpression actionsNonPoseNonSkeletonArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(ISteamVR_Action_In)));
//add the getaction method to
CodeMemberMethod actionsArraysInitMethod = CreateStaticMethod(inputClass, initializeActionsArraysMethodName, false);
CodeMemberMethod actionsPreInitMethod = CreateStaticMethod(inputClass, preInitActionsMethodName, false);
for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionFile.action_sets.Count; actionSetIndex++)
{
SteamVR_Input_ActionFile_ActionSet actionSet = SteamVR_Input.actionFile.action_sets[actionSetIndex];
string actionSetShortName = actionSet.shortName;
actionSetShortName = actionSetShortName.Substring(0, 1).ToLower() + actionSetShortName.Substring(1);
for (int actionIndex = 0; actionIndex < actionSet.actionsList.Count; actionIndex++)
{
SteamVR_Input_ActionFile_Action action = actionSet.actionsList[actionIndex];
string actionShortName = action.shortName;
string typeName = GetTypeStringForAction(action);
string codeFriendlyInstanceName;
if (actionSet.actionsList.Count(findAction => findAction.shortName == actionShortName) >= 2)
codeFriendlyInstanceName = string.Format("{0}_{1}_{2}", actionSetShortName, action.direction.ToString().ToLower(), actionShortName);
else
codeFriendlyInstanceName = string.Format("{0}_{1}", actionSetShortName, actionShortName);
CodeMemberField actionField = CreateFieldAndPropertyWrapper(inputClass, codeFriendlyInstanceName, typeName);
AddAssignActionStatement(actionsPreInitMethod, inputClass.Name, actionField.Name, action.name, typeName);
actionsArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
if (action.direction == SteamVR_ActionDirections.In)
{
actionsInArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
if (typeName == typeof(SteamVR_Action_Pose).Name)
{
actionsPoseArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
else if (typeName == typeof(SteamVR_Action_Skeleton).Name)
{
actionsSkeletonArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
else if (typeName == typeof(SteamVR_Action_Boolean).Name)
{
actionsBooleanArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
else if (typeName == typeof(SteamVR_Action_Single).Name)
{
actionsSingleArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
else if (typeName == typeof(SteamVR_Action_Vector2).Name)
{
actionsVector2Array.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
else if (typeName == typeof(SteamVR_Action_Vector3).Name)
{
actionsVector3Array.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
if ((typeName == typeof(SteamVR_Action_Skeleton).Name) == false && (typeName == typeof(SteamVR_Action_Pose).Name) == false)
{
actionsNonPoseNonSkeletonArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
}
else
{
actionsVibrationArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
actionsOutArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
}
}
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsFieldName, actionsArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsInFieldName, actionsInArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsOutFieldName, actionsOutArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsVibrationFieldName, actionsVibrationArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsPoseFieldName, actionsPoseArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsBooleanFieldName, actionsBooleanArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsSingleFieldName, actionsSingleArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsVector2FieldName, actionsVector2Array);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsVector3FieldName, actionsVector3Array);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsSkeletonFieldName, actionsSkeletonArray);
AddAssignStatement(actionsArraysInitMethod, SteamVR_Input_Generator_Names.actionsNonPoseNonSkeletonIn, actionsNonPoseNonSkeletonArray);
// Build the output file name.
string fullSourceFilePath = GetSourceFilePath(actionsClassFileName);
CreateFile(fullSourceFilePath, compileUnit);
}
private const string startPreInitActionSetsMethodName = "StartPreInitActionSets";
private const string finishPreInitActionSetsMethodName = "PreinitializeFinishActionSets";
private static void GenerateActionSetsHelpers(string actionSetsClassFileName)
{
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeTypeDeclaration inputClass = CreatePartialInputClass(compileUnit);
CodeMemberMethod startPreInitActionSetsMethod = CreateStaticMethod(inputClass, startPreInitActionSetsMethodName, false);
CodeArrayCreateExpression actionSetsArray = new CodeArrayCreateExpression(new CodeTypeReference(typeof(SteamVR_ActionSet)));
for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionFile.action_sets.Count; actionSetIndex++)
{
SteamVR_Input_ActionFile_ActionSet actionSet = SteamVR_Input.actionFile.action_sets[actionSetIndex];
string shortName = GetValidIdentifier(actionSet.shortName);
string codeFriendlyInstanceName = shortName;
string setTypeName = GetSetClassName(actionSet);
CodeMemberField actionSetField = CreateFieldAndPropertyWrapper(inputClass, shortName, setTypeName);
AddAssignActionSetStatement(startPreInitActionSetsMethod, inputClass.Name, actionSetField.Name, actionSet.name, setTypeName);
actionSetsArray.Initializers.Add(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), codeFriendlyInstanceName));
}
AddAssignStatement(startPreInitActionSetsMethod, SteamVR_Input_Generator_Names.actionSetsFieldName, actionSetsArray);
// Build the output file name.
string fullSourceFilePath = GetSourceFilePath(actionSetsClassFileName);
CreateFile(fullSourceFilePath, compileUnit);
}
private static CSharpCodeProvider provider = new CSharpCodeProvider();
private static string GetValidIdentifier(string name)
{
string newName = name.Replace("-", "_");
newName = provider.CreateValidIdentifier(newName);
return newName;
}
public static MethodInfo GetMethodInfo<T>(Expression<Action<T>> expression)
{
var member = expression.Body as MethodCallExpression;
if (member != null)
return member.Method;
throw new ArgumentException("Expression is not a method", "expression");
}
private static CodeTypeDeclaration CreatePartialInputClass(CodeCompileUnit compileUnit)
{
CodeNamespace codeNamespace = new CodeNamespace(typeof(SteamVR_Input).Namespace);
codeNamespace.Imports.Add(new CodeNamespaceImport("System"));
codeNamespace.Imports.Add(new CodeNamespaceImport("UnityEngine"));
compileUnit.Namespaces.Add(codeNamespace);
CodeTypeDeclaration inputClass = new CodeTypeDeclaration(SteamVR_Input_Generator_Names.actionsClassName);
inputClass.IsPartial = true;
codeNamespace.Types.Add(inputClass);
return inputClass;
}
private static string GetSetClassName(SteamVR_Input_ActionFile_ActionSet set)
{
return actionSetClassNamePrefix + set.shortName;
}
private const string inActionFieldPrefix = "in_";
private const string outActionFieldPrefix = "out_";
private const string setFinishPreInitializeMethodName = "FinishPreInitialize";
private static CodeTypeDeclaration CreateActionSetClass(SteamVR_Input_ActionFile_ActionSet set)
{
CodeCompileUnit compileUnit = new CodeCompileUnit();
CodeNamespace codeNamespace = new CodeNamespace(typeof(SteamVR_Input).Namespace);
codeNamespace.Imports.Add(new CodeNamespaceImport("System"));
codeNamespace.Imports.Add(new CodeNamespaceImport("UnityEngine"));
compileUnit.Namespaces.Add(codeNamespace);
CodeTypeDeclaration setClass = new CodeTypeDeclaration(GetSetClassName(set));
setClass.BaseTypes.Add(typeof(SteamVR_ActionSet));
setClass.Attributes = MemberAttributes.Public;
codeNamespace.Types.Add(setClass);
string actionSetShortName = set.shortName;
actionSetShortName = actionSetShortName.Substring(0, 1).ToLower() + actionSetShortName.Substring(1);
foreach (var inAction in set.actionsInList)
{
string inActionName = inAction.shortName;
if (set.actionsOutList.Any(outAction => inAction.shortName == outAction.shortName))
inActionName = inActionFieldPrefix + inActionName;
string actionClassPropertyName = string.Format("{0}_{1}", actionSetShortName, inActionName);
CreateActionPropertyWrapper(setClass, SteamVR_Input_Generator_Names.actionsClassName, inActionName, actionClassPropertyName, inAction);
}
foreach (var outAction in set.actionsOutList)
{
string outActionName = outAction.shortName;
if (set.actionsInList.Any(inAction => inAction.shortName == outAction.shortName))
outActionName = outActionFieldPrefix + outActionName;
string actionClassPropertyName = string.Format("{0}_{1}", actionSetShortName, outActionName);
CreateActionPropertyWrapper(setClass, SteamVR_Input_Generator_Names.actionsClassName, outActionName, actionClassPropertyName, outAction);
}
// Build the output file name.
string folderPath = GetSubFolderPath();
string fullSourceFilePath = Path.Combine(folderPath, setClass.Name + ".cs");
CreateFile(fullSourceFilePath, compileUnit);
return setClass;
}
private static CodeMemberMethod CreateStaticMethod(CodeTypeDeclaration inputClass, string methodName, bool isPublic)
{
CodeMemberMethod method = new CodeMemberMethod();
method.Name = methodName;
if (isPublic)
method.Attributes = MemberAttributes.Public | MemberAttributes.Static;
else
method.Attributes = MemberAttributes.Private | MemberAttributes.Static;
inputClass.Members.Add(method);
return method;
}
private static CodeMemberMethod CreateStaticConstructorMethod(CodeTypeDeclaration inputClass)
{
CodeTypeConstructor method = new CodeTypeConstructor();
method.Attributes = MemberAttributes.Static;
inputClass.Members.Add(method);
return method;
}
private static CodeMemberField CreateField(CodeTypeDeclaration inputClass, string fieldName, Type fieldType, bool isStatic)
{
if (fieldType == null)
Debug.Log("null fieldType");
CodeMemberField field = new CodeMemberField();
field.Name = fieldName;
field.Type = new CodeTypeReference(fieldType);
field.Attributes = MemberAttributes.Public;
if (isStatic)
field.Attributes |= MemberAttributes.Static;
inputClass.Members.Add(field);
return field;
}
private static CodeMemberField CreateFieldAndPropertyWrapper(CodeTypeDeclaration inputClass, string name, string type)
{
CodeMemberField actionField = CreatePrivateField(inputClass, name, type, true);
CodeMemberProperty actionProperty = CreateStaticProperty(inputClass, name, type, actionField);
return actionField;
}
private static CodeMemberProperty CreateStaticProperty(CodeTypeDeclaration inputClass, string propertyName, string propertyType, CodeMemberField privateField)
{
CodeMemberProperty property = new CodeMemberProperty();
property.Name = propertyName;
property.Type = new CodeTypeReference(propertyType);
property.Attributes = MemberAttributes.Public | MemberAttributes.Static;
CodeFieldReferenceExpression fieldReference = new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(inputClass.Name), privateField.Name);
CodeMethodInvokeExpression invokeExpression = new CodeMethodInvokeExpression(fieldReference, "GetCopy");
invokeExpression.Method.TypeArguments.Add(property.Type);
CodeMethodReturnStatement returnStatement = new CodeMethodReturnStatement(invokeExpression);
property.GetStatements.Add(returnStatement);
inputClass.Members.Add(property);
return property;
}
private static CodeMemberProperty CreateActionPropertyWrapper(CodeTypeDeclaration addToClass, string actionClass, string propertyName, string actionClassFieldName, SteamVR_Input_ActionFile_Action action)
{
string propertyType = GetTypeStringForAction(action);
CodeMemberProperty property = new CodeMemberProperty();
property.Name = propertyName;
property.Type = new CodeTypeReference(propertyType);
property.Attributes = MemberAttributes.Public;
CodeFieldReferenceExpression fieldReference = new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(actionClass), actionClassFieldName);
CodeMethodReturnStatement returnStatement = new CodeMethodReturnStatement(fieldReference);
property.GetStatements.Add(returnStatement);
addToClass.Members.Add(property);
return property;
}
private const string privateFieldPrefix = "p_";
private static CodeMemberField CreatePrivateField(CodeTypeDeclaration inputClass, string fieldName, string fieldType, bool isStatic)
{
return CreateField(inputClass, privateFieldPrefix + fieldName, fieldType, isStatic, false);
}
private static CodeMemberField CreateField(CodeTypeDeclaration inputClass, string fieldName, string fieldType, bool isStatic, bool isPublic = true)
{
CodeMemberField field = new CodeMemberField();
field.Name = fieldName;
field.Type = new CodeTypeReference(fieldType);
if (isPublic)
field.Attributes = MemberAttributes.Public;
else
field.Attributes = MemberAttributes.Private;
if (isStatic)
field.Attributes |= MemberAttributes.Static;
inputClass.Members.Add(field);
return field;
}
private static CodeMethodInvokeExpression AddStaticInvokeToMethod(CodeMemberMethod methodToAddTo, string classToInvoke, string invokeMethodName)
{
CodeMethodInvokeExpression invokeMethod = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(
new CodeTypeReferenceExpression(classToInvoke), invokeMethodName));
methodToAddTo.Statements.Add(invokeMethod);
return invokeMethod;
}
private static void AddAssignStatement(CodeMemberMethod methodToAddTo, string fieldToAssign, CodeArrayCreateExpression array)
{
methodToAddTo.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_Input)), fieldToAssign), array));
}
private const string createActionMethodName = "Create";
private const string createActionSetMethodName = "Create";
private const string getActionFromPathMethodName = "GetActionFromPath";
//grab = SteamVR_Action.Create<SteamVR_Action_Boolean>("path");
private static void AddAssignActionStatement(CodeMemberMethod methodToAddTo, string actionClassName, string fieldToAssign, string actionPath, string actionType)
{
CodeMethodInvokeExpression invokeMethod = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_Action).Name), createActionMethodName));
invokeMethod.Method.TypeArguments.Add(actionType);
invokeMethod.Parameters.Add(new CodePrimitiveExpression(actionPath));
methodToAddTo.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(actionClassName), fieldToAssign), new CodeCastExpression(new CodeTypeReference(actionType), invokeMethod)));
}
private static void AddAssignActionSetStatement(CodeMemberMethod methodToAddTo, string actionClassName, string fieldToAssign, string actionSetName, string actionSetType)
{
CodeMethodInvokeExpression invokeMethod = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_ActionSet).Name), createActionSetMethodName));
invokeMethod.Method.TypeArguments.Add(actionSetType);
invokeMethod.Parameters.Add(new CodePrimitiveExpression(actionSetName));
methodToAddTo.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(actionClassName), fieldToAssign), new CodeCastExpression(new CodeTypeReference(actionSetType), invokeMethod)));
}
private static void AddAssignLocalActionStatement(CodeMemberMethod methodToAddTo, string fieldToAssign, string actionPath, string actionType, bool create)
{
CodeMethodInvokeExpression invokeMethod;
if (create)
invokeMethod = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_Action).Name), createActionMethodName));
else
invokeMethod = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_Input).Name), getActionFromPathMethodName));
invokeMethod.Method.TypeArguments.Add(actionType);
invokeMethod.Parameters.Add(new CodePrimitiveExpression(actionPath));
methodToAddTo.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), fieldToAssign), new CodeCastExpression(new CodeTypeReference(actionType), invokeMethod)));
}
private static void AddAssignNewInstanceStatement(CodeMemberMethod methodToAddTo, string fieldToAssign, string fieldType)
{
CodeObjectCreateExpression createExpression = new CodeObjectCreateExpression(new CodeTypeReference(fieldType));
methodToAddTo.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), fieldToAssign), createExpression));
}
private static CodeConditionStatement CreateStringCompareStatement(CodeMemberMethod methodToAddTo, string action, string paramName, string returnActionName)
{
MethodInfo stringEqualsMethodInfo = GetMethodInfo<string>(set => string.Equals(null, null, StringComparison.CurrentCultureIgnoreCase));
CodeTypeReferenceExpression stringType = new CodeTypeReferenceExpression(typeof(string));
CodePrimitiveExpression actionName = new CodePrimitiveExpression(action);
CodeVariableReferenceExpression pathName = new CodeVariableReferenceExpression(paramName);
CodeVariableReferenceExpression caseInvariantName = new CodeVariableReferenceExpression("StringComparison.CurrentCultureIgnoreCase");
CodeMethodInvokeExpression stringCompare = new CodeMethodInvokeExpression(stringType, stringEqualsMethodInfo.Name, pathName, actionName, caseInvariantName);
CodeMethodReturnStatement returnAction = new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(SteamVR_Input)), returnActionName));
CodeConditionStatement condition = new CodeConditionStatement(stringCompare, returnAction);
methodToAddTo.Statements.Add(condition);
return condition;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dcf3113e82474c541960a24c222f07b3
timeCreated: 1521479845
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,294 @@
using UnityEditor;
using UnityEngine;
using System.CodeDom;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Linq.Expressions;
using System;
using UnityEditorInternal;
namespace Valve.VR
{
public class SteamVR_Input_LiveWindow : EditorWindow
{
private GUIStyle labelStyle;
private GUIStyle setLabelStyle;
[MenuItem("Window/SteamVR Input Live View")]
public static void ShowWindow()
{
GetWindow<SteamVR_Input_LiveWindow>(false, "SteamVR Input Live View", true);
}
private void OnInspectorUpdate()
{
Repaint();
}
private Vector2 scrollPosition;
private Dictionary<SteamVR_Input_Sources, bool> sourceFoldouts = null;
private Dictionary<SteamVR_Input_Sources, Dictionary<string, bool>> setFoldouts = null;
Color inactiveSetColor = Color.Lerp(Color.red, Color.white, 0.5f);
Color actionUnboundColor = Color.red;
Color actionChangedColor = Color.green;
Color actionNotUpdatingColor = Color.yellow;
private void DrawMap()
{
EditorGUILayout.BeginHorizontal();
//GUILayout.FlexibleSpace();
GUI.backgroundColor = actionUnboundColor;
EditorGUILayout.LabelField("Not Bound", labelStyle);
GUILayout.FlexibleSpace();
GUI.backgroundColor = inactiveSetColor;
EditorGUILayout.LabelField("Inactive", labelStyle);
GUILayout.FlexibleSpace();
GUI.backgroundColor = actionNotUpdatingColor;
EditorGUILayout.LabelField("Not Used Yet", labelStyle);
GUILayout.FlexibleSpace();
GUI.backgroundColor = actionChangedColor;
EditorGUILayout.LabelField("Changed", labelStyle);
//GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
}
private void OnGUI()
{
if (SteamVR_Input.actionSets == null)
{
EditorGUILayout.LabelField("Must first generate actions. Open SteamVR Input window.");
return;
}
bool startUpdatingSourceOnAccess = SteamVR_Action.startUpdatingSourceOnAccess;
SteamVR_Action.startUpdatingSourceOnAccess = false;
if (labelStyle == null)
{
labelStyle = new GUIStyle(EditorStyles.textField);
labelStyle.normal.background = Texture2D.whiteTexture;
setLabelStyle = new GUIStyle(EditorStyles.label);
setLabelStyle.wordWrap = true;
setLabelStyle.normal.background = Texture2D.whiteTexture;
}
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
Color defaultColor = GUI.backgroundColor;
SteamVR_ActionSet[] actionSets = SteamVR_Input.actionSets;
SteamVR_Input_Sources[] sources = SteamVR_Input_Source.GetAllSources();
if (sourceFoldouts == null)
{
sourceFoldouts = new Dictionary<SteamVR_Input_Sources, bool>();
setFoldouts = new Dictionary<SteamVR_Input_Sources, Dictionary<string, bool>>();
for (int sourceIndex = 0; sourceIndex < sources.Length; sourceIndex++)
{
sourceFoldouts.Add(sources[sourceIndex], false);
setFoldouts.Add(sources[sourceIndex], new Dictionary<string, bool>());
for (int actionSetIndex = 0; actionSetIndex < actionSets.Length; actionSetIndex++)
{
SteamVR_ActionSet set = actionSets[actionSetIndex];
setFoldouts[sources[sourceIndex]].Add(set.GetShortName(), true);
}
}
sourceFoldouts[SteamVR_Input_Sources.Any] = true;
sourceFoldouts[SteamVR_Input_Sources.LeftHand] = true;
sourceFoldouts[SteamVR_Input_Sources.RightHand] = true;
}
DrawMap();
for (int sourceIndex = 0; sourceIndex < sources.Length; sourceIndex++)
{
SteamVR_Input_Sources source = sources[sourceIndex];
sourceFoldouts[source] = EditorGUILayout.Foldout(sourceFoldouts[source], source.ToString());
if (sourceFoldouts[source] == false)
continue;
EditorGUI.indentLevel++;
for (int actionSetIndex = 0; actionSetIndex < actionSets.Length; actionSetIndex++)
{
SteamVR_ActionSet set = actionSets[actionSetIndex];
bool setActive = set.IsActive(source);
string activeText = setActive ? "Active" : "Inactive";
float setLastChanged = set.GetTimeLastChanged();
if (setLastChanged != -1)
{
float timeSinceLastChanged = Time.realtimeSinceStartup - setLastChanged;
if (timeSinceLastChanged < 1)
{
Color blendColor = setActive ? Color.green : inactiveSetColor;
Color setColor = Color.Lerp(blendColor, defaultColor, timeSinceLastChanged);
GUI.backgroundColor = setColor;
}
}
EditorGUILayout.BeginHorizontal();
setFoldouts[source][set.GetShortName()] = EditorGUILayout.Foldout(setFoldouts[source][set.GetShortName()], set.GetShortName());
EditorGUILayout.LabelField(activeText, labelStyle);
GUI.backgroundColor = defaultColor;
EditorGUILayout.EndHorizontal();
if (setFoldouts[source][set.GetShortName()] == false)
continue;
EditorGUI.indentLevel++;
for (int actionIndex = 0; actionIndex < set.allActions.Length; actionIndex++)
{
SteamVR_Action action = set.allActions[actionIndex];
if (source != SteamVR_Input_Sources.Any && action is SteamVR_Action_Skeleton)
continue;
bool isUpdating = action.IsUpdating(source);
bool inAction = action is ISteamVR_Action_In;
bool noData = false;
if (inAction && isUpdating == false)
{
GUI.backgroundColor = Color.yellow;
noData = true;
}
else
{
bool actionBound = action.GetActiveBinding(source);
if (setActive == false)
{
GUI.backgroundColor = inactiveSetColor;
}
else if (actionBound == false)
{
GUI.backgroundColor = Color.red;
noData = true;
}
}
if (noData)
{
EditorGUILayout.LabelField(action.GetShortName(), "-", labelStyle);
GUI.backgroundColor = defaultColor;
continue;
}
float actionLastChanged = action.GetTimeLastChanged(source);
string actionText = "";
float timeSinceLastChanged = -1;
if (actionLastChanged != -1)
{
timeSinceLastChanged = Time.realtimeSinceStartup - actionLastChanged;
if (timeSinceLastChanged < 1)
{
Color setColor = Color.Lerp(Color.green, defaultColor, timeSinceLastChanged);
GUI.backgroundColor = setColor;
}
}
if (action is SteamVR_Action_Boolean)
{
SteamVR_Action_Boolean actionBoolean = (SteamVR_Action_Boolean)action;
actionText = actionBoolean.GetState(source).ToString();
}
else if (action is SteamVR_Action_Single)
{
SteamVR_Action_Single actionSingle = (SteamVR_Action_Single)action;
actionText = actionSingle.GetAxis(source).ToString("0.0000");
}
else if (action is SteamVR_Action_Vector2)
{
SteamVR_Action_Vector2 actionVector2 = (SteamVR_Action_Vector2)action;
actionText = string.Format("({0:0.0000}, {1:0.0000})", actionVector2.GetAxis(source).x, actionVector2.GetAxis(source).y);
}
else if (action is SteamVR_Action_Vector3)
{
SteamVR_Action_Vector3 actionVector3 = (SteamVR_Action_Vector3)action;
Vector3 axis = actionVector3.GetAxis(source);
actionText = string.Format("({0:0.0000}, {1:0.0000}, {2:0.0000})", axis.x, axis.y, axis.z);
}
else if (action is SteamVR_Action_Pose)
{
SteamVR_Action_Pose actionPose = (SteamVR_Action_Pose)action;
Vector3 position = actionPose.GetLocalPosition(source);
Quaternion rotation = actionPose.GetLocalRotation(source);
actionText = string.Format("({0:0.0000}, {1:0.0000}, {2:0.0000}) : ({3:0.0000}, {4:0.0000}, {5:0.0000}, {6:0.0000})",
position.x, position.y, position.z,
rotation.x, rotation.y, rotation.z, rotation.w);
}
else if (action is SteamVR_Action_Skeleton)
{
SteamVR_Action_Skeleton actionSkeleton = (SteamVR_Action_Skeleton)action;
Vector3 position = actionSkeleton.GetLocalPosition(source);
Quaternion rotation = actionSkeleton.GetLocalRotation(source);
actionText = string.Format("({0:0.0000}, {1:0.0000}, {2:0.0000}) : ({3:0.0000}, {4:0.0000}, {5:0.0000}, {6:0.0000})",
position.x, position.y, position.z,
rotation.x, rotation.y, rotation.z, rotation.w);
}
else if (action is SteamVR_Action_Vibration)
{
//SteamVR_Input_Action_Vibration actionVibration = (SteamVR_Input_Action_Vibration)action;
if (timeSinceLastChanged == -1)
actionText = "never used";
actionText = string.Format("{0:0} seconds since last used", timeSinceLastChanged);
}
EditorGUILayout.LabelField(action.GetShortName(), actionText, labelStyle);
GUI.backgroundColor = defaultColor;
}
EditorGUI.indentLevel--;
EditorGUILayout.Space();
}
EditorGUI.indentLevel--;
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Active Action Set List");
EditorGUI.indentLevel++;
EditorGUILayout.LabelField(SteamVR_ActionSet_Manager.debugActiveSetListText, setLabelStyle);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.EndScrollView();
SteamVR_Action.startUpdatingSourceOnAccess = startUpdatingSourceOnAccess;
}
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4f3a55cce07b5da49ad2dfb86baea564
timeCreated: 1521569618
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- skin: {fileID: 11400000, guid: 7836f978f062019499564a455654e74a, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using UnityEditor.Callbacks;
using System.IO;
namespace Valve.VR
{
public class SteamVR_Input_PostProcessBuild
{
[PostProcessBuildAttribute(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
}
private static void UpdateAppKey(string newFilePath, string executableName)
{
if (File.Exists(newFilePath))
{
string jsonText = System.IO.File.ReadAllText(newFilePath);
string findString = "\"app_key\" : \"";
int stringStart = jsonText.IndexOf(findString);
if (stringStart == -1)
{
}
else
return; //no app key
stringStart += findString.Length;
int stringEnd = jsonText.IndexOf(",", stringStart + findString.Length);
int stringLength = stringEnd - stringStart + 1;
string removed = jsonText.Remove(stringStart, stringLength);
FileInfo file = new FileInfo(newFilePath);
file.IsReadOnly = false;
File.WriteAllText(newFilePath, removed);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7397a60f6d7fe3942bf26563dad77fe2
timeCreated: 1526670145
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4dc9de3af3d42194abc1380cc3a5cc61
timeCreated: 1542680608
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0142ddd0457153743ba87f4fdd6bfaa7
folderAsset: yes
timeCreated: 1528225471
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,175 @@
{
"actions": [
{
"name": "/actions/default/in/InteractUI",
"type": "boolean"
},
{
"name": "/actions/default/in/Teleport",
"type": "boolean"
},
{
"name": "/actions/default/in/GrabPinch",
"type": "boolean"
},
{
"name": "/actions/default/in/GrabGrip",
"type": "boolean"
},
{
"name": "/actions/default/in/Pose",
"type": "pose"
},
{
"name": "/actions/default/in/SkeletonLeftHand",
"type": "skeleton",
"skeleton": "/skeleton/hand/left"
},
{
"name": "/actions/default/in/SkeletonRightHand",
"type": "skeleton",
"skeleton": "/skeleton/hand/right"
},
{
"name": "/actions/default/in/Squeeze",
"type": "vector1",
"requirement": "optional"
},
{
"name": "/actions/default/in/HeadsetOnHead",
"type": "boolean",
"requirement": "optional"
},
{
"name": "/actions/default/in/SnapTurnLeft",
"type": "boolean",
"requirement": "suggested"
},
{
"name": "/actions/default/in/SnapTurnRight",
"type": "boolean"
},
{
"name": "/actions/default/out/Haptic",
"type": "vibration"
},
{
"name": "/actions/platformer/in/Move",
"type": "vector2"
},
{
"name": "/actions/platformer/in/Jump",
"type": "boolean"
},
{
"name": "/actions/buggy/in/Steering",
"type": "vector2"
},
{
"name": "/actions/buggy/in/Throttle",
"type": "vector1"
},
{
"name": "/actions/buggy/in/Brake",
"type": "boolean"
},
{
"name": "/actions/buggy/in/Reset",
"type": "boolean"
},
{
"name": "/actions/mixedreality/in/ExternalCamera",
"type": "pose",
"requirement": "optional"
}
],
"action_sets": [
{
"name": "/actions/default",
"usage": "single"
},
{
"name": "/actions/platformer",
"usage": "single"
},
{
"name": "/actions/buggy",
"usage": "single"
},
{
"name": "/actions/mixedreality",
"usage": "single"
}
],
"default_bindings": [
{
"controller_type": "vive_controller",
"binding_url": "bindings_vive_controller.json"
},
{
"controller_type": "oculus_touch",
"binding_url": "bindings_oculus_touch.json"
},
{
"controller_type": "knuckles",
"binding_url": "bindings_knuckles.json"
},
{
"controller_type": "holographic_controller",
"binding_url": "bindings_holographic_controller.json"
},
{
"controller_type": "vive_cosmos_controller",
"binding_url": "bindings_vive_cosmos_controller.json"
},
{
"controller_type": "logitech_stylus",
"binding_url": "bindings_logitech_stylus.json"
},
{
"controller_type": "vive_cosmos",
"binding_url": "binding_vive_cosmos.json"
},
{
"controller_type": "vive",
"binding_url": "binding_vive.json"
},
{
"controller_type": "indexhmd",
"binding_url": "binding_index_hmd.json"
},
{
"controller_type": "vive_pro",
"binding_url": "binding_vive_pro.json"
},
{
"controller_type": "rift",
"binding_url": "binding_rift.json"
},
{
"controller_type": "holographic_hmd",
"binding_url": "binding_holographic_hmd.json"
},
{
"controller_type": "vive_tracker_camera",
"binding_url": "binding_vive_tracker_camera.json"
}
],
"localization": [
{
"language_tag": "en_US",
"/actions/default/in/GrabGrip": "Grab Grip",
"/actions/default/in/GrabPinch": "Grab Pinch",
"/actions/default/in/HeadsetOnHead": "Headset on head (proximity sensor)",
"/actions/default/in/InteractUI": "Interact With UI",
"/actions/default/in/Pose": "Pose",
"/actions/default/in/SkeletonLeftHand": "Skeleton (Left)",
"/actions/default/in/SkeletonRightHand": "Skeleton (Right)",
"/actions/default/in/Teleport": "Teleport",
"/actions/default/out/Haptic": "Haptic",
"/actions/platformer/in/Jump": "Jump",
"/actions/default/in/SnapTurnLeft": "Snap Turn (Left)",
"/actions/default/in/SnapTurnRight": "Snap Turn (Right)"
}
]
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 39438ffe60abace49bb41a4ae9c732b8
timeCreated: 1568830083
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
{
"alias_info" : {},
"bindings" : {
"/actions/default" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/headsetonhead"
}
},
"mode" : "button",
"path" : "/user/head/proximity"
}
]
}
},
"controller_type" : "holographic_hmd",
"description" : "",
"name" : "holographic_hmd defaults",
"options" : {},
"simulated_actions" : []
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1bf9d7fa6f3987e4e9b1a610c756e32b
timeCreated: 1541544002
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
{
"alias_info": {},
"bindings": {
"/actions/default": {
"chords": [],
"haptics": [],
"poses": [],
"skeleton": [],
"sources": [
{
"inputs": {
"click": {
"output": "/actions/default/in/headsetonhead"
}
},
"mode": "button",
"path": "/user/head/proximity"
}
]
}
},
"controller_type": "indexhmd",
"description": "",
"name": "index hmd defaults",
"options": {},
"simulated_actions": []
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fab760ff58ade2e45a3ae64ba79b0798
timeCreated: 1568830083
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
{
"alias_info" : {},
"bindings" : {
"/actions/default" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/default/in/headsetonhead"
}
},
"mode" : "button",
"path" : "/user/head/proximity"
}
]
}
},
"controller_type" : "rift",
"description" : "",
"name" : "rift defaults",
"options" : {},
"simulated_actions" : []
}

Some files were not shown because too many files have changed in this diff Show More