Skip to content

Commit

Permalink
Remove using directive
Browse files Browse the repository at this point in the history
  • Loading branch information
JGamache-autodesk committed Nov 9, 2022
1 parent ac850c1 commit acd172c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
2 changes: 0 additions & 2 deletions lib/mayaUsd/ufe/UsdBatchOpsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include <mayaUsd/ufe/UsdUndoDuplicateSelectionCommand.h>

PXR_NAMESPACE_USING_DIRECTIVE

namespace MAYAUSD_NS_DEF {
namespace ufe {

Expand Down
26 changes: 12 additions & 14 deletions lib/mayaUsd/ufe/UsdUndoDuplicateSelectionCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

#include <ufe/path.h>

PXR_NAMESPACE_USING_DIRECTIVE

namespace MAYAUSD_NS_DEF {
namespace ufe {

Expand Down Expand Up @@ -87,9 +85,9 @@ void UsdUndoDuplicateSelectionCommand::execute()
for (auto&& duplicateItem : _perItemCommands) {
duplicateItem.second->execute();

auto dstSceneItem = duplicateItem.second->duplicatedItem();
UsdPrim srcPrim = ufePathToPrim(duplicateItem.first);
UsdPrim dstPrim = std::dynamic_pointer_cast<UsdSceneItem>(dstSceneItem)->prim();
auto dstSceneItem = duplicateItem.second->duplicatedItem();
PXR_NS::UsdPrim srcPrim = ufePathToPrim(duplicateItem.first);
PXR_NS::UsdPrim dstPrim = std::dynamic_pointer_cast<UsdSceneItem>(dstSceneItem)->prim();

Ufe::Path stgPath = stagePath(dstPrim.GetStage());
auto stageIt = _duplicatesMap.find(stgPath);
Expand All @@ -104,7 +102,7 @@ void UsdUndoDuplicateSelectionCommand::execute()

// Fixups were grouped by stage.
for (const auto& stageData : _duplicatesMap) {
UsdStageWeakPtr stage(getStage(stageData.first));
PXR_NS::UsdStageWeakPtr stage(getStage(stageData.first));
if (!stage) {
continue;
}
Expand All @@ -113,8 +111,8 @@ void UsdUndoDuplicateSelectionCommand::execute()
for (auto p : UsdPrimRange(stage->GetPrimAtPath(duplicatePair.second))) {
for (auto& prop : p.GetProperties()) {
if (prop.Is<PXR_NS::UsdAttribute>()) {
PXR_NS::UsdAttribute attr = prop.As<PXR_NS::UsdAttribute>();
SdfPathVector sources;
PXR_NS::UsdAttribute attr = prop.As<PXR_NS::UsdAttribute>();
PXR_NS::SdfPathVector sources;
attr.GetConnections(&sources);
if (updateSdfPathVector(
sources, duplicatePair, stageData.second, _copyExternalInputs)) {
Expand All @@ -127,9 +125,9 @@ void UsdUndoDuplicateSelectionCommand::execute()
attr.SetConnections(sources);
}
}
} else if (prop.Is<UsdRelationship>()) {
UsdRelationship rel = prop.As<UsdRelationship>();
SdfPathVector targets;
} else if (prop.Is<PXR_NS::UsdRelationship>()) {
PXR_NS::UsdRelationship rel = prop.As<PXR_NS::UsdRelationship>();
PXR_NS::SdfPathVector targets;
rel.GetTargets(&targets);
// Currently always copying external relationships is the right move since
// duplicated geometries will keep their currently assigned material. We
Expand Down Expand Up @@ -159,16 +157,16 @@ Ufe::SceneItem::Ptr UsdUndoDuplicateSelectionCommand::targetItem(const Ufe::Path
}

bool UsdUndoDuplicateSelectionCommand::updateSdfPathVector(
SdfPathVector& pathVec,
PXR_NS::SdfPathVector& pathVec,
const DuplicatePathsMap::value_type& duplicatePair,
const DuplicatePathsMap& otherPairs,
const bool keepExternal)
{
bool hasChanged = false;
std::list<size_t> indicesToRemove;
for (size_t i = 0; i < pathVec.size(); ++i) {
const SdfPath& path = pathVec[i];
SdfPath finalPath = path;
const PXR_NS::SdfPath& path = pathVec[i];
PXR_NS::SdfPath finalPath = path;
// Paths are lexicographically ordered, this means we can search quickly for bounds of
// candidate paths.
auto itPath = otherPairs.lower_bound(finalPath);
Expand Down
6 changes: 2 additions & 4 deletions lib/mayaUsd/ufe/UsdUndoDuplicateSelectionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <map>
#include <unordered_map>

PXR_NAMESPACE_USING_DIRECTIVE

namespace MAYAUSD_NS_DEF {
namespace ufe {

Expand Down Expand Up @@ -68,12 +66,12 @@ class MAYAUSD_CORE_PUBLIC UsdUndoDuplicateSelectionCommand : public Ufe::Selecti
CommandMap _perItemCommands;

// Fixup data:
using DuplicatePathsMap = std::map<SdfPath, SdfPath>;
using DuplicatePathsMap = std::map<PXR_NS::SdfPath, PXR_NS::SdfPath>;
using DuplicatesMap = std::unordered_map<Ufe::Path, DuplicatePathsMap>;
DuplicatesMap _duplicatesMap;

bool updateSdfPathVector(
SdfPathVector& pathVec,
PXR_NS::SdfPathVector& pathVec,
const DuplicatePathsMap::value_type& duplicatePair,
const DuplicatePathsMap& otherPairs,
const bool keepExternal);
Expand Down

0 comments on commit acd172c

Please sign in to comment.