diff --git a/docs/changelog-custom.txt b/docs/changelog-custom.txt index 62e1a199..7f957620 100644 --- a/docs/changelog-custom.txt +++ b/docs/changelog-custom.txt @@ -184,6 +184,8 @@ Q3map2: * handle patch lodbounds in -shift and -scale * refactor to work without -maxshaderinfo limit, improve shader search performance * fix and simplify FloodAreas + * support distinct lighting from different sky shaders in one map (by Tom Arrow) + * -onesky: fallback to old behavior: any sky emits total of all suns/skylights in the map @@ -377,6 +379,7 @@ menus... * shift + q: move-to LayersMenu * context menu for toolbar buttons configuration * Copy All in console context menu + * texBro.context menu: Select Textured Objects, Select Textured Surfaces misc... * removed note to save before going to preferences, project settings @@ -1148,8 +1151,6 @@ misc... * render camera crosshair sharply independently of viewport size, with shadow * support mixture of monitored and unmonitored build commands (do unmonitored run after 1st such command) * do Run Engine After Compile also after unmonitored builds - * support distinct lighting from different sky shaders in one map (by Tom Arrow) - * -onesky: fallback to old behavior: any sky emits total of all suns/skylights in the map * adjust icons in light GUI themes for better visibility diff --git a/radiant/select.cpp b/radiant/select.cpp index 1a5531cb..d7ebd825 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -823,6 +823,11 @@ void Scene_EntityGetPropertyValues( scene::Graph& graph, const char *prop, Prope graph.traverse( EntityGetSelectedPropertyValuesWalker( prop, propertyvalues ) ); } +void Scene_BrushPatchSelectByShader( const char *shader ){ + Scene_BrushSelectByShader( GlobalSceneGraph(), shader ); + Scene_PatchSelectByShader( GlobalSceneGraph(), shader ); +} + void Select_AllOfType(){ if ( GlobalSelectionSystem().Mode() == SelectionSystem::eComponent ) { if ( GlobalSelectionSystem().ComponentMode() == SelectionSystem::eFace ) { @@ -830,20 +835,15 @@ void Select_AllOfType(){ Scene_BrushSelectByShader_Component( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); } } - else - { + else{ PropertyValues propertyvalues; const char *prop = "classname"; Scene_EntityGetPropertyValues( GlobalSceneGraph(), prop, propertyvalues ); GlobalSelectionSystem().setSelectedAll( false ); - if ( !propertyvalues.empty() ) { + if ( !propertyvalues.empty() ) Scene_EntitySelectByPropertyValues( GlobalSceneGraph(), prop, propertyvalues ); - } else - { - Scene_BrushSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); - Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); - } + Scene_BrushPatchSelectByShader( TextureBrowser_GetSelectedShader() ); } } @@ -886,9 +886,12 @@ void Select_EntitiesByKeyValue( const char* key, const char* value ){ } } -void Select_FacesAndPatchesByShader(){ - Scene_BrushFacesSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); - Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); +void Select_FacesAndPatchesByShader( const char *shader ){ + Scene_BrushFacesSelectByShader( GlobalSceneGraph(), shader ); + Scene_PatchSelectByShader( GlobalSceneGraph(), shader ); +} +void Select_FacesAndPatchesByShader_(){ + Select_FacesAndPatchesByShader( TextureBrowser_GetSelectedShader() ); } void Select_Inside(){ @@ -1851,7 +1854,7 @@ void Select_registerCommands(){ GlobalCommands_insert( "RotateSelectionClockwise", makeCallbackF( Selection_RotateClockwise ) ); GlobalCommands_insert( "RotateSelectionAnticlockwise", makeCallbackF( Selection_RotateAnticlockwise ) ); - GlobalCommands_insert( "SelectTextured", makeCallbackF( Select_FacesAndPatchesByShader ), QKeySequence( "Ctrl+Shift+A" ) ); + GlobalCommands_insert( "SelectTextured", makeCallbackF( Select_FacesAndPatchesByShader_ ), QKeySequence( "Ctrl+Shift+A" ) ); GlobalCommands_insert( "Undo", makeCallbackF( Undo ), QKeySequence( "Ctrl+Z" ) ); GlobalCommands_insert( "Redo", makeCallbackF( Redo ), QKeySequence( "Ctrl+Shift+Z" ) ); diff --git a/radiant/select.h b/radiant/select.h index a3ffd20f..50af13e3 100644 --- a/radiant/select.h +++ b/radiant/select.h @@ -28,6 +28,9 @@ void Select_GetBounds( Vector3& mins, Vector3& maxs ); void Select_Delete(); void deleteSelection(); +void Scene_BrushPatchSelectByShader( const char *shader ); +void Select_FacesAndPatchesByShader( const char *shader ); + void Select_EntitiesByKeyValue( const char* key, const char* value ); void Select_ConnectedEntities( bool targeting, bool targets, bool focus ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 226dc95c..48b1d565 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -1608,6 +1608,15 @@ void TextureBrowser_ContextMenu( TextureBrowser& texBro, qreal deviceScale ){ menu->addSeparator(); + menu->addAction( "Select Textured Objects", [&](){ + Scene_BrushPatchSelectByShader( shader->getName() ); + } ); + menu->addAction( "Select Textured Surfaces", [&](){ + Select_FacesAndPatchesByShader( shader->getName() ); + } ); + + menu->addSeparator(); + auto *subMenu = menu->addMenu( "-> Recent" ); for( const auto& folder : texBro.m_recent_folders ){ subMenu->addAction( folder.c_str(), [&texBro, folder = folder.c_str()](){