SaintsField icon indicating copy to clipboard operation
SaintsField copied to clipboard

An attribute to Show/Hide/Enable/Disable an entire LayoutGroup

Open laurentopia opened this issue 1 year ago • 2 comments

I tried a few combination but they don't seem to work

laurentopia avatar Aug 12 '24 02:08 laurentopia

No at this point as ShowIf is only a PropertyDrawer which only works on a single field.

TylerTemp avatar Aug 19 '24 01:08 TylerTemp

np

laurentopia avatar Aug 19 '24 21:08 laurentopia

Hi,

this feature has been implemented in 3.7.0

using SaintsField.Playa;

public bool editableMain;
public bool visibleMain;

[LayoutEnableIf(nameof(editableMain))]
[LayoutShowIf(nameof(visibleMain))]
[LayoutStart("Main", ELayout.FoldoutBox)]
public bool editable1;
public bool visible1;

[LayoutEnableIf(nameof(editable1))]
[LayoutShowIf(nameof(visible1))]
[LayoutStart("./1", ELayout.FoldoutBox, marginBottom: 10)]
public int int1;
public string string1;

[LayoutStart("..", ELayout.FoldoutBox)]
public bool editable2;
public bool visible2;


[LayoutEnableIf(nameof(editable2))]
[LayoutShowIf(nameof(visible2))]
[LayoutStart("./2", ELayout.FoldoutBox)]
public int int2;
public string string2;

video

TylerTemp avatar Dec 08 '24 09:12 TylerTemp

Fantastic, I just removed a trove of individual HideIf with one for layout. So useful. I noticed that the lists ident well in your example. Is this because UITK moved the fold triangle inside the block? I suppose proper indentation in IMGUI is still not possible. image

laurentopia avatar Dec 20 '24 20:12 laurentopia

Yes, UI Toolkit got this issue fixed in 3.4.11, which has not been implemented in IMGUI yet. It'll be processed in the feature (but not sure when tho... depending on how much free time I got...)

TylerTemp avatar Dec 21 '24 05:12 TylerTemp