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