* fix: don't exclude worldspawn node on region() functions, so newly created brushes are visible afterwards

* fix: region() functions work for entities, having model, which is instantiated multiple times in a scene
	* warn on Map_RegionBrush with none selected
	* fix: 'region set brush' is deleting ultimateselected only (is using one to get bounds)
	* deselect components on any region() function: could be texturized or edited implicitly
	* allow 'region set selection' in components mode
	* Map_RegionXY: deselect anything (could leave stuff selected + invisible)
This commit is contained in:
Garux 2017-11-05 22:58:59 +03:00
parent bd28ec81f7
commit 618d31bc96
3 changed files with 47 additions and 25 deletions

View File

@ -497,6 +497,7 @@ GLFont *glfont_create( const char* font_string ){
// new font code ripped from ZeroRadiant
#include <pango/pangoft2.h>
#include <pango/pango-features.h> //has PANGO_VERSION_CHECK
#include <pango/pango-utils.h>
class GLFontInternal : public GLFont

View File

@ -2118,7 +2118,7 @@ GtkMenuItem* create_view_menu( MainFrame::EViewStyle style ){
create_menu_item_with_mnemonic( menu_in_menu, "_Off", "RegionOff" );
create_menu_item_with_mnemonic( menu_in_menu, "_Set XY", "RegionSetXY" );
create_menu_item_with_mnemonic( menu_in_menu, "Set _Brush", "RegionSetBrush" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Set Se_lected Brushes", "RegionSetSelection" );
create_check_menu_item_with_mnemonic( menu_in_menu, "Set Se_lection", "RegionSetSelection" );
}
//command_connect_accelerator( "CenterXYView" );

View File

@ -1543,6 +1543,7 @@ ExcludeSelectedWalker( bool exclude )
: m_exclude( exclude ){
}
bool pre( const scene::Path& path, scene::Instance& instance ) const {
if( !path.top().get().isRoot() ) /* don't touch model node: disabling one will disable all instances! */
exclude_node( path.top(), ( instance.isSelected() || instance.childSelected() || instance.parentSelected() ) == m_exclude );
return true;
}
@ -1560,6 +1561,7 @@ ExcludeRegionedWalker( bool exclude )
: m_exclude( exclude ){
}
bool pre( const scene::Path& path, scene::Instance& instance ) const {
if( !path.top().get().isRoot() ) /* don't touch model node: disabling one will disable all its instances! */
exclude_node(
path.top(),
!(
@ -1591,21 +1593,26 @@ void Map_RegionOff(){
g_region_active = false;
g_region_item.update();
g_region_maxs[0] = g_MaxWorldCoord - 64;
g_region_mins[0] = g_MinWorldCoord + 64;
g_region_maxs[1] = g_MaxWorldCoord - 64;
g_region_mins[1] = g_MinWorldCoord + 64;
g_region_maxs[2] = g_MaxWorldCoord - 64;
g_region_mins[2] = g_MinWorldCoord + 64;
g_region_maxs[0] = g_region_maxs[1] = g_region_maxs[2] = g_MaxWorldCoord - 64;
g_region_mins[0] = g_region_mins[1] = g_region_mins[2] = g_MinWorldCoord + 64;
Scene_Exclude_All( false );
}
void Map_ApplyRegion( void ){
void Map_ApplyRegion(){
if( GlobalSelectionSystem().countSelectedComponents() != 0 )
GlobalSelectionSystem().setSelectedAllComponents( false );
g_region_active = true;
g_region_item.update();
Scene_Exclude_Region( false );
/* newly created brushes have to visible! */
if( scene::Node* w = Map_FindWorldspawn( g_map ) )
exclude_node( *w, false );
if( GlobalSelectionSystem().countSelected() != 0 )
GlobalSelectionSystem().setSelectedAll( false );
}
@ -1614,19 +1621,25 @@ void Map_ApplyRegion( void ){
Map_RegionSelectedBrushes
========================
*/
void Map_RegionSelectedBrushes( void ){
Map_RegionOff();
void Map_RegionSelectedBrushes(){
if ( GlobalSelectionSystem().countSelected() != 0 ) {
if( GlobalSelectionSystem().countSelectedComponents() != 0 )
GlobalSelectionSystem().setSelectedAllComponents( false );
if ( GlobalSelectionSystem().countSelected() != 0
&& GlobalSelectionSystem().Mode() == SelectionSystem::ePrimitive ) {
g_region_active = true;
g_region_item.update();
Select_GetBounds( g_region_mins, g_region_maxs );
Scene_Exclude_Selected( false );
/* newly created brushes have to visible! */
if( scene::Node* w = Map_FindWorldspawn( g_map ) )
exclude_node( *w, false );
GlobalSelectionSystem().setSelectedAll( false );
}
else{
Map_RegionOff();
}
}
@ -1651,7 +1664,7 @@ void Map_RegionBounds( const AABB& bounds ){
g_region_mins = vector3_subtracted( bounds.origin, bounds.extents );
g_region_maxs = vector3_added( bounds.origin, bounds.extents );
deleteSelection();
// deleteSelection();
Map_ApplyRegion();
}
@ -1665,6 +1678,14 @@ void Map_RegionBrush( void ){
if ( GlobalSelectionSystem().countSelected() != 0 ) {
scene::Instance& instance = GlobalSelectionSystem().ultimateSelected();
Map_RegionBounds( instance.worldAABB() );
if( Selectable* selectable = Instance_getSelectable( instance ) ){
selectable->setSelected( true );
deleteSelection();
}
}
else{
globalErrorStream() << "Nothing is selected!\n";
}
}