class MAGES::SceneGraph::ActionFactory

Overview

A factory for creating actions for a specific graph. More…

class ActionFactory
{
public:
    // methods

    static bool InvokeInitialize(
        BaseActionData data,
        Action trigger,
        GraphRunner runner
    );

    static bool InvokeUndo(BaseActionData data);
    static void InvokeWriteDefaults(BaseActionData data);
    static BaseActionData CreateAction(System.Type actionType);
    virtual void WriteDefaults(BaseActionData data);

    virtual abstract bool Initialize(
        BaseActionData data,
        Action trigger,
        GraphRunner runner
    ) = 0;

    virtual bool Undo(BaseActionData data);
};

// direct descendants

class Factory;
class Factory;
class Factory;
class Factory;
class Factory;
class Factory;
class Factory;
class Factory;
class Factory;

Detailed Documentation

A factory for creating actions for a specific graph.

To create a factory, add it as a nested class inside of the corresponding action data class.

Methods

static bool InvokeInitialize(
    BaseActionData data,
    Action trigger,
    GraphRunner runner
)

Shortcut to invoke Initialize(BaseActionData, Action, GraphRunner).

Parameters:

data

The data.

trigger

The trigger.

runner

The graph runner.

Returns:

True on success, false otherwise.

static bool InvokeUndo(BaseActionData data)

Shortcut to invoke Undo(BaseActionData).

Parameters:

data

The data.

Returns:

True on success, false otherwise.

static void InvokeWriteDefaults(BaseActionData data)

Shortcut to invoke WriteDefaults(BaseActionData).

Parameters:

data

The data.

static BaseActionData CreateAction(System.Type actionType)

Create an action of type actionType.

Parameters:

actionType

The action type.

System.ArgumentException

Thrown if the type argument is not a subclass of BaseActionData.

Returns:

The new instance of the action object.

virtual void WriteDefaults(BaseActionData data)

Write the default values for the action data.

Parameters:

data

The action data.

virtual abstract bool Initialize(
    BaseActionData data,
    Action trigger,
    GraphRunner runner
) = 0

Initialize the action based on data.

Parameters:

data

The data.

trigger

Invoke this action to move to the next one.

runner

The graph runner.

Returns:

Whether (or not) the action was properly initialized.

virtual bool Undo(BaseActionData data)

Undo the action data.

Parameters:

data

The action data.

Returns:

Whether (or not) the action was properly undone.