1 #ifndef __MSTRUTILS_H_AB781278_E118_4246_A3BA_16102A7F2DFD__
4 #define STRUTILS_RETURN_TYPE ATL::CString
8 #ifdef _MString // if included Maya/MString.h
11 inline LPCTSTR MStringToLPCTSTR(
const MString& MStr)
13 #if defined(UNICODE) || defined(_UNICODE)
14 return MStr.asWChar();
21 inline LPCSTR MStringToLPCSTR(
const MString& MStr)
27 inline LPCWSTR MStringToLPCWSTR(
const MString& MStr)
29 return MStr.asWChar();
33 inline OIL::StrUtils_Return_Type OIL::ToString(
const MString& MStr)
35 #if defined(UNICODE) || defined(_UNICODE)
36 return _T(
"\"") + OIL::StrUtils_Return_Type(MStr.asWChar()) + _T(
"\"");
38 return _T(
"\"") + OIL::StrUtils_Return_Type(MStr.asChar()) + _T(
"\"");
43 #ifdef _MStringArray // if included Maya/MStringArray.h
45 inline OIL::StrUtils_Return_Type OIL::ToString(
const MStringArray& strArr)
47 OIL::StrUtils_Return_Type strRet(_T(
"{"));
49 const unsigned int len = strArr.length();
51 for(
unsigned int i=0; len !=0 && i < len-1; ++i)
53 strRet += OIL::ToString(strArr[i]);
57 if(len != 0) strRet += OIL::ToString(strArr[len-1]);
59 return strRet + _T(
"}");
61 #endif // _MStringArray
63 #ifdef _MPoint // if included maya/MPoint.h
65 inline OIL::StrUtils_Return_Type OIL::ToString(
const MPoint& pt)
67 return OIL::StrUtils_Return_Type(_T(
"{")) +
68 OIL::ToString(pt.x) + _T(
",") +
69 OIL::ToString(pt.y) + _T(
",") +
70 OIL::ToString(pt.z) + _T(
",") +
71 OIL::ToString(pt.w) + _T(
" ") +
76 #ifdef _MBoundingBox // if included Maya/MBoundingBox.h
78 inline OIL::StrUtils_Return_Type OIL::ToString(
const MBoundingBox& bb)
80 return OIL::StrUtils_Return_Type(_T(
"{")) +
81 _T(
"w=") + OIL::ToString(bb.width()) + _T(
",") +
82 _T(
"h=") + OIL::ToString(bb.height()) + _T(
",") +
83 _T(
"d=") + OIL::ToString(bb.depth()) + _T(
",") +
84 _T(
"Center=") + OIL::ToString(bb.center()) + _T(
"") +
89 #endif // _MBoundingBox
91 #ifdef _MDagPathArray // if included Maya/MDagPathArray.h
93 inline OIL::StrUtils_Return_Type OIL::ToString(
const MDagPathArray& pathArray)
95 OIL::StrUtils_Return_Type strRet(_T(
"{"));
97 const unsigned int len = pathArray.length();
99 for(
unsigned int i=0; len !=0 && i < len-1; ++i)
101 strRet += OIL::ToString(pathArray[i].fullPathName());
105 if(len != 0) strRet += OIL::ToString(pathArray[len-1].fullPathName());
107 return strRet + _T(
"}");
109 #endif // _MDagPathArray
111 #ifdef _MVector // if included Maya/MVector.h
113 inline OIL::StrUtils_Return_Type OIL::ToString(
const MVector& vec)
115 return OIL::StrUtils_Return_Type(_T(
"{")) +
116 OIL::ToString(vec.x) + _T(
",") +
117 OIL::ToString(vec.y) + _T(
",") +
118 OIL::ToString(vec.z) + _T(
" ") +
123 #ifdef _MFloatVector // if included Maya/MFloatVector.h
125 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFloatVector& vec)
127 return OIL::StrUtils_Return_Type(_T(
"{")) +
128 OIL::ToString(vec.x) + _T(
",") +
129 OIL::ToString(vec.y) + _T(
",") +
130 OIL::ToString(vec.z) + _T(
" ") +
135 #ifdef _MFloatMatrix // if included Maya/MFloatMatrix.h
137 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFloatMatrix& fm)
139 return OIL::StrUtils_Return_Type(_T(
"{")) +
140 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(fm.matrix[0][0]) + _T(
",") + OIL::ToString(fm.matrix[0][1]) + _T(
",") + OIL::ToString(fm.matrix[0][2]) + _T(
",") + OIL::ToString(fm.matrix[0][3]) + _T(
" }") +
141 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(fm.matrix[1][0]) + _T(
",") + OIL::ToString(fm.matrix[1][1]) + _T(
",") + OIL::ToString(fm.matrix[1][2]) + _T(
",") + OIL::ToString(fm.matrix[1][3]) + _T(
" }") +
142 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(fm.matrix[2][0]) + _T(
",") + OIL::ToString(fm.matrix[2][1]) + _T(
",") + OIL::ToString(fm.matrix[2][2]) + _T(
",") + OIL::ToString(fm.matrix[2][3]) + _T(
" }") +
143 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(fm.matrix[3][0]) + _T(
",") + OIL::ToString(fm.matrix[3][1]) + _T(
",") + OIL::ToString(fm.matrix[3][2]) + _T(
",") + OIL::ToString(fm.matrix[3][3]) + _T(
" }") +
146 #endif // _MFloatMatrix
148 #ifdef _MMatrix // if included Maya/MMatrix.h
150 inline OIL::StrUtils_Return_Type OIL::ToString(
const MMatrix& mat)
152 return OIL::StrUtils_Return_Type(_T(
"{")) +
153 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(mat.matrix[0][0]) + _T(
",") + OIL::ToString(mat.matrix[0][1]) + _T(
",") + OIL::ToString(mat.matrix[0][2]) + _T(
",") + OIL::ToString(mat.matrix[0][3]) + _T(
" }") +
154 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(mat.matrix[1][0]) + _T(
",") + OIL::ToString(mat.matrix[1][1]) + _T(
",") + OIL::ToString(mat.matrix[1][2]) + _T(
",") + OIL::ToString(mat.matrix[1][3]) + _T(
" }") +
155 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(mat.matrix[2][0]) + _T(
",") + OIL::ToString(mat.matrix[2][1]) + _T(
",") + OIL::ToString(mat.matrix[2][2]) + _T(
",") + OIL::ToString(mat.matrix[2][3]) + _T(
" }") +
156 OIL::StrUtils_Return_Type(_T(
"{")) + OIL::ToString(mat.matrix[3][0]) + _T(
",") + OIL::ToString(mat.matrix[3][1]) + _T(
",") + OIL::ToString(mat.matrix[3][2]) + _T(
",") + OIL::ToString(mat.matrix[3][3]) + _T(
" }") +
161 #ifdef _MFnCamera // if included Maya/MFnCamera.h
163 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFnCamera::FilmFit& ff)
165 const TCHAR* FilmFitStr[] = { _T(
"kFillFilmFit"), _T(
"kHorizontalFilmFit"), _T(
"kVerticalFilmFit"), _T(
"kOverscanFilmFit"), _T(
"kInvalid") };
166 return OIL::StrUtils_Return_Type(FilmFitStr[ff]);
170 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFnCamera::RollOrder& ro)
172 const TCHAR* RollOrderStr[] = { _T(
"kRotateTranslate"), _T(
"kTranslateRotate") };
173 return OIL::StrUtils_Return_Type(RollOrderStr[ro]);
177 #ifdef _MColor // if included Maya/MColor.h
179 inline OIL::StrUtils_Return_Type OIL::ToString(
const MColor& Color)
181 return OIL::StrUtils_Return_Type(_T(
"{")) +
182 OIL::ToString(Color.r) + _T(
",") +
183 OIL::ToString(Color.g) + _T(
",") +
184 OIL::ToString(Color.b) + _T(
",") +
185 OIL::ToString(Color.a) + _T(
" ") +
190 #ifdef _MFnNurbsCurve // if included <Maya/MFnNurbsCurve.h>
192 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFnNurbsCurve::Form& form)
194 const TCHAR* FormStr[] = { _T(
"kInvalid"), _T(
"kOpen"), _T(
"kClosed"), _T(
"kPeriodic"), _T(
"kLast")};
195 return OIL::StrUtils_Return_Type(FormStr[form]);
197 #endif //_MFnNurbsCurve
199 #ifdef _MFnNurbsSurface // if included <Maya/MFnNurbsSurface.h>
201 inline OIL::StrUtils_Return_Type OIL::ToString(
const MFnNurbsSurface::Form& form)
203 const TCHAR* FormStr[] = { _T(
"kInvalid"), _T(
"kOpen"), _T(
"kClosed"), _T(
"kPeriodic"), _T(
"kLast")};
204 return OIL::StrUtils_Return_Type(FormStr[form]);
206 #endif //_MFnNurbsSurface
208 #endif //__MSTRUTILS_H_AB781278_E118_4246_A3BA_16102A7F2DFD__