Skip to content

Commit

Permalink
Merge branch 'lts'
Browse files Browse the repository at this point in the history
  • Loading branch information
dooly123 committed Dec 29, 2024
2 parents ee50aaa + f447566 commit 92e911d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using System;

namespace UnityOpus
Expand All @@ -12,7 +12,8 @@ public class AudioDecoder : IDisposable {

public AudioDecoder(SamplingFrequency samplingFrequency,NumChannels channels) {ErrorCode error;this.channels = channels;
decoder = Library.OpusDecoderCreate(samplingFrequency,channels,out error);
if (error != ErrorCode.OK) {
if (error != ErrorCode.OK)
{
Debug.LogError("[UnityOpus] Failed to create Decoder. Error code is " + error.ToString());
decoder = IntPtr.Zero;
}
Expand Down
18 changes: 4 additions & 14 deletions Basis/Assets/third_party/Plugins/Opus Intergration/Encoder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Threading;
using UnityEngine;

namespace UnityOpus
{
Expand Down Expand Up @@ -55,16 +56,14 @@ public OpusSignal Signal
IntPtr encoder;
NumChannels channels;
public readonly object encoderLock = new object(); // For thread safety
private ConcurrentQueue<string> errorQueue = new ConcurrentQueue<string>(); // Thread-safe error queue

public Encoder(SamplingFrequency samplingFrequency, NumChannels channels, OpusApplication application)
{
this.channels = channels;
ErrorCode error;
encoder = Library.OpusEncoderCreate(samplingFrequency, channels, application, out error);
if (error != ErrorCode.OK)
{
errorQueue.Enqueue("[UnityOpus] Failed to init encoder. Error code: " + error.ToString());
Debug.Log("[UnityOpus] Failed to init encoder. Error code: " + error.ToString());
encoder = IntPtr.Zero;
}
}
Expand All @@ -87,15 +86,6 @@ public int Encode(float[] pcm, byte[] output)
);
}
}

public void ReportErrorsToMainThread()
{
while (errorQueue.TryDequeue(out var error))
{
UnityEngine.Debug.LogError(error);
}
}

#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls

Expand Down Expand Up @@ -130,4 +120,4 @@ public void Dispose()
}
#endregion
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static async Task<List<BasisBundleInformation>> BuildAssetBundle(BasisAss
}
string Pathout = Path.GetDirectoryName(actualFilePath);

await SaveFileAsync(Pathout, "dontuploadmepassword", ".txt", Password);
await SaveFileAsync(Pathout, "dontuploadmepassword", "txt", Password);

OpenRelativePath(Pathout);
}
Expand Down Expand Up @@ -195,4 +195,4 @@ public static void ResetAssetBundleName(string assetPath)
assetImporter.assetBundleName = null;
}
}
}
}
2 changes: 2 additions & 0 deletions Basis/Packages/basisdk/Scripts/Editor/AvatarPathConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public class AvatarPathConstants
public static readonly string AvatarDescription = "avatardescriptioninput";
public static readonly string AvatarIcon = "AvatarIcon";
public static readonly string Avatarpassword = "avatarpassword";

