HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Utils.h File Reference
#include "HUSD_API.h"
#include "HUSD_DataHandle.h"
#include "HUSD_Path.h"
#include <UT/UT_Function.h>
#include <UT/UT_IntArray.h>
#include <UT/UT_Lock.h>
#include <UT/UT_Map.h>
#include <UT/UT_StringHolder.h>
+ Include dependency graph for HUSD_Utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HUSD_OVERRIDES_NUM_LAYERS   6
 

Typedefs

typedef HUSD_LockedStagePtr(* HUSD_LopStageResolver )(const UT_StringRef &path)
 
typedef UT_StringSet HUSD_InstanceSelection
 

Enumerations

enum  HUSD_PrimTraversalDemands {
  HUSD_TRAVERSAL_ACTIVE_PRIMS = 0x00000001, HUSD_TRAVERSAL_DEFINED_PRIMS = 0x00000002, HUSD_TRAVERSAL_LOADED_PRIMS = 0x00000004, HUSD_TRAVERSAL_NONABSTRACT_PRIMS = 0x00000008,
  HUSD_TRAVERSAL_ALLOW_INSTANCE_PROXIES = 0x00000010, HUSD_TRAVERSAL_ALLOW_PROTOTYPES = 0x00000020, HUSD_TRAVERSAL_NO_DEMANDS = 0x00000000, HUSD_TRAVERSAL_DEFAULT_DEMANDS = HUSD_TRAVERSAL_NO_DEMANDS
}
 
enum  HUSD_PathSaveStyle { HUSD_PATH_SAVE_AUTO, HUSD_PATH_SAVE_RELATIVE, HUSD_PATH_SAVE_ABSOLUTE }
 
enum  HUSD_OverridesLayerId {
  HUSD_OVERRIDES_CUSTOM_LAYER = 0, HUSD_OVERRIDES_PURPOSE_LAYER = 1, HUSD_OVERRIDES_SOLO_LIGHTS_LAYER = 2, HUSD_OVERRIDES_SOLO_GEOMETRY_LAYER = 3,
  HUSD_OVERRIDES_SELECTABLE_LAYER = 4, HUSD_OVERRIDES_BASE_LAYER = 5
}
 
enum  HUSD_Variability { HUSD_VARIABILITY_VARYING, HUSD_VARIABILITY_UNIFORM }
 
enum  HUSD_StripLayerResponse { HUSD_IGNORE_STRIPPED_LAYERS, HUSD_WARN_STRIPPED_LAYERS, HUSD_ERROR_STRIPPED_LAYERS }
 
enum  HUSD_TimeSampling { HUSD_TimeSampling::NONE, HUSD_TimeSampling::SINGLE, HUSD_TimeSampling::MULTIPLE }
 
enum  HUSD_XformType {
  HUSD_XformType::Invalid, HUSD_XformType::Translate, HUSD_XformType::Scale, HUSD_XformType::RotateX,
  HUSD_XformType::RotateY, HUSD_XformType::RotateZ, HUSD_XformType::RotateXYZ, HUSD_XformType::RotateXZY,
  HUSD_XformType::RotateYXZ, HUSD_XformType::RotateYZX, HUSD_XformType::RotateZXY, HUSD_XformType::RotateZYX,
  HUSD_XformType::Orient, HUSD_XformType::Transform
}
 
enum  HUSD_XformAxis { HUSD_XformAxis::X, HUSD_XformAxis::Y, HUSD_XformAxis::Z }
 Enum of rotation axis. More...
 
enum  HUSD_XformAxisOrder {
  HUSD_XformAxisOrder::XYZ, HUSD_XformAxisOrder::XZY, HUSD_XformAxisOrder::YXZ, HUSD_XformAxisOrder::YZX,
  HUSD_XformAxisOrder::ZXY, HUSD_XformAxisOrder::ZYX
}
 Enum of rotation order. More...
 

Functions

HUSD_API void HUSDinitialize ()
 
HUSD_API void HUSDsetLopStageResolver (HUSD_LopStageResolver resolver)
 
HUSD_API bool HUSDsplitLopStageIdentifier (const UT_StringRef &identifier, OP_Node *&lop, bool &split_layers, fpreal &t, UT_Options &opts)
 
