From: Thomas Debesse Date: Mon, 11 Feb 2019 14:17:16 +0000 (+0100) Subject: Merge commit 'fe73dd74d0e40a33c090993390e4d5721a1f9e05' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b681f28130ff2e9789253eff1c1d41163e427eaa;p=xonotic%2Fnetradiant.git Merge commit 'fe73dd74d0e40a33c090993390e4d5721a1f9e05' into garux-merge --- b681f28130ff2e9789253eff1c1d41163e427eaa diff --cc radiant/environment.cpp index 484258d7,74de78b6..38c93c41 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@@ -110,10 -104,10 +110,11 @@@ bool gamedetect_check_game( char const void gamedetect(){ // if we're inside a Nexuiz install // default to nexuiz.game (unless the user used an option to inhibit this) - bool nogamedetect = false; + //bool nogamedetect = false; + bool nogamedetect = true; int i; for ( i = 1; i < g_argc - 1; ++i ) + { if ( g_argv[i][0] == '-' ) { if ( !strcmp( g_argv[i], "-gamedetect" ) ) { nogamedetect = !strcmp( g_argv[i + 1], "false" ); diff --cc radiant/mainframe.cpp index 50101b3f,310e7d97..6f377579 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -3491,38 -3343,41 +3493,41 @@@ void MainFrame_Construct() Patch_registerCommands(); XYShow_registerCommands(); - typedef FreeCaller1 ComponentModeSelectionChangedCaller; + typedef FreeCaller ComponentModeSelectionChangedCaller; GlobalSelectionSystem().addSelectionChangeCallback( ComponentModeSelectionChangedCaller() ); - GlobalPreferenceSystem().registerPreference( "DetachableMenus", BoolImportStringCaller( g_Layout_enableDetachableMenus.m_latched ), BoolExportStringCaller( g_Layout_enableDetachableMenus.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "PatchToolBar", BoolImportStringCaller( g_Layout_enablePatchToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePatchToolbar.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "PluginToolBar", BoolImportStringCaller( g_Layout_enablePluginToolbar.m_latched ), BoolExportStringCaller( g_Layout_enablePluginToolbar.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "FilterToolBar", BoolImportStringCaller( g_Layout_enableFilterToolbar.m_latched ), BoolExportStringCaller( g_Layout_enableFilterToolbar.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", IntImportStringCaller( g_Layout_viewStyle.m_latched ), IntExportStringCaller( g_Layout_viewStyle.m_latched ) ); - GlobalPreferenceSystem().registerPreference( "XYHeight", IntImportStringCaller( g_layout_globals.nXYHeight ), IntExportStringCaller( g_layout_globals.nXYHeight ) ); - GlobalPreferenceSystem().registerPreference( "XYWidth", IntImportStringCaller( g_layout_globals.nXYWidth ), IntExportStringCaller( g_layout_globals.nXYWidth ) ); - GlobalPreferenceSystem().registerPreference( "CamWidth", IntImportStringCaller( g_layout_globals.nCamWidth ), IntExportStringCaller( g_layout_globals.nCamWidth ) ); - GlobalPreferenceSystem().registerPreference( "CamHeight", IntImportStringCaller( g_layout_globals.nCamHeight ), IntExportStringCaller( g_layout_globals.nCamHeight ) ); - - GlobalPreferenceSystem().registerPreference( "State", IntImportStringCaller( g_layout_globals.nState ), IntExportStringCaller( g_layout_globals.nState ) ); - GlobalPreferenceSystem().registerPreference( "PositionX", IntImportStringCaller( g_layout_globals.m_position.x ), IntExportStringCaller( g_layout_globals.m_position.x ) ); - GlobalPreferenceSystem().registerPreference( "PositionY", IntImportStringCaller( g_layout_globals.m_position.y ), IntExportStringCaller( g_layout_globals.m_position.y ) ); - GlobalPreferenceSystem().registerPreference( "Width", IntImportStringCaller( g_layout_globals.m_position.w ), IntExportStringCaller( g_layout_globals.m_position.w ) ); - GlobalPreferenceSystem().registerPreference( "Height", IntImportStringCaller( g_layout_globals.m_position.h ), IntExportStringCaller( g_layout_globals.m_position.h ) ); - - GlobalPreferenceSystem().registerPreference( "CamWnd", WindowPositionTrackerImportStringCaller( g_posCamWnd ), WindowPositionTrackerExportStringCaller( g_posCamWnd ) ); - GlobalPreferenceSystem().registerPreference( "XYWnd", WindowPositionTrackerImportStringCaller( g_posXYWnd ), WindowPositionTrackerExportStringCaller( g_posXYWnd ) ); - GlobalPreferenceSystem().registerPreference( "YZWnd", WindowPositionTrackerImportStringCaller( g_posYZWnd ), WindowPositionTrackerExportStringCaller( g_posYZWnd ) ); - GlobalPreferenceSystem().registerPreference( "XZWnd", WindowPositionTrackerImportStringCaller( g_posXZWnd ), WindowPositionTrackerExportStringCaller( g_posXZWnd ) ); - - GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) ); + GlobalPreferenceSystem().registerPreference( "DetachableMenus", make_property_string( g_Layout_enableDetachableMenus.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "PatchToolBar", make_property_string( g_Layout_enablePatchToolbar.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "PluginToolBar", make_property_string( g_Layout_enablePluginToolbar.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "FilterToolBar", make_property_string( g_Layout_enableFilterToolbar.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "QE4StyleWindows", make_property_string( g_Layout_viewStyle.m_latched ) ); + GlobalPreferenceSystem().registerPreference( "XYHeight", make_property_string( g_layout_globals.nXYHeight ) ); + GlobalPreferenceSystem().registerPreference( "XYWidth", make_property_string( g_layout_globals.nXYWidth ) ); + GlobalPreferenceSystem().registerPreference( "CamWidth", make_property_string( g_layout_globals.nCamWidth ) ); + GlobalPreferenceSystem().registerPreference( "CamHeight", make_property_string( g_layout_globals.nCamHeight ) ); + + GlobalPreferenceSystem().registerPreference( "State", make_property_string( g_layout_globals.nState ) ); + GlobalPreferenceSystem().registerPreference( "PositionX", make_property_string( g_layout_globals.m_position.x ) ); + GlobalPreferenceSystem().registerPreference( "PositionY", make_property_string( g_layout_globals.m_position.y ) ); + GlobalPreferenceSystem().registerPreference( "Width", make_property_string( g_layout_globals.m_position.w ) ); + GlobalPreferenceSystem().registerPreference( "Height", make_property_string( g_layout_globals.m_position.h ) ); + + GlobalPreferenceSystem().registerPreference( "CamWnd", make_property(g_posCamWnd) ); + GlobalPreferenceSystem().registerPreference( "XYWnd", make_property(g_posXYWnd) ); + GlobalPreferenceSystem().registerPreference( "YZWnd", make_property(g_posYZWnd) ); + GlobalPreferenceSystem().registerPreference( "XZWnd", make_property(g_posXZWnd) ); + ++ GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) ); + if ( g_strEnginePath.empty() ) { + g_strEnginePath_was_empty_1st_start = true; const char* ENGINEPATH_ATTRIBUTE = -#if defined( WIN32 ) +#if GDEF_OS_WINDOWS "enginepath_win32" -#elif defined( __linux__ ) || defined ( __FreeBSD__ ) - "enginepath_linux" -#elif defined( __APPLE__ ) +#elif GDEF_OS_MACOS "enginepath_macos" +#elif GDEF_OS_LINUX || GDEF_OS_BSD + "enginepath_linux" #else #error "unknown platform" #endif @@@ -3530,17 -3385,10 +3535,16 @@@ StringOutputStream path( 256 ); path << DirectoryCleaned( g_pGameDescription->getRequiredKeyValue( ENGINEPATH_ATTRIBUTE ) ); g_strEnginePath = path.c_str(); - GlobalPreferenceSystem().registerPreference( "EnginePath", CopiedStringImportStringCaller( g_strEnginePath ), CopiedStringExportStringCaller( g_strEnginePath ) ); ++ GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) ); } - GlobalPreferenceSystem().registerPreference( "EnginePath", make_property_string( g_strEnginePath ) ); - + GlobalPreferenceSystem().registerPreference( "DisableEnginePath", make_property_string( g_disableEnginePath ) ); + GlobalPreferenceSystem().registerPreference( "DisableHomePath", make_property_string( g_disableHomePath ) ); + for ( int i = 0; i < g_pakPathCount; i++ ) { + std::string label = "PakPath" + std::to_string( i ); + GlobalPreferenceSystem().registerPreference( label.c_str(), make_property_string( g_strPakPath[i] ) ); + } g_Layout_viewStyle.useLatched(); g_Layout_enableDetachableMenus.useLatched(); diff --cc radiant/map.cpp index 6603279f,4706a0c6..a192231e --- a/radiant/map.cpp +++ b/radiant/map.cpp @@@ -1675,39 -1595,40 +1675,42 @@@ bool Map_SaveSelected( const char* file return MapResource_saveFile( MapFormat_forFile( filename ), GlobalSceneGraph().root(), Map_Traverse_Selected, filename ); } - class ParentSelectedBrushesToEntityWalker : public scene::Graph::Walker { - scene::Node& m_parent; + scene::Node& m_parent; + mutable bool m_emptyOldParent; + public: - ParentSelectedBrushesToEntityWalker( scene::Node& parent ) : m_parent( parent ){ + ParentSelectedBrushesToEntityWalker( scene::Node& parent ) : m_parent( parent ), m_emptyOldParent( false ){ } + bool pre( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get_pointer() != &m_parent - && Node_isPrimitive( path.top() ) ) { + if ( path.top().get_pointer() != &m_parent && ( Node_isPrimitive( path.top() ) || m_emptyOldParent ) ) { Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() - && path.size() > 1 ) { + if ( selectable && selectable->isSelected() && path.size() > 1 ) { return false; } } return true; } + void post( const scene::Path& path, scene::Instance& instance ) const { - if ( path.top().get_pointer() != &m_parent - && Node_isPrimitive( path.top() ) ) { + if ( path.top().get_pointer() == &m_parent ) + return; + + if ( Node_isPrimitive( path.top() ) ){ + m_emptyOldParent = false; Selectable* selectable = Instance_getSelectable( instance ); - if ( selectable != 0 - && selectable->isSelected() - && path.size() > 1 ) { + + if ( selectable && selectable->isSelected() && path.size() > 1 ){ scene::Node& parent = path.parent(); - if ( &parent != &m_parent ) { + if ( &parent != &m_parent ){ NodeSmartReference node( path.top().get() ); - Node_getTraversable( parent )->erase( node ); + scene::Traversable* traversable_parent = Node_getTraversable( parent ); + traversable_parent->erase( node ); Node_getTraversable( m_parent )->insert( node ); + if ( traversable_parent->empty() ) + m_emptyOldParent = true; } } } diff --cc radiant/texwindow.cpp index 45c684b2,14dfab42..2b4ad184 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -366,16 -304,13 +366,14 @@@ int m_uniformTextureMinSize } } } + */ - void getTextureWH( qtexture_t* tex, int *width, int *height ){ + void getTextureWH( qtexture_t* tex, int &W, int &H ){ // Don't use uniform size - *width = (int)( tex->width * ( (float)m_textureScale / 100 ) ); - *height = (int)( tex->height * ( (float)m_textureScale / 100 ) ); + W = (int)( tex->width * ( (float)m_textureScale / 100 ) ); + H = (int)( tex->height * ( (float)m_textureScale / 100 ) ); if ( g_TextureBrowser_fixedSize ){ - int W = *width; - int H = *height; if ( W >= H ) { // Texture is square, or wider than it is tall if ( W >= m_uniformTextureSize ){