public static readonly string ErrorMessage = "ErrorMessage";
}
26 changes: 25 additions & 1 deletion Basis/Packages/basisdk/Scripts/Editor/AvatarSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Basis.Scripts.Editor;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using UnityEditor;
Expand All @@ -13,6 +14,7 @@
[CustomEditor(typeof(BasisAvatar))]
public partial class BasisAvatarSDKInspector : Editor
{
private const string MsgIL2CPPIsNotInstalled = "IL2CPP is not installed.";
public VisualTreeAsset visualTree;
public BasisAvatar Avatar;
public VisualElement uiElementsRoot;
Expand All @@ -22,11 +24,20 @@ public partial class BasisAvatarSDKInspector : Editor
public AvatarSDKJiggleBonesView AvatarSDKJiggleBonesView = new AvatarSDKJiggleBonesView();
public AvatarSDKVisemes AvatarSDKVisemes = new AvatarSDKVisemes();
public Button EventCallbackAvatarBundleButton { get; private set; }
private bool IsIL2CPPIsInstalled;

private void OnEnable()
{
visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(AvatarPathConstants.uxmlPath);
Avatar = (BasisAvatar)target;
IsIL2CPPIsInstalled = CheckIfIL2CPPIsInstalled();
}

private static bool CheckIfIL2CPPIsInstalled()
{
var playbackEndingDirectory = BuildPipeline.GetPlaybackEngineDirectory(EditorUserBuildSettings.activeBuildTarget, BuildOptions.None, false);
return !string.IsNullOrEmpty(playbackEndingDirectory)
&& Directory.Exists(Path.Combine(playbackEndingDirectory, "Variations", "il2cpp"));
}

public override VisualElement CreateInspectorGUI()
Expand Down Expand Up @@ -178,6 +189,8 @@ public void SetupItems()

ObjectField AvatarIconField = uiElementsRoot.Q<ObjectField>(AvatarPathConstants.AvatarIcon);

Label ErrorMessage = uiElementsRoot.Q<Label>(AvatarPathConstants.ErrorMessage);

animatorField.allowSceneObjects = true;
faceBlinkMeshField.allowSceneObjects = true;
faceVisemeMeshField.allowSceneObjects = true;
Expand Down Expand Up @@ -217,6 +230,17 @@ public void SetupItems()
// Update Button Text
avatarEyePositionClick.text = "Eye Position Gizmo " + AvatarHelper.BoolToText(AvatarEyePositionState);
avatarMouthPositionClick.text = "Mouth Position Gizmo " + AvatarHelper.BoolToText(AvatarMouthPositionState);

if (!IsIL2CPPIsInstalled)
{
ErrorMessage.visible = true;
ErrorMessage.text = MsgIL2CPPIsNotInstalled;
}
else
{
ErrorMessage.visible = false;
ErrorMessage.text = "";
}
}
public Texture2D Texture;
public void OnAssignTexture2D(ChangeEvent<UnityEngine.Object> Texture2D)
Expand Down Expand Up @@ -290,4 +314,4 @@ public string ByteArrayToHexString(byte[] byteArray)
return hex.ToString();
}

}
}
1 change: 1 addition & 0 deletions Basis/Packages/basisdk/Scripts/Editor/AvatarSDK.uxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<engine:Foldout text="jiggle configuration" name="jiggles">
<engine:VisualElement name="JiggleStrains" style="flex-grow: 1;" />
</engine:Foldout>
<engine:Label name="ErrorMessage" enabled="true" text="Error Message" style="white-space: normal; color: rgb(255, 0, 0);" />
<engine:Button text="Create Avatar Bundle" name="AvatarBundleButton" />
</engine:VisualElement>
</engine:UXML>
22 changes: 9 additions & 13 deletions Basis/README.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

<table border="0">
<tr>
<td><div align="center"><img src="https://raw.githubusercontent.com/dooly123/Basis/main/Images/BasisLogo.png" alt="Logo" width="160" height="160"></td>
<td><div align="center"><img src="./Basis/Images/BasisLogo.png" alt="Logo" width="160" height="160"></td>
<td><div align="center"><h3><strong>Basis</strong></h3>
The Social VR Framework</br>
<a href="https://discord.gg/F35u3cUMqt"><strong>Join our Discord!»</strong></a></br></br>
<a href="https://github.com/dooly123/Basis/issues/new?labels=bug&template=bug-report---.md">Report Bug</a> -
<a href="https://github.com/dooly123/Basis/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a></div></td>
<a href="https://github.com/BasisVR/Basis/issues/new?labels=bug&template=bug-report---.md">Report Bug</a> -
<a href="https://github.com/BasisVR/Basis/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a></div></td>
</tr>
</table>
## About Basis

