interface MAGES::SceneGraph::Editor::IActionImplementor

Overview

The interface for action implementors in the scene graph view. More…

interface IActionImplementor
{
    // properties

    string Identifier;
    string Title;
    string Name;
    bool HasUnsavedChanges;
    bool Deleted;
    bool HasAnyIncomingConnections;
    bool BoundToAsset;
    SceneGraphView View;
    Port InActionPort;
    Port OutActionPort;
    VisualElement InputContainer;
    VisualElement OutputContainer;
    BaseActionData ActionData;
    SerializedObject SerializedData;
    System.Action> OnCanonicalInputChanged;

    // methods

    void Initialize(
        System.Type actionType,
        BaseActionData data,
        System.Action onNameChanged,
        string name
    );

    void OnConnectionCreated(Port thisPort, Port otherPort, GraphElement other);
    void OnConnectionRemoved(Port thisPort, Port otherPort, GraphElement other);
    void OnRemoved();
    void Save(string path);

    void Restore(
        Func<BaseActionData, GraphElement> lookup,
        Action addEdge
    );

    void SetRuntimeControlsEnalbed(
        bool enabled,
        Action performAction,
        Action undoAction
    );

    void SetPosition(Rect newPosition);
};

// direct descendants

class BaseActionNode;
class BaseNode;
class RepeatNode;
class ScopeNode;

Detailed Documentation

The interface for action implementors in the scene graph view.

Properties

string Identifier

Gets the identifier of the node.

string Title

Gets or sets the title.

string Name

Gets or sets the name.

bool HasUnsavedChanges

Gets a value indicating whether this instance has unsaved changes.

bool Deleted

Gets or sets a value indicating whether this IActionImplementor is deleted.

bool HasAnyIncomingConnections

Gets a value indicating whether this instance has any incoming connections.

bool BoundToAsset

Gets or sets a value indicating whether this instance has been bound to an asset (in other words, if it was created in this editing session or not).

SceneGraphView View

Gets or sets the parent scene graph view.

Port InActionPort

Gets the input port.

Port OutActionPort

Gets the output port.

VisualElement InputContainer

Gets the input port container.

VisualElement OutputContainer

Gets the output port container.

BaseActionData ActionData

Gets the action data.

SerializedObject SerializedData

Gets the serialized data.

System.Action> OnCanonicalInputChanged

Sets the action to be called when the canonical input port of of this implementor changes.

This method should be passed the list of all actions that are connected to the canonical input port.

Methods

void Initialize(
    System.Type actionType,
    BaseActionData data,
    System.Action onNameChanged,
    string name
)

Initialize the implementor.

Parameters:

actionType

The type of the action.

data

The action data (if available).

onNameChanged

The callback to invoke when the name of the node is changed.

name

The initial name of the node.

void OnConnectionCreated(Port thisPort, Port otherPort, GraphElement other)

Called when a connection is created.

Parameters:

thisPort

The port belonging to this node.

otherPort

The port belonging to the other node.

other

The other node (can be a scope, or BaseNode).

void OnConnectionRemoved(Port thisPort, Port otherPort, GraphElement other)

Called when a connection is deleted.

Parameters:

thisPort

The port belonging to this node.

otherPort

The port belonging to the other node.

other

The other node (can be a scope, or BaseNode).

void OnRemoved()

Called before this node is removed.

void Save(string path)

Save the node to a serialized state.

Parameters:

path

The path where the node should be saved.

void Restore(
    Func<BaseActionData, GraphElement> lookup,
    Action addEdge
)

Restore the node from a serialized state.

Parameters:

lookup

Used to match action data’s to nodes.

addEdge

Used to add edges between nodes.

void SetRuntimeControlsEnalbed(
    bool enabled,
    Action performAction,
    Action undoAction
)

Set the runtime controls enabled state.

Parameters:

enabled

Whether the controls should be visible.

performAction

Action to be called when a perform button is pressed.

undoAction

Action to be called when an undo button is pressed.

void SetPosition(Rect newPosition)

Set the position of the node.

Parameters:

newPosition

The new position.