class MAGES::SceneGraph::Editor::SceneGraphView¶
Overview¶
The scene graph view. More…
class SceneGraphView: public UnityEditor.Experimental.GraphView.GraphView { public: // structs struct CachedConnection; // properties SceneGraphData DataAsset; string LastGeneralState; Action OnBecameDirty; bool IsRuntime; string SceneGraphDataPath; // methods SceneGraphView( SceneGraphData data, List<Error> errorList, Action onErrorsChanged ); SceneGraphView( GraphRunner runner, List<Error> errorList, Action onErrorsChanged ); override ListGetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter); void OpenStepsPanel(BaseActionData data, SerializedObject serializedObject); void OpenScriptsPanel(BaseActionData data, SerializedObject serializedObject); void OpenEffectsPanel(BaseActionData data, SerializedObject serializedObject); GraphElement LookupNode(BaseActionData data); void AddConnection(BaseActionData prev, BaseActionData next); void RemoveConnection(BaseActionData data, BaseActionData otherData); IActionImplementor CreateActionNode(System.Type type, Vector2 position); IActionImplementor CreateActionNode(BaseActionData data, Vector2 position); string GenerateNewActionName(string prepend = "New Action"); override void BuildContextualMenu(ContextualMenuPopulateEvent evt); };
Detailed Documentation¶
The scene graph view.
This class is responsible for the visual representation of the scene graph.
In the future, it would be beneficial to make a copy of the scene graph during edit time, only applying changes after saving.
Properties¶
SceneGraphData DataAsset
Gets the data asset.
string LastGeneralState
Gets the last general state of the scene graph view. This is used to restore the view when a panel is closed.
Action OnBecameDirty
Gets or sets the Action to invoke when graph becomes dirty.
bool IsRuntime
Gets a value indicating whether the graph is runtime.
string SceneGraphDataPath
Gets or sets the scene graph data path.
Methods¶
SceneGraphView( SceneGraphData data, List<Error> errorList, Action onErrorsChanged )
Initializes a new instance of the SceneGraphView class.
Parameters:
data |
The scene graph data. |
errorList |
The list of errors. |
onErrorsChanged |
The callback for when the errors change. |
SceneGraphView( GraphRunner runner, List<Error> errorList, Action onErrorsChanged )
Initializes a new instance of the SceneGraphView class, during runtime.
Parameters:
runner |
The runner. |
errorList |
The list of errors. |
onErrorsChanged |
The callback for when errors change. |
override ListGetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter)
Gets the compatible ports.
Parameters:
startPort |
Start port. |
nodeAdapter |
Adapter. |
Returns:
List of compatible ports.
void OpenStepsPanel(BaseActionData data, SerializedObject serializedObject)
Opens the steps panel.
Parameters:
data |
The action data. |
serializedObject |
The serialized object reference of the action data. |
void OpenScriptsPanel(BaseActionData data, SerializedObject serializedObject)
Opens the scripts panel.
Parameters:
data |
The action data. |
serializedObject |
The serialized object reference of the action data. |
void OpenEffectsPanel(BaseActionData data, SerializedObject serializedObject)
Opens the effects panel.
Parameters:
data |
The action data. |
serializedObject |
The serialized object reference of the action data. |
GraphElement LookupNode(BaseActionData data)
Find a node corresponding to the action data.
Parameters:
data |
The action data. |
Returns:
The graph element representing the data, if found.
void AddConnection(BaseActionData prev, BaseActionData next)
Adds a new connection between two action datas.
Parameters:
prev |
The previous node (input). |
next |
The next node (output). |
void RemoveConnection(BaseActionData data, BaseActionData otherData)
Removes a connection between two action datas.
Parameters:
data |
The first data. |
otherData |
The second data. |
IActionImplementor CreateActionNode(System.Type type, Vector2 position)
Create a new action node (not bound to an asset yet).
Parameters:
type |
The type of the action. Must be a subclass of BaseActionData. |
position |
The position of the node. |
Returns:
The node instance.
IActionImplementor CreateActionNode(BaseActionData data, Vector2 position)
Create a node from an exisiting action asset.
Parameters:
data |
The asset. |
position |
The position of the node. |
Returns:
The node instance.
string GenerateNewActionName(string prepend = "New Action")
Create a new action name that doesn’t clash with the existing actions.
Parameters:
prepend |
Default value: New Action. |
Returns:
The action name.