Beispiel #1
0
 /// <summary>
 /// Creates a new variable declaration in the graph.
 /// </summary>
 /// <param name="self">The graph to add a variable declaration to.</param>
 /// <param name="variableDataType">The type of data the new variable declaration to create represents.</param>
 /// <param name="variableName">The name of the new variable declaration to create.</param>
 /// <param name="modifierFlags">The modifier flags of the new variable declaration to create.</param>
 /// <param name="isExposed">Whether the variable is exposed externally or not.</param>
 /// <param name="initializationModel">The initialization model of the new variable declaration to create. Can be <code>null</code>.</param>
 /// <param name="guid">The SerializableGUID to assign to the newly created item.</param>
 /// <param name="initializationCallback">An initialization method to be called right after the variable declaration is created.</param>
 /// <param name="spawnFlags">The flags specifying how the variable declaration is to be spawned.</param>
 /// <typeparam name="TDeclType">The type of variable declaration to create.</typeparam>
 /// <returns>The newly created variable declaration.</returns>
 public static TDeclType CreateGraphVariableDeclaration <TDeclType>(this IGraphModel self, TypeHandle variableDataType,
                                                                    string variableName, ModifierFlags modifierFlags, bool isExposed, IConstant initializationModel = null,
                                                                    SerializableGUID guid = default, Action <TDeclType, IConstant> initializationCallback = null,
                                                                    SpawnFlags spawnFlags = SpawnFlags.Default)
     where TDeclType : class, IVariableDeclarationModel
 {
     return((TDeclType)self.CreateGraphVariableDeclaration(typeof(TDeclType), variableDataType, variableName,
                                                           modifierFlags, isExposed, initializationModel, guid, (d, c) => initializationCallback?.Invoke((TDeclType)d, c), spawnFlags));
 }