]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Merge commit '39f598c5f44010cc32f1b445b12cb088a72bbc50' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:38:12 +0000 (04:38 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:38:12 +0000 (04:38 +0200)
15 files changed:
1  2 
libs/gtkutil/filechooser.cpp
radiant/brushmanip.cpp
radiant/camwindow.cpp
radiant/csg.cpp
radiant/main.cpp
radiant/mainframe.cpp
radiant/preferences.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp
radiant/xywindow.h
tools/quake3/q3map2/light.c
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/model.c
tools/quake3/q3map2/q3map2.h

Simple merge
Simple merge
Simple merge
diff --cc radiant/csg.cpp
index 2a59d2fec6785eb8cdb96527e3ada8be4b8c3e7b,24ca4035b82d3721310d91e7fb5236c485b4a8d0..c459804a549c3636b244eebfb0603fd05dadf085
@@@ -46,9 -33,9 +33,9 @@@
  void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
        if ( face.contributes() ) {
                out.push_back( new Brush( brush ) );
-               //face.getPlane().offset( -offset );
-               //face.planeChanged();
 -              Face* newFace = out.back()->addFace( face );
 +              std::shared_ptr<Face> newFace = out.back()->addFace( face );
+               face.getPlane().offset( -offset );
+               face.planeChanged();
                if ( newFace != 0 ) {
                        newFace->flipWinding();
                        newFace->getPlane().offset( offset );
@@@ -70,16 -57,29 +57,29 @@@ void Face_extrude( Face& face, const Br
        }
  }
  
- void Brush_makeHollow( const Brush &brush, brush_vector_t &out, float offset ){
-       Brush_forEachFace( brush, [&]( Face &face ) {
+ class FaceMakeBrush
+ {
+ const Brush& brush;
+ brush_vector_t& out;
+ float offset;
+ bool room;
+ public:
+ FaceMakeBrush( const Brush& brush, brush_vector_t& out, float offset, bool room )
+       : brush( brush ), out( out ), offset( offset ), room( room ){
+ }
+ void operator()( Face& face ) const {
+       if( room ){
+               Face_extrude( face, brush, out, offset );
+       }
+       else{
                Face_makeBrush( face, brush, out, offset );
-       } );
 -      }
 +}
+ }
+ };
  
- void Brush_makeRoom( const Brush &brush, brush_vector_t &out, float offset ){
-       Brush_forEachFace( brush, [&]( Face &face ) {
-               Face_makeRoom( face, brush, out, offset );
-       } );
+ void Brush_makeHollow( const Brush& brush, brush_vector_t& out, float offset, bool room ){
+       Brush_forEachFace( brush, FaceMakeBrush( brush, out, offset, room ) );
  }
  
  class BrushHollowSelectedWalker : public scene::Graph::Walker
Simple merge
index ea0ccd5ba221648329f0306486645723c88f602e,50101b3feb2e8df4f8fa5b56b2ceeaf11dc8aeb5..1bea47d16daa80c47f0b4ca559b64d8e9871ba7b
@@@ -3080,24 -2992,32 +3080,33 @@@ void MainFrame::Create()
  
        window.show();
  
 -      if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
 +      if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft )
 +      {
                {
 -                              ui::Widget vsplit = ui::VPaned(ui::New);
+                       ui::Widget hsplit = ui::HPaned(ui::New);
+                       m_vSplit = hsplit;
+                       vbox.pack_start( hsplit, TRUE, TRUE, 0 );
+                       hsplit.show();
+                       {
 -                              m_vSplit = vsplit;
 +                      ui::Widget vsplit = ui::VPaned(ui::New);
+                               vsplit.show();
-                       vbox.pack_start( vsplit, TRUE, TRUE, 0 );
-                       vsplit.show();
 +                      m_vSplit = vsplit;
+                               ui::Widget vsplit2 = ui::VPaned(ui::New);
+                               vsplit2.show();
+                               m_vSplit = vsplit2;
+                               if ( CurrentStyle() == eRegular ){
+                                       gtk_paned_add1( GTK_PANED( hsplit ), vsplit );
+                                       gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
+                               }
+                               else{
+                                       gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
+                                       gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
+                               }
  
 -                              // console
 -                              ui::Widget console_window = Console_constructWindow( window );
 -                              gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
 -                              
 +                      // console
 +                      ui::Widget console_window = Console_constructWindow( window );
 +                      gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
 +
-                       {
-                               ui::Widget hsplit = ui::HPaned(ui::New);
-                               hsplit.show();
-                               m_hSplit = hsplit;
-                               gtk_paned_add1( GTK_PANED( vsplit ), hsplit );
                                // xy
                                m_pXYWnd = new XYWnd();
                                m_pXYWnd->SetViewType( XY );
Simple merge
index 18311b40262299d04c2553168b2f1071d9b14da1,45c684b200ed2d42eff9a801dc9128ae00123c38..6640b97e7b04b873fb8d9ece04b4df78f5e9aca8
@@@ -327,42 -325,80 +328,80 @@@ bool m_searchedTags
  bool m_tags;
  // The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
  int m_uniformTextureSize;
+ int m_uniformTextureMinSize;
  
  // Return the display width of a texture in the texture browser
- int getTextureWidth( qtexture_t* tex ){
-       int width;
+ /*void getTextureWH( qtexture_t* tex, int *width, int *height ){
        if ( !g_TextureBrowser_fixedSize ) {
                // Don't use uniform size
-               width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
        }
-       else if
-       ( tex->width >= tex->height ) {
+       else if ( tex->width >= tex->height ) {
                // Texture is square, or wider than it is tall
-               width = m_uniformTextureSize;
+               if ( tex->width >= m_uniformTextureSize ){
+                       *width = m_uniformTextureSize;
+                       *height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
+               }
+               else if ( tex->width <= m_uniformTextureMinSize ){
+                       *width = m_uniformTextureMinSize;
+                       *height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
 -              }
 -              else {
 +      }
 +      else {
-               // Otherwise, preserve the texture's aspect ratio
-               width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
+                       *width = tex->width;
+                       *height = tex->height;
 -              }
++      }
+       }
+       else {
+               // Texture taller than it is wide
+               if ( tex->height >= m_uniformTextureSize ){
+                       *height = m_uniformTextureSize;
+                       *width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
+               }
+               else if ( tex->height <= m_uniformTextureMinSize ){
+                       *height = m_uniformTextureMinSize;
+                       *width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
+               }
+               else {
+                       *width = tex->width;
+                       *height = tex->height;
+               }
        }
-       return width;
  }
  
- // Return the display height of a texture in the texture browser
- int getTextureHeight( qtexture_t* tex ){
-       int height;
-       if ( !g_TextureBrowser_fixedSize ) {
+ */
+ void getTextureWH( qtexture_t* tex, int *width, int *height ){
                // Don't use uniform size
-               height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
-       }
-       else if ( tex->height >= tex->width ) {
-               // Texture is square, or taller than it is wide
-               height = m_uniformTextureSize;
+               *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
+               *height = (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 ){
+                               *width = m_uniformTextureSize;
+                               *height = m_uniformTextureSize * H / W;
 -                      }
++      }
+                       else if ( W <= m_uniformTextureMinSize ){
+                               *width = m_uniformTextureMinSize;
+                               *height = m_uniformTextureMinSize * H / W;
+                       }
 -              }
 -              else {
 +      }
 +      else {
-               // Otherwise, preserve the texture's aspect ratio
-               height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
+                       // Texture taller than it is wide
+                       if ( H >= m_uniformTextureSize ){
+                               *height = m_uniformTextureSize;
+                               *width = m_uniformTextureSize * W / H;
 -                      }
++      }
+                       else if ( H <= m_uniformTextureMinSize ){
+                               *height = m_uniformTextureMinSize;
+                               *width = m_uniformTextureMinSize * W / H;
+                       }
+               }
        }
-       return height;
  }
  
  TextureBrowser() :
@@@ -865,22 -887,10 +907,22 @@@ void visit( const char* minor, const _Q
  
  void TextureBrowser_ShowDirectory( TextureBrowser& textureBrowser, const char* directory ){
        if ( TextureBrowser_showWads() ) {
 +              g_TextureBrowser_currentDirectory = directory;
 +              TextureBrowser_heightChanged( textureBrowser );
 +
                Archive* archive = GlobalFileSystem().getArchive( directory );
 -              ASSERT_NOTNULL( archive );
 +              if ( archive != nullptr )
 +              {
-                       LoadShaderVisitor visitor;
-                       archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "textures/" );
+               LoadShaderVisitor visitor;
+               archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "textures/" );
 +
 +                      // Doom3-like dds/ prefix (used by DarkPlaces).
 +                      archive->forEachFile( Archive::VisitorFunc( visitor, Archive::eFiles, 0 ), "dds/textures/" );
 +              }
 +              else if ( extension_equal_i( path_get_extension( directory ), "wad" ) )
 +              {
 +                      globalErrorStream() << "Failed to load " << directory << "\n";
 +              }
        }
        else
        {
@@@ -2414,48 -2318,11 +2463,48 @@@ void TextureBrowser_destroyGLWidget()
  void TextureBrowser_destroyWindow(){
        GlobalShaderSystem().setActiveShadersChangedNotify( Callback<void()>() );
  
 -      g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_sizeHandler );
 -      g_signal_handler_disconnect( G_OBJECT( g_TextureBrowser.m_gl_widget ), g_TextureBrowser.m_exposeHandler );
 +      TextureBrowser_destroyGLWidget();
 +}
 +
 +#ifdef WORKAROUND_MACOS_GTK2_GLWIDGET
 +/* workaround for gtkglext on gtk 2 issue: OpenGL texture viewport being drawn over the other pages */
 +/* this is very ugly: force the resizing of the viewport to a single bottom line by forcing the
 + * resizing of the gl widget by expanding some empty boxes, so the widget area size is reduced
 + * while covered by another page, so the texture viewport is still rendered over the other page
 + * but does not annoy the user that much because it's just a line on the bottom that may even
 + * be printed over existing bottom frame or very close to it. */
 +void TextureBrowser_showGLWidget(){
 +      TextureBrowser &textureBrowser = GlobalTextureBrowser();
 +      if ( isWindowConstructed && isGLWidgetConstructed )
 +      {
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_vfiller, FALSE, FALSE, 0, ui::Packing::START );
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hframe, TRUE, TRUE, 0, ui::Packing::START );
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hfiller, FALSE, FALSE, 0, ui::Packing::START );
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, TRUE, TRUE, 0, ui::Packing::START );
 +
 +              textureBrowser.m_gl_widget.show();
-       }
++}
 +}
 +
 +void TextureBrowser_hideGLWidget(){
 +      TextureBrowser &textureBrowser = GlobalTextureBrowser();
 +      if ( isWindowConstructed && isGLWidgetConstructed )
 +      {
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_vfiller, TRUE, TRUE, 0, ui::Packing::START);
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hframe, FALSE, FALSE, 0, ui::Packing::END );
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_hfiller, TRUE, TRUE, 0, ui::Packing::START);
 +              textureBrowser.m_vframe.set_child_packing( textureBrowser.m_gl_widget, FALSE, FALSE, 0, ui::Packing::END );
 +
 +              // The hack needs the GL widget to not be hidden to work,
 +              // so resizing it triggers the redraw of it with the new size.
 +              // GlobalTextureBrowser().m_gl_widget.hide();
  
 -      g_TextureBrowser.m_gl_widget.unref();
 +              // Trigger the redraw.
 +              TextureBrowser_redraw( &GlobalTextureBrowser() );
 +              ui::process();
 +      }
  }
 +#endif // WORKAROUND_MACOS_GTK2_GLWIDGET
  
  const Vector3& TextureBrowser_getBackgroundColour( TextureBrowser& textureBrowser ){
        return textureBrowser.color_textureback;
@@@ -2804,6 -2664,17 +2853,17 @@@ struct UniformTextureSize 
        }
  };
  
 -              returnz(g_TextureBrowser.m_uniformTextureMinSize);