HUSD_API bool HUSDisValidUsdName (const UT_StringRef &name)
 Returns true if name is a valid identifier (ie, valid component of a path). More...
 
HUSD_API bool HUSDmakeValidUsdName (UT_String &name, bool addwarnings)
 
HUSD_API UT_StringHolder HUSDgetValidUsdName (OP_Node &node)
 
HUSD_API bool HUSDmakeValidUsdPath (UT_String &path, bool addwarnings)
 
HUSD_API bool HUSDmakeValidUsdPath (UT_String &path, bool addwarnings, bool allow_relative)
 
HUSD_API bool HUSDmakeValidUsdPathOrDefaultPrim (UT_String &path, bool addwarnings)
 
HUSD_API bool HUSDmakeUniqueUsdPath (UT_String &path, const HUSD_AutoAnyLock &lock, const UT_StringRef &suffix=UT_StringRef())
 
HUSD_API UT_StringHolder HUSDgetValidUsdPath (OP_Node &node)
 
HUSD_API bool HUSDmakeValidUsdPropertyName (UT_String &name, bool addwarnings)
 
HUSD_API bool HUSDmakeValidVariantName (UT_String &name, bool addwarnings)
 
HUSD_API bool HUSDmakeValidDefaultPrim (UT_String &default_prim, bool addwarnings)
 
HUSD_API UT_StringHolder HUSDgetUsdName (const UT_StringRef &primpath)
 
HUSD_API UT_StringHolder HUSDgetUsdParentPath (const UT_StringRef &primpath)
 
HUSD_API void HUSDgetMinimalPathsForInheritableProperty (bool skip_point_instancers, const HUSD_AutoAnyLock &lock, HUSD_PathSet &paths)
 
HUSD_API UT_StringHolder HUSDgetPrimTypeAlias (const UT_StringRef &primtype)
 
HUSD_API bool HUSDapplyStripLayerResponse (HUSD_StripLayerResponse response)
 
HUSD_API UT_StringHolder HUSDgetPrimvarAttribName (const UT_StringRef &primvar)
 Returns the attribute name of the given primvar. More...
 
HUSD_API UT_StringHolder HUSDgetAttribTypeName (const PI_EditScriptedParm &p)
 Returns the string name of the Usd Sdf type best suited for the parameter. More...
 
HUSD_API HUSD_TimeCode HUSDgetEffectiveTimeCode (const HUSD_TimeCode &timecode, HUSD_TimeSampling time_sampling)
 Returns the time code at which to author an attribute value. More...
 
HUSD_API bool HUSDisTimeVarying (HUSD_TimeSampling time_sampling)
 Returns true if there are more than one time samples. More...
 
HUSD_API bool HUSDisTimeSampled (HUSD_TimeSampling time_sampling)
 Returns true if there is at least one time sample. More...
 
HUSD_API bool HUSDsetParmFromProperty (HUSD_AutoAnyLock &lock, const UT_StringRef &primpath, const UT_StringRef &attribname, const HUSD_TimeCode &tc, PRM_Parm &parm, HUSD_TimeSampling &timesampling)
 Set a parameter value from the value of a USD property. More...
 
HUSD_API bool HUSDpartitionShadePrims (const HUSD_AutoAnyLock &anylock, const HUSD_PathSet &primpaths, UT_StringArray &shadeprimpaths, UT_StringArray &geoprimpaths, bool include_bound_materials=true, bool use_shader_for_mat_with_no_inputs=true)
 
HUSD_API UT_StringArray HUSDgetConnectedPrimsToBumpForHydra (const HUSD_AutoAnyLock &anylock, const UT_StringArray &modified_primpaths)
 
HUSD_API bool HUSDbumpPrimsForHydra (const HUSD_AutoWriteLock &writelock, const UT_StringArray &bump_primpaths)
 Bump metadata on a USD primitive to force a hydra update. More...
 
HUSD_API UT_LockHUSDgetLayerReloadLock ()
 
HUSD_API void HUSDmodifyAssetPaths (const UT_StringHolder &path, const UT_Function< UT_StringHolder(UT_StringHolder)> &modifyFn, const UT_StringHolder &dest)
 
