Skip to content

Add AddonFilter, AddonScreenFrame stuff - #1935

Merged
Haselnussbomber merged 1 commit into
aers:mainfrom
Zeffuro:addon-filters
Aug 27, 2026
Merged

Add AddonFilter, AddonScreenFrame stuff#1935
Haselnussbomber merged 1 commit into
aers:mainfrom
Zeffuro:addon-filters

Conversation

@Zeffuro

@Zeffuro Zeffuro commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Add structs and methods to use AddonFilter and AddonFilterSystem

ffxiv_dx11_2026-08-28_01-26-57.mp4

Here's a minimal way I used it for the demo.


using System;
using System.Numerics;
using FFXIVClientStructs.FFXIV.Component.GUI;
using KamiToolKit.BaseTypes;
using KamiToolKit.Nodes;

namespace ClientStructsTestbed.Addons;

public sealed unsafe class FilterTestAddon : NativeAddon
{
    protected override void OnSetup(AtkUnitBase* addon, Span<AtkValue> atkValueSpan)
    {
        base.OnSetup(addon, atkValueSpan);

        new TextButtonNode
        {
            Position = this.ContentStartPosition + new Vector2(20.0f, 20.0f),
            Size = new Vector2(170.0f, 32.0f),
            String = "Open Modal Dialogue",
            OnClick = PluginState.FilterDialogueAddon.Open,
        }.AttachNode(this);
    }

    protected override void OnFinalize(AtkUnitBase* addon)
    {
        PluginState.FilterDialogueAddon.Close();
        base.OnFinalize(addon);
    }
}
using System;
using System.Numerics;
using FFXIVClientStructs.FFXIV.Component.GUI;
using KamiToolKit.BaseTypes;
using KamiToolKit.Nodes;

namespace ClientStructsTestbed.Addons;

public sealed unsafe class FilterDialogueAddon : NativeAddon
{
    protected override void OnSetup(AtkUnitBase* addon, Span<AtkValue> atkValueSpan)
    {
        base.OnSetup(addon, atkValueSpan);

        new TextNode
        {
            Position = this.ContentStartPosition + new Vector2(10.0f, 15.0f),
            Size = new Vector2(this.ContentSize.X - 20.0f, 40.0f),
            AlignmentType = AlignmentType.Center,
            String = "Only this dialogue should accept input.",
        }.AttachNode(this);

        new TextButtonNode
        {
            Position = this.ContentStartPosition + new Vector2((this.ContentSize.X - 120.0f) / 2.0f, 65.0f),
            Size = new Vector2(120.0f, 30.0f),
            String = "Close",
            OnClick = this.Close,
        }.AttachNode(this);

        AcquireInputFilter(addon);
    }

    protected override void OnFinalize(AtkUnitBase* addon)
    {
        ReleaseInputFilter(addon);
        base.OnFinalize(addon);
    }

    private static void AcquireInputFilter(AtkUnitBase* addon)
    {
        var stage = AtkStage.Instance();
        stage->Filter.AcquireFilter(addon);
        stage->Filter.SetAdditionalFilterAddon(addon);

        var manager = (AtkUnitManager*)stage->RaptureAtkUnitManager;
        var filter = (AtkUnitBase*)manager->AddonFilter;
        if (filter->DepthLayer == addon->DepthLayer)
        {
            manager->SetAddonOrderAfter(addon, filter, false);
        }
        else
        {
            manager->SetAddonDepthLayerAndOrder(filter, addon->DepthLayer, addon->Id, 0);
        }

        manager->UpdateDrawOrderIndexes();
    }

    private static void ReleaseInputFilter(AtkUnitBase* addon)
    {
        var stage = AtkStage.Instance();
        stage->Filter.ClearAdditionalFilterAddon(addon);
        stage->Filter.ReleaseFilter(addon);
    }
}

AI was used for some of the descriptions/summaries.

@Haselnussbomber
Haselnussbomber merged commit 13eb752 into aers:main Aug 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants