HDK
|
#include "api.h"
#include "purpose.h"
#include "pxr/base/vt/array.h"
#include "pxr/usd/usd/timeCode.h"
#include <GU/GU_AgentDefinition.h>
#include <GU/GU_AgentLayer.h>
#include <GU/GU_AgentRig.h>
#include <GU/GU_AgentShapeLib.h>
#include <UT/UT_Function.h>
#include <UT/UT_StringArray.h>
Go to the source code of this file.
Classes | |
struct | GusdSkinImportParms |
Typedefs | |
using | GusdSkinnedPrimCallback = UT_Function< bool(exint i, const GusdSkinImportParms &parms, const VtTokenArray &jointNames, const VtMatrix4dArray &invBindTransforms)> |
Utilities for translating agents to/from USD.
These do not provide complete, automatic conversion to/from USD at this stage. Rather, these utilities may be used to build out a conversion pipeline, such as generating all of the various JSON files needed to build out the components of GU_Agent primitives.
Definition in file agentUtils.h.
using GusdSkinnedPrimCallback = UT_Function<bool(exint i, const GusdSkinImportParms &parms, const VtTokenArray &jointNames, const VtMatrix4dArray &invBindTransforms)> |
Definition at line 169 of file agentUtils.h.
GUSD_API bool GusdCoalesceAgentShapes | ( | GU_Detail & | gd, |
const UsdSkelBinding & | binding, | ||
UsdTimeCode | time = UsdTimeCode::EarliestTime() , |
||
const char * | lod = nullptr , |
||
GusdPurposeSet | purpose = GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY) , |
||
UT_ErrorSeverity | sev = UT_ERROR_WARNING , |
||
const GT_RefineParms * | refineParms = nullptr |
||
) |
Read in all skinnable shapes for binding
, coalescing them into gd
. The sev
defines the error severity when reading in each shape. If the severity is less than UT_ERROR_ABORT, the invalid shape is skipped. Otherwise, creation of the coalesced detail fails if errors are produced processing any shapes.
GUSD_API GU_AgentRigPtr GusdCreateAgentRig | ( | const UT_StringHolder & | name, |
const UsdSkelSkeletonQuery & | skelQuery, | ||
bool | createLocomotionJoint = true |
||
) |
Create an agent rig from a skelQuery
.
GUSD_API GU_AgentRigPtr GusdCreateAgentRig | ( | const UT_StringHolder & | name, |
const UsdSkelTopology & | topology, | ||
const VtTokenArray & | jointNames, | ||
const VtMatrix4dArray * | restXforms = nullptr , |
||
bool | createLocomotionJoint = true |
||
) |
Create an agent rig from topology
and jointNames
, and optionally including restXforms
(rest transforms in local space). Each joint name must be unique.
GUSD_API GU_AgentShapeLibPtr GusdCreateAgentShapeLib | ( | const UsdSkelBinding & | binding, |
UsdTimeCode | time = UsdTimeCode::EarliestTime() , |
||
const char * | lod = nullptr , |
||
GusdPurposeSet | purpose = GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY) , |
||
UT_ErrorSeverity | sev = UT_ERROR_WARNING , |
||
const GT_RefineParms * | refineParms = nullptr |
||
) |
Create a shape library where every skinning target of binding
is a separate shape. The sev
defines the error severity when reading in each shape. If the severity is less than UT_ERROR_ABORT, the invalid shape is skipped. Otherwise, creation of the shape lib fails if errors are produced processing any shapes.
GUSD_API bool GusdCreateCaptureAttribute | ( | GU_Detail & | detail, |
const UsdSkelSkinningQuery & | skinningQuery, | ||
const VtTokenArray & | jointNames, | ||
const VtMatrix4dArray & | invBindTransforms | ||
) |
Create the boneCapture attribute on the geometry. Requires the skel:jointIndices and skel:jointWeights primvars to have been imported as attributes, unless the geometry is rigidly deformed.
GUSD_API bool GusdForEachSkinnedPrim | ( | const UsdSkelBinding & | binding, |
const GusdSkinImportParms & | parms, | ||
const GusdSkinnedPrimCallback & | callback | ||
) |
Invokes the callback for each skinnable prim, possibly in parallel. This can be used for customized importing of shapes.
GUSD_API bool GusdGetJointNames | ( | const UsdSkelSkeleton & | skel, |
VtTokenArray & | jointNames | ||
) |
Returns the skeleton's list of joint names, preferring the 'jointNames' attribute over the 'joints' attribute.
GUSD_API bool GusdReadSkinnablePrim | ( | GU_Detail & | gd, |
const UsdSkelSkinningQuery & | skinningQuery, | ||
const VtTokenArray & | jointNames, | ||
const VtMatrix4dArray & | invBindTransforms, | ||
UsdTimeCode | time = UsdTimeCode::EarliestTime() , |
||
const char * | lod = nullptr , |
||
GusdPurposeSet | purpose = GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY) , |
||
UT_ErrorSeverity | sev = UT_ERROR_ABORT , |
||
const GT_RefineParms * | refineParms = nullptr |
||
) |
Read in a skinnable prim given by skinningQuery
into gd
. The jointNames
array provides the names of the joints of the bound Skeleton, using the ordering specified on the Skeleton. The invBindTransforms
array holds the inverse of the Skeleton's bind transforms. Errors encountered while reading the skinnable primitive are reported with a severity of sev
.
GUSD_API bool GusdReadSkinnablePrims | ( | const UsdSkelBinding & | binding, |
UT_Array< GU_DetailHandle > & | details, | ||
UsdTimeCode | time = UsdTimeCode::EarliestTime() , |
||
const char * | lod = nullptr , |
||
GusdPurposeSet | purpose = GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY) , |
||
UT_ErrorSeverity | sev = UT_ERROR_WARNING , |
||
const GT_RefineParms * | refineParms = nullptr |
||
) |
Read shapes for each shape in binding
. The sev
defines the error severity when reading in each shape. If the severity is less than UT_ERROR_ABORT, invalid shapes are skipped, and an empty detail handle is stored in details
for the corresponding shape. Otherwise, the process returns false if errors are encountered processing any shapes.