+ struct UniformTextureMinSize {
+       static void Export(const TextureBrowser &self, const Callback<void(int)> &returnz) {
++              returnz(GlobalTextureBrowser().m_uniformTextureMinSize);
+       }
+       static void Import(TextureBrowser &self, int value) {
+               if (value > 16)
+                       TextureBrowser_setUniformSize(self, value);
+       }
+ };
  void TextureBrowser_constructPreferences( PreferencesPage& page ){
        page.appendCheckBox(
                "", "Texture scrollbar",
                        make_property<TextureScale>(GlobalTextureBrowser())
                        );
        }
-       page.appendSpinner(
-               "Texture Thumbnail Size",
-               GlobalTextureBrowser().m_uniformTextureSize,
-               GlobalTextureBrowser().m_uniformTextureSize,
-               16, 8192
-       );
+       page.appendSpinner( "Thumbnails Max Size", GlobalTextureBrowser().m_uniformTextureSize, GlobalTextureBrowser().m_uniformTextureSize, 16, 8192 );
+       page.appendSpinner( "Thumbnails Min Size", GlobalTextureBrowser().m_uniformTextureMinSize, GlobalTextureBrowser().m_uniformTextureMinSize, 16, 8192 );
        page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement );
        {
 -              const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() };
 +              const char* startup_shaders[] = { "None", TextureBrowser_getCommonShadersName() };
                page.appendCombo( "Load Shaders at Startup", reinterpret_cast<int&>( GlobalTextureBrowser().m_startupShaders ), STRING_ARRAY_RANGE( startup_shaders ) );
        }
  }