[Basis Philosophy](https://github.com/dooly123/Basis/blob/main/PHILOSOPHY.md) <- read our Philosophy here!
[Basis Philosophy](./PHILOSOPHY.md) <- read our Philosophy here!

We are a MIT-Licensed Open-Source project with a focus on open development and full access to any optional modification desired or required.

Our goal is to help equip VR Creators, so we can accelerate the growth of VR.

<img src="https://raw.githubusercontent.com/dooly123/Basis/main/Images/Banner.png" alt="Banner" width="550" height="155">
<img src="./Basis/Images/Banner.png" alt="Banner" width="550" height="155">

We are actively working on Basis. If you like what you see please consider contributing to the github in any way you can.

Expand Down Expand Up @@ -73,11 +73,8 @@ Distributed under the MIT License. See [MIT License](https://opensource.org/lice
### Built With

This would not be possible without the following:
- [FFmpeg](https://github.com/FFmpeg/FFmpeg) (lgpl 3, 6.1)
- [FFmpeg Builds](https://github.com/BtbN/FFmpeg-Builds?tab=MIT-1-ov-file) (lgpl 3)
- [OdinSerializer](https://github.com/TeamSirenix/odin-serializer)
- [ULipSync](https://github.com/hecomi/uLipSync)
- [DarkRift 2](https://github.com/DarkRiftNetworking/ )
- [UnityJigglePhysics](https://github.com/naelstrof/UnityJigglePhysics)
- [UnityOpus](https://github.com/TyounanMOTI/UnityOpus)
- [Settings Manager](https://assetstore.unity.com/packages/tools/gui/settings-manager-158458)
Expand All @@ -87,7 +84,6 @@ This would not be possible without the following:
- [Unity Starter Assets - ThirdPerson](https://assetstore.unity.com/packages/essentials/starter-assets-thirdperson-updates-in-new-charactercontroller-pa-196526)
- [Aurellia](https://github.com/CascadianVR) Assets\third_party\Avatar\Aurellia\LICENSE
- [YUN](https://github.com/yewnyx) Assets\third_party\Avatar\Yun\LICENSE
- [vive OpenXR](https://developer.vive.com/resources/openxr/)
- [lilToon](https://github.com/lilxyzw/lilToon)
- [RNNoise](https://github.com/xiph/rnnoise?tab=BSD-3-Clause-1-ov-file)
- [RNNoise.Net](https://github.com/Yellow-Dog-Man/RNNoise.Net)
Expand All @@ -110,9 +106,9 @@ This project includes third-party code licensed under the BSD-3-Clause license:
- [OpenVR](https://github.com/valvesoftware/openvr)
The OpenVR API is (C) Valve Corporation under the BSD 3-clause license

For more details, see `Assets/third_party/plugins/SteamAudio/LICENSE`.
For more details, see `Assets/third_party/plugins/SteamVR/LICENSE`.
For more details, see `Basis/Assets/third_party/plugins/SteamAudio/LICENSE`.
For more details, see `Basis/Assets/third_party/plugins/SteamVR/LICENSE`.

This project also includes third-party trademarks as described in `Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`. For more details, see `Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`.
This project also includes third-party trademarks as described in `Basis/Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`. For more details, see `Basis/Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`.

"Valve", "Steam", and the associated figurative images are trademarks and/or registered trademarks of Valve Corporation in the US and in various other jurisdictions. All rights reserved. Use of these trademarks must comply with the guidelines set forth in `Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`.
"Valve", "Steam", and the associated figurative images are trademarks and/or registered trademarks of Valve Corporation in the US and in various other jurisdictions. All rights reserved. Use of these trademarks must comply with the guidelines set forth in `Basis/Assets/third_party/plugins/SteamAudio/TRADEMARK_RIGHTS.md`.

0 comments on commit 92e911d

Please sign in to comment.