Skip to content

Commit

Permalink
Don't need to check for folder resize flags outside of studio
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeSpork committed Dec 21, 2021
1 parent 63a36dd commit f3bea1c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
48 changes: 26 additions & 22 deletions AdvIKPlugin/AdvIKCharaController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,39 +410,42 @@ protected override void Update()
if (_breathing != null)
_breathing.FrameEffects = null;

foreach (TreeNodeObject flagNodeObject in flagNodeObjectList)
if (KKAPI.Studio.StudioAPI.InsideStudio && AdvIKPlugin.EnableResizeOnFolder.Value && flagNodeObjectList.Count > 0)
{
if (flagNodeObject != null && flagNodeObject.visible)
foreach (TreeNodeObject flagNodeObject in flagNodeObjectList)
{
try
if (flagNodeObject != null && flagNodeObject.visible)
{
if (flagNodeObject.textName == null || !flagNodeObject.textName.ToUpper().StartsWith("-RESIZE"))
try
{
flagNodeObjectList.Remove(flagNodeObject);
break;
}
if (flagNodeObject.textName == null || !flagNodeObject.textName.ToUpper().StartsWith("-RESIZE"))
{
flagNodeObjectList.Remove(flagNodeObject);
break;
}

string reqCentroidMode = flagNodeObject.textName.ToUpper().Substring(flagNodeObject.textName.LastIndexOf(":") + 1);
string reqCentroidMode = flagNodeObject.textName.ToUpper().Substring(flagNodeObject.textName.LastIndexOf(":") + 1);
#if DEBUG
AdvIKPlugin.Instance.Log.LogInfo($"Folder Requested Adjustment via: {reqCentroidMode}");
#endif
IKResizeCentroid currentCentroid = _iKResizeAdjustment.Centroid;
IKResizeCentroid requestedCentroid = (IKResizeCentroid)Enum.Parse(typeof(IKResizeCentroid), reqCentroidMode);
_iKResizeAdjustment.Centroid = requestedCentroid;
_iKResizeAdjustment.ApplyAdjustment(true);
_iKResizeAdjustment.Centroid = currentCentroid;
flagNodeObject.SetVisible(false);
}
catch (Exception errAny)
{
IKResizeCentroid currentCentroid = _iKResizeAdjustment.Centroid;
IKResizeCentroid requestedCentroid = (IKResizeCentroid)Enum.Parse(typeof(IKResizeCentroid), reqCentroidMode);
_iKResizeAdjustment.Centroid = requestedCentroid;
_iKResizeAdjustment.ApplyAdjustment(true);
_iKResizeAdjustment.Centroid = currentCentroid;
flagNodeObject.SetVisible(false);
}
catch (Exception errAny)
{
#if DEBUG
AdvIKPlugin.Instance.Log.LogInfo($"Error checking resize flag: {errAny.Message}\n{errAny.StackTrace}");
#endif
try
{
flagNodeObjectList.Remove(flagNodeObject);
try
{
flagNodeObjectList.Remove(flagNodeObject);
}
catch { }
}
catch { }
}
}
}
Expand Down Expand Up @@ -514,7 +517,8 @@ public Vector3 FindFKRotation(Transform t)
protected override void OnEnable()
{
StartCoroutine("StartBreathing", new PluginData());
StartCoroutine(ScanForFlagCo());
if (KKAPI.Studio.StudioAPI.InsideStudio)
StartCoroutine(ScanForFlagCo());
}


Expand Down
2 changes: 1 addition & 1 deletion AdvIKPlugin/AdvIKPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class AdvIKPlugin : BaseUnityPlugin
{
public const string GUID = "orange.spork.advikplugin";
public const string PluginName = "AdvIKPlugin";
public const string Version = "1.6.7";
public const string Version = "1.6.8";

public static AdvIKPlugin Instance { get; set; }

Expand Down

0 comments on commit f3bea1c

Please sign in to comment.