Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the PXR_NS macro instead of pxr in the layer editor #998

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/usd/ui/layerEditor/abstractCommandHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

namespace UsdLayerEditor {

typedef pxr::SdfLayerRefPtr UsdLayer;
typedef pxr::UsdStageRefPtr UsdStage;
typedef PXR_NS::SdfLayerRefPtr UsdLayer;
typedef PXR_NS::UsdStageRefPtr UsdStage;

class SessionState;

Expand Down
6 changes: 3 additions & 3 deletions lib/usd/ui/layerEditor/layerTreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ LayerItemVector LayerTreeItem::childrenVector() const
}

// recursively update the target layer data member. Meant to be called from invisibleRoot
void LayerTreeItem::updateTargetLayerRecursive(const pxr::SdfLayerRefPtr& newTargetLayer)
void LayerTreeItem::updateTargetLayerRecursive(const PXR_NS::SdfLayerRefPtr& newTargetLayer)
{
if (!_layer)
return;
Expand Down Expand Up @@ -174,7 +174,7 @@ AbstractCommandHook* LayerTreeItem::commandHook() const
return parentModel()->sessionState()->commandHook();
}

pxr::UsdStageRefPtr const& LayerTreeItem::stage() const
PXR_NS::UsdStageRefPtr const& LayerTreeItem::stage() const
{
return parentModel()->sessionState()->stage();
}
Expand Down Expand Up @@ -308,7 +308,7 @@ void LayerTreeItem::addAnonymousSublayer()
addAnonymousSublayerAndReturn();
}

