Skip to content

Commit

Permalink
Merge pull request #501 from mattyjams/pr/remove_support_for_Maya_rel…
Browse files Browse the repository at this point in the history
…eases_older_than_2018

remove support for Maya releases older than 2018
  • Loading branch information
Krystian Ligenza authored May 20, 2020
2 parents 0681396 + 7cd3c48 commit ddefcd4
Show file tree
Hide file tree
Showing 33 changed files with 35 additions and 879 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if (BUILD_USDMAYA_SCHEMAS)
include(cmake/jinja.cmake)
endif()

find_package(Maya REQUIRED)
find_package(Maya 2018 REQUIRED)
find_package(USD REQUIRED)
include(cmake/usd.cmake)
include(${USD_CONFIG_FILE})
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/FindMaya.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ find_package_handle_standard_args(Maya
MAYA_PY_EXECUTABLE
MAYA_INCLUDE_DIRS
MAYA_LIBRARIES
VERSION_VAR
MAYA_API_VERSION
MAYA_APP_VERSION
VERSION_VAR
MAYA_APP_VERSION
)
)
7 changes: 1 addition & 6 deletions lib/mayaUsd/fileio/shading/shadingModeExporterContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,7 @@ _GetShaderFromShadingEngine(
return MObject();
}

MObject shaderObj =
#if MAYA_API_VERSION >= 20180000
shaderPlug.asMObject(&status);
#else
shaderPlug.asMObject(MDGContext::fsNormal, &status);
#endif
MObject shaderObj = shaderPlug.asMObject(&status);
if (status != MS::kSuccess || shaderObj.isNull()) {
return MObject();
}
Expand Down
29 changes: 0 additions & 29 deletions lib/mayaUsd/fileio/shading/shadingModeUseRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,49 +195,20 @@ class UseRegistryShadingModeExporter : public UsdMayaShadingModeExporter
continue;
}

// Note that MPlug's source() and destinations() methods were
// added in Maya 2016 Extension 2.
if (isDestination) {
#if MAYA_API_VERSION >= 201651
srcPlug = iterPlug.source(&status);
if (status != MS::kSuccess) {
continue;
}
#else
MPlugArray srcPlugs;
iterPlug.connectedTo(
srcPlugs,
/* asDst = */ true,
/* asSrc = */ false,
&status);
if (status != MS::kSuccess) {
continue;
}

if (srcPlugs.length() > 0u) {
srcPlug = srcPlugs[0u];
}
#endif

dstPlugs.append(iterPlug);
} else if (isSource) {
srcPlug = iterPlug;

#if MAYA_API_VERSION >= 201651
if (!iterPlug.destinations(dstPlugs, &status) ||
status != MS::kSuccess) {
continue;
}
#else
iterPlug.connectedTo(
dstPlugs,
/* asDst = */ false,
/* asSrc = */ true,
&status);
if (status != MS::kSuccess) {
continue;
}
#endif
}

// Since we are traversing the shading graph in the upstream
Expand Down
4 changes: 0 additions & 4 deletions lib/mayaUsd/fileio/translators/translatorMayaReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,7 @@ UsdMayaTranslatorMayaReference::update(const UsdPrim& prim, MObject parent)
command = MString("referenceQuery -f -withoutCopyNumber \"") + fnReference.name() + "\"";
MGlobal::executeCommand(command, filepath);
TF_DEBUG(PXRUSDMAYA_TRANSLATORS).Msg("MayaReferenceLogic::update referenceNode=%s prim=%s execute \"%s\"=%s\n",
#if MAYA_API_VERSION < 201700
fnReference.name().asChar(),
#else
fnReference.absoluteName().asChar(),
#endif
prim.GetPath().GetText(),
command.asChar(),
filepath.asChar());
Expand Down
25 changes: 4 additions & 21 deletions lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeDrawOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ PxrMayaHdImagingShapeDrawOverride::~PxrMayaHdImagingShapeDrawOverride()
MHWRender::DrawAPI
PxrMayaHdImagingShapeDrawOverride::supportedDrawAPIs() const
{
#if MAYA_API_VERSION >= 201600
return MHWRender::kOpenGL | MHWRender::kOpenGLCoreProfile;
#else
return MHWRender::kOpenGL;
#endif
}

