Open 3D Engine Atom Gem API Reference 24.09.2
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AtomToolsFramework::GraphCompiler Class Reference

#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.
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static bool IsCompileLoggingEnabled ()
 Returns the value of a registry setting that enables or disables verbose logging for the compilation process.
 

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< Statem_state = State::Idle
 
StateChangeHandler m_stateChangeHandler
 
const AZ::Uuid m_assetReportRequestId = AZ::Uuid::CreateRandom()
 

Detailed Description

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.

Member Function Documentation

◆ CompileGraph()

virtual bool AtomToolsFramework::GraphCompiler::CompileGraph ( GraphModel::GraphPtr graph,
const AZStd::string & graphName,
const AZStd::string & graphPath )
virtual

Dysfunction initiates and executes the graph compile, changing states accordingly.

Reimplemented in MaterialCanvas::MaterialGraphCompiler, and PassCanvas::PassGraphCompiler.

◆ GetGraphPath()

virtual AZStd::string AtomToolsFramework::GraphCompiler::GetGraphPath ( ) const
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.

◆ Reset()

virtual bool AtomToolsFramework::GraphCompiler::Reset ( )
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.


The documentation for this class was generated from the following file: