| 1 | /* |
|---|
| 2 | ----------------------------------------------------------------------------- |
|---|
| 3 | This source file is part of OGRE |
|---|
| 4 | (Object-oriented Graphics Rendering Engine) |
|---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
|---|
| 6 | |
|---|
| 7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
|---|
| 8 | Also see acknowledgements in Readme.html |
|---|
| 9 | |
|---|
| 10 | This program is free software; you can redistribute it and/or modify it under |
|---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software |
|---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 13 | version. |
|---|
| 14 | |
|---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|---|
| 18 | |
|---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
|---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
|---|
| 22 | http://www.gnu.org/copyleft/lesser.txt. |
|---|
| 23 | |
|---|
| 24 | You may alternatively use this source under the terms of a specific version of |
|---|
| 25 | the OGRE Unrestricted License provided you have obtained such a license from |
|---|
| 26 | Torus Knot Software Ltd. |
|---|
| 27 | ----------------------------------------------------------------------------- |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | #include "OgreExport.h" |
|---|
| 31 | |
|---|
| 32 | #include "max.h" |
|---|
| 33 | #include "plugapi.h" |
|---|
| 34 | #include "impexp.h" |
|---|
| 35 | |
|---|
| 36 | static int controlsInit = FALSE; |
|---|
| 37 | static HINSTANCE hInstance; |
|---|
| 38 | |
|---|
| 39 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { |
|---|
| 40 | hInstance = hinstDLL; |
|---|
| 41 | if ( !controlsInit ) { |
|---|
| 42 | controlsInit = TRUE; |
|---|
| 43 | |
|---|
| 44 | // jaguar controls |
|---|
| 45 | InitCustomControls(hInstance); |
|---|
| 46 | |
|---|
| 47 | // initialize Chicago controls |
|---|
| 48 | InitCommonControls(); |
|---|
| 49 | } |
|---|
| 50 | switch(fdwReason) { |
|---|
| 51 | case DLL_PROCESS_ATTACH: |
|---|
| 52 | //MessageBox(NULL,_T("3DSIMP.DLL: DllMain"),_T("3DSIMP"),MB_OK); |
|---|
| 53 | if (FAILED(CoInitialize(NULL))) |
|---|
| 54 | return FALSE; |
|---|
| 55 | break; |
|---|
| 56 | case DLL_THREAD_ATTACH: |
|---|
| 57 | break; |
|---|
| 58 | case DLL_THREAD_DETACH: |
|---|
| 59 | break; |
|---|
| 60 | case DLL_PROCESS_DETACH: |
|---|
| 61 | break; |
|---|
| 62 | } |
|---|
| 63 | return(TRUE); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | //------------------------------------------------------ |
|---|
| 68 | static OgreMaxExportClassDesc OgreMaxExportDescInst; |
|---|
| 69 | |
|---|
| 70 | int OgreMaxExportClassDesc::IsPublic() { |
|---|
| 71 | return 1; |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | void * OgreMaxExportClassDesc::Create(BOOL loading) { |
|---|
| 75 | OgreMaxExport *inst = new OgreMaxExport(hInstance); |
|---|
| 76 | return inst; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | const TCHAR * OgreMaxExportClassDesc::ClassName() { |
|---|
| 80 | return _T("Ogre 3DSMax Exporter"); |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | SClass_ID OgreMaxExportClassDesc::SuperClassID() { |
|---|
| 84 | return SCENE_EXPORT_CLASS_ID; |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | Class_ID OgreMaxExportClassDesc::ClassID() { |
|---|
| 88 | return Class_ID(0x2a961d1d, 0x8160db1); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | const TCHAR* OgreMaxExportClassDesc::Category() { |
|---|
| 92 | return _T("Ogre 3DSMax Exporter"); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | TCHAR *GetString(int id) |
|---|
| 97 | { |
|---|
| 98 | static TCHAR buf[256]; |
|---|
| 99 | |
|---|
| 100 | if (hInstance) |
|---|
| 101 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; |
|---|
| 102 | return NULL; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | extern "C" { |
|---|
| 106 | //------------------------------------------------------ |
|---|
| 107 | // This is the interface to Jaguar: |
|---|
| 108 | //------------------------------------------------------ |
|---|
| 109 | |
|---|
| 110 | // what does this DLL contain? |
|---|
| 111 | __declspec( dllexport ) const TCHAR * |
|---|
| 112 | LibDescription() { |
|---|
| 113 | return _T("Ogre 3DSMax Exporter"); |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | // how many plugin classes do we implement in this DLL? |
|---|
| 117 | __declspec( dllexport ) int |
|---|
| 118 | LibNumberClasses() { |
|---|
| 119 | return 1; |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | // return a class descriptor class for each plugin class in this DLL; |
|---|
| 123 | // 0-based, so i==0 is the first plugin in this DLL, and so on |
|---|
| 124 | __declspec( dllexport ) ClassDesc * |
|---|
| 125 | LibClassDesc(int i) { |
|---|
| 126 | switch(i) { |
|---|
| 127 | case 0: |
|---|
| 128 | return &OgreMaxExportDescInst; |
|---|
| 129 | break; |
|---|
| 130 | default: |
|---|
| 131 | return 0; |
|---|
| 132 | break; |
|---|
| 133 | } |
|---|
| 134 | } |
|---|
| 135 | |
|---|
| 136 | // Return version so can detect obsolete DLLs |
|---|
| 137 | __declspec( dllexport ) ULONG |
|---|
| 138 | LibVersion() { |
|---|
| 139 | return VERSION_3DSMAX; |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | // Let the plug-in register itself for deferred loading |
|---|
| 143 | __declspec( dllexport ) ULONG CanAutoDefer() |
|---|
| 144 | { |
|---|
| 145 | return 1; |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | } |
|---|