From bd0027e737c6512397f841c22786274ed74b927f Mon Sep 17 00:00:00 2001 From: Ben Marsh Date: Tue, 22 Oct 2019 09:07:59 -0400 Subject: Adding Shave-and-a-Haircut 9.6 --- mayaPlug/isSharedCmd.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 mayaPlug/isSharedCmd.cpp (limited to 'mayaPlug/isSharedCmd.cpp') diff --git a/mayaPlug/isSharedCmd.cpp b/mayaPlug/isSharedCmd.cpp new file mode 100644 index 0000000..18881eb --- /dev/null +++ b/mayaPlug/isSharedCmd.cpp @@ -0,0 +1,80 @@ +// Shave and a Haircut +// (c) 2019 Epic Games +// US Patent 6720962 + +#include "shaveIO.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "isSharedCmd.h" + +const MString isSharedCmd::commandName("isShared"); +const MString shaveRepair::commandName("shaveRepair"); +const MString shavePurge::commandName("shavePurge"); + + +isSharedCmd::isSharedCmd() {} +isSharedCmd::~isSharedCmd() {} + + +void* isSharedCmd::createCmd() +{ + return new isSharedCmd(); +} + + +MSyntax isSharedCmd::createSyntax() +{ + MSyntax syntax; + + syntax.enableEdit(false); + syntax.enableQuery(false); + + syntax.setObjectType(MSyntax::kSelectionList, 1, 1); + syntax.useSelectionAsDefault(false); + + return syntax; +} + + +MStatus isSharedCmd::doIt(const MArgList& argList) +{ + MStatus status; + MArgDatabase args(syntax(), argList, &status); + + if (!status) return status; + + // + // Get the shaveNode to be operated on. + // + // Note that if no node was specified on the command line, then + // getObjects() will return whatever is currently selected. + // + MSelectionList selection; + args.getObjects(selection); + + MObject node(MObject::kNullObj); + selection.getDependNode(0, node); + + MFnDependencyNode nodeFn(node, &status); + + if (node.isNull() || !status) + { + status = MS::kInvalidParameter; + } + else + { + bool result = nodeFn.isShared(); + setResult(result); + } + + return status; +} + -- cgit v1.2.3