Panda3D
mayaApi.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 mayaApi.h
10  * @author drose
11  * @date 2002-04-15
12  */
13 
14 #ifndef MAYAAPI_H
15 #define MAYAAPI_H
16 
17 #include "pandatoolbase.h"
18 #include "distanceUnit.h"
19 #include "coordinateSystem.h"
20 #include "referenceCount.h"
21 #include "pointerTo.h"
22 
23 class Filename;
24 
25 /**
26  * This class presents a wrapper around the global Maya interface. While the
27  * reference count is held, it keeps the Maya interface open, and closes the
28  * interface when the object destructs.
29  */
30 class MayaApi : public ReferenceCount {
31 protected:
32  MayaApi(const std::string &program_name, bool view_license = false, bool revertdir = true);
33  MayaApi(const MayaApi &copy);
34  void operator = (const MayaApi &copy);
35 
36 public:
37  ~MayaApi();
38 
39  static PT(MayaApi) open_api(std::string program_name = "", bool view_license = false, bool revertdir = true);
40  bool is_valid() const;
41 
42  bool read(const Filename &filename);
43  bool write(const Filename &filename);
44  bool clear();
45 
47  void set_units(DistanceUnit unit);
48  CoordinateSystem get_coordinate_system();
49 
50 private:
51  bool _is_valid;
52  bool _plug_in;
53  Filename _cwd;
54  static MayaApi *_global_api;
55 };
56 
57 #endif
void set_units(DistanceUnit unit)
Set Maya's UI units.
Definition: mayaApi.cxx:377
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool read(const Filename &filename)
Reads the indicated maya file into the global model space.
Definition: mayaApi.cxx:249
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool write(const Filename &filename)
Writes the global model space to the indicated file.
Definition: mayaApi.cxx:292
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit get_units()
Returns Maya's internal units in effect.
Definition: mayaApi.cxx:349
bool clear()
Resets the global model space to the empty state, for instance in preparation for building a new file...
Definition: mayaApi.cxx:336
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
Definition: distanceUnit.h:23
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things that want to be reference-counted.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CoordinateSystem get_coordinate_system()
Returns Maya's internal coordinate system in effect.
Definition: mayaApi.cxx:413
This class presents a wrapper around the global Maya interface.
Definition: mayaApi.h:30