pxr::SdfLayerRefPtr LayerTreeItem::addAnonymousSublayerAndReturn()
PXR_NS::SdfLayerRefPtr LayerTreeItem::addAnonymousSublayerAndReturn()
{
auto model = parentModel();
auto newLayer
Expand Down
44 changes: 22 additions & 22 deletions lib/usd/ui/layerEditor/layerTreeItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class LayerTreeItem : public QStandardItem
{
public:
LayerTreeItem(
pxr::SdfLayerRefPtr in_usdLayer,
LayerType in_layerType = LayerType::SubLayer,
std::string in_subLayerPath = "",
RecursionDetector* in_recursionDetector = nullptr);
PXR_NS::SdfLayerRefPtr in_usdLayer,
LayerType in_layerType = LayerType::SubLayer,
std::string in_subLayerPath = "",
RecursionDetector* in_recursionDetector = nullptr);

// refresh our data from the USD Layer
void fetchData(RebuildChildren in_rebuild, RecursionDetector* in_recursionDetector = nullptr);
Expand All @@ -90,7 +90,7 @@ class LayerTreeItem : public QStandardItem
// if a sublayer, get the path we were saved with in the parent
const std::string& subLayerPath() const { return _subLayerPath; }
// shortcut to get stage from model
pxr::UsdStageRefPtr const& stage() const;
PXR_NS::UsdStageRefPtr const& stage() const;

// is the layer muted at the stage level?
bool isMuted() const;
Expand All @@ -108,15 +108,15 @@ class LayerTreeItem : public QStandardItem
// is this sublayer with a path that doesn't load?
bool isInvalidLayer() const { return !_layer; }
// update the target layer flags -- meant to be called from invisible root
void updateTargetLayerRecursive(const pxr::SdfLayerRefPtr& newTargetLayer);
void updateTargetLayerRecursive(const PXR_NS::SdfLayerRefPtr& newTargetLayer);

// USD Layer type query
bool isSessionLayer() const { return _layerType == LayerType::SessionLayer; }
bool isSublayer() const { return _layerType == LayerType::SubLayer; }
bool isTargetLayer() const { return _isTargetLayer; }
bool isAnonymous() const { return _layer ? _layer->IsAnonymous() : false; }
bool isRootLayer() const { return _layerType == LayerType::RootLayer; }
pxr::SdfLayerRefPtr layer() const { return _layer; }
bool isSessionLayer() const { return _layerType == LayerType::SessionLayer; }
bool isSublayer() const { return _layerType == LayerType::SubLayer; }
bool isTargetLayer() const { return _isTargetLayer; }
bool isAnonymous() const { return _layer ? _layer->IsAnonymous() : false; }
bool isRootLayer() const { return _layerType == LayerType::RootLayer; }
PXR_NS::SdfLayerRefPtr layer() const { return _layer; }

// allows c++ iteration of children
LayerItemVector childrenVector() const;
Expand All @@ -127,11 +127,11 @@ class LayerTreeItem : public QStandardItem
void discardEdits();

// there are two addAnonymousSubLayer , because the menu needs all method to be void
void addAnonymousSublayer();
pxr::SdfLayerRefPtr addAnonymousSublayerAndReturn();
void loadSubLayers(QWidget* in_parent);
void printLayer();
void clearLayer();
void addAnonymousSublayer();
PXR_NS::SdfLayerRefPtr addAnonymousSublayerAndReturn();
void loadSubLayers(QWidget* in_parent);
void printLayer();
void clearLayer();

// delegate Action API for command buttons
int getActionButtonCount() const { return (isSublayer() && !isInvalidLayer()) ? 1 : 0; }
Expand All @@ -140,11 +140,11 @@ class LayerTreeItem : public QStandardItem
static const std::vector<LayerActionInfo>& actionButtonsDefinition();

protected:
pxr::SdfLayerRefPtr _layer;
std::string _displayName;
bool _isTargetLayer = false;
LayerType _layerType = LayerType::SubLayer;
std::string _subLayerPath; // name of the layer as it was found in the parent's stack
PXR_NS::SdfLayerRefPtr _layer;
std::string _displayName;
bool _isTargetLayer = false;
LayerType _layerType = LayerType::SubLayer;
std::string _subLayerPath; // name of the layer as it was found in the parent's stack

static std::vector<LayerActionInfo> _actionButtons;

Expand Down
18 changes: 9 additions & 9 deletions lib/usd/ui/layerEditor/layerTreeModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ enum class InRebuildModel
*/
class LayerTreeModel
: public QStandardItemModel
, public pxr::TfWeakBase
, public PXR_NS::TfWeakBase
{
Q_OBJECT
public:
Expand Down Expand Up @@ -87,7 +87,7 @@ class LayerTreeModel
void toggleMuteLayer(LayerTreeItem* item, bool* forcedState = nullptr);

// ask to select a layer in the near future
void selectUsdLayerOnIdle(const pxr::SdfLayerRefPtr& usdLayer);
void selectUsdLayerOnIdle(const PXR_NS::SdfLayerRefPtr& usdLayer);

// drag and drop support
Qt::ItemFlags flags(const QModelIndex& index) const override;
Expand Down Expand Up @@ -116,14 +116,14 @@ class LayerTreeModel
SessionState* _sessionState = nullptr;

void registerUsdNotifications(bool in_register);
void usd_layerChanged(pxr::SdfNotice::LayersDidChangeSentPerLayer const& notice);
void usd_editTargetChanged(pxr::UsdNotice::StageEditTargetChanged const& notice);
void usd_layerChanged(PXR_NS::SdfNotice::LayersDidChangeSentPerLayer const& notice);
void usd_editTargetChanged(PXR_NS::UsdNotice::StageEditTargetChanged const& notice);
void usd_layerDirtinessChanged(
pxr::SdfNotice::LayerDirtinessChanged const& notice,
const pxr::TfWeakPtr<pxr::SdfLayer>& layer);
PXR_NS::SdfNotice::LayerDirtinessChanged const& notice,
const PXR_NS::TfWeakPtr<PXR_NS::SdfLayer>& layer);

pxr::TfNotice::Keys _noticeKeys;
static bool _blockUsdNotices;
PXR_NS::TfNotice::Keys _noticeKeys;
static bool _blockUsdNotices;
;

mutable int _lastAskedAnonLayerNameSinceRebuild = 0;
Expand All @@ -134,7 +134,7 @@ class LayerTreeModel

void updateTargetLayer(InRebuildModel inRebuild);

LayerTreeItem* findUSDLayerItem(const pxr::SdfLayerRefPtr& usdLayer) const;
LayerTreeItem* findUSDLayerItem(const PXR_NS::SdfLayerRefPtr& usdLayer) const;
};

} // namespace UsdLayerEditor
Expand Down
4 changes: 2 additions & 2 deletions lib/usd/ui/layerEditor/layerTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void LayerTreeView::onAddParentLayer(const QString& undoName) const
for (auto item : *params.selection) {
auto oldParent = item->parentLayerItem()->layer();
// create an anon layer as the new parent
auto anonLayer
= pxr::SdfLayer::CreateAnonymous(item->parentModel()->findNameForNewAnonymousLayer());
auto anonLayer = PXR_NS::SdfLayer::CreateAnonymous(
item->parentModel()->findNameForNewAnonymousLayer());
// insert this selected item under it
anonLayer->InsertSubLayerPath(item->layer()->GetIdentifier());
// replace this selected item in its parent with the anon layer
Expand Down
2 changes: 1 addition & 1 deletion lib/usd/ui/layerEditor/mayaCommandHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ UsdLayer MayaCommandHook::addAnonymousSubLayer(UsdLayer usdLayer, std::string ne
cmd += quote(newName);
cmd += quote(usdLayer->GetIdentifier());
std::string result = executeMel(cmd).asChar();
return pxr::SdfLayer::FindOrOpen(result);
return PXR_NS::SdfLayer::FindOrOpen(result);
}

// mute or unmute the given layer
Expand Down
4 changes: 2 additions & 2 deletions lib/usd/ui/layerEditor/mayaSessionState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MayaSessionState::~MayaSessionState()
//
}