/* virtual */
Expand Down Expand Up @@ -167,11 +163,7 @@ PxrMayaHdImagingShapeDrawOverride::prepareForDraw(
&status);
if (status == MS::kSuccess) {
const short selectionResolution =
#if MAYA_API_VERSION >= 20180000
selectionResolutionPlug.asShort(&status);
#else
selectionResolutionPlug.asShort(MDGContext::fsNormal, &status);
#endif
if (status == MS::kSuccess) {
UsdMayaGLBatchRenderer::GetInstance().SetSelectionResolution(
GfVec2i(selectionResolution));
Expand All @@ -184,11 +176,7 @@ PxrMayaHdImagingShapeDrawOverride::prepareForDraw(
&status);
if (status == MS::kSuccess) {
const bool enableDepthSelection =
#if MAYA_API_VERSION >= 20180000
enableDepthSelectionPlug.asBool(&status);
#else
enableDepthSelectionPlug.asBool(MDGContext::fsNormal, &status);
#endif
if (status == MS::kSuccess) {
UsdMayaGLBatchRenderer::GetInstance().SetDepthSelectionEnabled(
enableDepthSelection);
Expand Down Expand Up @@ -229,17 +217,12 @@ PxrMayaHdImagingShapeDrawOverride::draw(
UsdMayaGLBatchRenderer::GetInstance().Draw(context, data);
}

// Note that isAlwaysDirty became available as an MPxDrawOverride constructor
// parameter beginning with Maya 2016 Extension 2.
PxrMayaHdImagingShapeDrawOverride::PxrMayaHdImagingShapeDrawOverride(
const MObject& obj) :
MHWRender::MPxDrawOverride(obj,
PxrMayaHdImagingShapeDrawOverride::draw
#if MAYA_API_VERSION >= 201651
, /* isAlwaysDirty = */ false)
#else
)
#endif
MHWRender::MPxDrawOverride(
obj,
PxrMayaHdImagingShapeDrawOverride::draw,
/* isAlwaysDirty = */ false)
{
}

Expand Down
8 changes: 0 additions & 8 deletions lib/mayaUsd/render/pxrUsdMayaGL/hdImagingShapeUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ PxrMayaHdImagingShapeUI::getDrawRequests(
&status);
if (status == MS::kSuccess) {
const short selectionResolution =
#if MAYA_API_VERSION >= 20180000
selectionResolutionPlug.asShort(&status);
#else
selectionResolutionPlug.asShort(MDGContext::fsNormal, &status);
#endif
if (status == MS::kSuccess) {
UsdMayaGLBatchRenderer::GetInstance().SetSelectionResolution(
GfVec2i(selectionResolution));
Expand All @@ -103,11 +99,7 @@ PxrMayaHdImagingShapeUI::getDrawRequests(
&status);
if (status == MS::kSuccess) {
const bool enableDepthSelection =
#if MAYA_API_VERSION >= 20180000
enableDepthSelectionPlug.asBool(&status);
#else
enableDepthSelectionPlug.asBool(MDGContext::fsNormal, &status);
#endif
if (status == MS::kSuccess) {
UsdMayaGLBatchRenderer::GetInstance().SetDepthSelectionEnabled(
enableDepthSelection);
Expand Down
3 changes: 0 additions & 3 deletions lib/mayaUsd/render/pxrUsdMayaGL/instancerShapeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,10 @@ UsdMayaGL_InstancerShapeAdapter::_Sync(
_rprimCollection.GetName());
}

// The kBackfaceCulling display style was introduced in Maya 2016 SP2.
HdCullStyle cullStyle = HdCullStyleNothing;
#if MAYA_API_VERSION >= 201603
if (displayStyle & MHWRender::MFrameContext::DisplayStyle::kBackfaceCulling) {
cullStyle = HdCullStyleBackUnlessDoubleSided;
}
#endif

_delegate->SetCullStyleFallback(cullStyle);

Expand Down
23 changes: 5 additions & 18 deletions lib/mayaUsd/render/pxrUsdMayaGL/proxyDrawOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,12 @@ UsdMayaProxyDrawOverride::Creator(const MObject& obj)
return new UsdMayaProxyDrawOverride(obj);
}

// Note that isAlwaysDirty became available as an MPxDrawOverride constructor
// parameter beginning with Maya 2016 Extension 2.
UsdMayaProxyDrawOverride::UsdMayaProxyDrawOverride(const MObject& obj) :
MHWRender::MPxDrawOverride(obj,
UsdMayaProxyDrawOverride::draw
#if MAYA_API_VERSION >= 201651
, /* isAlwaysDirty = */ false),
#else
),
#endif
_shapeAdapter(/* isViewport2 = */ true)
MHWRender::MPxDrawOverride(
obj,
UsdMayaProxyDrawOverride::draw,
/* isAlwaysDirty = */ false),
_shapeAdapter(/* isViewport2 = */ true)
{
}

Expand All @@ -82,11 +77,7 @@ UsdMayaProxyDrawOverride::~UsdMayaProxyDrawOverride()
MHWRender::DrawAPI
UsdMayaProxyDrawOverride::supportedDrawAPIs() const
{
#if MAYA_API_VERSION >= 201600
return MHWRender::kOpenGL | MHWRender::kOpenGLCoreProfile;
#else
return MHWRender::kOpenGL;
#endif
}

/* virtual */
Expand Down Expand Up @@ -237,8 +228,6 @@ UsdMayaProxyDrawOverride::prepareForDraw(
return _shapeAdapter.GetMayaUserData(oldData, boundingBoxPtr);
}

#if MAYA_API_VERSION >= 20180000

/* virtual */
bool
UsdMayaProxyDrawOverride::wantUserSelection() const
Expand Down Expand Up @@ -312,8 +301,6 @@ UsdMayaProxyDrawOverride::userSelect(
return true;
}

#endif // MAYA_API_VERSION >= 20180000

/* static */
void
UsdMayaProxyDrawOverride::draw(
Expand Down
2 changes: 0 additions & 2 deletions lib/mayaUsd/render/pxrUsdMayaGL/proxyDrawOverride.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride
const MHWRender::MFrameContext& frameContext,
MUserData* oldData) override;

#if MAYA_API_VERSION >= 20180000
MAYAUSD_CORE_PUBLIC
bool wantUserSelection() const override;

Expand All @@ -89,7 +88,6 @@ class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride
const MHWRender::MDrawContext& context,
MPoint& hitPoint,
const MUserData* data) override;
#endif

MAYAUSD_CORE_PUBLIC
static void draw(
Expand Down
11 changes: 0 additions & 11 deletions lib/mayaUsd/render/pxrUsdMayaGL/shapeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,8 @@ _ToMFrameContextDisplayStyle(const M3dView::DisplayStyle legacyDisplayStyle)
displayStyle |= MHWRender::MFrameContext::DisplayStyle::kBoundingBox;
break;
case M3dView::kFlatShaded:
// MHWRender::MFrameContext::DisplayStyle::kFlatShaded is missing in Maya 2015
// and earlier. For those versions of Maya, fall through to kGouraudShaded.
#if MAYA_API_VERSION >= 201600
displayStyle |= MHWRender::MFrameContext::DisplayStyle::kFlatShaded;
break;
#endif
case M3dView::kGouraudShaded:
displayStyle |= MHWRender::MFrameContext::DisplayStyle::kGouraudShaded;
break;
Expand Down Expand Up @@ -289,13 +285,8 @@ PxrMayaHdShapeAdapter::GetReprSelectorForDisplayState(
const bool wireframeStyle =
displayStyle & MHWRender::MFrameContext::DisplayStyle::kWireFrame;

// The kFlatShaded display style was introduced in Maya 2016.
const bool flatShadedStyle =
#if MAYA_API_VERSION >= 201600
displayStyle & MHWRender::MFrameContext::DisplayStyle::kFlatShaded;
#else
false;
#endif

if (flatShadedStyle) {
if (!shadeActiveOnlyStyle || isActive) {
Expand Down Expand Up @@ -498,11 +489,9 @@ PxrMayaHdShapeAdapter::_GetVisibility(
// If a view was provided, check to see whether it is being filtered, and
// get its isolated objects if so.
MSelectionList isolatedObjects;
#if MAYA_API_VERSION >= 201700
if (view && view->viewIsFiltered()) {
view->filteredObjectList(isolatedObjects);
}
#endif

// If non-empty, isolatedObjects contains the "root" isolated objects, so
// we'll need to check to see if one of our ancestors was isolated. (The
Expand Down
3 changes: 0 additions & 3 deletions lib/mayaUsd/render/pxrUsdMayaGL/usdProxyShapeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,10 @@ PxrMayaHdUsdProxyShapeAdapter::_Sync(
_rprimCollection.GetName());
}

// The kBackfaceCulling display style was introduced in Maya 2016 SP2.
HdCullStyle cullStyle = HdCullStyleNothing;
#if MAYA_API_VERSION >= 201603
if (displayStyle & MHWRender::MFrameContext::DisplayStyle::kBackfaceCulling) {
cullStyle = HdCullStyleBackUnlessDoubleSided;
}
#endif

_delegate->SetCullStyleFallback(cullStyle);

Expand Down
2 changes: 0 additions & 2 deletions lib/mayaUsd/render/vp2ShaderFragments/shaderFragments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ MStatus HdVP2ShaderFragments::deregisterFragments()

_registered = false;

#if MAYA_API_VERSION >= 201700
// Clear the shader manager's effect cache as well so that any changes to
// the fragments will get picked up if they are re-registered.
const MHWRender::MShaderManager* shaderMgr =
Expand All @@ -294,7 +293,6 @@ MStatus HdVP2ShaderFragments::deregisterFragments()
return status;
}
}
#endif

return MS::kSuccess;
}
Expand Down
Loading

0 comments on commit ddefcd4

Please sign in to comment.