HUSD_API bool HUSDgetXformTypeAndSuffix (HUSD_XformType &xform_type, UT_StringHolder &xform_namesuffix, const UT_StringRef &xform_fullname)
 Functions for obtaining transform name, suffix, and type. More...
 
HUSD_API HUSD_XformType HUSDgetXformType (const UT_StringRef &xform_fullname)
 Functions for obtaining transform name, suffix, and type. More...
 
HUSD_API UT_StringHolder HUSDgetXformSuffix (const UT_StringRef &xform_fullname)
 Functions for obtaining transform name, suffix, and type. More...
 
HUSD_API UT_StringHolder HUSDgetXformName (HUSD_XformType xform_type, const UT_StringRef &xform_namesuffix)
 Functions for obtaining transform name, suffix, and type. More...
 
HUSD_API bool HUSDisXformAttribute (const UT_StringRef &attr, UT_StringHolder *xform_type=nullptr, UT_StringHolder *xform_name=nullptr)
 Functions for obtaining transform name, suffix, and type. More...
 
HUSD_API UT_StringHolder HUSDmakeCollectionPath (const UT_StringRef &prim_path, const UT_StringRef &collection_name)
 
HUSD_API bool HUSDsplitCollectionPath (UT_StringHolder &prim_path, UT_StringHolder &collection_name, const UT_StringRef &collection_path)
 
HUSD_API bool HUSDisValidCollectionPath (const UT_StringRef &path)
 
HUSD_API UT_StringHolder HUSDmakePropertyPath (const UT_StringRef &prim_path, const UT_StringRef &property_name)
 
HUSD_API UT_StringHolder HUSDmakeAttributePath (const UT_StringRef &prim_path, const UT_StringRef &attribute_name)
 
HUSD_API UT_StringHolder HUSDmakeRelationshipPath (const UT_StringRef &prim_path, const UT_StringRef &relationship_name)
 

Macro Definition Documentation

#define HUSD_OVERRIDES_NUM_LAYERS   6

Definition at line 81 of file HUSD_Utils.h.

Typedef Documentation

Definition at line 111 of file HUSD_Utils.h.

typedef HUSD_LockedStagePtr(* HUSD_LopStageResolver)(const UT_StringRef &path)

Definition at line 106 of file HUSD_Utils.h.

Enumeration Type Documentation

Enumerator
HUSD_OVERRIDES_CUSTOM_LAYER 
HUSD_OVERRIDES_PURPOSE_LAYER 
HUSD_OVERRIDES_SOLO_LIGHTS_LAYER 
HUSD_OVERRIDES_SOLO_GEOMETRY_LAYER 
HUSD_OVERRIDES_SELECTABLE_LAYER 
HUSD_OVERRIDES_BASE_LAYER 

Definition at line 73 of file HUSD_Utils.h.

Enumerator
HUSD_PATH_SAVE_AUTO 
HUSD_PATH_SAVE_RELATIVE 
HUSD_PATH_SAVE_ABSOLUTE 

Definition at line 63 of file HUSD_Utils.h.

Enumerator
HUSD_TRAVERSAL_ACTIVE_PRIMS 
HUSD_TRAVERSAL_DEFINED_PRIMS 
HUSD_TRAVERSAL_LOADED_PRIMS 
HUSD_TRAVERSAL_NONABSTRACT_PRIMS 
HUSD_TRAVERSAL_ALLOW_INSTANCE_PROXIES 
HUSD_TRAVERSAL_ALLOW_PROTOTYPES 
HUSD_TRAVERSAL_NO_DEMANDS 
HUSD_TRAVERSAL_DEFAULT_DEMANDS 

Definition at line 38 of file HUSD_Utils.h.

Enumerator
HUSD_IGNORE_STRIPPED_LAYERS 
HUSD_WARN_STRIPPED_LAYERS 
HUSD_ERROR_STRIPPED_LAYERS 

Definition at line 91 of file HUSD_Utils.h.

enum HUSD_TimeSampling
strong
Enumerator
NONE 
SINGLE 
MULTIPLE 

Definition at line 98 of file HUSD_Utils.h.

Enumerator
HUSD_VARIABILITY_VARYING 
HUSD_VARIABILITY_UNIFORM 