void MayaSessionState::setStage(pxr::UsdStageRefPtr const& in_stage)
void MayaSessionState::setStage(PXR_NS::UsdStageRefPtr const& in_stage)
{
PARENT_CLASS::setStage(in_stage);
if (in_stage) {
Expand Down Expand Up @@ -356,7 +356,7 @@ void MayaSessionState::setAutoHideSessionLayer(bool hideIt)
PARENT_CLASS::setAutoHideSessionLayer(hideIt);
}

void MayaSessionState::printLayer(const pxr::SdfLayerRefPtr& layer) const
void MayaSessionState::printLayer(const PXR_NS::SdfLayerRefPtr& layer) const
{
MString result, temp;

Expand Down
6 changes: 3 additions & 3 deletions lib/usd/ui/layerEditor/mayaSessionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PXR_NAMESPACE_USING_DIRECTIVE
*/
class MayaSessionState
: public SessionState
, public pxr::TfWeakBase
, public PXR_NS::TfWeakBase

{
Q_OBJECT
Expand All @@ -50,7 +50,7 @@ class MayaSessionState
~MayaSessionState();

// API implementation
void setStage(pxr::UsdStageRefPtr const& in_stage) override;
void setStage(PXR_NS::UsdStageRefPtr const& in_stage) override;
void setAutoHideSessionLayer(bool hide) override;
AbstractCommandHook* commandHook() override;
std::vector<StageEntry> allStages() const override;
Expand All @@ -62,7 +62,7 @@ class MayaSessionState
// ui to save a layer. returns the path and the file format (ex: "usda")
bool saveLayerUI(QWidget* in_parent, std::string* out_filePath, std::string* out_pFormat)
const override;
void printLayer(const pxr::SdfLayerRefPtr& layer) const override;
void printLayer(const PXR_NS::SdfLayerRefPtr& layer) const override;

// main API
void setupCreateMenu(QMenu* in_menu) override;
Expand Down
26 changes: 13 additions & 13 deletions lib/usd/ui/layerEditor/pathChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
namespace {
using namespace UsdLayerEditor;

typedef pxr::SdfLayerRefPtr UsdLayer;
typedef std::vector<UsdLayer> UsdLayerVector;
typedef PXR_NS::SdfLayerRefPtr UsdLayer;
typedef std::vector<UsdLayer> UsdLayerVector;

// helper for checkIfPathIsSafeToAdd
UsdLayerVector getAllParentHandles(LayerTreeItem* parentItem)
Expand Down Expand Up @@ -79,7 +79,7 @@ bool checkPathRecursive(
return false;
}

auto& resolver = pxr::ArGetResolver();
auto& resolver = PXR_NS::ArGetResolver();
auto anchor = toForwardSlashes(testLayer->GetRealPath());

// now check all children of the testLayer recursivly down for conflicts with any of the parents
Expand All @@ -89,7 +89,7 @@ bool checkPathRecursive(
for (const auto path : proxy) {
auto actualpath = computePathToLoadSublayer(path, anchor, resolver);

auto childLayer = pxr::SdfLayer::FindOrOpen(actualpath);
auto childLayer = PXR_NS::SdfLayer::FindOrOpen(actualpath);
if (childLayer != nullptr) {
if (!checkPathRecursive(
in_errorTitle,
Expand Down Expand Up @@ -121,7 +121,7 @@ bool checkIfPathIsSafeToAdd(
// checking if the handles were already loaded

auto parentLayer = in_parentItem->layer();
auto& resolver = pxr::ArGetResolver();
auto& resolver = PXR_NS::ArGetResolver();

// first check if the path is already in the stack
auto proxy = parentLayer->GetSubLayerPaths();
Expand All @@ -133,15 +133,15 @@ bool checkIfPathIsSafeToAdd(
// now we're going to check if the layer is already in the stack, through
// another path
bool foundLayerInStack = false;
auto subLayer = pxr::SdfLayer::FindOrOpen(pathToAdd);
auto subLayer = PXR_NS::SdfLayer::FindOrOpen(pathToAdd);
if (subLayer == nullptr) {
return true; // always safe to add a bad path, unless it's already in the stack
} else {
// check the layer stack again, this time comparing handles
for (const auto path : proxy) {
std::string actualpath = computePathToLoadSublayer(path, anchor, resolver);

auto childLayer = pxr::SdfLayer::FindOrOpen(actualpath);
auto childLayer = PXR_NS::SdfLayer::FindOrOpen(actualpath);
if (childLayer == subLayer) {
foundLayerInStack = true;
break;
Expand All @@ -164,11 +164,11 @@ bool checkIfPathIsSafeToAdd(
}

bool saveSubLayer(
const QString& in_errorTitle,
LayerTreeItem* in_parentItem,
pxr::SdfLayerRefPtr in_layer,
const std::string& in_absolutePath,
const std::string& in_formatTag)
const QString& in_errorTitle,
LayerTreeItem* in_parentItem,
PXR_NS::SdfLayerRefPtr in_layer,
const std::string& in_absolutePath,
const std::string& in_formatTag)
{
std::string backupFileName;
QFileInfo fileInfo(QString::fromStdString(in_absolutePath));
Expand All @@ -184,7 +184,7 @@ bool saveSubLayer(
}

if (!fileError) {
pxr::SdfFileFormat::FileFormatArguments formatArgs;
PXR_NS::SdfFileFormat::FileFormatArguments formatArgs;
formatArgs["format"] = in_formatTag;

if (!in_layer->Export(in_absolutePath, "", formatArgs)) {
Expand Down
18 changes: 9 additions & 9 deletions lib/usd/ui/layerEditor/pathChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ bool checkIfPathIsSafeToAdd(
// if that fails, delete the file we created.
// for now, assumes an absolute input path
bool saveSubLayer(
const QString& in_errorTitle,
LayerTreeItem* in_parentItem,
pxr::SdfLayerRefPtr in_layer,
const std::string& in_absolutePath,
const std::string& in_formatTag);
const QString& in_errorTitle,
LayerTreeItem* in_parentItem,
PXR_NS::SdfLayerRefPtr in_layer,
const std::string& in_absolutePath,
const std::string& in_formatTag);

// convert path string to use forward slashes
inline std::string toForwardSlashes(const std::string& in_path)
Expand All @@ -64,13 +64,13 @@ inline std::string toForwardSlashes(const std::string& in_path)
// from a sublayerpath.
// this path could be absolute, relative, or be an anon layer
inline std::string computePathToLoadSublayer(
const std::string& subLayerPath,
const std::string& anchor,
pxr::ArResolver& resolver)
const std::string& subLayerPath,
const std::string& anchor,
PXR_NS::ArResolver& resolver)
{
std::string actualPath = subLayerPath;
if (resolver.IsRelativePath(subLayerPath)) {
auto subLayer = pxr::SdfLayer::Find(subLayerPath); // note: finds in the cache
auto subLayer = PXR_NS::SdfLayer::Find(subLayerPath); // note: finds in the cache
if (subLayer) {
if (!resolver.IsRelativePath(subLayer->GetIdentifier())) {
actualPath = toForwardSlashes(subLayer->GetRealPath());
Expand Down
2 changes: 1 addition & 1 deletion lib/usd/ui/layerEditor/saveLayersDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void SaveLayersDialog::onSaveAll()

QString path = row->pathToSaveAs();
if (!path.isEmpty()) {
pxr::SdfFileFormat::FileFormatArguments formatArgs;
PXR_NS::SdfFileFormat::FileFormatArguments formatArgs;
formatArgs["format"] = row->usdFormatTag().toStdString();

auto sessionState = item->parentModel()->sessionState();
Expand Down
4 changes: 2 additions & 2 deletions lib/usd/ui/layerEditor/sessionState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ void SessionState::setAutoHideSessionLayer(bool hideIt)
Q_EMIT autoHideSessionLayerSignal(_autoHideSessionLayer);
}

void SessionState::setStage(pxr::UsdStageRefPtr const& in_stage)
void SessionState::setStage(PXR_NS::UsdStageRefPtr const& in_stage)
{
if (in_stage != _stage) {
_stage = in_stage;
Q_EMIT currentStageChangedSignal();
}
}

pxr::SdfLayerRefPtr SessionState::targetLayer() const
PXR_NS::SdfLayerRefPtr SessionState::targetLayer() const
{
if (_stage != nullptr) {
const auto& target = _stage->GetEditTarget();
Expand Down
Loading