diff --git a/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim b/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim deleted file mode 100644 index a375c34..0000000 --- a/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim +++ /dev/null @@ -1,116 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!74 &7400000 -AnimationClip: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Disable AudioLinkBlocker - serializedVersion: 6 - m_Legacy: 0 - m_Compressed: 0 - m_UseHighQualityCurve: 1 - m_RotationCurves: [] - m_CompressedRotationCurves: [] - m_EulerCurves: [] - m_PositionCurves: [] - m_ScaleCurves: [] - m_FloatCurves: - - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.016666668 - value: 0 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_IsActive - path: AudioLink Blocker - classID: 1 - script: {fileID: 0} - m_PPtrCurves: [] - m_SampleRate: 60 - m_WrapMode: 0 - m_Bounds: - m_Center: {x: 0, y: 0, z: 0} - m_Extent: {x: 0, y: 0, z: 0} - m_ClipBindingConstant: - genericBindings: - - serializedVersion: 2 - path: 4290039188 - attribute: 2086281974 - script: {fileID: 0} - typeID: 1 - customType: 0 - isPPtrCurve: 0 - pptrCurveMapping: [] - m_AnimationClipSettings: - serializedVersion: 2 - m_AdditiveReferencePoseClip: {fileID: 0} - m_AdditiveReferencePoseTime: 0 - m_StartTime: 0 - m_StopTime: 0.016666668 - m_OrientationOffsetY: 0 - m_Level: 0 - m_CycleOffset: 0 - m_HasAdditiveReferencePose: 0 - m_LoopTime: 0 - m_LoopBlend: 0 - m_LoopBlendOrientation: 0 - m_LoopBlendPositionY: 0 - m_LoopBlendPositionXZ: 0 - m_KeepOriginalOrientation: 0 - m_KeepOriginalPositionY: 1 - m_KeepOriginalPositionXZ: 0 - m_HeightFromFeet: 0 - m_Mirror: 0 - m_EditorCurves: - - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.016666668 - value: 0 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_IsActive - path: AudioLink Blocker - classID: 1 - script: {fileID: 0} - m_EulerEditorCurves: [] - m_HasGenericRootTransform: 0 - m_HasMotionFloatCurves: 0 - m_Events: [] diff --git a/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim.meta b/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim.meta deleted file mode 100644 index 6e504be..0000000 --- a/Audiolink Blocker/Animations/Disable AudioLinkBlocker.anim.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 35c9afd680f98444382d72e67cc544e5 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 7400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim b/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim deleted file mode 100644 index d7f9204..0000000 --- a/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim +++ /dev/null @@ -1,116 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!74 &7400000 -AnimationClip: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Enable AudioLinkBlocker - serializedVersion: 6 - m_Legacy: 0 - m_Compressed: 0 - m_UseHighQualityCurve: 1 - m_RotationCurves: [] - m_CompressedRotationCurves: [] - m_EulerCurves: [] - m_PositionCurves: [] - m_ScaleCurves: [] - m_FloatCurves: - - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.016666668 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_IsActive - path: AudioLink Blocker - classID: 1 - script: {fileID: 0} - m_PPtrCurves: [] - m_SampleRate: 60 - m_WrapMode: 0 - m_Bounds: - m_Center: {x: 0, y: 0, z: 0} - m_Extent: {x: 0, y: 0, z: 0} - m_ClipBindingConstant: - genericBindings: - - serializedVersion: 2 - path: 499752857 - attribute: 2086281974 - script: {fileID: 0} - typeID: 1 - customType: 0 - isPPtrCurve: 0 - pptrCurveMapping: [] - m_AnimationClipSettings: - serializedVersion: 2 - m_AdditiveReferencePoseClip: {fileID: 0} - m_AdditiveReferencePoseTime: 0 - m_StartTime: 0 - m_StopTime: 0.016666668 - m_OrientationOffsetY: 0 - m_Level: 0 - m_CycleOffset: 0 - m_HasAdditiveReferencePose: 0 - m_LoopTime: 0 - m_LoopBlend: 0 - m_LoopBlendOrientation: 0 - m_LoopBlendPositionY: 0 - m_LoopBlendPositionXZ: 0 - m_KeepOriginalOrientation: 0 - m_KeepOriginalPositionY: 1 - m_KeepOriginalPositionXZ: 0 - m_HeightFromFeet: 0 - m_Mirror: 0 - m_EditorCurves: - - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.016666668 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_IsActive - path: AudioLink Blocker - classID: 1 - script: {fileID: 0} - m_EulerEditorCurves: [] - m_HasGenericRootTransform: 0 - m_HasMotionFloatCurves: 0 - m_Events: [] diff --git a/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim.meta b/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim.meta deleted file mode 100644 index 9c867d2..0000000 --- a/Audiolink Blocker/Animations/Enable AudioLinkBlocker.anim.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 21bec0a6bb4558841b4193a9efacb8a0 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 7400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor.meta b/Editor.meta index d17cc2b..ee94598 100644 --- a/Editor.meta +++ b/Editor.meta @@ -1,3 +1,8 @@ -fileFormatVersion: 2 -guid: 66a1999d721b4d6884003da01daf01d0 -timeCreated: 1655358550 \ No newline at end of file +fileFormatVersion: 2 +guid: ba7f0d9f09a305743b536ef6e0c89f62 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AnimationHelpers.cs b/Editor/AnimationHelpers.cs deleted file mode 100644 index 10be1fa..0000000 --- a/Editor/AnimationHelpers.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System.Linq; -using UnityEditor; -using UnityEditor.Animations; -using UnityEngine; -using VRC.SDK3.Avatars.Components; - -namespace Comfort.Editor -{ - public static class AnimationHelpers - { - public static void AddAnimatorStates(VRCAvatarDescriptor avatar, string parameterName, AnimationClip emable, - AnimationClip disable, bool writeDefaults, AnimMode animMode) - { - Debug.Log("Adding animator states for " + parameterName); - VRCAvatarDescriptor.CustomAnimLayer - avatarDescriptorBaseAnimationLayer = avatar.baseAnimationLayers[4]; - AnimatorController animatorController = - (AnimatorController)avatarDescriptorBaseAnimationLayer.animatorController; - //Add checks for existing states - if (animatorController.parameters.All(x => x.name != parameterName)) - { - animatorController.AddParameter(parameterName, AnimMode.Toggle == animMode ? AnimatorControllerParameterType.Bool : AnimatorControllerParameterType.Float); - } - AnimatorControllerLayer layer = animatorController.layers.FirstOrDefault(lay => lay.name == parameterName); - if (layer == null) - { - layer = new AnimatorControllerLayer - { - defaultWeight = 1, - blendingMode = AnimatorLayerBlendingMode.Override, - avatarMask = null, - name = parameterName, - stateMachine = new AnimatorStateMachine - { - name = parameterName - } - }; - animatorController.AddLayer(layer); - } - - // add the animator state - AnimatorStateMachine stateMachine = layer.stateMachine; - if (stateMachine == null) - { - stateMachine = new AnimatorStateMachine - { - name = parameterName - }; - layer.stateMachine = stateMachine; - } - - if (animMode == AnimMode.Toggle) - { - AnimatorState notBlocked = stateMachine.AddState(parameterName + " Not Blocked"); - AnimatorState blocked = stateMachine.AddState(parameterName + " Blocked"); - blocked.writeDefaultValues = writeDefaults; - notBlocked.writeDefaultValues = writeDefaults; - notBlocked.motion = disable; - blocked.motion = emable; - // add the transition - - AnimatorStateTransition animatorStateTransition = blocked.AddTransition(notBlocked); - animatorStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0f, parameterName); - animatorStateTransition.hasExitTime = false; - animatorStateTransition.exitTime = 0f; - animatorStateTransition.duration = 0f; - animatorStateTransition.offset = 0f; - - AnimatorStateTransition animatorStateTransition2 = notBlocked.AddTransition(blocked); - animatorStateTransition2.AddCondition(AnimatorConditionMode.If, 1f, parameterName); - animatorStateTransition2.AddCondition(AnimatorConditionMode.If, 1f, "IsLocal"); - animatorStateTransition2.hasExitTime = false; - animatorStateTransition2.exitTime = 0f; - animatorStateTransition2.duration = 0f; - animatorStateTransition2.offset = 0f; - } - - if (animMode == AnimMode.Blend) - { - BlendTree blendTree = new BlendTree - { - name = parameterName, - blendType = BlendTreeType.Simple1D, - blendParameter = parameterName - }; - blendTree.AddChild(disable, 0f); - blendTree.AddChild(emable, 1f); - AnimatorState animatorState = stateMachine.AddState(parameterName); - animatorState.motion = blendTree; - } - - EditorUtility.SetDirty(animatorController); - Debug.Log("Added animator states for " + parameterName); - } - public static bool IsWriteDefaults(VRCAvatarDescriptor avatar) - { - // check animator to get if write defaults is enabled - foreach (VRCAvatarDescriptor.CustomAnimLayer layer in avatar.baseAnimationLayers) - { - if (layer.animatorController != null) - { - AnimatorController animator = (AnimatorController)layer.animatorController; - - foreach (AnimatorControllerLayer layer2 in animator.layers) - { - if (layer2.stateMachine != null && layer2.stateMachine.defaultState != null && layer2.stateMachine.defaultState.writeDefaultValues) - { - return true; - } - } - } - } - - return false; - } - public enum AnimMode - { - Toggle, - Blend - } - } -} \ No newline at end of file diff --git a/Editor/AnimationHelpers.cs.meta b/Editor/AnimationHelpers.cs.meta deleted file mode 100644 index edc5793..0000000 --- a/Editor/AnimationHelpers.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9014274b9e72448cb82b7b342ad9405e -timeCreated: 1660503528 \ No newline at end of file diff --git a/Editor/Helpers.cs b/Editor/Helpers.cs deleted file mode 100644 index a874704..0000000 --- a/Editor/Helpers.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; -using UnityEngine.Animations; -using UnityEngine.Rendering; -using VRC.SDK3.Avatars.Components; -using VRC.SDK3.Avatars.ScriptableObjects; -using Object = UnityEngine.Object; - -namespace Comfort.Editor -{ - public static class Helpers - { - public static VRCAvatarDescriptor GetSelectedAvatar() - { - GameObject selected = Selection.activeGameObject; - if (selected != null) - { - return selected.GetComponent(); - } - - // else check hierarchy for a valid avatar - VRCAvatarDescriptor avatar = Object.FindObjectOfType(); - if (avatar != null) - { - return avatar; - } - - return null; - } - - public static void CreateGrabPassSphere(VRCAvatarDescriptor avatar, string parameterName, string materialPath) - { - GameObject root = avatar.transform.Find(parameterName).gameObject; - Transform grabPassSphere = root.transform.Find("GrabPassSphere"); - if (grabPassSphere == null) - { - grabPassSphere = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; - grabPassSphere.parent = root.transform; - grabPassSphere.localPosition = Vector3.zero; - grabPassSphere.localRotation = Quaternion.identity; - grabPassSphere.localScale = Vector3.one; - grabPassSphere.name = "GrabPassSphere"; - } - - Collider collider = grabPassSphere.GetComponent(); - if (collider != null) - { - Object.DestroyImmediate(collider); - } - - MeshRenderer renderer = grabPassSphere.GetComponent(); - Material material = AssetDatabase.LoadAssetAtPath(materialPath); - material.name = parameterName + "Material"; - renderer.sharedMaterial = material; - - renderer.shadowCastingMode = ShadowCastingMode.Off; - renderer.lightProbeUsage = LightProbeUsage.Off; - renderer.reflectionProbeUsage = ReflectionProbeUsage.Off; - renderer.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion; - renderer.lightProbeUsage = LightProbeUsage.Off; - renderer.allowOcclusionWhenDynamic = false; - renderer.receiveShadows = false; - - } - - public static void SetUpConstraint(VRCAvatarDescriptor avatar, string parameterName) - { - Transform target = avatar.transform.Find(parameterName); - if (target == null) - { - target = new GameObject(parameterName).transform; - target.parent = avatar.transform; - } - - Transform headTransform = avatar.GetComponent().GetBoneTransform(HumanBodyBones.Head); - - target.transform.position = headTransform.position; - target.gameObject.SetActive(false); - - ParentConstraint parentConstraint = target.gameObject.GetComponent(); - if (parentConstraint == null) - { - parentConstraint = target.gameObject.AddComponent(); - } - ConstraintSource source = new ConstraintSource - { - sourceTransform = headTransform, - weight = 1 - }; - List sources = new List {}; - parentConstraint.GetSources(sources); - if (!sources.Contains(source)) - { - parentConstraint.AddSource(source); - } - parentConstraint.weight = 1; - parentConstraint.constraintActive = true; - } - public static void SetUpCameraOverlay(VRCAvatarDescriptor avatar, string parameterName) - { - if (avatar == null) - { - return; - } - - Transform root = avatar.transform.Find(parameterName); - Transform camera = root.Find("Camera"); - Transform overlayTransform = camera.Find("Overlay"); - GameObject overlay; - if (overlayTransform == null) - { - overlay = GameObject.CreatePrimitive(PrimitiveType.Quad); - overlay.transform.parent = camera; - overlay.name = "Overlay"; - overlay.transform.localPosition = new Vector3(0, 0, 10000); - overlay.transform.localScale = new Vector3(100, 100, 100); - Collider collider = overlay.GetComponent(); - if (collider != null) - { - Object.DestroyImmediate(collider); - } - } - else - { - overlay = overlayTransform.gameObject; - } - - overlay.layer = LayerMask.NameToLayer("PlayerLocal"); - MeshRenderer renderer = overlay.GetComponent(); - if (renderer != null) - { - renderer.shadowCastingMode = ShadowCastingMode.Off; - renderer.receiveShadows = false; - renderer.lightProbeUsage = LightProbeUsage.Off; - renderer.reflectionProbeUsage = ReflectionProbeUsage.Off; - renderer.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion; - renderer.allowOcclusionWhenDynamic = false; - renderer.material = - AssetDatabase.LoadAssetAtPath( - "Assets/Comfort/Post Processing Blocker/Materials/RT Overlay.mat"); - } - } - public static void SetUpCamera(VRCAvatarDescriptor avatar, string parameterName) - { - if (avatar == null) - { - return; - } - - GameObject root = avatar.transform.Find(parameterName).gameObject; - Camera camera = root.GetComponentInChildren(); - if (camera == null) - { - GameObject cameraObject = new GameObject("Camera") - { - transform = - { - parent = root.transform, - localPosition = Vector3.zero, - localRotation = Quaternion.identity - }, - }; - camera = cameraObject.AddComponent(); - } - - camera.nearClipPlane = 9000f; - camera.farClipPlane = 11000f; - camera.depth = 0f; - camera.cullingMask = ~(1 << LayerMask.NameToLayer("MirrorReflection")); - } - public static void AddCollider(VRCAvatarDescriptor avatar, string parameterName) - { - Debug.Log("Adding Collider"); - GameObject root = avatar.transform.Find(parameterName).gameObject; - Transform collider = root.transform.Find("collider"); - if (collider == null) - { - collider = new GameObject("collider").transform; - collider.parent = root.transform; - collider.localPosition = Vector3.zero; - collider.localRotation = Quaternion.identity; - collider.localScale = Vector3.one; - } - - Collider _collider = collider.GetComponent(); - if (_collider == null) - { - _collider = collider.gameObject.AddComponent(); - } - - Bounds colliderBounds = _collider.bounds; - colliderBounds.size = new Vector3(1f, 0.8f, 0f); - - collider.localScale = new Vector3(5f, 5f, 5f); - collider.localPosition = new Vector3(0, 5, 0); - } - public static void SetScale(VRCAvatarDescriptor avatar, string parameterName) - { - GameObject root = avatar.transform.Find(parameterName).gameObject; - root.transform.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f); - } - } -} \ No newline at end of file diff --git a/Editor/Helpers.cs.meta b/Editor/Helpers.cs.meta deleted file mode 100644 index 5c6e469..0000000 --- a/Editor/Helpers.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e2a762fa2c324740a505e08e522fa1ff -timeCreated: 1655358797 \ No newline at end of file diff --git a/Editor/Layout.uxml b/Editor/Layout.uxml deleted file mode 100644 index 6794cc4..0000000 --- a/Editor/Layout.uxml +++ /dev/null @@ -1,38 +0,0 @@ - - -