Panda3D
mayaApi.h
1 // Filename: mayaApi.h
2 // Created by: drose (15Apr02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MAYAAPI_H
16 #define MAYAAPI_H
17 
18 #include "pandatoolbase.h"
19 #include "distanceUnit.h"
20 #include "coordinateSystem.h"
21 #include "referenceCount.h"
22 #include "pointerTo.h"
23 
24 class Filename;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : MayaApi
28 // Description : This class presents a wrapper around the global
29 // Maya interface. While the reference count is held,
30 // it keeps the Maya interface open, and closes the
31 // interface when the object destructs.
32 ////////////////////////////////////////////////////////////////////
33 class MayaApi : public ReferenceCount {
34 protected:
35  MayaApi(const string &program_name, bool view_license = false, bool revertdir = true);
36  MayaApi(const MayaApi &copy);
37  void operator = (const MayaApi &copy);
38 
39 public:
40  ~MayaApi();
41 
42  static PT(MayaApi) open_api(string program_name = "", bool view_license = false, bool revertdir = true);
43  bool is_valid() const;
44 
45  bool read(const Filename &filename);
46  bool write(const Filename &filename);
47  bool clear();
48 
49  DistanceUnit get_units();
50  void set_units(DistanceUnit unit);
51  CoordinateSystem get_coordinate_system();
52 
53 private:
54  bool _is_valid;
55  bool _plug_in;
56  Filename _cwd;
57  static MayaApi *_global_api;
58 };
59 
60 #endif
void set_units(DistanceUnit unit)
Set Maya's UI units.
Definition: mayaApi.cxx:402
bool read(const Filename &filename)
Reads the indicated maya file into the global model space.
Definition: mayaApi.cxx:266
bool write(const Filename &filename)
Writes the global model space to the indicated file.
Definition: mayaApi.cxx:311
DistanceUnit get_units()
Returns Maya's internal units in effect.
Definition: mayaApi.cxx:372
bool clear()
Resets the global model space to the empty state, for instance in preparation for building a new file...
Definition: mayaApi.cxx:357
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
bool is_valid() const
Returns true if the API has been successfully opened and may be used, or false if there is some probl...
Definition: mayaApi.cxx:240
A base class for all things that want to be reference-counted.
CoordinateSystem get_coordinate_system()
Returns Maya's internal coordinate system in effect.
Definition: mayaApi.cxx:440
This class presents a wrapper around the global Maya interface.
Definition: mayaApi.h:33