@@@ -2856,20 -2722,21 +2913,21 @@@ void TextureBrowser_Construct()
        GlobalCommands_insert( "CopyTag", makeCallbackF(TextureBrowser_copyTag) );
        GlobalCommands_insert( "PasteTag", makeCallbackF(TextureBrowser_pasteTag) );
        GlobalCommands_insert( "RefreshShaders", makeCallbackF(VFS_Refresh) );
 -      GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
 +      GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( textureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
        GlobalCommands_insert( "ShowAllTextures", makeCallbackF(TextureBrowser_showAll), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator( 'T' ) );
 -      GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
 -      GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
 -      GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
 -      GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
 -      GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) );
 -      GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) );
 -
 -      GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string<TextureScale>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(GlobalTextureBrowser()));
 -      GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( GlobalTextureBrowser().m_showShaders ) );
 +      GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( textureBrowser.m_showshaders_item ) );
 +      GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( textureBrowser.m_showshaderlistonly_item ) );
 +      GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( textureBrowser.m_fixedsize_item ) );
 +      GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( textureBrowser.m_filternotex_item ) );
 +      GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( textureBrowser.m_hidenotex_item ) );
 +      GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( textureBrowser.m_enablealpha_item ) );
 +
 +      GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string<TextureScale>(textureBrowser) );
 +      GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(textureBrowser) );
++      GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(textureBrowser) );
 +      GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(textureBrowser));
 +      GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( textureBrowser.m_showShaders ) );
        GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", make_property_string( g_TextureBrowser_shaderlistOnly ) );
        GlobalPreferenceSystem().registerPreference( "FixedSize", make_property_string( g_TextureBrowser_fixedSize ) );
        GlobalPreferenceSystem().registerPreference( "FilterMissing", make_property_string( g_TextureBrowser_filterMissing ) );
Simple merge
index bf7eb853432cc683a4f4874aaac0c5f28abd239c,3842e8f66f1f2d0602c848f96c78e9013c06c6bd..bb9e92ddc8f271613219ba735682d13af48f9856
@@@ -124,8 -124,10 +124,12 @@@ void Zoom_End()
  bool m_zoom_started;
  guint m_zoom_focusOut;
  
+ void ZoomIn();
+ void ZoomOut();
+ void ZoomInWithMouse( int pointx, int pointy );
 +void Redraw();
 +
  void SetActive( bool b ){
        m_bActive = b;
  };
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge