Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
poi-vrc committed Apr 30, 2024
1 parent 6c775db commit 8d6ca51
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 87 deletions.
4 changes: 2 additions & 2 deletions Editor/Configurator/Cabinet/DTBaseOutfitProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal class BaseOutfitProvider : IBaseOutfitProvider
internal class DTBaseOutfitProvider : IBaseOutfitProvider
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,33 @@
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using Chocopoi.DressingTools.Components.Cabinet;
using Chocopoi.DressingTools.Configurator.Modules;
using Chocopoi.DressingTools.UI.Views;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal class AlternateOutfitProvider : IAlternateOutfitProvider
internal class DTConfigurableOutfit : IConfigurableOutfit
{
public ElementView CreateView(IConfigurableOutfit outfit)
public Transform RootTransform { get => _outfitComp.RootTransform; }
public string Name => _outfitComp.Name;
public Texture2D Icon => _outfitComp.Icon;

private readonly DTAlternateOutfit _outfitComp;

public DTConfigurableOutfit(DTAlternateOutfit outfitComp)
{
_outfitComp = outfitComp;
}

public ElementView CreateView()
{
throw new System.NotImplementedException();
}

public IModule GetOutfitModules(IConfigurableOutfit outfit)
public List<IModule> GetModules()
{
throw new System.NotImplementedException();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions Editor/Configurator/Cabinet/DTWardrobeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using Chocopoi.DressingTools.Components.Cabinet;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal class WardrobeProvider : IWardrobeProvider
internal class DTWardrobeProvider : IWardrobeProvider
{
public IConfigurableOutfit GetOutfitsInAvatars(GameObject avatar)
public List<IConfigurableOutfit> GetOutfitsInAvatars(GameObject avatar)
{
throw new System.NotImplementedException();
var comps = avatar.GetComponentsInChildren<DTAlternateOutfit>(true);
var outfits = new List<IConfigurableOutfit>();
foreach (var comp in comps)
{
outfits.Add(new DTConfigurableOutfit(comp));
}
return outfits;
}
}
}
24 changes: 0 additions & 24 deletions Editor/Configurator/Cabinet/IAlternateOutfitProvider.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Editor/Configurator/Cabinet/IAlternateOutfitProvider.cs.meta

This file was deleted.

2 changes: 1 addition & 1 deletion Editor/Configurator/Cabinet/IBaseOutfitProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal interface IBaseOutfitProvider
{
Expand Down
11 changes: 10 additions & 1 deletion Editor/Configurator/Cabinet/IConfigurableOutfit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using Chocopoi.DressingTools.Configurator.Modules;
using Chocopoi.DressingTools.UI.Views;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal interface IConfigurableOutfit
{
Transform RootTransform { get; }
string Name { get; }
Texture2D Icon { get; }

List<IModule> GetModules();
ElementView CreateView();
}
}
5 changes: 3 additions & 2 deletions Editor/Configurator/Cabinet/IWardrobeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal interface IWardrobeProvider
{
IConfigurableOutfit GetOutfitsInAvatars(GameObject avatar);
List<IConfigurableOutfit> GetOutfitsInAvatars(GameObject avatar);
}
}
14 changes: 11 additions & 3 deletions Editor/Configurator/Cabinet/OneConfCabinetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using Chocopoi.DressingTools.OneConf;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator
namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal class OneConfCabinetProvider : IWardrobeProvider
{
public IConfigurableOutfit GetOutfitsInAvatars(GameObject avatar)
public List<IConfigurableOutfit> GetOutfitsInAvatars(GameObject avatarGameObject)
{
throw new System.NotImplementedException();
var wearables = OneConfUtils.GetCabinetWearables(avatarGameObject);
var outfits = new List<IConfigurableOutfit>();
foreach (var wearable in wearables)
{
outfits.Add(new OneConfConfigurableOutfit(avatarGameObject, wearable));
}
return outfits;
}
}
}
82 changes: 82 additions & 0 deletions Editor/Configurator/Cabinet/OneConfConfigurableOutfit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2024 chocopoi
*
* This file is part of DressingTools.
*
* DressingTools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* DressingTools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>.
*/

using System.Collections.Generic;
using Chocopoi.DressingTools.Components.OneConf;
using Chocopoi.DressingTools.Configurator.Modules;
using Chocopoi.DressingTools.OneConf;
using Chocopoi.DressingTools.OneConf.Serialization;
using Chocopoi.DressingTools.OneConf.Wearable.Modules.BuiltIn;
using Chocopoi.DressingTools.UI.Views;
using UnityEngine;

namespace Chocopoi.DressingTools.Configurator.Cabinet
{
internal class OneConfConfigurableOutfit : IConfigurableOutfit
{
public Transform RootTransform
{
get => _wearableComp.RootGameObject.transform;
}
public string Name
{
get => WearableConfigUtility.TryDeserialize(_wearableComp.ConfigJson, out var config) ?
config.info.name :
"(Error)";

}
public Texture2D Icon
{
get => WearableConfigUtility.TryDeserialize(_wearableComp.ConfigJson, out var config) ?
(string.IsNullOrEmpty(config.info.thumbnail) ?
null :
OneConfUtils.GetTextureFromBase64(config.info.thumbnail)) :
null;
}

private readonly GameObject _avatarGameObject;
private readonly DTWearable _wearableComp;

public OneConfConfigurableOutfit(GameObject avatarGameObject, DTWearable wearableComp)
{
_avatarGameObject = avatarGameObject;
_wearableComp = wearableComp;
}

public ElementView CreateView()
{
throw new System.NotImplementedException();
}

public List<IModule> GetModules()
{
var modules = new List<IModule>();
if (!WearableConfigUtility.TryDeserialize(_wearableComp.ConfigJson, out var config))
{
Debug.LogError("[DressingTools] Unable to deserialize OneConf wearable config, returning empty modules");
return modules;
}

foreach (var oneConfModule in config.modules)
{
// TODO
if (oneConfModule.moduleName == ArmatureMappingWearableModuleConfig.ModuleIdentifier &&
oneConfModule.config is ArmatureMappingWearableModuleConfig)
{
modules.Add(new OneConfArmatureMappingModule(_avatarGameObject, _wearableComp));
}
}

return modules;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions Editor/Configurator/Cabinet/OneConfWearableProvider.cs

This file was deleted.

Loading

0 comments on commit 8d6ca51

Please sign in to comment.