// 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; }