Skip to content

Commit

Permalink
move pxrUsdStageNode and pxrUsdPointBasedDeformerNode registration to…
Browse files Browse the repository at this point in the history
… mayaUsd core

These nodes are created when the "useAsAnimationCache" import arg is used. The
import arg is built into the base import command, so the nodes must be
registered and de-registered in the core, otherwise imports that use the arg
will fail.
  • Loading branch information
mattyjams committed Oct 10, 2020
1 parent 50eb2c6 commit 14acc4c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
26 changes: 26 additions & 0 deletions lib/mayaUsd/nodes/proxyShapePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@
#include <maya/MGlobal.h>
#include <maya/MFnPlugin.h>
#include <maya/MDrawRegistry.h>
#include <maya/MPxNode.h>

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

#include <mayaUsd/nodes/hdImagingShape.h>
#include <mayaUsd/nodes/pointBasedDeformerNode.h>
#include <mayaUsd/nodes/proxyShapeBase.h>
#include <mayaUsd/nodes/stageData.h>
#include <mayaUsd/nodes/stageNode.h>

PXR_NAMESPACE_USING_DIRECTIVE

Expand Down Expand Up @@ -81,6 +84,23 @@ MayaUsdProxyShapePlugin::initialize(MFnPlugin& plugin)
getProxyShapeClassification());
CHECK_MSTATUS(status);

// Stage and point-based deformer node registration. These nodes are
// created when the "useAsAnimationCache" import argument is used.
status = plugin.registerNode(
UsdMayaStageNode::typeName,
UsdMayaStageNode::typeId,
UsdMayaStageNode::creator,
UsdMayaStageNode::initialize);
CHECK_MSTATUS_AND_RETURN_IT(status);

status = plugin.registerNode(
UsdMayaPointBasedDeformerNode::typeName,
UsdMayaPointBasedDeformerNode::typeId,
UsdMayaPointBasedDeformerNode::creator,
UsdMayaPointBasedDeformerNode::initialize,
MPxNode::kDeformerNode);
CHECK_MSTATUS_AND_RETURN_IT(status);

// Hybrid Hydra / VP2 rendering uses a draw override to draw the proxy
// shape. The Pixar and MayaUsd plugins use the UsdMayaProxyDrawOverride,
// so register it here. Native USD VP2 rendering uses a sub-scene override.
Expand Down Expand Up @@ -176,6 +196,12 @@ MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin)
CHECK_MSTATUS(status);
}

status = plugin.deregisterNode(UsdMayaPointBasedDeformerNode::typeId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(UsdMayaStageNode::typeId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(MayaUsdProxyShapeBase::typeId);
CHECK_MSTATUS(status);

Expand Down
23 changes: 0 additions & 23 deletions plugin/pxr/maya/plugin/pxrUsd/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
#include "usdMaya/listShadingModesCommand.h"

#include <mayaUsd/listeners/notice.h>
#include <mayaUsd/nodes/pointBasedDeformerNode.h>
#include "usdMaya/proxyShape.h"
#include "usdMaya/referenceAssembly.h"
#include <mayaUsd/nodes/stageNode.h>
#include <mayaUsd/utils/undoHelperCommand.h>

#include <maya/MFnPlugin.h>
Expand Down Expand Up @@ -70,21 +68,6 @@ initializePlugin(MObject obj)
status = MayaUsdProxyShapePlugin::initialize(plugin);
CHECK_MSTATUS_AND_RETURN_IT(status);

status = plugin.registerNode(
UsdMayaStageNode::typeName,
UsdMayaStageNode::typeId,
UsdMayaStageNode::creator,
UsdMayaStageNode::initialize);
CHECK_MSTATUS_AND_RETURN_IT(status);

status = plugin.registerNode(
UsdMayaPointBasedDeformerNode::typeName,
UsdMayaPointBasedDeformerNode::typeId,
UsdMayaPointBasedDeformerNode::creator,
UsdMayaPointBasedDeformerNode::initialize,
MPxNode::kDeformerNode);
CHECK_MSTATUS_AND_RETURN_IT(status);

status = plugin.registerShape(
UsdMayaProxyShape::typeName,
UsdMayaProxyShape::typeId,
Expand Down Expand Up @@ -265,12 +248,6 @@ uninitializePlugin(MObject obj)
status = plugin.deregisterNode(UsdMayaProxyShape::typeId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(UsdMayaPointBasedDeformerNode::typeId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(UsdMayaStageNode::typeId);
CHECK_MSTATUS(status);

status = MayaUsdProxyShapePlugin::finalize(plugin);
CHECK_MSTATUS(status);

Expand Down

0 comments on commit 14acc4c

Please sign in to comment.