16 #include <maya/MString.h>
17 #include <maya/MFnPlugin.h>
18 #include <maya/MFileIO.h>
19 #include <maya/MArgParser.h>
20 #include <maya/MArgList.h>
21 #include <maya/MSyntax.h>
40 doIt(
const MArgList &args) {
45 syntax.addFlag(
"a",
"animate");
47 MArgParser parser(syntax, args, &result);
49 result.perror(
"arguments");
53 bool animate = parser.isFlagSet(
"a", &result);
55 result.perror(
"isFlagSet");
60 result = MFileIO::save(
false);
61 if (result != MS::kSuccess) {
65 MString filename = MFileIO::currentFile();
67 MString pview_args =
"-cl";
74 MString quoted = MString(
"\"") + filename + MString(
"\"");
75 intptr_t retval = _spawnlp(_P_DETACH,
"pview",
76 "pview", pview_args.asChar(), quoted.asChar(),
nullptr);
84 MString command = MString(
"pview " + pview_args + MString(
" \"") + filename + MString(
"\""));
86 int command_result = system(command.asChar());
87 if (command_result != 0) {
110 MFnPlugin plugin(obj,
"VR Studio",
"1.0");
114 status.perror(
"registerCommand");
125 MFnPlugin plugin(obj);
127 status = plugin.deregisterCommand(
"pview");
130 status.perror(
"deregisterCommand");
This class serves as a plug-in to Maya to save the scene and view it using the external pview program...
virtual MStatus doIt(const MArgList &args)
Called when the plugin command is invoked.
static void * creator()
This is used to create a new instance of the plugin.
MStatus initializePlugin(MObject obj)
Called by Maya when the plugin is loaded.
MStatus uninitializePlugin(MObject obj)
Called by Maya when the plugin is unloaded.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.