Radiant:
binds... * ctrl + shift + v: MoveToCamera (translate selection to camera origin) * m2 in entities creation menu: change classname misc... * do not delete selected on entities creation, just deselect * ExpandSelectionToEntities: do not select invisible nodes * fix: keep stuff on grid after paste/move to camera commands, if stuff's size is (2*N + 1)*gridSize * MapName build system variable (can use to make build menu entry to run map in a game) * build->customize: list available build variables * texture browser: gtk search in directories and tags trees * fix: build menu->customize Cancel button cancels (was reloading menu from disk) * build menu->customize Reset button (= reload menu from disk = editor start state)
This commit is contained in:
parent
4dcf76ef34
commit
471fca65b6
|
|
@ -641,6 +641,8 @@ void build_commands_write( const char* filename ){
|
|||
#include <gtk/gtktreeselection.h>
|
||||
#include <gtk/gtkliststore.h>
|
||||
#include <gtk/gtkscrolledwindow.h>
|
||||
#include <gtk/gtkexpander.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
|
||||
#include "gtkutil/dialog.h"
|
||||
#include "gtkutil/closure.h"
|
||||
|
|
@ -846,6 +848,7 @@ gboolean commands_key_press( GtkWidget* widget, GdkEventKey* event, GtkListStore
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#include "qe3.h"
|
||||
|
||||
GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){
|
||||
GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Build Menu", G_CALLBACK( dialog_delete_callback ), &modal, -1, 400 );
|
||||
|
|
@ -853,7 +856,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
|
|||
GtkWidget* buildView = 0;
|
||||
|
||||
{
|
||||
GtkTable* table1 = create_dialog_table( 2, 2, 4, 4, 4 );
|
||||
GtkTable* table1 = create_dialog_table( 3, 2, 4, 4, 4 );
|
||||
gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( table1 ) );
|
||||
{
|
||||
GtkVBox* vbox = create_dialog_vbox( 4 );
|
||||
|
|
@ -868,6 +871,11 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
|
|||
GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &modal );
|
||||
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
|
||||
}
|
||||
{
|
||||
GtkButton* button = create_dialog_button( "Reset", G_CALLBACK( dialog_button_no ), &modal );
|
||||
gtk_widget_set_tooltip_text( GTK_WIDGET( button ), "Reset to editor start state" );
|
||||
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
|
||||
}
|
||||
}
|
||||
{
|
||||
GtkFrame* frame = create_dialog_frame( "Build menu" );
|
||||
|
|
@ -947,6 +955,38 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
|
|||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
GtkWidget* expander = gtk_expander_new_with_mnemonic( "build variables" );
|
||||
gtk_widget_show( expander );
|
||||
gtk_table_attach( table1, expander, 0, 2, 2, 3,
|
||||
(GtkAttachOptions) ( GTK_FILL ),
|
||||
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
|
||||
|
||||
bsp_init();
|
||||
for ( Tools::iterator i = g_build_tools.begin(); i != g_build_tools.end(); ++i ){
|
||||
StringBuffer output;
|
||||
( *i ).second.evaluate( output );
|
||||
build_set_variable( ( *i ).first.c_str(), output.c_str() );
|
||||
}
|
||||
StringOutputStream stream;
|
||||
for( Variables::iterator i = g_build_variables.begin(); i != g_build_variables.end(); ++i ){
|
||||
stream << "[" << ( *i ).first.c_str() << "] = " << ( *i ).second.c_str() << "\n";
|
||||
}
|
||||
build_clear_variables();
|
||||
|
||||
GtkWidget* label = gtk_label_new( stream.c_str() );
|
||||
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
|
||||
#if 1
|
||||
gtk_label_set_ellipsize( GTK_LABEL( label ), PANGO_ELLIPSIZE_END );
|
||||
#else
|
||||
gtk_label_set_line_wrap( GTK_LABEL( label ), TRUE );
|
||||
//gtk_label_set_max_width_chars( GTK_LABEL( label ), 100 );
|
||||
//gtk_label_set_width_chars( GTK_LABEL( label ), 100 );
|
||||
gtk_widget_set_size_request( label, 500, -1 );
|
||||
#endif
|
||||
gtk_widget_show( label );
|
||||
gtk_container_add( GTK_CONTAINER( expander ), label );
|
||||
}
|
||||
}
|
||||
|
||||
BSPCommandList_Construct( projectList.m_store, g_build_project );
|
||||
|
|
@ -969,7 +1009,16 @@ void DoBuildMenu(){
|
|||
|
||||
GtkWindow* window = BuildMenuDialog_construct( modal, projectList );
|
||||
|
||||
if ( modal_dialog_show( window, modal ) == eIDCANCEL ) {
|
||||
Project bakproj = g_build_project;
|
||||
|
||||
EMessageBoxReturn ret = modal_dialog_show( window, modal );
|
||||
if ( ret == eIDCANCEL ) {
|
||||
if ( projectList.m_changed || g_build_changed ){
|
||||
g_build_project = bakproj;
|
||||
Build_refreshMenu( g_bsp_menu );
|
||||
}
|
||||
}
|
||||
else if( ret == eIDNO ){//RESET
|
||||
build_commands_clear();
|
||||
LoadBuildMenu();
|
||||
|
||||
|
|
@ -987,7 +1036,6 @@ void DoBuildMenu(){
|
|||
#include "gtkutil/menu.h"
|
||||
#include "mainframe.h"
|
||||
#include "preferences.h"
|
||||
#include "qe3.h"
|
||||
|
||||
typedef struct _GtkMenuItem GtkMenuItem;
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
|||
scene::Instance& instance = findInstance( entitypath );
|
||||
|
||||
if ( entityClass->fixedsize || ( isModel && !brushesSelected ) ) {
|
||||
Select_Delete();
|
||||
//Select_Delete();
|
||||
|
||||
Transformable* transform = Instance_getTransformable( instance );
|
||||
if ( transform != 0 ) {
|
||||
|
|
@ -359,7 +359,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
|
|||
Scene_forEachChildSelectable( SelectableSetSelected( true ), instance.path() );
|
||||
}
|
||||
|
||||
// tweaking: when right clic dropping a light entity, ask for light value in a custom dialog box
|
||||
// tweaking: when right click dropping a light entity, ask for light value in a custom dialog box
|
||||
// see SF bug 105383
|
||||
|
||||
if ( g_pGameDescription->mGameType == "hl" ) {
|
||||
|
|
|
|||
|
|
@ -708,23 +708,30 @@ void Paste(){
|
|||
}
|
||||
}
|
||||
|
||||
void PasteToCamera(){
|
||||
void TranslateToCamera(){
|
||||
CamWnd& camwnd = *g_pParentWnd->GetCamWnd();
|
||||
GlobalSelectionSystem().setSelectedAll( false );
|
||||
|
||||
UndoableCommand undo( "pasteToCamera" );
|
||||
|
||||
Selection_Paste();
|
||||
|
||||
// Work out the delta
|
||||
Vector3 mid;
|
||||
Select_GetMid( mid );
|
||||
Vector3 delta = vector3_subtracted( vector3_snapped( Camera_getOrigin( camwnd ), GetSnapGridSize() ), mid );
|
||||
//Vector3 delta = vector3_subtracted( vector3_snapped( Camera_getOrigin( camwnd ), GetSnapGridSize() ), mid );
|
||||
Vector3 delta = vector3_snapped( vector3_subtracted( Camera_getOrigin( camwnd ), mid ), GetSnapGridSize() );
|
||||
|
||||
// Move to camera
|
||||
GlobalSelectionSystem().translateSelected( delta );
|
||||
}
|
||||
|
||||
void PasteToCamera(){
|
||||
GlobalSelectionSystem().setSelectedAll( false );
|
||||
UndoableCommand undo( "pasteToCamera" );
|
||||
Selection_Paste();
|
||||
TranslateToCamera();
|
||||
}
|
||||
|
||||
void MoveToCamera(){
|
||||
UndoableCommand undo( "moveToCamera" );
|
||||
TranslateToCamera();
|
||||
}
|
||||
|
||||
|
||||
void ColorScheme_Original(){
|
||||
TextureBrowser_setBackgroundColour( GlobalTextureBrowser(), Vector3( 0.25f, 0.25f, 0.25f ) );
|
||||
|
|
@ -1903,6 +1910,7 @@ GtkMenuItem* create_edit_menu(){
|
|||
create_menu_item_with_mnemonic( menu, "_Copy", "Copy" );
|
||||
create_menu_item_with_mnemonic( menu, "_Paste", "Paste" );
|
||||
create_menu_item_with_mnemonic( menu, "P_aste To Camera", "PasteToCamera" );
|
||||
create_menu_item_with_mnemonic( menu, "Move To Camera", "MoveToCamera" );
|
||||
menu_separator( menu );
|
||||
create_menu_item_with_mnemonic( menu, "_Duplicate", "CloneSelection" );
|
||||
create_menu_item_with_mnemonic( menu, "Duplicate, make uni_que", "CloneSelectionAndMakeUnique" );
|
||||
|
|
@ -3430,6 +3438,7 @@ void MainFrame_Construct(){
|
|||
GlobalCommands_insert( "Copy", FreeCaller<Copy>(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
|
||||
GlobalCommands_insert( "Paste", FreeCaller<Paste>(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
|
||||
GlobalCommands_insert( "PasteToCamera", FreeCaller<PasteToCamera>(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) );
|
||||
GlobalCommands_insert( "MoveToCamera", FreeCaller<MoveToCamera>(), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
|
||||
GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) );
|
||||
GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) );
|
||||
// GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
|
||||
|
|
|
|||
|
|
@ -165,8 +165,11 @@ void bsp_init(){
|
|||
build_set_variable( "GameName", gamename_get() );
|
||||
|
||||
const char* mapname = Map_Name( g_map );
|
||||
StringOutputStream name( 256 );
|
||||
name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".bsp";
|
||||
{
|
||||
StringOutputStream name( 256 );
|
||||
name << StringRange( mapname, path_get_filename_base_end( mapname ) ) << ".bsp";
|
||||
build_set_variable( "BspFile", name.c_str() );
|
||||
}
|
||||
|
||||
if( region_active ){
|
||||
StringOutputStream name( 256 );
|
||||
|
|
@ -177,7 +180,11 @@ void bsp_init(){
|
|||
build_set_variable( "MapFile", mapname );
|
||||
}
|
||||
|
||||
build_set_variable( "BspFile", name.c_str() );
|
||||
{
|
||||
StringOutputStream name( 256 );
|
||||
name << StringRange( path_get_filename_start( mapname ), path_get_filename_base_end( mapname ) );
|
||||
build_set_variable( "MapName", name.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void bsp_shutdown(){
|
||||
|
|
|
|||
|
|
@ -62,5 +62,6 @@ class SimpleCounter;
|
|||
extern SimpleCounter g_brushCount;
|
||||
extern SimpleCounter g_entityCount;
|
||||
|
||||
void bsp_init();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -394,6 +394,9 @@ ExpandSelectionToEntitiesWalker() : m_depth( 0 ), worldspawn( Map_FindOrInsertWo
|
|||
bool pre( const scene::Path& path, scene::Instance& instance ) const {
|
||||
++m_depth;
|
||||
|
||||
if( !path.top().get().visible() )
|
||||
return false;
|
||||
|
||||
// ignore worldspawn
|
||||
// NodeSmartReference me( path.top().get() );
|
||||
// if ( me == worldspawn ) {
|
||||
|
|
|
|||
|
|
@ -1641,7 +1641,7 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV
|
|||
void TextureBrowser_createTreeViewTree(){
|
||||
GtkCellRenderer* renderer;
|
||||
g_TextureBrowser.m_treeViewTree = GTK_WIDGET( gtk_tree_view_new() );
|
||||
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
|
||||
//gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
|
||||
|
||||
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE );
|
||||
g_signal_connect( g_TextureBrowser.m_treeViewTree, "row-activated", (GCallback) TreeView_onRowActivated, NULL );
|
||||
|
|
@ -1704,7 +1704,7 @@ gboolean TreeViewTags_onButtonPressed( GtkWidget *treeview, GdkEventButton *even
|
|||
void TextureBrowser_createTreeViewTags(){
|
||||
GtkCellRenderer* renderer;
|
||||
g_TextureBrowser.m_treeViewTags = GTK_WIDGET( gtk_tree_view_new() );
|
||||
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
|
||||
// gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE );
|
||||
|
||||
g_signal_connect( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL );
|
||||
|
||||
|
|
|
|||
|
|
@ -1187,6 +1187,31 @@ void XYWnd::NewBrushDrag( int x, int y ){
|
|||
"textures/common/caulk" : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) );
|
||||
}
|
||||
|
||||
gboolean entitycreate_rightClicked( GtkWidget* widget, GdkEvent* event, gpointer user_data ) {
|
||||
if ( event->button.button == 3 ) {
|
||||
// globalOutputStream() << "yo+\n";
|
||||
|
||||
const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( widget )->child ) );
|
||||
StringOutputStream command;
|
||||
command << "entitySetClass -class " << entity_name;
|
||||
UndoableCommand undo( command.c_str() );
|
||||
|
||||
Scene_EntitySetClassname_Selected( entity_name );
|
||||
|
||||
gtk_menu_popdown( XYWnd::m_mnuDrop );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean entitycreate_rightUnClicked( GtkWidget* widget, GdkEvent* event, gpointer user_data ) {
|
||||
if ( event->button.button == 3 ) {
|
||||
// globalOutputStream() << "yo-\n";
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void entitycreate_activated( GtkWidget* item ){
|
||||
scene::Node* world_node = Map_FindWorldspawn( g_map );
|
||||
const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) );
|
||||
|
|
@ -1223,6 +1248,8 @@ void entitycreate_activated( GtkWidget* item ){
|
|||
|
||||
void EntityClassMenu_addItem( GtkMenu* menu, const char* name ){
|
||||
GtkMenuItem* item = GTK_MENU_ITEM( gtk_menu_item_new_with_label( name ) );
|
||||
g_signal_connect( G_OBJECT( item ), "button-press-event", G_CALLBACK( entitycreate_rightClicked ), item );
|
||||
g_signal_connect( G_OBJECT( item ), "button-release-event", G_CALLBACK( entitycreate_rightUnClicked ), item );
|
||||
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( entitycreate_activated ), item );
|
||||
gtk_widget_show( GTK_WIDGET( item ) );
|
||||
menu_add_item( menu, item );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user