OmniOperation#

Fully qualified name: usd_optimize::OmniOperation

class OmniOperation : public usd_optimize::Operation#

OmniMesh Operation.

Derived operation that creates a TBB pipeline to read USD data, perform an omni mesh operation on it, and then author it back to a stage.

Wraps up the TBB pipeline handling in to a single place so the omni plugins can be simpler, only really needing to implement their primary logic.

Public Functions

OmniOperation(
const std::string &name,
const std::string &displayName,
const std::string &description,
)#

Standard Constructor.

Parameters:
  • name – The internal name of the operation

  • displayName – The display name of the operation

  • description – A description of what the operation does

~OmniOperation() override#
virtual OperationResult execute(
ExecutionContext *context,
const PXR_NS::JsObject &args,
)#

Public entry point to tell an operation to do its thing.

std::string getName() const#

Get the name of this operation.

std::string getDisplayName() const#

Get the display name of this operation.

virtual std::string getDisplayGroup() const#

An optional UI grouping for the operation.

std::string getDescription() const#

Get the description of this plugin.

virtual std::string getDocumentation() const#

Returns the full documentation for this operation. If this is not overridden by the plugin, it will return the same string as getDescription().

virtual std::string getAuthor() const = 0#

Get the author of this operation.

virtual UsdOptimizePluginVersion getVersion() const = 0#
virtual std::string getCategory() const = 0#
virtual bool getVisible() const#

Returns whether this operation is visible.

This function has no effect internally, it is intended for a user interface to be able to hide an operation. Plugins can override this function to return false if necessary.

Returns:

Whether the operation is visible to the user interface

virtual bool getSupportsAnalysis() const#

Returns whether this operation supports analysis mode.

ExecutionContext *getContext() const#

Get the execution context.

PXR_NS::UsdStageWeakPtr getUsdStage() const#

Get the USD Stage that has been set on this operation.

std::shared_ptr<Report> getReport() const#

Get the Report object.

const Argument *getArgument(const std::string &name) const#

Get a specific argument.

std::vector<const Argument*> getArgs() const#

Get the arguments for this operation.

template<typename T>
inline Argument &addArgument(
const std::string &name,
const std::string &displayName,
const std::string &displayType,
const std::string &description,
T &target,
)#

Add an argument to this operation.

Adds an argument to the operation. A reference to the argument is returned so that any of the less common settings can be configured afterwards.

template<class ...Args>
inline Group &addGroup(
const std::string &name,
Args&&... args,
)#

Create a group of arguments.

Creates a series of arguments that should be grouped together e.g. in a UI. The group itself can have its own conditional expression to save having to specify it per argument.

Example usage:

addGroup("myGroup",
         addArgument(...),
         addArgument(...)
).setVisibleIf(...);

Groups will be returned from Operation::getArgs, and will be ordered prior to their children. You can use Argument::getIsGroup to check if an argument is a group.

virtual void setUserData(void *userData)#

Set custom user data for this operation.

This function can be used to let operations communicate with each other in a basic way. The data is operation specific.

Parameters:

userData – Plugin-specific user data

Public Static Functions

static void log(int32_t level, const char *fmt, ...)#

Entry point for the USD_OPTIMIZE_LOG_X macros. Generally you don’t need to call this function directly.

Parameters:
  • level – The level. See carb::logging::kLevelVerbose etc.

  • fmt – The format string

Protected Functions

virtual bool meshesOnly()#

Used for the call to _resolveExpressionsToPrims (to get the prims to operate on)

virtual PXR_NS::Usd_PrimFlagsPredicate primFlagsPredicate() const#

The predicate used to resolve prim expressions in executeImpl()

virtual ResolveFilter resolveFilter()#

The resolve filter to use for prims to process.

virtual OperationResult executePre()#

Called prior to the TBB pipeline, to allow a class to do any last minute setup.

virtual void preProcessPrims(std::vector<PXR_NS::UsdPrim>&)#

Called after executePre, to allow a class to filter and/or mutate the input prims.

virtual void executePost(const TotalStats &totalStats)#

Called after the pipeline is finished, so cleanup can be done or stats can be printed. The default implementation just prints out the values in totalStats.

virtual OperationResult executeImpl() override#

Standard Usd Optimize operation entry point.

virtual ProcessedData *processMesh(
const PXR_NS::UsdPrim &prim,
tbb::task_group_context &taskGroupContext,
) = 0#

Derived Omni operations must implement this function.

This function can be called on multiple threads.

Parameters:
  • prim – The USD prim to process

  • taskGroupContext – TBB task group for execution control

Argument &addArgument(Argument *arg)#

Adds the given Argument to this Operation.

Note

The Operation will take ownership of the Argument after this function has been called

Returns:

A reference to the added Argument

virtual OperationResult executeAnalysisImpl()#

Internal entry point for derived operations to perform analysis logic.

template<class ...Args>
inline Group &addJoin(
const std::string &name,
const std::string &description,
Args&&... args,
)#

Create a group of joined arguments.

Convenience function to use the Join Next functionality to show UI widgets on the same row.

May be used within addGroup also.

void positionArgument(
const Argument *argument,
const Argument *after,
)#

Reposition an argument.

Parameters:
  • argument – The argument to move

  • after – The argument to position it after

Protected Attributes

std::vector<std::string> m_meshPrimPaths#