Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/scripts/unitypackagegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PACKAGES="Packages/org.basisvr.generator.equals-3.2.0.tgz:
Packages/org.basisvr.simplebase-4.0.2.tgz:
Packages/org.basisvr.bouncycastle-2.5.0.tgz"
SUBFOLDERS="Packages/com.basis.sdk:
Packages/com.basis.openlipsync:
Packages/UnityJigglePhysics-upm:
Packages/org.basisvr.k4os.compression.lz4:
Packages/com.basis.bundlemanagement:
Expand All @@ -24,15 +25,16 @@ if [[ "$1" == "full" ]]; then

PACKAGES+=":Packages/com.valvesoftware.unity.openvr-1.2.1.tgz"

# Need this for framework (But only framework)
# Framework + client-only additions on top of the SDK base.
SUBFOLDERS+=":Packages/com.avionblock.opussharp:
Packages/com.basis.addon.snapcontrols:
Packages/com.basis.common:
Packages/com.basis.eventdriver:
Packages/com.basis.examples:
Packages/com.basis.framework:
Packages/com.basis.framework.editor:
Packages/com.basis.gizmos:
Packages/com.basis.openlipsync:
Packages/com.basis.integration.audiolink:
Packages/com.basis.openvr:
Packages/com.basis.openxr:
Packages/com.basis.profilerintergration:
Expand All @@ -41,21 +43,17 @@ if [[ "$1" == "full" ]]; then
Packages/com.basis.textmeshpro:
Packages/com.basis.vehicles:
Packages/com.basis.visualtrackers:
Packages/com.basis.zeromessenger:
Packages/com.cnlohr.cilbox:
Packages/com.cqf.urpvolumetricfog:
Packages/com.hecomi.ulipsync:
Packages/com.llealloo.audiolink:
Packages/com.steam.steamaudio:
Packages/com.steam.steamvr:
Packages/com.unity.3rdpersondemo:
Packages/com.unity.render-pipelines.core:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is cut because Unity should resolve this dependency by itself. Correct me if im wrong.

Packages/com.unity.render-pipelines.universal:
Packages/com.unity.xr.openxr:
Packages/com.xiph.rnnoise:
Packages/dev.hai-vr.basis.comms:
Packages/HVRBasisNDMF:
Packages/nuget.meamod.dns:
Packages/org.basisvr.k4os.compression.lz4:
Assets/AddressableAssetsData:
Assets/Basis:
Assets/MetaXR:
Expand All @@ -72,14 +70,24 @@ if [[ "$1" == "full" ]]; then
elif [[ "$1" == "sdk" ]]; then
echo "Producing SDK package"
# All things are already included.

else
echo "Only full and sdk targets are specified."
echo "Only full, sdk, and creator targets are specified."
die
exit
fi

set -e

