aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/isSharedCmd.cpp
diff options
context:
space:
mode:
authorBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
committerBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
commitbd0027e737c6512397f841c22786274ed74b927f (patch)
treef7ffbdb8f3741bb7f24635616cc189cba5cb865c /mayaPlug/isSharedCmd.cpp
downloadarchived-shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz
archived-shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'mayaPlug/isSharedCmd.cpp')
-rw-r--r--mayaPlug/isSharedCmd.cpp80
1 files changed, 80 insertions, 0 deletions
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 <maya/MArgDatabase.h>
+#include <maya/MArgList.h>
+#include <maya/MDagPath.h>
+#include <maya/MFnDependencyNode.h>
+#include <maya/MGlobal.h>
+#include <maya/MSelectionList.h>
+#include <maya/MSyntax.h>
+#include <maya/MString.h>
+
+#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;
+}
+