]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '4ee1a6ee1ae75d52984e54e689ef1e587b384bcb' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 03:47:32 +0000 (05:47 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 03:47:32 +0000 (05:47 +0200)
12 files changed:
Makefile
contrib/meshtex/AllocatedMatrix.h
contrib/meshtex/PluginUI.cpp
contrib/meshtex/PluginUI.h
docs/Blendmodes_cheatsheet.jpg [new file with mode: 0644]
plugins/image/tga.cpp
radiant/brush.cpp
radiant/entity.cpp
radiant/mainframe.cpp
radiant/patchmanip.cpp
radiant/patchmanip.h
radiant/texwindow.cpp

index 977d3500ee404223ef5b84b9e041ad8a6aa16417..29471bdefd3dd6964fa350a88863c40977da6541 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -412,7 +412,6 @@ binaries-radiant-plugins: \
        $(INSTALLDIR)/plugins/shaderplug.$(DLL) \
        $(INSTALLDIR)/plugins/sunplug.$(DLL) \
        $(INSTALLDIR)/plugins/ufoaiplug.$(DLL) \
-       $(INSTALLDIR)/plugins/meshtex.$(DLL) \
 
 .PHONY: binaries-radiant
 binaries-radiant-core: \
@@ -1023,23 +1022,6 @@ $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): \
        contrib/ufoaiplug/ufoai_level.o \
        contrib/ufoaiplug/ufoai.o \
 
-$(INSTALLDIR)/plugins/meshtex.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
-$(INSTALLDIR)/plugins/meshtex.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
-$(INSTALLDIR)/plugins/meshtex.$(DLL): \
-       contrib/meshtex/GeneralFunctionDialog.o \
-       contrib/meshtex/GenericDialog.o \
-       contrib/meshtex/GenericMainMenu.o \
-       contrib/meshtex/GenericPluginUI.o \
-       contrib/meshtex/GetInfoDialog.o \
-       contrib/meshtex/MainMenu.o \
-       contrib/meshtex/MeshEntity.o \
-       contrib/meshtex/MeshVisitor.o \
-       contrib/meshtex/PluginModule.o \
-       contrib/meshtex/PluginRegistration.o \
-       contrib/meshtex/PluginUI.o \
-       contrib/meshtex/RefCounted.o \
-       contrib/meshtex/SetScaleDialog.o \
-
 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \
index db3850fb9ed0b57981a4b5e0997ff58a3c03af6a..3967d6c85c07c9661c46b000ec9ecb956f427eea 100644 (file)
@@ -38,8 +38,8 @@
 template<typename Element>
 class AllocatedMatrix : public Matrix<Element>
 {
-       std::size_t m_x, m_y;
-       Element* m_data; 
+       //std::size_t m_x, m_y;
+       //Element* m_data;
 public: // public methods
 
    /**
@@ -48,8 +48,11 @@ public: // public methods
     * @param x Matrix x dimension.
     * @param y Matrix y dimension.
     */
-   AllocatedMatrix(std::size_t x, std::size_t y) : m_x(x), m_y(y), m_data(_allocated = new Element[x*y]){}
-//      Matrix(x, y, (_allocated = new Element[x*y])) {}
+   //AllocatedMatrix(std::size_t x, std::size_t y) : m_x(x), m_y(y), m_data(_allocated = new Element[x*y]){} //doesnt work.
+   //AllocatedMatrix(std::size_t x, std::size_t y) : Matrix(x, y, (_allocated = new Element[x*y])) {} //msvc
+   typedef Matrix<Element> matrix_type;
+   AllocatedMatrix(std::size_t x, std::size_t y) : matrix_type(x, y, (_allocated = new Element[x*y])) {}
+
 
    /**
     * Destructor. Deallocates the data array.
@@ -64,4 +67,4 @@ private: // private member vars
    Element *_allocated;
 };
 
-#endif // #if !defined(INCLUDED_ALLOCATEDMATRIX_H)
\ No newline at end of file
+#endif // #if !defined(INCLUDED_ALLOCATEDMATRIX_H)
index b0f6ad884e5a71c7edd09d128ab676815ded4214..fcbeef44e44a96b2e16ad01f216229b11bcd6a68 100644 (file)
@@ -36,6 +36,7 @@
  */
 PluginUI::PluginUI()
 {
+       PluginUI::singleton = this;
    // Instantiate and register the Set S/T Scale dialog. We need a non-generic
    // handle on this one too, because it will be used as input to the Get Info
    // dialog constructor below.
@@ -69,6 +70,7 @@ PluginUI::~PluginUI()
 {
 }
 
+PluginUI* PluginUI::singleton = 0;
 /**
  * Get the singleton instance of the UI manager. Note that callers should
  * almost certainly invoke the UIInstance global function instead of using
@@ -79,8 +81,11 @@ PluginUI::~PluginUI()
 PluginUI&
 PluginUI::Instance()
 {
-   static PluginUI singleton;
-   return singleton;
+   //static PluginUI singleton;
+   //return singleton;
+    if(!singleton)
+            singleton = new PluginUI();
+        return *singleton;
 }
 
 /**
index 6d9e08f1a62267a94d97089377d0820775dd9f65..9dcb0842d0033e1a51a31426389316ca301acfe9 100644 (file)
@@ -43,10 +43,19 @@ private: // private methods
    PluginUI();
    ~PluginUI();
    //@}
+   // C++ 03
+   // ========
+   // Dont forget to declare these two. You want to make sure they
+   // are unacceptable otherwise you may accidentally get copies of
+   // your singleton appearing.
+   PluginUI(PluginUI const&);              // Don't Implement
+   void operator=(PluginUI const&); // Don't implement
+
+   static PluginUI* singleton;
 
 public: // public methods
 
    static PluginUI& Instance();
 };
 
-#endif // #if !defined(INCLUDED_PLUGINUI_H)
\ No newline at end of file
+#endif // #if !defined(INCLUDED_PLUGINUI_H)
diff --git a/docs/Blendmodes_cheatsheet.jpg b/docs/Blendmodes_cheatsheet.jpg
new file mode 100644 (file)
index 0000000..b2e4c39
Binary files /dev/null and b/docs/Blendmodes_cheatsheet.jpg differ
index 4fa8731f5a3b7600ead4d9e16982b0002567bb58..88233a9af05a56ffdca7bb25df4901ee70d9977d 100644 (file)
@@ -413,4 +413,4 @@ Image* LoadTGABuff( const byte* buffer ){
 Image* LoadTGA( ArchiveFile& file ){
        ScopedArchiveBuffer buffer( file );
        return LoadTGABuff( buffer.buffer );
-}
+}
\ No newline at end of file
index 5e38cc1d62e785797468ceb7a103bf26cbd5f40a..443a69ec53ba42d3b83aed33110d932b53aa7414 100644 (file)
@@ -35,7 +35,7 @@ void Brush_textureChanged(){
 QuantiseFunc Face::m_quantise;
 EBrushType Face::m_type;
 EBrushType FacePlane::m_type;
-bool g_brush_texturelock_enabled = true;
+bool g_brush_texturelock_enabled = false;
 
 EBrushType Brush::m_type;
 double Brush::m_maxWorldCoord = 0;
index 6a29380518408cb167d9bd894e2f2eb5b01184a6..c555715cc2fccf995b03214518fa4fa83fe907e1 100644 (file)
@@ -309,7 +309,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
 
        bool isModel = ( string_compare_nocase_n( name, "misc_", 5 ) == 0 && string_equal_nocase( name + string_length( name ) - 5, "model" ) ) // misc_*model (also misc_model)
                                   || string_equal_nocase( name, "model_static" )
-                                  || ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) );
+                                  || ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) && g_pGameDescription->mGameType == "doom3" );
 
        bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
 
index 8cc59bc18576ae7b622b6c77c5666f5b6cd187d1..e377c52386b18e26a6da9d533743837603bf1749 100644 (file)
@@ -2088,8 +2088,6 @@ ui::MenuItem create_edit_menu(){
        create_menu_item_with_mnemonic( menu, "_Duplicate", "CloneSelection" );
        create_menu_item_with_mnemonic( menu, "Duplicate, make uni_que", "CloneSelectionAndMakeUnique" );
        create_menu_item_with_mnemonic( menu, "D_elete", "DeleteSelection" );
-       menu_separator( menu );
-       create_menu_item_with_mnemonic( menu, "Snap To Grid", "SnapToGrid" );
        //create_menu_item_with_mnemonic( menu, "Pa_rent", "ParentSelection" );
        menu_separator( menu );
        create_menu_item_with_mnemonic( menu, "C_lear Selection", "UnSelectSelection" );
@@ -2278,6 +2276,9 @@ ui::MenuItem create_selection_menu(){
                create_check_menu_item_with_mnemonic( menu_in_menu, "_Faces", "DragFaces" );
        }
 
+       menu_separator( menu );
+       create_menu_item_with_mnemonic( menu, "Snap To Grid", "SnapToGrid" );
+
        menu_separator( menu );
 
        {
@@ -2455,14 +2456,14 @@ void PatchInspector_registerShortcuts(){
 }
 
 void Patch_registerShortcuts(){
-//     command_connect_accelerator( "InvertCurveTextureX" );
-//     command_connect_accelerator( "InvertCurveTextureY" );
+       command_connect_accelerator( "InvertCurveTextureX" );
+       command_connect_accelerator( "InvertCurveTextureY" );
        command_connect_accelerator( "PatchInsertInsertColumn" );
        command_connect_accelerator( "PatchInsertInsertRow" );
        command_connect_accelerator( "PatchDeleteLastColumn" );
        command_connect_accelerator( "PatchDeleteLastRow" );
-//     command_connect_accelerator( "NaturalizePatch" );
-       //command_connect_accelerator("CapCurrentCurve");
+       command_connect_accelerator( "NaturalizePatch" );
+       command_connect_accelerator( "CapCurrentCurve");
 }
 
 void Manipulators_registerShortcuts(){
index 2fbc322c68124249665e21b7ab30ed3d15b8d665..ca984ef6601089c00ceeb357bb58fde0df56c64a 100644 (file)
@@ -664,6 +664,8 @@ void Patch_Thicken(){
 
        DoPatchThickenDlg();
 }
+
+
 #include "ifilter.h"
 
 
@@ -819,11 +821,11 @@ void Patch_constructMenu( ui::Menu menu ){
                if ( g_Layout_enableDetachableMenus.m_value ) {
                        menu_tearoff( menu_in_menu );
                }
-               create_menu_item_with_mnemonic( menu_in_menu, "Insert (2) Columns", "PatchInsertInsertColumn" );
                create_menu_item_with_mnemonic( menu_in_menu, "Add (2) Columns", "PatchInsertAddColumn" );
+               create_menu_item_with_mnemonic( menu_in_menu, "Insert (2) Columns", "PatchInsertInsertColumn" );
                menu_separator( menu_in_menu );
-               create_menu_item_with_mnemonic( menu_in_menu, "Insert (2) Rows", "PatchInsertInsertRow" );
                create_menu_item_with_mnemonic( menu_in_menu, "Add (2) Rows", "PatchInsertAddRow" );
+               create_menu_item_with_mnemonic( menu_in_menu, "Insert (2) Rows", "PatchInsertInsertRow" );
        }
        {
                auto menu_in_menu = create_sub_menu_with_mnemonic( menu, "Delete" );
index 512a3f95c1132c05cd28f08f9c8d7930f3466e9a..773ceb965b9fb2a6f90e24879f150eb45f5414b0 100644 (file)
@@ -58,6 +58,13 @@ void Patch_FlipTextureX();
 void Patch_FlipTextureY();
 void Patch_AutoCapTexture();
 
+void Patch_NaturalTexture();
+void Patch_CapTexture();
+void Patch_ResetTexture();
+void Patch_FitTexture();
+void Patch_FlipTextureX();
+void Patch_FlipTextureY();
+
 class PatchCreator;
 extern PatchCreator* g_patchCreator;
 
index 46f8c390033596ccf9e0c78e4598c25dcae20d81..96fe13c2e347d0e7b67e24eddd886bea73edf203 100644 (file)
@@ -381,6 +381,8 @@ void getTextureWH( qtexture_t* tex, int &W, int &H ){
                // Don't use uniform size
                W = (int)( tex->width * ( (float)m_textureScale / 100 ) );
                H = (int)( tex->height * ( (float)m_textureScale / 100 ) );
+               if ( W < 1 ) W = 1;
+               if ( H < 1 ) H = 1;
 
        if ( g_TextureBrowser_fixedSize ){
                if      ( W >= H ) {
@@ -538,7 +540,7 @@ void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qte
        textureBrowser.getTextureWH( q, nWidth, nHeight );
        if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
                layout.current_x = 8;
-               layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
+               layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;//+4
                layout.current_row = 0;
        }
 
@@ -1104,12 +1106,15 @@ void TextureBrowser_Focus( TextureBrowser& textureBrowser, const char* name ){
                // we have found when texdef->name and the shader name match
                // NOTE: as everywhere else for our comparisons, we are not case sensitive
                if ( shader_equal( name, shader->getName() ) ) {
-                       int textureHeight = (int)( q->height * ( (float)textureBrowser.m_textureScale / 100 ) )
-                                                               + 2 * TextureBrowser_fontHeight( textureBrowser );
+                       //int textureHeight = (int)( q->height * ( (float)textureBrowser.m_textureScale / 100 ) ) + 2 * TextureBrowser_fontHeight( textureBrowser );
+                       int textureWidth, textureHeight;
+                       textureBrowser.getTextureWH( q, textureWidth, textureHeight );
+                       textureHeight += 2 * TextureBrowser_fontHeight( textureBrowser );
+
 
                        int originy = TextureBrowser_getOriginY( textureBrowser );
                        if ( y > originy ) {
-                               originy = y;
+                               originy = y + 4;
                        }
 
                        if ( y - textureHeight < originy - textureBrowser.height ) {
@@ -1301,38 +1306,14 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                        // if !texture_showinuse: (some textures displayed may not be in use)
                        // draw an additional square around with 0.5 1 0.5 color
                        glLineWidth( 1 );
-                       // shader border:
-                       if ( !shader->IsDefault() ) {
-                       //real 1px white/black stipple
-                               glColor3f( 0, 0, 0 );
-                               glDisable( GL_TEXTURE_2D );
-
-                               float xf = (float)x;
-                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
-                               glBegin( GL_LINE_LOOP );
-                               glVertex2f( xf - 1.5,yf + 1.5 );
-                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
-                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
-                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
-
-                               glEnd();
-
-                               glEnable( GL_LINE_STIPPLE );
-                               glLineStipple( 1, 0x0FFF );
-
-                               glBegin( GL_LINE_LOOP );
-                               glColor3f( 1, 1, 1 );
-
-                               glVertex2f( xf - 1.5,yf + 1.5 );
-                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
-                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
-                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
-
-                               glEnd();
-                               glDisable( GL_LINE_STIPPLE );
-                               glEnable( GL_TEXTURE_2D );
-
-                       }
+                       const float xf = (float)x;
+                       const float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
+                       float xfMax = xf + 1.5 + nWidth;
+                       float xfMin = xf - 1.5;
+                       float yfMax = yf + 1.5;
+                       float yfMin = yf - nHeight - 1.5;
+
+                       //selected texture
                        if ( shader_equal( TextureBrowser_GetSelectedShader( textureBrowser ), shader->getName() ) ) {
                                glLineWidth( 2 );
                                if ( textureBrowser.m_rmbSelected ) {
@@ -1341,31 +1322,55 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                                else {
                                        glColor3f( 1,0,0 );
                                }
+                               xfMax += .5;
+                               xfMin -= .5;
+                               yfMax += .5;
+                               yfMin -= .5;
                                glDisable( GL_TEXTURE_2D );
-
                                glBegin( GL_LINE_LOOP );
-                               glVertex2i( x - 4,y - TextureBrowser_fontHeight( textureBrowser ) + 4 );
-                               glVertex2i( x - 4,y - TextureBrowser_fontHeight( textureBrowser ) - nHeight - 4 );
-                               glVertex2i( x + 4 + nWidth,y - TextureBrowser_fontHeight( textureBrowser ) - nHeight - 4 );
-                               glVertex2i( x + 4 + nWidth,y - TextureBrowser_fontHeight( textureBrowser ) + 4 );
+                               glVertex2f( xfMin ,yfMax );
+                               glVertex2f( xfMin ,yfMin );
+                               glVertex2f( xfMax ,yfMin );
+                               glVertex2f( xfMax ,yfMax );
                                glEnd();
-
                                glEnable( GL_TEXTURE_2D );
-                               glLineWidth( 1 );
                        }
                        // highlight in-use textures
                        else if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
-                       //1px with float
-                               float xf = (float)x;
-                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
                                glColor3f( 0.5,1,0.5 );
                                glDisable( GL_TEXTURE_2D );
                                glBegin( GL_LINE_LOOP );
-                               glVertex2f( xf - 3.5,yf + 3.5 );
-                               glVertex2f( xf - 3.5,yf - nHeight - 3.5 );
-                               glVertex2f( xf + 3.5 + nWidth,yf - nHeight - 3.5 );
-                               glVertex2f( xf + 3.5 + nWidth,yf + 3.5 );
+                               glVertex2f( xfMin ,yfMax );
+                               glVertex2f( xfMin ,yfMin );
+                               glVertex2f( xfMax ,yfMin );
+                               glVertex2f( xfMax ,yfMax );
+                               glEnd();
+                               glEnable( GL_TEXTURE_2D );
+                       }
+                       // shader white border:
+                       else if ( !shader->IsDefault() ) {
+                               glColor3f( 1, 1, 1 );
+                               glDisable( GL_TEXTURE_2D );
+                               glBegin( GL_LINE_LOOP );
+                               glVertex2f( xfMin ,yfMax );
+                               glVertex2f( xfMin ,yfMin );
+                               glVertex2f( xfMax ,yfMin );
+                               glVertex2f( xfMax ,yfMax );
                                glEnd();
+                       }
+
+                       // shader stipple:
+                       if ( !shader->IsDefault() ) {
+                               glEnable( GL_LINE_STIPPLE );
+                               glLineStipple( 1, 0xF000 );
+                               glBegin( GL_LINE_LOOP );
+                               glColor3f( 0, 0, 0 );
+                               glVertex2f( xfMin ,yfMax );
+                               glVertex2f( xfMin ,yfMin );
+                               glVertex2f( xfMax ,yfMin );
+                               glVertex2f( xfMax ,yfMax );
+                               glEnd();
+                               glDisable( GL_LINE_STIPPLE );
                                glEnable( GL_TEXTURE_2D );
                        }
 
@@ -1412,7 +1417,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                        glDisable( GL_TEXTURE_2D );
                        glColor3f( 1,1,1 );
 
-                       glRasterPos2i( x, y - TextureBrowser_fontHeight( textureBrowser ) + 5 );
+                       glRasterPos2i( x, y - TextureBrowser_fontHeight( textureBrowser ) + 2 );//+5
 
                        // don't draw the directory name
                        const char* name = shader->getName();