00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * Mayaアトリビュートユーティリティヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef MAYA_ATTRIBUTE_UTILITY_H_ 00026 #define MAYA_ATTRIBUTE_UTILITY_H_ 00027 00028 namespace LampForMaya{ 00029 00030 //------------------------------------------------------------------------------ 00031 /** 00032 * Mayaアトリビュートユーティリティ 00033 */ 00034 class MayaAttributeUtility{ 00035 public: 00036 //-------------------------------------------------------------------------- 00037 // アトリビュートの取得 00038 //-------------------------------------------------------------------------- 00039 /** 00040 * アトリビュートの取得 00041 * @param node アトリビュートを持つノード 00042 * @param attributeName アトリビュート名 00043 */ 00044 static MObject getAttribute( 00045 const MObject& node, const String& attributeName); 00046 00047 /** 00048 * プラグの取得 00049 * @param node アトリビュートを持つノード 00050 * @param plugName プラグ名 00051 */ 00052 static MPlug getPlug( 00053 const MObject& node, const String& plugName); 00054 00055 //-------------------------------------------------------------------------- 00056 /** 00057 * ブールアトリビュートの取得 00058 * @param node アトリビュートを持つノード 00059 * @param attribute アトリビュート 00060 */ 00061 static bool getBool(const MObject& node, const MObject& attribute); 00062 00063 /** 00064 * ブールアトリビュートの取得 00065 * @param node アトリビュートを持つノード 00066 * @param attributeName アトリビュート名 00067 */ 00068 static bool getBool(const MObject& node, const String& attributeName); 00069 00070 //-------------------------------------------------------------------------- 00071 /** 00072 * 整数アトリビュートの取得 00073 * @param node アトリビュートを持つノード 00074 * @param attribute アトリビュート 00075 */ 00076 static int getInt(const MObject& node, const MObject& attribute); 00077 00078 /** 00079 * 整数アトリビュートの取得 00080 * @param node アトリビュートを持つノード 00081 * @param attributeName アトリビュート名 00082 */ 00083 static int getInt(const MObject& node, const String& attributeName); 00084 00085 //-------------------------------------------------------------------------- 00086 /** 00087 * 実数アトリビュートの取得 00088 * @param node アトリビュートを持つノード 00089 * @param attribute アトリビュート 00090 */ 00091 static float getFloat(const MObject& node, const MObject& attribute); 00092 00093 /** 00094 * 実数アトリビュートの取得 00095 * @param node アトリビュートを持つノード 00096 * @param attributeName アトリビュート名 00097 */ 00098 static float getFloat(const MObject& node, const String& attributeName); 00099 00100 //-------------------------------------------------------------------------- 00101 /** 00102 * 文字列アトリビュートの取得 00103 * @param node アトリビュートを持つノード 00104 * @param attribute アトリビュート 00105 */ 00106 static String getString(const MObject& node, const MObject& attribute); 00107 00108 /** 00109 * 文字列アトリビュートの取得 00110 * @param node アトリビュートを持つノード 00111 * @param attributeName アトリビュート名 00112 */ 00113 static String getString(const MObject& node, const String& attributeName); 00114 00115 //-------------------------------------------------------------------------- 00116 /** 00117 * 実数三要素カラーアトリビュートの取得 00118 * @param node アトリビュートを持つノード 00119 * @param attribute アトリビュート 00120 */ 00121 static Color3f getColor3f( 00122 const MObject& node, const MObject& attribute); 00123 00124 /** 00125 * 実数三要素カラーアトリビュートの取得 00126 * @param node アトリビュートを持つノード 00127 * @param attributeName アトリビュート名 00128 */ 00129 static Color3f getColor3f( 00130 const MObject& node, const String& attributeName); 00131 00132 //-------------------------------------------------------------------------- 00133 /** 00134 * ベクトルアトリビュートの取得 00135 * @param node アトリビュートを持つノード 00136 * @param attribute アトリビュート 00137 */ 00138 static Vector3 getVector( 00139 const MObject& node, const MObject& attribute); 00140 00141 /** 00142 * ベクトルアトリビュートの取得 00143 * @param node アトリビュートを持つノード 00144 * @param attributeName アトリビュート名 00145 */ 00146 static Vector3 getVector( 00147 const MObject& node, const String& attributeName); 00148 00149 //-------------------------------------------------------------------------- 00150 /** 00151 * 行列アトリビュートの取得 00152 * @param node アトリビュートを持つノード 00153 * @param attribute アトリビュート 00154 */ 00155 static Matrix44 getMatrix( 00156 const MObject& node, const MObject& attribute); 00157 00158 /** 00159 * 行列アトリビュートの取得 00160 * @param node アトリビュートを持つノード 00161 * @param attributeName アトリビュート名 00162 */ 00163 static Matrix44 getMatrix( 00164 const MObject& node, const String& attributeName); 00165 00166 //-------------------------------------------------------------------------- 00167 00168 private: 00169 // コンストラクタの隠蔽 00170 MayaAttributeUtility(); 00171 00172 }; 00173 00174 //------------------------------------------------------------------------------ 00175 } // End of namespace LampForMaya 00176 #endif // End of MAYA_ATTRIBUTE_UTILITY_H_ 00177 //------------------------------------------------------------------------------ 00178