Skip to content

Commit

Permalink
chore: adjust debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Sep 26, 2024
1 parent 3e9fc4f commit d858ac9
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions Editor/ChangeStream/ShadowGameObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ void DumpListenerSet<T>(ListenerSet<T> set)

internal IDisposable RegisterRootSetListener(ListenerSet<HierarchyEvent>.Filter filter, ComputeContext ctx)
{
#if NDMF_TRACE
Debug.WriteLine("[ShadowHierarchy] RegisterRootSetListener()");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine("[ShadowHierarchy] RegisterRootSetListener()");
#endif

if (ctx.IsInvalidated) return new NullDisposable();
Expand All @@ -161,8 +161,8 @@ internal IDisposable RegisterGameObjectListener(
ComputeContext ctx
)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] RegisterGameObjectListener({targetObject.GetInstanceID()})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] RegisterGameObjectListener({targetObject.GetInstanceID()})");
#endif

if (targetObject == null || ctx.IsInvalidated) return new NullDisposable();
Expand All @@ -179,8 +179,8 @@ ComputeContext ctx
{
if (targetComponent == null || ctx.IsInvalidated) return new NullDisposable();

#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] RegisterObjectListener({targetComponent.GetInstanceID()})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] RegisterObjectListener({targetComponent.GetInstanceID()})");
#endif

if (!_otherObjects.TryGetValue(targetComponent.GetInstanceID(), out var shadowComponent))
Expand All @@ -207,8 +207,8 @@ public void Dispose()
/// <param name="root"></param>
internal void EnableComponentMonitoring(GameObject root)
{
#if NDMF_TRACE
//Debug.WriteLine($"[ShadowHierarchy] EnableComponentMonitoring({root.GetInstanceID()})");
#if NDMF_TRACE_SHADOW
//System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] EnableComponentMonitoring({root.GetInstanceID()})");
#endif

var obj = ActivateShadowObject(root);
Expand All @@ -231,8 +231,8 @@ private void EnableComponentMonitoring(ShadowGameObject obj)

internal void EnablePathMonitoring(GameObject root)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] EnablePathMonitoring({root.GetInstanceID()})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] EnablePathMonitoring({root.GetInstanceID()})");
#endif

var obj = ActivateShadowObject(root);
Expand Down Expand Up @@ -285,8 +285,8 @@ private ShadowGameObject ActivateShadowObject(GameObject targetObject)
/// <param name="instanceId"></param>
internal void FireObjectChangeNotification(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireObjectChangeNotification({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireObjectChangeNotification({instanceId})");
#endif

if (_gameObjects.TryGetValue(instanceId, out var shadow))
Expand Down Expand Up @@ -320,8 +320,8 @@ internal void FireObjectChangeNotification(int instanceId)
/// <param name="instanceId"></param>
internal void FireReparentNotification(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireReparentNotification({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireReparentNotification({instanceId})");
#endif

// Always activate on reparent. This is because we might be reparenting _into_ an active hierarchy.
Expand Down Expand Up @@ -397,8 +397,8 @@ private void FireParentComponentChangeNotifications(ShadowGameObject obj)

internal void FireDestroyNotification(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireDestroyNotification({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireDestroyNotification({instanceId})");
#endif

if (_gameObjects.TryGetValue(instanceId, out var shadow))
Expand All @@ -410,9 +410,9 @@ internal void FireDestroyNotification(int instanceId)

void ForceInvalidateHierarchy(ShadowGameObject obj)
{
#if NDMF_TRACE
#if NDMF_TRACE_SHADOW
var resolvedName = obj.GameObject == null ? "<null>" : obj.GameObject.name;
Debug.WriteLine($"[ShadowHierarchy] ForceInvalidateHierarchy({obj.InstanceID}:{resolvedName})");
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] ForceInvalidateHierarchy({obj.InstanceID}:{resolvedName})");
#endif

obj._listeners.Fire(HierarchyEvent.ForceInvalidate);
Expand All @@ -426,8 +426,8 @@ void ForceInvalidateHierarchy(ShadowGameObject obj)

internal void FireReorderNotification(int parentInstanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireReorderNotification({parentInstanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireReorderNotification({parentInstanceId})");
#endif

if (!_gameObjects.TryGetValue(parentInstanceId, out var shadow))
Expand All @@ -440,8 +440,8 @@ internal void FireReorderNotification(int parentInstanceId)

internal void FireStructureChangeEvent(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireStructureChangeEvent({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireStructureChangeEvent({instanceId})");
#endif

if (!_gameObjects.TryGetValue(instanceId, out var shadow))
Expand All @@ -455,8 +455,8 @@ internal void FireStructureChangeEvent(int instanceId)

internal void InvalidateAll()
{
#if NDMF_TRACE
Debug.WriteLine("[ShadowHierarchy] InvalidateAll()");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine("[ShadowHierarchy] InvalidateAll()");
#endif

var oldDict = _gameObjects;
Expand Down Expand Up @@ -486,8 +486,8 @@ internal void InvalidateAll()
/// <exception cref="NotImplementedException"></exception>
public void InvalidateTree(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] InvalidateTree({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] InvalidateTree({instanceId})");
#endif

if (_gameObjects.TryGetValue(instanceId, out var shadow))
Expand Down Expand Up @@ -524,8 +524,8 @@ public void InvalidateTree(int instanceId)

public void FireGameObjectCreate(int instanceId)
{
#if NDMF_TRACE
Debug.WriteLine($"[ShadowHierarchy] FireGameObjectCreate({instanceId})");
#if NDMF_TRACE_SHADOW
System.Diagnostics.Debug.WriteLine($"[ShadowHierarchy] FireGameObjectCreate({instanceId})");
#endif

var obj = EditorUtility.InstanceIDToObject(instanceId) as GameObject;
Expand Down

0 comments on commit d858ac9

Please sign in to comment.