HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP_SlapCompDispatcher Class Reference

#include <COP_SlapCompDispatcher.h>

+ Inheritance diagram for COP_SlapCompDispatcher:

Public Types

using Callbacks = COP_SlapCompManager::Callbacks
 
using CheckFunction = bool(*)(const OP_Node *)
 Should return true for nodes that are supported by the slapcomp type. More...
 
using AllocationFunction ) = COP_SlapCompManager *(*)(
 

Public Member Functions

 COP_SlapCompDispatcher ()
 
 COP_SlapCompDispatcher (const COP_SlapCompDispatcher &)=delete
 
 COP_SlapCompDispatcher (COP_SlapCompDispatcher &&)
 
COP_SlapCompDispatcheroperator= (const COP_SlapCompDispatcher &)=delete
 
COP_SlapCompDispatcheroperator= (COP_SlapCompDispatcher &&)
 
void copyFrom (const COP_SlapCompDispatcher &other, const OP_Context &context)
 Makes this object a copy of other, including the enable state. More...
 
void setStage (const UT_Span< const int > &node_ids, const OP_Context &) override
 Set the image filters defined on the USD Stage. More...
 
void setViewport (const OP_Node *cop, const OP_Context &) override
 
bool hasStageFilters () const override
 Returns whether the viewport slapcomp is enabled. More...
 
bool hasViewportFilters () const override
 Returns whether the viewport slapcomp is enabled. More...
 
void updateEnableState () override
 Called when slapcomp is enabled disabled. More...
 
bool hasErrors () const override
 Returns true if the last run of slapcomp had errors. More...
 
UT_Array< intgetStageTargetNodes () const override
 
int getViewportTargetNode () const override
 Return the viewport target node. More...
 
void setErrorCallback (void(*cb)(void *, const char *), void *data) override
 Sets a callback that gets called when reporting slapcomp errors. More...
 
void setWarningCallback (void(*cb)(void *, const char *), void *data) override
 Sets a callback that gets called when reporting slapcomp warnings. More...
 
void setRunCallback (void(*cb)(void *), void *data) override
 Sets a callback that gets called when slapcomp is run. More...
 
void setUpdateCallback (void(*cb)(void *), void *data) override
 Sets a callback that gets called when slapcomp changes. More...
 
bool isSlapCompAOV (const UT_StringHolder &name) const override
 
bool buildForInputs (const COP_CableStructure &inputs, const OP_Context &context) override
 Prepares for applying slapcomp for inputs of the given types. More...
 
void runSlapCompImpl (COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context) override
 Should run slapcomp with the specified inputs and context. More...
 
COP_CableStructure getOutputStructure () const override
 Should return the outputs that this slapcomp produces. More...
 
IMX_LayerPtr getOutputLayer (const UT_StringHolder &name) const override
 Returns a particular output by name. More...
 
int getVersion () const override
 
bool hasStateChanged () const override
 
void setVersion (int version) override
 
- Public Member Functions inherited from COP_SlapCompManager
 COP_SlapCompManager ()=default
 
 COP_SlapCompManager (const COP_SlapCompManager &)=delete
 
 COP_SlapCompManager (COP_SlapCompManager &&)=default
 
COP_SlapCompManageroperator= (const COP_SlapCompManager &)=delete
 
COP_SlapCompManageroperator= (COP_SlapCompManager &&)=default
 
virtual ~COP_SlapCompManager ()=default
 
void clearAllFilters ()
 Clear all filters. More...
 
void enable ()
 
void disable ()
 Disable all slapcomp. More...
 
void setEnabled (bool state)
 
bool isEnabled () const
 Returns the on-off state of slapcomp. More...
 
bool getEnableState () const
 Returns the enable state. More...
 
virtual bool expectsLayerCameras () const
 
bool runSlapComp (COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context, bool should_build=true)
 
bool build (const COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context)
 Prepares for applying slapcomp for the provided set of inputs. More...
 
UT_StringMap< OutputgetOutputs () const
 
void setCallbacks (const Callbacks &cbs)
 Set all callbacks using a struct. More...
 

Static Public Member Functions

static void installFactory (CheckFunction checker, AllocationFunction allocator)
 

Protected Member Functions

void reportError (const char *message) override
 Reports an error (through the callback if possible). More...
 
void reportWarning (const char *message) override
 Reports a warning (through the callback if possible). More...
 
void clearManager ()
 
- Protected Member Functions inherited from COP_SlapCompManager
void reportAllErrorManagerErrors (const UT_ErrorManager &)
 Relays all warnings and messages from the error manager. More...
 

Protected Attributes

Callbacks myCallbacks
 
UT_UniquePtr< COP_SlapCompManagermyManager
 
int myCurrentType = -1
 
int myVersion = 0
 

Detailed Description

This class is a polymorphic slapcomp manager that can be used to interface with different types of slapcomps. To this end, a factory must be registered with the static installFactory() method, with a checker and an allocator. When a manager gets enabled with a specific node, the first factory (i.e. one registered earliest) whose check the node passes will be used to run it.

Definition at line 19 of file COP_SlapCompDispatcher.h.

Member Typedef Documentation

using COP_SlapCompDispatcher::AllocationFunction = COP_SlapCompManager* (*)(

Should dynamically allocate a new slapcomp manager for the slapcomp type.

Definition at line 28 of file COP_SlapCompDispatcher.h.

Should return true for nodes that are supported by the slapcomp type.

Definition at line 25 of file COP_SlapCompDispatcher.h.

Constructor & Destructor Documentation

COP_SlapCompDispatcher::COP_SlapCompDispatcher ( )
inline

Definition at line 49 of file COP_SlapCompDispatcher.h.

COP_SlapCompDispatcher::COP_SlapCompDispatcher ( const COP_SlapCompDispatcher )
delete
COP_SlapCompDispatcher::COP_SlapCompDispatcher ( COP_SlapCompDispatcher &&  )

Member Function Documentation

bool COP_SlapCompDispatcher::buildForInputs ( const COP_CableStructure inputs,
const OP_Context context 
)
overridevirtual

Prepares for applying slapcomp for inputs of the given types.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::clearManager ( )
protected
void COP_SlapCompDispatcher::copyFrom ( const COP_SlapCompDispatcher other,
const OP_Context context 
)

Makes this object a copy of other, including the enable state.

IMX_LayerPtr COP_SlapCompDispatcher::getOutputLayer ( const UT_StringHolder name) const
overridevirtual

Returns a particular output by name.

Implements COP_SlapCompManager.

COP_CableStructure COP_SlapCompDispatcher::getOutputStructure ( ) const
overridevirtual

Should return the outputs that this slapcomp produces.

Implements COP_SlapCompManager.

UT_Array<int> COP_SlapCompDispatcher::getStageTargetNodes ( ) const
overridevirtual

Return target nodes the slapcomp programs this was built for (typically size==1, but may be mode if there are chained programs).

Implements COP_SlapCompManager.

int COP_SlapCompDispatcher::getVersion ( ) const
inlineoverridevirtual

Returns a version number, which is incremented every time the program is rebuilt.

Implements COP_SlapCompManager.

Definition at line 84 of file COP_SlapCompDispatcher.h.

int COP_SlapCompDispatcher::getViewportTargetNode ( ) const
overridevirtual

Return the viewport target node.

Implements COP_SlapCompManager.

bool COP_SlapCompDispatcher::hasErrors ( ) const
overridevirtual

Returns true if the last run of slapcomp had errors.

Implements COP_SlapCompManager.

bool COP_SlapCompDispatcher::hasStageFilters ( ) const
overridevirtual

Returns whether the viewport slapcomp is enabled.

Implements COP_SlapCompManager.

bool COP_SlapCompDispatcher::hasStateChanged ( ) const
inlineoverridevirtual

Returns true if the last attempted application of slapcomp may have changed the possible outputs. This flag is is reset before each application of slapcomp.

Implements COP_SlapCompManager.

Definition at line 90 of file COP_SlapCompDispatcher.h.

bool COP_SlapCompDispatcher::hasViewportFilters ( ) const
overridevirtual

Returns whether the viewport slapcomp is enabled.

Implements COP_SlapCompManager.

static void COP_SlapCompDispatcher::installFactory ( CheckFunction  checker,
AllocationFunction  allocator 
)
static

Call this function to register a slapcomp factory. The checker function should return true for a node if that slapcomp manager should be used for it.

bool COP_SlapCompDispatcher::isSlapCompAOV ( const UT_StringHolder name) const
overridevirtual

Returns true if the slapcomp program ouputs an AOV with the given name. Should accept "color" as an alias for the "C" AOV.

Implements COP_SlapCompManager.

COP_SlapCompDispatcher& COP_SlapCompDispatcher::operator= ( const COP_SlapCompDispatcher )
delete
COP_SlapCompDispatcher& COP_SlapCompDispatcher::operator= ( COP_SlapCompDispatcher &&  )
void COP_SlapCompDispatcher::reportError ( const char *  message)
overrideprotectedvirtual

Reports an error (through the callback if possible).

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::reportWarning ( const char *  message)
overrideprotectedvirtual

Reports a warning (through the callback if possible).

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::runSlapCompImpl ( COP_SlapCompInputFetcher input_fetcher,
const OP_Context context 
)
overridevirtual

Should run slapcomp with the specified inputs and context.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setErrorCallback ( void(*)(void *, const char *)  cb,
void data 
)
overridevirtual

Sets a callback that gets called when reporting slapcomp errors.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setRunCallback ( void(*)(void *)  cb,
void data 
)
overridevirtual

Sets a callback that gets called when slapcomp is run.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setStage ( const UT_Span< const int > &  target_nodes,
const OP_Context  
)
overridevirtual

Set the image filters defined on the USD Stage.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setUpdateCallback ( void(*)(void *)  cb,
void data 
)
overridevirtual

Sets a callback that gets called when slapcomp changes.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setVersion ( int  version)
inlineoverridevirtual

This should really be private, but due to difficult visibility rules, we just settle for this... This should only be called by higher-level managers that interface with other managers.

Implements COP_SlapCompManager.

Definition at line 98 of file COP_SlapCompDispatcher.h.

void COP_SlapCompDispatcher::setViewport ( const OP_Node node,
const OP_Context ctx 
)
overridevirtual

Set the image filter from the viewport control (which gets applied after the stage filters)

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::setWarningCallback ( void(*)(void *, const char *)  cb,
void data 
)
overridevirtual

Sets a callback that gets called when reporting slapcomp warnings.

Implements COP_SlapCompManager.

void COP_SlapCompDispatcher::updateEnableState ( )
overridevirtual

Called when slapcomp is enabled disabled.

Implements COP_SlapCompManager.

Member Data Documentation

Callbacks COP_SlapCompDispatcher::myCallbacks
protected

Definition at line 110 of file COP_SlapCompDispatcher.h.

int COP_SlapCompDispatcher::myCurrentType = -1
protected

Definition at line 112 of file COP_SlapCompDispatcher.h.

UT_UniquePtr<COP_SlapCompManager> COP_SlapCompDispatcher::myManager
protected

Definition at line 111 of file COP_SlapCompDispatcher.h.

int COP_SlapCompDispatcher::myVersion = 0
protected

Definition at line 119 of file COP_SlapCompDispatcher.h.


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