Browse Source

Add support for building for COM3D2.5

This does not mean that COM3D2.5 support is added since the IK system is
still borked.
habeebweeb 1 year ago
parent
commit
3040023f0f

+ 18 - 1
Directory.Build.props

@@ -5,10 +5,27 @@
     <LangVersion>10</LangVersion>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)StyleCop.ruleset</CodeAnalysisRuleSet>
+    <Platforms>AnyCPU</Platforms>
+    <Configurations>Debug-COM25;Release-COM25;Release;Debug</Configurations>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" $(Configuration.StartsWith('Debug')) ">
+    <DebugSymbols>true</DebugSymbols>
+    <Optimize>false</Optimize>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" $(Configuration.StartsWith('Release')) ">
+    <DebugSymbols>false</DebugSymbols>
+    <Optimize>true</Optimize>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" $(Configuration.EndsWith('COM25')) ">
+    <DefineConstants>COM25</DefineConstants>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="COM3D2.GameLibs" Version="2.17.0-r.0" />
+    <PackageReference Include="COM3D2.GameLibs" Version="2.17.0-r.0" Condition="!$(DefineConstants.Contains(COM25))" />
+    <PackageReference Include="COM3D2.GameLibs" Version="3.16.0-r.0" Condition="$(DefineConstants.Contains(COM25))" />
     <PackageReference Include="UnityEngine" Version="5.6.1" />
     <PackageReference Include="BepInEx.BaseLib" Version="5.4.19" />
     <PackageReference Include="HarmonyX" Version="2.9.0" />

+ 8 - 0
MeidoPhotoStudio.Plugin.sln

@@ -10,14 +10,22 @@ Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Release|Any CPU = Release|Any CPU
+		Release-COM25|Any CPU = Release-COM25|Any CPU
+		Debug-COM25|Any CPU = Debug-COM25|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Release-COM25|Any CPU.ActiveCfg = Release-COM25|Any CPU
+		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Release-COM25|Any CPU.Build.0 = Release-COM25|Any CPU
 		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Debug-COM25|Any CPU.ActiveCfg = Debug-COM25|Any CPU
+		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Debug-COM25|Any CPU.Build.0 = Debug-COM25|Any CPU
 		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{5FA40522-E0AC-459A-A571-DD0051217AB6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Release-COM25|Any CPU.ActiveCfg = Release-COM25|Any CPU
 		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Debug-COM25|Any CPU.ActiveCfg = Debug-COM25|Any CPU
 		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{19D28B0C-3537-4FEE-B7B3-1ABF70B16D5E}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection

+ 22 - 3
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointMeido.cs

@@ -19,6 +19,8 @@ public abstract class DragPointMeido : DragPoint
     protected bool isPlaying;
     protected bool isBone;
 
+    private const string IkDataTag = "左手";
+
     public virtual bool IsBone
     {
         get => isBone;
@@ -32,8 +34,14 @@ public abstract class DragPointMeido : DragPoint
         }
     }
 
-    protected IKCtrlData IkCtrlData =>
-        meido.Body.IKCtrl.GetIKData("左手");
+    // TODO: Come up with an intermediary fix for this until I can rewrite the IK system.
+    // WARN: This does NOT work and is only done so the compiler does not complain
+    protected
+#if COM25
+        AIKCtrl IkCtrlData => meido.Body.fullBodyIK.GetIKCtrl(IkDataTag);
+#else
+        IKCtrlData IkCtrlData => meido.Body.IKCtrl.GetIKData(IkDataTag);
+#endif
 
     public virtual void Initialize(Meido meido, Func<Vector3> position, Func<Vector3> rotation)
     {
@@ -65,6 +73,17 @@ public abstract class DragPointMeido : DragPoint
     protected void InitializeIK(TBody.IKCMO iKCmo, Transform upper, Transform middle, Transform lower) =>
         iKCmo.Init(upper, middle, lower, maid.body0);
 
-    protected void Porc(TBody.IKCMO ikCmo, IKCtrlData ikData, Transform upper, Transform middle, Transform lower) =>
+    // WARN: This does NOT work and is only done so the compiler does not complain
+    protected void Porc(
+        TBody.IKCMO ikCmo,
+#if COM25
+        AIKCtrl
+#else
+        IKCtrlData
+#endif
+        ikData,
+        Transform upper,
+        Transform middle,
+        Transform lower) =>
         ikCmo.Porc(upper, middle, lower, CursorPosition(), Vector3.zero, ikData);
 }

+ 9 - 1
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointFinger.cs

@@ -11,7 +11,15 @@ public class DragPointFinger : DragPointMeido
     private readonly TBody.IKCMO ik = new();
     private readonly Quaternion[] jointRotation = new Quaternion[2];
 
-    private IKCtrlData ikCtrlData;
+    // WARN: This does NOT work and is only done so the compiler does not complain
+    private
+#if COM25
+            AIKCtrl
+#else
+            IKCtrlData
+#endif
+    ikCtrlData;
+
     private Transform[] ikChain;
     private bool baseFinger;
 

+ 9 - 1
src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointChain.cs

@@ -7,7 +7,15 @@ public abstract class DragPointChain : DragPointMeido
     protected readonly TBody.IKCMO IK = new();
     protected readonly Quaternion[] jointRotation = new Quaternion[3];
 
-    protected IKCtrlData ikCtrlData;
+    // WARN: This does NOT work and is only done so the compiler does not complain
+    protected
+#if COM25
+    AIKCtrl
+#else
+    IKCtrlData
+#endif
+    ikCtrlData;
+
     protected Transform[] ikChain;
 
     public override void Set(Transform myObject)