Skip to content

Commit

Permalink
[maya] xformStack: rename OpClassConstPtr to OpClassPtr for brevity
Browse files Browse the repository at this point in the history
  • Loading branch information
pmolodo committed Oct 3, 2017
1 parent d663105 commit 14028e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion third_party/maya/lib/usdMaya/translatorXformable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ PxrUsdMayaTranslatorXformable::Read(
// different name or out of order that will miss the match, we will rely on
// matrix decomposition

std::vector<PxrUsdMayaXformStack::OpClassConstPtr> stackOps = \
std::vector<PxrUsdMayaXformStack::OpClassPtr> stackOps = \
PxrUsdMayaXformStack::FirstMatchingSubstack(
xformops, &MrotOrder,
PxrUsdMayaXformStack::MayaStack(),
Expand Down
28 changes: 14 additions & 14 deletions third_party/maya/lib/usdMaya/xformStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ TF_DEFINE_PUBLIC_TOKENS(PxrUsdMayaXformStackTokens,
PXRUSDMAYA_XFORM_STACK_TOKENS);

typedef PxrUsdMayaXformStack::OpClassList OpClassList;
typedef PxrUsdMayaXformStack::OpClassConstPtr OpClassConstPtr;
typedef PxrUsdMayaXformStack::OpClassConstPtrPair OpClassConstPtrPair;
typedef PxrUsdMayaXformStack::OpClassPtr OpClassPtr;
typedef PxrUsdMayaXformStack::OpClassPtrPair OpClassPtrPair;
typedef PxrUsdMayaXformStack::TokenPtrPairMap TokenPtrPairMap;
typedef PxrUsdMayaXformStack::IndexMap IndexMap;

Expand Down Expand Up @@ -90,9 +90,9 @@ namespace {
// pointers, which is:
// {opPtr, nullptr} if opPtr does not have an inverted twin
// {opPtr, opPtrTwin} if opPtr does have an inverted twin
OpClassConstPtrPair
OpClassPtrPair
_makeInversionPtrPair(
const OpClassConstPtr opPtr,
const OpClassPtr opPtr,
const OpClassList& ops,
const IndexMap& inversionMap)
{
Expand All @@ -103,7 +103,7 @@ namespace {
}
else
{
OpClassConstPtr twinOpPtr = &ops[foundTwin->second];
OpClassPtr twinOpPtr = &ops[foundTwin->second];
if (twinOpPtr >= opPtr)
{
return std::make_pair(opPtr, twinOpPtr);
Expand Down Expand Up @@ -297,10 +297,10 @@ PxrUsdMayaXformStack::PxrUsdMayaXformStack(
}
}

OpClassConstPtr
OpClassPtr
PxrUsdMayaXformStack::FindOp(const TfToken& opName, bool isInvertedTwin) const
{
const OpClassConstPtrPair& foundPtrPair = FindOpPair(opName);
const OpClassPtrPair& foundPtrPair = FindOpPair(opName);

if(foundPtrPair.first == nullptr) return nullptr;

Expand All @@ -319,10 +319,10 @@ PxrUsdMayaXformStack::FindOp(const TfToken& opName, bool isInvertedTwin) const
}
}

const OpClassConstPtrPair&
const OpClassPtrPair&
PxrUsdMayaXformStack::FindOpPair(const TfToken& opName) const
{
static OpClassConstPtrPair _NO_MATCH(nullptr, nullptr);
static OpClassPtrPair _NO_MATCH(nullptr, nullptr);

TokenPtrPairMap::const_iterator foundTokenPtrPair =
_opNamesToPtrs.find(opName);
Expand All @@ -334,16 +334,16 @@ PxrUsdMayaXformStack::FindOpPair(const TfToken& opName) const
return foundTokenPtrPair->second;
}

std::vector<OpClassConstPtr>
std::vector<OpClassPtr>
PxrUsdMayaXformStack::MatchingSubstack(
const std::vector<UsdGeomXformOp>& xformops,
MTransformationMatrix::RotationOrder* MrotOrder) const
{
static const std::vector<OpClassConstPtr> _NO_MATCH;
static const std::vector<OpClassPtr> _NO_MATCH;

if (xformops.empty()) return _NO_MATCH;

std::vector<OpClassConstPtr> ret;
std::vector<OpClassPtr> ret;

// nextOp keeps track of where we will start looking for matches. It
// will only move forward.
Expand All @@ -353,7 +353,7 @@ PxrUsdMayaXformStack::MatchingSubstack(

TF_FOR_ALL(iter, xformops) {
const UsdGeomXformOp& xformOp = *iter;
OpClassConstPtr foundOp = nullptr;
OpClassPtr foundOp = nullptr;

if(_nameMatters) {
// First try the fast attrName lookup...
Expand All @@ -367,7 +367,7 @@ PxrUsdMayaXformStack::MatchingSubstack(

// we found a pair of opPtrs... make sure one is
// not less than nextOp...
const OpClassConstPtrPair& foundPtrPair = foundTokenPtrPair->second;
const OpClassPtrPair& foundPtrPair = foundTokenPtrPair->second;

if (foundPtrPair.first >= &(*nextOp))
{
Expand Down
22 changes: 11 additions & 11 deletions third_party/maya/lib/usdMaya/xformStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ class PxrUsdMayaXformStack
// If at some point this changes, and we allow user-created OpClassifications, we
// may consider using reference-counted pointers (though that will have a small
// extra cost.)
typedef const PxrUsdMayaXformOpClassification* OpClassConstPtr;
typedef std::pair<OpClassConstPtr, OpClassConstPtr> OpClassConstPtrPair;
typedef std::unordered_map<TfToken, OpClassConstPtrPair, TfToken::HashFunctor>
typedef const PxrUsdMayaXformOpClassification* OpClassPtr;
typedef std::pair<OpClassPtr, OpClassPtr> OpClassPtrPair;
typedef std::unordered_map<TfToken, OpClassPtrPair, TfToken::HashFunctor>
TokenPtrPairMap;
typedef std::unordered_map<size_t, size_t> IndexMap;

Expand Down Expand Up @@ -160,7 +160,7 @@ class PxrUsdMayaXformStack
/// return Pointer to the op classification object with the given name (and
/// inverted twin state); will be nullptr if no match could be found.
PXRUSDMAYA_API
OpClassConstPtr FindOp(const TfToken& opName, bool isInvertedTwin=false) const;
OpClassPtr FindOp(const TfToken& opName, bool isInvertedTwin=false) const;

/// \brief Finds the Op Classification(s) with the given name in this stack
/// \param opName the name of the operator classification we wish to find
Expand All @@ -171,7 +171,7 @@ class PxrUsdMayaXformStack
/// to the found classification, and the second will be null. If
/// no matches are found, both pointers will be nullptr.
PXRUSDMAYA_API
const OpClassConstPtrPair& FindOpPair(const TfToken& opName) const;
const OpClassPtrPair& FindOpPair(const TfToken& opName) const;

/// \brief Returns a list of pointers to matching XformOpDefinitions for this stack
///
Expand All @@ -185,7 +185,7 @@ class PxrUsdMayaXformStack
/// stack. The size of this vector will be 0 if no complete match is found,
/// or xformops.size() if a complete match is found.
PXRUSDMAYA_API
std::vector<OpClassConstPtr>
std::vector<OpClassPtr>
MatchingSubstack(
const std::vector<UsdGeomXformOp>& xformops,
MTransformationMatrix::RotationOrder* MrotOrder=nullptr) const;
Expand Down Expand Up @@ -230,29 +230,29 @@ class PxrUsdMayaXformStack

/// \brief dummy recursion endpoint for FirstMatchingSubstack variadic template
PXRUSDMAYA_API
inline static std::vector<OpClassConstPtr>
inline static std::vector<OpClassPtr>
FirstMatchingSubstack(
const std::vector<UsdGeomXformOp>& xformops,
MTransformationMatrix::RotationOrder* MrotOrder=nullptr)
{
return std::vector<OpClassConstPtr>();
return std::vector<OpClassPtr>();
}

/// \brief Runs MatchingSubstack against the given list of stacks
///
/// Returns the first non-empty result it finds; if all stacks
/// return an empty vector, an empty vector is returned.
template<typename... RemainingTypes>
static std::vector<OpClassConstPtr>
static std::vector<OpClassPtr>
FirstMatchingSubstack(
const std::vector<UsdGeomXformOp>& xformops,
MTransformationMatrix::RotationOrder* MrotOrder,
const PxrUsdMayaXformStack& firstStack,
RemainingTypes&... otherStacks)
{
if (xformops.empty()) return std::vector<OpClassConstPtr>();
if (xformops.empty()) return std::vector<OpClassPtr>();

std::vector<PxrUsdMayaXformStack::OpClassConstPtr> stackOps = \
std::vector<PxrUsdMayaXformStack::OpClassPtr> stackOps = \
firstStack.MatchingSubstack(xformops, MrotOrder);
if (!stackOps.empty())
{
Expand Down

0 comments on commit 14028e0

Please sign in to comment.