// Magica Cloth. // Copyright (c) MagicaSoft, 2020-2022. // https://magicasoft.jp using System.Collections.Generic; using UnityEngine; namespace MagicaCloth { /// /// CoreComponent API /// public abstract partial class CoreComponent : BaseComponent, IShareDataObject, IDataVerify, IEditorMesh, IEditorCloth, IDataHash, IBoneReplace { /// /// コンポーネントで使用されているすべてのボーンを返します。 /// Returns all bones used in the component. /// /// public Dictionary GetUsedComponentBones() { var boneDict = new Dictionary(); var bones = GetUsedBones(); foreach (var t in bones) if (t) { if (boneDict.ContainsKey(t.name)) { if (boneDict[t.name] != t) Debug.LogWarning($"The bone name is duplicated!:{t.name}"); } else boneDict.Add(t.name, t); } return boneDict; } /// /// コンポーネントで使用されているすべてのボーンの名前を返します。 /// Returns all bone names used in the component. /// /// public List GetUsedComponentBoneNames() { return new List(GetUsedComponentBones().Keys); } /// /// コンポーネントのボーンを入れ替え再セットアップします。 /// Swap component bones and set up again. /// https://magicasoft.jp/en/corecomponent-2/ /// /// public void ReplaceComponentBone(Dictionary boneReplaceDict) { ChangeAvatar(boneReplaceDict); } /// /// コンポーネントのボーンを入れ替え再セットアップします。 /// Swap component bones and set up again. /// https://magicasoft.jp/en/corecomponent-2/ /// /// public void ReplaceComponentBone(Dictionary boneReplaceDict) { ChangeAvatar(boneReplaceDict); } } }