Skip to content

Commit

Permalink
[DPE] Fix TwoLut default not being applied on scene reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Mar 17, 2023
1 parent 99c4956 commit f26ee5d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/DefaultParamEditor.Core/SceneParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,28 @@ private static void SetSceneInfoValues(SceneInfo sceneInfo)
}

// Second ace/ramp dropdown added by the TwoLut Plugin
if (_sceneData.ace2No != null)
if(_sceneData.ace2No != null)
{
var tlp = Traverse.CreateWithType("KK_Plugins.TwoLutPlugin");
if (tlp.TypeExists())
if(tlp.TypeExists())
{
var prop = tlp.Property("CurrentLut2LocalSlot");
if (prop.PropertyExists())
if(prop.PropertyExists())
{
prop.SetValue(_sceneData.ace2No);

if (!string.IsNullOrEmpty(_sceneData.ace2No_GUID))
{
var ace2Info = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.GUID == _sceneData.ace2No_GUID && x.Slot == _sceneData.ace2No);
if (ace2Info != null)
prop.SetValue(ace2Info.LocalSlot);
}
// Need to do a delayed load because on studio startup this is called before studio controls and TwoLut are initialized
ThreadingHelper.Instance.StartCoroutine(new WaitUntil(() => StudioAPI.StudioLoaded)
.AppendCo(new WaitForEndOfFrame())
.AppendCo(() =>
{
prop.SetValue(_sceneData.ace2No);

if (!string.IsNullOrEmpty(_sceneData.ace2No_GUID))
{
var ace2Info = UniversalAutoResolver.LoadedStudioResolutionInfo.FirstOrDefault(x => x.GUID == _sceneData.ace2No_GUID && x.Slot == _sceneData.ace2No);
if (ace2Info != null)
prop.SetValue(ace2Info.LocalSlot);
}
}));
}
}
}
Expand Down

0 comments on commit f26ee5d

Please sign in to comment.