2 Copyright (C) 2006, Thomas Nitschke.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "qerplugin.h"
28 #include "debugging/debugging.h"
29 #include "string/string.h"
30 #include "modulesystem/singletonmodule.h"
31 #include "stream/textfilestream.h"
32 #include "stream/stringstream.h"
33 #include "gtkutil/messagebox.h"
34 #include "gtkutil/filechooser.h"
37 #include "iscenegraph.h"
38 #include "iselection.h"
39 #include "ifilesystem.h"
40 #include "ifiletypes.h"
44 #include "typesystem.h"
46 void CreateWindow(void);
48 void DestroyWindow(void);
50 bool IsWindowOpen(void);
52 namespace BrushExport {
53 ui::Window g_mainwnd{ui::null};
55 const char *init(void *hApp, void *pMainWidget)
57 g_mainwnd = ui::Window::from(pMainWidget);
58 ASSERT_TRUE(g_mainwnd);
64 return "Brush export Plugin";
67 const char *getCommandList()
69 return "Export selected as Wavefront Object;About";
72 const char *getCommandTitleList()
77 void dispatch(const char *command, float *vMin, float *vMax, bool bSingleBrush)
79 if (string_equal(command, "About")) {
80 GlobalRadiant().m_pfnMessageBox(g_mainwnd, "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
81 "Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
84 } else if (string_equal(command, "Export selected as Wavefront Object")) {
93 class BrushExportDependencies :
94 public GlobalRadiantModuleRef,
95 public GlobalFiletypesModuleRef,
96 public GlobalBrushModuleRef,
97 public GlobalFileSystemModuleRef,
98 public GlobalSceneGraphModuleRef,
99 public GlobalSelectionModuleRef {
101 BrushExportDependencies(void)
102 : GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes"))
106 class BrushExportModule : public TypeSystemRef {
107 _QERPluginTable m_plugin;
109 typedef _QERPluginTable Type;
111 STRING_CONSTANT(Name, "brushexport2");
115 m_plugin.m_pfnQERPlug_Init = &BrushExport::init;
116 m_plugin.m_pfnQERPlug_GetName = &BrushExport::getName;
117 m_plugin.m_pfnQERPlug_GetCommandList = &BrushExport::getCommandList;
118 m_plugin.m_pfnQERPlug_GetCommandTitleList = &BrushExport::getCommandTitleList;
119 m_plugin.m_pfnQERPlug_Dispatch = &BrushExport::dispatch;
122 _QERPluginTable *getTable()
128 typedef SingletonModule<BrushExportModule, BrushExportDependencies> SingletonBrushExportModule;
129 SingletonBrushExportModule g_BrushExportModule;
131 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
133 initialiseModule(server);
134 g_BrushExportModule.selfRegister();