36 virtual void setViewport(
const OP_Node *node,
44 setViewport(
nullptr, ctx);
57 myEnableState =
false;
69 virtual void updateEnableState() = 0;
74 return getEnableState() && (hasStageFilters() || hasViewportFilters());
79 virtual bool hasStageFilters()
const = 0;
81 virtual bool hasViewportFilters()
const = 0;
83 virtual bool hasErrors()
const = 0;
88 virtual int getViewportTargetNode()
const = 0;
91 virtual void setErrorCallback(
void (*cb)(
void*,
const char*),
94 virtual void setWarningCallback(
void (*cb)(
void*,
const char*),
97 virtual void setRunCallback(
void (*cb)(
void*),
void *
data) = 0;
99 virtual void setUpdateCallback(
void (*cb)(
void*),
void *
data) = 0;
112 bool should_build=
true)
114 if (should_build && !build(input_fetcher, context))
116 runSlapCompImpl(input_fetcher, context);
136 getOutputStructure()
const = 0;
147 virtual bool hasStateChanged()
const = 0;
151 virtual void reportError(
const char *
message) = 0;
153 virtual void reportWarning(
const char *
message) = 0;
159 void (*myErrorCB)(
void*,
const char*) =
nullptr;
161 void *myErrorCBData =
nullptr;
163 void (*myWarningCB)(
void*,
const char*) =
nullptr;
165 void *myWarningCBData =
nullptr;
167 void (*myRunCB)(
void*) =
nullptr;
169 void *myRunCBData =
nullptr;
171 void (*myUpdateCB)(
void*) =
nullptr;
173 void *myUpdateCBData =
nullptr;
209 bool myEnableState =
true;
275 {
return myStateChanged; }
280 {
return myVersion; }
286 myCallbacks.myErrorCB = cb;
287 myCallbacks.myErrorCBData =
data;
293 myCallbacks.myWarningCB = cb;
294 myCallbacks.myWarningCBData =
data;
299 myCallbacks.myRunCB = cb;
300 myCallbacks.myRunCBData =
data;
305 myCallbacks.myUpdateCB = cb;
306 myCallbacks.myUpdateCBData =
data;
332 void reportOutputSizeErrors(
351 Callbacks myCallbacks;
void(* myUpdateCB)(void *)
Callback function for when the slapcomp program is updated.
GLuint GLsizei const GLchar * message
void * myErrorCBData
Data to send to the error reporting callback.
int getVersion(int version)
int getVersion() const override
Abstract interface for managing slapcomp.
IMX_LayerConstPtr myLayer
const COP_ApexProgram & getProgram(exint i=0) const
Get the managed slapcomp program.
virtual void reportWarning(const char *message)=0
Reports a warning (through the callback if possible).
void(* myWarningCB)(void *, const char *)
Callback function to report warnings to the outside world.
virtual COP_CableStructure getOutputStructure() const =0
Should return the outputs that this slapcomp produces.
virtual bool expectsLayerCameras() const
virtual IMX_LayerPtr getOutputLayer(const UT_StringHolder &name) const =0
Returns a particular output by name.
void(* myRunCB)(void *)
Callback function for when the slapcomp program is run.
virtual bool isSlapCompAOV(const UT_StringHolder &name) const =0
void * myUpdateCBData
Data to send to the update callback.
std::optional< T > UT_Optional
void setCallbacks(const Callbacks &cbs)
Set all callbacks using a struct.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
virtual bool hasStageFilters() const =0
Returns whether the viewport slapcomp is enabled.
virtual void updateEnableState()=0
Called when slapcomp is enabled disabled.
void setUpdateCallback(void(*cb)(void *), void *data) override
Sets a callback that gets called when the slapcomp program is updated.
virtual void setStage(const UT_Span< const int > &target_nodes, const OP_Context &)=0
Set the image filters defined on the USD Stage.
UT_SharedPtr< const IMX_Layer > IMX_LayerConstPtr
OPENVDB_API void setVersion(std::ios_base &, const VersionId &libraryVersion, uint32_t fileVersion)
Associate specific file format and library version numbers with the given stream. ...
virtual void runSlapCompImpl(COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context)=0
Should run slapcomp with the specified inputs and context.
virtual UT_Array< int > getStageTargetNodes() const =0
void setRunCallback(void(*cb)(void *), void *data) override
Sets a callback that gets called when the slapcomp program is run.
void * myWarningCBData
Data to send to the warning reporting callback.
void setErrorCallback(void(*cb)(void *, const char *), void *data) override
Sets a callback that gets called when reporting errors.
GLuint const GLchar * name
void(* myErrorCB)(void *, const char *)
Callback function to report errors to the outside world.
virtual void setViewport(const OP_Node *node, const OP_Context &ctx)=0
COP_SlapCompManager & operator=(const COP_SlapCompManager &)=delete
bool build(const COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context)
Prepares for applying slapcomp for the provided set of inputs.
GT_API const UT_StringHolder version
bool getEnableState() const
Returns the enable state.
COP_Type
Types of basic data that are passed around a COP network.
void setEnabled(bool state)
virtual void reportError(const char *message)=0
Reports an error (through the callback if possible).
void setVersion(int version) override
void * myRunCBData
Data to send to the run callback.
virtual bool buildForInputs(const COP_CableStructure &inputs, const OP_Context &context)=0
Prepares for applying slapcomp for inputs of the given types.
virtual int getViewportTargetNode() const =0
Return the viewport target node.
virtual bool hasViewportFilters() const =0
Returns whether the viewport slapcomp is enabled.
LeafData & operator=(const LeafData &)=delete
A global error manager scope.
bool isEnabled() const
Returns the on-off state of slapcomp.
bool hasErrors() const override
Returns true if the last run of slapcomp had errors.
bool hasStateChanged() const override
bool runSlapComp(COP_SlapCompInputFetcher &input_fetcher, const OP_Context &context, bool should_build=true)
void disable()
Disable all slapcomp.
UT_SharedPtr< IMX_Layer > IMX_LayerPtr
void clearAllFilters()
Clear all filters.
void setWarningCallback(void(*cb)(void *, const char *), void *data) override
Sets a callback that gets called when reporting warnings.