UVTexIntegra 310.0.0.3

- メインページ
- 関連ページ
- モジュール
- ネームスペース
- クラス
- ファイル

- ファイル一覧

全て クラス ネームスペース 関数 変数 列挙型 プロパティ イベント グループ ページ
K:/Dancer_iMac/UVTexa/UVTexIntegra/MQCLIExtention.hpp
1 // == LICENSE INFORMATION ==
2 /*
3 * First author tiritomato 2013.
4 * This program is distributed under the GNU General Public License(GPL).
5 * support blog (Japanese only) http://d.hatena.ne.jp/tiri_tomato/
6 */
7 // == LICENSE INFORMATION ==
8
9 #pragma once
10
11 namespace MQCLIEX {
12
15
17 inline System::Drawing::Color FromMQVertexColor( DWORD vc ) {
18 return System::Drawing::Color::FromArgb( (vc & 0xFF000000)>>24, (vc & 0x000000FF), (vc & 0x0000FF00)>>8, (vc & 0x00FF0000)>>16 );
19 }
20
22 inline DWORD ArgbToMQVertexColor( const int a, const int r, const int g, const int b )
23 {
24 return DWORD( unsigned int(r & 0xFF) | (unsigned int(g & 0xFF) << 8) | (unsigned int(b & 0xFF) << 16) | (unsigned int(a & 0xFF) << 24) );
25 }
26
28 inline System::String^ GetMaterialTextureAbsName( const MQDocument doc, const MQMaterial mat, DWORD map_type ) {
29 char buf[MAX_PATH];
30 if ( (doc==NULL)||(mat==NULL) ) return System::String::Empty;
31 std::string path = MQ0x::GetMaterialTextureName(mat, map_type);
32 if ( doc->FindMappingFile(buf,path.c_str(),map_type)==FALSE ) return System::String::Empty;
33 return gcnew System::String( buf );
34 }
35
38 inline System::Collections::Generic::List<UINT>^ GetSelectedObjectIDs( const MQDocument doc, bool isRecursiveRootOnly ) {
39 System::Collections::Generic::List<UINT>^ selectedObjectIDs = gcnew System::Collections::Generic::List<UINT>();
40 if ( doc != NULL ) {
41 const int ctObj = doc->GetObjectCount();
42 for ( int ct = 0; ct < ctObj; ct++ ) {
43 const MQObject obj = doc->GetObject(ct);
44 if ( (obj!=NULL) && (obj->GetSelected()==TRUE) ) {
45 const UINT id = obj->GetUniqueID();
46 if ( selectedObjectIDs->Contains(id) == false ) {
47 bool isFind = false;
48 if ( isRecursiveRootOnly ) for ( MQObject parent = doc->GetParentObject( obj ); parent != NULL; parent = doc->GetParentObject(parent) ) {
49 if ( parent->GetSelected() == TRUE ) { isFind = true; break; }
50 }
51 if ( isFind == false ) selectedObjectIDs->Add(id);
52 }
53 }
54 }
55 }
56 return selectedObjectIDs;
57 }
59 inline System::Collections::Generic::List<UINT>^ GetSelectedObjectIDs( const MQDocument doc ) { return GetSelectedObjectIDs( doc, false ); }
62 inline System::Collections::Generic::List<System::String^>^ GetSelectedObjectNames( const MQDocument doc, bool isRecursiveRootOnly ) {
63 System::Collections::Generic::List<UINT>^ IDs = GetSelectedObjectIDs( doc, isRecursiveRootOnly );
64 System::Collections::Generic::List<System::String^>^ ret = gcnew System::Collections::Generic::List<System::String^>(IDs->Count);
65 for each ( UINT id in IDs ) {
66 System::String^ item = gcnew System::String(MQ0x::GetName(doc->GetObjectFromUniqueID(id)).c_str());
67 if (System::String::IsNullOrEmpty(item)==false) ret->Add(item);
68 }
69 return ret;
70 }
72 inline System::Collections::Generic::List<System::String^>^ GetSelectedObjectNames( const MQDocument doc ) { return GetSelectedObjectNames(doc,false); }
73
76 template <class T> T TryExpLogCeil2( T n ) {
77 T threshold = 1;
78 for ( ; threshold < (threshold*2); threshold *= 2 ) if ( n <= threshold ) break;
79 return threshold;
80 }
81
82
84 }