From 30277762436a37ddd0e38ce820ef18759770570d Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Wed, 11 Nov 2015 11:56:29 +0100 Subject: [PATCH 01/20] Make NULL models rendered as a box, and selectable (were already editable) TODO: - Handle the case "Model not found". - Add relevant console prints. - Fix glitchy-looking selected box. --- include/imodel.h | 1 + plugins/entity/entity_entitymodel.h | 2 ++ plugins/model/cpicomodel.h | 1 + plugins/model/remap.cpp | 6 ++++++ plugins/spritemodel/spritemodel.h | 1 + radiant/brush.cpp | 3 ++- radiant/camwindow.cpp | 16 ++++++++++++++-- 7 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/imodel.h b/include/imodel.h index 65d88678..2ae1e631 100644 --- a/include/imodel.h +++ b/include/imodel.h @@ -77,6 +77,7 @@ virtual ~IRender() { } virtual void IncRef() = 0; // increments the reference counter for this object virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state +virtual const bool IsModelNotNull() const = 0; virtual const aabb_t *GetAABB() const = 0; }; diff --git a/plugins/entity/entity_entitymodel.h b/plugins/entity/entity_entitymodel.h index f523630b..f3b49324 100644 --- a/plugins/entity/entity_entitymodel.h +++ b/plugins/entity/entity_entitymodel.h @@ -40,6 +40,7 @@ void DecRef() { // IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect @@ -105,6 +106,7 @@ void DecRef() { // IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect diff --git a/plugins/model/cpicomodel.h b/plugins/model/cpicomodel.h index a5556f24..6432eb9d 100644 --- a/plugins/model/cpicomodel.h +++ b/plugins/model/cpicomodel.h @@ -66,6 +66,7 @@ void Reload( void ); void Draw( int state, vector shaders, int rflags ) const; //IRender virtual void Draw( int state, int rflags ) const; +virtual const bool IsModelNotNull() const { return true; } virtual const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/plugins/model/remap.cpp b/plugins/model/remap.cpp index 5e313222..69683eae 100644 --- a/plugins/model/remap.cpp +++ b/plugins/model/remap.cpp @@ -141,6 +141,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, m_shaders, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } @@ -300,6 +303,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } diff --git a/plugins/spritemodel/spritemodel.h b/plugins/spritemodel/spritemodel.h index d9be5152..34015df5 100644 --- a/plugins/spritemodel/spritemodel.h +++ b/plugins/spritemodel/spritemodel.h @@ -45,6 +45,7 @@ void DecRef() { //IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return true; } const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 05ec12fb..6b3d3bbf 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -2223,7 +2223,8 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag if ( b->owner->eclass->fixedsize && b->owner->model.pSelect && !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) ) - && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX ) { + && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX + && b->owner->model.pRender->IsModelNotNull()) { ray_t ray_local; vec_t dist_local = FLT_MAX; ray_construct_for_vec3( &ray_local, origin, dir ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 8a952be0..466fa612 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -922,12 +922,24 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) { qglColor4fv( material ); } - else{ qglColor4fv( identity ); } + else { + qglColor4fv( identity ); + } + if ( nGLState & DRAW_GL_LIGHTING ) { qglShadeModel( GL_SMOOTH ); } - b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); + // Check model validity + // If the model is NULL or invalid, draw a box instead + bool temp = b->owner->model.pRender->IsModelNotNull(); + if ( temp ) { + b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM); + } + else { + qglColor4fv( material ); + aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); + } } break; case DRAW_WIRE: From a0e076ce9b3fa8c5aef92ba24f2268713fdd9e9c Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Sat, 12 Mar 2016 20:05:45 +0100 Subject: [PATCH 02/20] Alignments in code. --- radiant/brush.cpp | 448 +++++++++++++++++++++--------------------- radiant/camwindow.cpp | 10 +- radiant/select.cpp | 28 +-- 3 files changed, 242 insertions(+), 244 deletions(-) diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 6b3d3bbf..8846eb0c 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -74,18 +74,18 @@ void PrintVector( vec3_t v ){ /* - ============================================================================= + ============================================================================= - TEXTURE COORDINATES + TEXTURE COORDINATES - ============================================================================= + ============================================================================= */ /* - ================== - textureAxisFromPlane - ================== + ================== + textureAxisFromPlane + ================== */ vec3_t baseaxis[18] = { @@ -108,7 +108,7 @@ void TextureAxisFromPlane( plane_t *pln, vec3_t xv, vec3_t yv ) { for ( i = 0 ; i < 6 ; i++ ) { dot = DotProduct( pln->normal, baseaxis[i * 3] ); - // see q3map2 source - added () for clarity + // see q3map2 source - added () for clarity if ( ( g_PrefsDlg.m_bQ3Map2Texturing && dot > best + 0.0001f ) || dot > best ) { best = dot; bestaxis = i; @@ -604,18 +604,18 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz // find the STfromXYZ 4-vectors /* - SARRUS-SOLVE: - xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - FOR: STfromXYZ[0] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) - SARRUS-SOLVE: - xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - FOR: STfromXYZ[1] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + FOR: STfromXYZ[0] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + FOR: STfromXYZ[1] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) */ STfromXYZ[0][uv] = 0; @@ -647,8 +647,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz float newSTfromXYZ[2][4]; printf("old: %Lf,%Lf,%Lf,%Lf %Lf,%Lf,%Lf,%Lf\n", - STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], - STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); + STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], + STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); */ Face_TexdefFromTextureVectors( f, STfromXYZ, pvecs, sv, tv ); @@ -657,8 +657,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz Face_TextureVectors(f, newSTfromXYZ); printf("new: %f,%f,%f,%f %f,%f,%f,%f\n", - newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], - newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); + newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], + newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); float newxyzst1[5]; float newxyzst2[5]; @@ -670,12 +670,12 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz EmitTextureCoordinates (newxyzst2, q, f); EmitTextureCoordinates (newxyzst3, q, f); printf("Face_TexdefFromTextureCoordinates: %f,%f %f,%f %f,%f -> %f,%f %f,%f %f,%f\n", - xyzst1[3], xyzst1[4], - xyzst2[3], xyzst2[4], - xyzst3[3], xyzst3[4], - newxyzst1[3], newxyzst1[4], - newxyzst2[3], newxyzst2[4], - newxyzst3[3], newxyzst3[4]); + xyzst1[3], xyzst1[4], + xyzst2[3], xyzst2[4], + xyzst3[3], xyzst3[4], + newxyzst1[3], newxyzst1[4], + newxyzst2[3], newxyzst2[4], + newxyzst3[3], newxyzst3[4]); // TODO why do these differ, but not the previous ones? this makes no sense whatsoever */ } @@ -1040,16 +1040,16 @@ face_t *Brush_BestSplitFace( brush_t *b ){ } /* - ================= - Brush_MakeConvexBrushes + ================= + Brush_MakeConvexBrushes - MrE FIXME: this doesn't work because the old - Brush_SplitBrushByFace is used - Turns the brush into a minimal number of convex brushes. - If the input brush is convex then it will be returned. - Otherwise the input brush will be freed. - NOTE: the input brush should have windings for the faces. - ================= + MrE FIXME: this doesn't work because the old + Brush_SplitBrushByFace is used + Turns the brush into a minimal number of convex brushes. + If the input brush is convex then it will be returned. + Otherwise the input brush will be freed. + NOTE: the input brush should have windings for the faces. + ================= */ brush_t *Brush_MakeConvexBrushes( brush_t *b ){ brush_t *front, *back, *end; @@ -2078,130 +2078,130 @@ brush_t *Brush_FullClone( brush_t *b ){ // FIXME - spog - finish this later.. /* - bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) - { - int i; - vec3_t v1, v2, normal[3]; - float d; + bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) + { + int i; + vec3_t v1, v2, normal[3]; + float d; - //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); - //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); - //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); - //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); + //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); + //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); + //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); + //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); - // test ray against triangle - // get triangle plane normal - //VectorSubtract(p1, p2, v1); - //VectorSubtract(p1, p3, v2); - //CrossProduct(v1, v2, v1); - // check normal against direction - //if (DotProduct(dir, v1) >= 0) - //{ - // generate cone normals - VectorSubtract(origin, p1, v1); - VectorSubtract(origin, p2, v2); - CrossProduct(v1, v2, normal[0]); - VectorSubtract(origin, p2, v1); - VectorSubtract(origin, p3, v2); - CrossProduct(v1, v2, normal[1]); - VectorSubtract(origin, p3, v1); - VectorSubtract(origin, p1, v2); - CrossProduct(v1, v2, normal[2]); - //} - //else - //{ - // flip normals if triangle faces away - // Sys_Printf("flipped\n"); - // VectorSubtract(origin, p1, v1); - // VectorSubtract(origin, p3, v2); - // CrossProduct(v1, v2, normal[0]); - // VectorSubtract(origin, p3, v1); - // VectorSubtract(origin, p2, v2); - // CrossProduct(v1, v2, normal[1]); - // VectorSubtract(origin, p2, v1); - // VectorSubtract(origin, p1, v2); - // CrossProduct(v1, v2, normal[2]); - //} + // test ray against triangle + // get triangle plane normal + //VectorSubtract(p1, p2, v1); + //VectorSubtract(p1, p3, v2); + //CrossProduct(v1, v2, v1); + // check normal against direction + //if (DotProduct(dir, v1) >= 0) + //{ + // generate cone normals + VectorSubtract(origin, p1, v1); + VectorSubtract(origin, p2, v2); + CrossProduct(v1, v2, normal[0]); + VectorSubtract(origin, p2, v1); + VectorSubtract(origin, p3, v2); + CrossProduct(v1, v2, normal[1]); + VectorSubtract(origin, p3, v1); + VectorSubtract(origin, p1, v2); + CrossProduct(v1, v2, normal[2]); + //} + //else + //{ + // flip normals if triangle faces away + // Sys_Printf("flipped\n"); + // VectorSubtract(origin, p1, v1); + // VectorSubtract(origin, p3, v2); + // CrossProduct(v1, v2, normal[0]); + // VectorSubtract(origin, p3, v1); + // VectorSubtract(origin, p2, v2); + // CrossProduct(v1, v2, normal[1]); + // VectorSubtract(origin, p2, v1); + // VectorSubtract(origin, p1, v2); + // CrossProduct(v1, v2, normal[2]); + //} - for (i=0; i<3; i++) - { - VectorNormalize(normal[i]); - //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); - //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); - d = DotProduct(dir, normal[i]); - //Sys_Printf("dotproduct: %f\n",d); - if (d < 0) - return false; - } - return true; - } + for (i=0; i<3; i++) + { + VectorNormalize(normal[i]); + //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); + //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); + d = DotProduct(dir, normal[i]); + //Sys_Printf("dotproduct: %f\n",d); + if (d < 0) + return false; + } + return true; + } */ /* - extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, - float vert0[3], float vert1[3], float vert2[3], - double *t, double *u, double *v); + extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, + float vert0[3], float vert1[3], float vert2[3], + double *t, double *u, double *v); - bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) - { - bool bIntersect = false; - float tBest = FLT_MAX; - int i, j; - vec3_t xyz[3]; - vec3_t vRay[2]; + bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) + { + bool bIntersect = false; + float tBest = FLT_MAX; + int i, j; + vec3_t xyz[3]; + vec3_t vRay[2]; - float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set + float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set - VectorSubtract (origin, b->owner->origin, vRay[0]); - VectorCopy (dir, vRay[1]); + VectorSubtract (origin, b->owner->origin, vRay[0]); + VectorCopy (dir, vRay[1]); - if (angle > 0) - { - int i; - float s, c; - float x, y; + if (angle > 0) + { + int i; + float s, c; + float x, y; - s = sin (-angle/180*Q_PI); - c = cos (-angle/180*Q_PI); + s = sin (-angle/180*Q_PI); + c = cos (-angle/180*Q_PI); - for (i=0; i<2; i++) - { - x = vRay[i][0]; - y = vRay[i][1]; - vRay[i][0] = (x * c) - (y * s); - vRay[i][1] = (x * s) + (y * c); - } - } + for (i=0; i<2; i++) + { + x = vRay[i][0]; + y = vRay[i][1]; + vRay[i][0] = (x * c) - (y * s); + vRay[i][1] = (x * s) + (y * c); + } + } - entitymodel *model = b->owner->md3Class->model; + entitymodel *model = b->owner->md3Class->model; - while (model != NULL) - { - for (i = 0; i < model->nTriCount; i++) - { - for (j = 0; j < 3; j++) - VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); + while (model != NULL) + { + for (i = 0; i < model->nTriCount; i++) + { + for (j = 0; j < 3; j++) + VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); - if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) - { - bIntersect = true; - if (*t < tBest) - tBest = *t; - } - } - model = model->pNext; - } - if (bIntersect) - { - *t = tBest; - return true; - } - else - { - *t = 0; - return false; - } - } + if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) + { + bIntersect = true; + if (*t < tBest) + tBest = *t; + } + } + model = model->pNext; + } + if (bIntersect) + { + *t = tBest; + return true; + } + else + { + *t = 0; + return false; + } + } */ /* @@ -2224,7 +2224,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag && b->owner->model.pSelect && !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) ) && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX - && b->owner->model.pRender->IsModelNotNull()) { + && b->owner->model.pRender->IsModelNotNull() ) { ray_t ray_local; vec_t dist_local = FLT_MAX; ray_construct_for_vec3( &ray_local, origin, dir ); @@ -2261,8 +2261,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag for ( i = 0 ; i < 3 ; i++ ) p1[i] = p1[i] + frac * ( p2[i] - p1[i] ); } - else - { + else { for ( i = 0 ; i < 3 ; i++ ) p2[i] = p1[i] + frac * ( p2[i] - p1[i] ); } @@ -2368,23 +2367,23 @@ void Brush_RemoveFromList( brush_t *b ){ } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default - TTimo - shader code cleanup - added IShader* parameter - =============== + TTimo - shader code cleanup + added IShader* parameter + =============== */ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2436,20 +2435,20 @@ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default - =============== + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default + =============== */ void SetFaceTexdef( face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2642,8 +2641,9 @@ void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ){ // leave it alone // if ( i != w->numpoints ) { - if ( i == 0 ) { // see if the first clockwise point was the - // last point on the winding + // see if the first clockwise point was the + // last point on the winding + if ( i == 0 ) { d = DotProduct( w->points[w->numpoints - 1] , f->plane.normal ) - f->plane.dist; if ( d > -ON_EPSILON && d < ON_EPSILON ) { @@ -2823,15 +2823,15 @@ void Brush_BuildWindings( brush_t *b, bool bSnap ){ if ( g_qeglobals.bNeedConvert ) { BrushPrimitFaceToFace( face ); /* - // we have parsed brush primitives and need conversion back to standard format - // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it - // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling - // I tried various tweaks, no luck .. seems shifting is lost - brushprimit_texdef_t aux; - ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); - TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); - face->texdef.scale[0]/=2.0; - face->texdef.scale[1]/=2.0; + // we have parsed brush primitives and need conversion back to standard format + // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it + // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling + // I tried various tweaks, no luck .. seems shifting is lost + brushprimit_texdef_t aux; + ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); + TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); + face->texdef.scale[0]/=2.0; + face->texdef.scale[1]/=2.0; */ } for ( i = 0 ; i < w->numpoints ; i++ ) @@ -3065,14 +3065,14 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ qglNormal3fv( face->plane.normal ); } /* - if (mode & DRAW_GL_TEXTURE_2D) - qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); - qglVertexPointer(3, GL_FLOAT, 5, w->points); + if (mode & DRAW_GL_TEXTURE_2D) + qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); + qglVertexPointer(3, GL_FLOAT, 5, w->points); - if (mode & DRAW_GL_FILL) - qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); - else - qglDrawArrays(GL_POLYGON, 0, w->numpoints); + if (mode & DRAW_GL_FILL) + qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); + else + qglDrawArrays(GL_POLYGON, 0, w->numpoints); */ if ( nGLState & DRAW_GL_FILL ) { @@ -3792,46 +3792,44 @@ void aabb_draw( const aabb_t *aabb, int mode ){ qglEnd(); /* + vec3_t Coords[8]; + vec3_t vMin, vMax; + VectorSubtract(aabb->origin, aabb->extents, vMin); + VectorAdd(aabb->origin, aabb->extents, vMax); + VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); + VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); + VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); + VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); + VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); + VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); + VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); + VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - vec3_t Coords[8]; + vec3_t Normals[8] = { {-1, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 1 }, + { 0, 0,-1 }, + { 0, 1, 0 }, + { 1, 0, 0 }, + { 0,-1, 0 } }; - vec3_t vMin, vMax; - VectorSubtract(aabb->origin, aabb->extents, vMin); - VectorAdd(aabb->origin, aabb->extents, vMax); - VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); - VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); - VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); - VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); - VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); - VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); - VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); - VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); + unsigned short Indices[24] = { 2, 1, 5, 6, + 1, 0, 4, 5, + 0, 1, 2, 3, + 3, 7, 4, 0, + 3, 2, 6, 7, + 7, 6, 5, 4 }; - vec3_t Normals[8] = { {-1, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 1 }, - { 0, 0,-1 }, - { 0, 1, 0 }, - { 1, 0, 0 }, - { 0,-1, 0 } }; + qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays + qglNormalPointer(GL_FLOAT, 0, Normals); - unsigned short Indices[24] = { 2, 1, 5, 6, - 1, 0, 4, 5, - 0, 1, 2, 3, - 3, 7, 4, 0, - 3, 2, 6, 7, - 7, 6, 5, 4 }; + //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array - qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays - qglNormalPointer(GL_FLOAT, 0, Normals); + qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); - //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array - - qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); - - //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array + //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array */ } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 466fa612..dddb5875 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -932,9 +932,9 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ // Check model validity // If the model is NULL or invalid, draw a box instead - bool temp = b->owner->model.pRender->IsModelNotNull(); - if ( temp ) { - b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM); + bool isModelValid = b->owner->model.pRender->IsModelNotNull(); + if ( isModelValid ) { + b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); } else { qglColor4fv( material ); @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index de8ea82e..a13cb346 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ From 45c2924e27d4c21671cc52f06c2878955c4ffd4d Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sun, 30 Apr 2017 22:35:20 +0200 Subject: [PATCH 03/20] Multiselect and description for the Entity Info dialog --- radiant/gtkdlgs.cpp | 136 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 121 insertions(+), 15 deletions(-) diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 5f18ced8..19935be5 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -1129,6 +1129,41 @@ static void entitylist_select( GtkWidget *widget, gpointer data ){ } } +static void add_entity_selection( entity_t *pEntity ) { + if( pEntity ) { + for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next ) + { + Select_Brush( pEntity->brushes.onext ); + } + } +} +static void entitylist_selected_foreach( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data ) { + entity_t* pEntity; + gtk_tree_model_get( model, iter, 1, &pEntity, -1 ); + add_entity_selection( pEntity ); + + //if parent (classname) node is selected then all child nodes are included + if( !pEntity ) { + GtkTreeIter child; + unsigned int i = 0; + while( gtk_tree_model_iter_nth_child( model, &child, iter, i++ ) ) { + gtk_tree_model_get( model, &child, 1, &pEntity, -1 ); + add_entity_selection( pEntity ); + } + } +} +static void entitylist_multiselect( GtkWidget *widget, gpointer data ) { + GtkTreeView *view = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( data ), "entities" ) ); + + GtkTreeSelection *selection = gtk_tree_view_get_selection( view ); + + Select_Deselect(); + + gtk_tree_selection_selected_foreach( selection, entitylist_selected_foreach, NULL ); + + Sys_UpdateWindows( W_ALL ); +} + static gint entitylist_click( GtkWidget *widget, GdkEventButton *event, gpointer data ){ if ( event->type == GDK_2BUTTON_PRESS ) { entitylist_select( NULL, data ); @@ -1137,26 +1172,62 @@ static gint entitylist_click( GtkWidget *widget, GdkEventButton *event, gpointer return FALSE; } + static void entitylist_selection_changed( GtkTreeSelection* selection, gpointer data ){ + GtkTreeModel *model; + GtkTreeIter selected; + GtkTreeIter child; + entity_t *pEntity = NULL; + entity_t *firstEntity = NULL; GtkListStore* store = GTK_LIST_STORE( g_object_get_data( G_OBJECT( data ), "keyvalues" ) ); + GtkWidget *notebook = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "notebook" ); + GtkWidget *keyvalue_page = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "keyvalue_page" ); + GtkWidget *desc_page = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "description_page" ); + GtkWidget *textview = (GtkWidget*)g_object_get_data( G_OBJECT( data ), "description_textview" ); + gtk_list_store_clear( store ); - GtkTreeModel* model; - GtkTreeIter selected; - if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) { - entity_t* pEntity; - gtk_tree_model_get( model, &selected, 1, &pEntity, -1 ); - - if ( pEntity ) { - for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next ) - { - GtkTreeIter appended; - gtk_list_store_append( store, &appended ); - gtk_list_store_set( store, &appended, 0, pEpair->key, 1, pEpair->value, -1 ); + if ( gtk_tree_selection_get_mode( selection ) == GTK_SELECTION_MULTIPLE ) { + GList *rows, *last; + rows = gtk_tree_selection_get_selected_rows( selection, &model ); + //only the keys/values of the last selected node with entity + last = g_list_last( rows ); + if ( last ) { + if ( gtk_tree_model_get_iter( model, &selected, (GtkTreePath *)last->data ) == TRUE ) { + gtk_tree_model_get( model, &selected, 1, &pEntity, -1 ); + if ( !pEntity ) { + if( gtk_tree_model_iter_nth_child( model, &child, &selected, 0 ) ) { + gtk_tree_model_get( model, &child, 1, &firstEntity, -1 ); + } + } } } + g_list_free_full( rows, (GDestroyNotify)gtk_tree_path_free ); + + } else if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) { + entity_t* pEntity; + gtk_tree_model_get( model, &selected, 1, &pEntity, -1 ); } + if ( pEntity ) { + for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next ) + { + GtkTreeIter appended; + gtk_list_store_append( store, &appended ); + gtk_list_store_set( store, &appended, 0, pEpair->key, 1, pEpair->value, -1 ); + } + + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), keyvalue_page ) ); + } else { + GtkTextBuffer *buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( textview ) ); + if( firstEntity && firstEntity->eclass && firstEntity->eclass->comments ) { + gtk_text_buffer_set_text( buffer, firstEntity->eclass->comments, -1 ); + } else { + gtk_text_buffer_set_text( buffer, _( "No description available." ), -1 ); + } + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), gtk_notebook_page_num( GTK_NOTEBOOK( notebook ), desc_page ) ); + } + } static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer user_data ) @@ -1170,6 +1241,8 @@ static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer void DoEntityList(){ static GtkWidget *dialog; GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area; + GtkWidget *notebook, *label, *textview, *keyvalue_scr, *desc_scr; + gint keyvalue_index; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; if ( EntityList_dialog != NULL ) { @@ -1211,6 +1284,7 @@ void DoEntityList(){ { GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); + gtk_tree_selection_set_mode( selection, GTK_SELECTION_MULTIPLE ); g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( entitylist_selection_changed ), dialog ); } @@ -1279,8 +1353,17 @@ void DoEntityList(){ gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); gtk_widget_show( vbox ); - scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); + notebook = gtk_notebook_new(); + // hide the notebook tabs since its not supposed to look like a notebook + gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook ), FALSE ); + gtk_box_pack_start( GTK_BOX( vbox ), notebook, TRUE, TRUE, 0 ); + gtk_widget_show( notebook ); + + label = gtk_label_new( _( "Keys/Values" ) ); + gtk_widget_show( label ); + + keyvalue_scr = scr = gtk_scrolled_window_new( NULL, NULL ); + keyvalue_index = gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), scr, label ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); gtk_widget_show( scr ); @@ -1310,6 +1393,29 @@ void DoEntityList(){ g_object_unref( G_OBJECT( store ) ); } + label = gtk_label_new( _( "Description" ) ); + gtk_widget_show( label ); + + desc_scr = scr = gtk_scrolled_window_new( NULL, NULL ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); + gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), scr, label ); + gtk_widget_show( scr ); + + textview = gtk_text_view_new(); + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( textview ), GTK_WRAP_WORD ); + gtk_text_view_set_editable( GTK_TEXT_VIEW( textview ), FALSE ); + gtk_container_add( GTK_CONTAINER( scr ), textview ); + gtk_widget_show( textview ); + + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), keyvalue_index ); + + g_object_set_data( G_OBJECT( dialog ), "notebook", notebook ); + g_object_set_data( G_OBJECT( dialog ), "keyvalue_page", keyvalue_scr ); + g_object_set_data( G_OBJECT( dialog ), "description_page", desc_scr ); + g_object_set_data( G_OBJECT( dialog ), "description_textview", textview ); + + hbox2 = gtk_hbox_new( FALSE, 5 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); gtk_widget_show( hbox2 ); @@ -1317,7 +1423,7 @@ void DoEntityList(){ button = gtk_button_new_with_label( _( "Select" ) ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( entitylist_select ), dialog ); + G_CALLBACK( entitylist_multiselect ), dialog ); gtk_widget_set_size_request( button, 60, -1 ); gtk_widget_show( button ); From d1ace58cebe40d44f0d254516b53b5c011627a74 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 2 May 2017 22:18:43 +0200 Subject: [PATCH 04/20] Image loading fallback --- radiant/gtkmisc.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index f8f5262a..26fb2c2a 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -660,15 +660,16 @@ GtkWidget* new_image_icon( const char* filename ) { str += filename; pixbuf = gdk_pixbuf_new_from_file( str.GetBuffer(), &gerror ); - if( pixbuf == NULL ) { + if( pixbuf != NULL ) { + icon = gtk_image_new_from_pixbuf( pixbuf ); + g_object_unref( pixbuf ); + } else { Sys_FPrintf( SYS_ERR, "ERROR: Failed to load bitmap: %s, %s\n", str.GetBuffer(), gerror->message ); g_error_free( gerror ); + icon = gtk_image_new_from_file( filename ); } - icon = gtk_image_new_from_pixbuf( pixbuf ); gtk_widget_show( icon ); - if( pixbuf ) { - g_object_unref( pixbuf ); - } + return icon; } From 75079e179f6b0d74246813b8cfed0a8a96473777 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 2 May 2017 23:22:08 +0200 Subject: [PATCH 05/20] Entities/Entity View update --- radiant/groupdialog.cpp | 82 +++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index 8873ee6e..444524e8 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -35,8 +35,6 @@ #include "groupdialog.h" GtkWidget* EntWidgets[EntLast]; -GtkListStore* g_entlist_store; -GtkListStore* g_entprops_store; int inspector_mode; // W_TEXTURE, W_ENTITY, or W_CONSOLE qboolean multiple_entities; qboolean disable_spawn_get = false; @@ -90,7 +88,10 @@ static void entity_check( GtkWidget *widget, gpointer data ); */ void FillClassList(){ - GtkListStore* store = g_entlist_store; + GtkListStore *store; + GtkTreeModel * model; + model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntList] ) ) ); + store = GTK_LIST_STORE( model ); gtk_list_store_clear( store ); @@ -109,7 +110,10 @@ void FillClassList(){ // void SetKeyValuePairs( bool bClearMD3 ){ - GtkListStore* store = g_entprops_store; + GtkListStore *store; + GtkTreeModel * model; + model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntProps] ) ) ); + store = GTK_LIST_STORE( model ); gtk_list_store_clear( store ); @@ -347,7 +351,7 @@ bool UpdateEntitySel( eclass_t *pec ){ Sys_FPrintf( SYS_WRN, "UpdateEntitySel\n" ); #endif - GtkTreeModel* model = GTK_TREE_MODEL( g_entlist_store ); + GtkTreeModel* model = GTK_TREE_MODEL( gtk_tree_view_get_model( GTK_TREE_VIEW( EntWidgets[EntList] ) ) ); GtkTreeIter iter; unsigned int i = 0; for ( gboolean good = gtk_tree_model_get_iter_first( model, &iter ); good != FALSE; good = gtk_tree_model_iter_next( model, &iter ) ) @@ -1059,12 +1063,21 @@ static gint eclasslist_keypress( GtkWidget* widget, GdkEventKey* event, gpointer return FALSE; } - static void proplist_selection_changed( GtkTreeSelection* selection, gpointer data ){ // find out what type of entity we are trying to create GtkTreeModel* model; GtkTreeIter iter; - if ( gtk_tree_selection_get_selected( selection, &model, &iter ) == FALSE ) { + GtkWidget *dialog, *del_button; + gboolean selected; + + dialog = GTK_WIDGET( data ); + del_button = GTK_WIDGET( g_object_get_data( G_OBJECT( dialog ), "del_button" ) ); + + selected = gtk_tree_selection_get_selected( selection, &model, &iter ); + + gtk_widget_set_sensitive( del_button, selected ); + + if ( selected == FALSE ) { return; } @@ -1078,6 +1091,10 @@ static void proplist_selection_changed( GtkTreeSelection* selection, gpointer da g_free( key ); g_free( val ); } +static void proplist_view_realize( GtkWidget *widget, gpointer data ) +{ + proplist_selection_changed( gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) ), data ); +} static void entity_check( GtkWidget *widget, gpointer data ){ if ( !disable_spawn_get ) { @@ -1215,30 +1232,34 @@ extern void PositionWindowOnPrimaryScreen( window_position_t& position ); #endif void GroupDlg::Create(){ + GtkWidget *dialog, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; + if ( m_pWidget != NULL ) { return; } - GtkWidget* dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + dialog = gtk_dialog_new_with_buttons( _( "Entities/Entity View" ), NULL, flags, NULL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); #ifdef _WIN32 if ( g_PrefsDlg.m_bStartOnPrimMon ) { PositionWindowOnPrimaryScreen( g_PrefsDlg.mWindowInfo.posEntityWnd ); } #endif - load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posEntityWnd ); + load_window_pos( dialog, g_PrefsDlg.mWindowInfo.posEntityWnd ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Entities" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", G_CALLBACK( OnDeleteHide ), NULL ); + g_signal_connect( G_OBJECT( dialog ), "delete-event", G_CALLBACK( OnDeleteHide ), NULL ); // catch 'Esc' - g_signal_connect( G_OBJECT( dlg ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL ); + g_signal_connect( G_OBJECT( dialog ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); - g_qeglobals_gui.d_entity = dlg; + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + g_qeglobals_gui.d_entity = dialog; { GtkWidget* notebook = gtk_notebook_new(); - gtk_container_add( GTK_CONTAINER( dlg ), notebook ); + gtk_container_add( GTK_CONTAINER( content_area ), notebook ); gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_BOTTOM ); gtk_widget_show( notebook ); m_pNotebook = notebook; @@ -1261,20 +1282,20 @@ void GroupDlg::Create(){ { GtkWidget* split2 = gtk_vpaned_new(); - gtk_paned_add1( GTK_PANED( split1 ), split2 ); + gtk_paned_pack1( GTK_PANED( split1 ), split2, TRUE, FALSE ); gtk_widget_show( split2 ); - g_object_set_data( G_OBJECT( dlg ), "split1", split1 ); - g_object_set_data( G_OBJECT( dlg ), "split2", split2 ); + g_object_set_data( G_OBJECT( dialog ), "split1", split1 ); + g_object_set_data( G_OBJECT( dialog ), "split2", split2 ); { GtkWidget* vbox2 = gtk_vbox_new( FALSE, 2 ); - gtk_paned_pack2( GTK_PANED( split1 ), vbox2, FALSE, FALSE ); + gtk_paned_pack2( GTK_PANED( split1 ), vbox2, TRUE, FALSE ); gtk_widget_show( vbox2 ); { GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL ); - gtk_paned_add1( GTK_PANED( split2 ), scr ); + gtk_paned_pack1( GTK_PANED( split2 ), scr, TRUE, FALSE ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); gtk_widget_show( scr ); @@ -1295,22 +1316,21 @@ void GroupDlg::Create(){ { GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( eclasslist_selection_changed ), dlg ); + g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( eclasslist_selection_changed ), dialog ); } - gtk_widget_show( view ); - gtk_container_add( GTK_CONTAINER( scr ), view ); + gtk_widget_show( view ); + g_object_unref( G_OBJECT( store ) ); EntWidgets[EntList] = view; - g_entlist_store = store; } } { GtkWidget* scr = gtk_scrolled_window_new( NULL, NULL ); - gtk_paned_add2( GTK_PANED( split2 ), scr ); + gtk_paned_pack2( GTK_PANED( split2 ), scr, TRUE, FALSE ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); gtk_widget_show( scr ); @@ -1369,17 +1389,16 @@ void GroupDlg::Create(){ { GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( proplist_selection_changed ), dlg ); + g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( proplist_selection_changed ), dialog ); + g_signal_connect( G_OBJECT( view ), "realize", G_CALLBACK( proplist_view_realize ), dialog ); } - gtk_container_add( GTK_CONTAINER( scr ), view ); gtk_widget_show( view ); g_object_unref( G_OBJECT( store ) ); EntWidgets[EntProps] = view; - g_entprops_store = store; } } } @@ -1539,9 +1558,9 @@ void GroupDlg::Create(){ { GtkWidget* button = gtk_button_new_with_label( _( "Reset" ) ); + gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( ResetEntity ), NULL ); - gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); } { @@ -1570,6 +1589,7 @@ void GroupDlg::Create(){ gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( DelProp ), NULL ); + g_object_set_data( G_OBJECT( dialog ), "del_button", button ); } { @@ -1630,7 +1650,7 @@ void GroupDlg::Create(){ } inspector_mode = W_ENTITY; - m_pWidget = dlg; - g_signal_connect( G_OBJECT( notebook ), "switch-page", G_CALLBACK( switch_page ), dlg ); + m_pWidget = dialog; + g_signal_connect( G_OBJECT( notebook ), "switch-page", G_CALLBACK( switch_page ), dialog ); } } From c03075a737f65b6a29c9fad30747bb78752e636b Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 10:17:10 +0200 Subject: [PATCH 06/20] Rollback on alignments. --- radiant/brush.cpp | 438 +++++++++++++++++++++++----------------------- 1 file changed, 220 insertions(+), 218 deletions(-) diff --git a/radiant/brush.cpp b/radiant/brush.cpp index adab6acf..9ce1220a 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -73,18 +73,18 @@ void PrintVector( vec3_t v ){ /* - ============================================================================= + ============================================================================= - TEXTURE COORDINATES + TEXTURE COORDINATES - ============================================================================= + ============================================================================= */ /* - ================== - textureAxisFromPlane - ================== + ================== + textureAxisFromPlane + ================== */ vec3_t baseaxis[18] = { @@ -107,7 +107,7 @@ void TextureAxisFromPlane( plane_t *pln, vec3_t xv, vec3_t yv ) { for ( i = 0 ; i < 6 ; i++ ) { dot = DotProduct( pln->normal, baseaxis[i * 3] ); - // see q3map2 source - added () for clarity + // see q3map2 source - added () for clarity if ( ( g_PrefsDlg.m_bQ3Map2Texturing && dot > best + 0.0001f ) || dot > best ) { best = dot; bestaxis = i; @@ -602,18 +602,18 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz // find the STfromXYZ 4-vectors /* - SARRUS-SOLVE: - xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - FOR: STfromXYZ[0] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) - SARRUS-SOLVE: - xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - FOR: STfromXYZ[1] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + FOR: STfromXYZ[0] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + FOR: STfromXYZ[1] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) */ STfromXYZ[0][uv] = 0; @@ -645,8 +645,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz float newSTfromXYZ[2][4]; printf("old: %Lf,%Lf,%Lf,%Lf %Lf,%Lf,%Lf,%Lf\n", - STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], - STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); + STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], + STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); */ Face_TexdefFromTextureVectors( f, STfromXYZ, pvecs, sv, tv ); @@ -655,8 +655,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz Face_TextureVectors(f, newSTfromXYZ); printf("new: %f,%f,%f,%f %f,%f,%f,%f\n", - newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], - newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); + newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], + newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); float newxyzst1[5]; float newxyzst2[5]; @@ -668,12 +668,12 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz EmitTextureCoordinates (newxyzst2, q, f); EmitTextureCoordinates (newxyzst3, q, f); printf("Face_TexdefFromTextureCoordinates: %f,%f %f,%f %f,%f -> %f,%f %f,%f %f,%f\n", - xyzst1[3], xyzst1[4], - xyzst2[3], xyzst2[4], - xyzst3[3], xyzst3[4], - newxyzst1[3], newxyzst1[4], - newxyzst2[3], newxyzst2[4], - newxyzst3[3], newxyzst3[4]); + xyzst1[3], xyzst1[4], + xyzst2[3], xyzst2[4], + xyzst3[3], xyzst3[4], + newxyzst1[3], newxyzst1[4], + newxyzst2[3], newxyzst2[4], + newxyzst3[3], newxyzst3[4]); // TODO why do these differ, but not the previous ones? this makes no sense whatsoever */ } @@ -1038,16 +1038,16 @@ face_t *Brush_BestSplitFace( brush_t *b ){ } /* - ================= - Brush_MakeConvexBrushes + ================= + Brush_MakeConvexBrushes - MrE FIXME: this doesn't work because the old - Brush_SplitBrushByFace is used - Turns the brush into a minimal number of convex brushes. - If the input brush is convex then it will be returned. - Otherwise the input brush will be freed. - NOTE: the input brush should have windings for the faces. - ================= + MrE FIXME: this doesn't work because the old + Brush_SplitBrushByFace is used + Turns the brush into a minimal number of convex brushes. + If the input brush is convex then it will be returned. + Otherwise the input brush will be freed. + NOTE: the input brush should have windings for the faces. + ================= */ brush_t *Brush_MakeConvexBrushes( brush_t *b ){ brush_t *front, *back, *end; @@ -2076,130 +2076,130 @@ brush_t *Brush_FullClone( brush_t *b ){ // FIXME - spog - finish this later.. /* - bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) - { - int i; - vec3_t v1, v2, normal[3]; - float d; + bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) + { + int i; + vec3_t v1, v2, normal[3]; + float d; - //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); - //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); - //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); - //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); + //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); + //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); + //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); + //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); - // test ray against triangle - // get triangle plane normal - //VectorSubtract(p1, p2, v1); - //VectorSubtract(p1, p3, v2); - //CrossProduct(v1, v2, v1); - // check normal against direction - //if (DotProduct(dir, v1) >= 0) - //{ - // generate cone normals - VectorSubtract(origin, p1, v1); - VectorSubtract(origin, p2, v2); - CrossProduct(v1, v2, normal[0]); - VectorSubtract(origin, p2, v1); - VectorSubtract(origin, p3, v2); - CrossProduct(v1, v2, normal[1]); - VectorSubtract(origin, p3, v1); - VectorSubtract(origin, p1, v2); - CrossProduct(v1, v2, normal[2]); - //} - //else - //{ - // flip normals if triangle faces away - // Sys_Printf("flipped\n"); - // VectorSubtract(origin, p1, v1); - // VectorSubtract(origin, p3, v2); - // CrossProduct(v1, v2, normal[0]); - // VectorSubtract(origin, p3, v1); - // VectorSubtract(origin, p2, v2); - // CrossProduct(v1, v2, normal[1]); - // VectorSubtract(origin, p2, v1); - // VectorSubtract(origin, p1, v2); - // CrossProduct(v1, v2, normal[2]); - //} + // test ray against triangle + // get triangle plane normal + //VectorSubtract(p1, p2, v1); + //VectorSubtract(p1, p3, v2); + //CrossProduct(v1, v2, v1); + // check normal against direction + //if (DotProduct(dir, v1) >= 0) + //{ + // generate cone normals + VectorSubtract(origin, p1, v1); + VectorSubtract(origin, p2, v2); + CrossProduct(v1, v2, normal[0]); + VectorSubtract(origin, p2, v1); + VectorSubtract(origin, p3, v2); + CrossProduct(v1, v2, normal[1]); + VectorSubtract(origin, p3, v1); + VectorSubtract(origin, p1, v2); + CrossProduct(v1, v2, normal[2]); + //} + //else + //{ + // flip normals if triangle faces away + // Sys_Printf("flipped\n"); + // VectorSubtract(origin, p1, v1); + // VectorSubtract(origin, p3, v2); + // CrossProduct(v1, v2, normal[0]); + // VectorSubtract(origin, p3, v1); + // VectorSubtract(origin, p2, v2); + // CrossProduct(v1, v2, normal[1]); + // VectorSubtract(origin, p2, v1); + // VectorSubtract(origin, p1, v2); + // CrossProduct(v1, v2, normal[2]); + //} - for (i=0; i<3; i++) - { - VectorNormalize(normal[i]); - //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); - //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); - d = DotProduct(dir, normal[i]); - //Sys_Printf("dotproduct: %f\n",d); - if (d < 0) - return false; - } - return true; - } + for (i=0; i<3; i++) + { + VectorNormalize(normal[i]); + //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); + //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); + d = DotProduct(dir, normal[i]); + //Sys_Printf("dotproduct: %f\n",d); + if (d < 0) + return false; + } + return true; + } */ /* - extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, - float vert0[3], float vert1[3], float vert2[3], - double *t, double *u, double *v); + extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, + float vert0[3], float vert1[3], float vert2[3], + double *t, double *u, double *v); - bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) - { - bool bIntersect = false; - float tBest = FLT_MAX; - int i, j; - vec3_t xyz[3]; - vec3_t vRay[2]; + bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) + { + bool bIntersect = false; + float tBest = FLT_MAX; + int i, j; + vec3_t xyz[3]; + vec3_t vRay[2]; - float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set + float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set - VectorSubtract (origin, b->owner->origin, vRay[0]); - VectorCopy (dir, vRay[1]); + VectorSubtract (origin, b->owner->origin, vRay[0]); + VectorCopy (dir, vRay[1]); - if (angle > 0) - { - int i; - float s, c; - float x, y; + if (angle > 0) + { + int i; + float s, c; + float x, y; - s = sin (-angle/180*Q_PI); - c = cos (-angle/180*Q_PI); + s = sin (-angle/180*Q_PI); + c = cos (-angle/180*Q_PI); - for (i=0; i<2; i++) - { - x = vRay[i][0]; - y = vRay[i][1]; - vRay[i][0] = (x * c) - (y * s); - vRay[i][1] = (x * s) + (y * c); - } - } + for (i=0; i<2; i++) + { + x = vRay[i][0]; + y = vRay[i][1]; + vRay[i][0] = (x * c) - (y * s); + vRay[i][1] = (x * s) + (y * c); + } + } - entitymodel *model = b->owner->md3Class->model; + entitymodel *model = b->owner->md3Class->model; - while (model != NULL) - { - for (i = 0; i < model->nTriCount; i++) - { - for (j = 0; j < 3; j++) - VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); + while (model != NULL) + { + for (i = 0; i < model->nTriCount; i++) + { + for (j = 0; j < 3; j++) + VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); - if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) - { - bIntersect = true; - if (*t < tBest) - tBest = *t; - } - } - model = model->pNext; - } - if (bIntersect) - { - *t = tBest; - return true; - } - else - { - *t = 0; - return false; - } - } + if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) + { + bIntersect = true; + if (*t < tBest) + tBest = *t; + } + } + model = model->pNext; + } + if (bIntersect) + { + *t = tBest; + return true; + } + else + { + *t = 0; + return false; + } + } */ /* @@ -2365,23 +2365,23 @@ void Brush_RemoveFromList( brush_t *b ){ } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default - TTimo - shader code cleanup - added IShader* parameter - =============== + TTimo - shader code cleanup + added IShader* parameter + =============== */ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2433,20 +2433,20 @@ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default - =============== + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default + =============== */ void SetFaceTexdef( face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2821,15 +2821,15 @@ void Brush_BuildWindings( brush_t *b, bool bSnap ){ if ( g_qeglobals.bNeedConvert ) { BrushPrimitFaceToFace( face ); /* - // we have parsed brush primitives and need conversion back to standard format - // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it - // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling - // I tried various tweaks, no luck .. seems shifting is lost - brushprimit_texdef_t aux; - ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); - TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); - face->texdef.scale[0]/=2.0; - face->texdef.scale[1]/=2.0; + // we have parsed brush primitives and need conversion back to standard format + // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it + // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling + // I tried various tweaks, no luck .. seems shifting is lost + brushprimit_texdef_t aux; + ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); + TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); + face->texdef.scale[0]/=2.0; + face->texdef.scale[1]/=2.0; */ } for ( i = 0 ; i < w->numpoints ; i++ ) @@ -3063,14 +3063,14 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ qglNormal3fv( face->plane.normal ); } /* - if (mode & DRAW_GL_TEXTURE_2D) - qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); - qglVertexPointer(3, GL_FLOAT, 5, w->points); + if (mode & DRAW_GL_TEXTURE_2D) + qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); + qglVertexPointer(3, GL_FLOAT, 5, w->points); - if (mode & DRAW_GL_FILL) - qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); - else - qglDrawArrays(GL_POLYGON, 0, w->numpoints); + if (mode & DRAW_GL_FILL) + qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); + else + qglDrawArrays(GL_POLYGON, 0, w->numpoints); */ if ( nGLState & DRAW_GL_FILL ) { @@ -3790,44 +3790,46 @@ void aabb_draw( const aabb_t *aabb, int mode ){ qglEnd(); /* - vec3_t Coords[8]; - vec3_t vMin, vMax; - VectorSubtract(aabb->origin, aabb->extents, vMin); - VectorAdd(aabb->origin, aabb->extents, vMax); - VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); - VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); - VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); - VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); - VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); - VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); - VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); - VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - vec3_t Normals[8] = { {-1, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 1 }, - { 0, 0,-1 }, - { 0, 1, 0 }, - { 1, 0, 0 }, - { 0,-1, 0 } }; + vec3_t Coords[8]; - unsigned short Indices[24] = { 2, 1, 5, 6, - 1, 0, 4, 5, - 0, 1, 2, 3, - 3, 7, 4, 0, - 3, 2, 6, 7, - 7, 6, 5, 4 }; + vec3_t vMin, vMax; + VectorSubtract(aabb->origin, aabb->extents, vMin); + VectorAdd(aabb->origin, aabb->extents, vMax); + VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); + VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); + VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); + VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); + VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); + VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); + VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); + VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays - qglNormalPointer(GL_FLOAT, 0, Normals); + vec3_t Normals[8] = { {-1, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 1 }, + { 0, 0,-1 }, + { 0, 1, 0 }, + { 1, 0, 0 }, + { 0,-1, 0 } }; - //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array + unsigned short Indices[24] = { 2, 1, 5, 6, + 1, 0, 4, 5, + 0, 1, 2, 3, + 3, 7, 4, 0, + 3, 2, 6, 7, + 7, 6, 5, 4 }; - qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); + qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays + qglNormalPointer(GL_FLOAT, 0, Normals); - //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array + //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array + + qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); + + //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array */ } From 877f0b4c2f392a4dbc8fede785efbcd7cee3e12e Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 10:40:38 +0200 Subject: [PATCH 07/20] Finalizing alignments rollback. --- radiant/camwindow.cpp | 4 ++-- radiant/select.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 5419913f..6cf28584 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index 768a717c..b0584136 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ From 58a263dbe49603ba90251025565b96d2918b06ad Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Wed, 11 Nov 2015 11:56:29 +0100 Subject: [PATCH 08/20] Make NULL models rendered as a box, and selectable (were already editable) TODO: - Handle the case "Model not found". - Add relevant console prints. - Fix glitchy-looking selected box. Alignments in code. More texture suffix checks for DarkPlaces effect texture names. PicoModel Backport: Fixed compilation. Update .gitignore Added more exclusions, most of them Windows/Visual Studio related. Aligment. Fix compilation on OS X. How is this working elsewhere? This generates a different warning now, and is just wrong anyway. Fix a handful of compiler warnings. Fix for potentially using uninitialized variable Fix gcc warning shdr may be used uninitialized Fix gcc warning i may be used uninitialized tweak previous pull with an assert remove unused tex_palette Fix gcc warning item may be used uninitialized in this function read source file lists from .vcxproj files for SCons build remove the old .vcproj m4_submat modification Fix gcc warning sizeof on array function parameter src will return size of float (*)[3] Rollback on alignments. --- .gitignore | 40 +- SConscript.lib | 2 +- SConscript.module | 2 +- SConscript.q3data | 2 +- SConscript.q3map2 | 2 +- SConscript.q3map2.urt | 2 +- SConscript.radiant | 2 +- bspc | 2 +- config.py | 58 +- contrib/bkgrnd2d/bkgrnd2d.vcproj | 195 --- contrib/bobtoolz/bobtoolz.vcproj | 292 ----- contrib/camera/camera.vcproj | 211 --- contrib/gtkgensurf/gtkgensurf.vcproj | 227 ---- contrib/hydratoolz/hydratoolz.vcproj | 187 --- contrib/prtview/prtview.vcproj | 207 --- include/imodel.h | 1 + libs/cmdlib/cmdlib.vcproj | 155 --- libs/ddslib/ddslib.vcproj | 153 --- libs/l_net/l_net.vcproj | 157 --- libs/mathlib/m4x4.c | 14 +- libs/mathlib/mathlib.vcproj | 165 --- libs/md5lib/md5lib.vcproj | 159 --- libs/picomodel.h | 1 + libs/picomodel/lwo/envelope.c | 2 + libs/picomodel/lwo/lwob.c | 21 +- libs/picomodel/picointernal.c | 2 +- libs/picomodel/picointernal.h | 2 +- libs/picomodel/picomodel.vcproj | 244 ---- libs/picomodel/picomodel.vcxproj | 1 + libs/picomodel/picomodel.vcxproj.filters | 3 + libs/picomodel/pm_lwo.c | 4 +- libs/picomodel/pm_terrain.c | 4 +- libs/splines/math_matrix.h | 6 +- libs/splines/splines.vcproj | 183 --- libs/synapse/synapse.vcproj | 155 --- plugins/eclassfgd/fgd.vcproj | 187 --- plugins/entity/entity.vcproj | 207 --- plugins/entity/entity_entitymodel.h | 2 + plugins/image/image.vcproj | 199 --- plugins/imagehl/imagehl.vcproj | 191 --- plugins/imagem8/imagem8.vcproj | 195 --- plugins/imagepng/imagepng.vcproj | 187 --- plugins/imagewal/imagewal.vcproj | 191 --- plugins/map/map.vcproj | 195 --- plugins/mapxml/mapxml.vcproj | 195 --- plugins/model/cpicomodel.h | 1 + plugins/model/model.vcproj | 203 --- plugins/model/remap.cpp | 6 + plugins/shaders/shaders.vcproj | 191 --- plugins/spritemodel/spritemodel.h | 1 + plugins/spritemodel/spritemodel.vcproj | 191 --- plugins/surface/surface.vcproj | 191 --- .../surface_idtech2/surface_idtech2.vcproj | 195 --- plugins/textool/textool.vcproj | 199 --- plugins/vfspak/vfspak.vcproj | 191 --- plugins/vfspk3/vfspk3.vcproj | 195 --- plugins/vfsqlpk3/vfsqlpk3.vcproj | 200 --- plugins/vfswad/vfswad.vcproj | 195 --- radiant/brush.cpp | 25 +- radiant/camwindow.cpp | 20 +- radiant/mainframe.cpp | 1 + radiant/radiant.vcproj | 402 ------ radiant/select.cpp | 28 +- radiant/texwindow.cpp | 15 +- tools/quake2/extra/bsp/qbsp3/map.c | 2 - tools/quake3/common/quake3-common.vcproj | 191 --- tools/quake3/q3data/q3data.vcproj | 279 ---- tools/quake3/q3map2/q3map2.vcproj | 362 ------ .../urt/tools/quake3/q3map2/q3map2_urt.vcproj | 1155 ----------------- utils.py | 7 +- 70 files changed, 167 insertions(+), 8891 deletions(-) delete mode 100644 contrib/bkgrnd2d/bkgrnd2d.vcproj delete mode 100644 contrib/bobtoolz/bobtoolz.vcproj delete mode 100644 contrib/camera/camera.vcproj delete mode 100644 contrib/gtkgensurf/gtkgensurf.vcproj delete mode 100644 contrib/hydratoolz/hydratoolz.vcproj delete mode 100644 contrib/prtview/prtview.vcproj delete mode 100644 libs/cmdlib/cmdlib.vcproj delete mode 100644 libs/ddslib/ddslib.vcproj delete mode 100644 libs/l_net/l_net.vcproj delete mode 100644 libs/mathlib/mathlib.vcproj delete mode 100644 libs/md5lib/md5lib.vcproj delete mode 100644 libs/picomodel/picomodel.vcproj delete mode 100644 libs/splines/splines.vcproj delete mode 100644 libs/synapse/synapse.vcproj delete mode 100644 plugins/eclassfgd/fgd.vcproj delete mode 100644 plugins/entity/entity.vcproj delete mode 100644 plugins/image/image.vcproj delete mode 100644 plugins/imagehl/imagehl.vcproj delete mode 100644 plugins/imagem8/imagem8.vcproj delete mode 100644 plugins/imagepng/imagepng.vcproj delete mode 100644 plugins/imagewal/imagewal.vcproj delete mode 100644 plugins/map/map.vcproj delete mode 100644 plugins/mapxml/mapxml.vcproj delete mode 100644 plugins/model/model.vcproj delete mode 100644 plugins/shaders/shaders.vcproj delete mode 100644 plugins/spritemodel/spritemodel.vcproj delete mode 100644 plugins/surface/surface.vcproj delete mode 100644 plugins/surface_idtech2/surface_idtech2.vcproj delete mode 100644 plugins/textool/textool.vcproj delete mode 100644 plugins/vfspak/vfspak.vcproj delete mode 100644 plugins/vfspk3/vfspk3.vcproj delete mode 100644 plugins/vfsqlpk3/vfsqlpk3.vcproj delete mode 100644 plugins/vfswad/vfswad.vcproj delete mode 100644 radiant/radiant.vcproj delete mode 100644 tools/quake3/common/quake3-common.vcproj delete mode 100644 tools/quake3/q3data/q3data.vcproj delete mode 100644 tools/quake3/q3map2/q3map2.vcproj delete mode 100644 tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj diff --git a/.gitignore b/.gitignore index afed6944..3dce9620 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,30 @@ -/apple/target/* -/build -/install/games -/install/installs -/install/q3data -/install/q3map2 -/install/q3map2_urt -/install/radiant.bin -/install/share -/packs -/site.sconf -/.sconsign.dblite -*.pyc -*.so .settings .DS_Store + +/apple/target/* +/build +/install +/packs +/tools/urt/tools/quake3/q3map2/Debug +/tools/urt/tools/quake3/q3map2/Release +/.sconsign.dblite +/.vs/radiant/v14/.suo +/radiant.opensdf +/radiant.sdf +/radiant.suo +/radiant.v11.suo +/radiant.v12.suo +/radiant.VC.db +/site.sconf + *.obj +*.pyc +*.so *.tlog +*.vcxproj.user +*.zip + + + + + diff --git a/SConscript.lib b/SConscript.lib index dd0988d7..0aaa81a4 100644 --- a/SConscript.lib +++ b/SConscript.lib @@ -12,7 +12,7 @@ libname = os.path.splitext( libname )[0] env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), project ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), project ) ) # some filtering. may need to improve that add_sources = [] diff --git a/SConscript.module b/SConscript.module index 9d4bdd6a..41885be8 100644 --- a/SConscript.module +++ b/SConscript.module @@ -18,7 +18,7 @@ useZ = True usePNG = True settings.SetupEnvironment( env, config['name'], useGtk = useGtk, useJPEG = useJPEG, useZ = useZ, usePNG = usePNG ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), project ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), project ) ) # some filtering. may need to improve that add_sources = [] diff --git a/SConscript.q3data b/SConscript.q3data index c89012f2..6a089323 100644 --- a/SConscript.q3data +++ b/SConscript.q3data @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common' ] ) env.Append( LIBS = [ 'm', 'pthread' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3data/q3data.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3data/q3data.vcxproj' ) ) objects = lib_objects objects += [ os.path.join( 'tools/quake3/q3data', i ) for i in proj.getSourceFiles() ] q3data = env.Program( 'q3data', objects ) diff --git a/SConscript.q3map2 b/SConscript.q3map2 index 2c981136..8229b8c9 100644 --- a/SConscript.q3map2 +++ b/SConscript.q3map2 @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common' ] ) env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3map2/q3map2.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3map2/q3map2.vcxproj' ) ) objects = lib_objects objects += [ os.path.join( 'tools/quake3/q3map2', i ) for i in proj.getSourceFiles() ] q3map2 = env.Program( 'q3map2', objects ) diff --git a/SConscript.q3map2.urt b/SConscript.q3map2.urt index c75f73ac..baf383dc 100644 --- a/SConscript.q3map2.urt +++ b/SConscript.q3map2.urt @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common', ] ) env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/urt/tools/quake3/q3map2/q3map2_urt.vcxproj' ) ) objects = lib_objects def keep_file( n ): diff --git a/SConscript.radiant b/SConscript.radiant index 114689aa..f3d85770 100644 --- a/SConscript.radiant +++ b/SConscript.radiant @@ -10,7 +10,7 @@ Import( [ 'utils', 'config', 'settings', 'lib_objects' ] ) env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config[ 'name' ], useGtk = True, useGtkGL = True ) env.Append( LIBS = [ 'dl' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcxproj' ) ) radiant = env.Program( 'radiant.bin', lib_objects + [ os.path.join( 'radiant', i ) for i in proj.getSourceFiles() ] ) diff --git a/bspc b/bspc index a1287590..2c840783 160000 --- a/bspc +++ b/bspc @@ -1 +1 @@ -Subproject commit a1287590f17c35a612f33708aeec5815402866b8 +Subproject commit 2c8407838398608cb9c52abae046987bb7a39c08 diff --git a/config.py b/config.py index 10d3ed7e..c91914a9 100644 --- a/config.py +++ b/config.py @@ -72,7 +72,7 @@ class Config: build_dir = os.path.join( 'build', config_name, 'radiant' ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'libs/synapse/synapse.vcproj', 'libs/cmdlib/cmdlib.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj' ]: + for project in [ 'libs/synapse/synapse.vcxproj', 'libs/cmdlib/cmdlib.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) @@ -81,7 +81,7 @@ class Config: # PIC versions of the libs for the modules shlib_objects_extra = {} - for project in [ 'libs/synapse/synapse.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/picomodel/picomodel.vcproj', 'libs/cmdlib/cmdlib.vcproj', 'libs/splines/splines.vcproj' ]: + for project in [ 'libs/synapse/synapse.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/picomodel/picomodel.vcxproj', 'libs/cmdlib/cmdlib.vcxproj', 'libs/splines/splines.vcxproj' ]: ( libpath, libname ) = os.path.split( project ) libname = os.path.splitext( libname )[0] config['shared'] = True @@ -90,31 +90,31 @@ class Config: VariantDir( build_dir, '.', duplicate = 0 ) shlib_objects_extra[libname] = SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) - for project in [ 'plugins/vfsqlpk3/vfsqlpk3.vcproj', - 'plugins/vfspk3/vfspk3.vcproj', - 'plugins/vfspak/vfspak.vcproj', - 'plugins/vfswad/vfswad.vcproj', - 'plugins/eclassfgd/fgd.vcproj', - 'plugins/entity/entity.vcproj', - 'plugins/image/image.vcproj', - 'plugins/model/model.vcproj', - 'plugins/imagepng/imagepng.vcproj', - 'plugins/imagewal/imagewal.vcproj', - 'plugins/imagehl/imagehl.vcproj', - 'plugins/imagem8/imagem8.vcproj', - 'plugins/spritemodel/spritemodel.vcproj', - 'plugins/textool/textool.vcproj', - 'plugins/map/map.vcproj', - 'plugins/mapxml/mapxml.vcproj', - 'plugins/shaders/shaders.vcproj', - 'plugins/surface/surface.vcproj', - 'plugins/surface_idtech2/surface_idtech2.vcproj', - 'contrib/camera/camera.vcproj', - 'contrib/prtview/prtview.vcproj', - 'contrib/hydratoolz/hydratoolz.vcproj', - 'contrib/bobtoolz/bobtoolz.vcproj', - 'contrib/gtkgensurf/gtkgensurf.vcproj', - 'contrib/bkgrnd2d/bkgrnd2d.vcproj' + for project in [ 'plugins/vfsqlpk3/vfsqlpk3.vcxproj', + 'plugins/vfspk3/vfspk3.vcxproj', + 'plugins/vfspak/vfspak.vcxproj', + 'plugins/vfswad/vfswad.vcxproj', + 'plugins/eclassfgd/fgd.vcxproj', + 'plugins/entity/entity.vcxproj', + 'plugins/image/image.vcxproj', + 'plugins/model/model.vcxproj', + 'plugins/imagepng/imagepng.vcxproj', + 'plugins/imagewal/imagewal.vcxproj', + 'plugins/imagehl/imagehl.vcxproj', + 'plugins/imagem8/imagem8.vcxproj', + 'plugins/spritemodel/spritemodel.vcxproj', + 'plugins/textool/textool.vcxproj', + 'plugins/map/map.vcxproj', + 'plugins/mapxml/mapxml.vcxproj', + 'plugins/shaders/shaders.vcxproj', + 'plugins/surface/surface.vcxproj', + 'plugins/surface_idtech2/surface_idtech2.vcxproj', + 'contrib/camera/camera.vcxproj', + 'contrib/prtview/prtview.vcxproj', + 'contrib/hydratoolz/hydratoolz.vcxproj', + 'contrib/bobtoolz/bobtoolz.vcxproj', + 'contrib/gtkgensurf/gtkgensurf.vcxproj', + 'contrib/bkgrnd2d/bkgrnd2d.vcxproj' ]: ( libpath, libname ) = os.path.split( project ) libname = os.path.splitext( libname )[0] @@ -158,7 +158,7 @@ class Config: build_dir = os.path.join( 'build', config_name, compiler_name ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'tools/quake3/common/quake3-common.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj', 'libs/ddslib/ddslib.vcproj', 'libs/picomodel/picomodel.vcproj', 'libs/md5lib/md5lib.vcproj' ]: + for project in [ 'tools/quake3/common/quake3-common.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj', 'libs/ddslib/ddslib.vcxproj', 'libs/picomodel/picomodel.vcxproj', 'libs/md5lib/md5lib.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) @@ -176,7 +176,7 @@ class Config: build_dir = os.path.join( 'build', config_name, 'q3data' ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj', 'libs/ddslib/ddslib.vcproj' ]: + for project in [ 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj', 'libs/ddslib/ddslib.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) diff --git a/contrib/bkgrnd2d/bkgrnd2d.vcproj b/contrib/bkgrnd2d/bkgrnd2d.vcproj deleted file mode 100644 index cdaa3c9f..00000000 --- a/contrib/bkgrnd2d/bkgrnd2d.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/bobtoolz/bobtoolz.vcproj b/contrib/bobtoolz/bobtoolz.vcproj deleted file mode 100644 index c8b8609f..00000000 --- a/contrib/bobtoolz/bobtoolz.vcproj +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/camera/camera.vcproj b/contrib/camera/camera.vcproj deleted file mode 100644 index 4aa51dbd..00000000 --- a/contrib/camera/camera.vcproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/gtkgensurf/gtkgensurf.vcproj b/contrib/gtkgensurf/gtkgensurf.vcproj deleted file mode 100644 index 5782132c..00000000 --- a/contrib/gtkgensurf/gtkgensurf.vcproj +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/hydratoolz/hydratoolz.vcproj b/contrib/hydratoolz/hydratoolz.vcproj deleted file mode 100644 index 9e327ea2..00000000 --- a/contrib/hydratoolz/hydratoolz.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/prtview/prtview.vcproj b/contrib/prtview/prtview.vcproj deleted file mode 100644 index 332ddd8f..00000000 --- a/contrib/prtview/prtview.vcproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/include/imodel.h b/include/imodel.h index 65d88678..2ae1e631 100644 --- a/include/imodel.h +++ b/include/imodel.h @@ -77,6 +77,7 @@ virtual ~IRender() { } virtual void IncRef() = 0; // increments the reference counter for this object virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state +virtual const bool IsModelNotNull() const = 0; virtual const aabb_t *GetAABB() const = 0; }; diff --git a/libs/cmdlib/cmdlib.vcproj b/libs/cmdlib/cmdlib.vcproj deleted file mode 100644 index 94d4c253..00000000 --- a/libs/cmdlib/cmdlib.vcproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/ddslib/ddslib.vcproj b/libs/ddslib/ddslib.vcproj deleted file mode 100644 index b0b689c0..00000000 --- a/libs/ddslib/ddslib.vcproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/l_net/l_net.vcproj b/libs/l_net/l_net.vcproj deleted file mode 100644 index dd883685..00000000 --- a/libs/l_net/l_net.vcproj +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/mathlib/m4x4.c b/libs/mathlib/m4x4.c index 5dfdd10d..6f3e75ab 100644 --- a/libs/mathlib/m4x4.c +++ b/libs/mathlib/m4x4.c @@ -702,27 +702,31 @@ void m4_submat( m4x4_t mr, m3x3_t mb, int i, int j ){ idst = 0; for ( ti = 0; ti < 4; ti++ ) { + if ( ti == i ) { + continue; + } if ( ti < i ) { idst = ti; } else - if ( ti > i ) { + { idst = ti - 1; } for ( tj = 0; tj < 4; tj++ ) { + if ( tj == j ) { + continue; + } if ( tj < j ) { jdst = tj; } else - if ( tj > j ) { + { jdst = tj - 1; } - if ( ti != i && tj != j ) { - mb[idst * 3 + jdst] = mr[ti * 4 + tj ]; - } + mb[idst * 3 + jdst] = mr[ti * 4 + tj ]; } } } diff --git a/libs/mathlib/mathlib.vcproj b/libs/mathlib/mathlib.vcproj deleted file mode 100644 index 55ec5ee5..00000000 --- a/libs/mathlib/mathlib.vcproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/md5lib/md5lib.vcproj b/libs/md5lib/md5lib.vcproj deleted file mode 100644 index 8da037cb..00000000 --- a/libs/md5lib/md5lib.vcproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/picomodel.h b/libs/picomodel.h index f33c6da6..a1f2c5c6 100644 --- a/libs/picomodel.h +++ b/libs/picomodel.h @@ -267,6 +267,7 @@ void PicoSetSurfaceIndex( picoSurface_t *surface, int num void PicoSetSurfaceIndexes( picoSurface_t *surface, int num, picoIndex_t *index, int count ); void PicoSetFaceNormal( picoSurface_t *surface, int num, picoVec3_t normal ); void PicoSetSurfaceSpecial( picoSurface_t *surface, int num, int special ); +void PicoSetSurfaceSmoothingGroup( picoSurface_t *surface, int num, picoIndex_t smoothingGroup ); /* getter functions */ diff --git a/libs/picomodel/lwo/envelope.c b/libs/picomodel/lwo/envelope.c index db7000ad..4510dade 100644 --- a/libs/picomodel/lwo/envelope.c +++ b/libs/picomodel/lwo/envelope.c @@ -75,6 +75,8 @@ lwEnvelope *lwGetEnvelope( picoMemStream_t *fp, int cksize ){ goto Fail; } + key = NULL; + /* process subchunks as they're encountered */ while ( 1 ) { diff --git a/libs/picomodel/lwo/lwob.c b/libs/picomodel/lwo/lwob.c index 57cc0c52..a8bd25e5 100644 --- a/libs/picomodel/lwo/lwob.c +++ b/libs/picomodel/lwo/lwob.c @@ -8,6 +8,8 @@ Ernie Wright 17 Sep 00 ====================================================================== */ +#include + #include "../picointernal.h" #include "lwo2.h" @@ -244,6 +246,8 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ goto Fail; } + shdr = NULL; + /* process subchunks as they're encountered */ while ( 1 ) { @@ -382,16 +386,18 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ case ID_TFLG: flags = getU2( fp ); + //only one of the three axis bits should be set if ( flags & 1 ) { - i = 0; + tex->axis = 0; } - if ( flags & 2 ) { - i = 1; + else if ( flags & 2 ) { + tex->axis = 1; } - if ( flags & 4 ) { - i = 2; + else { + assert( flags & 4 ); + tex->axis = 2; } - tex->axis = i; + if ( tex->type == ID_IMAP ) { tex->param.imap.axis = i; } @@ -494,6 +500,9 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ break; case ID_SDAT: + if ( !shdr ) { + goto Fail; + } shdr->data = getbytes( fp, sz ); break; diff --git a/libs/picomodel/picointernal.c b/libs/picomodel/picointernal.c index c6f396ce..d9eeb656 100644 --- a/libs/picomodel/picointernal.c +++ b/libs/picomodel/picointernal.c @@ -272,7 +272,7 @@ void _pico_first_token( char *str ) { return; } while (*str && !isspace(*str)) - *str++; + str++; *str = '\0'; } diff --git a/libs/picomodel/picointernal.h b/libs/picomodel/picointernal.h index 8e9bba25..853809ee 100644 --- a/libs/picomodel/picointernal.h +++ b/libs/picomodel/picointernal.h @@ -132,7 +132,7 @@ void _pico_printf( int level, const char *format, ... ); char *_pico_stristr( char *str, const char *substr ); void _pico_unixify( char *path ); int _pico_nofname( const char *path, char *dest, int destSize ); -char *_pico_nopath( const char *path ); +const char *_pico_nopath( const char *path ); char *_pico_setfext( char *path, const char *ext ); int _pico_getline( char *buf, int bufsize, char *dest, int destsize ); char *_pico_strlwr( char *str ); diff --git a/libs/picomodel/picomodel.vcproj b/libs/picomodel/picomodel.vcproj deleted file mode 100644 index 1cfa803c..00000000 --- a/libs/picomodel/picomodel.vcproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/picomodel/picomodel.vcxproj b/libs/picomodel/picomodel.vcxproj index f5c872a5..2faa101c 100644 --- a/libs/picomodel/picomodel.vcxproj +++ b/libs/picomodel/picomodel.vcxproj @@ -147,6 +147,7 @@ + diff --git a/libs/picomodel/picomodel.vcxproj.filters b/libs/picomodel/picomodel.vcxproj.filters index 2760cddb..d22ec524 100644 --- a/libs/picomodel/picomodel.vcxproj.filters +++ b/libs/picomodel/picomodel.vcxproj.filters @@ -77,5 +77,8 @@ src\lwo + + src + \ No newline at end of file diff --git a/libs/picomodel/pm_lwo.c b/libs/picomodel/pm_lwo.c index 5b4f2d60..dfb64c6e 100644 --- a/libs/picomodel/pm_lwo.c +++ b/libs/picomodel/pm_lwo.c @@ -285,8 +285,8 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){ ///* doom3 lwo data doesn't seem to have smoothing-angle information */ //#if 0 -// if ( surface->smooth <= 0 ) { -// /* use face normals */ + if ( surface->smooth <= 0 ) { + /* use face normals */ normal[ 0 ] = v->norm[ 0 ]; normal[ 1 ] = v->norm[ 2 ]; normal[ 2 ] = v->norm[ 1 ]; diff --git a/libs/picomodel/pm_terrain.c b/libs/picomodel/pm_terrain.c index d0d54653..f5d16423 100644 --- a/libs/picomodel/pm_terrain.c +++ b/libs/picomodel/pm_terrain.c @@ -303,7 +303,7 @@ static int _terrain_canload( PM_PARAMS_CANLOAD ) { /* keep the friggin compiler happy */ - *fileName = *fileName; + /**fileName = *fileName*/; /* create pico parser */ p = _pico_new_parser( (picoByte_t*) buffer, bufSize ); @@ -356,7 +356,7 @@ static picoModel_t *_terrain_load( PM_PARAMS_LOAD ) { /* keep the friggin compiler happy */ - *fileName = *fileName; + /**fileName = *fileName*/; /* create pico parser */ p = _pico_new_parser( (picoByte_t*) buffer, bufSize ); diff --git a/libs/splines/math_matrix.h b/libs/splines/math_matrix.h index 41216ee0..a6dabb89 100644 --- a/libs/splines/math_matrix.h +++ b/libs/splines/math_matrix.h @@ -84,7 +84,11 @@ ID_INLINE mat3_t::mat3_t() { } ID_INLINE mat3_t::mat3_t( float src[ 3 ][ 3 ] ) { - memcpy( mat, src, sizeof( src ) ); + for( unsigned int i = 0; i < 3; i++ ) { + mat[i].x = src[i][0]; + mat[i].y = src[i][1]; + mat[i].z = src[i][2]; + } } ID_INLINE mat3_t::mat3_t( idVec3 const &x, idVec3 const &y, idVec3 const &z ) { diff --git a/libs/splines/splines.vcproj b/libs/splines/splines.vcproj deleted file mode 100644 index 83cc0c3f..00000000 --- a/libs/splines/splines.vcproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/synapse/synapse.vcproj b/libs/synapse/synapse.vcproj deleted file mode 100644 index 95b4dbc2..00000000 --- a/libs/synapse/synapse.vcproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/eclassfgd/fgd.vcproj b/plugins/eclassfgd/fgd.vcproj deleted file mode 100644 index 9a42231c..00000000 --- a/plugins/eclassfgd/fgd.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/entity/entity.vcproj b/plugins/entity/entity.vcproj deleted file mode 100644 index da817127..00000000 --- a/plugins/entity/entity.vcproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/entity/entity_entitymodel.h b/plugins/entity/entity_entitymodel.h index 3a4aad31..7858402b 100644 --- a/plugins/entity/entity_entitymodel.h +++ b/plugins/entity/entity_entitymodel.h @@ -40,6 +40,7 @@ class CEntityMiscModel : public IRender, public ISelect, public IEdit // IRender void Draw( int state, int rflags ) const; + const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect @@ -105,6 +106,7 @@ class CEntityEclassModel : public IRender, public ISelect, public IEdit // IRender void Draw( int state, int rflags ) const; + const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect diff --git a/plugins/image/image.vcproj b/plugins/image/image.vcproj deleted file mode 100644 index f9cb3034..00000000 --- a/plugins/image/image.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagehl/imagehl.vcproj b/plugins/imagehl/imagehl.vcproj deleted file mode 100644 index 53079916..00000000 --- a/plugins/imagehl/imagehl.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagem8/imagem8.vcproj b/plugins/imagem8/imagem8.vcproj deleted file mode 100644 index bbba695d..00000000 --- a/plugins/imagem8/imagem8.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagepng/imagepng.vcproj b/plugins/imagepng/imagepng.vcproj deleted file mode 100644 index a2a83e3b..00000000 --- a/plugins/imagepng/imagepng.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagewal/imagewal.vcproj b/plugins/imagewal/imagewal.vcproj deleted file mode 100644 index 7cd92f5b..00000000 --- a/plugins/imagewal/imagewal.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/map/map.vcproj b/plugins/map/map.vcproj deleted file mode 100644 index c93a5d2d..00000000 --- a/plugins/map/map.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/mapxml/mapxml.vcproj b/plugins/mapxml/mapxml.vcproj deleted file mode 100644 index 978f16cb..00000000 --- a/plugins/mapxml/mapxml.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/model/cpicomodel.h b/plugins/model/cpicomodel.h index a5556f24..6432eb9d 100644 --- a/plugins/model/cpicomodel.h +++ b/plugins/model/cpicomodel.h @@ -66,6 +66,7 @@ void Reload( void ); void Draw( int state, vector shaders, int rflags ) const; //IRender virtual void Draw( int state, int rflags ) const; +virtual const bool IsModelNotNull() const { return true; } virtual const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/plugins/model/model.vcproj b/plugins/model/model.vcproj deleted file mode 100644 index 8ed2f449..00000000 --- a/plugins/model/model.vcproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/model/remap.cpp b/plugins/model/remap.cpp index 5e313222..69683eae 100644 --- a/plugins/model/remap.cpp +++ b/plugins/model/remap.cpp @@ -141,6 +141,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, m_shaders, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } @@ -300,6 +303,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } diff --git a/plugins/shaders/shaders.vcproj b/plugins/shaders/shaders.vcproj deleted file mode 100644 index 7b55902d..00000000 --- a/plugins/shaders/shaders.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/spritemodel/spritemodel.h b/plugins/spritemodel/spritemodel.h index d9be5152..34015df5 100644 --- a/plugins/spritemodel/spritemodel.h +++ b/plugins/spritemodel/spritemodel.h @@ -45,6 +45,7 @@ void DecRef() { //IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return true; } const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/plugins/spritemodel/spritemodel.vcproj b/plugins/spritemodel/spritemodel.vcproj deleted file mode 100644 index 1e18ddf3..00000000 --- a/plugins/spritemodel/spritemodel.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface/surface.vcproj b/plugins/surface/surface.vcproj deleted file mode 100644 index 9b775485..00000000 --- a/plugins/surface/surface.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface_idtech2/surface_idtech2.vcproj b/plugins/surface_idtech2/surface_idtech2.vcproj deleted file mode 100644 index f5d9e256..00000000 --- a/plugins/surface_idtech2/surface_idtech2.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/textool/textool.vcproj b/plugins/textool/textool.vcproj deleted file mode 100644 index 0c769bce..00000000 --- a/plugins/textool/textool.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfspak/vfspak.vcproj b/plugins/vfspak/vfspak.vcproj deleted file mode 100644 index 51bc322b..00000000 --- a/plugins/vfspak/vfspak.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfspk3/vfspk3.vcproj b/plugins/vfspk3/vfspk3.vcproj deleted file mode 100644 index d8ccc438..00000000 --- a/plugins/vfspk3/vfspk3.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfsqlpk3/vfsqlpk3.vcproj b/plugins/vfsqlpk3/vfsqlpk3.vcproj deleted file mode 100644 index 152b6fed..00000000 --- a/plugins/vfsqlpk3/vfsqlpk3.vcproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfswad/vfswad.vcproj b/plugins/vfswad/vfswad.vcproj deleted file mode 100644 index e10730c6..00000000 --- a/plugins/vfswad/vfswad.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 2d07acad..9ce1220a 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -26,7 +26,6 @@ #include "filters.h" extern MainFrame* g_pParentWnd; -extern void MemFile_fprintf( MemStream* pMemFile, const char* pText, ... ); // globals @@ -130,7 +129,6 @@ float lightaxis[3] = {0.6f, 0.8f, 1.0f}; improve recognition ================ */ -extern float ShadeForNormal( vec3_t normal ); float SetShadeForPlane( plane_t *p ){ //return ShadeForNormal(p->normal); @@ -2223,7 +2221,8 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag if ( b->owner->eclass->fixedsize && b->owner->model.pSelect && !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) ) - && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX ) { + && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX + && b->owner->model.pRender->IsModelNotNull() ) { ray_t ray_local; vec_t dist_local = FLT_MAX; ray_construct_for_vec3( &ray_local, origin, dir ); @@ -2260,8 +2259,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag for ( i = 0 ; i < 3 ; i++ ) p1[i] = p1[i] + frac * ( p2[i] - p1[i] ); } - else - { + else { for ( i = 0 ; i < 3 ; i++ ) p2[i] = p1[i] + frac * ( p2[i] - p1[i] ); } @@ -2292,7 +2290,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag // see Brush_Draw // do some last minute filtering - if ( firstface && nFlags & SF_CAMERA ) { + if ( firstface && ( nFlags & SF_CAMERA ) ) { if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK ) { if ( strstr( firstface->texdef.GetName(), "caulk" ) ) { *dist = 0; @@ -2641,8 +2639,9 @@ void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ){ // leave it alone // if ( i != w->numpoints ) { - if ( i == 0 ) { // see if the first clockwise point was the - // last point on the winding + // see if the first clockwise point was the + // last point on the winding + if ( i == 0 ) { d = DotProduct( w->points[w->numpoints - 1] , f->plane.normal ) - f->plane.dist; if ( d > -ON_EPSILON && d < ON_EPSILON ) { @@ -3060,7 +3059,7 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ if ( w == NULL ) { return; } - if ( nGLState & DRAW_GL_LIGHTING && g_PrefsDlg.m_bGLLighting ) { + if ( ( nGLState & DRAW_GL_LIGHTING ) && g_PrefsDlg.m_bGLLighting ) { qglNormal3fv( face->plane.normal ); } /* @@ -3137,7 +3136,7 @@ void Brush_Draw( brush_t *b ){ if ( bTrans && !( nGLState & DRAW_GL_BLEND ) ) { continue; } - if ( !bTrans && nGLState & DRAW_GL_BLEND ) { + if ( !bTrans && ( nGLState & DRAW_GL_BLEND ) ) { continue; } @@ -3163,17 +3162,17 @@ void Brush_Draw( brush_t *b ){ } } - if ( nGLState & DRAW_GL_TEXTURE_2D && face->d_texture->name[0] == '(' ) { + if ( ( nGLState & DRAW_GL_TEXTURE_2D ) && face->d_texture->name[0] == '(' ) { prev = NULL; qglDisable( GL_TEXTURE_2D ); } - else if ( nGLState & DRAW_GL_TEXTURE_2D && ( nDrawMode == cd_texture || nDrawMode == cd_light ) && face->d_texture != prev ) { + else if ( ( nGLState & DRAW_GL_TEXTURE_2D ) && ( nDrawMode == cd_texture || nDrawMode == cd_light ) && face->d_texture != prev ) { // set the texture for this face prev = face->d_texture; qglBindTexture( GL_TEXTURE_2D, face->d_texture->texture_number ); } - if ( nGLState & DRAW_GL_LIGHTING && !g_PrefsDlg.m_bGLLighting ) { + if ( ( nGLState & DRAW_GL_LIGHTING ) && !g_PrefsDlg.m_bGLLighting ) { if ( !b->owner->eclass->fixedsize ) { material[3] = transVal; } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 87df69c1..5419913f 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -922,12 +922,24 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) { qglColor4fv( material ); } - else{ qglColor4fv( identity ); } + else { + qglColor4fv( identity ); + } + if ( nGLState & DRAW_GL_LIGHTING ) { qglShadeModel( GL_SMOOTH ); } - b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); + // Check model validity + // If the model is NULL or invalid, draw a box instead + bool isModelValid = b->owner->model.pRender->IsModelNotNull(); + if ( isModelValid ) { + b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); + } + else { + qglColor4fv( material ); + aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); + } } break; case DRAW_WIRE: @@ -949,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 4fb3b198..211f2da4 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -7172,6 +7172,7 @@ void MainFrame::OnGridPrev(){ case 64: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_64" ) ); break; case 128: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_128" ) ); break; case 256: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_256" ) ); break; + default: return; } } diff --git a/radiant/radiant.vcproj b/radiant/radiant.vcproj deleted file mode 100644 index 81af2a28..00000000 --- a/radiant/radiant.vcproj +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/radiant/select.cpp b/radiant/select.cpp index b0584136..768a717c 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index ec20e357..87275870 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -50,7 +50,6 @@ #include "texmanip.h" #define TYP_MIPTEX 68 -static unsigned tex_palette[256]; #define FONT_HEIGHT 10 @@ -180,14 +179,6 @@ void Texture_InitPalette( byte *pal ){ g = gammatable[pal[1]]; b = gammatable[pal[2]]; pal += 3; - - //v = (r<<24) + (g<<16) + (b<<8) + 255; - //v = BigLong (v); - - //tex_palette[i] = v; - tex_palette[i * 3 + 0] = r; - tex_palette[i * 3 + 1] = g; - tex_palette[i * 3 + 2] = b; } } @@ -780,7 +771,11 @@ void Texture_ShowDirectory(){ g_str_has_suffix( name, "_h" ) || g_str_has_suffix( name, "_local" ) || g_str_has_suffix( name, "_nm" ) || - g_str_has_suffix( name, "_s" )) { + g_str_has_suffix( name, "_s" ) || + g_str_has_suffix( name, "_bump" ) || + g_str_has_suffix( name, "_gloss" ) || + g_str_has_suffix( name, "_luma" ) || + g_str_has_suffix( name, "_norm" ) ) { continue; } diff --git a/tools/quake2/extra/bsp/qbsp3/map.c b/tools/quake2/extra/bsp/qbsp3/map.c index 232979c7..2af52057 100644 --- a/tools/quake2/extra/bsp/qbsp3/map.c +++ b/tools/quake2/extra/bsp/qbsp3/map.c @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "qbsp.h" -extern qboolean onlyents; - int nummapbrushes; mapbrush_t mapbrushes[MAX_MAP_BRUSHES]; diff --git a/tools/quake3/common/quake3-common.vcproj b/tools/quake3/common/quake3-common.vcproj deleted file mode 100644 index f6179cef..00000000 --- a/tools/quake3/common/quake3-common.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/quake3/q3data/q3data.vcproj b/tools/quake3/q3data/q3data.vcproj deleted file mode 100644 index f09923a2..00000000 --- a/tools/quake3/q3data/q3data.vcproj +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/quake3/q3map2/q3map2.vcproj b/tools/quake3/q3map2/q3map2.vcproj deleted file mode 100644 index b71a4459..00000000 --- a/tools/quake3/q3map2/q3map2.vcproj +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj b/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj deleted file mode 100644 index 3cdd42cf..00000000 --- a/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj +++ /dev/null @@ -1,1155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/utils.py b/utils.py index ca70ceb9..9521672c 100644 --- a/utils.py +++ b/utils.py @@ -5,7 +5,7 @@ import os, commands, platform, xml.sax, re, string, platform -class vcproj( xml.sax.handler.ContentHandler ): +class vcxproj( xml.sax.handler.ContentHandler ): def __init__( self, filepath ): self.source_files = [] self.misc_files = [] @@ -29,8 +29,9 @@ class vcproj( xml.sax.handler.ContentHandler ): return ( match, nomatch ) def startElement( self, name, attrs ): - if ( name == 'File' ): - self._files.append( attrs.getValue('RelativePath') ) + if ( name == 'ClCompile' ): + if ( attrs.has_key('Include') ): + self._files.append( attrs.getValue('Include') ) def endDocument( self ): # split into source and headers, remap path seperator to the platform From d25fc9b847ddb17fbe25f8fd52bc8c29cd887853 Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 23:27:33 +0200 Subject: [PATCH 09/20] Rollback again. --- radiant/camwindow.cpp | 4 ++-- radiant/select.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 6cf28584..5419913f 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index b0584136..768a717c 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ From 6ba4b02cbc9f9aff03c778481b7995c544c5edce Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 23:38:07 +0200 Subject: [PATCH 10/20] Enough. --- radiant/camwindow.cpp | 4 ++-- radiant/select.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 5419913f..6cf28584 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index 768a717c..b0584136 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ From c1f482b034bf079886472fca37623eec681405c5 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 8 May 2017 00:01:49 +0200 Subject: [PATCH 11/20] Adjusting the layout of the "Configure games" dialog --- radiant/preferences.cpp | 86 +++++++++++++++++++++++++++-------------- radiant/preferences.h | 1 - 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index dc78d258..c5c100d2 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -3376,37 +3376,49 @@ void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) { g_free( str ); i->UpdateData( FALSE ); + GtkWidget *label = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_label" ) ); + GtkWidget *entry = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_entry" ) ); + GtkWidget *button = GTK_WIDGET( g_object_get_data( G_OBJECT( i->m_pWidget ), "executable_button" ) ); + int game_id = i->m_availGames[ i->m_nComboSelect ]; if ( game_id == GAME_Q2 || game_id == GAME_QUETOO ) { - gtk_widget_show( i->m_executablesVBox ); + gtk_widget_show( label ); + gtk_widget_show( entry ); + gtk_widget_show( button ); } else { - gtk_widget_hide( i->m_executablesVBox ); + gtk_widget_hide( label ); + gtk_widget_hide( entry ); + gtk_widget_hide( button ); } } void CGameInstall::BuildDialog() { - GtkWidget *dlg, *vbox1, *frame, *vbox2, *button, *text, *game_select_combo, *entry, *hbox; + GtkWidget *dlg, *vbox1, *frame, *table, *button, *text, *game_select_combo, *entry, *hbox; dlg = m_pWidget; gtk_window_set_title( GTK_WINDOW( dlg ), _( "Configure games" ) ); vbox1 = gtk_vbox_new( FALSE, 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); + gtk_widget_show( vbox1 ); frame = gtk_frame_new( _( "Configure a game" ) ); + gtk_box_pack_start( GTK_BOX( vbox1 ), frame, TRUE, TRUE, 0 ); gtk_widget_show( frame ); - gtk_container_add( GTK_CONTAINER( vbox1 ), frame ); - vbox2 = gtk_vbox_new( FALSE, 5); - gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); - gtk_widget_show( vbox2 ); - gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); + table = gtk_table_new( 5, 2, FALSE ); + gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); + gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_container_add( GTK_CONTAINER( frame ), table ); + gtk_widget_show( table ); game_select_combo = gtk_combo_box_text_new(); + gtk_table_attach( GTK_TABLE( table ), game_select_combo, 1, 2, 0, 1, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( game_select_combo ); - gtk_box_pack_start( GTK_BOX( vbox2 ), game_select_combo, FALSE, FALSE, 0 ); int iGame = 0; while ( m_availGames[ iGame ] != GAME_NONE ) { @@ -3463,67 +3475,83 @@ void CGameInstall::BuildDialog() { g_signal_connect( G_OBJECT( game_select_combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this ); text = gtk_label_new( _( "Name:" ) ); + gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 ); + gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 1, 2, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( text ); - gtk_box_pack_start( GTK_BOX( vbox2 ), text, FALSE, FALSE, 0 ); entry = gtk_entry_new(); + gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( entry ); - gtk_box_pack_start( GTK_BOX( vbox2 ), entry, FALSE, FALSE, 0 ); AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); text = gtk_label_new( _( "Game directory:" ) ); + gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 ); + gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 2, 3, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( text ); - gtk_box_pack_start( GTK_BOX( vbox2 ), text, FALSE, FALSE, 0 ); hbox = gtk_hbox_new( FALSE, 5 ); + gtk_table_attach( GTK_TABLE( table ), hbox, 1, 2, 2, 3, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, FALSE, FALSE, 0 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT ); button = gtk_button_new_with_label( _( "..." ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseEngine ), this ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - - m_executablesVBox = gtk_vbox_new( TRUE, 0 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), m_executablesVBox, FALSE, FALSE, 0 ); - gtk_widget_show( m_executablesVBox ); + gtk_widget_show( button ); text = gtk_label_new( _( "Engine binaries directory:" ) ); + gtk_misc_set_alignment( GTK_MISC( text ), 0.0, 0.5 ); + gtk_table_attach( GTK_TABLE( table ), text, 0, 1, 3, 4, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( text ); - gtk_box_pack_start( GTK_BOX( m_executablesVBox ), text, FALSE, FALSE, 0 ); + g_object_set_data( G_OBJECT( dlg ), "executable_label", text ); hbox = gtk_hbox_new( FALSE, 5 ); + gtk_table_attach( GTK_TABLE( table ), hbox, 1, 2, 3, 4, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( m_executablesVBox ), hbox, FALSE, FALSE, 0 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_strExecutables, DLG_ENTRY_TEXT ); + g_object_set_data( G_OBJECT( dlg ), "executable_entry", entry ); button = gtk_button_new_with_label( _( "..." ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseExecutables ), this ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); + g_object_set_data( G_OBJECT( dlg ), "executable_button", button ); + + hbox = gtk_hbox_new( FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 ); + gtk_widget_show( hbox ); button = gtk_button_new_with_label( _( "OK" ) ); + gtk_box_pack_start( GTK_BOX( hbox ), button, TRUE, TRUE, 0 ); gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 ); AddModalButton( button, IDOK ); button = gtk_button_new_with_label( _( "Cancel" ) ); + gtk_box_pack_start( GTK_BOX( hbox ), button, TRUE, TRUE, 0 ); gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox1 ), button, TRUE, TRUE, 0 ); AddModalButton( button, IDCANCEL ); - gtk_widget_set_size_request( dlg, 320, -1 ); - - // triggers the callback - sets the game name, shows/hide extra settings depending on project + // triggers the callback - sets the game name, shows/hide extra settings depending on project gtk_combo_box_set_active( GTK_COMBO_BOX( game_select_combo ), 0 ); } diff --git a/radiant/preferences.h b/radiant/preferences.h index 4bc1f831..4086685c 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -275,7 +275,6 @@ protected: // maps from m_nComboSelect to the games int m_availGames[GAME_COUNT]; - GtkWidget * m_executablesVBox; }; /*! From 3d9d86a48cdd82261b222aa28302959c4884c7d1 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 8 May 2017 00:40:46 +0200 Subject: [PATCH 12/20] GtkPaned for the Entity View Dialog --- radiant/gtkdlgs.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 19935be5..6ebf1bf1 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -1240,7 +1240,7 @@ static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer } void DoEntityList(){ static GtkWidget *dialog; - GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area; + GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area, *paned; GtkWidget *notebook, *label, *textview, *keyvalue_scr, *desc_scr; gint keyvalue_index; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; @@ -1258,13 +1258,12 @@ void DoEntityList(){ content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - hbox = gtk_hbox_new( TRUE, 5 ); - gtk_container_add( GTK_CONTAINER( content_area ), hbox ); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); - gtk_widget_show( hbox ); + paned = gtk_hpaned_new(); + gtk_box_pack_start( GTK_BOX( content_area ), paned, TRUE, TRUE, 0 ); + gtk_widget_show( paned ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 ); + gtk_paned_pack1( GTK_PANED( paned ), scr, FALSE, TRUE ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); gtk_widget_show( scr ); @@ -1350,7 +1349,7 @@ void DoEntityList(){ } vbox = gtk_vbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + gtk_paned_pack2( GTK_PANED( paned ), vbox, FALSE, TRUE ); gtk_widget_show( vbox ); notebook = gtk_notebook_new(); From 31c24a875f83d460f6d5a6611be4b253701da8c5 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Wed, 10 May 2017 23:26:29 +0200 Subject: [PATCH 13/20] Make menus more consistent with ellipses --- contrib/bkgrnd2d/plugin.cpp | 2 +- contrib/bobtoolz/bobToolz-GTK.cpp | 4 ++-- contrib/camera/camera.cpp | 4 ++-- contrib/gtkgensurf/plugin.cpp | 6 +++--- contrib/hydratoolz/plugin.cpp | 4 ++-- contrib/prtview/prtview.cpp | 2 +- plugins/spritemodel/plugin.cpp | 4 ++-- plugins/textool/TexTool.cpp | 6 +++--- radiant/mainframe.cpp | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/contrib/bkgrnd2d/plugin.cpp b/contrib/bkgrnd2d/plugin.cpp index 85223734..f032e4dc 100644 --- a/contrib/bkgrnd2d/plugin.cpp +++ b/contrib/bkgrnd2d/plugin.cpp @@ -55,7 +55,7 @@ #define CMD_SEP "-" #define CMD_CONFIG "Configure..." -#define CMD_ABOUT "About..." +#define CMD_ABOUT "About" // ============================================================================= // Globals diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index 96975429..ccc8e3e8 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -39,7 +39,7 @@ _QEREntityTable g_EntityTable; const char* PLUGIN_NAME = "bobToolz"; // commands in the menu -static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge"; +static const char* PLUGIN_COMMANDS = "About,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge"; // globals GtkWidget *g_pRadiantWnd = NULL; @@ -103,7 +103,7 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool else if ( !stricmp( p, "vis viewer" ) ) { DoVisAnalyse(); } - else if ( !stricmp( p, "about..." ) ) { + else if ( !stricmp( p, "About" ) ) { DoMessageBox( PLUGIN_ABOUT, "About", MB_OK ); } } diff --git a/contrib/camera/camera.cpp b/contrib/camera/camera.cpp index 9c133941..ca787ea3 100644 --- a/contrib/camera/camera.cpp +++ b/contrib/camera/camera.cpp @@ -36,7 +36,7 @@ CListener *Listener = NULL; static const char *PLUGIN_NAME = "Camera"; // commands in the menu -static const char *PLUGIN_COMMANDS = "About...,-,Load Camera...,-,Preview Camera,-,Camera Inspector...,-,New Spline Camera,New Interpolated Camera,New Fixed Camera"; +static const char *PLUGIN_COMMANDS = "About,-,Load Camera...,-,Preview Camera,-,Camera Inspector...,-,New Spline Camera...,New Interpolated Camera...,New Fixed Camera..."; // globals GtkWidget *g_pRadiantWnd = NULL; @@ -116,7 +116,7 @@ void QERPlug_Dispatch( const char* p, float* vMin, float* vMax, bool bSingleBrus else if ( !strcmp( p, "Load Camera..." ) ) { DoLoadCamera(); } - else if ( !strcmp( p, "About..." ) ) { + else if ( !strcmp( p, "About" ) ) { g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, PLUGIN_ABOUT, "About", MB_OK, NULL ); } } diff --git a/contrib/gtkgensurf/plugin.cpp b/contrib/gtkgensurf/plugin.cpp index 2ec3d469..9b739a99 100644 --- a/contrib/gtkgensurf/plugin.cpp +++ b/contrib/gtkgensurf/plugin.cpp @@ -40,8 +40,8 @@ const char* QERPlug_GetName(){ } const char* QERPlug_GetCommandList(){ - return "Wall facing 270...;Wall facing 180...;Wall facing 90...;Wall facing 0...;" - "Ceiling...;Ground surface...;-;About..."; + return "About;-;Wall facing 270...;Wall facing 180...;Wall facing 90...;Wall facing 0...;" + "Ceiling...;Ground surface..."; } // vMin/vMax provide the bounds of the selection, they are zero if there is no selection @@ -129,7 +129,7 @@ void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrus } Generate = true; } - else if ( !strcmp( p,"About..." ) ) { + else if ( !strcmp( p,"About" ) ) { About( g_pRadiantWnd ); } diff --git a/contrib/hydratoolz/plugin.cpp b/contrib/hydratoolz/plugin.cpp index b04e4022..4fe46b33 100644 --- a/contrib/hydratoolz/plugin.cpp +++ b/contrib/hydratoolz/plugin.cpp @@ -334,7 +334,7 @@ void UpdateWadKeyPair( void ){ const char *PLUGIN_NAME = "HydraToolz"; // commands in the menu -const char *PLUGIN_COMMANDS = "About...;Create/Update WAD keypair"; +const char *PLUGIN_COMMANDS = "About;-;Create/Update WAD keypair"; const char *PLUGIN_ABOUT = "HydraToolz v1.0 for GTKRadiant\n\n" "By Hydra!"; @@ -362,7 +362,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool if ( !strcmp( p, "Create/Update WAD keypair" ) ) { UpdateWadKeyPair(); } - else if ( !strcmp( p, "About..." ) ) { + else if ( !strcmp( p, "About" ) ) { g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL ); } } diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index b36a8b13..97c69e62 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -25,7 +25,7 @@ #include #define Q3R_CMD_SPLITTER "-" -#define Q3R_CMD_ABOUT "About Portal Viewer..." +#define Q3R_CMD_ABOUT "About" #define Q3R_CMD_LOAD "Load .prt file" #define Q3R_CMD_RELEASE "Unload .prt file" #define Q3R_CMD_SHOW_3D "Toggle portals (3D)" diff --git a/plugins/spritemodel/plugin.cpp b/plugins/spritemodel/plugin.cpp index 9c06a8ab..f2072527 100644 --- a/plugins/spritemodel/plugin.cpp +++ b/plugins/spritemodel/plugin.cpp @@ -148,7 +148,7 @@ _QERShadersTable g_ShadersTable; static const char *PLUGIN_NAME = "Sprite Model loading module"; -static const char *PLUGIN_COMMANDS = "About..."; +static const char *PLUGIN_COMMANDS = "About"; static const char *PLUGIN_ABOUT = "Sprite Model loading module v0.2 for GTKRadiant\n\n" "By Hydra!"; @@ -200,7 +200,7 @@ extern "C" const char* QERPlug_GetCommandList(){ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){ // NOTE: this never happens in a module - if ( !strcmp( p, "About..." ) ) { + if ( !strcmp( p, "About" ) ) { g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL ); } } diff --git a/plugins/textool/TexTool.cpp b/plugins/textool/TexTool.cpp index 32b2b26d..55c6a443 100644 --- a/plugins/textool/TexTool.cpp +++ b/plugins/textool/TexTool.cpp @@ -37,7 +37,7 @@ _QERFuncTable_1 g_FuncTable; const char *PLUGIN_NAME = "Q3 Texture Tools"; // commands in the menu -const char *PLUGIN_COMMANDS = "About...;Go..."; +const char *PLUGIN_COMMANDS = "About;-;Go..."; // cast to GtkWidget* void *g_pMainWnd; @@ -775,8 +775,8 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool } #endif - if ( !strcmp( p, "About..." ) ) { - DoMessageBox( PLUGIN_ABOUT, "About ...", MB_OK ); + if ( !strcmp( p, "About" ) ) { + DoMessageBox( PLUGIN_ABOUT, "About", MB_OK ); } else if ( !strcmp( p, "Go..." ) ) { if ( !g_pToolWnd ) { diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 4a1da7be..c8fa722e 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1541,7 +1541,7 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){ item = create_menu_item_with_mnemonic( menu, _( "Simple Patch Mesh..." ), G_CALLBACK( HandleCommand ), ID_CURVE_SIMPLEPATCHMESH ); g_object_set_data( G_OBJECT( window ), "menu_simplepatchmesh", item ); - create_menu_item_with_mnemonic( menu, _( "Patch Inspector" ), G_CALLBACK( HandleCommand ), ID_PATCH_INSPECTOR ); + create_menu_item_with_mnemonic( menu, _( "Patch Inspector..." ), G_CALLBACK( HandleCommand ), ID_PATCH_INSPECTOR ); menu_separator( menu ); menu_in_menu = create_menu_in_menu_with_mnemonic( menu, _( "Insert" ) ); create_menu_item_with_mnemonic( menu_in_menu, _( "Insert (2) Columns" ), From c54979002522fd31d8148692f7544b6bb80779ed Mon Sep 17 00:00:00 2001 From: Pan7 Date: Thu, 11 May 2017 03:46:07 +0200 Subject: [PATCH 14/20] Make hollow touch icon --- install/bitmaps/selection_makehollowtouch.png | Bin 0 -> 161 bytes radiant/mainframe.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 install/bitmaps/selection_makehollowtouch.png diff --git a/install/bitmaps/selection_makehollowtouch.png b/install/bitmaps/selection_makehollowtouch.png new file mode 100644 index 0000000000000000000000000000000000000000..8b6de06e0b0ed33b77a902d858c8c4ca2f753b05 GIT binary patch literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~q#0(@S$S&Ulq&Ne7LR>o-7|xtI^Z);U4VLG6 zAi)BU$YKTtzQZ8Qcszea3Q&-}#M9T6{UIwiqc%^0=Ei2AkhZ6bV+hCf Date: Sun, 14 May 2017 05:18:36 +0200 Subject: [PATCH 15/20] Numeric text fields for bobtoolz --- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 99 +++++++++++------------- 1 file changed, 45 insertions(+), 54 deletions(-) diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 2039f41b..2847bc38 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -33,13 +33,13 @@ typedef struct { GtkWidget *editTexOld, *editTexNew; GtkWidget *cbScaleHor, *cbScaleVert; - GtkWidget *editScaleHor, *editScaleVert; + GtkWidget *spinScaleHor, *spinScaleVert; GtkWidget *cbShiftHor, *cbShiftVert; - GtkWidget *editShiftHor, *editShiftVert; + GtkWidget *spinShiftHor, *spinShiftVert; GtkWidget *cbRotation; - GtkWidget *editRotation; + GtkWidget *spinRotation; }dlg_texReset_t; dlg_texReset_t dlgTexReset; @@ -60,19 +60,19 @@ void Update_TextureReseter(){ gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexOld ), check ); check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) ); - gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleHor ), check ); + gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinScaleHor ), check ); check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) ); - gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleVert ), check ); + gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinScaleVert ), check ); check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) ); - gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftHor ), check ); + gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinShiftHor ), check ); check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) ); - gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftVert ), check ); + gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinShiftVert ), check ); check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) ); - gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editRotation ), check ); + gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.spinRotation ), check ); } static void dialog_button_callback( GtkWidget *widget, gpointer data ){ @@ -1320,7 +1320,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_widget_show( frame ); - table = gtk_table_new( 2, 3, TRUE ); + table = gtk_table_new( 2, 3, FALSE ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); @@ -1348,7 +1348,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editTexOld ), 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( dlgTexReset.editTexOld ); @@ -1363,7 +1363,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editTexNew ), 256 ); gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( dlgTexReset.editTexNew ); @@ -1373,7 +1373,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_widget_show( frame ); - table = gtk_table_new( 2, 3, TRUE ); + table = gtk_table_new( 2, 3, FALSE ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); @@ -1397,13 +1397,14 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 ); gtk_widget_show( w ); - dlgTexReset.editScaleHor = gtk_entry_new(); - gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editScaleHor ), 256 ); - gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1, + + dlgTexReset.spinScaleHor = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0.5, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinScaleHor ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinScaleHor ), 1.0 ); //right align numbers + gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinScaleHor, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( dlgTexReset.editScaleHor ); + gtk_widget_show( dlgTexReset.spinScaleHor ); dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( _( "Enabled" ) ); @@ -1420,13 +1421,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 ); gtk_widget_show( w ); - dlgTexReset.editScaleVert = gtk_entry_new(); - gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editScaleVert ), 256 ); - gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2, + dlgTexReset.spinScaleVert = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0.5, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinScaleVert ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinScaleVert ), 1.0 ); //right align numbers + gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinScaleVert, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( dlgTexReset.editScaleVert ); + gtk_widget_show( dlgTexReset.spinScaleVert ); // ---- /frame ---- @@ -1434,7 +1435,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_widget_show( frame ); - table = gtk_table_new( 2, 3, TRUE ); + table = gtk_table_new( 2, 3, FALSE ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); @@ -1458,13 +1459,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 ); gtk_widget_show( w ); - dlgTexReset.editShiftHor = gtk_entry_new(); - gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editShiftHor ), 256 ); - gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1, + dlgTexReset.spinShiftHor = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinShiftHor ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinShiftHor ), 1.0 ); //right align numbers + gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinShiftHor, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( dlgTexReset.editShiftHor ); + gtk_widget_show( dlgTexReset.spinShiftHor ); dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( _( "Enabled" ) ); @@ -1481,13 +1482,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 ); gtk_widget_show( w ); - dlgTexReset.editShiftVert = gtk_entry_new(); - gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editShiftVert ), 256 ); - gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2, + dlgTexReset.spinShiftVert = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 65535, 0.1, 1, 0 ) ), 0.1, 1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinShiftVert ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinShiftVert ), 1.0 ); //right align numbers + gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinShiftVert, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( dlgTexReset.editShiftVert ); + gtk_widget_show( dlgTexReset.spinShiftVert ); // ---- /frame ---- @@ -1495,7 +1496,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_widget_show( frame ); - table = gtk_table_new( 1, 3, TRUE ); + table = gtk_table_new( 1, 3, FALSE ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); @@ -1517,13 +1518,13 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 ); gtk_widget_show( w ); - dlgTexReset.editRotation = gtk_entry_new(); - gtk_entry_set_max_length( GTK_ENTRY( dlgTexReset.editRotation ), 256 ); - gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" ); - gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1, + dlgTexReset.spinRotation = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 90, 0 ) ), 1, 1 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( dlgTexReset.spinRotation ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( dlgTexReset.spinRotation ), 1.0 ); //right align numbers + gtk_table_attach( GTK_TABLE( table ), dlgTexReset.spinRotation, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_show( dlgTexReset.editRotation ); + gtk_widget_show( dlgTexReset.spinRotation ); // ---- /frame ---- @@ -1553,37 +1554,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){ if ( response_id != GTK_RESPONSE_CANCEL ) { rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) ); if ( rs->bResetRotation ) { - if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), _( "Rotation" ), &rs->rotation ) ) { - dialogError = TRUE; - } + rs->rotation = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinRotation ) ); } rs->bResetScale[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) ); if ( rs->bResetScale[0] ) { - if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleHor ) ), _( "Horizontal Scale" ), &rs->fScale[0] ) ) { - dialogError = TRUE; - } + rs->fScale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinScaleHor ) ); } rs->bResetScale[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) ); if ( rs->bResetScale[1] ) { - if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleVert ) ), _( "Vertical Scale" ), &rs->fScale[1] ) ) { - dialogError = TRUE; - } + rs->fScale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinScaleVert ) ); } rs->bResetShift[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) ); if ( rs->bResetShift[0] ) { - if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftHor ) ), _( "Horizontal Shift" ), &rs->fShift[0] ) ) { - dialogError = TRUE; - } + rs->fShift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinShiftHor ) ); } rs->bResetShift[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) ); if ( rs->bResetShift[1] ) { - if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftVert ) ), _( "Vertical Shift" ), &rs->fShift[1] ) ) { - dialogError = TRUE; - } + rs->fShift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( dlgTexReset.spinShiftVert ) ); } rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) ); From 2e119b583dd9c74eb8a10c889662944e64faa1b8 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 16 May 2017 00:34:04 +0200 Subject: [PATCH 16/20] Extra gtk_box_set_homogeneous function calls --- contrib/bkgrnd2d/dialog.cpp | 3 ++- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 3 ++- contrib/gtkgensurf/gendlgs.cpp | 12 ++++++++---- contrib/gtkgensurf/view.cpp | 3 ++- contrib/prtview/AboutDialog.cpp | 2 +- contrib/prtview/ConfigDialog.cpp | 3 ++- contrib/prtview/gtkdlgs.cpp | 3 ++- radiant/gtkdlgs.cpp | 6 ++++-- radiant/patchdialog.cpp | 3 ++- 9 files changed, 25 insertions(+), 13 deletions(-) diff --git a/contrib/bkgrnd2d/dialog.cpp b/contrib/bkgrnd2d/dialog.cpp index 41e54c89..2aa53e7c 100644 --- a/contrib/bkgrnd2d/dialog.cpp +++ b/contrib/bkgrnd2d/dialog.cpp @@ -342,7 +342,8 @@ void InitBackgroundDialog(){ pPage = new CBackgroundDialogPage( YZ ); pPage->Append( pNotebook ); - vbox = gtk_hbox_new( TRUE, 5 ); + vbox = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 2847bc38..155d1030 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -1287,7 +1287,8 @@ int DoResetTextureBox( ResetTextureRS* rs ){ content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index 25da1f13..fd791774 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1392,7 +1392,8 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_show( frame ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); @@ -1413,7 +1414,8 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_show( frame ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); @@ -1434,7 +1436,8 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_widget_show( frame ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); @@ -1837,7 +1840,8 @@ GtkWidget* create_main_dialog(){ g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( bitmap_file_entryfocusout ), NULL ); - hbox2 = gtk_hbox_new( TRUE, 5 ); + hbox2 = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox2 ), TRUE ); gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); diff --git a/contrib/gtkgensurf/view.cpp b/contrib/gtkgensurf/view.cpp index 3edf7388..23e50692 100644 --- a/contrib/gtkgensurf/view.cpp +++ b/contrib/gtkgensurf/view.cpp @@ -394,7 +394,8 @@ void CreateViewWindow(){ gtk_widget_show( vbox ); #ifndef ISOMETRIC - hbox = gtk_hbox_new( TRUE, 5 ); + hbox = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 ); gtk_widget_show( hbox ); diff --git a/contrib/prtview/AboutDialog.cpp b/contrib/prtview/AboutDialog.cpp index 881a9e8a..b30242e2 100644 --- a/contrib/prtview/AboutDialog.cpp +++ b/contrib/prtview/AboutDialog.cpp @@ -41,7 +41,7 @@ void DoAboutDlg( GtkWidget *parent ){ content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent) ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index fe3b707a..3b852cf5 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -420,7 +420,8 @@ void DoConfigDialog( GtkWidget *parent ){ gtk_widget_show( cliplabel ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel ); - hbox = gtk_hbox_new( TRUE, 5 ); + hbox = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); diff --git a/contrib/prtview/gtkdlgs.cpp b/contrib/prtview/gtkdlgs.cpp index 9e79ee48..ab94085c 100644 --- a/contrib/prtview/gtkdlgs.cpp +++ b/contrib/prtview/gtkdlgs.cpp @@ -613,7 +613,8 @@ void DoConfigDialog(){ gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel ); - hbox = gtk_hbox_new( TRUE, 5 ); + hbox = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE ); gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 6ebf1bf1..b8ad7ddc 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -1586,7 +1586,8 @@ void DoGamma(){ content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - vbox = gtk_vbox_new( TRUE, 5 ); + vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( vbox ), TRUE ); gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); @@ -3536,7 +3537,8 @@ int DoLightIntensityDlg( int *intensity ){ gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 ); gtk_widget_show( label ); - hbox = gtk_hbox_new( TRUE, 5 ); + hbox = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox ), TRUE ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); gtk_widget_show( hbox ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index e10b3ae2..6be5b6f5 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -659,7 +659,8 @@ void PatchDialog::BuildDialog(){ gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right gtk_widget_show( spin ); - hbox2 = gtk_hbox_new( TRUE, 5 ); + hbox2 = gtk_hbox_new( FALSE, 5 ); + gtk_box_set_homogeneous( GTK_BOX( hbox2 ), TRUE ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 ); gtk_widget_show( hbox2 ); From 1f40723a78acab0f872b1474a628f1316d91fb4b Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 16 May 2017 12:25:41 +0200 Subject: [PATCH 17/20] Replace deprecated gtk_menu_append --- plugins/textool/2DView.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/textool/2DView.cpp b/plugins/textool/2DView.cpp index 243318d9..93341cb7 100644 --- a/plugins/textool/2DView.cpp +++ b/plugins/textool/2DView.cpp @@ -119,22 +119,22 @@ bool C2DView::OnRButtonUp( int x, int y ){ item = gtk_menu_item_new_with_label( _( "Validate (RETURN)" ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Textool_Validate ), NULL ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); item = gtk_menu_item_new_with_label( _( "Zoom in (INSERT)" ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( view_ZoomIn ), this ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); item = gtk_menu_item_new_with_label( _( "Zoom out (DELETE)" ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( view_ZoomOut ), this ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); item = gtk_menu_item_new_with_label( _( "Cancel (ESC)" ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Textool_Cancel ), NULL ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME ); } From 8df88a23d1b2b6bde69180f725c933abbb5624a4 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 20 May 2017 12:05:38 +0200 Subject: [PATCH 18/20] Use gtk_window_deiconify for Sys_Restore --- radiant/mainframe.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 95993ec0..09901ec7 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -3095,26 +3095,7 @@ static void Sys_Restore( GtkWidget *w ){ return; } -#if defined ( __linux__ ) || defined ( __APPLE__ ) - Sys_FPrintf( SYS_WRN, "FIXME: Sys_Restore\n" ); - #if 0 - XWindowAttributes xattr; - GdkWindowPrivate *Private; - - Private = (GdkWindowPrivate*)gtk_widget_get_window( w ); - - xattr.map_state = IsUnmapped; - XGetWindowAttributes( Private->xdisplay, Private->xwindow, &xattr ); - - if ( xattr.map_state == IsUnmapped ) { - XMapRaised( Private->xdisplay, Private->xwindow ); - } - #endif -#endif - -#ifdef _WIN32 - ShowWindow( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( w ) ), SW_RESTORE ); -#endif + gtk_window_deiconify( GTK_WINDOW( w ) ); } #ifdef _DEBUG From c757835111686756ee90fa8c0678e86e5d78530d Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 20 May 2017 13:09:51 +0200 Subject: [PATCH 19/20] Remove unused header gdkwin32.h --- radiant/mainframe.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 09901ec7..0134ceb2 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -27,9 +27,6 @@ #include "stdafx.h" #ifdef _WIN32 -extern "C" { -#include -} #endif #include #include From 3730351e8a4e5b691a3fb68d1a6be14a0915da8e Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sat, 20 May 2017 15:32:59 +0200 Subject: [PATCH 20/20] Remove obsolete gdk header --- radiant/texwindow.cpp | 5 ----- radiant/xywindow.cpp | 4 ---- 2 files changed, 9 deletions(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index f2f070df..5f05d213 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -32,12 +32,7 @@ - Make sure the interface is not dependent on gtk. */ -#ifdef _WIN32 -//#include -#include -#endif #if defined ( __linux__ ) || defined ( __APPLE__ ) -#include #include #endif #include diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index cc5d332b..371ca836 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -31,10 +31,6 @@ #include #include -#ifdef _WIN32 -#include -#endif - // ============================================================================= // variables