You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Nodes can now be implemented by arbitary C# methods. Graph structure is specified through expression trees implemented using Bg* types, which are not substituted with values until execution time. Doing so allows determination of node and option dependencies for a particular target, allowing us to generate dynamic UI for presenting relevant settings to the user. Includes partial implementation of Installed Build script as an example implementation. #preflight 61bb85d46c2686e86322eec9 [CL 18477305 by Ben Marsh in ue5-main branch]
70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using EpicGames.BuildGraph.Expressions;
|
|
using EpicGames.Core;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace EpicGames.BuildGraph
|
|
{
|
|
/// <summary>
|
|
/// Context object used for evaluating expressions
|
|
/// </summary>
|
|
public class BgExprContext
|
|
{
|
|
/// <summary>
|
|
/// Command line options for the graph
|
|
/// </summary>
|
|
public Dictionary<string, string> Options = new Dictionary<string, string>();
|
|
|
|
/// <summary>
|
|
/// Map from tag name to fileset
|
|
/// </summary>
|
|
public Dictionary<string, FileSet> TagNameToFileSet = new Dictionary<string, FileSet>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base class for computable expressions
|
|
/// </summary>
|
|
public interface IBgExpr
|
|
{
|
|
/// <summary>
|
|
/// Compute the value of this expression
|
|
/// </summary>
|
|
/// <param name="Context"></param>
|
|
object Compute(BgExprContext Context);
|
|
|
|
/// <summary>
|
|
/// Helper method to create an expression which formats this expression as a string
|
|
/// </summary>
|
|
BgString ToBgString();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Interface for a computable expression.
|
|
/// </summary>
|
|
public interface IBgExpr<TExpr> : IBgExpr
|
|
{
|
|
/// <summary>
|
|
/// Chooses between the current value and another value based on a condition
|
|
/// </summary>
|
|
/// <param name="Condition">The condition to evaluate</param>
|
|
/// <param name="ValueIfTrue">Value to return if the condition is true</param>
|
|
TExpr IfThen(BgBool Condition, TExpr ValueIfTrue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sentinel expression node which can be assigned different values
|
|
/// </summary>
|
|
/// <typeparam name="TExpr">The expression type</typeparam>
|
|
public interface IBgExprVariable<TExpr> where TExpr : IBgExpr<TExpr>
|
|
{
|
|
/// <summary>
|
|
/// The current value of the variable
|
|
/// </summary>
|
|
TExpr Value { get; set; }
|
|
}
|
|
}
|