Skip to content

Commit

Permalink
feat: implement remove outfit method in oneconf cabinet provider
Browse files Browse the repository at this point in the history
  • Loading branch information
poi-vrc committed Dec 28, 2024
1 parent aca1168 commit c1de66f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Editor/Configurator/Cabinet/OneConfCabinetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

using System.Collections.Generic;
using Chocopoi.DressingFramework.Localization;
using Chocopoi.DressingTools.Components.OneConf;
using Chocopoi.DressingTools.Configurator.Views;
using Chocopoi.DressingTools.Localization;
using Chocopoi.DressingTools.OneConf;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

Expand Down Expand Up @@ -51,7 +53,17 @@ public List<IConfigurableOutfit> GetOutfits()

public void RemoveOutfit(IConfigurableOutfit outfit)
{
throw new System.NotImplementedException();
// if outfit is an object inside of a prefab, do not remove it
if (!PrefabUtility.IsAnyPrefabInstanceRoot(outfit.RootTransform.gameObject) && PrefabUtility.IsPartOfAnyPrefab(outfit.RootTransform.gameObject))
{
EditorUtility.DisplayDialog(t._("tool.name"), t._("configurator.cabinet.oneConf.dialog.outfitPartOfPrefabObjectNotRemoved"), t._("common.dialog.btn.ok"));
if (outfit.RootTransform.TryGetComponent<DTWearable>(out var comp))
{
Undo.DestroyObjectImmediate(comp);
}
return;
}
Undo.DestroyObjectImmediate(outfit.RootTransform.gameObject);
}
}
}
1 change: 1 addition & 0 deletions Translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"editor.main.toolSettings.updateChecker.label.defaultBranch": "Default branch",
"editor.main.toolSettings.updateChecker.popup.branch": "Branch",
"editor.main.toolSettings.updaterChecker.helpbox.msg.updateNotChecked": "Update has not been checked yet. Check update to change the branch.",
"configurator.cabinet.oneConf.dialog.outfitPartOfPrefabObjectNotRemoved": "Outfit object is part of a prefab. Only the outfit component is removed.",
"tool.name": "DressingTools",
"wearable.inspector.dialog.msg.unableToLocateCabinetToStartDressing": "Unable to locate cabinet to start dressing.",
"wearable.inspector.settings.wearable": "Wearable",
Expand Down

0 comments on commit c1de66f

Please sign in to comment.