Skip to content

Commit

Permalink
Merge pull request #935 from marsupial/PR/fixups-from-899
Browse files Browse the repository at this point in the history
Remove redundant toMString function and pragma include guard.
  • Loading branch information
Krystian Ligenza authored Nov 21, 2020
2 parents 92b91b3 + d0291d1 commit 222647e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 6 additions & 10 deletions lib/mayaUsd/base/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
// limitations under the License.
//

#pragma once
#ifndef PXRUSDMAYA_TOKENS_H
#define PXRUSDMAYA_TOKENS_H

#include "api.h"

#include <pxr/base/tf/staticTokens.h>
#include <pxr/pxr.h>

#include <maya/MString.h>

// See lib/mayaUsd/utils/util.h for a TfToken -> MString conversion
//
PXR_NAMESPACE_OPEN_SCOPE

// Tokens that are used as optionVars in MayaUSD
Expand All @@ -33,11 +34,6 @@ PXR_NAMESPACE_OPEN_SCOPE

TF_DECLARE_PUBLIC_TOKENS(MayaUsdOptionVars, MAYAUSD_CORE_PUBLIC, MAYA_USD_OPTIONVAR_TOKENS);

// Convenience to convert a TfToken to MString
//
static inline MString toMString(const TfToken& token)
{
return MString(token.data(), token.size());
}

PXR_NAMESPACE_CLOSE_SCOPE

#endif
5 changes: 3 additions & 2 deletions lib/mayaUsd/nodes/proxyShapeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <mayaUsd/nodes/stageData.h>
#include <mayaUsd/utils/query.h>
#include <mayaUsd/utils/stageCache.h>
#include <mayaUsd/utils/util.h>
#include <mayaUsd/utils/utilFileSystem.h>

#include <pxr/base/gf/bbox3d.h>
Expand Down Expand Up @@ -548,8 +549,8 @@ MStatus MayaUsdProxyShapeBase::computeInStageDataCached(MDataBlock& dataBlock)
SdfLayerRefPtr sessionLayer = computeSessionLayer(dataBlock);

bool targetSession
= MGlobal::optionVarIntValue(
toMString(MayaUsdOptionVars->mayaUsd_ProxyTargetsSessionLayerOnOpen))
= MGlobal::optionVarIntValue(UsdMayaUtil::convert(
MayaUsdOptionVars->mayaUsd_ProxyTargetsSessionLayerOnOpen))
== 1;
targetSession = targetSession || !rootLayer->PermissionToEdit();

Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/nodes/stageNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <mayaUsd/base/tokens.h>
#include <mayaUsd/nodes/stageData.h>
#include <mayaUsd/utils/stageCache.h>
#include <mayaUsd/utils/util.h>

#include <pxr/base/tf/staticTokens.h>
#include <pxr/base/tf/stringUtils.h>
Expand Down Expand Up @@ -110,7 +111,7 @@ MStatus UsdMayaStageNode::compute(const MPlug& plug, MDataBlock& dataBlock)
const bool loadAll = true;
UsdStageCacheContext ctx(UsdMayaStageCache::Get(loadAll));

bool targetSession = MGlobal::optionVarIntValue(toMString(
bool targetSession = MGlobal::optionVarIntValue(UsdMayaUtil::convert(
MayaUsdOptionVars->mayaUsd_ProxyTargetsSessionLayerOnOpen))
== 1;
targetSession = targetSession || !rootLayer->PermissionToEdit();
Expand Down

0 comments on commit 222647e

Please sign in to comment.