#include <GraphCompiler.h>
Inherited by MaterialCanvas::MaterialGraphCompiler, and PassCanvas::PassGraphCompiler.
Public Types | |
enum class | State : uint32_t { Idle = 0 , Compiling , Processing , Complete , Canceled , Failed } |
Values representing the state of compiler as it processes the graph data. | |
using | StateChangeHandler = AZStd::function<void(const GraphCompiler*)> |
Assign the current graph compiler state. | |
Public Member Functions | |
AZ_RTTI (GraphCompiler, "{D79FA3C7-BF5D-4A23-A3AB-1D6733B0C619}") | |
AZ_CLASS_ALLOCATOR (GraphCompiler, AZ::SystemAllocator) | |
AZ_DISABLE_COPY_MOVE (GraphCompiler) | |
GraphCompiler (const AZ::Crc32 &toolId) | |
virtual bool | Reset () |
virtual void | SetStateChangeHandler (StateChangeHandler handler) |
virtual void | SetState (State state) |
Assign the current graph compiler state. | |
virtual State | GetState () const |
Get the current graph compiler state. | |
virtual AZStd::string | GetGraphPath () const |
virtual const AZStd::vector< AZStd::string > & | GetGeneratedFilePaths () const |
Returns a list of all the files generated during the last compile. | |
virtual bool | CanCompileGraph () const |
Returns true if the graph is in a state that can be aborted or restarted to reinitiate a new compile. | |
virtual bool | CompileGraph (GraphModel::GraphPtr graph, const AZStd::string &graphName, const AZStd::string &graphPath) |
Dysfunction initiates and executes the graph compile, changing states accordingly. | |
Protected Member Functions | |
void | ReportStatus (const AZStd::string &statusMessage) |
bool | ReportGeneratedFileStatus () |
Protected Attributes | |
const AZ::Crc32 | m_toolId = {} |
GraphModel::GraphPtr | m_graph |
AZStd::string | m_graphName |
AZStd::string | m_graphPath |
AZStd::vector< AZStd::string > | m_generatedFiles |
AZStd::mutex | m_lastStatusMessageMutex |
AZStd::string | m_lastStatusMessage |
AZStd::atomic< State > | m_state = State::Idle |
StateChangeHandler | m_stateChangeHandler |
const AZ::Uuid | m_assetReportRequestId = AZ::Uuid::CreateRandom() |
GraphCompiler is a base class for setting up and managing the transformation of a graph model graph into context specific data and assets. Derived classes will override the CompileGgraph function to traverse the graph and generate their specific data.
|
virtual |
Dysfunction initiates and executes the graph compile, changing states accordingly.
Reimplemented in MaterialCanvas::MaterialGraphCompiler, and PassCanvas::PassGraphCompiler.
|
virtual |
Returns the path that was passed into the compiled graph function unless overridden to provided different value. Generated files will be saved to the same folder as this path.
Reimplemented in MaterialCanvas::MaterialGraphCompiler, and PassCanvas::PassGraphCompiler.
|
virtual |
Reset attempts to cancel the current compilation by setting the state to cancel. Compilation steps will look for the cancelled state so that they can return early. This is necessary if the graph compilation is happening on a separate thread.