|
@@ -112,33 +112,51 @@ namespace MeidoPhotoStudio.Plugin
|
|
{
|
|
{
|
|
updating = true;
|
|
updating = true;
|
|
|
|
|
|
- PoseInfo poseInfo = meidoManager.ActiveMeido.CachedPose;
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ var cachedPose = meidoManager.ActiveMeido.CachedPose;
|
|
|
|
|
|
- bool oldPoseMode = customPoseMode;
|
|
|
|
|
|
+ poseModeGrid.SelectedItemIndex = cachedPose.CustomPose ? 1 : 0;
|
|
|
|
|
|
- poseModeGrid.SelectedItemIndex = poseInfo.CustomPose ? 1 : 0;
|
|
|
|
|
|
+ var oldCustomPoseMode = customPoseMode;
|
|
|
|
+ customPoseMode = cachedPose.CustomPose;
|
|
|
|
|
|
- int poseGroupIndex = CurrentPoseGroupList.IndexOf(poseInfo.PoseGroup);
|
|
|
|
|
|
+ if (oldCustomPoseMode != customPoseMode)
|
|
|
|
+ poseGroupDropdown.SetDropdownItems(
|
|
|
|
+ customPoseMode ? CurrentPoseGroupList.ToArray() : Translation.GetArray(
|
|
|
|
+ "poseGroupDropdown", CurrentPoseGroupList
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
|
|
- if (poseGroupIndex < 0) poseGroupIndex = 0;
|
|
|
|
|
|
+ var newPoseGroupIndex = CurrentPoseGroupList.IndexOf(cachedPose.PoseGroup);
|
|
|
|
|
|
- int poseIndex = CurrentPoseDict[poseInfo.PoseGroup].IndexOf(poseInfo.Pose);
|
|
|
|
|
|
+ if (newPoseGroupIndex < 0)
|
|
|
|
+ poseGroupDropdown.SelectedItemIndex = 0;
|
|
|
|
+ else if (oldCustomPoseMode != customPoseMode
|
|
|
|
+ || poseGroupDropdown.SelectedItemIndex != newPoseGroupIndex)
|
|
|
|
+ {
|
|
|
|
+ poseGroupDropdown.SelectedItemIndex = newPoseGroupIndex;
|
|
|
|
+ poseDropdown.SetDropdownItems(UIPoseList());
|
|
|
|
+ }
|
|
|
|
|
|
- if (poseIndex < 0) poseIndex = 0;
|
|
|
|
|
|
+ var newPoseIndex = CurrentPoseDict.TryGetValue(cachedPose.PoseGroup, out var poseList)
|
|
|
|
+ ? poseList.IndexOf(cachedPose.Pose)
|
|
|
|
+ : 0;
|
|
|
|
|
|
- if (oldPoseMode != customPoseMode)
|
|
|
|
- {
|
|
|
|
- string[] list = customPoseMode
|
|
|
|
- ? CurrentPoseGroupList.ToArray()
|
|
|
|
- : Translation.GetArray("poseGroupDropdown", CurrentPoseGroupList);
|
|
|
|
|
|
+ if (newPoseIndex < 0)
|
|
|
|
+ newPoseIndex = 0;
|
|
|
|
|
|
- poseGroupDropdown.SetDropdownItems(list);
|
|
|
|
|
|
+ poseDropdown.SelectedItemIndex = newPoseIndex;
|
|
|
|
+ poseListEnabled = CurrentPoseList.Count > 0;
|
|
|
|
+ }
|
|
|
|
+ catch
|
|
|
|
+ {
|
|
|
|
+ // Do nothing
|
|
|
|
+ }
|
|
|
|
+ finally
|
|
|
|
+ {
|
|
|
|
+ updating = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- poseGroupDropdown.SelectedItemIndex = poseGroupIndex;
|
|
|
|
- poseDropdown.SelectedItemIndex = poseIndex;
|
|
|
|
-
|
|
|
|
- updating = false;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void OnPresetChange(object sender, PresetChangeEventArgs args)
|
|
private void OnPresetChange(object sender, PresetChangeEventArgs args)
|
|
@@ -169,9 +187,10 @@ namespace MeidoPhotoStudio.Plugin
|
|
|
|
|
|
private void SetPoseMode()
|
|
private void SetPoseMode()
|
|
{
|
|
{
|
|
- customPoseMode = poseModeGrid.SelectedItemIndex == 1;
|
|
|
|
|
|
+ if (updating)
|
|
|
|
+ return;
|
|
|
|
|
|
- if (updating) return;
|
|
|
|
|
|
+ customPoseMode = poseModeGrid.SelectedItemIndex == 1;
|
|
|
|
|
|
string[] list = customPoseMode
|
|
string[] list = customPoseMode
|
|
? CurrentPoseGroupList.ToArray()
|
|
? CurrentPoseGroupList.ToArray()
|
|
@@ -182,6 +201,9 @@ namespace MeidoPhotoStudio.Plugin
|
|
|
|
|
|
private void ChangePoseGroup()
|
|
private void ChangePoseGroup()
|
|
{
|
|
{
|
|
|
|
+ if (updating)
|
|
|
|
+ return;
|
|
|
|
+
|
|
poseListEnabled = CurrentPoseList.Count > 0;
|
|
poseListEnabled = CurrentPoseList.Count > 0;
|
|
if (previousPoseGroup == SelectedPoseGroup)
|
|
if (previousPoseGroup == SelectedPoseGroup)
|
|
{
|
|
{
|