mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-30 18:22:52 +08:00
parent
d57e211d0b
commit
42ca90a6bc
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
#region
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using nadena.dev.modular_avatar.JacksonDunstan.NativeCollections;
|
||||
using Unity.Burst;
|
||||
@ -7,6 +9,8 @@ using Unity.Jobs;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Jobs;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
{
|
||||
internal class BidirectionalArmatureLock : IDisposable, IArmatureLock
|
||||
@ -131,8 +135,9 @@ namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
|
||||
LastOp.Complete();
|
||||
|
||||
_baseBoneAccess.Dispose();
|
||||
_mergeBoneAccess.Dispose();
|
||||
// work around crashes caused by destroying TransformAccessArray from within Undo processing
|
||||
DeferDestroy.DeferDestroyObj(_baseBoneAccess);
|
||||
DeferDestroy.DeferDestroyObj(_mergeBoneAccess);
|
||||
BaseBones.Dispose();
|
||||
MergeBones.Dispose();
|
||||
SavedMerge.Dispose();
|
||||
|
18
Runtime/ArmatureAwase/DeferDestroy.cs
Normal file
18
Runtime/ArmatureAwase/DeferDestroy.cs
Normal file
@ -0,0 +1,18 @@
|
||||
#region
|
||||
|
||||
using System;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
{
|
||||
internal static class DeferDestroy
|
||||
{
|
||||
internal static void DeferDestroyObj(IDisposable obj)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.delayCall += () => obj.Dispose();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
3
Runtime/ArmatureAwase/DeferDestroy.cs.meta
Normal file
3
Runtime/ArmatureAwase/DeferDestroy.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 587f90fe407f4a8287c927c435d84880
|
||||
timeCreated: 1708260240
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
#region
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using nadena.dev.modular_avatar.JacksonDunstan.NativeCollections;
|
||||
using Unity.Burst;
|
||||
@ -10,6 +12,8 @@ using UnityEngine.Jobs;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
{
|
||||
internal class OnewayArmatureLock : IDisposable, IArmatureLock
|
||||
@ -203,6 +207,8 @@ namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
|
||||
LastOp.Complete();
|
||||
|
||||
_baseBonesAccessor.SetTransforms(_baseBones);
|
||||
_mergeBonesAccessor.SetTransforms(_mergeBones);
|
||||
|
||||
_fault.Value = 0;
|
||||
_wroteAny.Value = 0;
|
||||
@ -293,7 +299,7 @@ namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
||||
|
||||
LastOp.Complete();
|
||||
_boneStaticData.Dispose();
|
||||
_mergeSavedState.Dispose();
|
||||
@ -301,8 +307,9 @@ namespace nadena.dev.modular_avatar.core.armature_lock
|
||||
_mergeState.Dispose();
|
||||
_fault.Dispose();
|
||||
_wroteAny.Dispose();
|
||||
_baseBonesAccessor.Dispose();
|
||||
_mergeBonesAccessor.Dispose();
|
||||
// work around crashes caused by destroying TransformAccessArray from within Undo processing
|
||||
DeferDestroy.DeferDestroyObj(_baseBonesAccessor);
|
||||
DeferDestroy.DeferDestroyObj(_mergeBonesAccessor);
|
||||
_disposed = true;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
Loading…
Reference in New Issue
Block a user