Skip to content

Commit

Permalink
add option to toggle bone list ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv authored and Fayti1703 committed Jun 14, 2023
1 parent 0b73587 commit e898904
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Ktisis/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class Configuration : IPluginConfiguration {

// Overlay

public bool OrderBoneListByDistance { get; set; } = true;

public bool DrawLinesOnSkeleton { get; set; } = true;
public bool DrawLinesWithGizmo { get; set; } = true;
public bool DrawDotsWithGizmo { get; set; } = true;
Expand Down
8 changes: 8 additions & 0 deletions Ktisis/Interface/Windows/ConfigGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ public static void DrawInterfaceTab(Configuration cfg) {
// Overlay

public static void DrawOverlayTab(Configuration cfg) {
ImGui.Spacing();

var order = cfg.OrderBoneListByDistance;
if (ImGui.Checkbox("Order bone list by distance from camera", ref order))
cfg.OrderBoneListByDistance = order;

ImGui.Spacing();

if (ImGui.CollapsingHeader(Locale.GetString("Skeleton_lines_and_dots"), ImGuiTreeNodeFlags.DefaultOpen)) {
ImGui.Separator();
var drawLines = cfg.DrawLinesOnSkeleton;
Expand Down
3 changes: 2 additions & 1 deletion Ktisis/Overlay/Selection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public static void DrawList(List<DrawItem> items) {
else if (ScrollIndex < 0)
ScrollIndex = items.Count - 1;

items.Sort((x, y) => x.Depth < y.Depth ? -1 : 1);
if (Ktisis.Configuration.OrderBoneListByDistance)
items.Sort((x, y) => x.Depth < y.Depth ? -1 : 1);

for (var i = 0; i < items.Count; i++) {
var item = items[i];
Expand Down

0 comments on commit e898904

Please sign in to comment.