public void SetRemapConfig(ObjectVariantDestinationInfo info)
 {
     if (info.DstObject != null)
     {
         VariantOperation.GetOperation().AddVariantMapping(info.CreateTagFromSelection(), m_obj, info.DstObject);
     }
     else
     {
         RemoveRemapConfig(info);
     }
 }
        private void DrawDstContent(Rect r, ObjectVariantDestinationInfo dstInfo, int index)
        {
            var tex = AssetPreview.GetAssetPreview(dstInfo.DstObject);

            GUILayout.Label(tex, GUILayout.Width(100f), GUILayout.Height(100f));

            string name = "<null>";

            if (dstInfo.DstObject != null)
            {
                name = dstInfo.DstObject.name;
            }
            GUILayout.Label(name, "BoldLabel", GUILayout.Width(100f));
            var newObj = EditorGUILayout.ObjectField(dstInfo.DstObject, m_obj.GetType(), false, GUILayout.Width(100f));

            if (newObj != dstInfo.DstObject)
            {
                dstInfo.DstObject = newObj;
                SetRemapConfig(dstInfo);
                VariantOperation.SetDBDirty();
            }

            GUILayout.Space(8f);

            foreach (var ax in VariantOperation.Axis)
            {
                var items = ax.Variants.Select(v => v.Name).ToList();
                items.Insert(0, "<Any>");
                var array = items.ToArray();

                int           popIndex = 0;
                AxisSelection s        = dstInfo.Selections.Find(x => x.axName == ax.Name);
                if (s != null)
                {
                    popIndex = ax.Variants.FindIndex(v => v.ShortName == s.vShortName) + 1;
                }

                var newIndex = EditorGUILayout.Popup(popIndex, array, GUILayout.Width(100f));
                if (newIndex != popIndex)
                {
                    if (newIndex == 0)
                    {
                        dstInfo.Selections.RemoveAll(sel => sel.axName == ax.Name);
                    }
                    else
                    {
                        if (s == null)
                        {
                            s        = new AxisSelection();
                            s.axName = ax.Name;
                            dstInfo.Selections.Add(s);
                        }
                        s.vShortName = (newIndex == 0)? "" : ax.Variants.ElementAt(newIndex - 1).ShortName;
                    }
                    SetRemapConfig(dstInfo);
                    VariantOperation.SetDBDirty();
                }
                GUILayout.Space(2f);
            }

            GUILayout.Space(8f);

            if (GUILayout.Button("Delete Variant"))
            {
                m_removing.Add(dstInfo);
            }
        }
 public void RemoveRemapConfig(ObjectVariantDestinationInfo info)
 {
     VariantOperation.GetOperation().RemoveVariantMapping(info.CreateTagFromSelection(), m_obj);
 }