HDK
|
#include <COP_ApexProgram.h>
Public Types | |
enum | SlapcompBuildStatus { FAIL = 0, REBUILD_NOT_NEEDED, SUCCESS } |
Public Member Functions | |
COP_ApexProgram () | |
~COP_ApexProgram () | |
bool | setOutputNode (COP_Block *output) |
bool | buildFromNode (COP_Block *output, const OP_Context &context, UT_ErrorManager &error) |
void | saveToGeometry (GU_Detail *gdp) const |
Saves the graph as geometry. More... | |
bool | loadFromGeometry (const GU_Detail *gdp) |
Loads a graph from geometry. More... | |
bool | saveToFile (const char *filename) const |
Saves the graph to a (geometry) file. More... | |
bool | loadFromFile (const char *filename) |
Loads the graph from a geometry file. More... | |
bool | setInputLayer (const UT_StringRef &name, const IMX_LayerConstPtr &layer) |
Binds an input to the program. More... | |
bool | setInputGeometry (const UT_StringRef &name, const GU_ConstDetailHandle &geo) |
bool | setInput (const UT_StringRef &name, const COP_PortData &input) |
void | runProgram (const OP_Context &context, UT_ErrorManager &error) |
Runs the program after the inputs have been bound. More... | |
IMX_LayerPtr | getOutputLayer (const UT_StringRef &name) const |
Extracts results after the program has executed. More... | |
GU_DetailHandle | getOutputGeometry (const UT_StringRef &name) const |
COP_PortData | getOutput (const UT_StringRef &name) const |
void | clearInputs () |
Clears all the graph inputs, letting go of the held references. More... | |
const UT_StringMap< std::pair < COP_Type, bool > > & | getProgramInputs () const |
const UT_StringMap< std::pair < COP_Type, UT_StringHolder > > & | getProgramOutputs () const |
bool | isUnusedInput (const UT_StringRef &name) const |
Returns true if the input of the given name exists but is not used. More... | |
bool | isUsedInput (const UT_StringRef &name) const |
DEP_TimedMicroNode & | getGraphDep () |
Returns the micronode that captures all dependencies for the program. More... | |
DEP_TimedMicroNode & | getResultsDep () |
void | enableCallback (bool enable) |
void | setCallback (void(*callback)(void *), void *data) |
SlapcompBuildStatus | rebuildIfNeeded (const OP_Context &context, UT_ErrorManager &error) |
bool | expectsLayerCameras () const |
COP_Block * | getOutputNode () const |
Returns the Block End node this program is built for. More... | |
bool | isOutputNodeSlapComp () const |
Returns if the block end is registered for a slapcomp. More... | |
Protected Member Functions | |
void | addBlockDeps (DEP_MicroNode &dep, COP_Block *begin, COP_Block *end) |
Protected Attributes | |
UT_UniquePtr< apex::APEX_Graph > | myGraph |
UT_StringMap< std::pair < COP_Type, bool > > | myProgramInputs |
Map of all inputs used by the program. More... | |
UT_StringMap< std::pair < COP_Type, bool > > | myUnusedInputs |
UT_StringMap< std::pair < COP_Type, UT_StringHolder > > | myProgramOutputs |
UT_StringMap< COP_PortData > | myPassthroughOutputs |
int | myOutputNodeId = -1 |
COP_MicroNodeWithCallback | myGraphDep |
COP_MicroNodeWithCallback | myResultsDep |
COP_MicroNodeWithCallback | myErroredMonitor |
bool | myExpectInputCameras = true |
This class creates an executable program out of a COP block. All parameters are evaluated and hardened in the graph.
Definition at line 74 of file COP_ApexProgram.h.
Enumerator | |
---|---|
FAIL | |
REBUILD_NOT_NEEDED | |
SUCCESS |
Definition at line 77 of file COP_ApexProgram.h.
COP_ApexProgram::COP_ApexProgram | ( | ) |
COP_ApexProgram::~COP_ApexProgram | ( | ) |
|
protected |
bool COP_ApexProgram::buildFromNode | ( | COP_Block * | output, |
const OP_Context & | context, | ||
UT_ErrorManager & | error | ||
) |
Builds an executable out of the block end node, containing everything up to its begin node.
void COP_ApexProgram::clearInputs | ( | ) |
Clears all the graph inputs, letting go of the held references.
|
inline |
When enabled, the registered callback is invoked whenever the program's results become out of date. Note that the callback may be invoked more than once when the results are dirtied!!!
Definition at line 162 of file COP_ApexProgram.h.
|
inline |
Returns true if the user should bind input layers that have correct camera metadata. If this is false, then the input layers are expected to use the default transformation.
Definition at line 188 of file COP_ApexProgram.h.
|
inline |
Returns the micronode that captures all dependencies for the program.
Definition at line 147 of file COP_ApexProgram.h.
COP_PortData COP_ApexProgram::getOutput | ( | const UT_StringRef & | name | ) | const |
GU_DetailHandle COP_ApexProgram::getOutputGeometry | ( | const UT_StringRef & | name | ) | const |
IMX_LayerPtr COP_ApexProgram::getOutputLayer | ( | const UT_StringRef & | name | ) | const |
Extracts results after the program has executed.
COP_Block* COP_ApexProgram::getOutputNode | ( | ) | const |
Returns the Block End node this program is built for.
|
inline |
Returns a map of all COP inputs to the program. Key of an input is its name, while the value is its expected type in the program.
Definition at line 128 of file COP_ApexProgram.h.
|
inline |
Returns a map of all COP outputs of the program. Key of an output is its name, while the value is its type in the program.
Definition at line 135 of file COP_ApexProgram.h.
|
inline |
Returns the micronode that captures all dynamic runtime dependencies from the previous program execution.
Definition at line 153 of file COP_ApexProgram.h.
bool COP_ApexProgram::isOutputNodeSlapComp | ( | ) | const |
Returns if the block end is registered for a slapcomp.
bool COP_ApexProgram::isUnusedInput | ( | const UT_StringRef & | name | ) | const |
Returns true if the input of the given name exists but is not used.
bool COP_ApexProgram::isUsedInput | ( | const UT_StringRef & | name | ) | const |
Returns true if the input of the given name exists and is used by the program.
bool COP_ApexProgram::loadFromFile | ( | const char * | filename | ) |
Loads the graph from a geometry file.
bool COP_ApexProgram::loadFromGeometry | ( | const GU_Detail * | gdp | ) |
Loads a graph from geometry.
SlapcompBuildStatus COP_ApexProgram::rebuildIfNeeded | ( | const OP_Context & | context, |
UT_ErrorManager & | error | ||
) |
Rebuilds the APEX graph if necessary and returns one of the above status codes.
void COP_ApexProgram::runProgram | ( | const OP_Context & | context, |
UT_ErrorManager & | error | ||
) |
Runs the program after the inputs have been bound.
bool COP_ApexProgram::saveToFile | ( | const char * | filename | ) | const |
Saves the graph to a (geometry) file.
Registers the callback that is to run when the program's results become out of date. Use enableCallback() to control whether or not the callback is forced to run. The data pointer is passed to the callback function when it executes. Note that the callback may be invoked more than once when the results are dirtied!!!
Definition at line 173 of file COP_ApexProgram.h.
bool COP_ApexProgram::setInput | ( | const UT_StringRef & | name, |
const COP_PortData & | input | ||
) |
bool COP_ApexProgram::setInputGeometry | ( | const UT_StringRef & | name, |
const GU_ConstDetailHandle & | geo | ||
) |
bool COP_ApexProgram::setInputLayer | ( | const UT_StringRef & | name, |
const IMX_LayerConstPtr & | layer | ||
) |
Binds an input to the program.
bool COP_ApexProgram::setOutputNode | ( | COP_Block * | output | ) |
Set the block end node for this program, without trying to rebuild. Returns false if output is a block begin node, in which case the output node (and the program as a whole) is unchanged.
|
protected |
This micronode is used only when the build fails. It gets notified when a relevant node is rewired or changed.
Definition at line 220 of file COP_ApexProgram.h.
|
protected |
This flag indicates to the user whether they should place the input layers at the correct 3D locations or use default transforms.
Definition at line 224 of file COP_ApexProgram.h.
|
protected |
Definition at line 202 of file COP_ApexProgram.h.
|
protected |
Definition at line 216 of file COP_ApexProgram.h.
|
protected |
Definition at line 215 of file COP_ApexProgram.h.
|
protected |
Mapping of bound passthrough outputs (by their name) to the bound input that they correspond to.
Definition at line 214 of file COP_ApexProgram.h.
|
protected |
Map of all inputs used by the program.
Definition at line 205 of file COP_ApexProgram.h.
|
protected |
Definition at line 211 of file COP_ApexProgram.h.
|
protected |
Definition at line 217 of file COP_ApexProgram.h.
|
protected |
Map of all inputs that are not used by the program. These are saved as they are part of the program's signature.
Definition at line 209 of file COP_ApexProgram.h.