| | 1 | | using System.Collections.Generic; |
| | 2 | | using System.Linq; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace MainScripts.DCL.Components.Avatar.VRMExporter |
| | 6 | | { |
| | 7 | | [System.Serializable] |
| | 8 | | public struct BonesMapEntry |
| | 9 | | { |
| | 10 | | public string nameDCL; |
| | 11 | | public string nameVRM; |
| | 12 | | } |
| | 13 | |
|
| | 14 | | [CreateAssetMenu(menuName = "VRM/Create BonesMappingSO", fileName = "VRMBonesMapping", order = 0)] |
| | 15 | | public class VRMBonesMappingSO : ScriptableObject |
| | 16 | | { |
| 0 | 17 | | [SerializeField] private List<BonesMapEntry> bonesMapping = new List<BonesMapEntry>(); |
| | 18 | | private Dictionary<string, string> dclToFbx; |
| | 19 | |
|
| | 20 | | public bool TryGetFBXBone(string dclBoneName, out string fbxBoneName) |
| | 21 | | { |
| 0 | 22 | | EnsureDictionary(); |
| 0 | 23 | | return dclToFbx.TryGetValue(dclBoneName, out fbxBoneName); |
| | 24 | | } |
| | 25 | |
|
| 0 | 26 | | private void EnsureDictionary() => dclToFbx ??= bonesMapping.ToDictionary(x => x.nameDCL, x => x.nameVRM); |
| | 27 | | } |
| | 28 | | } |