UI调整
This commit is contained in:
@@ -24,8 +24,8 @@ namespace MagicaCloth2
|
||||
internal HashSet<ClothProcess> meshClothSet = new HashSet<ClothProcess>();
|
||||
|
||||
//=========================================================================================
|
||||
Dictionary<int, bool> animatorVisibleDict = new Dictionary<int, bool>(30);
|
||||
Dictionary<int, bool> rendererVisibleDict = new Dictionary<int, bool>(100);
|
||||
Dictionary<MagicaObjectId, bool> animatorVisibleDict = new Dictionary<MagicaObjectId, bool>(30);
|
||||
Dictionary<MagicaObjectId, bool> rendererVisibleDict = new Dictionary<MagicaObjectId, bool>(100);
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
@@ -121,7 +121,7 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// チームマネージャの作業バッファへ登録
|
||||
MagicaManager.Team.comp2TeamIdMap.Add(cprocess.cloth.GetInstanceID(), teamId);
|
||||
MagicaManager.Team.comp2TeamIdMap.Add(cprocess.cloth.GetMagicaId(), teamId);
|
||||
|
||||
return teamId;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ namespace MagicaCloth2
|
||||
{
|
||||
if (ani)
|
||||
{
|
||||
int id = ani.GetInstanceID();
|
||||
MagicaObjectId id = ani.GetMagicaId();
|
||||
if (animatorVisibleDict.ContainsKey(id))
|
||||
return animatorVisibleDict[id];
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace MagicaCloth2
|
||||
if (ren)
|
||||
{
|
||||
bool visible;
|
||||
int id = ren.GetInstanceID();
|
||||
MagicaObjectId id = ren.GetMagicaId();
|
||||
if (rendererVisibleDict.ContainsKey(id))
|
||||
{
|
||||
visible = rendererVisibleDict[id];
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Cloth/ClothManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Cloth/PreBuildManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/IManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/MagicaManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/MagicaManagerAPI.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/MagicaSettings.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace MagicaCloth2
|
||||
setupData?.GetUsedTransform(transformSet);
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
setupData?.ReplaceTransform(replaceDict);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Render/RenderData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace MagicaCloth2
|
||||
/// <summary>
|
||||
/// 描画データをint型ハンドルで管理する
|
||||
/// </summary>
|
||||
Dictionary<int, RenderData> renderDataDict = new Dictionary<int, RenderData>();
|
||||
Dictionary<MagicaObjectId, RenderData> renderDataDict = new Dictionary<MagicaObjectId, RenderData>();
|
||||
|
||||
//=========================================================================================
|
||||
// ■RenderData
|
||||
@@ -159,7 +159,7 @@ namespace MagicaCloth2
|
||||
/// </summary>
|
||||
/// <param name="ren"></param>
|
||||
/// <returns></returns>
|
||||
public int AddRenderer(
|
||||
public MagicaObjectId AddRenderer(
|
||||
Renderer ren,
|
||||
RenderSetupData referenceSetupData,
|
||||
RenderSetupData.UniqueSerializationData referenceUniqueSetupData,
|
||||
@@ -167,11 +167,11 @@ namespace MagicaCloth2
|
||||
)
|
||||
{
|
||||
if (isValid == false)
|
||||
return 0;
|
||||
return MagicaObjectId.Invalid;
|
||||
Debug.Assert(ren);
|
||||
|
||||
// 制御ハンドル
|
||||
int handle = ren.GetInstanceID();
|
||||
MagicaObjectId handle = ren.GetMagicaId();
|
||||
|
||||
lock (renderDataDict)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ namespace MagicaCloth2
|
||||
return handle;
|
||||
}
|
||||
|
||||
public bool RemoveRenderer(int handle)
|
||||
public bool RemoveRenderer(MagicaObjectId handle)
|
||||
{
|
||||
if (isValid == false)
|
||||
return false;
|
||||
@@ -221,7 +221,7 @@ namespace MagicaCloth2
|
||||
return delete;
|
||||
}
|
||||
|
||||
public RenderData GetRendererData(int handle)
|
||||
public RenderData GetRendererData(MagicaObjectId handle)
|
||||
{
|
||||
if (isValid == false)
|
||||
return null;
|
||||
@@ -327,7 +327,7 @@ namespace MagicaCloth2
|
||||
/// 有効化
|
||||
/// </summary>
|
||||
/// <param name="handle"></param>
|
||||
public void StartUse(ClothProcess cprocess, int handle)
|
||||
public void StartUse(ClothProcess cprocess, MagicaObjectId handle)
|
||||
{
|
||||
GetRendererData(handle)?.StartUse(cprocess);
|
||||
}
|
||||
@@ -336,7 +336,7 @@ namespace MagicaCloth2
|
||||
/// 無効化
|
||||
/// </summary>
|
||||
/// <param name="handle"></param>
|
||||
public void EndUse(ClothProcess cprocess, int handle)
|
||||
public void EndUse(ClothProcess cprocess, MagicaObjectId handle)
|
||||
{
|
||||
GetRendererData(handle)?.EndUse(cprocess);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Render/RenderManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace MagicaCloth2
|
||||
public NativeArray<Vector4> localTangents;
|
||||
|
||||
// Bone ---------------------------------------------------------------
|
||||
public List<int> rootTransformIdList;
|
||||
public List<MagicaObjectId> rootTransformIdList;
|
||||
public enum BoneConnectionMode
|
||||
{
|
||||
// line only.
|
||||
@@ -85,9 +85,9 @@ namespace MagicaCloth2
|
||||
// Transform情報
|
||||
// 通常メッシュはrenderTransorm100%のスキニングとして扱われる
|
||||
public List<Transform> transformList; // skin bonesは[0]~skinBoneCountまで
|
||||
public List<int> transformIdList;
|
||||
public List<int> transformParentIdList; // 親ID(0=なし)
|
||||
public List<FixedList512Bytes<int>> transformChildIdList; // 子IDリスト
|
||||
public List<MagicaObjectId> transformIdList;
|
||||
public List<MagicaObjectId> transformParentIdList; // 親ID(0=なし)
|
||||
public List<FixedList512Bytes<MagicaObjectId>> transformChildIdList; // 子IDリスト
|
||||
public NativeArray<float3> transformPositions;
|
||||
public NativeArray<quaternion> transformRotations;
|
||||
public NativeArray<float3> transformLocalPositions;
|
||||
@@ -443,10 +443,10 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// root transform id
|
||||
rootTransformIdList = new List<int>(rootTransforms.Count);
|
||||
rootTransformIdList = new List<MagicaObjectId>(rootTransforms.Count);
|
||||
foreach (var t in rootTransforms)
|
||||
{
|
||||
rootTransformIdList.Add(t.GetInstanceID());
|
||||
rootTransformIdList.Add(t.GetMagicaId());
|
||||
}
|
||||
|
||||
// collision transform (use BoneSpring)
|
||||
@@ -583,18 +583,20 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// id / parent id
|
||||
transformIdList = new List<int>(tcnt);
|
||||
transformParentIdList = new List<int>(tcnt);
|
||||
transformIdList = new List<MagicaObjectId>(tcnt);
|
||||
transformParentIdList = new List<MagicaObjectId>(tcnt);
|
||||
for (int i = 0; i < tcnt; i++)
|
||||
{
|
||||
int id = 0, pid = 0;
|
||||
//int id = 0, pid = 0;
|
||||
MagicaObjectId id = MagicaObjectId.Invalid;
|
||||
MagicaObjectId pid = MagicaObjectId.Invalid;
|
||||
|
||||
var t = transformList[i];
|
||||
if (t)
|
||||
{
|
||||
id = t.GetInstanceID();
|
||||
id = t.GetMagicaId();
|
||||
if (includeChilds && t.parent)
|
||||
pid = t.parent.GetInstanceID();
|
||||
pid = t.parent.GetMagicaId();
|
||||
}
|
||||
transformIdList.Add(id);
|
||||
transformParentIdList.Add(pid);
|
||||
@@ -603,17 +605,17 @@ namespace MagicaCloth2
|
||||
// child id
|
||||
if (includeChilds)
|
||||
{
|
||||
transformChildIdList = new List<FixedList512Bytes<int>>(tcnt);
|
||||
transformChildIdList = new List<FixedList512Bytes<MagicaObjectId>>(tcnt);
|
||||
for (int i = 0; i < tcnt; i++)
|
||||
{
|
||||
var t = transformList[i];
|
||||
var clist = new FixedList512Bytes<int>();
|
||||
var clist = new FixedList512Bytes<MagicaObjectId>();
|
||||
if (t && t.childCount > 0)
|
||||
{
|
||||
for (int j = 0; j < t.childCount; j++)
|
||||
{
|
||||
var ct = t.GetChild(j);
|
||||
clist.Add(ct.GetInstanceID());
|
||||
clist.Add(ct.GetMagicaId());
|
||||
}
|
||||
}
|
||||
transformChildIdList.Add(clist);
|
||||
@@ -733,33 +735,33 @@ namespace MagicaCloth2
|
||||
}
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
if (rootTransformIdList != null)
|
||||
{
|
||||
for (int i = 0; i < rootTransformIdList.Count; i++)
|
||||
{
|
||||
int id = rootTransformIdList[i];
|
||||
MagicaObjectId id = rootTransformIdList[i];
|
||||
if (replaceDict.ContainsKey(id))
|
||||
{
|
||||
rootTransformIdList[i] = replaceDict[id].GetInstanceID();
|
||||
rootTransformIdList[i] = replaceDict[id].GetMagicaId();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < TransformCount; i++)
|
||||
{
|
||||
int id = transformIdList[i];
|
||||
MagicaObjectId id = transformIdList[i];
|
||||
if (replaceDict.ContainsKey(id))
|
||||
{
|
||||
var t = replaceDict[id];
|
||||
transformIdList[i] = t.GetInstanceID();
|
||||
transformIdList[i] = t.GetMagicaId();
|
||||
transformList[i] = t;
|
||||
}
|
||||
int pid = transformParentIdList[i];
|
||||
MagicaObjectId pid = transformParentIdList[i];
|
||||
if (replaceDict.ContainsKey(pid))
|
||||
{
|
||||
var t = replaceDict[pid];
|
||||
transformParentIdList[i] = t.GetInstanceID();
|
||||
transformParentIdList[i] = t.GetMagicaId();
|
||||
}
|
||||
|
||||
if (transformChildIdList != null)
|
||||
@@ -767,11 +769,11 @@ namespace MagicaCloth2
|
||||
var cidlist = transformChildIdList[i];
|
||||
for (int j = 0; j < cidlist.Length; j++)
|
||||
{
|
||||
int cid = cidlist[j];
|
||||
MagicaObjectId cid = cidlist[j];
|
||||
if (replaceDict.ContainsKey(cid))
|
||||
{
|
||||
var t = replaceDict[cid];
|
||||
cidlist[j] = t.GetInstanceID();
|
||||
cidlist[j] = t.GetMagicaId();
|
||||
}
|
||||
}
|
||||
transformChildIdList[i] = cidlist;
|
||||
@@ -789,7 +791,7 @@ namespace MagicaCloth2
|
||||
return transformList[renderTransformIndex];
|
||||
}
|
||||
|
||||
public int GetRenderTransformId()
|
||||
public MagicaObjectId GetRenderTransformId()
|
||||
{
|
||||
return transformIdList[renderTransformIndex];
|
||||
}
|
||||
@@ -812,12 +814,12 @@ namespace MagicaCloth2
|
||||
return transformList[skinRootBoneIndex];
|
||||
}
|
||||
|
||||
public int GetSkinRootTransformId()
|
||||
public MagicaObjectId GetSkinRootTransformId()
|
||||
{
|
||||
return transformIdList[skinRootBoneIndex];
|
||||
}
|
||||
|
||||
public int GetTransformIndexFromId(int id)
|
||||
public int GetTransformIndexFromId(MagicaObjectId id)
|
||||
{
|
||||
return transformIdList.IndexOf(id);
|
||||
}
|
||||
@@ -830,7 +832,7 @@ namespace MagicaCloth2
|
||||
/// <returns>なし(-1)</returns>
|
||||
public int GetParentTransformIndex(int index, bool centerExcluded)
|
||||
{
|
||||
int pid = transformParentIdList[index];
|
||||
MagicaObjectId pid = transformParentIdList[index];
|
||||
int i = transformIdList.IndexOf(pid);
|
||||
if (centerExcluded && i == renderTransformIndex)
|
||||
i = -1;
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Render/RenderSetupData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace MagicaCloth2
|
||||
});
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
if (transformList != null)
|
||||
{
|
||||
@@ -164,8 +164,8 @@ namespace MagicaCloth2
|
||||
var t = transformList[i];
|
||||
if (t)
|
||||
{
|
||||
int id = t.GetInstanceID();
|
||||
if (id != 0 && replaceDict.ContainsKey(id))
|
||||
MagicaObjectId id = t.GetMagicaId();
|
||||
if (id.IsValid() && replaceDict.ContainsKey(id))
|
||||
{
|
||||
transformList[i] = replaceDict[id];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Render/RenderSetupDataSerialization.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -338,16 +338,16 @@ namespace MagicaCloth2
|
||||
}
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
if (transformArray == null)
|
||||
return;
|
||||
for (int i = 0; i < transformArray.Length; i++)
|
||||
{
|
||||
var t = transformArray[i];
|
||||
if (t && replaceDict.ContainsKey(t.GetInstanceID()))
|
||||
if (t && replaceDict.ContainsKey(t.GetMagicaId()))
|
||||
{
|
||||
transformArray[i] = replaceDict[t.GetInstanceID()];
|
||||
transformArray[i] = replaceDict[t.GetMagicaId()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Render/RenderSetupSerializeData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/ColliderManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -654,6 +654,11 @@ namespace MagicaCloth2
|
||||
// buffer
|
||||
stepBasicPositionBuffer = stepBasicPositionBuffer,
|
||||
stepBasicRotationBuffer = stepBasicRotationBuffer,
|
||||
// temp
|
||||
tempVectorBufferA = tempVectorBufferA,
|
||||
tempVectorBufferB = tempVectorBufferB,
|
||||
tempCountBuffer = tempCountBuffer,
|
||||
tempFloatBufferA = tempFloatBufferA,
|
||||
};
|
||||
splitClothJobHandle = splitStep_B_job.Schedule(splitClothTeamCount * workerCount, 1, splitClothJobHandle);
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/SimulationManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -459,7 +459,12 @@ namespace MagicaCloth2
|
||||
ref frictionArray,
|
||||
// buffer
|
||||
ref stepBasicPositionBuffer,
|
||||
ref stepBasicRotationBuffer
|
||||
ref stepBasicRotationBuffer,
|
||||
// temp
|
||||
ref tempVectorBufferA,
|
||||
ref tempVectorBufferB,
|
||||
ref tempCountBuffer,
|
||||
ref tempFloatBufferA
|
||||
);
|
||||
|
||||
// 制約解決のためのステップごとの基準姿勢を計算
|
||||
@@ -1070,7 +1075,12 @@ namespace MagicaCloth2
|
||||
ref NativeArray<float> frictionArray,
|
||||
// buffer
|
||||
ref NativeArray<float3> stepBasicPositionBuffer,
|
||||
ref NativeArray<quaternion> stepBasicRotationBuffer
|
||||
ref NativeArray<quaternion> stepBasicRotationBuffer,
|
||||
// temp buffer
|
||||
ref NativeArray<float3> tempVectorBufferA,
|
||||
ref NativeArray<float3> tempVectorBufferB,
|
||||
ref NativeArray<int> tempCountBuffer,
|
||||
ref NativeArray<float> tempFloatBufferA
|
||||
)
|
||||
{
|
||||
// 速度更新、外力の影響、慣性シフト
|
||||
@@ -1225,6 +1235,12 @@ namespace MagicaCloth2
|
||||
|
||||
// 予測位置格納
|
||||
nextPosArray[pindex] = nextPos;
|
||||
|
||||
// 作業バッファクリア
|
||||
tempVectorBufferA[pindex] = 0;
|
||||
tempVectorBufferB[pindex] = 0;
|
||||
tempCountBuffer[pindex] = 0;
|
||||
tempFloatBufferA[pindex] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/SimulationManagerNormal.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -607,6 +607,20 @@ namespace MagicaCloth2
|
||||
[NativeDisableContainerSafetyRestriction]
|
||||
public NativeArray<quaternion> stepBasicRotationBuffer;
|
||||
|
||||
// temp
|
||||
[NativeDisableParallelForRestriction]
|
||||
[NativeDisableContainerSafetyRestriction]
|
||||
public NativeArray<float3> tempVectorBufferA;
|
||||
[NativeDisableParallelForRestriction]
|
||||
[NativeDisableContainerSafetyRestriction]
|
||||
public NativeArray<float3> tempVectorBufferB;
|
||||
[NativeDisableParallelForRestriction]
|
||||
[NativeDisableContainerSafetyRestriction]
|
||||
public NativeArray<int> tempCountBuffer;
|
||||
[NativeDisableParallelForRestriction]
|
||||
[NativeDisableContainerSafetyRestriction]
|
||||
public NativeArray<float> tempFloatBufferA;
|
||||
|
||||
// バッチ内のローカルチームインデックスごと
|
||||
public void Execute(int index)
|
||||
{
|
||||
@@ -670,7 +684,12 @@ namespace MagicaCloth2
|
||||
ref frictionArray,
|
||||
// buffer
|
||||
ref stepBasicPositionBuffer,
|
||||
ref stepBasicRotationBuffer
|
||||
ref stepBasicRotationBuffer,
|
||||
// temp
|
||||
ref tempVectorBufferA,
|
||||
ref tempVectorBufferB,
|
||||
ref tempCountBuffer,
|
||||
ref tempFloatBufferA
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/SimulationManagerSplit.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/TimeManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Simulation/WindManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -206,7 +206,8 @@ namespace MagicaCloth2
|
||||
/// <summary>
|
||||
/// MagicaClothコンポーネントのインスタンスID
|
||||
/// </summary>
|
||||
public int componentId;
|
||||
//public int componentId;
|
||||
public MagicaObjectId componentId;
|
||||
|
||||
/// <summary>
|
||||
/// 同期チームID(0=なし)
|
||||
@@ -226,7 +227,8 @@ namespace MagicaCloth2
|
||||
/// <summary>
|
||||
/// 連動するAnimatorのインスタンスID(0=なし)
|
||||
/// </summary>
|
||||
public int interlockingAnimatorId;
|
||||
//public int interlockingAnimatorId;
|
||||
public MagicaObjectId interlockingAnimatorId;
|
||||
|
||||
/// <summary>
|
||||
/// 初期姿勢とアニメーション姿勢のブレンド率(制約で利用)
|
||||
@@ -647,10 +649,10 @@ namespace MagicaCloth2
|
||||
internal int edgeColliderCollisionCount;
|
||||
|
||||
internal NativeReference<int> edgeColliderCollisionCountBuff;
|
||||
internal NativeParallelHashMap<int, int> comp2SuspendCounterMap;
|
||||
internal NativeParallelHashMap<int, int> comp2TeamIdMap;
|
||||
internal NativeParallelHashMap<int, int> comp2SyncPartnerCompMap;
|
||||
internal NativeParallelHashMap<int, int> comp2SyncTopCompMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, int> comp2SuspendCounterMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, int> comp2TeamIdMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, MagicaObjectId> comp2SyncPartnerCompMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, MagicaObjectId> comp2SyncTopCompMap;
|
||||
|
||||
internal NativeList<int> batchNormalClothTeamList;
|
||||
internal NativeList<int> batchSplitClothTeamList;
|
||||
@@ -659,12 +661,12 @@ namespace MagicaCloth2
|
||||
internal List<ClothProcess> skipWritingDirtyList;
|
||||
internal NativeList<int> cullingDirtyList;
|
||||
internal NativeParallelHashSet<int> selfCollisionUpdateSet;
|
||||
internal NativeParallelHashMap<int, int> animatorUpdateModeMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, int> animatorUpdateModeMap;
|
||||
|
||||
internal ExSimpleNativeArray<int> teamAnchorTransformIndexArray;
|
||||
internal ExSimpleNativeArray<int> teamDistanceTransformIndexArray;
|
||||
internal NativeParallelHashMap<int, float3> transformPositionMap;
|
||||
internal NativeParallelHashMap<int, quaternion> transformRotationMap;
|
||||
internal ExSimpleNativeArray<MagicaObjectId> teamAnchorTransformIndexArray;
|
||||
internal ExSimpleNativeArray<MagicaObjectId> teamDistanceTransformIndexArray;
|
||||
internal NativeParallelHashMap<MagicaObjectId, float3> transformPositionMap;
|
||||
internal NativeParallelHashMap<MagicaObjectId, quaternion> transformRotationMap;
|
||||
|
||||
internal HashSet<MagicaCloth> cameraCullingClothSet = new HashSet<MagicaCloth>(256);
|
||||
|
||||
@@ -762,10 +764,10 @@ namespace MagicaCloth2
|
||||
|
||||
// 作業用
|
||||
edgeColliderCollisionCountBuff = new NativeReference<int>(Allocator.Persistent);
|
||||
comp2SuspendCounterMap = new NativeParallelHashMap<int, int>(256, Allocator.Persistent);
|
||||
comp2TeamIdMap = new NativeParallelHashMap<int, int>(256, Allocator.Persistent);
|
||||
comp2SyncPartnerCompMap = new NativeParallelHashMap<int, int>(256, Allocator.Persistent);
|
||||
comp2SyncTopCompMap = new NativeParallelHashMap<int, int>(256, Allocator.Persistent);
|
||||
comp2SuspendCounterMap = new NativeParallelHashMap<MagicaObjectId, int>(256, Allocator.Persistent);
|
||||
comp2TeamIdMap = new NativeParallelHashMap<MagicaObjectId, int>(256, Allocator.Persistent);
|
||||
comp2SyncPartnerCompMap = new NativeParallelHashMap<MagicaObjectId, MagicaObjectId>(256, Allocator.Persistent);
|
||||
comp2SyncTopCompMap = new NativeParallelHashMap<MagicaObjectId, MagicaObjectId>(256, Allocator.Persistent);
|
||||
|
||||
batchNormalClothTeamList = new NativeList<int>(Allocator.Persistent);
|
||||
batchSplitClothTeamList = new NativeList<int>(Allocator.Persistent);
|
||||
@@ -774,12 +776,12 @@ namespace MagicaCloth2
|
||||
skipWritingDirtyList = new List<ClothProcess>(128);
|
||||
cullingDirtyList = new NativeList<int>(128, Allocator.Persistent);
|
||||
selfCollisionUpdateSet = new NativeParallelHashSet<int>(256, Allocator.Persistent);
|
||||
animatorUpdateModeMap = new NativeParallelHashMap<int, int>(128, Allocator.Persistent);
|
||||
animatorUpdateModeMap = new NativeParallelHashMap<MagicaObjectId, int>(128, Allocator.Persistent);
|
||||
|
||||
teamAnchorTransformIndexArray = new ExSimpleNativeArray<int>(256, true);
|
||||
teamDistanceTransformIndexArray = new ExSimpleNativeArray<int>(256, true);
|
||||
transformPositionMap = new NativeParallelHashMap<int, float3>(32, Allocator.Persistent);
|
||||
transformRotationMap = new NativeParallelHashMap<int, quaternion>(32, Allocator.Persistent);
|
||||
teamAnchorTransformIndexArray = new ExSimpleNativeArray<MagicaObjectId>(256, true);
|
||||
teamDistanceTransformIndexArray = new ExSimpleNativeArray<MagicaObjectId>(256, true);
|
||||
transformPositionMap = new NativeParallelHashMap<MagicaObjectId, float3>(32, Allocator.Persistent);
|
||||
transformRotationMap = new NativeParallelHashMap<MagicaObjectId, quaternion>(32, Allocator.Persistent);
|
||||
|
||||
// 破棄監視更新処理
|
||||
MagicaManager.afterUpdateDelegate += MonitoringProcessUpdate;
|
||||
@@ -807,7 +809,7 @@ namespace MagicaCloth2
|
||||
// この段階でProxyMeshは完成している
|
||||
|
||||
var team = new TeamData();
|
||||
team.componentId = cprocess.cloth.GetInstanceID();
|
||||
team.componentId = cprocess.cloth.GetMagicaId();
|
||||
// ★Enableフラグは立てない
|
||||
team.flag.SetBits(Flag_Valid, true);
|
||||
team.flag.SetBits(Flag_Reset, true);
|
||||
@@ -889,8 +891,8 @@ namespace MagicaCloth2
|
||||
centerDataArray.Remove(c);
|
||||
|
||||
// チーム作業バッファをクリア
|
||||
teamAnchorTransformIndexArray[teamId] = 0;
|
||||
teamDistanceTransformIndexArray[teamId] = 0;
|
||||
teamAnchorTransformIndexArray[teamId] = MagicaObjectId.Invalid;
|
||||
teamDistanceTransformIndexArray[teamId] = MagicaObjectId.Invalid;
|
||||
|
||||
clothProcessDict.Remove(teamId);
|
||||
}
|
||||
@@ -900,22 +902,39 @@ namespace MagicaCloth2
|
||||
/// </summary>
|
||||
/// <param name="teamId"></param>
|
||||
/// <param name="sw"></param>
|
||||
public void SetEnable(int teamId, bool sw)
|
||||
public void SetEnable(ClothProcess cprocess, int teamId, bool sw)
|
||||
{
|
||||
//Debug.Log($"Set Enable:{sw} F:{Time.frameCount}");
|
||||
if (isValid == false || teamId == 0)
|
||||
return;
|
||||
ref var team = ref teamDataArray.GetRef(teamId);
|
||||
|
||||
// シミュレーションリセットの有無
|
||||
// (同期先を参照)
|
||||
ClothProcess syncProcess = cprocess.SyncTopCloth ? cprocess.SyncTopCloth.Process : cprocess;
|
||||
bool isReset = syncProcess.cloth.SerializeData.disableMode == ClothDisableMode.Reset;
|
||||
|
||||
team.flag.SetBits(Flag_Enable, sw);
|
||||
team.flag.SetBits(Flag_Reset, sw);
|
||||
if (isReset)
|
||||
team.flag.SetBits(Flag_Reset, sw);
|
||||
|
||||
//Debug.Log($"Set Enable:{sw}, isReset:{isReset} F:{Time.frameCount}");
|
||||
|
||||
if (sw)
|
||||
enableTeamSet.Add(teamId);
|
||||
else
|
||||
enableTeamSet.Remove(teamId);
|
||||
|
||||
// 無効時には一度のみTransform復元フラグを立てる
|
||||
if (sw == false)
|
||||
// 非表示(リセット)の挙動
|
||||
if (sw == false && isReset)
|
||||
{
|
||||
// 無効時には一度のみTransform復元フラグを立てる
|
||||
team.flag.SetBits(Flag_RestoreTransformOnlyOnec, true);
|
||||
// Disable時は非表示設定にする
|
||||
team.flag.SetBits(Flag_CameraCullingInvisible, true);
|
||||
cprocess.SetState(ClothProcess.State_CameraCullingInvisible, true);
|
||||
cprocess.cameraCullingOldInvisible = true;
|
||||
}
|
||||
|
||||
// コライダーの有効状態(内部でコライダートランスフォームの有効状態も設定)
|
||||
MagicaManager.Collider.EnableTeamCollider(teamId);
|
||||
@@ -1096,12 +1115,12 @@ namespace MagicaCloth2
|
||||
// 状態変更
|
||||
if (oldInvisible != invisible)
|
||||
{
|
||||
//Debug.Log($"Camera culling change. oldInvisible:{oldInvisible} -> invisible:{invisible} F:{Time.frameCount}");
|
||||
int teamId = cprocess.TeamId;
|
||||
ref var tdata = ref GetTeamDataRef(teamId);
|
||||
|
||||
tdata.flag.SetBits(Flag_CameraCullingInvisible, invisible);
|
||||
tdata.flag.SetBits(Flag_CameraCullingKeep, false);
|
||||
//Debug.Log($"Change camera culling invisible:({oldInvisible}) -> ({invisible})");
|
||||
|
||||
// cprocessクラスにもコピーする
|
||||
cprocess.SetState(ClothProcess.State_CameraCullingInvisible, invisible);
|
||||
@@ -1193,7 +1212,7 @@ namespace MagicaCloth2
|
||||
var cloth = cprocess.cloth;
|
||||
|
||||
// 連動アニメーターのインスタンスID
|
||||
tdata.interlockingAnimatorId = cprocess.interlockingAnimator != null ? cprocess.interlockingAnimator.GetInstanceID() : 0;
|
||||
tdata.interlockingAnimatorId = cprocess.interlockingAnimator != null ? cprocess.interlockingAnimator.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
|
||||
// パラメータ変更
|
||||
cprocess.SyncParameters();
|
||||
@@ -1281,7 +1300,7 @@ namespace MagicaCloth2
|
||||
// 連動アニメーターの更新モード取得
|
||||
if (cprocess.interlockingAnimator)
|
||||
{
|
||||
int animatorId = cprocess.interlockingAnimator.GetInstanceID();
|
||||
MagicaObjectId animatorId = cprocess.interlockingAnimator.GetMagicaId();
|
||||
if (animatorUpdateModeMap.ContainsKey(animatorId) == false)
|
||||
{
|
||||
animatorUpdateModeMap.Add(animatorId, (int)cprocess.interlockingAnimator.updateMode);
|
||||
@@ -1295,8 +1314,8 @@ namespace MagicaCloth2
|
||||
#if true
|
||||
// アンカー参照オブジェクト
|
||||
var anchorTransform = sdata.inertiaConstraint.anchor;
|
||||
int anchorTransformId = anchorTransform != null ? anchorTransform.GetInstanceID() : 0;
|
||||
if (anchorTransformId != 0 && transformPositionMap.ContainsKey(anchorTransformId) == false)
|
||||
MagicaObjectId anchorTransformId = anchorTransform != null ? anchorTransform.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
if (anchorTransformId.IsValid() && transformPositionMap.ContainsKey(anchorTransformId) == false)
|
||||
{
|
||||
// 参照オブジェクトの座標取得
|
||||
transformPositionMap.Add(anchorTransformId, anchorTransform.position);
|
||||
@@ -1310,8 +1329,8 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// 距離カリング参照オブジェクト
|
||||
int distanceObjectId = sdata.cullingSettings.distanceCullingReferenceObject != null ? sdata.cullingSettings.distanceCullingReferenceObject.GetInstanceID() : 0;
|
||||
if (distanceObjectId != 0 && transformPositionMap.ContainsKey(distanceObjectId) == false)
|
||||
MagicaObjectId distanceObjectId = sdata.cullingSettings.distanceCullingReferenceObject != null ? sdata.cullingSettings.distanceCullingReferenceObject.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
if (distanceObjectId.IsValid() && transformPositionMap.ContainsKey(distanceObjectId) == false)
|
||||
{
|
||||
// 参照オブジェクトの座標取得
|
||||
transformPositionMap.Add(distanceObjectId, sdata.cullingSettings.distanceCullingReferenceObject.transform.position);
|
||||
@@ -1328,7 +1347,8 @@ namespace MagicaCloth2
|
||||
// メインカメラ座標
|
||||
bool hasMainCamera = Camera.main != null;
|
||||
float3 mainCameraPosition = Camera.main ? Camera.main.transform.position : 0;
|
||||
transformPositionMap.Add(0, mainCameraPosition);
|
||||
//transformPositionMap.Add(0, mainCameraPosition);
|
||||
transformPositionMap.Add(MagicaObjectId.Invalid, mainCameraPosition);
|
||||
startClothUpdateComponentProfiler.End();
|
||||
|
||||
// チーム前処理ジョブ待ち
|
||||
@@ -1426,10 +1446,10 @@ namespace MagicaCloth2
|
||||
public NativeArray<ClothParameters> parameterArray;
|
||||
|
||||
// work
|
||||
public NativeParallelHashMap<int, int> comp2SuspendCounterMap;
|
||||
public NativeParallelHashMap<int, int> comp2TeamIdMap;
|
||||
public NativeParallelHashMap<int, int> comp2SyncPartnerCompMap;
|
||||
public NativeParallelHashMap<int, int> comp2SyncTopCompMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, int> comp2SuspendCounterMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, int> comp2TeamIdMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, MagicaObjectId> comp2SyncPartnerCompMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, MagicaObjectId> comp2SyncTopCompMap;
|
||||
public NativeParallelHashSet<int> selfCollisionUpdateSet;
|
||||
public NativeReference<int> edgeColliderCollisionCountBuff;
|
||||
|
||||
@@ -1444,7 +1464,7 @@ namespace MagicaCloth2
|
||||
if (teamId == 0)
|
||||
continue;
|
||||
|
||||
int compId = kv.Key;
|
||||
MagicaObjectId compId = kv.Key;
|
||||
ref var tdata = ref *(tt + teamId);
|
||||
|
||||
// 作業フラグをクリア -------------------------------------
|
||||
@@ -1462,7 +1482,7 @@ namespace MagicaCloth2
|
||||
// 同期相手の有効状態
|
||||
if (comp2SyncPartnerCompMap.ContainsKey(compId))
|
||||
{
|
||||
int syncCompId = comp2SyncPartnerCompMap[compId];
|
||||
MagicaObjectId syncCompId = comp2SyncPartnerCompMap[compId];
|
||||
if (comp2TeamIdMap.ContainsKey(syncCompId))
|
||||
{
|
||||
int syncTeamId = comp2TeamIdMap[syncCompId];
|
||||
@@ -1486,7 +1506,7 @@ namespace MagicaCloth2
|
||||
tdata.syncTeamId = 0;
|
||||
if (comp2SyncPartnerCompMap.ContainsKey(compId))
|
||||
{
|
||||
int syncCompId = comp2SyncPartnerCompMap[compId];
|
||||
MagicaObjectId syncCompId = comp2SyncPartnerCompMap[compId];
|
||||
if (comp2TeamIdMap.ContainsKey(syncCompId))
|
||||
{
|
||||
int syncTeamId = comp2TeamIdMap[syncCompId];
|
||||
@@ -1543,7 +1563,7 @@ namespace MagicaCloth2
|
||||
int syncTopTeamId = 0;
|
||||
if (comp2SyncTopCompMap.ContainsKey(compId))
|
||||
{
|
||||
int syncTopCompId = comp2SyncTopCompMap[compId];
|
||||
MagicaObjectId syncTopCompId = comp2SyncTopCompMap[compId];
|
||||
if (comp2TeamIdMap.ContainsKey(syncTopCompId))
|
||||
{
|
||||
syncTopTeamId = comp2TeamIdMap[syncTopCompId];
|
||||
@@ -1618,13 +1638,13 @@ namespace MagicaCloth2
|
||||
public bool hasMainCamera;
|
||||
|
||||
// work
|
||||
public NativeParallelHashMap<int, int> comp2TeamIdMap;
|
||||
public NativeParallelHashMap<int, int> comp2SyncTopCompMap;
|
||||
public NativeParallelHashMap<int, int> animatorUpdateModeMap;
|
||||
public NativeArray<int> teamAnchorTransformIndexArray;
|
||||
public NativeArray<int> teamDistanceTransformIndexArray;
|
||||
public NativeParallelHashMap<int, float3> transformPositionMap;
|
||||
public NativeParallelHashMap<int, quaternion> transformRotationMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, int> comp2TeamIdMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, MagicaObjectId> comp2SyncTopCompMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, int> animatorUpdateModeMap;
|
||||
public NativeArray<MagicaObjectId> teamAnchorTransformIndexArray;
|
||||
public NativeArray<MagicaObjectId> teamDistanceTransformIndexArray;
|
||||
public NativeParallelHashMap<MagicaObjectId, float3> transformPositionMap;
|
||||
public NativeParallelHashMap<MagicaObjectId, quaternion> transformRotationMap;
|
||||
public NativeList<int> cullingDirtyList;
|
||||
|
||||
public NativeList<int> batchNormalClothTeamList;
|
||||
@@ -1640,7 +1660,7 @@ namespace MagicaCloth2
|
||||
for (int teamId = 1; teamId < teamCount; teamId++)
|
||||
{
|
||||
var tdata = teamDataArray[teamId];
|
||||
int compId = tdata.componentId;
|
||||
MagicaObjectId compId = tdata.componentId;
|
||||
if (tdata.IsEnable == false)
|
||||
continue;
|
||||
if (tdata.flag.IsSet(Flag_SyncSuspend))
|
||||
@@ -1658,14 +1678,14 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// アンカー
|
||||
int anchorTransformIndex = teamAnchorTransformIndexArray[teamId];
|
||||
MagicaObjectId anchorTransformIndex = teamAnchorTransformIndexArray[teamId];
|
||||
bool oldAnchor = tdata.flag.IsSet(Flag_Anchor);
|
||||
bool newAnchor = anchorTransformIndex != 0;
|
||||
bool newAnchor = anchorTransformIndex.IsValid();
|
||||
tdata.flag.SetBits(Flag_Anchor, newAnchor);
|
||||
tdata.flag.SetBits(Flag_AnchorReset, oldAnchor != newAnchor);
|
||||
var cdata = centerDataArray[teamId];
|
||||
cdata.anchorPosition = anchorTransformIndex != 0 ? transformPositionMap[anchorTransformIndex] : float3.zero;
|
||||
cdata.anchorRotation = anchorTransformIndex != 0 ? transformRotationMap[anchorTransformIndex] : quaternion.identity;
|
||||
cdata.anchorPosition = anchorTransformIndex.IsValid() ? transformPositionMap[anchorTransformIndex] : float3.zero;
|
||||
cdata.anchorRotation = anchorTransformIndex.IsValid() ? transformRotationMap[anchorTransformIndex] : quaternion.identity;
|
||||
centerDataArray[teamId] = cdata;
|
||||
|
||||
// 距離カリング判定
|
||||
@@ -1681,7 +1701,7 @@ namespace MagicaCloth2
|
||||
int syncTopTeamId = 0;
|
||||
if (comp2SyncTopCompMap.ContainsKey(compId))
|
||||
{
|
||||
int syncTopCompId = comp2SyncTopCompMap[compId];
|
||||
MagicaObjectId syncTopCompId = comp2SyncTopCompMap[compId];
|
||||
if (comp2TeamIdMap.ContainsKey(syncTopCompId))
|
||||
{
|
||||
syncTopTeamId = comp2TeamIdMap[syncTopCompId];
|
||||
@@ -1690,7 +1710,7 @@ namespace MagicaCloth2
|
||||
if (tdata.originalUpdateMode == ClothUpdateMode.AnimatorLinkage || syncTopTeamId > 0)
|
||||
{
|
||||
var originalUpdateMode = tdata.originalUpdateMode;
|
||||
int animatorId = tdata.interlockingAnimatorId;
|
||||
MagicaObjectId animatorId = tdata.interlockingAnimatorId;
|
||||
if (syncTopTeamId > 0)
|
||||
{
|
||||
var syncTeamData = teamDataArray[syncTopTeamId];
|
||||
@@ -1876,7 +1896,7 @@ namespace MagicaCloth2
|
||||
{
|
||||
// 距離カリング有効
|
||||
// 距離判定
|
||||
int transformId = teamDistanceTransformIndexArray[teamId];
|
||||
MagicaObjectId transformId = teamDistanceTransformIndexArray[teamId];
|
||||
if (transformPositionMap.ContainsKey(transformId))
|
||||
{
|
||||
// 現在コンポーネント位置(pos)は同期を取っていない
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Team/TeamManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/Team/TeamWindData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -70,17 +70,17 @@ namespace MagicaCloth2
|
||||
/// <summary>
|
||||
/// トランスフォームのインスタンスID
|
||||
/// </summary>
|
||||
internal ExSimpleNativeArray<int> idArray;
|
||||
internal ExSimpleNativeArray<MagicaObjectId> idArray;
|
||||
|
||||
/// <summary>
|
||||
/// 親トランスフォームのインスタンスID(0=なし)
|
||||
/// </summary>
|
||||
internal ExSimpleNativeArray<int> parentIdArray;
|
||||
internal ExSimpleNativeArray<MagicaObjectId> parentIdArray;
|
||||
|
||||
/// <summary>
|
||||
/// BoneClothのルートトランスフォームIDリスト
|
||||
/// </summary>
|
||||
internal List<int> rootIdList;
|
||||
internal List<MagicaObjectId> rootIdList;
|
||||
|
||||
/// <summary>
|
||||
/// Transformリストに変更があったかどうか
|
||||
@@ -114,8 +114,8 @@ namespace MagicaCloth2
|
||||
{
|
||||
// 領域のみ確保する
|
||||
transformList = new List<Transform>(capacity);
|
||||
idArray = new ExSimpleNativeArray<int>(capacity, true);
|
||||
parentIdArray = new ExSimpleNativeArray<int>(capacity, true);
|
||||
idArray = new ExSimpleNativeArray<MagicaObjectId>(capacity, true);
|
||||
parentIdArray = new ExSimpleNativeArray<MagicaObjectId>(capacity, true);
|
||||
flagArray = new ExSimpleNativeArray<ExBitFlag8>(capacity, true);
|
||||
initLocalPositionArray = new ExSimpleNativeArray<float3>(capacity, true);
|
||||
initLocalRotationArray = new ExSimpleNativeArray<quaternion>(capacity, true);
|
||||
@@ -163,10 +163,12 @@ namespace MagicaCloth2
|
||||
/// すでに登録済みの同じトランスフォームがある場合はそのインデックスを返す
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <param name="tid">0の場合はTransformからGetInstanceId()を即時設定する</param>
|
||||
/// <param name="tid">Invalidの場合はTransformからGetInstanceId()を即時設定する</param>
|
||||
/// <param name="pid">不要ならInvalid</param>
|
||||
/// <param name="flag"></param>
|
||||
/// <returns></returns>
|
||||
public int AddTransform(Transform t, int tid = 0, int pid = 0, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
//public int AddTransform(Transform t, int tid = 0, int pid = 0, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
public int AddTransform(Transform t, MagicaObjectId tid, MagicaObjectId pid, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
{
|
||||
int index;
|
||||
|
||||
@@ -183,11 +185,11 @@ namespace MagicaCloth2
|
||||
{
|
||||
index = emptyStack.Dequeue();
|
||||
transformList[index] = t;
|
||||
if (tid == 0)
|
||||
if (tid.IsValid() == false)
|
||||
{
|
||||
// Transformからデータを取得(メインスレッドのみ)
|
||||
idArray[index] = t.GetInstanceID();
|
||||
parentIdArray[index] = t.parent ? t.parent.GetInstanceID() : 0;
|
||||
idArray[index] = t.GetMagicaId();
|
||||
parentIdArray[index] = t.parent ? t.parent.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
initLocalPositionArray[index] = t.localPosition;
|
||||
initLocalRotationArray[index] = t.localRotation;
|
||||
positionArray[index] = t.position;
|
||||
@@ -218,11 +220,11 @@ namespace MagicaCloth2
|
||||
{
|
||||
index = Count;
|
||||
transformList.Add(t);
|
||||
if (tid == 0)
|
||||
if (tid.IsValid() == false)
|
||||
{
|
||||
// Transformからデータを取得(メインスレッドのみ)
|
||||
idArray.Add(t.GetInstanceID());
|
||||
parentIdArray.Add(t.parent ? t.parent.GetInstanceID() : 0);
|
||||
idArray.Add(t.GetMagicaId());
|
||||
parentIdArray.Add(t.parent ? t.parent.GetMagicaId() : MagicaObjectId.Invalid);
|
||||
initLocalPositionArray.Add(t.localPosition);
|
||||
initLocalRotationArray.Add(t.localRotation);
|
||||
positionArray.Add(t.position);
|
||||
@@ -260,11 +262,12 @@ namespace MagicaCloth2
|
||||
/// すでに登録済みの同じトランスフォームがある場合はそのインデックスを返す
|
||||
/// </summary>
|
||||
/// <param name="record">トランスフォーム記録クラス</param>
|
||||
/// <param name="pid">親のインスタンスID</param>
|
||||
/// <param name="pid">親のインスタンスID。なければInvalid</param>
|
||||
/// <param name="flag"></param>
|
||||
/// <param name="checkDuplicate">重複チェックの有無</param>
|
||||
/// <returns></returns>
|
||||
public int AddTransform(TransformRecord record, int pid = 0, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
//public int AddTransform(TransformRecord record, int pid = 0, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
public int AddTransform(TransformRecord record, MagicaObjectId pid, byte flag = TransformManager.Flag_Read, bool checkDuplicate = true)
|
||||
{
|
||||
int index;
|
||||
|
||||
@@ -335,8 +338,8 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
// 新規追加
|
||||
int id = srcData.idArray[srcIndex];
|
||||
int pid = srcData.parentIdArray[srcIndex];
|
||||
MagicaObjectId id = srcData.idArray[srcIndex];
|
||||
MagicaObjectId pid = srcData.parentIdArray[srcIndex];
|
||||
var initPos = srcData.initLocalPositionArray[srcIndex];
|
||||
var initRot = srcData.initLocalRotationArray[srcIndex];
|
||||
var pos = srcData.positionArray[srcIndex];
|
||||
@@ -389,7 +392,7 @@ namespace MagicaCloth2
|
||||
/// </summary>
|
||||
/// <param name="tlist"></param>
|
||||
/// <returns></returns>
|
||||
public int[] AddTransformRange(List<Transform> tlist, List<int> idList, List<int> pidList, int copyCount = 0)
|
||||
public int[] AddTransformRange(List<Transform> tlist, List<MagicaObjectId> idList, List<MagicaObjectId> pidList, int copyCount = 0)
|
||||
{
|
||||
//int tcnt = tlist.Count;
|
||||
int tcnt = copyCount > 0 ? copyCount : tlist.Count;
|
||||
@@ -434,8 +437,8 @@ namespace MagicaCloth2
|
||||
Debug.Assert(stdata != null);
|
||||
return AddTransformRange(
|
||||
stdata.transformList,
|
||||
new List<int>(stdata.idArray.ToArray()),
|
||||
new List<int>(stdata.parentIdArray.ToArray()),
|
||||
new List<MagicaObjectId>(stdata.idArray.ToArray()),
|
||||
new List<MagicaObjectId>(stdata.parentIdArray.ToArray()),
|
||||
copyCount
|
||||
);
|
||||
}
|
||||
@@ -453,9 +456,9 @@ namespace MagicaCloth2
|
||||
/// <returns></returns>
|
||||
public int[] AddTransformRange(
|
||||
List<Transform> tlist,
|
||||
List<int> idList,
|
||||
List<int> pidList,
|
||||
List<int> rootIds,
|
||||
List<MagicaObjectId> idList,
|
||||
List<MagicaObjectId> pidList,
|
||||
List<MagicaObjectId> rootIds,
|
||||
NativeArray<float3> localPositions,
|
||||
NativeArray<quaternion> localRotations,
|
||||
NativeArray<float3> positions,
|
||||
@@ -482,7 +485,7 @@ namespace MagicaCloth2
|
||||
if (rootIds != null && rootIds.Count > 0)
|
||||
{
|
||||
if (rootIdList == null)
|
||||
rootIdList = new List<int>(rootIds);
|
||||
rootIdList = new List<MagicaObjectId>(rootIds);
|
||||
else
|
||||
rootIdList.AddRange(rootIds);
|
||||
}
|
||||
@@ -522,20 +525,22 @@ namespace MagicaCloth2
|
||||
/// Transform単体を追加する(tidを指定するならスレッド可)
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <param name="tid">0の場合はTransformからGetInstanceId()を即時設定する</param>
|
||||
/// <param name="tid">Invalidの場合はTransformからGetInstanceId()を即時設定する</param>
|
||||
/// <param name="pid">不要ならInvalid</param>
|
||||
/// <param name="flag"></param>
|
||||
/// <returns></returns>
|
||||
public int ReplaceTransform(int index, Transform t, int tid = 0, int pid = 0, byte flag = TransformManager.Flag_Read)
|
||||
//public int ReplaceTransform(int index, Transform t, int tid = 0, int pid = 0, byte flag = TransformManager.Flag_Read)
|
||||
public int ReplaceTransform(int index, Transform t, MagicaObjectId tid, MagicaObjectId pid, byte flag = TransformManager.Flag_Read)
|
||||
{
|
||||
Debug.Assert(index < Count);
|
||||
|
||||
transformList[index] = t;
|
||||
flagArray[index] = new ExBitFlag8(flag);
|
||||
if (tid == 0)
|
||||
if (tid.IsValid() == false)
|
||||
{
|
||||
// Transformからデータを取得(メインスレッドのみ)
|
||||
idArray[index] = t.GetInstanceID();
|
||||
parentIdArray[index] = t.parent ? t.parent.GetInstanceID() : 0;
|
||||
idArray[index] = t.GetMagicaId();
|
||||
parentIdArray[index] = t.parent ? t.parent.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
initLocalPositionArray[index] = t.localPosition;
|
||||
initLocalRotationArray[index] = t.localRotation;
|
||||
positionArray[index] = t.position;
|
||||
@@ -840,8 +845,8 @@ namespace MagicaCloth2
|
||||
|
||||
// 新しい領域
|
||||
var newTransformList = new List<Transform>(newTransformCount);
|
||||
var newTransformIdArray = new ExSimpleNativeArray<int>(newTransformCount);
|
||||
var newParentIdArray = new ExSimpleNativeArray<int>(newTransformCount);
|
||||
var newTransformIdArray = new ExSimpleNativeArray<MagicaObjectId>(newTransformCount);
|
||||
var newParentIdArray = new ExSimpleNativeArray<MagicaObjectId>(newTransformCount);
|
||||
var newFlagArray = new ExSimpleNativeArray<ExBitFlag8>(newTransformCount);
|
||||
var newInitLocalPositionArray = new ExSimpleNativeArray<float3>(newTransformCount);
|
||||
var newInitLocalRotationArray = new ExSimpleNativeArray<quaternion>(newTransformCount);
|
||||
@@ -910,7 +915,7 @@ namespace MagicaCloth2
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>-1=見つからない</returns>
|
||||
public int GetTransformIndexFormId(int id)
|
||||
public int GetTransformIndexFormId(MagicaObjectId id)
|
||||
{
|
||||
var array = idArray.GetNativeArray();
|
||||
int cnt = Count;
|
||||
@@ -922,12 +927,12 @@ namespace MagicaCloth2
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int GetTransformIdFromIndex(int index)
|
||||
public MagicaObjectId GetTransformIdFromIndex(int index)
|
||||
{
|
||||
return idArray[index];
|
||||
}
|
||||
|
||||
public int GetParentIdFromIndex(int index)
|
||||
public MagicaObjectId GetParentIdFromIndex(int index)
|
||||
{
|
||||
return parentIdArray[index];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/TransformManager/TransformData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace MagicaCloth2
|
||||
}
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
if (transformArray != null)
|
||||
{
|
||||
@@ -88,8 +88,8 @@ namespace MagicaCloth2
|
||||
var t = transformArray[i];
|
||||
if (t)
|
||||
{
|
||||
int id = t.GetInstanceID();
|
||||
if (id != 0 && replaceDict.ContainsKey(id))
|
||||
MagicaObjectId id = t.GetMagicaId();
|
||||
if (id.IsValid() && replaceDict.ContainsKey(id))
|
||||
{
|
||||
transformArray[i] = replaceDict[id];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/TransformManager/TransformDataSerialization.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/TransformManager/TransformManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace MagicaCloth2
|
||||
public class TransformRecord : IValid, ITransform
|
||||
{
|
||||
public Transform transform;
|
||||
public int id;
|
||||
public MagicaObjectId id;
|
||||
public Vector3 localPosition;
|
||||
public Quaternion localRotation;
|
||||
public Vector3 position;
|
||||
@@ -20,14 +20,14 @@ namespace MagicaCloth2
|
||||
public Vector3 scale; // lossy scale
|
||||
public Matrix4x4 localToWorldMatrix;
|
||||
public Matrix4x4 worldToLocalMatrix;
|
||||
public int pid;
|
||||
public MagicaObjectId pid;
|
||||
|
||||
public TransformRecord(Transform t, bool read)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
transform = t;
|
||||
id = t.GetInstanceID();
|
||||
id = t.GetMagicaId();
|
||||
|
||||
if (read)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace MagicaCloth2
|
||||
}
|
||||
|
||||
if (t.parent)
|
||||
pid = t.parent.GetInstanceID();
|
||||
pid = t.parent.GetMagicaId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace MagicaCloth2
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return id != 0;
|
||||
return id.IsValid();
|
||||
}
|
||||
|
||||
public void GetUsedTransform(HashSet<Transform> transformSet)
|
||||
@@ -60,18 +60,18 @@ namespace MagicaCloth2
|
||||
transformSet.Add(transform);
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
if (replaceDict.ContainsKey(id))
|
||||
{
|
||||
var t = replaceDict[id];
|
||||
transform = t;
|
||||
id = transform.GetInstanceID();
|
||||
id = transform.GetMagicaId();
|
||||
}
|
||||
if (replaceDict.ContainsKey(pid))
|
||||
{
|
||||
var t = replaceDict[pid];
|
||||
pid = t.GetInstanceID();
|
||||
pid = t.GetMagicaId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/TransformManager/TransformRecord.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -72,10 +72,10 @@ namespace MagicaCloth2
|
||||
transformSet.Add(transform);
|
||||
}
|
||||
|
||||
public void ReplaceTransform(Dictionary<int, Transform> replaceDict)
|
||||
public void ReplaceTransform(Dictionary<MagicaObjectId, Transform> replaceDict)
|
||||
{
|
||||
int id = transform != null ? transform.GetInstanceID() : 0;
|
||||
if (id != 0 && replaceDict.ContainsKey(id))
|
||||
MagicaObjectId id = transform != null ? transform.GetMagicaId() : MagicaObjectId.Invalid;
|
||||
if (id.IsValid() && replaceDict.ContainsKey(id))
|
||||
transform = replaceDict[id];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/TransformManager/TransformRecordSerializeData.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 242307
|
||||
packageName: Magica Cloth 2
|
||||
packageVersion: 2.17.0
|
||||
packageVersion: 2.18.1
|
||||
assetPath: Assets/OtherPlugins/MagicaCloth2/Scripts/Core/Manager/VirtualMesh/VirtualMeshManager.cs
|
||||
uploadId: 829902
|
||||
uploadId: 893596
|
||||
|
||||
Reference in New Issue
Block a user