Skip to content

Commit

Permalink
Massive changes following 1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
krypto5863 committed Dec 31, 2022
1 parent 4a15844 commit 417da95
Show file tree
Hide file tree
Showing 21 changed files with 1,202 additions and 604 deletions.
33 changes: 9 additions & 24 deletions YotogiShapekeys/0Old/0Old1ShapekeyFetcherSetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static List<Maid> GetMaidsList()
//The main idea behind MissionControl is to eventually have it drive everything on first thread and simply instruct the worker threads allowing flexibility for when we need to run something on thread 1. As a result, Mission control will have a few versions.
public static void MissionControlAll()
{

Stopwatch stop = new Stopwatch();

stop.Start();
Expand Down Expand Up @@ -83,8 +82,6 @@ public static void MissionControlAll()
}
public static void MissionControlMaid(Maid maid)
{


#if (DEBUG)
Main.logger.Log($"Started");
#endif
Expand All @@ -93,7 +90,6 @@ public static void MissionControlMaid(Maid maid)

stop.Start();


#if (DEBUG)
Main.logger.Log($"Checking maid isn't null.");
#endif
Expand All @@ -103,15 +99,13 @@ public static void MissionControlMaid(Maid maid)
return;
}


#if (DEBUG)
Main.logger.Log($"Fetching morphs");
#endif

//var morphs = await Task.Factory.StartNew(() => GetAllMorphsFromMaid(maid));
IEnumerable<TMorph> morphs = GetAllMorphsFromMaid(maid);


#if (DEBUG)
Main.logger.Log($"Converting morphs to changes...");
#endif
Expand All @@ -123,7 +117,6 @@ public static void MissionControlMaid(Maid maid)
//.Select(n => n.Result)
.SelectMany(r => r);