Definition at line 84 of file HUSD_Utils.h.

enum HUSD_XformAxis
strong

Enum of rotation axis.

Enumerator
X 
Y 
Z 

Definition at line 241 of file HUSD_Utils.h.

enum HUSD_XformAxisOrder
strong

Enum of rotation order.

Enumerator
XYZ 
XZY 
YXZ 
YZX 
ZXY 
ZYX 

Definition at line 244 of file HUSD_Utils.h.

enum HUSD_XformType
strong

Enum of USD transform operation types. Note, they need to correspond to UsdGeomXformOp::Type enum.

Enumerator
Invalid 
Translate 
Scale 
RotateX 
RotateY 
RotateZ 
RotateXYZ 
RotateXZY 
RotateYXZ 
RotateYZX 
RotateZXY 
RotateZYX 
Orient 
Transform 

Definition at line 230 of file HUSD_Utils.h.

Function Documentation

HUSD_API bool HUSDapplyStripLayerResponse ( HUSD_StripLayerResponse  response)
HUSD_API bool HUSDbumpPrimsForHydra ( const HUSD_AutoWriteLock writelock,
const UT_StringArray bump_primpaths 
)

Bump metadata on a USD primitive to force a hydra update.

HUSD_API UT_StringHolder HUSDgetAttribTypeName ( const PI_EditScriptedParm p)

Returns the string name of the Usd Sdf type best suited for the parameter.

HUSD_API UT_StringArray HUSDgetConnectedPrimsToBumpForHydra ( const HUSD_AutoAnyLock anylock,
const UT_StringArray modified_primpaths 
)

Gets a list of primitives that are siblings or ancestors (or siblings of ancestors) of any of the provided prims, and are also have any of these prims as direct or indirect sources (via UsdConnectableAPI). This method will work for materials, light filters, or any other connectable prim type.

HUSD_API HUSD_TimeCode HUSDgetEffectiveTimeCode ( const HUSD_TimeCode timecode,
HUSD_TimeSampling  time_sampling 
)

Returns the time code at which to author an attribute value.

HUSD_API UT_Lock& HUSDgetLayerReloadLock ( )

Return a lock object that should be obtained by any code that is going to call a USD method that reloads a layer, and by any code that needs to be protected against layers being reloaded on another thread. This exists primarily to protect background render delegate update threads from reload calls happening while reading from the viewport stage.

HUSD_API void HUSDgetMinimalPathsForInheritableProperty ( bool  skip_point_instancers,
const HUSD_AutoAnyLock lock,
HUSD_PathSet paths 
)
HUSD_API UT_StringHolder HUSDgetPrimTypeAlias ( const UT_StringRef primtype)
HUSD_API UT_StringHolder HUSDgetPrimvarAttribName ( const UT_StringRef primvar)

Returns the attribute name of the given primvar.

HUSD_API UT_StringHolder HUSDgetUsdName ( const UT_StringRef primpath)
HUSD_API UT_StringHolder HUSDgetUsdParentPath ( const UT_StringRef primpath)
HUSD_API UT_StringHolder HUSDgetValidUsdName ( OP_Node node)
HUSD_API UT_StringHolder HUSDgetValidUsdPath ( OP_Node node)
HUSD_API UT_StringHolder HUSDgetXformName ( HUSD_XformType  xform_type,
const UT_StringRef xform_namesuffix 
)

Functions for obtaining transform name, suffix, and type.

HUSD_API UT_StringHolder HUSDgetXformSuffix ( const UT_StringRef xform_fullname)

Functions for obtaining transform name, suffix, and type.

HUSD_API HUSD_XformType HUSDgetXformType ( const UT_StringRef xform_fullname)

Functions for obtaining transform name, suffix, and type.

HUSD_API bool HUSDgetXformTypeAndSuffix ( HUSD_XformType xform_type,
UT_StringHolder xform_namesuffix,
const UT_StringRef xform_fullname 
)

Functions for obtaining transform name, suffix, and type.

HUSD_API void HUSDinitialize ( )
HUSD_API bool HUSDisTimeSampled ( HUSD_TimeSampling  time_sampling)

Returns true if there is at least one time sample.

