15 #include "mayaSavePview.h" 17 #include <maya/MString.h> 18 #include <maya/MFnPlugin.h> 19 #include <maya/MFileIO.h> 20 #include <maya/MArgParser.h> 21 #include <maya/MArgList.h> 22 #include <maya/MSyntax.h> 45 doIt(
const MArgList &args) {
50 syntax.addFlag(
"a",
"animate");
52 MArgParser parser(syntax, args, &result);
54 result.perror(
"arguments");
58 bool animate = parser.isFlagSet(
"a", &result);
60 result.perror(
"isFlagSet");
65 result = MFileIO::save(
false);
66 if (result != MS::kSuccess) {
70 MString filename = MFileIO::currentFile();
72 MString pview_args =
"-cl";
80 MString quoted = MString(
"\"") + filename + MString(
"\"");
81 int retval = _spawnlp(_P_DETACH,
"pview",
82 "pview", pview_args.asChar(), quoted.asChar(), NULL);
91 MString command = MString(
"pview " + pview_args + MString(
" \"") + filename + MString(
"\""));
93 int command_result = system(command.asChar());
94 if (command_result != 0) {
119 initializePlugin(MObject obj) {
120 MFnPlugin plugin(obj,
"VR Studio",
"1.0");
124 status.perror(
"registerCommand");
135 uninitializePlugin(MObject obj) {
136 MFnPlugin plugin(obj);
138 status = plugin.deregisterCommand(
"pview");
141 status.perror(
"deregisterCommand");
static void * creator()
This is used to create a new instance of the plugin.
virtual MStatus doIt(const MArgList &args)
Called when the plugin command is invoked.
This class serves as a plug-in to Maya to save the scene and view it using the external pview program...