#if (DEBUG)
Main.logger.Log($"Processing changes...");
#endif
Expand Down Expand Up @@ -237,7 +230,6 @@ public static List<ShapekeyChangeForm> GetTMorphChangeForm(TMorph m)
//Checks every held shapekeyentry and works as required.
foreach (ShapeKeyEntry s in templist)
{

#if (DEBUG)
Main.logger.Log($"Checking that it isn't a face morph...");
#endif
Expand Down Expand Up @@ -355,7 +347,6 @@ public static ShapekeyChangeForm GetShapekeyChangeForm(ShapeKeyEntry s, TMorph m
//Even though this goes against my mission control's idea. I wanted to save myself the trouble of rewriting the same code 3 times As such, I decided to go for it. This will be run sync though.
public static void ProcessChanges(IEnumerable<ShapekeyChangeForm> changes)
{

#if (DEBUG)
Main.logger.Log($"Processing changes...");
#endif
Expand Down Expand Up @@ -383,12 +374,10 @@ public static void ProcessChanges(IEnumerable<ShapekeyChangeForm> changes)
#if (DEBUG)
Main.logger.Log($"Finished foreach...");
#endif

}
//The actual changes are pushed to a coroutine. Coroutines have the property of always running on the main thread, in time with the main thread so pushing this function to a coroutine from a worker thread ensures safe changes. However when possible. It should be avoided as creating too many coroutines is asking for trouble.
public static IEnumerator RunShapekeyChange()
{

CorouteRunning = true;

yield return new WaitForEndOfFrame();
Expand All @@ -397,10 +386,8 @@ public static IEnumerator RunShapekeyChange()

while (ChangeList.Count > 0)
{

if (ChangeList[0].Morph != null && ChangeList[0].Morph.GetBlendValues(ChangeList[0].Index) != ChangeList[0].Deform)
{

if (ChangeList[0].Morph == null || ChangeList[0].Morph.bodyskin == null || ChangeList[0].Morph.bodyskin.body == null || ChangeList[0].Morph.bodyskin.body.maid.isActiveAndEnabled == false)
{
yield return new WaitForEndOfFrame();
Expand All @@ -423,7 +410,6 @@ public static IEnumerator RunShapekeyChange()
}
catch
{

}

#if (DEBUG)
Expand All @@ -444,7 +430,7 @@ public static IEnumerator RunShapekeyChange()
CorouteRunning = false;
}
/*
public static void FixSingleBlendValues(TMorph morph, int index)
public static void FixSingleBlendValues(TMorph morph, int index)
{
int num = 0;
var BlendValuesCHK = AccessTools.DeclaredField(typeof(TMorph), "BlendValuesCHK").GetValue(morph) as float[];
Expand Down Expand Up @@ -502,8 +488,8 @@ public static void FixSingleBlendValues(TMorph morph, int index)
}
}*/
/*
//The animator can be considered something of a manager. It simply calculates orgasms and
public static IEnumerator OrgasmAnimator()
//The animator can be considered something of a manager. It simply calculates orgasms and
public static IEnumerator OrgasmAnimator()
{
#if (DEBUG)
Main.logger.Log($"Orgasm animator has started!!");
Expand All @@ -524,7 +510,7 @@ public static IEnumerator OrgasmAnimator()
{
s2.Start();
while (OrgasmDeform < 100)
while (OrgasmDeform < 100)
{
OrgasmDeform += 25;
Expand All @@ -536,12 +522,11 @@ public static IEnumerator OrgasmAnimator()
yield return new WaitForSeconds(.1f);
}
while (OrgasmDeform > 0 && s.Elapsed < TimeSpan.FromSeconds(1))
while (OrgasmDeform > 0 && s.Elapsed < TimeSpan.FromSeconds(1))
{
OrgasmDeform -= 10;
if (OrgasmDeform < 0)
if (OrgasmDeform < 0)
{
OrgasmDeform = 0;
}
Expand Down Expand Up @@ -573,9 +558,9 @@ public static IEnumerator OrgasmAnimator()
Main.logger.Log($"Orgasm animator has finished: {s.Elapsed}");
#endif
}
private static IEnumerator UpdateOrgasmKeys()
private static IEnumerator UpdateOrgasmKeys()
{
while (IsOrgasming)
while (IsOrgasming)
{
RunAllBackgroundAsync();
Expand All @@ -584,4 +569,4 @@ private static IEnumerator UpdateOrgasmKeys()
yield break;
}*/
}
}
}
3 changes: 1 addition & 2 deletions YotogiShapekeys/0Old/BlendShapeFetcherSetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ internal static class BlendShapeFetcherSetter
{
public static void RunAll()
{

#if (DEBUG)
Main.logger.Log($"Updated called. Running on all.");
#endif
Expand Down Expand Up @@ -48,4 +47,4 @@ static void RunSkinnedMesh(SkinnedMeshRenderer smr)
}
}
}
}
}
26 changes: 13 additions & 13 deletions YotogiShapekeys/0Old/PrivateSettersContractResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace ShapekeyMaster
{
class PrivateSettersContractResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var prop = base.CreateProperty(member, memberSerialization);
if (!prop.Writable)
{
var property = member as PropertyInfo;
var hasPrivateSetter = property?.GetSetMethod(true) != null;
prop.Writable = hasPrivateSetter;
}
return prop;
}
}
}
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var prop = base.CreateProperty(member, memberSerialization);
if (!prop.Writable)
{
var property = member as PropertyInfo;
var hasPrivateSetter = property?.GetSetMethod(true) != null;
prop.Writable = hasPrivateSetter;
}
return prop;
}
}
}
10 changes: 4 additions & 6 deletions YotogiShapekeys/0Old/PropsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ private static void DisplayPropShapeKeyEntriesMenu(SortedDictionary<Guid, ShapeK

foreach (ShapeKeyEntry s in ShapeKeys.Values)
{

if (s.IsProp == false)
{
continue;
Expand All @@ -35,21 +34,21 @@ private static void DisplayPropShapeKeyEntriesMenu(SortedDictionary<Guid, ShapeK
{
if (FilterMode == 0)
{
if (!Regex.IsMatch(s.EntryName.ToLower(), $@".*{Filter.ToLower()}.*"))
if (s.EntryName.Contains(Filter, StringComparison.OrdinalIgnoreCase) == false)
{
continue;
}
}
else if (FilterMode == 1)
{
if (!Regex.IsMatch(s.Maid.ToLower(), $@".*{Filter.ToLower()}.*"))
if (s.Maid.Contains(Filter, StringComparison.OrdinalIgnoreCase) == false)
{
continue;
}
}
else if (FilterMode == 2)
{
if (!Regex.IsMatch(s.ShapeKey.ToLower(), $@".*{Filter.ToLower()}.*"))
if (s.ShapeKey.Contains(Filter, StringComparison.OrdinalIgnoreCase) == false)
{
continue;
}
Expand All @@ -72,7 +71,6 @@ private static void DisplayPropShapeKeyEntriesMenu(SortedDictionary<Guid, ShapeK

if (GUILayout.Button("+"))
{

}

s.SetShapeKey(GUILayout.TextField(s.ShapeKey));
Expand Down Expand Up @@ -103,4 +101,4 @@ private static void DisplayPropShapeKeyEntriesMenu(SortedDictionary<Guid, ShapeK
}
}
}
}
}
Loading

0 comments on commit 417da95

Please sign in to comment.