Skip to content

Commit

Permalink
Fix Material Editor Compatibility Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeSpork committed Jan 10, 2022
1 parent e3bd237 commit 9a1eb02
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions OutfitPainter/OutfitPainter.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterMakerChannelGUI.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterMakerGUI.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterMaterialEditorHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterPlugin.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterSlot.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OutfitPainterStudioGUI.cs" />
Expand Down
3 changes: 2 additions & 1 deletion OutfitPainter/OutfitPainterChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public void UpdateAssignment(ChaControl character, OutfitPainterChannelAssignmen
{
character.nowCoordinate.clothes.parts[(int)assignment.slot].colorInfo[assignment.colorNumber - 1].baseColor = ChannelColor;
character.chaFile.coordinate.clothes.parts[(int)assignment.slot].colorInfo[assignment.colorNumber - 1].baseColor = ChannelColor;
}
}
OutfitPainterMaterialEditorHelper.SetMaterialEditorCustomClothesFlag(character);
character.ChangeCustomClothes(kind: ((int)assignment.slot), updateColor: true, updateTex01: true, updateTex02: true, updateTex03: true);
}
else
Expand Down
24 changes: 24 additions & 0 deletions OutfitPainter/OutfitPainterMaterialEditorHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using AIChara;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace OutfitPainter
{
public class OutfitPainterMaterialEditorHelper
{
private static Type MaterialEditorCharaControllerType = AccessTools.TypeByName("KK_Plugins.MaterialEditor.MaterialEditorCharaController");
private static PropertyInfo CustomClothesOverrideProperty = AccessTools.Property(MaterialEditorCharaControllerType, "CustomClothesOverride");

public static void SetMaterialEditorCustomClothesFlag(ChaControl chaControl)
{
if (chaControl == null)
return;

var controller = chaControl.gameObject.GetComponent(MaterialEditorCharaControllerType);
CustomClothesOverrideProperty.SetValue(controller, true);
}
}
}
3 changes: 2 additions & 1 deletion OutfitPainter/OutfitPainterPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ namespace OutfitPainter
{
[BepInPlugin(GUID, PluginName, Version)]
[BepInDependency(KoikatuAPI.GUID, KoikatuAPI.VersionConst)]
[BepInDependency("com.deathweasel.bepinex.materialeditor")]
public class OutfitPainterPlugin : BaseUnityPlugin
{

public const string GUID = "orange.spork.outfitpainter";
public const string PluginName = "Outfit Painter";
public const string Version = "1.0.0";
public const string Version = "1.0.1";

public static OutfitPainterPlugin Instance { get; set; }

Expand Down

0 comments on commit 9a1eb02

Please sign in to comment.