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

Remove redundant toMString function and pragma include guard. #935

Merged
merged 1 commit into from
Nov 21, 2020
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
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