HDK
|
#include <HUSD_BindMaterial.h>
Public Types | |
enum | BindMethod { BindMethod::DIRECT, BindMethod::COLLECTION } |
Enumeration of the ways in which a binding can be performed. More... | |
enum | Strength { Strength::DEFAULT, Strength::STRONG, Strength::WEAK } |
Enumeration of the material binding strength. More... | |
Public Member Functions | |
HUSD_BindMaterial (HUSD_AutoWriteLock &lock) | |
Standard constructor. More... | |
bool | bind (const UT_StringRef &mat_prim_path, const UT_StringRef &geo_prim_path) const |
Assigns the given material to the given geometry primitive(s). More... | |
bool | bind (const UT_StringRef &mat_prim_path, const HUSD_FindPrims &find_geo_prims) const |
bool | bindWithCollection (const UT_StringRef &mat_prim_path, const HUSD_FindPrims &include_geo_prims, const HUSD_FindPrims &exclude_geo_prims) const |
bool | bindWithPathExpression (const UT_StringRef &mat_prim_path, const UT_StringRef &path_expr) const |
bool | bindSubset (const UT_StringRef &mat_prim_path, const UT_StringRef &geo_prim_path, const UT_Array< exint > *face_indices, const HUSD_TimeCode &tc=HUSD_TimeCode()) const |
HUSD_Path | createSubset (const UT_StringRef &subset_name, const UT_StringRef &geo_prim_path, const UT_Array< exint > &face_indices, const HUSD_TimeCode &tc=HUSD_TimeCode()) const |
bool | isPrimWithoutBoundMaterial (const UT_StringRef &prim_path, const UT_Optional< UT_StringHolder > &purpose=std::nullopt) |
bool | unbindAll (const HUSD_FindPrims &find_prims) const |
bool | unbind (const HUSD_FindPrims &find_prims, const UT_StringHolder &purpose, int unbind_limit=1) const |
bool | assignMaterialsFromAttribute (const UT_StringRef &layername, const UT_StringMap< UT_StringHolder > &args, const UT_StringRef &primpath, bool loadasreference, const UT_StringRef &refprimpath, const UT_StringRef &attrname, bool remove_attr, bool create_empty_materials, const UT_StringRef &reffileattrname, const UT_StringRef &refprimattrname) const |
void | setBindMethod (BindMethod method) |
Sets the method of defining bindings. More... | |
BindMethod | getBindMethod () const |
void | setBindCollectionExpand (bool expand) |
Sets the collection expansion option when defining collections. More... | |
bool | getBindCollectionExpand () const |
void | setBindCollectionInfo (const UT_StringHolder &primpath, const UT_StringHolder &collectionname) |
const UT_StringHolder & | getBindCollectionPrimPath () const |
const UT_StringHolder & | getBindCollectionName () const |
void | setBindCollectionWarnUnspecifiedPrim (bool warn) |
bool | getBindCollectionWarnUnspecifiedPrim () const |
void | setStrength (Strength strength) |
Sets the strength preference for material assignments. More... | |
Strength | getStrength () const |
void | setPurpose (const UT_StringHolder &purpose) |
Sets the purpose for material assignments. More... | |
const UT_StringHolder & | getPurpose () const |
Definition at line 32 of file HUSD_BindMaterial.h.
|
strong |
Enumeration of the ways in which a binding can be performed.
Enumerator | |
---|---|
DIRECT | |
COLLECTION |
Definition at line 113 of file HUSD_BindMaterial.h.
|
strong |
Enumeration of the material binding strength.
Enumerator | |
---|---|
DEFAULT | |
STRONG | |
WEAK |
Definition at line 155 of file HUSD_BindMaterial.h.
HUSD_BindMaterial::HUSD_BindMaterial | ( | HUSD_AutoWriteLock & | lock | ) |
Standard constructor.
bool HUSD_BindMaterial::assignMaterialsFromAttribute | ( | const UT_StringRef & | layername, |
const UT_StringMap< UT_StringHolder > & | args, | ||
const UT_StringRef & | primpath, | ||
bool | loadasreference, | ||
const UT_StringRef & | refprimpath, | ||
const UT_StringRef & | attrname, | ||
bool | remove_attr, | ||
bool | create_empty_materials, | ||
const UT_StringRef & | reffileattrname, | ||
const UT_StringRef & | refprimattrname | ||
) | const |
Looks for the specified attrname on any prims in the named layer. This string attribute is turned into an SdfPath that is bound as the material to the primitive with the attribute. If the attribute string points to a geometry primitive, we assign the material bound to that geometry primitive. Return false if the operation fails in an unrecoverable way. An error will have been added to the error scope to explain the failure. Warnings may also be generated for more minor issues such as invalid material paths. If create_empty_materials is enabled, the reffileattrname and refprimattrname can be used to optionally author a reference to a file (and reference prim within that file) rather than an empty material.
bool HUSD_BindMaterial::bind | ( | const UT_StringRef & | mat_prim_path, |
const UT_StringRef & | geo_prim_path | ||
) | const |
Assigns the given material to the given geometry primitive(s).
bool HUSD_BindMaterial::bind | ( | const UT_StringRef & | mat_prim_path, |
const HUSD_FindPrims & | find_geo_prims | ||
) | const |
bool HUSD_BindMaterial::bindSubset | ( | const UT_StringRef & | mat_prim_path, |
const UT_StringRef & | geo_prim_path, | ||
const UT_Array< exint > * | face_indices, | ||
const HUSD_TimeCode & | tc = HUSD_TimeCode() |
||
) | const |
Assigns the given material to a subset of the geometry primitive. This method creates the geometry subset. If a geometry subset already exists, it can be bound using the regular bind methods above.
bool HUSD_BindMaterial::bindWithCollection | ( | const UT_StringRef & | mat_prim_path, |
const HUSD_FindPrims & | include_geo_prims, | ||
const HUSD_FindPrims & | exclude_geo_prims | ||
) | const |
bool HUSD_BindMaterial::bindWithPathExpression | ( | const UT_StringRef & | mat_prim_path, |
const UT_StringRef & | path_expr | ||
) | const |
HUSD_Path HUSD_BindMaterial::createSubset | ( | const UT_StringRef & | subset_name, |
const UT_StringRef & | geo_prim_path, | ||
const UT_Array< exint > & | face_indices, | ||
const HUSD_TimeCode & | tc = HUSD_TimeCode() |
||
) | const |
Creates a geometry subset for material binding, but does not actually bind any material to the prim.
|
inline |
Definition at line 128 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 143 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 141 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 151 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 122 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 171 of file HUSD_BindMaterial.h.
|
inline |
Definition at line 165 of file HUSD_BindMaterial.h.
bool HUSD_BindMaterial::isPrimWithoutBoundMaterial | ( | const UT_StringRef & | prim_path, |
const UT_Optional< UT_StringHolder > & | purpose = std::nullopt |
||
) |
Returns true if the given path points to a primitive, and that primitive does not have any material bound to it.
|
inline |
Sets the collection expansion option when defining collections.
Definition at line 126 of file HUSD_BindMaterial.h.
|
inline |
For collection-based bindings, sets the USD primitive path on which the collection-based binding is defined, and the collection name. If these are not supplied, we'll do a best guess for these values.
Definition at line 134 of file HUSD_BindMaterial.h.
|
inline |
Indicates whether a warning should be generated if we are asked to create a collection binding, but are not explicitly given a prim on which to author the binding (and we have to calculate one instead).
Definition at line 149 of file HUSD_BindMaterial.h.
|
inline |
Sets the method of defining bindings.
Definition at line 120 of file HUSD_BindMaterial.h.
|
inline |
Sets the purpose for material assignments.
Definition at line 169 of file HUSD_BindMaterial.h.
Sets the strength preference for material assignments.
Definition at line 163 of file HUSD_BindMaterial.h.
bool HUSD_BindMaterial::unbind | ( | const HUSD_FindPrims & | find_prims, |
const UT_StringHolder & | purpose, | ||
int | unbind_limit = 1 |
||
) | const |
Removes the material binding from the geometry primitive(s). The unbind_limit
determines how many material bindings are blocked. The binding limit of 1 unassigns the currently bound material, allowing any other candidate moaterial to take over.
The binding limit of 2 unassigns the currently bound material (if any), and the second candidate material (if any), allowing the next candidate material to take effect.
bool HUSD_BindMaterial::unbindAll | ( | const HUSD_FindPrims & | find_prims | ) | const |
Makes sure the primitives are not bound to any material. I.e, if there is any direct material binding (on the given prim or its ancestor), authors a binding block on the given prim, and if there is any collection-based assignment on the prim or ancestor, removes the given prim from the collection.