Panda3D
maya_funcs.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 maya_funcs.h
10  * @author drose
11  * @date 2000-02-16
12  */
13 
14 #ifndef MAYA_FUNCS_H
15 #define MAYA_FUNCS_H
16 
17 #include "pandatoolbase.h"
18 #include "luse.h"
19 #include "config_maya.h"
20 
21 #include "pre_maya_include.h"
22 #include <maya/MFnAttribute.h>
23 #include <maya/MPlug.h>
24 #include <maya/MStatus.h>
25 #include <maya/MFnDependencyNode.h>
26 #include <maya/MObject.h>
27 #include <maya/MString.h>
28 #include <maya/MVector.h>
29 #include "post_maya_include.h"
30 
31 
32 bool
33 get_maya_plug(MObject &node, const std::string &attribute_name, MPlug &plug);
34 
35 bool
36 is_connected(MObject &node, const std::string &attribute_name);
37 
38 template<class ValueType>
39 bool
40 get_maya_attribute(MObject &node, const std::string &attribute_name,
41  ValueType &value);
42 
43 template<class ValueType>
44 bool
45 set_maya_attribute(MObject &node, const std::string &attribute_name,
46  ValueType &value);
47 
48 bool
49 has_attribute(MObject &node, const std::string &attribute_name);
50 
51 bool
52 remove_attribute(MObject &node, const std::string &attribute_name);
53 
54 bool
55 get_bool_attribute(MObject &node, const std::string &attribute_name,
56  bool &value);
57 
58 bool
59 get_angle_attribute(MObject &node, const std::string &attribute_name,
60  double &value);
61 
62 bool
63 get_vec2_attribute(MObject &node, const std::string &attribute_name,
64  LVecBase2 &value);
65 
66 bool
67 get_vec3_attribute(MObject &node, const std::string &attribute_name,
68  LVecBase3 &value);
69 
70 bool
71 get_vec2d_attribute(MObject &node, const std::string &attribute_name,
72  LVecBase2d &value);
73 
74 bool
75 get_vec3d_attribute(MObject &node, const std::string &attribute_name,
76  LVecBase3d &value);
77 
78 bool
79 get_mat4d_attribute(MObject &node, const std::string &attribute_name,
80  LMatrix4d &value);
81 
82 void
83 get_tag_attribute_names(MObject &node, pvector<std::string> &tag_names);
84 
85 bool
86 get_enum_attribute(MObject &node, const std::string &attribute_name,
87  std::string &value);
88 
89 bool
90 get_string_attribute(MObject &node, const std::string &attribute_name,
91  std::string &value);
92 
93 bool
94 set_string_attribute(MObject &node, const std::string &attribute_name,
95  const std::string &value);
96 
97 void
98 describe_maya_attribute(MObject &node, const std::string &attribute_name);
99 
100 bool
101 describe_compound_attribute(MObject &node);
102 
103 std::string
104 string_mfndata_type(MFnData::Type type);
105 
106 void
107 list_maya_attributes(MObject &node);
108 
109 // Also, we must define some output functions for Maya objects, since we can't
110 // use those built into Maya (which forward-defines the ostream type
111 // incorrectly).
112 INLINE std::ostream &operator << (std::ostream &out, const MString &str);
113 INLINE std::ostream &operator << (std::ostream &out, const MVector &vec);
114 
115 #include "maya_funcs.I"
116 #include "maya_funcs.T"
117 
118 #endif
bool get_string_attribute(MObject &node, const std::string &attribute_name, std::string &value)
Extracts the named string attribute from the MObject.
Definition: maya_funcs.cxx:440
bool get_vec3d_attribute(MObject &node, const std::string &attribute_name, LVecBase3d &value)
Extracts the named three-component vector from the MObject.
Definition: maya_funcs.cxx:302
void list_maya_attributes(MObject &node)
Writes some info output showing all the attributes on the given dependency node.
Definition: maya_funcs.cxx:664
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool get_mat4d_attribute(MObject &node, const std::string &attribute_name, LMatrix4d &value)
Extracts the named 4x4 matrix from the MObject.
Definition: maya_funcs.cxx:337
bool get_maya_plug(MObject &node, const std::string &attribute_name, MPlug &plug)
Gets the named MPlug associated, if any.
Definition: maya_funcs.cxx:41
bool get_enum_attribute(MObject &node, const std::string &attribute_name, std::string &value)
Extracts the enum attribute from the MObject as a string value.
Definition: maya_funcs.cxx:398
bool get_vec3_attribute(MObject &node, const std::string &attribute_name, LVecBase3 &value)
Extracts the named three-component vector from the MObject.
Definition: maya_funcs.cxx:232
bool remove_attribute(MObject &node, const std::string &attribute_name)
Removes the named attribute from the indicated Maya node.
Definition: maya_funcs.cxx:107
bool set_string_attribute(MObject &node, const std::string &attribute_name, const std::string &value)
Sets the named string attribute on the MObject.
Definition: maya_funcs.cxx:469
bool is_connected(MObject &node, const std::string &attribute_name)
Returns true if the named connection exists on the node and is connected to anything,...
Definition: maya_funcs.cxx:72
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool describe_compound_attribute(MObject &node)
Extracts the children of this attribute from the MObject.
Definition: maya_funcs.cxx:513
void get_tag_attribute_names(MObject &node, pvector< std::string > &tag_names)
artists should be able to set arbitrary tags.
Definition: maya_funcs.cxx:367
bool get_vec2_attribute(MObject &node, const std::string &attribute_name, LVecBase2 &value)
Extracts the named two-component vector from the MObject.
Definition: maya_funcs.cxx:197
void describe_maya_attribute(MObject &node, const std::string &attribute_name)
Writes some warning output about the indicated Maya attribute.
Definition: maya_funcs.cxx:565
bool get_vec2d_attribute(MObject &node, const std::string &attribute_name, LVecBase2d &value)
Extracts the named two-component vector from the MObject.
Definition: maya_funcs.cxx:267
bool get_bool_attribute(MObject &node, const std::string &attribute_name, bool &value)
Extracts the named boolean attribute from the MObject.
Definition: maya_funcs.cxx:157
bool get_angle_attribute(MObject &node, const std::string &attribute_name, double &value)
Extracts the named angle in degrees from the MObject.
Definition: maya_funcs.cxx:179
bool has_attribute(MObject &node, const std::string &attribute_name)
Returns true if the node has the indicated attribute, false otherwise.
Definition: maya_funcs.cxx:85
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.