Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fdd1ad2
added initial KHR_audio: schema, plugins, and first draft export
robertdorn83 Apr 4, 2025
700aed7
fixed 2d <> 3d blend sorting
robertdorn83 Apr 4, 2025
d2b76cd
renamed extension KHR_audio to KHR_audio_emitter
robertdorn83 Apr 4, 2025
6d96350
fixed missing uri assignment in audio exporter
robertdorn83 Apr 4, 2025
beda0d2
added audio deserialization
robertdorn83 Apr 4, 2025
7abe7e9
Audio: inital import (WIP)
robertdorn83 Apr 4, 2025
9dd0888
added new GetBufferViewData for public access to buffers
robertdorn83 Apr 4, 2025
9b788a3
added Generic Object Cache to track AudioClips in runtime loaded files
robertdorn83 Apr 7, 2025
4bebea2
removed AudioData.Name from deserialization
robertdorn83 Apr 8, 2025
2095c23
Audio Export: added support for wav, mp3 and ogg
robertdorn83 Apr 8, 2025
3c16724
added support for Audio Import as Assets
robertdorn83 Apr 8, 2025
d8712ee
fixed wrong offset in GetBufferViewData
robertdorn83 Apr 8, 2025
e5ebc81
Audio plugins: set enabledbydefault to false
robertdorn83 Apr 8, 2025
77eb908
deleted KHR_audio Sample
robertdorn83 Apr 8, 2025
2c824be
changed Audio Export plugin description
robertdorn83 Apr 8, 2025
2bfa171
changed audio emitter import creation to split global/posiotional par…
robertdorn83 Apr 8, 2025
071063d
changed how positional emitter data gets serializied and deserialized
robertdorn83 Apr 8, 2025
3a060bd
moved Audio plugins to Experimental
robertdorn83 May 15, 2025
85327e2
AudioExport: removed unsused variables
robertdorn83 May 15, 2025
4c47b6a
new non-ratified plugin attribute, added to Audio and Int.VisualScrip…
robertdorn83 May 15, 2025
105e655
changed Audio Export to editor only
robertdorn83 May 15, 2025
ef29060
added new Experimental Attribute for Plugins
robertdorn83 May 15, 2025
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
57 changes: 57 additions & 0 deletions Editor/Scripts/GLTFSettingsInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
Expand All @@ -17,6 +18,7 @@ namespace UnityGLTF
#if SHOW_SETTINGS_EDITOR
internal class GltfSettingsProvider : SettingsProvider
{
private const string DEFAULT_NON_RATIFIED_TOOLTIP = "This extension specification is not yet ratified. It may change in the future.";
internal static Action<GLTFSettings> OnAfterGUI;
private static GLTFSettings settings;
private SerializedProperty showDefaultReferenceNameWarning, showNamingRecommendationHint;
Expand Down Expand Up @@ -161,6 +163,8 @@ internal static void DrawGLTFSettingsGUI(GLTFSettings settings, SerializedObject

private static Dictionary<Type, Editor> editorCache = new Dictionary<Type, Editor>();

private static GUIStyle _badgeStyle = null;

internal static void OnPluginsGUI(IEnumerable<GLTFPlugin> plugins, bool allowDisabling = true)
{
var lastAssembly = "";
Expand Down Expand Up @@ -210,9 +214,23 @@ internal static void OnPluginsGUI(IEnumerable<GLTFPlugin> plugins, bool allowDis
EditorUtility.SetDirty(plugin);

var label = new GUIContent(displayName, plugin.Description);

EditorGUI.BeginDisabledGroup(!plugin.Enabled);
var expanded2 = EditorGUILayout.Foldout(expanded, label);
var lastFoldoutRect = GUILayoutUtility.GetLastRect();

float batchOffsetX = EditorStyles.label.CalcSize(label).x + 20f;
var nonRatAttribute = plugin.GetType().GetCustomAttribute(typeof(NonRatifiedPluginAttribute), true);
if (nonRatAttribute != null)
{
batchOffsetX = DrawNonRatifiedBadge(nonRatAttribute, batchOffsetX);
}
var expAttribute = plugin.GetType().GetCustomAttribute(typeof(ExperimentalPluginAttribute), true);
if (expAttribute != null)
{
batchOffsetX = DrawExperimentalBadge(expAttribute, batchOffsetX);
}

// check for right click so we can show a context menu
EditorGUI.EndDisabledGroup();
if (Event.current.type == EventType.MouseDown && lastFoldoutRect.Contains(Event.current.mousePosition))
Expand Down Expand Up @@ -279,6 +297,45 @@ internal static void OnPluginsGUI(IEnumerable<GLTFPlugin> plugins, bool allowDis
}
}

private static float DrawBadge(string text, string toolTip, Color color, float offsetX)
{
if (_badgeStyle == null)
{
_badgeStyle = new GUIStyle(EditorStyles.objectFieldThumb);
_badgeStyle.fontSize = 11;
_badgeStyle.contentOffset = new Vector2(0, 0);
_badgeStyle.clipping = TextClipping.Overflow;
_badgeStyle.fixedHeight = 15f;
}

var explabel = new GUIContent(text , toolTip);
var expLabelRect = GUILayoutUtility.GetLastRect();

expLabelRect.x += offsetX;
expLabelRect.width = _badgeStyle.CalcSize(explabel).x+15;
expLabelRect.y += 2f;

GUI.contentColor = color;
GUI.backgroundColor = color;
EditorGUI.LabelField(expLabelRect, explabel, _badgeStyle);
GUI.backgroundColor = Color.white;
GUI.contentColor = Color.white;
return offsetX + expLabelRect.width - 10f;
}

private static float DrawNonRatifiedBadge(Attribute expAttribute, float offsetX)
{
var exp = expAttribute as NonRatifiedPluginAttribute;
var toolTip = exp.toolTip == null ? DEFAULT_NON_RATIFIED_TOOLTIP : exp.toolTip;
return DrawBadge("non-ratified", toolTip, new Color(1f*2,0.5f*2,0f,1f), offsetX);
}

private static float DrawExperimentalBadge(Attribute expAttribute, float offsetX)
{
var exp = expAttribute as ExperimentalPluginAttribute;
var toolTip = exp.toolTip == null ? null : exp.toolTip;
return DrawBadge("experimental", toolTip, new Color(1f*2f,0.7f,0f,1f), offsetX);
}
}

[CustomEditor(typeof(GLTFSettings))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace UnityGLTF.Interactivity.VisualScripting
/// See https://github.com/KhronosGroup/UnityGLTF?tab=readme-ov-file#extensibility
/// for the external documentation on how to extend UnityGLTF.
/// </summary>
[NonRatifiedPlugin]
public class VisualScriptingExportPlugin: GLTFExportPlugin
{
public override JToken AssetExtras
Expand Down
Loading