netradiant-custom/contrib/brushexport/plugin.cpp
Garux c845c5cd8f Radiant:
binds...
	* Tab: focus camera on selected

menus...
	* Modify->Nudge:+ Nudge +Z, Nudge -Z

misc...
	* improvement of: Scale tool: now scales bbox by gridsize increment
	* snap transform origin for rotate 90' commands, if one is not custom (is good to stay on grid)
	* 2d camera icon in ZY, ZX views represents yaw aswell
	* M3 camera direction control: disabled snapping
	* M3 camera direction control: affect yaw instead of doing pitch > 90' in ZY, ZX views
	* fix of: ctrl+m3 in 2d, release ctrl, then m3: m3 drag works like with ctrl pressed
	* removed 2 buttons mouse option: was only affecting m3 camera control binds
	* fix of: press any modifier (ctrl/shift/alt) + any mouse, release modifier, then mouse = chase mouse broken
	* removed 'Right Button Activates Context Menu' preference
	* brushExport plugin, prtview plugin, bobToolz::Polygon Builder, about, textures reset, messagebox windows live on top of main window
	* removed 'Update views on camera move' option: camera icon updating is enough quick
	* fix: bobToolz::split patch rows+columns - works if rows = 3 ( clos and rows were mixed up in general )
	* entitySetColour, entityNormalizeColour are undoable
	* bobToolz::splitPatch commands place result into parent entity (worldspawn or group one)
	* bobToolz::mergePatches places result into last selected patch's parent entity
	* bobToolz::mergePatches: remove left empty group entities
	* SelectAllOfType works for group entities, whose brush(es) are selected (no parent node selection needed).
		Algorithm is: get [ent inspector's keyName field(if visible) or classname]'s keyValues of selected ents ('no key' counts, as property, too);
		Then select ents with according keyName+keyValues; Worldspawn is omitted;
		Otherwise (nothing or worldspawn selected) select primitives, holding selected texture;
		in 'Faces' component mode = select specifically faces, holding selected texture;
	* SelectAllOfType selects child primitives of group entities
	* ExpandSelectionToEntities works for worldspawn entity too
2017-08-02 09:09:58 +03:00

129 lines
3.5 KiB
C++

/*
Copyright (C) 2006, Thomas Nitschke.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "plugin.h"
#include "iplugin.h"
#include "qerplugin.h"
#include <gtk/gtk.h>
#include <gtk/gtktreeview.h>
#include "debugging/debugging.h"
#include "string/string.h"
#include "modulesystem/singletonmodule.h"
#include "stream/textfilestream.h"
#include "stream/stringstream.h"
#include "gtkutil/messagebox.h"
#include "gtkutil/filechooser.h"
#include "ibrush.h"
#include "iscenegraph.h"
#include "iselection.h"
#include "ifilesystem.h"
#include "ifiletypes.h"
#include "support.h"
#include "typesystem.h"
void CreateWindow( void );
void DestroyWindow( void );
bool IsWindowOpen( void );
GtkWidget *g_pRadiantWnd = NULL;
namespace BrushExport
{
GtkWindow* g_mainwnd;
const char* init( void* hApp, void* pMainWidget ){
g_mainwnd = (GtkWindow*)pMainWidget;
g_pRadiantWnd = (GtkWidget*)pMainWidget;
ASSERT_NOTNULL( g_mainwnd );
return "";
}
const char* getName(){
return "Brush export Plugin";
}
const char* getCommandList(){
return "Export selected as Wavefront Object;About";
}
const char* getCommandTitleList(){
return "";
}
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
if ( string_equal( command, "About" ) ) {
GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"
"Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",
eMB_OK,
eMB_ICONDEFAULT );
}
else if ( string_equal( command, "Export selected as Wavefront Object" ) ) {
if ( IsWindowOpen() ) {
DestroyWindow();
}
CreateWindow();
}
}
}
class BrushExportDependencies :
public GlobalRadiantModuleRef,
public GlobalFiletypesModuleRef,
public GlobalBrushModuleRef,
public GlobalFileSystemModuleRef,
public GlobalSceneGraphModuleRef,
public GlobalSelectionModuleRef
{
public:
BrushExportDependencies( void )
: GlobalBrushModuleRef( GlobalRadiant().getRequiredGameDescriptionKeyValue( "brushtypes" ) )
{}
};
class BrushExportModule : public TypeSystemRef
{
_QERPluginTable m_plugin;
public:
typedef _QERPluginTable Type;
STRING_CONSTANT( Name, "brushexport2" );
BrushExportModule(){
m_plugin.m_pfnQERPlug_Init = &BrushExport::init;
m_plugin.m_pfnQERPlug_GetName = &BrushExport::getName;
m_plugin.m_pfnQERPlug_GetCommandList = &BrushExport::getCommandList;
m_plugin.m_pfnQERPlug_GetCommandTitleList = &BrushExport::getCommandTitleList;
m_plugin.m_pfnQERPlug_Dispatch = &BrushExport::dispatch;
}
_QERPluginTable* getTable(){
return &m_plugin;
}
};
typedef SingletonModule<BrushExportModule, BrushExportDependencies> SingletonBrushExportModule;
SingletonBrushExportModule g_BrushExportModule;
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
initialiseModule( server );
g_BrushExportModule.selfRegister();
}