Skip to content

Commit

Permalink
chore: refactor APIs in preparation for 1.5.0-beta release (#294)
Browse files Browse the repository at this point in the history
* chore: temporarily disable APIs that aren't ready for stabilization

* chore: rearrange namespaces

* chore: restructure assemblies

* chore: CHANGELOG update
  • Loading branch information
bdunderscore authored Jul 29, 2024
1 parent 9497ebf commit 96b3cf1
Show file tree
Hide file tree
Showing 42 changed files with 40 additions and 2,306 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#284] Preview objects do not inherit scale when they are previewing a Skinned Mesh Renderer with no root bone.

### Changed
- [#XXX] Restructured namespace and assembly hierarchy to remove references to "Reactive Query".

### Removed
- [#XXX] Removed some unimplemented APIs in preparation for 1.5.0 release.

### Security

Expand Down
1 change: 0 additions & 1 deletion Editor/API/ObjectRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using nadena.dev.ndmf.rq;
using nadena.dev.ndmf.runtime;
using UnityEngine;
using Object = UnityEngine.Object;
Expand Down
4 changes: 3 additions & 1 deletion Editor/ChangeStream/ChangeNotifier.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#region

using JetBrains.Annotations;
using nadena.dev.ndmf.cs;
using UnityEditor;
using UnityEngine;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.preview
{
[PublicAPI]
public static class ChangeNotifier
{
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions Editor/ChangeStream/ChangeStreamMonitor.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#region

using System;
using System.Diagnostics;
using UnityEditor;
using UnityEngine.Profiling;
using Debug = UnityEngine.Debug;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.cs
{
internal class ChangeStreamMonitor
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/ChangeStream/ListenerSet.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#region

using System;
using nadena.dev.ndmf.preview;
using UnityEditor;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.cs
{
internal class Listener<T> : IDisposable
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/ChangeStream/ObjectWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using nadena.dev.ndmf.preview;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.cs
{
#region

Expand Down
2 changes: 1 addition & 1 deletion Editor/ChangeStream/PropertyMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Stopwatch = System.Diagnostics.Stopwatch;
using Object = UnityEngine.Object;

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.cs
{
internal class PropertyMonitor
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/ChangeStream/ShadowGameObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
using System;
using System.Collections.Generic;
using System.Threading;
using nadena.dev.ndmf.preview;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.cs
{
#region

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

#endregion

namespace nadena.dev.ndmf.rq
namespace nadena.dev.ndmf
{
internal class ObjectIdentityComparer<T> : IEqualityComparer<T>
{
public static ObjectIdentityComparer<T> Instance { get; } = new ObjectIdentityComparer<T>();
public static ObjectIdentityComparer<T> Instance { get; } = new();


public bool Equals(T x, T y)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

#endregion

namespace nadena.dev.ndmf.rq
namespace nadena.dev.ndmf.preview
{
/// <summary>
/// Tracks dependencies around a single computation. Generally, this object should be retained as long as we need to
/// receive invalidation events (GCing this object may deregister invalidation events).
/// Tracks dependencies around a single computation. Generally, this object should be retained as long as we need to
/// receive invalidation events (GCing this object may deregister invalidation events).
/// </summary>
public sealed class ComputeContext
{
private TaskCompletionSource<object> _invalidater = new();
private readonly TaskCompletionSource<object> _invalidater = new();

/// <summary>
/// An Action which can be used to invalidate this compute context (possibly triggering a recompute).
/// An Action which can be used to invalidate this compute context (possibly triggering a recompute).
/// </summary>
internal Action Invalidate { get; }

/// <summary>
/// A Task which completes when this compute context is invalidated. Note that completing this task does not
/// guarantee that the underlying computation (e.g. ReactiveValue) is going to be recomputed.
/// A Task which completes when this compute context is invalidated. Note that completing this task does not
/// guarantee that the underlying computation (e.g. ReactiveValue) is going to be recomputed.
/// </summary>
internal Task OnInvalidate { get; }

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion Editor/PreviewSystem/ComputeContext/GlobalQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using nadena.dev.ndmf.cs;
using UnityEngine;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.preview
{
public static partial class ComputeContextQueries
{
Expand Down
3 changes: 2 additions & 1 deletion Editor/PreviewSystem/ComputeContext/PublishedValue.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using nadena.dev.ndmf.cs;
using UnityEngine;

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.preview
{
/// <summary>
/// A holder of a value which can be subscribed to (using ComputeContext) to receive invalidation events when the
Expand Down
3 changes: 2 additions & 1 deletion Editor/PreviewSystem/ComputeContext/SingleObjectQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using nadena.dev.ndmf.cs;
using UnityEngine;
using Object = UnityEngine.Object;

#endregion

namespace nadena.dev.ndmf.rq.unity.editor
namespace nadena.dev.ndmf.preview
{
[PublicAPI]
public static partial class ComputeContextQueries
Expand Down
1 change: 0 additions & 1 deletion Editor/PreviewSystem/IRenderFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using nadena.dev.ndmf.rq;
using UnityEngine;

#endregion
Expand Down
8 changes: 5 additions & 3 deletions Editor/PreviewSystem/PreviewSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using nadena.dev.ndmf.rq;
using UnityEngine;

#endregion
Expand All @@ -16,7 +15,7 @@ namespace nadena.dev.ndmf.preview
///
/// (For now, this isn't very useful; use `DeclaringPass.PreviewingWith` instead)
/// </summary>
public class PreviewSession : IDisposable
public class PreviewSession // : IDisposable
{
#region Static State

Expand All @@ -25,7 +24,7 @@ public class PreviewSession : IDisposable
/// </summary>
public static PreviewSession Current { get; set; } = null;


#if FUTURE_API
/// <summary>
/// Applies this PreviewSession to the `target` camera.
/// </summary>
Expand All @@ -43,6 +42,7 @@ public static void ClearCameraOverride(Camera target)
{
throw new NotImplementedException();
}
#endif

#endregion

Expand Down Expand Up @@ -120,6 +120,7 @@ void RebuildSequence()
_session.Filters = filters;
}

#if FUTURE_API
/// <summary>
/// Returns a new PreviewSession which inherits all mutators from the parent session. Any mutators added to this
/// new session run after the parent session's mutators.
Expand All @@ -135,5 +136,6 @@ public void Dispose()
{
throw new NotImplementedException();
}
#endif
}
}
1 change: 0 additions & 1 deletion Editor/PreviewSystem/Rendering/NodeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using nadena.dev.ndmf.rq;
using UnityEngine;

#endregion
Expand Down
1 change: 0 additions & 1 deletion Editor/PreviewSystem/Rendering/ProxyObjectCache.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using nadena.dev.ndmf.rq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
Expand Down
2 changes: 0 additions & 2 deletions Editor/PreviewSystem/Rendering/ProxyObjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using nadena.dev.ndmf.rq;
using nadena.dev.ndmf.rq.unity.editor;
using UnityEngine;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;
Expand Down
1 change: 0 additions & 1 deletion Editor/PreviewSystem/Rendering/ProxyPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using nadena.dev.ndmf.rq;
using UnityEngine;

#endregion
Expand Down
1 change: 0 additions & 1 deletion Editor/PreviewSystem/Rendering/ProxySession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using nadena.dev.ndmf.rq;
using UnityEditor;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@

#endregion

namespace nadena.dev.ndmf.rq
namespace nadena.dev.ndmf.preview
{
public static class TaskThrottle
internal static class TaskThrottle // TODO: make this a public API?
{
public static readonly ThreadLocal<Func<bool>> ShouldThrottle = new(() => () => false);

public static async ValueTask MaybeThrottle()
{
if (ShouldThrottle.Value())
{
await Task.CompletedTask.ContinueWith(
_ => Task.CompletedTask,
CancellationToken.None,
TaskContinuationOptions.RunContinuationsAsynchronously,
TaskScheduler.Current
);
}
}

public static IDisposable WithThrottleCondition(Func<bool> condition)
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion Editor/assembly-info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
#endregion

[assembly: InternalsVisibleTo("nadena.dev.ndmf.UnitTests")]
[assembly: InternalsVisibleTo("nadena.dev.ndmf.reactive-query.tests.editor")]
[assembly: InternalsVisibleTo("nadena.dev.ndmf.vrchat")]
3 changes: 1 addition & 2 deletions Editor/nadena.dev.ndmf.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"VRC.SDKBase",
"VRC.SDK3A",
"VRC.SDK3A.Editor",
"nadena.dev.ndmf.runtime",
"nadena.dev.ndmf.reactive-query.core"
"nadena.dev.ndmf.runtime"
],
"includePlatforms": [
"Editor"
Expand Down
3 changes: 0 additions & 3 deletions RQ-Core.meta

This file was deleted.

8 changes: 0 additions & 8 deletions RQ-Core/JetBrainsAnnotations.meta

This file was deleted.

Loading

0 comments on commit 96b3cf1

Please sign in to comment.