Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo break dynamic output #203

Open
fractalisstudio opened this issue Feb 2, 2022 · 0 comments
Open

Undo break dynamic output #203

fractalisstudio opened this issue Feb 2, 2022 · 0 comments

Comments

@fractalisstudio
Copy link

fractalisstudio commented Feb 2, 2022

When doing Undo command i lose most of my outputs edges on my custom nodes (on any graph). Am pretty sure my code is the issue (my method may be outdated) but just and case i will post a issues.

Here how most of my dynamic outputs are done

    public virtual IEnumerable<PortData> ListPortBehavior(List<SerializableEdge> edges)
    {
        int outputPortCount = Mathf.Max(1, edges.Count + 1);

        for (int i = 0; i < outputPortCount; i++)
        {
            yield return new PortData
            {
                displayName = "child " + i,
                displayType = typeof(BehaviorTreeLink),
                identifier = i.ToString(), // Must be unique
                vertical = true,
            };
        }
    }

And and class NodeView i do

    //Work around
    public override void Enable()
    {
        nodeTarget.onAfterEdgeConnected += OnStructuralChange;
        nodeTarget.onAfterEdgeDisconnected += OnStructuralChange;
    }

    void OnStructuralChange(SerializableEdge _) => ForceUpdatePorts();
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

No branches or pull requests

1 participant