Skip to content

Commit

Permalink
Added option to load a pose without face
Browse files Browse the repository at this point in the history
Fixes #502
  • Loading branch information
Yuki-Codes committed Mar 2, 2022
1 parent 9c9b5c2 commit 8197d47
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Anamnesis/Languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@
"Pose_Selected": "Selected Bones",
"Pose_Expression": "Expression",
"Pose_ScalePack": "Body Scale",
"Pose_Body": "Body Pose",
"Pose_BodyTooltip": "Loads a pose onto the entire actor except for the face",
"Pose_Clear": "Clear",
"Pose_SelectChildren": "Select Children",
"Pose_Flip": "Flip",
Expand Down
9 changes: 9 additions & 0 deletions Anamnesis/Posing/Pages/PosePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@
<XivToolsWpf:TextBlock Key="Pose_AllTooltip" />
</MenuItem.ToolTip>
</MenuItem>

<MenuItem Header="Pose_Body"
Style="{StaticResource AnaMenuItem}"
Click="OnOpenBodyClicked">
<MenuItem.ToolTip>
<XivToolsWpf:TextBlock Key="Pose_BodyTooltip" />
</MenuItem.ToolTip>
</MenuItem>

<MenuItem Header="Pose_Expression"
Style="{StaticResource AnaMenuItem}"
Click="OnOpenExpressionClicked"/>
Expand Down
12 changes: 12 additions & 0 deletions Anamnesis/Posing/Pages/PosePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ private async void OnOpenAllClicked(object sender, RoutedEventArgs e)
await this.Open(false, PoseFile.Mode.All);
}

private async void OnOpenBodyClicked(object sender, RoutedEventArgs e)
{
if (this.Skeleton == null)
return;

this.Skeleton.SelectHead();
this.Skeleton.InvertSelection();

await this.Open(true, PoseFile.Mode.Rotation);
this.Skeleton.ClearSelection();
}

private async void OnOpenExpressionClicked(object sender, RoutedEventArgs e)
{
if (this.Skeleton == null)
Expand Down
22 changes: 22 additions & 0 deletions Anamnesis/Posing/Visuals/SkeletonVisual3d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,28 @@ public void SelectHead()
this.Select(headBones, SkeletonVisual3d.SelectMode.Add);
}

public void InvertSelection()
{
foreach ((string name, BoneVisual3d bone) in this.Bones)
{
bool selected = this.SelectedBones.Contains(bone);

if (selected)
{
this.SelectedBones.Remove(bone);
}
else
{
this.SelectedBones.Add(bone);
}
}

this.RaisePropertyChanged(nameof(SkeletonVisual3d.CurrentBone));
this.RaisePropertyChanged(nameof(SkeletonVisual3d.HasSelection));
this.RaisePropertyChanged(nameof(SkeletonVisual3d.SelectedCount));
this.RaisePropertyChanged(nameof(SkeletonVisual3d.CanEditBone));
}

public void GetBoneChildren(BoneVisual3d bone, ref List<BoneVisual3d> bones)
{
foreach (Visual3D child in bone.Children)
Expand Down

0 comments on commit 8197d47

Please sign in to comment.