HUSD_API bool HUSDisTimeVarying ( HUSD_TimeSampling  time_sampling)

Returns true if there are more than one time samples.

HUSD_API bool HUSDisValidCollectionPath ( const UT_StringRef path)

Manipulate collection paths and components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API bool HUSDisValidUsdName ( const UT_StringRef name)

Returns true if name is a valid identifier (ie, valid component of a path).

HUSD_API bool HUSDisXformAttribute ( const UT_StringRef attr,
UT_StringHolder xform_type = nullptr,
UT_StringHolder xform_name = nullptr 
)

Functions for obtaining transform name, suffix, and type.

HUSD_API UT_StringHolder HUSDmakeAttributePath ( const UT_StringRef prim_path,
const UT_StringRef attribute_name 
)

Create property paths from their components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API UT_StringHolder HUSDmakeCollectionPath ( const UT_StringRef prim_path,
const UT_StringRef collection_name 
)

Manipulate collection paths and components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API UT_StringHolder HUSDmakePropertyPath ( const UT_StringRef prim_path,
const UT_StringRef property_name 
)

Create property paths from their components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API UT_StringHolder HUSDmakeRelationshipPath ( const UT_StringRef prim_path,
const UT_StringRef relationship_name 
)

Create property paths from their components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API bool HUSDmakeUniqueUsdPath ( UT_String path,
const HUSD_AutoAnyLock lock,
const UT_StringRef suffix = UT_StringRef() 
)
HUSD_API bool HUSDmakeValidDefaultPrim ( UT_String default_prim,
bool  addwarnings 
)
HUSD_API bool HUSDmakeValidUsdName ( UT_String name,
bool  addwarnings 
)
HUSD_API bool HUSDmakeValidUsdPath ( UT_String path,
bool  addwarnings 
)
Examples:
LOP/LOP_Sphere.C.
HUSD_API bool HUSDmakeValidUsdPath ( UT_String path,
bool  addwarnings,
bool  allow_relative 
)
HUSD_API bool HUSDmakeValidUsdPathOrDefaultPrim ( UT_String path,
bool  addwarnings 
)
HUSD_API bool HUSDmakeValidUsdPropertyName ( UT_String name,
bool  addwarnings 
)
HUSD_API bool HUSDmakeValidVariantName ( UT_String name,
bool  addwarnings 
)
HUSD_API void HUSDmodifyAssetPaths ( const UT_StringHolder path,
const UT_Function< UT_StringHolder(UT_StringHolder)> &  modifyFn,
const UT_StringHolder dest 
)

Takes the root layer of the USD file at path and searches for all referenced asset paths in that layer, replacing them with the return value of modifyFn. The resulting layer is saved at the path specified by dest. If path and dest are the same, it overwrites the file at path.

HUSD_API bool HUSDpartitionShadePrims ( const HUSD_AutoAnyLock anylock,
const HUSD_PathSet primpaths,
UT_StringArray shadeprimpaths,
UT_StringArray geoprimpaths,
bool  include_bound_materials = true,
bool  use_shader_for_mat_with_no_inputs = true 
)

Split the found prims into shade and geo prims. The parms control whether materials bound to geo prims are included in the shade prims, and if so, whether to include material's surface shader rather than material itself, if the material has no interface input attributes (ie, is not particularly editable).

HUSD_API void HUSDsetLopStageResolver ( HUSD_LopStageResolver  resolver)
HUSD_API bool HUSDsetParmFromProperty ( HUSD_AutoAnyLock lock,
const UT_StringRef primpath,
const UT_StringRef attribname,
const HUSD_TimeCode tc,
PRM_Parm parm,
HUSD_TimeSampling timesampling 
)

Set a parameter value from the value of a USD property.

HUSD_API bool HUSDsplitCollectionPath ( UT_StringHolder prim_path,
UT_StringHolder collection_name,
const UT_StringRef collection_path 
)

Manipulate collection paths and components. The individual components must be validated (see HUSDmakeValidName and HUSDmakeValidPath) before calling these methods.

HUSD_API bool HUSDsplitLopStageIdentifier ( const UT_StringRef identifier,
OP_Node *&  lop,
bool &  split_layers,
fpreal t,
UT_Options opts 
)