trimmer icon indicating copy to clipboard operation
trimmer copied to clipboard

Variant that has child looks weird

Open alijaya opened this issue 2 years ago • 3 comments

Screenshot 2023-10-17 at 01 41 40

alijaya avatar Oct 16 '23 18:10 alijaya

In ProfileEditor, changing the order of iterating child first than variant seems working

From this

protected void OptionGUIRecursive(Option option, int depth = 0)
{
    if (!OptionGUI(option, depth)) return;

    if (option.IsDefaultVariant) {
        if (!OptionGUI(option, depth + 1, showDefaultVariant: true)) return;
    }

    foreach (var variant in option.Variants) {
        OptionGUIRecursive(variant, depth + 1);
    }

    foreach (var child in option.Children) {
        OptionGUIRecursive(child, depth + 1);
    }


}

To this

protected void OptionGUIRecursive(Option option, int depth = 0)
{
    if (!OptionGUI(option, depth)) return;

    if (option.IsDefaultVariant) {
        if (!OptionGUI(option, depth + 1, showDefaultVariant: true)) return;
    }

    foreach (var child in option.Children) {
        OptionGUIRecursive(child, depth + 1);
    }

    foreach (var variant in option.Variants) {
        OptionGUIRecursive(variant, depth + 1);
    }

}

alijaya avatar Oct 16 '23 18:10 alijaya

It seems variants with children are a bit broken. The child options should be shown as part of the default variant, not a level higher up as they are now and identical to how they are shown for non-default variants.

sttz avatar Oct 17 '23 05:10 sttz

Ah I see... but functionally, it works... just a little inconvenience

alijaya avatar Oct 17 '23 12:10 alijaya