From f467e0cfe0765e28685d658c0ceb97cb3f582aa1 Mon Sep 17 00:00:00 2001 From: Matt Schoen Date: Tue, 22 Sep 2020 03:15:53 -0700 Subject: [PATCH] Add version defines; Update changelog --- CHANGELOG.md | 9 ++++- Interfaces/Providers/IProvidesWeb.cs | 2 ++ Interfaces/Subscribers/IUsesWeb.cs | 2 ++ .../Unity.Labs.EditorXR.Interfaces.asmdef | 21 ++++++++++-- Runtime/Scripts/Modules/WebModule.cs | 2 ++ Runtime/Scripts/Utilities/AssetDropUtils.cs | 34 ++++++++++++++++--- Runtime/Unity.Labs.EditorXR.asmdef | 20 +++++++++-- .../Workspaces/PolyWorkspace/PolyWorkspace.cs | 2 +- .../PolyWorkspace/Scripts/PolyGridAsset.cs | 12 +++++-- .../ProjectWorkspace/Scripts/AssetGridItem.cs | 10 ++++++ package.json | 16 +++++---- 11 files changed, 110 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3943ca2e..95bedb5d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [0.4.12-preview] - 2020-09-22 -- Update List View Framework with multi-select changes +### Added +- Version defines and package dependencies for built-in modules + +### Updated +- List View Framework dependency version + +### Removed +- Dependency on Timeline ## [0.4.11-preview] - 2020-09-02 - Update List View Framework dependency version diff --git a/Interfaces/Providers/IProvidesWeb.cs b/Interfaces/Providers/IProvidesWeb.cs index 6549b3615..d03f9d5be 100644 --- a/Interfaces/Providers/IProvidesWeb.cs +++ b/Interfaces/Providers/IProvidesWeb.cs @@ -1,3 +1,4 @@ +#if INCLUDE_UNITY_WEB_REQUEST using System; using Unity.XRTools.ModuleLoader; using UnityEngine.Networking; @@ -33,3 +34,4 @@ public interface IProvidesWeb : IFunctionalityProvider void Download(string url, string destination, Action completed); } } +#endif diff --git a/Interfaces/Subscribers/IUsesWeb.cs b/Interfaces/Subscribers/IUsesWeb.cs index 9c6f79a12..4b9f0d34f 100644 --- a/Interfaces/Subscribers/IUsesWeb.cs +++ b/Interfaces/Subscribers/IUsesWeb.cs @@ -1,3 +1,4 @@ +#if INCLUDE_UNITY_WEB_REQUEST using System; using Unity.XRTools.ModuleLoader; using UnityEngine.Networking; @@ -58,3 +59,4 @@ public static void Download(this IUsesWeb user, string url, string destination, } } } +#endif diff --git a/Interfaces/Unity.Labs.EditorXR.Interfaces.asmdef b/Interfaces/Unity.Labs.EditorXR.Interfaces.asmdef index 237a6ff4b..b476c79df 100644 --- a/Interfaces/Unity.Labs.EditorXR.Interfaces.asmdef +++ b/Interfaces/Unity.Labs.EditorXR.Interfaces.asmdef @@ -11,5 +11,22 @@ "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] -} \ No newline at end of file + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.modules.unitywebrequest", + "expression": "1.0.0", + "define": "INCLUDE_UNITY_WEB_REQUEST" + }, + { + "name": "com.unity.modules.video", + "expression": "1.0.0", + "define": "INCLUDE_VIDEO_MODULE" + }, + { + "name": "com.unity.modules.audio", + "expression": "1.0.0", + "define": "INCLUDE_AUDIO_MODULE" + } + ] +} diff --git a/Runtime/Scripts/Modules/WebModule.cs b/Runtime/Scripts/Modules/WebModule.cs index a1d576e08..6bdca798e 100644 --- a/Runtime/Scripts/Modules/WebModule.cs +++ b/Runtime/Scripts/Modules/WebModule.cs @@ -1,3 +1,4 @@ +#if INCLUDE_UNITY_WEB_REQUEST using System; using System.Collections.Generic; using System.IO; @@ -199,3 +200,4 @@ public void ConnectSubscriber(object obj) public void UnloadProvider() { } } } +#endif diff --git a/Runtime/Scripts/Utilities/AssetDropUtils.cs b/Runtime/Scripts/Utilities/AssetDropUtils.cs index 779141987..182dc0117 100644 --- a/Runtime/Scripts/Utilities/AssetDropUtils.cs +++ b/Runtime/Scripts/Utilities/AssetDropUtils.cs @@ -18,9 +18,15 @@ static class AssetDropUtils public static readonly Dictionary> AssignmentDependencies = new Dictionary> { - { "AnimationClip", new List { typeof(Animation) } }, +#if INCLUDE_AUDIO_MODULE { "AudioClip", new List { typeof(AudioSource) } }, +#endif + +#if INCLUDE_VIDEO_MODULE { "VideoClip", new List { typeof(VideoPlayer) } }, +#endif + + { "AnimationClip", new List { typeof(Animation) } }, { "Material", new List { typeof(Renderer) } }, { "Shader", new List { typeof(Material) } }, { "PhysicMaterial", new List {typeof(Collider) } } @@ -29,15 +35,29 @@ public static readonly Dictionary> AssignmentDependencies // dependency types to ignore when previewing asset assignment validity public static List AutoFillTypes = new List { - typeof(Animation), typeof(AudioSource), typeof(VideoPlayer) +#if INCLUDE_AUDIO_MODULE + typeof(AudioSource), +#endif + +#if INCLUDE_VIDEO_MODULE + typeof(VideoPlayer), +#endif + + typeof(Animation) }; - const string k_AssignAudioClipUndo = "Assign Audio Clip"; - const string k_AssignAnimationClipUndo = "Assign Animation Clip"; - const string k_AssignVideoClipUndo = "Assign Video Clip"; const string k_AssignFontUndo = "Assign Font"; const string k_AssignMaterialUndo = "Assign Material"; const string k_AssignPhysicMaterialUndo = "Assign Physic Material"; + const string k_AssignAnimationClipUndo = "Assign Animation Clip"; + +#if INCLUDE_AUDIO_MODULE + const string k_AssignAudioClipUndo = "Assign Audio Clip"; +#endif + +#if INCLUDE_VIDEO_MODULE + const string k_AssignVideoClipUndo = "Assign Video Clip"; +#endif // TODO - make all these booleans options in the settings menu static bool s_CreatePlayerForClips = true; @@ -69,6 +89,7 @@ internal static void AssignAnimationClipAction(GameObject go, AssetData data) AssignAnimationClip(go, data); } +#if INCLUDE_AUDIO_MODULE internal static AudioSource AttachAudioClip(GameObject go, AssetData data) { var source = ComponentUtils.GetOrAddIf(go, s_CreatePlayerForClips); @@ -87,7 +108,9 @@ internal static void AudioClipAction(GameObject go, AssetData data) { AttachAudioClip(go, data); } +#endif +#if INCLUDE_VIDEO_MODULE internal static VideoPlayer AttachVideoClip(GameObject go, AssetData data) { var player = ComponentUtils.GetOrAddIf(go, s_CreatePlayerForClips); @@ -106,6 +129,7 @@ internal static void VideoClipAction(GameObject go, AssetData data) { AttachVideoClip(go, data); } +#endif internal static GameObject AttachScript(GameObject go, AssetData data) { diff --git a/Runtime/Unity.Labs.EditorXR.asmdef b/Runtime/Unity.Labs.EditorXR.asmdef index 0687ee07d..a857c6a9a 100644 --- a/Runtime/Unity.Labs.EditorXR.asmdef +++ b/Runtime/Unity.Labs.EditorXR.asmdef @@ -15,7 +15,6 @@ "Unity.XRTools.SpatialHash.Public", "Unity.XRTools.SpatialHash" ], - "optionalUnityReferences": [], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, @@ -23,5 +22,22 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [] + "versionDefines": [ + { + "name": "com.unity.modules.unitywebrequest", + "expression": "1.0.0", + "define": "INCLUDE_UNITY_WEB_REQUEST" + }, + { + "name": "com.unity.modules.video", + "expression": "1.0.0", + "define": "INCLUDE_VIDEO_MODULE" + }, + { + "name": "com.unity.modules.audio", + "expression": "1.0.0", + "define": "INCLUDE_AUDIO_MODULE" + } + ], + "noEngineReferences": false } \ No newline at end of file diff --git a/Runtime/Workspaces/PolyWorkspace/PolyWorkspace.cs b/Runtime/Workspaces/PolyWorkspace/PolyWorkspace.cs index b311c5af5..3feabf54d 100644 --- a/Runtime/Workspaces/PolyWorkspace/PolyWorkspace.cs +++ b/Runtime/Workspaces/PolyWorkspace/PolyWorkspace.cs @@ -19,7 +19,7 @@ namespace Unity.EditorXR.Workspaces { -#if INCLUDE_POLY_TOOLKIT +#if INCLUDE_POLY_TOOLKIT && INCLUDE_UNITY_WEB_REQUEST [MainMenuItem("Poly", "Workspaces", "Import models from Google Poly")] [SpatialMenuItem("Poly", "Workspaces", "Import models from Google Poly")] sealed class PolyWorkspace : Workspace, ISerializeWorkspace diff --git a/Runtime/Workspaces/PolyWorkspace/Scripts/PolyGridAsset.cs b/Runtime/Workspaces/PolyWorkspace/Scripts/PolyGridAsset.cs index dea650ff7..2a088df76 100644 --- a/Runtime/Workspaces/PolyWorkspace/Scripts/PolyGridAsset.cs +++ b/Runtime/Workspaces/PolyWorkspace/Scripts/PolyGridAsset.cs @@ -1,9 +1,12 @@ using System; -using Unity.EditorXR.Interfaces; using UnityEngine; using Unity.ListViewFramework; +#if INCLUDE_UNITY_WEB_REQUEST +using Unity.EditorXR.Interfaces; using Unity.XRTools.ModuleLoader; +#endif + #if INCLUDE_POLY_TOOLKIT using PolyToolkit; using UnityEngine.Networking; @@ -11,7 +14,10 @@ namespace Unity.EditorXR.Workspaces { - class PolyGridAsset : IListViewItemData, IUsesWeb + class PolyGridAsset : IListViewItemData +#if INCLUDE_UNITY_WEB_REQUEST + , IUsesWeb +#endif { const int k_MaxPreviewComplexity = 2500; static readonly string k_TemplateName = "PolyGridItem"; @@ -41,7 +47,7 @@ class PolyGridAsset : IListViewItemData, IUsesWeb public bool initialized { get { return m_Initialized; } } public long complexity { get { return m_Complexity; } } -#if !FI_AUTOFILL +#if INCLUDE_UNITY_WEB_REQUEST IProvidesWeb IFunctionalitySubscriber.provider { get; set; } #endif diff --git a/Runtime/Workspaces/ProjectWorkspace/Scripts/AssetGridItem.cs b/Runtime/Workspaces/ProjectWorkspace/Scripts/AssetGridItem.cs index 8cc8025be..e8d8dea91 100644 --- a/Runtime/Workspaces/ProjectWorkspace/Scripts/AssetGridItem.cs +++ b/Runtime/Workspaces/ProjectWorkspace/Scripts/AssetGridItem.cs @@ -599,15 +599,25 @@ void HandleAssetDropByType(Transform rayOrigin, AssetGridItem gridItem) case AssetData.ModelTypeString: PlaceModelOrPrefab(gridItem.transform, data); break; + +#if INCLUDE_ANIMATION_MODULE case "AnimationClip": SelectAndPlace(rayOrigin, data, AssetDropUtils.AssignAnimationClipAction); break; +#endif + +#if INCLUDE_AUDIO_MODULE case "AudioClip": SelectAndPlace(rayOrigin, data, AssetDropUtils.AudioClipAction); break; +#endif + +#if INCLUDE_VIDEO_MODULE case "VideoClip": SelectAndPlace(rayOrigin, data, AssetDropUtils.VideoClipAction); break; +#endif + case "Font": SelectAndPlace(rayOrigin, data, AssetDropUtils.AssignFontAction); break; diff --git a/package.json b/package.json index 4db7bf79d..dc6cc581c 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,17 @@ "unityRelease": "14f1", "description": "Author XR in XR\nEditorXR provides a basic set of authoring tools and a framework for using and developing spatial authoring environments. This package adds the VR View to the Unity Editor, allowing users to take advantage of VR devices like Oculus Rift and HTC Vive in edit mode and work directly on their project and scenes in VR.\nIt is also possible to build EditorXR and its tools and workspaces into Player builds for use on devices like Oculus Quest or to incoroprate authoring components into end-user experiences.", "dependencies": { - "com.unity.xrtools.utils": "1.1.1", - "com.unity.xrtools.module-loader": "1.1.1", - "com.unity.list-view-framework": "1.1.6-preview", - "com.unity.xrtools.spatial-hash": "0.1.3-preview", + "com.unity.list-view-framework": "1.1.7-preview", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.textmeshpro": "2.0.1", "com.unity.xr.legacyinputhelpers": "2.0.6", "com.unity.xr-line-renderer": "0.1.2-preview", - "com.unity.timeline": "1.0.0", - "com.unity.textmeshpro": "2.0.1" + "com.unity.xrtools.module-loader": "1.1.1", + "com.unity.xrtools.spatial-hash": "0.1.3-preview", + "com.unity.xrtools.utils": "1.1.1" } }