Panda3D
mayaSavePview.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file mayaSavePview.h
10  * @author drose
11  * @date 2003-10-27
12  */
13 
14 #ifndef MAYASAVEPVIEW_H
15 #define MAYASAVEPVIEW_H
16 
17 // We don't want to include pre_maya_include.h here, since that would
18 // necessitate linking with Pandatool's libmaya.dll, which would in turn bring
19 // in a lot of stuff from panda that we don't really need. Instead, we'll
20 // just define the Maya symbols we require here.
21 
22 // Maya will try to typedef bool unless this symbol is defined.
23 #ifndef _BOOL
24 #define _BOOL 1
25 #endif
26 
27 #ifdef __MACH__
28 #define OSMac_ 1
29 // This defines MAYA_API_VERSION
30 #include <maya/MTypes.h>
31 #if MAYA_API_VERSION < 201600
32 #include <maya/OpenMayaMac.h>
33 #endif
34 #endif
35 
36 // Even though we don't include any Panda headers, it's safe to include this
37 // one, since it only defines some macros that we need to make this program
38 // platform-independent.
39 #include "dtool_config.h"
40 
41 #ifdef PHAVE_IOSTREAM
42 // This will ask Maya 5.0 or better to use the new <iostream> library instead
43 // of the old <iostream.h> library.
44 #define REQUIRE_IOSTREAM
45 #endif // PHAVE_IOSTREAM
46 
47 #include <maya/MArgList.h>
48 #include <maya/MPxCommand.h>
49 #include <maya/MObject.h>
50 
51 /**
52  * This class serves as a plug-in to Maya to save the scene and view it using
53  * the external pview program, rather than linking in any part of Panda to a
54  * Maya plugin.
55  *
56  * Since it does not link with any Panda code, and hence is a very lean
57  * plugin, it is less likely than MayaPview to cause interoperability problems
58  * within Maya. However, it does force a save-to-disk and a spawning of a
59  * separate executable, including a complete reloading of all of the Maya
60  * libraries, so it is quite a bit slower to execute. And the potential for
61  * interactive control is substantially reduced.
62  */
63 class MayaSavePview : public MPxCommand {
64 public:
65  MayaSavePview();
66  virtual MStatus doIt(const MArgList &args);
67 
68  static void *creator();
69 };
70 
71 // Since we don't include any of the Panda headers (other than
72 // dtool_config.h), we have to define this macro ourselves, to tell Windows to
73 // export the following functions from the DLL.
74 #ifdef WIN32_VC
75  #define EXPCL_MISC __declspec(dllexport)
76 #else
77  #define EXPCL_MISC
78 #endif
79 
80 EXPCL_MISC MStatus initializePlugin(MObject obj);
81 EXPCL_MISC MStatus uninitializePlugin(MObject obj);
82 
83 
84 #endif
MStatus initializePlugin(MObject obj)
Called by Maya when the plugin is loaded.
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.
MStatus uninitializePlugin(MObject obj)
Called by Maya when the plugin is unloaded.
This class serves as a plug-in to Maya to save the scene and view it using the external pview program...
Definition: mayaSavePview.h:63