* Model Browser: default bind '/'
m1 = assign model to selected entity nodes (shift + e to select nodes of group entities) m1x2 = insert "misc_model" with given model m1 drag = rotate model Preferences.Model Browser: list of * separated folderToLoad/depth values, e.g. *models/mapobjects/99*maps/1*; */99* loads root
This commit is contained in:
parent
49b725a1b2
commit
06cd1e98ff
1
Makefile
1
Makefile
|
|
@ -705,6 +705,7 @@ $(INSTALLDIR)/radiant.$(EXE): \
|
|||
radiant/mainframe.o \
|
||||
radiant/main.o \
|
||||
radiant/map.o \
|
||||
radiant/modelwindow.o \
|
||||
$(if $(findstring $(OS),Win32),radiant/multimon.o,) \
|
||||
radiant/mru.o \
|
||||
radiant/nullmodel.o \
|
||||
|
|
|
|||
|
|
@ -225,4 +225,46 @@ void unfreeze_pointer( GtkWindow* window, bool centerize ){
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class DeferredAdjustment
|
||||
{
|
||||
gdouble m_value;
|
||||
guint m_handler;
|
||||
typedef void ( *ValueChangedFunction )( void* data, gdouble value );
|
||||
ValueChangedFunction m_function;
|
||||
void* m_data;
|
||||
|
||||
static gboolean deferred_value_changed( gpointer data ){
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_function(
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_data,
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_value
|
||||
);
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_handler = 0;
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_value = 0;
|
||||
return FALSE;
|
||||
}
|
||||
public:
|
||||
DeferredAdjustment( ValueChangedFunction function, void* data ) : m_value( 0 ), m_handler( 0 ), m_function( function ), m_data( data ){
|
||||
}
|
||||
void flush(){
|
||||
if ( m_handler != 0 ) {
|
||||
g_source_remove( m_handler );
|
||||
deferred_value_changed( this );
|
||||
}
|
||||
}
|
||||
void value_changed( gdouble value ){
|
||||
m_value = value;
|
||||
if ( m_handler == 0 ) {
|
||||
m_handler = g_idle_add( deferred_value_changed, this );
|
||||
}
|
||||
}
|
||||
static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){
|
||||
self->value_changed( adjustment->value );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -642,6 +642,18 @@ GtkWidget* Dialog::addFloatEntry( GtkWidget* vbox, const char* name, const Float
|
|||
return row.m_row;
|
||||
}
|
||||
|
||||
GtkWidget* Dialog::addTextEntry( GtkWidget* vbox, const char* name, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
|
||||
GtkEntry* entry = DialogEntry_new();
|
||||
gtk_widget_set_size_request( GTK_WIDGET( entry ), -1, -1 ); // unset
|
||||
|
||||
AddTextEntryData( *entry, importViewer, exportViewer );
|
||||
|
||||
GtkTable* row = DialogRow_new( name, GTK_WIDGET( entry ) );
|
||||
DialogVBox_packRow( GTK_VBOX( vbox ), GTK_WIDGET( row ) );
|
||||
|
||||
return GTK_WIDGET( row );
|
||||
}
|
||||
|
||||
GtkWidget* Dialog::addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importViewer, const StringExportCallback& exportViewer ){
|
||||
PathEntry pathEntry = PathEntry_new();
|
||||
g_signal_connect( G_OBJECT( pathEntry.m_button ), "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
|
||||
|
|
|
|||
|
|
@ -160,6 +160,10 @@ GtkWidget* addFloatEntry( GtkWidget* vbox, const char* name, const FloatImportCa
|
|||
GtkWidget* addEntry( GtkWidget* vbox, const char* name, float& data ){
|
||||
return addFloatEntry( vbox, name, FloatImportCaller( data ), FloatExportCaller( data ) );
|
||||
}
|
||||
GtkWidget* addTextEntry( GtkWidget* vbox, const char* name, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
|
||||
GtkWidget* addEntry( GtkWidget* vbox, const char* name, CopiedString& data ){
|
||||
return addTextEntry( vbox, name, StringImportCallback( StringImportCaller( data ) ), StringExportCallback( StringExportCaller( data ) ) );
|
||||
}
|
||||
GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback );
|
||||
GtkWidget* addPathEntry( GtkWidget* vbox, const char* name, CopiedString& data, bool directory );
|
||||
GtkWidget* addSpinner( GtkWidget* vbox, const char* name, int& data, double value, double lower, double upper );
|
||||
|
|
|
|||
|
|
@ -92,6 +92,9 @@ static gboolean switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint
|
|||
GroupDialog_updatePageTitle( GTK_WINDOW( data ), page_num );
|
||||
g_current_page = page_num;
|
||||
|
||||
/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
|
||||
g_object_set_data( G_OBJECT( g_GroupDlg.m_window ), "glwidget", g_object_get_data( G_OBJECT( gtk_notebook_get_nth_page( notebook, page_num ) ), "glwidget" ) );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
#include "surfacedialog.h"
|
||||
#include "textures.h"
|
||||
#include "texwindow.h"
|
||||
#include "modelwindow.h"
|
||||
#include "url.h"
|
||||
#include "xywindow.h"
|
||||
#include "windowobservers.h"
|
||||
|
|
@ -1088,6 +1089,12 @@ void EntityInspector_ToggleShow(){
|
|||
GroupDialog_showPage( g_page_entity );
|
||||
}
|
||||
|
||||
GtkWidget* g_page_models;
|
||||
|
||||
void ModelBrowser_ToggleShow(){
|
||||
GroupDialog_showPage( g_page_models );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetClipMode( bool enable );
|
||||
|
|
@ -2095,6 +2102,7 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
|
|||
create_menu_item_with_mnemonic( menu, "Console", "ToggleConsole" );
|
||||
create_menu_item_with_mnemonic( menu, "Texture Browser", "ToggleTextures" );
|
||||
}
|
||||
create_menu_item_with_mnemonic( menu, "Model Browser", "ToggleModelBrowser" );
|
||||
create_menu_item_with_mnemonic( menu, "Entity Inspector", "ToggleEntityInspector" );
|
||||
create_menu_item_with_mnemonic( menu, "_Surface Inspector", "SurfaceInspector" );
|
||||
create_menu_item_with_mnemonic( menu, "_Patch Inspector", "PatchInspector" );
|
||||
|
|
@ -3119,6 +3127,13 @@ void MainFrame::Create(){
|
|||
g_page_console = GroupDialog_addPage( "Console", Console_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Console" ) );
|
||||
}
|
||||
|
||||
{
|
||||
GtkFrame* frame = create_framed_widget( ModelBrowser_constructWindow( GroupDialog_getWindow() ) );
|
||||
g_page_models = GroupDialog_addPage( "Models", GTK_WIDGET( frame ), RawStringExportCaller( "Models" ) );
|
||||
/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
|
||||
g_object_set_data( G_OBJECT( g_page_models ), "glwidget", ModelBrowser_getGLWidget() );
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if ( g_multimon_globals.m_bStartOnPrimMon ) {
|
||||
PositionWindowOnPrimaryScreen( g_layout_globals.m_position );
|
||||
|
|
@ -3266,7 +3281,7 @@ void MainFrame::Create(){
|
|||
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
|
||||
g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
|
||||
/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
|
||||
g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
|
||||
g_object_set_data( G_OBJECT( g_page_textures ), "glwidget", TextureBrowser_getGLWidget() );
|
||||
}
|
||||
|
||||
m_vSplit = 0;
|
||||
|
|
@ -3305,7 +3320,7 @@ void MainFrame::Create(){
|
|||
GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
|
||||
g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
|
||||
/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
|
||||
g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
|
||||
g_object_set_data( G_OBJECT( g_page_textures ), "glwidget", TextureBrowser_getGLWidget() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3392,6 +3407,7 @@ void MainFrame::Shutdown(){
|
|||
delete m_pXZWnd;
|
||||
m_pXZWnd = 0;
|
||||
|
||||
ModelBrowser_destroyWindow();
|
||||
TextureBrowser_destroyWindow();
|
||||
|
||||
DeleteCamWnd( m_pCamWnd );
|
||||
|
|
@ -3605,6 +3621,7 @@ void MainFrame_Construct(){
|
|||
|
||||
GlobalCommands_insert( "ToggleConsole", FreeCaller<Console_ToggleShow>(), Accelerator( 'O' ) );
|
||||
GlobalCommands_insert( "ToggleEntityInspector", FreeCaller<EntityInspector_ToggleShow>(), Accelerator( 'N' ) );
|
||||
GlobalCommands_insert( "ToggleModelBrowser", FreeCaller<ModelBrowser_ToggleShow>(), Accelerator( '/' ) );
|
||||
GlobalCommands_insert( "EntityList", FreeCaller<EntityList_toggleShown>(), Accelerator( 'L' ) );
|
||||
|
||||
// GlobalCommands_insert( "ShowHidden", FreeCaller<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
|
||||
|
|
|
|||
|
|
@ -409,6 +409,7 @@ void RemoveRegionBrushes( void );
|
|||
free all map elements, reinitialize the structures that depend on them
|
||||
================
|
||||
*/
|
||||
#include "modelwindow.h"
|
||||
void Map_Free(){
|
||||
Map_RegionOff();
|
||||
Select_ShowAllHidden();
|
||||
|
|
@ -419,6 +420,8 @@ void Map_Free(){
|
|||
GlobalReferenceCache().release( g_map.m_name.c_str() );
|
||||
g_map.m_resource = 0;
|
||||
|
||||
ModelBrowser_flushReferences();
|
||||
|
||||
FlushReferences();
|
||||
|
||||
g_currentMap = 0;
|
||||
|
|
|
|||
1413
radiant/modelwindow.cpp
Normal file
1413
radiant/modelwindow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
41
radiant/modelwindow.h
Normal file
41
radiant/modelwindow.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined( INCLUDED_MODELWINDOW_H )
|
||||
#define INCLUDED_MODELWINDOW_H
|
||||
|
||||
|
||||
void ModelBrowser_Construct();
|
||||
void ModelBrowser_Destroy();
|
||||
|
||||
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
typedef struct _GtkWindow GtkWindow;
|
||||
|
||||
GtkWidget* ModelBrowser_constructWindow( GtkWindow* toplevel );
|
||||
void ModelBrowser_destroyWindow();
|
||||
|
||||
GtkWidget* ModelBrowser_getGLWidget();
|
||||
|
||||
void ModelBrowser_flushReferences();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -59,6 +59,7 @@
|
|||
#include "points.h"
|
||||
#include "gtkmisc.h"
|
||||
#include "texwindow.h"
|
||||
#include "modelwindow.h"
|
||||
#include "mainframe.h"
|
||||
#include "build.h"
|
||||
#include "mru.h"
|
||||
|
|
@ -246,6 +247,7 @@ Radiant(){
|
|||
XYWindow_Construct();
|
||||
BuildMonitor_Construct();
|
||||
TextureBrowser_Construct();
|
||||
ModelBrowser_Construct();
|
||||
Entity_Construct();
|
||||
Autosave_Construct();
|
||||
EntityInspector_construct();
|
||||
|
|
@ -265,6 +267,7 @@ Radiant(){
|
|||
EntityInspector_destroy();
|
||||
Autosave_Destroy();
|
||||
Entity_Destroy();
|
||||
ModelBrowser_Destroy();
|
||||
TextureBrowser_Destroy();
|
||||
BuildMonitor_Destroy();
|
||||
XYWindow_Destroy();
|
||||
|
|
|
|||
|
|
@ -91,6 +91,12 @@ GtkWidget* appendEntry( const char* name, const FloatImportCallback& importCallb
|
|||
GtkWidget* appendEntry( const char* name, float& data ){
|
||||
return m_dialog.addEntry( m_vbox, name, data );
|
||||
}
|
||||
GtkWidget* appendEntry( const char* name, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
|
||||
return m_dialog.addTextEntry( m_vbox, name, importCallback, exportCallback );
|
||||
}
|
||||
GtkWidget* appendEntry( const char* name, CopiedString& data ){
|
||||
return m_dialog.addEntry( m_vbox, name, data );
|
||||
}
|
||||
GtkWidget* appendPathEntry( const char* name, bool browse_directory, const StringImportCallback& importCallback, const StringExportCallback& exportCallback ){
|
||||
return m_dialog.addPathEntry( m_vbox, name, browse_directory, importCallback, exportCallback );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,43 +133,6 @@ bool g_TextureBrowser_enableAlpha = false;
|
|||
bool g_TextureBrowser_filter_searchFromStart = false;
|
||||
}
|
||||
|
||||
class DeferredAdjustment
|
||||
{
|
||||
gdouble m_value;
|
||||
guint m_handler;
|
||||
typedef void ( *ValueChangedFunction )( void* data, gdouble value );
|
||||
ValueChangedFunction m_function;
|
||||
void* m_data;
|
||||
|
||||
static gboolean deferred_value_changed( gpointer data ){
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_function(
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_data,
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_value
|
||||
);
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_handler = 0;
|
||||
reinterpret_cast<DeferredAdjustment*>( data )->m_value = 0;
|
||||
return FALSE;
|
||||
}
|
||||
public:
|
||||
DeferredAdjustment( ValueChangedFunction function, void* data ) : m_value( 0 ), m_handler( 0 ), m_function( function ), m_data( data ){
|
||||
}
|
||||
void flush(){
|
||||
if ( m_handler != 0 ) {
|
||||
g_source_remove( m_handler );
|
||||
deferred_value_changed( this );
|
||||
}
|
||||
}
|
||||
void value_changed( gdouble value ){
|
||||
m_value = value;
|
||||
if ( m_handler == 0 ) {
|
||||
m_handler = g_idle_add( deferred_value_changed, this );
|
||||
}
|
||||
}
|
||||
static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){
|
||||
self->value_changed( adjustment->value );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TextureBrowser;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user