# Fail loudly if a listed Packages/ path doesn't exist
for ddv in $(echo "$SUBFOLDERS" | tr : '\n'); do
ddv_trimmed=$(echo "$ddv" | tr -d '[:space:]')
if [[ -n "$ddv_trimmed" && "$ddv_trimmed" == Packages/* && ! -d "Basis/$ddv_trimmed" ]]; then
echo "ERROR: SUBFOLDERS lists '$ddv_trimmed' but Basis/$ddv_trimmed does not exist." >&2
exit 1
fi
done

cd Basis

rm -rf generate_unitypackage
Expand Down
1 change: 1 addition & 0 deletions .github/vpm-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ com.llealloo.audiolink
com.xiph.rnnoise
com.cnlohr.cilbox
dev.hai-vr.basis.comms
dev.hai-vr.basis.ndmf

# VR / spatial-audio (Apache 2.0 / BSD-3).
com.steam.steamaudio
Expand Down
2 changes: 2 additions & 0 deletions Basis/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ mono_crash.mem.*.*.blob
[Aa]ssets/_[Uu]ser[Cc]ontent.meta
[Aa]ssets/[Gg]it[Ii]gnore/
[Aa]ssets/[Gg]it[Ii]gnore.meta
[Aa]ssets/_[Bb]asis[Tt]emp/
[Aa]ssets/_[Bb]asis[Tt]emp.meta

# FFmpeg
/[Aa]ssets/[Ss]treamingAssets/[Ff][Ff]mpeg/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rootNamespace": "",
"references": [
"BasisConsoleDisplay",
"BasisSDK",
"Basis Framework",
"Unity.InputSystem",
"com.gator-dragon-games.jigglephysics",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "Basis.Integration.AudioLink",
"rootNamespace": "Basis.Integration.AudioLink",
"references": [
"BasisSDK",
"Basis Framework",
"AudioLink"
],
Expand Down
11 changes: 9 additions & 2 deletions Basis/Packages/com.basis.sdk/BasisSDK.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"BasisDebug",
"Unity.TextMeshPro",
"Unity.Addressables",
"Unity.ResourceManager"
"Unity.ResourceManager",
"Basis.OpenLipSync.Runtime"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -15,6 +16,12 @@
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"versionDefines": [
{
"name": "com.basis.framework",
"expression": "",
"define": "BASIS_FRAMEWORK_EXISTS"
}
],
"noEngineReferences": false
}
8 changes: 8 additions & 0 deletions Basis/Packages/com.basis.sdk/Scripts/Avatar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Basis/Packages/com.basis.sdk/Scripts/Drivers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Basis/Packages/com.basis.sdk/Scripts/Drivers/Common.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,12 @@ public void TryShutdown()
public volatile bool InVisemeRange = true;

// Slot in BasisRemoteAudioDriver.Drivers; -1 when not registered.
[System.NonSerialized] internal int RegisteredIndex = -1;
// Public for cross-asmdef access from Framework's BasisRemoteAudioDriver only — do not mutate externally.
[System.NonSerialized] public int RegisteredIndex = -1;

// Slot in BasisRemoteAudioDriver.ActiveDrivers; -1 when out of range.
[System.NonSerialized] internal int ActiveIndex = -1;
// Public for cross-asmdef access from Framework's BasisRemoteAudioDriver only — do not mutate externally.
[System.NonSerialized] public int ActiveIndex = -1;

/// <summary>
/// Callback that updates whether viseme processing is active based on face visibility.
Expand Down
8 changes: 8 additions & 0 deletions Basis/Packages/com.basis.sdk/Scripts/Drivers/Local.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,29 @@ public static class BasisAutomaticSetupAvatarEditor
public static void TryToAutomatic(BasisAvatarSDKInspector Inspector)
{
BasisAvatar avatar = Inspector.Avatar;
if (avatar != null)
// Inspector can redraw with a destroyed/cleared target during play-mode transitions
// and asset reloads. Bail silently — it's not an error worth logging on every redraw.
if (avatar == null) return;

if (TryFindOrCheckAvatar(avatar))
{
if (TryFindOrCheckAvatar(avatar))
if (CheckAnimator(avatar))
{
if (CheckAnimator(avatar))
if (TryFindNeckAndHead(avatar, out Transform Neck, out Transform Head))
{
if (TryFindNeckAndHead(avatar, out Transform Neck, out Transform Head))
{
TrySetAvatarEyePosition(avatar);
TrySetAvatarMouthPosition(avatar, Head);
}
TrySetAvatarEyePosition(avatar);
TrySetAvatarMouthPosition(avatar, Head);
}
}
else
{
Debug.LogError("Animator component not found on GameObject " + avatar.gameObject.name);
}
UpdateAvatarRenders(avatar);

EditorUtility.SetDirty(avatar);
AssetDatabase.Refresh();
}
else
{
Debug.LogError("Avatar instance is null.");
Debug.LogError("Animator component not found on GameObject " + avatar.gameObject.name);
}
UpdateAvatarRenders(avatar);

EditorUtility.SetDirty(avatar);
AssetDatabase.Refresh();
}
private static bool CheckAnimator(BasisAvatar avatar)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#if !BASIS_FRAMEWORK_EXISTS
using UnityEditor;

namespace Basis.Scripts.BasisSdk.Players.Editor
{
internal static class BasisAvatarEditorPreviewBootstrap
{
[InitializeOnLoadMethod]
private static void Register()
{
BasisAvatarSDKInspector.PreviewFoldoutFactory = BasisEditorPreviewParametersFoldout.Create;
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,52 @@

namespace Basis.Scripts.BasisSdk.Players.Editor
{
// Avatar preview for projects without com.basis.framework. Compiled out when framework
// is installed (gated via versionDefine BASIS_FRAMEWORK_EXISTS) — framework's real
// BasisLocalPlayer registers itself with BasisLocalPlayerData at play-mode init.
// SDK-side avatar preview. Backs off when framework's BasisLocalPlayer has
// already registered with BasisLocalPlayerData (play mode).
internal sealed class BasisEditorPreviewLocalPlayer : IBasisLocalPlayer
{
private const string FallbackControllerPath = "Packages/com.basis.sdk/Animator/BasisLocomotion.controller";
private const string PreviewRootName = "BasisEditorPreviewRoot";

private static readonly BasisEditorPreviewLocalPlayer _instance = new BasisEditorPreviewLocalPlayer();

public static BasisAvatar ActiveAvatar { get; private set; }
public static BasisAnimatorVariableApply Applier { get; private set; }
public static BasisAvatar ActiveAvatar;
public static BasisAnimatorVariableApply Applier;
public static BasisAvatarSimPlayer ActiveSimPlayer;
public static BasisAvatarSimMic ActiveSimMic;
public static event System.Action StateChanged;

private static GameObject _previewRoot;

[InitializeOnLoadMethod]
private static void Register()
{
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;

if (BasisLocalPlayerData.Instance != null) return;
BasisLocalPlayerData.Instance = _instance;
BasisLocalPlayerData.RaiseLocalPlayerInitialized();
}

private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
// The preview is created during play mode (via the inspector's Test-in-Editor flow,
// which enters play mode and resolves the pending avatar from SessionState). Unity's
// play-mode revert destroys the preview root + clone automatically — we just need
// to drop our static refs so they don't dangle into the next session.
if (state == PlayModeStateChange.ExitingPlayMode)
{
if (ActiveSimMic != null) ActiveSimMic.StopCapture();
_previewRoot = null;
ActiveAvatar = null;
Applier = null;
ActiveSimPlayer = null;
ActiveSimMic = null;
StateChanged?.Invoke();
}
}

public Task CreateAvatarFromMode(BasisLoadMode LoadMode, BasisLoadableBundle BasisLoadableBundle)
{
if (LoadMode != BasisLoadMode.ByGameobjectReference)
Expand All @@ -46,7 +69,7 @@ public Task CreateAvatarFromMode(BasisLoadMode LoadMode, BasisLoadableBundle Bas

DisposeActive();

_previewRoot = new GameObject(PreviewRootName) { hideFlags = HideFlags.DontSave };
_previewRoot = new GameObject(PreviewRootName);
inSceneItem.transform.SetParent(_previewRoot.transform, worldPositionStays: false);
inSceneItem.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);

Expand All @@ -72,16 +95,28 @@ public Task CreateAvatarFromMode(BasisLoadMode LoadMode, BasisLoadableBundle Bas

ActiveAvatar = avatar;
avatar.NotifyAvatarReady(true);

// SimPlayer + SimMic provide play-mode ticking for blink and visemes.
// The MonoBehaviours only tick in play mode; in edit mode they're inert.
ActiveSimPlayer = _previewRoot.AddComponent<BasisAvatarSimPlayer>();
ActiveSimPlayer.Bootstrap(avatar);

ActiveSimMic = _previewRoot.AddComponent<BasisAvatarSimMic>();
ActiveSimMic.Driver = ActiveSimPlayer.Viseme;

StateChanged?.Invoke();
return Task.CompletedTask;
}

public static void DisposeActive()
{
if (ActiveSimMic != null) ActiveSimMic.StopCapture();
if (_previewRoot != null) Object.DestroyImmediate(_previewRoot);
_previewRoot = null;
ActiveAvatar = null;
Applier = null;
ActiveSimPlayer = null;
ActiveSimMic = null;
StateChanged?.Invoke();
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading