Skip to content
Merged
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
4 changes: 3 additions & 1 deletion Basis/Packages/com.basis.sdk/Scripts/BasisBundleConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ public class BasisBundleDescription
{
public string AssetBundleName;//user friendly name of this asset.
public string AssetBundleDescription;//the description of this asset
public Texture2D AssetBundleIcon;//icon for this asset
public BasisBundleDescription()
{

}
public BasisBundleDescription(string assetBundleName, string assetBundleDescription)
public BasisBundleDescription(string assetBundleName, string assetBundleDescription, Texture2D assetBundleIcon = null)
{
AssetBundleName = assetBundleName ?? throw new ArgumentNullException(nameof(assetBundleName));
AssetBundleDescription = assetBundleDescription ?? throw new ArgumentNullException(nameof(assetBundleDescription));
AssetBundleIcon = assetBundleIcon;
}
}
[System.Serializable]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void SetupItems()
animatorField.value = Avatar.Animator;
faceBlinkMeshField.value = Avatar.FaceBlinkMesh;
faceVisemeMeshField.value = Avatar.FaceVisemeMesh;
AvatarIconField.value = Icon;
AvatarIconField.value = Avatar.BasisBundleDescription.AssetBundleIcon;

AvatarNameField.value = Avatar.BasisBundleDescription.AssetBundleName;
AvatarDescriptionField.value = Avatar.BasisBundleDescription.AssetBundleDescription;
Expand All @@ -289,7 +289,7 @@ public void SetupItems()
BasisSDKCommonInspector.CreateBuildOptionsDropdown(uiElementsRoot);
BasisAssetBundleObject assetBundleObject = AssetDatabase.LoadAssetAtPath<BasisAssetBundleObject>(BasisAssetBundleObject.AssetBundleObject);
AvatarIconField.RegisterCallback<ChangeEvent<UnityEngine.Object>>(OnIconFieldChanged);
avatarBundleButton.clicked += () => EventCallbackAvatarBundle(assetBundleObject.selectedTargets, Icon);
avatarBundleButton.clicked += () => EventCallbackAvatarBundle(assetBundleObject.selectedTargets, Avatar.BasisBundleDescription.AssetBundleIcon);


// Register Animator field change event
Expand All @@ -306,11 +306,10 @@ public void SetupItems()

private void OnIconFieldChanged(ChangeEvent<UnityEngine.Object> evt)
{
Icon = evt.newValue as Texture2D;
BasisDebug.Log($"Setting to {Icon}");
Avatar.BasisBundleDescription.AssetBundleIcon = evt.newValue as Texture2D;
EditorUtility.SetDirty(Avatar);
BasisDebug.Log($"Setting to {Avatar.BasisBundleDescription.AssetBundleIcon}");
}

public static Texture2D Icon;
private async void EventCallbackAvatarBundle(List<BuildTarget> targets, Texture2D Image)
{
if (targets == null || targets.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class BasisPropSDKInspector : Editor
public VisualElement uiElementsRoot;
private Label resultLabel;
public BasisAssetBundleObject assetBundleObject;
public static Texture2D Icon;
public BasisPropValidator BasisPropValidator;

public void OnEnable()
Expand Down Expand Up @@ -69,7 +68,7 @@ public override VisualElement CreateInspectorGUI()
ObjectField PropIconField = uiElementsRoot.Q<ObjectField>(BasisSDKConstants.PropIcon);
PropIconField.objectType = typeof(Texture2D);
PropIconField.allowSceneObjects = true;
PropIconField.value = Icon;
PropIconField.value = BasisProp.BasisBundleDescription.AssetBundleIcon;
PropIconField.RegisterCallback<ChangeEvent<UnityEngine.Object>>(OnIconFieldChanged);

// Build options
Expand All @@ -78,7 +77,7 @@ public override VisualElement CreateInspectorGUI()

BasisAssetBundleObject assetBundleObject = AssetDatabase.LoadAssetAtPath<BasisAssetBundleObject>(BasisAssetBundleObject.AssetBundleObject);
Button BuildButton = BasisHelpersGizmo.Button(uiElementsRoot, BasisSDKConstants.BuildButton);
BuildButton.clicked += () => Build(BuildButton, assetBundleObject.selectedTargets, Icon);
BuildButton.clicked += () => Build(BuildButton, assetBundleObject.selectedTargets, BasisProp.BasisBundleDescription.AssetBundleIcon);
}
else
{
Expand All @@ -90,8 +89,9 @@ public override VisualElement CreateInspectorGUI()

private void OnIconFieldChanged(ChangeEvent<UnityEngine.Object> evt)
{
Icon = evt.newValue as Texture2D;
BasisDebug.Log($"Setting to {Icon}");
BasisProp.BasisBundleDescription.AssetBundleIcon = evt.newValue as Texture2D;
EditorUtility.SetDirty(BasisProp);
BasisDebug.Log($"Setting to {BasisProp.BasisBundleDescription.AssetBundleIcon}");
}

private void PropNameChanged(ChangeEvent<string> evt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class BasisSceneSDKInspector : Editor
public VisualElement rootElement;
public VisualElement uiElementsRoot;
private Label resultLabel;
public static Texture2D Icon;
public BasisSceneValidator BasisSceneValidator;
public bool SpawnPointGizmoState = false;

Expand Down Expand Up @@ -70,7 +69,7 @@ public override VisualElement CreateInspectorGUI()
ObjectField SceneIconField = uiElementsRoot.Q<ObjectField>(BasisSDKConstants.SceneIcon);
SceneIconField.objectType = typeof(Texture2D);
SceneIconField.allowSceneObjects = true;
SceneIconField.value = Icon;
SceneIconField.value = BasisScene.BasisBundleDescription.AssetBundleIcon;
SceneIconField.RegisterCallback<ChangeEvent<UnityEngine.Object>>(OnIconFieldChanged);

// Spawn point field
Expand Down Expand Up @@ -116,7 +115,7 @@ public override VisualElement CreateInspectorGUI()
Button buildButton = BasisHelpersGizmo.Button(uiElementsRoot, BasisSDKConstants.BuildButton);

BasisAssetBundleObject assetBundleObject = AssetDatabase.LoadAssetAtPath<BasisAssetBundleObject>(BasisAssetBundleObject.AssetBundleObject);
buildButton.clicked += () => Build(assetBundleObject.selectedTargets, Icon);
buildButton.clicked += () => Build(assetBundleObject.selectedTargets, BasisScene.BasisBundleDescription.AssetBundleIcon);
}
else
{
Expand All @@ -128,8 +127,9 @@ public override VisualElement CreateInspectorGUI()

private void OnIconFieldChanged(ChangeEvent<UnityEngine.Object> evt)
{
Icon = evt.newValue as Texture2D;
BasisDebug.Log($"Setting to {Icon}");
BasisScene.BasisBundleDescription.AssetBundleIcon = evt.newValue as Texture2D;
EditorUtility.SetDirty(BasisScene);
BasisDebug.Log($"Setting to {BasisScene.BasisBundleDescription.AssetBundleIcon}");
}

private void SceneNameChanged(ChangeEvent<string> evt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<engine:VisualElement name="description" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0.54); -unity-text-outline-color: rgb(24, 24, 24); -unity-text-outline-width: 0; border-bottom-color: rgba(0, 0, 0, 0); letter-spacing: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 10px; border-left-width: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); text-overflow: ellipsis; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-bottom: 5px;">
<engine:TextField label="Avatar Name" name="avatarnameinput" style="-unity-font-style: bold;"/>
<engine:TextField label="Avatar Description" name="avatardescriptioninput" hide-placeholder-on-focus="false" style="-unity-font-style: bold;"/>
<editor:ObjectField name="avataricon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Avatar Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
</engine:VisualElement>
<engine:Foldout text="Assigned Input" name="assignedinput" value="false" style="-unity-background-image-tint-color: rgb(255, 255, 255); -unity-text-align: middle-center; white-space: normal; text-overflow: clip; -unity-font-style: bold; -unity-text-outline-width: 0; -unity-text-outline-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0.54); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-width: 10px; margin-bottom: 5px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;">
<engine:VisualElement name="Fields" style="flex-grow: 1; align-items: stretch; align-content: flex-end; visibility: visible; padding-left: 0; flex-direction: column; align-self: stretch; justify-content: space-around;">
<editor:ObjectField name="AnimatorField" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Animator, UnityEngine.AnimationModule" type="UnityEngine.Animator, UnityEngine.AnimationModule" label="Animator" style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; background-image: none; flex-shrink: 0; right: auto; bottom: auto; align-content: auto; -unity-font-style: normal;"/>
<editor:ObjectField name="FaceVisemeMeshField" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.SkinnedMeshRenderer, UnityEngine.CoreModule" type="UnityEngine.SkinnedMeshRenderer, UnityEngine.CoreModule" label="Face Viseme Mesh " style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; -unity-font-style: normal;"/>
<editor:ObjectField name="FaceBlinkMeshField" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.SkinnedMeshRenderer, UnityEngine.CoreModule" type="UnityEngine.SkinnedMeshRenderer, UnityEngine.CoreModule" label="Blink Blendshape Mesh" style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: space-between; height: auto; width: auto; -unity-font-style: normal;"/>
<editor:ObjectField name="avataricon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Avatar Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
</engine:VisualElement>
</engine:Foldout>
<engine:Foldout text="Eye And Mouth Data" name="eyeandmouthpositions" value="false" style="-unity-text-align: upper-center; -unity-font-style: bold; background-color: rgba(0, 0, 0, 0.54); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-width: 10px; margin-bottom: 5px;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<engine:VisualElement name="description" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0.54); -unity-text-outline-color: rgb(24, 24, 24); -unity-text-outline-width: 0; border-bottom-color: rgba(0, 0, 0, 0); letter-spacing: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 10px; border-left-width: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); text-overflow: ellipsis; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-bottom: 5px;">
<engine:TextField label="Prop Name" name="propnameinput" style="-unity-font-style: bold;"/>
<engine:TextField label="Prop Description" name="propdescriptioninput" hide-placeholder-on-focus="false" style="-unity-font-style: bold;"/>
<editor:ObjectField name="propicon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Prop Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
</engine:VisualElement>
<engine:Foldout text="Settings" name="assignedinput" value="false" style="-unity-background-image-tint-color: rgb(255, 255, 255); -unity-text-align: middle-center; white-space: normal; text-overflow: clip; -unity-font-style: bold; -unity-text-outline-width: 0; -unity-text-outline-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0.54); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-width: 10px; margin-bottom: 5px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;">
<engine:VisualElement name="Fields" style="flex-grow: 1; align-items: stretch; align-content: flex-end; visibility: visible; padding-left: 0; flex-direction: column; align-self: stretch; justify-content: space-around;">
<editor:ObjectField name="propicon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Prop Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
</engine:VisualElement>
</engine:Foldout>
<engine:Label name="ErrorMessage" enabled="false" style="white-space: normal; color: rgb(255, 0, 0);" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<engine:VisualElement name="description" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0.54); -unity-text-outline-color: rgb(24, 24, 24); -unity-text-outline-width: 0; border-bottom-color: rgba(0, 0, 0, 0); letter-spacing: 0; border-top-width: 0; border-right-width: 0; border-bottom-width: 10px; border-left-width: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); text-overflow: ellipsis; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; margin-bottom: 5px;">
<engine:TextField label="Scene Name" name="scenenameinput" style="-unity-font-style: bold;"/>
<engine:TextField label="Scene Description" name="scenedescriptioninput" hide-placeholder-on-focus="false" style="-unity-font-style: bold;"/>
<editor:ObjectField name="sceneicon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Scene Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
</engine:VisualElement>
<engine:Foldout text="Settings" name="assignedinput" value="false" style="-unity-background-image-tint-color: rgb(255, 255, 255); -unity-text-align: middle-center; white-space: normal; text-overflow: clip; -unity-font-style: bold; -unity-text-outline-width: 0; -unity-text-outline-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0.54); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-width: 10px; margin-bottom: 5px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;">
<engine:VisualElement name="Fields" style="flex-grow: 1; align-items: stretch; align-content: flex-end; visibility: visible; padding-left: 0; flex-direction: column; align-self: stretch; justify-content: space-around;">
<editor:ObjectField name="sceneicon" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Texture2D, UnityEngine.CoreModule" type="UnityEngine.Texture2D, UnityEngine.CoreModule" label="Scene Icon" enabled="true" style="position: relative; overflow: flex-start; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; display: flex; flex-wrap: nowrap;"/>
<editor:ObjectField name="spawnpointfield" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Transform, UnityEngine.CoreModule" type="UnityEngine.Transform, UnityEngine.CoreModule" label="Spawn Point" style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; -unity-font-style: normal;"/>
<editor:ObjectField name="maincamerafield" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Camera, UnityEngine.CoreModule" type="UnityEngine.Camera, UnityEngine.CoreModule" label="Main Camera" style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; -unity-font-style: normal;"/>
<editor:ObjectField name="audiomixergroupfield" allow-scene-objects="true" usage-hints="None" data-source-type="UnityEngine.Audio.AudioMixerGroup, UnityEngine.AudioModule" type="UnityEngine.Audio.AudioMixerGroup, UnityEngine.AudioModule" label="Audio Mixer Group" enabled="false" style="position: relative; overflow: visible; visibility: visible; flex-direction: row; align-items: auto; top: auto; left: auto; align-self: auto; opacity: 1; justify-content: flex-start; height: auto; width: auto; -unity-font-style: normal;"/>
Expand Down
Loading