From ea39e6ac7a95838ee5d67f35ca8c0f2d23b274f0 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 1 May 2011 17:01:11 +0200 Subject: [PATCH 01/29] Changed: #1275 Create an OpenGL ES driver --- code/CMakeModules/ConfigureChecks.cmake | 4 ++++ code/CMakeModules/nel.cmake | 9 +++++++++ code/config.h.cmake | 1 + 3 files changed, 14 insertions(+) diff --git a/code/CMakeModules/ConfigureChecks.cmake b/code/CMakeModules/ConfigureChecks.cmake index 707b85c86..baf6e0e7c 100644 --- a/code/CMakeModules/ConfigureChecks.cmake +++ b/code/CMakeModules/ConfigureChecks.cmake @@ -47,6 +47,10 @@ MACRO(NL_CONFIGURE_CHECKS) IF(WITH_DRIVER_OPENGL) SET(NL_OPENGL_AVAILABLE 1) ENDIF(WITH_DRIVER_OPENGL) + + IF(WITH_DRIVER_OPENGLES) + SET(NL_OPENGLES_AVAILABLE 1) + ENDIF(WITH_DRIVER_OPENGLES) IF(WITH_DRIVER_DIRECT3D) SET(NL_DIRECT3D_AVAILABLE 1) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index dc6b477d0..cf6154648 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -93,6 +93,14 @@ MACRO(NL_ADD_STATIC_VID_DRIVERS name) TARGET_LINK_LIBRARIES(${name} nel_drv_opengl) ENDIF(WIN32) ENDIF(WITH_DRIVER_OPENGL) + + IF(WITH_DRIVER_OPENGLES) + IF(WIN32) + TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win) + ELSE(WIN32) + TARGET_LINK_LIBRARIES(${name} nel_drv_opengles) + ENDIF(WIN32) + ENDIF(WITH_DRIVER_OPENGLES) ENDIF(WITH_STATIC_DRIVERS) ENDMACRO(NL_ADD_STATIC_VID_DRIVERS) @@ -208,6 +216,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) # Drivers Support ### OPTION(WITH_DRIVER_OPENGL "Build OpenGL Driver (3D)" ON ) + OPTION(WITH_DRIVER_OPENGLES "Build OpenGL ES Driver (3D)" OFF) OPTION(WITH_DRIVER_DIRECT3D "Build Direct3D Driver (3D)" OFF) OPTION(WITH_DRIVER_OPENAL "Build OpenAL Driver (Sound)" ON ) OPTION(WITH_DRIVER_FMOD "Build FMOD Driver (Sound)" OFF) diff --git a/code/config.h.cmake b/code/config.h.cmake index a2f65aa41..2f2ff8095 100644 --- a/code/config.h.cmake +++ b/code/config.h.cmake @@ -35,6 +35,7 @@ #cmakedefine HAVE_STAT64 1 #cmakedefine NL_OPENGL_AVAILABLE ${NL_OPENGL_AVAILABLE} +#cmakedefine NL_OPENGLES_AVAILABLE ${NL_OPENGLES_AVAILABLE} #cmakedefine NL_DIRECT3D_AVAILABLE ${NL_DIRECT3D_AVAILABLE} #cmakedefine NL_FMOD_AVAILABLE ${NL_FMOD_AVAILABLE} From ae9de611f6b112dd75a01c1801d4ab33bd38e28b Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 1 May 2011 18:27:05 +0200 Subject: [PATCH 02/29] Changed: #1275 Create an OpenGL ES driver --- .../3d/driver/opengl/driver_opengl_light.cpp | 5 + .../3d/driver/opengl/driver_opengl_matrix.cpp | 15 ++- .../3d/driver/opengl/driver_opengl_states.cpp | 98 ++++++++++++++++--- .../3d/driver/opengl/driver_opengl_vertex.cpp | 52 +++++++++- .../driver_opengl_vertex_buffer_hard.cpp | 15 ++- 5 files changed, 169 insertions(+), 16 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp index 073d39176..e5c3cff6e 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp @@ -139,8 +139,13 @@ void CDriverGL::setLightInternal(uint8 num, const CLight& light) else { // Deactivate spot properties +#ifdef USE_OPENGLES + glLightf (lightNum, GL_SPOT_CUTOFF, 180.f); + glLightf (lightNum, GL_SPOT_EXPONENT, 0.f); +#else glLighti (lightNum, GL_SPOT_CUTOFF, 180); glLighti (lightNum, GL_SPOT_EXPONENT, 0); +#endif } // Flag this light as dirt. diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 0e5cea073..4106c38f2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -15,24 +15,35 @@ // along with this program. If not, see . #include "stdopengl.h" - #include "driver_opengl.h" + namespace NL3D { // *************************************************************************** void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective) { - H_AUTO_OGL(CDriverGL_setFrustum) + H_AUTO_OGL(CDriverGL_setFrustum); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); + if (perspective) { +#ifdef USE_OPENGLES + glFrustumf(left,right,bottom,top,znear,zfar); +#else glFrustum(left,right,bottom,top,znear,zfar); +#endif } else { +#ifdef USE_OPENGLES + glOrthof(left,right,bottom,top,znear,zfar); +#else glOrtho(left,right,bottom,top,znear,zfar); +#endif } + _ProjMatDirty = true; // Backup znear and zfar for zbias setup diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index fb4f14dc2..e0c79c504 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -144,33 +144,62 @@ void CDriverGLStates::forceDefaults(uint nbStages) for(stage=0;stage_Extensions.OESMapBuffer) + { + unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER); + } +#else + unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); +#endif + #ifdef NL_DEBUG _Unmapping = false; #endif From a272feeb9bfa96f0166baf5df47c65356d83d753 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 1 May 2011 19:11:10 +0200 Subject: [PATCH 03/29] Changed: #1275 Create an OpenGL ES driver --- .../src/3d/driver/opengl/driver_opengl.cpp | 8 ++- .../driver/opengl/driver_opengl_material.cpp | 20 ++++++- .../3d/driver/opengl/driver_opengl_states.cpp | 47 +++++++++++---- .../driver_opengl_vertex_buffer_hard.cpp | 58 ++++++++++++++++++- 4 files changed, 116 insertions(+), 17 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 02ba70993..f222dc5a7 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -2508,8 +2508,13 @@ void CDriverGL::checkTextureOn() const GLboolean flagCM; GLboolean flagTR; glGetBooleanv(GL_TEXTURE_2D, &flag2D); +#ifdef USE_OPENGLES + glGetBooleanv(GL_TEXTURE_CUBE_MAP_OES, &flagCM); + flagTR = true; // always true in OpenGL ES +#else glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM); glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR); +#endif switch(dgs.getTextureMode()) { case CDriverGLStates::TextureDisabled: @@ -2545,7 +2550,8 @@ bool CDriverGL::supportOcclusionQuery() const // *************************************************************************** bool CDriverGL::supportTextureRectangle() const { - H_AUTO_OGL(CDriverGL_supportTextureRectangle) + H_AUTO_OGL(CDriverGL_supportTextureRectangle); + return (_Extensions.NVTextureRectangle || _Extensions.EXTTextureRectangle || _Extensions.ARBTextureRectangle); } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 569aceb0c..9dd08a51f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -137,7 +137,9 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat) _DriverGLStates.setTexGenMode (stage, GL_OBJECT_LINEAR); } else if(mode==CMaterial::TexCoordGenEyeSpace) + { _DriverGLStates.setTexGenMode (stage, GL_EYE_LINEAR); + } } else { @@ -918,7 +920,11 @@ void CDriverGL::setupLightMapPass(uint pass) if (mat._LightMapsMulx2) { // Multiply x 2 +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2); +#else glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2); +#endif } } } @@ -1027,7 +1033,11 @@ void CDriverGL::endLightMapMultiPass() for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i) { _DriverGLStates.activeTextureARB(i); +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1); +#else glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1); +#endif } } } @@ -1102,13 +1112,16 @@ void CDriverGL::setupSpecularBegin() // todo hulud remove // _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap); +#ifdef USE_OPENGLES + _DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_OES); +#else _DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_ARB); +#endif + // setup the good matrix for stage 1. glMatrixMode(GL_TEXTURE); glLoadMatrixf( _SpecularTexMtx.get() ); glMatrixMode(GL_MODELVIEW); - - } // *************************************************************************** @@ -1292,7 +1305,8 @@ void CDriverGL::setupSpecularPass(uint pass) _DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled); } else - { // Multiply texture1 by alpha_texture0 and display with add + { + // Multiply texture1 by alpha_texture0 and display with add _DriverGLStates.enableBlend(true); _DriverGLStates.blendFunc(GL_ONE, GL_ONE); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index e0c79c504..cf30758dc 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -77,7 +77,8 @@ void CDriverGLStates::init(bool supportTextureCubeMap, bool supportTextureRect // *************************************************************************** void CDriverGLStates::forceDefaults(uint nbStages) { - H_AUTO_OGL(CDriverGLStates_forceDefaults) + H_AUTO_OGL(CDriverGLStates_forceDefaults); + // Enable / disable. _CurFog= false; _CurBlend= false; @@ -86,6 +87,7 @@ void CDriverGLStates::forceDefaults(uint nbStages) _CurLighting= false; _CurZWrite= true; _CurStencilTest=false; + // setup GLStates. glDisable(GL_FOG); glDisable(GL_BLEND); @@ -642,10 +644,14 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) if(mode==0) { +#ifdef USE_OPENGLES + glDisable(GL_TEXTURE_GEN_STR_OES); +#else glDisable( GL_TEXTURE_GEN_S ); glDisable( GL_TEXTURE_GEN_T ); glDisable( GL_TEXTURE_GEN_R ); glDisable( GL_TEXTURE_GEN_Q ); +#endif } else { @@ -667,6 +673,7 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) { glDisable( GL_TEXTURE_GEN_Q ); } + // Enable All. #ifdef USE_OPENGLES glEnable(GL_TEXTURE_GEN_STR_OES); @@ -853,22 +860,25 @@ void CDriverGLStates::enableNormalArray(bool enable) // *************************************************************************** void CDriverGLStates::enableWeightArray(bool enable) { - H_AUTO_OGL(CDriverGLStates_enableWeightArray) + H_AUTO_OGL(CDriverGLStates_enableWeightArray); + if(_WeightArrayEnabled != enable) { +#ifndef USE_OPENGLES if(enable) glEnableClientState(GL_VERTEX_WEIGHTING_EXT); else glDisableClientState(GL_VERTEX_WEIGHTING_EXT); +#endif + _WeightArrayEnabled= enable; - - } } // *************************************************************************** void CDriverGLStates::enableColorArray(bool enable) { - H_AUTO_OGL(CDriverGLStates_enableColorArray) + H_AUTO_OGL(CDriverGLStates_enableColorArray); + if(_ColorArrayEnabled != enable) { if(enable) @@ -885,14 +895,16 @@ void CDriverGLStates::enableColorArray(bool enable) // *************************************************************************** void CDriverGLStates::enableSecondaryColorArray(bool enable) { - H_AUTO_OGL(CDriverGLStates_enableSecondaryColorArray) + H_AUTO_OGL(CDriverGLStates_enableSecondaryColorArray); + if(_SecondaryColorArrayEnabled != enable) { +#ifndef USE_OPENGLES if(enable) glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); else glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); - +#endif _SecondaryColorArrayEnabled= enable; @@ -910,10 +922,15 @@ void CDriverGLStates::enableSecondaryColorArray(bool enable) // *************************************************************************** void CDriverGLStates::clientActiveTextureARB(uint stage) { - H_AUTO_OGL(CDriverGLStates_clientActiveTextureARB) + H_AUTO_OGL(CDriverGLStates_clientActiveTextureARB); + if( _CurrentClientActiveTextureARB != stage ) { +#ifdef USE_OPENGLES + glClientActiveTexture(GL_TEXTURE0+stage); +#else nglClientActiveTextureARB(GL_TEXTURE0_ARB+stage); +#endif _CurrentClientActiveTextureARB= stage; } } @@ -921,7 +938,8 @@ void CDriverGLStates::clientActiveTextureARB(uint stage) // *************************************************************************** void CDriverGLStates::enableTexCoordArray(bool enable) { - H_AUTO_OGL(CDriverGLStates_enableTexCoordArray) + H_AUTO_OGL(CDriverGLStates_enableTexCoordArray); + if(_TexCoordArrayEnabled[_CurrentClientActiveTextureARB] != enable) { if(enable) @@ -937,14 +955,16 @@ void CDriverGLStates::enableTexCoordArray(bool enable) // *************************************************************************** void CDriverGLStates::enableVertexAttribArray(uint glIndex, bool enable) { - H_AUTO_OGL(CDriverGLStates_enableVertexAttribArray) + H_AUTO_OGL(CDriverGLStates_enableVertexAttribArray); + if(_VertexAttribArrayEnabled[glIndex] != enable) { +#ifndef USE_OPENGLES if(enable) glEnableClientState(glIndex+GL_VERTEX_ATTRIB_ARRAY0_NV); else glDisableClientState(glIndex+GL_VERTEX_ATTRIB_ARRAY0_NV); - +#endif _VertexAttribArrayEnabled[glIndex]= enable; } @@ -953,15 +973,18 @@ void CDriverGLStates::enableVertexAttribArray(uint glIndex, bool enable) // *************************************************************************** void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable) { - H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayARB) + H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayARB); + #ifndef NL3D_GLSTATE_DISABLE_CACHE if(_VertexAttribArrayEnabled[glIndex] != enable) #endif { +#ifndef USE_OPENGLES if(enable) nglEnableVertexAttribArrayARB(glIndex); else nglDisableVertexAttribArrayARB(glIndex); +#endif _VertexAttribArrayEnabled[glIndex]= enable; } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index ce436dcc6..3c74d02b4 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -1210,19 +1210,37 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff // create a ARB VBHard GLuint vertexBufferID; glGetError(); + +#ifdef USE_OPENGLES + glGenBuffers(1, &vertexBufferID); +#else nglGenBuffersARB(1, &vertexBufferID); +#endif + if (glGetError() != GL_NO_ERROR) return false; _Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID); switch(_VBType) { case CVertexBuffer::AGPPreferred: +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); +#endif break; case CVertexBuffer::StaticPreferred: if (_Driver->getStaticMemoryToVRAM()) +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); +#endif else +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); +#endif break; default: nlassert(0); @@ -1230,7 +1248,12 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff } if (glGetError() != GL_NO_ERROR) { +#ifdef USE_OPENGLES + glDeleteBuffers(1, &vertexBufferID); +#else nglDeleteBuffersARB(1, &vertexBufferID); +#endif + return false; } CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb); @@ -1272,8 +1295,13 @@ void CVertexArrayRangeARB::updateLostBuffers() { nlassert((*it)->_VertexObjectId); GLuint id = (GLuint) (*it)->_VertexObjectId; +#ifdef USE_OPENGLES + nlassert(glIsBuffer(id)); + glDeleteBuffers(1, &id); +#else nlassert(nglIsBufferARB(id)); nglDeleteBuffersARB(1, &id); +#endif (*it)->_VertexObjectId = 0; (*it)->VB->setLocation(CVertexBuffer::NotResident); } @@ -1316,8 +1344,13 @@ CVertexBufferHardARB::~CVertexBufferHardARB() if (_VertexObjectId) { GLuint id = (GLuint) _VertexObjectId; +#ifdef USE_OPENGLES + nlassert(glIsBuffer(id)); + glDeleteBuffers(1, &id); +#else nlassert(nglIsBufferARB(id)); nglDeleteBuffersARB(1, &id); +#endif } if (_VertexArrayRange) { @@ -1341,7 +1374,8 @@ CVertexBufferHardARB::~CVertexBufferHardARB() // *************************************************************************** void *CVertexBufferHardARB::lock() { - H_AUTO_OGL(CVertexBufferHardARB_lock) + H_AUTO_OGL(CVertexBufferHardARB_lock); + if (_VertexPtr) return _VertexPtr; // already locked if (_Invalid) { @@ -1352,7 +1386,13 @@ void *CVertexBufferHardARB::lock() } // recreate a vb GLuint vertexBufferID; + +#ifdef USE_OPENGLES + glGenBuffers(1, &vertexBufferID); +#else nglGenBuffersARB(1, &vertexBufferID); +#endif + if (glGetError() != GL_NO_ERROR) { _Driver->incrementResetCounter(); @@ -1363,13 +1403,25 @@ void *CVertexBufferHardARB::lock() switch(_MemType) { case CVertexBuffer::AGPPreferred: +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); +#endif break; case CVertexBuffer::StaticPreferred: if (_Driver->getStaticMemoryToVRAM()) +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); +#endif else +#ifdef USE_OPENGLES + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); +#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); +#endif break; default: nlassert(0); @@ -1378,7 +1430,11 @@ void *CVertexBufferHardARB::lock() if (glGetError() != GL_NO_ERROR) { _Driver->incrementResetCounter(); +#ifdef USE_OPENGLES + glDeleteBuffers(1, &vertexBufferID); +#else nglDeleteBuffersARB(1, &vertexBufferID); +#endif return &_DummyVB[0];; } _VertexObjectId = vertexBufferID; From dc5c4dccec2d73e2c8eb83f4861a9927a83dffd5 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Wed, 4 May 2011 21:55:57 -0500 Subject: [PATCH 05/29] Test for my branch gsoc2011-guildmission --HG-- branch : gsoc2011-guildmissions --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 000000000..30d74d258 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test \ No newline at end of file From 23f5d9619185bad109f928bc33cc93ccfc9d6087 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Wed, 4 May 2011 21:58:28 -0500 Subject: [PATCH 06/29] Removing test for my branch gsoc2011-guildmissions --HG-- branch : gsoc2011-guildmissions --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 30d74d258..000000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file From a3d7d31badb4d117f7be2431613f34316c5899fa Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 7 May 2011 15:51:15 +0300 Subject: [PATCH 07/29] Header cascading section resizes is enabled. --- .../leveldesign/georges_editor_qt/src/georges_treeview_form.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_form.ui b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_form.ui index 4cff36c92..f5c283b55 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_form.ui +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_form.ui @@ -57,6 +57,9 @@ 0 + + true + From c4ce6dcdcce3604e6c5441a81372d6a33f0e130b Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 7 May 2011 18:23:23 +0300 Subject: [PATCH 08/29] Fixed: geqt correctly handles in the FileOpenDialog of cancel action and empty icon --- .../src/georges_treeview_dialog.cpp | 4 +++- .../georges_editor_qt/src/georgesform_model.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp index dea8d8ce7..65c53ed78 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp @@ -222,7 +222,7 @@ namespace NLQT { COFile file; - std::string s = CPath::lookup(loadedForm.toStdString()); + std::string s = CPath::lookup(loadedForm.toStdString(), false); if (file.open (s)) { try @@ -323,6 +323,8 @@ namespace NLQT path, "Images (*.png *.tga)" ); + if (file.isNull()) + return; QFileInfo info = QFileInfo(file); // TODO? diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp index ab3092455..956380851 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp @@ -184,10 +184,17 @@ namespace NLQT if (Modules::objViewInt()) { QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); - if (icon->isNull()) - return QIcon(":/images/pqrticles.png"); + if (icon) + { + if(icon->isNull()) + return QIcon(":/images/pqrticles.png"); + else + return QIcon(*icon); + } else - return QIcon(*icon); + { + return QIcon(); + } } } else if(value.contains(".tga") || value.contains(".png")) From 403cb36539cc27faa5fe495a31b5c56d163b7373 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sun, 8 May 2011 00:13:56 +0300 Subject: [PATCH 09/29] Fixed: Mouse zoom correct works in geqt. --- .../tools/3d/object_viewer_widget/src/object_viewer_widget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index 4c6d25b3a..cbee70185 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -62,7 +62,8 @@ namespace NLQT _CameraFocal(75), _CurrentInstance(""), _BloomEffect(false), _Scene(0), QWidget(parent) { - + setMouseTracking(true); + setFocusPolicy(Qt::StrongFocus); _objectViewerWidget = this; _isGraphicsEnabled = true; From e6e126b3e3073b190047165993c19ad74feaa648 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sun, 8 May 2011 01:10:12 +0300 Subject: [PATCH 10/29] Changed: Added particle system animation. --- .../src/object_viewer_widget.cpp | 15 ++++++++++++++- .../src/object_viewer_widget.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index cbee70185..67abffbcb 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -262,7 +262,7 @@ namespace NLQT //updateAnimation(_AnimationDialog->getTime()); - + updateAnimatePS(); // 10. Update Camera (depends on entities) // ... @@ -719,6 +719,19 @@ namespace NLQT //CFile::deleteFile(filename); return icon; } + + void CObjectViewerWidget::updateAnimatePS(uint64 deltaTime) + { + static sint64 firstTime = NLMISC::CTime::getLocalTime(); + static sint64 lastTime = NLMISC::CTime::getLocalTime(); + if (deltaTime == 0) + { + deltaTime = NLMISC::CTime::getLocalTime() - lastTime; + } + lastTime += deltaTime; + float fdelta = 0.001f * (float) (lastTime - firstTime); + _Scene->animate ( fdelta); + } #if defined(NL_OS_WINDOWS) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h index 82bf26f92..15c9b0fa9 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h @@ -178,6 +178,10 @@ namespace NLQT void updateRender(); private: + + /// Update the animation time for Particle System animation. + /// @param deltaTime - set the manual animation time. + void updateAnimatePS(uint64 deltaTime = 0); static CObjectViewerWidget *_objectViewerWidget; From 87a197cba52fcbde572bb9e418dbbdcbf0f3c536 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sun, 8 May 2011 01:11:10 +0300 Subject: [PATCH 11/29] Changed: Added preview particle system in geqt. --- .../georges_editor_qt/src/georges_treeview_dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp index 65c53ed78..b2c3d5a64 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp @@ -335,7 +335,7 @@ namespace NLQT } else { - if (path.contains(".shape")) + if (path.contains(".shape") || path.contains(".ps")) { if (Modules::objViewInt()) { From 65b8f494e9f3d60d53d4f06bd1e027e7e0a409c4 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sun, 8 May 2011 01:48:38 +0300 Subject: [PATCH 12/29] Fixed: The program crashes after preview ps. --- .../tools/3d/object_viewer_widget/src/object_viewer_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index 67abffbcb..70bf51f81 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -79,7 +79,7 @@ namespace NLQT CObjectViewerWidget::~CObjectViewerWidget() { - + release(); } void CObjectViewerWidget::showEvent ( QShowEvent * event ) From 1637ec17f986d4e3b7f36c748b4b9e549e762413 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 13:25:03 +0300 Subject: [PATCH 13/29] Fixed: #1193 Compilation with GCC (SchemeManager). Fix typos in comments/code. --- .../tools/3d/object_viewer_qt/doc/ovqt.dox | 4 +-- .../src/extension_system/iplugin_manager.h | 1 - .../src/extension_system/plugin_manager.cpp | 2 +- .../src/extension_system/plugin_manager.h | 2 +- .../src/extension_system/plugin_spec.cpp | 2 +- .../src/extension_system/plugin_spec.h | 2 +- .../src/plugins/core/core_constants.h | 8 ++--- .../plugins/object_viewer/particle_editor.h | 2 +- .../object_viewer/particle_system_page.cpp | 4 --- .../object_viewer/particle_tree_model.cpp | 2 +- .../plugins/object_viewer/scheme_manager.h | 11 +++---- .../object_viewer/value_gradient_dialog.cpp | 33 ++++++++++--------- .../object_viewer/value_gradient_dialog.h | 30 ++++++++--------- 13 files changed, 50 insertions(+), 53 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox b/code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox index e15e37e5a..b310ad758 100644 --- a/code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox +++ b/code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox @@ -31,7 +31,7 @@ PROJECT_NAME = "Object Viewer Qt" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = r90 +PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -643,7 +643,7 @@ FILE_PATTERNS = *.c \ # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. -RECURSIVE = NO +RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h index e67c9e588..05d4b832c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h @@ -40,7 +40,6 @@ class IPluginSpec; class IPluginManager: public QObject { Q_OBJECT - public: IPluginManager(QObject *parent = 0): QObject(parent) {} virtual ~IPluginManager() {} diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp index 49dcec785..21c6e15b1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp @@ -292,4 +292,4 @@ void CPluginManager::deleteAll() } } -}; // namespace NLQT \ No newline at end of file +}; // namespace ExtensionSystem \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h index d1a18485b..4ef3b2208 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h @@ -74,6 +74,6 @@ private: }; // class CPluginManager -} // namespace NLQT +} // namespace ExtensionSystem #endif // PLUGINMANAGER_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp index 7158c8d9f..d77d90962 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp @@ -266,4 +266,4 @@ bool CPluginSpec::reportError(const QString &err) return false; } -} // namespace NLQT \ No newline at end of file +} // namespace ExtensionSystem \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h index e73f3ed93..0cc895ada 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h @@ -79,7 +79,7 @@ private: friend class CPluginManager; }; -} // namespace NLQT +} // namespace ExtensionSystem #endif // PLUGINSPEC_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index 18dc11c87..2adf4f35a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -32,7 +32,7 @@ const char * const OVQT_CORE_PLUGIN = "Core"; const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; //menubar -const char * const MENU_BAR = "ObjectViewerQt.MenuBar"; +const char * const MENU_BAR = "ObjectViewerQt.MenuBar"; //menus const char * const M_FILE = "ObjectViewerQt.Menu.File"; @@ -54,11 +54,11 @@ const char * const SETTINGS = "ObjectViewerQt.Settings"; const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; const char * const CLOSE = "ObjectViewerQt.Close"; -const char * const CLOSEALL = "ObjectViewerQt.CloseAll"; +const char * const CLOSEALL = "ObjectViewerQt.CloseAll"; const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers"; const char * const ABOUT = "ObjectViewerQt.About"; const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins"; -const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; +const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; //settings const char * const DATA_PATH_SECTION = "DataPath"; @@ -68,7 +68,7 @@ const char * const LEVELDESIGN_PATH = "LevelDesignPath"; const char * const ASSETS_PATH = "LevelDesignPath"; //resources -const char * const ICON_NEL = ":/core/images/nel.png"; +const char * const ICON_NEL = ":/core/images/nel.png"; const char * const ICON_SETTINGS = ":/core/images/preferences.png"; const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png"; const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h index da191705f..e4d1605e3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h @@ -214,7 +214,7 @@ public: { return _FontGen; } - + CSchemeManager *getSchemeManager () const { return _SchemeManager; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp index b9c07db1a..072297437 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp @@ -605,25 +605,21 @@ void CParticleSystemPage::setMaxSteps(uint32 value) void CParticleSystemPage::setUserParam1(float value) { _Node->getPSPointer()->setUserParam(0, value); - updateModifiedFlag(); } void CParticleSystemPage::setUserParam2(float value) { _Node->getPSPointer()->setUserParam(1, value); - updateModifiedFlag(); } void CParticleSystemPage::setUserParam3(float value) { _Node->getPSPointer()->setUserParam(2, value); - updateModifiedFlag(); } void CParticleSystemPage::setUserParam4(float value) { _Node->getPSPointer()->setUserParam(3, value); - updateModifiedFlag(); } void CParticleSystemPage::setMaxViewDist(float value) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp index 155e6ad4c..77286ed32 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp @@ -177,7 +177,7 @@ CParticleTreeModel::~CParticleTreeModel() int CParticleTreeModel::columnCount(const QModelIndex &parent) const { if (parent.isValid()) - return static_cast(parent.internalPointer())->columnCount(); + return static_cast(parent.internalPointer())->columnCount(); else return _rootItem->columnCount(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h index 01a2abb35..8348fae0c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h @@ -25,10 +25,10 @@ namespace NL3D { - class CPSAttribMakerBase; +class CPSAttribMakerBase; } - -namespace NLQT + +namespace NLQT { class CSchemeManager @@ -50,10 +50,9 @@ public: void remove(NL3D::CPSAttribMakerBase *am); // rename a scheme, given a pointer on it void rename(NL3D::CPSAttribMakerBase *am, const std::string &newName); -protected: - typedef std::pair TSchemeInfo; +protected: typedef std::multimap TSchemeMap; - TSchemeMap _SchemeMap; + TSchemeMap _SchemeMap; }; } /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp index adf91c598..544ceec98 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp @@ -1,18 +1,18 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // Projects include @@ -154,6 +154,9 @@ void CGradientDialog::valueDown() m_ui.listWidget->setCurrentRow(currentRow); } m_ui.listWidget->setCurrentRow(currentRow); + --currentRow; + QListWidgetItem *item = m_ui.listWidget->item(currentRow); + m_clientInterface->displayValue(currentRow, item); } void CGradientDialog::valueUp() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h index 48da2f600..dc2b366d8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h @@ -1,18 +1,18 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #ifndef VALUE_GRADIENT_DIALOG_H From ef9e358b4f7dd8d5bf6c5710525677b49aa13217 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 15:13:59 +0300 Subject: [PATCH 14/29] Changed: #1193 The user can specify the ovqt plugins path if not using the default path. --- code/nel/tools/3d/object_viewer_qt/src/main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/nel/tools/3d/object_viewer_qt/src/main.cpp index 64cb1fff2..8588c148a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include static const char *appNameC = "ObjectViewerQt"; @@ -135,7 +137,7 @@ sint main(int argc, char **argv) QTranslator qtTranslator; QString locale = settings->value("Language", QLocale::system().name()).toString(); QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); - translator.load("object_viewer_qt_" + locale, ":/"); +// translator.load("object_viewer_qt_" + locale, ":/"); qtTranslator.load("qt_" + locale, qtTrPath); app.installTranslator(&translator); app.installTranslator(&qtTranslator); @@ -149,7 +151,7 @@ sint main(int argc, char **argv) pluginManager.setSettings(settings); QStringList pluginPaths; #if !defined(NL_OS_MAC) - pluginPaths << QString("./plugins"); + pluginPaths << settings->value("PluginPath", "./plugins").toString(); #else pluginPaths << qApp->applicationDirPath() + QString("/../PlugIns/ovqt"); #endif @@ -176,6 +178,15 @@ sint main(int argc, char **argv) QString absolutePaths = absolutePluginPaths.absolutePath(); const QString reason = QCoreApplication::translate("Application", "Could not find ovqt_plugin_core in %1").arg(absolutePaths); displayError(msgCoreLoadFailure(reason)); + + QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath()); + bool ok; + QString text = QInputDialog::getText(0, QCoreApplication::translate("Application", "Enter the plugins path"), + QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal, + newPath, &ok); + if (ok && !text.isEmpty()) + settings->setValue("PluginPath", text); + settings->sync(); return 1; } if (corePlugin->hasError()) From cba0e9844d7217e32d6662f16d0cb3467da80a47 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 18:27:09 +0300 Subject: [PATCH 15/29] Changed: #1193 Added general settings page. ICore emits a signal changeSettings() when changing settings. Enabled sound in object viewer plugin. --- .../3d/object_viewer_qt/src/description.h | 134 ++---------- .../src/plugins/core/CMakeLists.txt | 2 + .../src/plugins/core/core_constants.h | 14 +- .../src/plugins/core/core_plugin.cpp | 42 ++-- .../src/plugins/core/core_plugin.h | 10 +- .../plugins/core/general_settings_page.cpp | 187 ++++++++++++++++ .../src/plugins/core/general_settings_page.h | 71 +++++++ .../src/plugins/core/general_settings_page.ui | 199 ++++++++++++++++++ .../object_viewer_qt/src/plugins/core/icore.h | 1 + .../src/plugins/core/main_window.cpp | 25 ++- .../src/plugins/core/main_window.h | 1 + .../core/search_paths_settings_page.cpp | 6 +- .../src/plugins/log/log_plugin.cpp | 18 +- .../src/plugins/object_viewer/attrib_form.ui | 2 +- .../object_viewer/graphics_settings_page.cpp | 17 -- .../object_viewer/graphics_settings_page.ui | 51 +---- .../src/plugins/object_viewer/main_window.cpp | 34 +-- .../src/plugins/object_viewer/main_window.h | 9 - 18 files changed, 551 insertions(+), 272 deletions(-) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/description.h b/code/nel/tools/3d/object_viewer_qt/src/description.h index d22a1918b..a1a041de9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/description.h +++ b/code/nel/tools/3d/object_viewer_qt/src/description.h @@ -1,6 +1,6 @@ /** @mainpage Object Viewer Qt -@author Dzmitry Kamiahin , (C) 2010 +@author Dzmitry Kamiahin , (C) 2011 @section introduce Introduce @details @@ -15,130 +15,22 @@ The tool can be used in different tasks: - Create and modify micro-vegetation material (.vegetset files) - Viewing landscape (.zonel files) - Dialog allows to specify graphical, sound, search path and landscape settings. - -@section project_structure Overview of the Object Viewer Qt Project Structure -@details -OVQT - consists of several major subsystems. Each subsystem performs its defined part of the task. -Through Modules:: provides access to all other program subsystems. - -Program has the following subsystems: -- @ref Modules - Main modules aggregated all parts of the program. -- @ref NLQT::CConfiguration - is responsible for loading and saving settings from the configuration file. As well as search path of data. -- @ref NLQT::CObjectViewer - main subsystem of the program, which initializes the driver, creates a scene and other supporting elements. -It is a container for loaded models, which can further be viewed and animated. -- @ref NLQT::CMainWindow - is responsible for the GUI. -- @ref NLQT::CParticleEditor - is responsible for the particle systems and provides access to a container that keeps all the loaded particle systems. -And also allows you to view an animation of particle systems, with the ability to control its parameters. -- @ref NLQT::CVegetableEditor - is responsible for the landscape zones and the editor of vegetation. -Allows you to load and view the landscape. Also has the ability to create and edit the parameters of the micro-vegetation. -- @ref NLQT::CSoundSystem - is responsible for the sound in the program. - - -The structure of the GUI in the editor of the particles. -
-This can be useful for new developers who want to add more new dialogs or to improve the functionality of existing dialogues. -Particle Workspace -ParticleWorkspace dialogue uses the technique of model-view. -Using the signal/slot link QTreeView with QStackWidget, Editor properties dialog. -When you select an item in QTreeView, QStackWidget displays the necessary page(PageWidget) where you can edit the element of the particles system. -Each page is made in the designer and has a separate forms(.ui). -In accordance with the recommendations of dialogues design, with a large number of items,every page uses QTabWidget. -In case when there is a great number of controls, and not everything you want to display, -it's used the dynamic creation of tabs. Moreover, each tab uses a separate forms(.ui). - -@section for_new_developer Guide for new developers of the Object Viewer Qt. -@details - First of all, to begin developing dialogues that add new features ovqt, -it is needed to read the documentation Qt libs (http://doc.qt.nokia.com/) and NeL documentation. - - In order to have convenient using of the tool and its further development, -it is expected to make a unified interface that is why all dialogs should adhere to a standard design, -which will be written further. For this goals program provides some additional widgets, -which are recommended to use. As in the development Qt Designer is actively used. -To get access to founded here widgets from the designer,the technique promotion is used, -which can be found here . -
    -
  1. -CEditRangeUIntWidget / CEditRangeIntWidget / CEditRangeFloatWidget -
    -Widgets provides a slider that allows you to specify an integer (or float, depending on which widget used) number within a set range. -The range is also can be set by the user, or for a more accurate selection of numbers, either for receiving large values. -As there may be situations when the range that a user requests,has to be restricted, and widget provides methods that allow you to do so. -

    -CEditRangeIntWidget -
    -CEditRangeFloatWidget -@see -@ref NLQT::CEditRangeUIntWidget, @ref NLQT::CEditRangeIntWidget, @ref NLQT::CEditRangeFloatWidget - -
  2. -CColorEditWidget -
    -Using this widget you can set the color(RGBA) using the four sliders or through the color selection dialog. -

    -CColorEditWidget -@see -@ref NLQT::CColorEditWidget - -
  3. -CDirectionWidget -
    -This widget helps to choose from several preset directions, or to choose a custom one. -

    -CDirectionWidget -@see -@ref NLQT::CDirectionWidget -


- -To further convinience of instrument using dialogues interface is recommended to make as follows. -The most sophisticated tools of the program, should take the form of three dock windows (example shown in the screenshot). -Object Viewer Qt -
    -
  1. -The first dock window - is a control dock window, it should focus all of the control functions of general purpose -(for example: start/stop/pause animations or particles system). -It is recommended to perform of the horizontal type window and placed in the bottom of the main window. -
  2. -The second dock window - is a list or a tree of items. In which selecting of the current element, -which assumes to modify or viewis possible.Operations "add/remove/insert or other" items are recommended to make as a popur menu. -It is recommended to perform of the vertical type window and placed in the left of the main window. -
  3. -The third dock - is an editor for properties of the element that was selected in the list or in the tree of elements. -As all the controls occupy much space or do not fit at all, you have to use tabs QTabWidget, -which in total can contains quite a lot of elements. -For a small number of tabs it is allowed to use both horizontal and vertical location. -But with a large number of tabs, it is necessary to apply the vertical arrangement. -It is recommended to perform of the vertical type of window and placed in the right of the main window. -
-In the simple dialogues do not necessary to use all three windows, but user has to adhere to the recommendations given above as well. -Also, all dialogs must use the qt layout manager. And if you do not use the designer, -make sure you use the qt tools internationalization applications. -

-In ovqt for most dialogs their owner is NLQT::CMainWindow and in its methods creating and initializing all dependent dialogs occur. -For the convenience of the program using, most dialogues are created in the form of docking windows. -Creating all the dialogues are carried out in a private method NLQT::CMainWindow::createDialogs(). -Hence, it is necessary to add operations in this method to create new dialogues. -But we must take into account that at this moment is fully available only one component of the program CConfiguration, -to read the settings from the configuration file. The remaining components of the program are available only after the main window stays visible. -Calling the dialogues going through the menu or the toolbar, usually it is a checkable item. -Adding of the new menu items or items toolbars is need in methods NLQT::CMainWindow::createMenus(), NLQT::CMainWindow::createToolBars(). +- OVQT supports loading third-party plug-ins. @section license_ovqt License Object Viewer Qt @details - Object Viewer Qt +Object Viewer Qt - MMORPG Framework
- Copyright (C) 2010 Dzmitry Kamiahin +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version.

- This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details.

- This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -

- You should have received a copy of the GNU General Public License - along with this program. If not, see . +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt index 726cb4a2d..06095790b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt @@ -20,10 +20,12 @@ SET(OVQT_CORE_PLUGIN_HDR menu_manager.h settings_dialog.h search_paths_settings_page.h + general_settings_page.h plugin_view_dialog.h) SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui plugin_view_dialog.ui + general_settings_page.ui search_paths_settings_page.ui) SET(OVQT_CORE_PLUGIN_RCS core.qrc) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index 2adf4f35a..eb59cddd2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -24,7 +24,7 @@ namespace Constants { const char * const OVQT_VERSION_LONG = "0.0.1"; -const char * const OVQT_VENDOR = "Dzmitry Kamiahin"; +const char * const OVQT_VENDOR = "Ryzom Core"; const char * const OVQT_YEAR = "2010, 2011"; const char * const OVQT_CORE_PLUGIN = "Core"; @@ -61,6 +61,18 @@ const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins"; const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; //settings +const char * const SETTINGS_CATEGORY_GENERAL = "general"; +const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png"; +const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General"); + +const char * const MAIN_WINDOW_SECTION = "MainWindow"; +const char * const MAIN_WINDOW_STATE = "WindowState"; +const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry"; +const char * const QT_STYLE = "QtStyle"; +const char * const QT_PALETTE = "QtPalette"; + +const char * const LANGUAGE = "Language"; +const char * const PLUGINS_PATH = "PluginPath"; const char * const DATA_PATH_SECTION = "DataPath"; const char * const SEARCH_PATHS = "SearchPaths"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp index 6d051d64d..6cb58ba67 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp @@ -20,8 +20,8 @@ #include "settings_dialog.h" #include "core_constants.h" #include "search_paths_settings_page.h" +#include "general_settings_page.h" #include "../../extension_system/iplugin_spec.h" -#include "qtwin.h" // NeL includes #include "nel/misc/debug.h" @@ -42,37 +42,37 @@ CorePlugin::CorePlugin() CorePlugin::~CorePlugin() { - Q_FOREACH(QObject *obj, _autoReleaseObjects) + Q_FOREACH(QObject *obj, m_autoReleaseObjects) { - _plugMan->removeObject(obj); + m_plugMan->removeObject(obj); } - qDeleteAll(_autoReleaseObjects); - _autoReleaseObjects.clear(); + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); - delete _mainWindow; + delete m_mainWindow; } bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) { Q_UNUSED(errorString); - _plugMan = pluginManager; + m_plugMan = pluginManager; - _mainWindow = new MainWindow(pluginManager); - /*if (QtWin::isCompositionEnabled()) - { - QtWin::extendFrameIntoClientArea(_mainWindow); - _mainWindow->setContentsMargins(0, 0, 0, 0); - }*/ - bool success = _mainWindow->initialize(errorString); - CSearchPathsSettingsPage *serchPathPage = new CSearchPathsSettingsPage(this); - serchPathPage->applySearchPaths(); - addAutoReleasedObject(serchPathPage); + m_mainWindow = new MainWindow(pluginManager); + bool success = m_mainWindow->initialize(errorString); + + GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this); + CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(this); + + generalSettings->applyGeneralSettings(); + searchPathPage->applySearchPaths(); + addAutoReleasedObject(generalSettings); + addAutoReleasedObject(searchPathPage); return success; } void CorePlugin::extensionsInitialized() { - _mainWindow->extensionsInitialized(); + m_mainWindow->extensionsInitialized(); } void CorePlugin::shutdown() @@ -86,7 +86,7 @@ void CorePlugin::setNelContext(NLMISC::INelContext *nelContext) // This only applies to platforms without PIC, e.g. Windows. nlassert(!NLMISC::INelContext::isContextInitialised()); #endif // NL_OS_WINDOWS - _LibContext = new NLMISC::CLibraryContext(*nelContext); + m_libContext = new NLMISC::CLibraryContext(*nelContext); } QString CorePlugin::name() const @@ -116,8 +116,8 @@ QStringList CorePlugin::dependencies() const void CorePlugin::addAutoReleasedObject(QObject *obj) { - _plugMan->addObject(obj); - _autoReleaseObjects.prepend(obj); + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); } Q_EXPORT_PLUGIN(CorePlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h index ef590e1fc..5c95d22c9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h @@ -63,16 +63,16 @@ public: ExtensionSystem::IPluginManager *pluginManager() const { - return _plugMan; + return m_plugMan; } protected: - NLMISC::CLibraryContext *_LibContext; + NLMISC::CLibraryContext *m_libContext; private: - ExtensionSystem::IPluginManager *_plugMan; - MainWindow *_mainWindow; - QList _autoReleaseObjects; + ExtensionSystem::IPluginManager *m_plugMan; + MainWindow *m_mainWindow; + QList m_autoReleaseObjects; }; } // namespace Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp new file mode 100644 index 000000000..47bf4026a --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp @@ -0,0 +1,187 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "general_settings_page.h" +#include "core_constants.h" +#include "icore.h" + +// NeL includes +#include + +// Qt includes +#include +#include +#include +#include +#include +#include + +namespace Core +{ + +GeneralSettingsPage::GeneralSettingsPage(QObject *parent) + : IOptionsPage(parent), + m_page(0) +{ + m_originalPalette = QApplication::palette(); +} + +GeneralSettingsPage::~GeneralSettingsPage() +{ +} + +QString GeneralSettingsPage::id() const +{ + return QLatin1String("general_settings"); +} + +QString GeneralSettingsPage::trName() const +{ + return tr("General"); +} + +QString GeneralSettingsPage::category() const +{ + return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL); +} + +QString GeneralSettingsPage::trCategory() const +{ + return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL); +} + +void GeneralSettingsPage::applyGeneralSettings() +{ + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Constants::MAIN_WINDOW_SECTION); + QApplication::setStyle(QStyleFactory::create(settings->value(Constants::QT_STYLE, "").toString())); + + if (settings->value(Constants::QT_PALETTE, true).toBool()) + QApplication::setPalette(QApplication::style()->standardPalette()); + else + QApplication::setPalette(m_originalPalette); + settings->endGroup(); +} + +QWidget *GeneralSettingsPage::createPage(QWidget *parent) +{ + m_page = new QWidget(parent); + m_ui.setupUi(m_page); + + readSettings(); + connect(m_ui.languageComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeLanguage(QString))); + connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath())); + connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath())); + connect(m_ui.assetsPathButton, SIGNAL(clicked()), this, SLOT(setAssetsPath())); + return m_page; +} + +void GeneralSettingsPage::apply() +{ + writeSettings(); + applyGeneralSettings(); +} + +void GeneralSettingsPage::finish() +{ + delete m_page; + m_page = 0; +} + +void GeneralSettingsPage::changeLanguage(const QString &lang) +{ + QMessageBox::information(0, tr("Restart required"), + tr("The language change will take effect after a restart of Object Viewer Qt.")); +} + +void GeneralSettingsPage::setPluginsPath() +{ + QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the plugins path"), + m_ui.pluginsPathLineEdit->text()); + if (!newPath.isEmpty()) + { + m_ui.pluginsPathLineEdit->setText(newPath); + } +} + +void GeneralSettingsPage::setLevelDesignPath() +{ + QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the level design path"), + m_ui.leveldesignPathLineEdit->text()); + if (!newPath.isEmpty()) + { + m_ui.leveldesignPathLineEdit->setText(newPath); + } +} + +void GeneralSettingsPage::setAssetsPath() +{ + QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"), + m_ui.assetsPathLineEdit->text()); + if (!newPath.isEmpty()) + { + m_ui.assetsPathLineEdit->setText(newPath); + } +} + +void GeneralSettingsPage::readSettings() +{ + QSettings *settings = Core::ICore::instance()->settings(); + + m_ui.pluginsPathLineEdit->setText(settings->value(Core::Constants::PLUGINS_PATH, "./plugins").toString()); + + settings->beginGroup(Constants::MAIN_WINDOW_SECTION); + m_ui.styleComboBox->addItems(QStyleFactory::keys()); + QString style = settings->value(Constants::QT_STYLE, "").toString(); + if (style == "") + m_ui.styleComboBox->setCurrentIndex(0); + else + m_ui.styleComboBox->setCurrentIndex(m_ui.styleComboBox->findText(style)); + m_ui.paletteCheckBox->setChecked(settings->value(Constants::QT_PALETTE, true).toBool()); + settings->endGroup(); + + QStringList paths; + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + m_ui.leveldesignPathLineEdit->setText(settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString()); + m_ui.assetsPathLineEdit->setText(settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString()); + settings->endGroup(); +} + +void GeneralSettingsPage::writeSettings() +{ + QSettings *settings = Core::ICore::instance()->settings(); + + settings->setValue(Core::Constants::PLUGINS_PATH, m_ui.pluginsPathLineEdit->text()); + + settings->beginGroup(Constants::MAIN_WINDOW_SECTION); + if (m_ui.styleComboBox->currentIndex() == 0) + settings->setValue(Constants::QT_STYLE, ""); + else + settings->setValue(Constants::QT_STYLE, m_ui.styleComboBox->currentText()); + settings->setValue(Constants::QT_PALETTE, m_ui.paletteCheckBox->isChecked()); + settings->endGroup(); + + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->text()); + settings->setValue(Core::Constants::ASSETS_PATH, m_ui.assetsPathLineEdit->text()); + settings->endGroup(); + settings->sync(); +} + +} /* namespace Core */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h new file mode 100644 index 000000000..2f73f8715 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h @@ -0,0 +1,71 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef GENERAL_SETTINGS_PAGE_H +#define GENERAL_SETTINGS_PAGE_H + +#include + +#include "ioptions_page.h" + +#include "ui_general_settings_page.h" + +class QWidget; + +namespace Core +{ +/** +@class GeneralSettingsPage +*/ +class GeneralSettingsPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + GeneralSettingsPage(QObject *parent = 0); + ~GeneralSettingsPage(); + + QString id() const; + QString trName() const; + QString category() const; + QString trCategory() const; + QWidget *createPage(QWidget *parent); + + void apply(); + void finish(); + + void applyGeneralSettings(); + +private Q_SLOTS: + void changeLanguage(const QString &lang); + void setPluginsPath(); + void setLevelDesignPath(); + void setAssetsPath(); + +private: + void readSettings(); + void writeSettings(); + + QPalette m_originalPalette; + QWidget *m_page; + Ui::GeneralSettingsPage m_ui; +}; + +} // namespace Core + +#endif // GENERAL_SETTINGS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui new file mode 100644 index 000000000..d2aa042e3 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui @@ -0,0 +1,199 @@ + + + GeneralSettingsPage + + + + 0 + 0 + 267 + 282 + + + + Form + + + + 6 + + + 3 + + + + + Qt Style + + + + 6 + + + 6 + + + + + + default + + + + + + + + Use style's standard palette + + + + + + + + + + Language + + + + 6 + + + + + false + + + + English + + + + + German + + + + + French + + + + + Russian + + + + + + + + + + + Paths + + + + 6 + + + 6 + + + + + Plugins path: + + + + + + + + 0 + 0 + + + + + + + + ... + + + + + + + Level design path: + + + + + + + + 0 + 0 + + + + + + + + ... + + + + + + + Assets path: + + + + + + + + 0 + 0 + + + + + + + + ... + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h index 8f0c5b4ca..71f075973 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h @@ -59,6 +59,7 @@ public: virtual ExtensionSystem::IPluginManager *pluginManager() const = 0; Q_SIGNALS: + void changeSettings(); void closeMainWindow(); }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp index 44f415a25..e048aa80b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp @@ -60,6 +60,7 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget * m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); m_tabWidget->setMovable(true); + m_tabWidget->setDocumentMode(true); setCentralWidget(m_tabWidget); setDockNestingEnabled(true); @@ -118,6 +119,10 @@ ExtensionSystem::IPluginManager *MainWindow::pluginManager() const return m_pluginManager; } +void MainWindow::open() +{ +} + void MainWindow::checkObject(QObject *obj) { IContext *context = qobject_cast(obj); @@ -133,7 +138,10 @@ bool MainWindow::showOptionsDialog(const QString &group, parent = this; CSettingsDialog settingsDialog(m_pluginManager, group, page, parent); settingsDialog.show(); - return settingsDialog.execDialog(); + bool ok = settingsDialog.execDialog(); + if (ok) + Q_EMIT m_coreImpl->changeSettings(); + return ok; } void MainWindow::about() @@ -177,7 +185,7 @@ void MainWindow::createActions() m_openAction->setShortcut(QKeySequence::Open); m_openAction->setStatusTip(tr("Open an existing file")); menuManager()->registerAction(m_openAction, Constants::OPEN); -// connect(m_openAction, SIGNAL(triggered()), this, SLOT(open())); + connect(m_openAction, SIGNAL(triggered()), this, SLOT(open())); m_exitAction = new QAction(tr("E&xit"), this); m_exitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); @@ -220,6 +228,7 @@ void MainWindow::createMenus() { m_fileMenu = menuBar()->addMenu(tr("&File")); menuManager()->registerMenu(m_fileMenu, Constants::M_FILE); +// m_fileMenu->addAction(m_openAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_exitAction); @@ -260,17 +269,17 @@ void MainWindow::createDialogs() void MainWindow::readSettings() { - m_settings->beginGroup("MainWindow"); - restoreState(m_settings->value("WindowState").toByteArray()); - restoreGeometry(m_settings->value("WindowGeometry").toByteArray()); + m_settings->beginGroup(Constants::MAIN_WINDOW_SECTION); + restoreState(m_settings->value(Constants::MAIN_WINDOW_STATE).toByteArray()); + restoreGeometry(m_settings->value(Constants::MAIN_WINDOW_GEOMETRY).toByteArray()); m_settings->endGroup(); } void MainWindow::writeSettings() { - m_settings->beginGroup("MainWindow"); - m_settings->setValue("WindowState", saveState()); - m_settings->setValue("WindowGeometry", saveGeometry()); + m_settings->beginGroup(Constants::MAIN_WINDOW_SECTION); + m_settings->setValue(Constants::MAIN_WINDOW_STATE, saveState()); + m_settings->setValue(Constants::MAIN_WINDOW_GEOMETRY, saveGeometry()); m_settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h index 21d091ef3..4cc24e5eb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h @@ -59,6 +59,7 @@ public Q_SLOTS: QWidget *parent = 0); private Q_SLOTS: + void open(); void checkObject(QObject *obj); void about(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp index c52624717..6f0fcb47d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp @@ -45,7 +45,7 @@ CSearchPathsSettingsPage::~CSearchPathsSettingsPage() QString CSearchPathsSettingsPage::id() const { - return QLatin1String("SearchPaths"); + return QLatin1String("search_paths"); } QString CSearchPathsSettingsPage::trName() const @@ -55,12 +55,12 @@ QString CSearchPathsSettingsPage::trName() const QString CSearchPathsSettingsPage::category() const { - return QLatin1String("General"); + return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL); } QString CSearchPathsSettingsPage::trCategory() const { - return tr("General"); + return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL); } QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp index 439cce7d9..ad772f593 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp @@ -45,7 +45,7 @@ using namespace Plugin; namespace ExtensionSystem { - class IPluginSpec; +class IPluginSpec; } CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) @@ -53,9 +53,9 @@ CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) _ui.setupUi(this); } -CLogPlugin::~CLogPlugin() +CLogPlugin::~CLogPlugin() { - _plugMan->removeObject(_logSettingsPage); + //_plugMan->removeObject(_logSettingsPage); delete _logSettingsPage; NLMISC::ErrorLog->removeDisplayer(_displayer); @@ -71,7 +71,7 @@ bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr Q_UNUSED(errorString); _plugMan = pluginManager; _logSettingsPage = new CLogSettingsPage(this); - _plugMan->addObject(_logSettingsPage); + //_plugMan->addObject(_logSettingsPage); return true; } @@ -96,12 +96,12 @@ void CLogPlugin::extensionsInitialized() void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) { -#ifdef NL_OS_WINDOWS - // Ensure that a context doesn't exist yet. - // This only applies to platforms without PIC, e.g. Windows. - nlassert(!NLMISC::INelContext::isContextInitialised()); +#ifdef NL_OS_WINDOWS + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); #endif // fdef NL_OS_WINDOWS^M - _LibContext = new NLMISC::CLibraryContext(*nelContext); + _LibContext = new NLMISC::CLibraryContext(*nelContext); _displayer = new NLQT::CQtDisplayer(_ui.plainTextEdit); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui index 404444fc0..77c4b895f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui @@ -91,7 +91,7 @@ - true + false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp index 4e11ee15c..eabb67f3d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp @@ -25,8 +25,6 @@ // Qt includes #include #include -#include -#include // NeL includes #include @@ -75,11 +73,6 @@ QWidget *GraphicsSettingsPage::createPage(QWidget *parent) m_ui.squareBloomCheckBox->setChecked(NL3D::CBloomEffect::instance().getSquareBloom()); m_ui.bloomDensityHorizontalSlider->setValue(NL3D::CBloomEffect::instance().getDensityBloom()); - m_ui.styleComboBox->addItems(QStyleFactory::keys()); - QString style = settings->value(Constants::QT_STYLE, "").toString(); - m_ui.styleComboBox->setCurrentIndex(m_ui.styleComboBox->findText(style)); - m_ui.paletteCheckBox->setChecked(settings->value(Constants::QT_PALETTE, true).toBool()); - settings->endGroup(); connect(m_ui.enableBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableBloom(bool))); @@ -103,16 +96,6 @@ void GraphicsSettingsPage::apply() settings->setValue(Constants::ENABLE_BLOOM, m_ui.enableBloomCheckBox->isChecked()); settings->setValue(Constants::ENABLE_SQUARE_BLOOM, m_ui.squareBloomCheckBox->isChecked()); settings->setValue(Constants::BLOOM_DENSITY, m_ui.bloomDensityHorizontalSlider->value()); - settings->setValue(Constants::QT_STYLE, m_ui.styleComboBox->currentText()); - settings->setValue(Constants::QT_PALETTE, m_ui.paletteCheckBox->isChecked()); - - // apply qt style and palette - QApplication::setStyle(QStyleFactory::create(m_ui.styleComboBox->currentText())); - - if (m_ui.paletteCheckBox->isChecked()) - QApplication::setPalette(QApplication::style()->standardPalette()); - else - QApplication::setPalette(Modules::mainWin().getOriginalPalette()); settings->endGroup(); settings->sync(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui index 24058d3d3..e6b4952a5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui @@ -117,50 +117,7 @@ - - - - Qt Style - - - - - - - - Style - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Use style's standard palette - - - - - - - + false @@ -170,14 +127,14 @@ - + false - + false @@ -187,7 +144,7 @@ - + Qt::Vertical diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp index fa077cfed..6e183d913 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp @@ -66,7 +66,7 @@ CMainWindow::CMainWindow(QWidget *parent) _isGraphicsInitialized(false), _isGraphicsEnabled(false), _isSoundInitialized(false), - _isSoundEnabled(false), + _isSoundEnabled(true), _GraphicsViewport(NULL), _lastDir("."), _mouseMode(NL3D::U3dMouseListener::edit3d) @@ -80,19 +80,6 @@ CMainWindow::CMainWindow(QWidget *parent) setDockNestingEnabled(true); - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(Constants::OBJECT_VIEWER_SECTION); - - // setup Qt style and palette from config file - _originalPalette = QApplication::palette(); - - QApplication::setStyle(QStyleFactory::create(settings->value(Constants::QT_STYLE, "").toString())); - - if (settings->value(Constants::QT_PALETTE, true).toBool()) - QApplication::setPalette(QApplication::style()->standardPalette()); - else - QApplication::setPalette(_originalPalette); - _GraphicsViewport->init(); _isGraphicsInitialized = true; @@ -111,6 +98,9 @@ CMainWindow::CMainWindow(QWidget *parent) setWindowIcon(QIcon(":/images/nel.png")); + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::OBJECT_VIEWER_SECTION); + restoreState(settings->value("QtWindowState").toByteArray()); restoreGeometry(settings->value("QtWindowGeometry").toByteArray()); @@ -484,22 +474,6 @@ bool CMainWindow::loadFile(const QString &fileName, const QString &skelName) return true; } -void CMainWindow::cfcbQtStyle(NLMISC::CConfigFile::CVar &var) -{ - QApplication::setStyle(QStyleFactory::create(var.asString().c_str())); -} - -void CMainWindow::cfcbQtPalette(NLMISC::CConfigFile::CVar &var) -{ - if (var.asBool()) QApplication::setPalette(QApplication::style()->standardPalette()); - else QApplication::setPalette(_originalPalette); -} - -void CMainWindow::cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var) -{ - _isSoundEnabled = var.asBool(); // update loop inits -} - void CMainWindow::updateRender() { if (isVisible()) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h index 3a6411df2..52b3dc8d5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h @@ -71,10 +71,6 @@ public: { return _SkeletonTreeModel; } - QPalette getOriginalPalette() const - { - return _originalPalette; - } private Q_SLOTS: void open(); @@ -96,10 +92,6 @@ private: bool loadFile(const QString &fileName, const QString &skelName); - void cfcbQtStyle(NLMISC::CConfigFile::CVar &var); - void cfcbQtPalette(NLMISC::CConfigFile::CVar &var); - void cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var); - bool _isGraphicsInitialized, _isGraphicsEnabled; bool _isSoundInitialized, _isSoundEnabled; @@ -122,7 +114,6 @@ private: CCameraControl *_cameraControl; - QPalette _originalPalette; QString _lastDir; QTimer *_mainTimer; From 3079e1d2f79b955155f7e176532fc46f438eb105 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 20:51:29 +0300 Subject: [PATCH 16/29] Fixed: Crash the ovqt in ps editor. --- code/nel/tools/3d/object_viewer_qt/src/main.cpp | 2 +- .../plugins/object_viewer/particle_workspace_dialog.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/nel/tools/3d/object_viewer_qt/src/main.cpp index 8588c148a..15173fa5c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main.cpp @@ -153,7 +153,7 @@ sint main(int argc, char **argv) #if !defined(NL_OS_MAC) pluginPaths << settings->value("PluginPath", "./plugins").toString(); #else - pluginPaths << qApp->applicationDirPath() + QString("/../PlugIns/ovqt"); + pluginPaths << settings->value("PluginPath", qApp->applicationDirPath() + QString("/../PlugIns/ovqt")).toString(); #endif pluginManager.setPluginPaths(pluginPaths); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index 50698198b..4d6d35c9f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -222,24 +222,27 @@ void CParticleWorkspaceDialog::touchPSState(CParticleTreeItem *item) void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) { - if (_currentItem != NULL) + if (_currentItem != 0) _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); _currentItem = static_cast(index.internalPointer()); + + if (_currentItem == 0) + return; if (index.flags() != Qt::NoItemFlags) _PropertyDialog->setCurrentEditedElement(_currentItem); if ((_currentItem->itemType() == ItemType::Workspace) || (_currentItem->itemType() == ItemType::ParticleSystemNotLoaded)) - _currentItem = NULL; + _currentItem = 0; } void CParticleWorkspaceDialog::customContextMenu() { if (!Modules::psEdit().getParticleWorkspace()) return; clickedItem(_ui.treeView->currentIndex()); - if (_currentItem == NULL) return; + if (_currentItem == 0) return; QMenu *popurMenu = new QMenu(this); switch (_currentItem->itemType()) { From 15ef109f5818b573c9ffa18b8a3ff663157db55a Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Mon, 9 May 2011 23:46:14 +0300 Subject: [PATCH 17/29] Fixed: #1193 Fixed flickering graphics viewport under windows. --- .../src/plugins/core/core_constants.h | 2 +- .../src/plugins/example/qnel_widget.cpp | 3 ++ .../plugins/object_viewer/global_wind_form.ui | 10 ++++- .../object_viewer/graphics_viewport.cpp | 38 ++----------------- .../plugins/object_viewer/graphics_viewport.h | 4 -- .../plugins/object_viewer/tune_timer_form.ui | 14 +++++-- 6 files changed, 26 insertions(+), 45 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index eb59cddd2..a3b7c0d72 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -77,7 +77,7 @@ const char * const DATA_PATH_SECTION = "DataPath"; const char * const SEARCH_PATHS = "SearchPaths"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; const char * const LEVELDESIGN_PATH = "LevelDesignPath"; -const char * const ASSETS_PATH = "LevelDesignPath"; +const char * const ASSETS_PATH = "AssetsPath"; //resources const char * const ICON_NEL = ":/core/images/nel.png"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp index 9a67abb80..759e8f304 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp @@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent) m_initialized(false), m_interval(25) { + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_PaintOnScreen); setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui index 971d16c60..bb266f650 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui @@ -6,8 +6,8 @@ 0 0 - 195 - 64 + 192 + 52 @@ -21,6 +21,12 @@ + + 3 + + + 3 + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp index 2a15932b7..7eaed0a1b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp @@ -49,6 +49,9 @@ namespace NLQT CGraphicsViewport::CGraphicsViewport(QWidget *parent) : QNLWidget(parent) { + setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_PaintOnScreen); } CGraphicsViewport::~CGraphicsViewport() @@ -77,7 +80,7 @@ void CGraphicsViewport::release() { //H_AUTO2 nldebug("CGraphicsViewport::release"); - + Modules::veget().release(); Modules::psEdit().release(); Modules::objView().release(); @@ -119,39 +122,6 @@ void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent) Modules::objView().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height()); } -#if defined(NL_OS_MAC) -// Qt does not provide wheel events through winEvent() and macEvent() (but it -// does through x11Event(), which is inconsistent...) -// Workaround is to handle wheel events like implemented below. -// -// TODO: this is not a clean solution, because all but wheel events are -// handled using winEvent(), x11Event(), macEvent(). But this seems to be a -// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm) -void CGraphicsViewport::wheelEvent(QWheelEvent *event) -{ - // Get relative positions. - float fX = 1.0f - (float)event->pos().x() / this->width(); - float fY = 1.0f - (float)event->pos().y() / this->height(); - - // Get the buttons currently pressed. - uint32 buttons = NLMISC::noButton; - if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton; - if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton; - if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton; - if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton; - if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton; - if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton; - - if(event->delta() > 0) - Modules::objView().getDriver()->EventServer.postEvent( - new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL)); - else - Modules::objView().getDriver()->EventServer.postEvent( - new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL)); -} -#endif // defined(NL_OS_MAC) - - #if defined(NL_OS_WINDOWS) typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h index 00b2c80d2..d810d8c01 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h @@ -80,10 +80,6 @@ private Q_SLOTS: protected: virtual void resizeEvent(QResizeEvent *resizeEvent); -#if defined(NL_OS_MAC) - virtual void wheelEvent(QWheelEvent *event); -#endif - #if defined(NL_OS_WINDOWS) virtual bool winEvent(MSG *message, long *result); #elif defined(NL_OS_MAC) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui index f2f883263..8288747ce 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui @@ -6,14 +6,14 @@ 0 0 - 460 - 64 + 452 + 52 - 86 - 64 + 0 + 0 @@ -24,6 +24,12 @@ + + 3 + + + 3 + From 2e4b7777bda6e727930e0339e980754285dd8ff0 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 12 May 2011 12:49:17 +0200 Subject: [PATCH 18/29] Fixed: #1177 VS 2010 does not work under CMake --- code/CMakeLists.txt | 9 +++---- code/CMakeModules/nel.cmake | 27 ++++++++++--------- .../src/interface_v3/ctrl_text_button.cpp | 4 +-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 151dd5e4d..3f477d9c4 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -41,10 +41,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. CHECK_OUT_OF_SOURCE() -# Variables which must be set before PROJECT -NL_SETUP_BUILD() -NL_SETUP_BUILD_FLAGS() - CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 0) @@ -52,6 +48,9 @@ SET(NL_VERSION_MINOR 8) SET(NL_VERSION_PATCH 0) SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") +NL_SETUP_BUILD() +NL_SETUP_BUILD_FLAGS() + #----------------------------------------------------------------------------- # Redirect output files SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -109,7 +108,7 @@ IF(WIN32) GET_FILENAME_COMPONENT(VC_ROOT_PATH "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) # convert IDE fullpath to VC++ path STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_PATH}) - ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC") + ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC") ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") IF(WITH_MFC) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index cf6154648..dbe0991a4 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -37,16 +37,15 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) + IF(NOT MSVC10) + SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) + ENDIF(NOT MSVC10) GET_TARGET_PROPERTY(type ${name} TYPE) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} - INSTALL_NAME_DIR ${NL_LIB_PREFIX} - PROJECT_LABEL ${label}) - ELSE(${type} STREQUAL SHARED_LIBRARY) - SET_TARGET_PROPERTIES(${name} PROPERTIES - PROJECT_LABEL ${label}) + INSTALL_NAME_DIR ${NL_LIB_PREFIX}) ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") @@ -288,10 +287,17 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(WIN32) - # don't use a /O[012x] flag if you want custom optimizations - SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") - # without inlining it's unusable, use custom optimizations again - SET(MIN_OPTIMIZATIONS "/Ob1") + IF(MSVC10) + # /Ox is working with VC++ 2010, but custom optimizations don't exist + SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Od /Ob1") + ELSE(MSVC10) + # don't use a /O[012x] flag if you want custom optimizations + SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Ob1") + ENDIF(MSVC10) SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000") @@ -347,9 +353,6 @@ MACRO(NL_SETUP_BUILD) ENDMACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD_FLAGS) - #SET(CMAKE_DEBUG_POSTFIX "_d") - #SET(CMAKE_RELEASE_POSTFIX "_r") - SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE) diff --git a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp index d2191a4eb..55cae37e3 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp @@ -113,8 +113,8 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) _TextureIdOver[2].setTexture((TxName+"_r.tga").c_str()); } - // Compute Bmp Sizes - nlctassert(NumTexture==3); + // Compute Bmp Sizes (crash with VC++ 2010) +// nlctassert(NumTexture==3); rVR.getTextureSizeFromId(_TextureIdNormal[0], _BmpLeftW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[1], _BmpMiddleW, _BmpH); rVR.getTextureSizeFromId(_TextureIdNormal[2], _BmpRightW, _BmpH); From f87a76b31f2042df41b292769af785c1ea38840f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 13:56:25 +0200 Subject: [PATCH 19/29] Fixed: Some parameters were forgotten while compiling PCH --- code/CMakeModules/PCHSupport.cmake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 74d009864..7bd202d0d 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -45,8 +45,6 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) LIST(APPEND ${_out_compile_flags} "-fPIC") ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - ELSE(CMAKE_COMPILER_IS_GNUCXX) - ## TODO ... ? or does it work out of the box ENDIF(CMAKE_COMPILER_IS_GNUCXX) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) @@ -115,6 +113,11 @@ MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output) ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input) MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + IF(${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + ENDIF(${oldProps} MATCHES NOTFOUND) + IF(CMAKE_COMPILER_IS_GNUCXX) # to do: test whether compiler flags match between target _targetName # and _pch_output_to_use @@ -123,19 +126,15 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) # for use with distcc and gcc >4.0.1 if preprocessed files are accessible # on all remote machines set # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess - SET(_target_cflags "${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch") + SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch") ELSE(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) - SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"") ENDIF(MSVC) ENDIF(CMAKE_COMPILER_IS_GNUCXX) SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) + SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${_target_cflags}) ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use}) ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName}) ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) From 7b472a2456b0a064dd3739b565cca0bd2408ac18 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 13:58:39 +0200 Subject: [PATCH 20/29] Fixed: Use of Windows SDK 7.1 with VC++ 2010 if found --- code/CMakeModules/FindWindowsSDK.cmake | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 04059a6a5..30e507f85 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -9,17 +9,32 @@ IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FIND_QUIETLY TRUE) ENDIF(WINSDK_INCLUDE_DIR) +GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE) +GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME) + +IF(WINSDK71_DIR) + IF(NOT WINSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}") + ENDIF(NOT WINSDK_FIND_QUIETLY) +ENDIF(WINSDK71_DIR) + +GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE) +GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME) + +IF(WINSDKCURRENT_DIR) + IF(NOT WINSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}") + ENDIF(NOT WINSDK_FIND_QUIETLY) +ENDIF(WINSDKCURRENT_DIR) + FIND_PATH(WINSDK_INCLUDE_DIR Windows.h PATHS - "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include" + ${WINSDK71_DIR}/Include + ${WINSDKCURRENT_DIR}/Include ) IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND TRUE) - IF(NOT WINSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows SDK.") - ENDIF(NOT WINSDK_FIND_QUIETLY) ELSE(WINSDK_INCLUDE_DIR) IF(NOT WINSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") From 3eb4b064fb2263648f90c9e0d710dcfa44631e1d Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:02:53 +0200 Subject: [PATCH 21/29] Changed: Use of LIB_PREFIX only if defined Changed: Compilation with all cores for VC++ 2008 and 2010 Changed: New method to determine the target CPU --- code/CMakeModules/nel.cmake | 42 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index dbe0991a4..c123ca8a8 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -44,8 +44,10 @@ MACRO(NL_DEFAULT_PROPS name label) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library SET_TARGET_PROPERTIES(${name} PROPERTIES - VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} - INSTALL_NAME_DIR ${NL_LIB_PREFIX}) + VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}) + IF(LIB_PREFIX) + SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${LIB_PREFIX}) + ENDIF(LIB_PREFIX) ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") @@ -299,7 +301,7 @@ MACRO(NL_SETUP_BUILD) SET(MIN_OPTIMIZATIONS "/Ob1") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000") + SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP") # Exceptions are only set for C++ SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") @@ -332,23 +334,25 @@ MACRO(NL_SETUP_BUILD) ENDIF(WIN32) - # Determine host CPU - IF(UNIX AND NOT WIN32) - FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) - IF(CMAKE_UNAME) - EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) - SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)") - IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ADD_DEFINITIONS(-DHAVE_X86_64) - ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") - ADD_DEFINITIONS(-DHAVE_IA64) - ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ADD_DEFINITIONS(-DHAVE_X86) - ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - ELSE(CMAKE_UNAME) # Assume that if uname is not found that we're x86. + # Determine target CPU + IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") + IF(NOT CMAKE_SIZEOF_VOID_P) + INCLUDE (CheckTypeSize) + CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) + ENDIF(NOT CMAKE_SIZEOF_VOID_P) + + # Using 32 or 64 bits libraries + SET(TARGET_X86 1) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86_64") + SET(TARGET_X64 1) + ADD_DEFINITIONS(-DHAVE_X86_64) + ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86") ADD_DEFINITIONS(-DHAVE_X86) - ENDIF(CMAKE_UNAME) - ENDIF(UNIX AND NOT WIN32) + ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) +# ADD_DEFINITIONS(-DHAVE_IA64) + ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") ENDMACRO(NL_SETUP_BUILD) From 87aa990f3a89a409357261b9cbb0474aca6764bf Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:04:03 +0200 Subject: [PATCH 22/29] Changed: Some code simplifications --- code/CMakeModules/FindExternal.cmake | 39 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 3ca7774ba..436997d99 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -7,7 +7,7 @@ # EXTERNAL_FOUND - True if the external libraries are available SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH}) -SET(EXTERNAL_TEMP_FILE "include/png.h") +SET(EXTERNAL_TEMP_FILE "include/zlib.h") SET(EXTERNAL_NAME "external") # If using STLport preprend external_stlport @@ -17,36 +17,35 @@ IF(WITH_STLPORT) SET(EXTERNAL_NAME "external with STLport") ENDIF(WITH_STLPORT) -SET(EXTERNAL_FOUND FALSE) -FOREACH(ITEM ${EXTERNAL_TEMP_PATH}) - IF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND) - SET(EXTERNAL_FOUND TRUE) - # Get absolute path to avoid .. - GET_FILENAME_COMPONENT(ITEM ${ITEM} ABSOLUTE) - SET(EXTERNAL_PATH ${ITEM} CACHE PATH "" FORCE) - ENDIF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND) -ENDFOREACH(ITEM ${EXTERNAL_TEMP_PATH}) +FIND_PATH(EXTERNAL_PATH + ${EXTERNAL_TEMP_FILE} + PATHS + $ENV{EXTERNAL_PATH} + ${EXTERNAL_TEMP_PATH} + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt +) -IF(EXTERNAL_FOUND) +IF(EXTERNAL_PATH) + SET(EXTERNAL_FOUND TRUE) SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") - IF(NOT CMAKE_SIZEOF_VOID_P) - INCLUDE (CheckTypeSize) - CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) - ENDIF(NOT CMAKE_SIZEOF_VOID_P) - # Using 32 or 64 bits libraries - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + IF(TARGET_X64) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + ELSE(TARGET_X64) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib") - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) + ENDIF(TARGET_X64) SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}") # Stupid hack for FindOpenAL.cmake SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}") SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}") -ENDIF(EXTERNAL_FOUND) +ENDIF(EXTERNAL_PATH) IF(EXTERNAL_FOUND) IF(NOT External_FIND_QUIETLY) From 5b9b5300135f914f3cad25f723b41bf04b8c3c38 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:05:31 +0200 Subject: [PATCH 23/29] Fixed: Didn't display any error when DirectX SDK was not found Changed: Use of new variables to detect 64bits arch --- code/CMakeModules/FindDirectXSDK.cmake | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/code/CMakeModules/FindDirectXSDK.cmake b/code/CMakeModules/FindDirectXSDK.cmake index d21261b95..1f832cf95 100644 --- a/code/CMakeModules/FindDirectXSDK.cmake +++ b/code/CMakeModules/FindDirectXSDK.cmake @@ -30,16 +30,11 @@ ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) IF(DXSDK_DIR) SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include") - IF(NOT CMAKE_SIZEOF_VOID_P) - INCLUDE (CheckTypeSize) - CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) - ENDIF(NOT CMAKE_SIZEOF_VOID_P) - - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + IF(TARGET_X64) SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x64") - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + ELSE(TARGET_X64) SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x86") - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) + ENDIF(TARGET_X64) FIND_DXSDK_LIBRARY(DXSDK_GUID_LIBRARY dxguid) FIND_DXSDK_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8) @@ -59,7 +54,7 @@ ENDIF(DXSDK_DIR) # all listed variables are TRUE. INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY) MARK_AS_ADVANCED(DXSDK_INCLUDE_DIR DXSDK_GUID_LIBRARY From a4e5d88f5bfbf6356a78d3e78afb1b04d2d7cf71 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:05:45 +0200 Subject: [PATCH 24/29] Changed: Use of new variables to detect 64bits arch --- code/CMakeModules/FindCustomMFC.cmake | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index e37936ef0..7dd87c15f 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -40,17 +40,12 @@ ENDIF(WITH_STLPORT OR NOT MFC_FOUND) # Only if using a custom path IF(CUSTOM_MFC_DIR) - IF(NOT CMAKE_SIZEOF_VOID_P) - INCLUDE (CheckTypeSize) - CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) - ENDIF(NOT CMAKE_SIZEOF_VOID_P) - # Using 32 or 64 bits libraries - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + IF(TARGET_X64) SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64") - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + ELSE(TARGET_X64) SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib") - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) + ENDIF(TARGET_X64) # Add MFC libraries directory to default library path LINK_DIRECTORIES(${MFC_LIBRARY_DIR}) From d76e14c158a1fe3855410a6fa0b13985255282f3 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 16:08:58 +0200 Subject: [PATCH 25/29] Changed: Replaced LIB_PREFIX by NL_LIB_PREFIX --- code/CMakeModules/nel.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index c123ca8a8..f20febe4d 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -45,9 +45,9 @@ MACRO(NL_DEFAULT_PROPS name label) # Set versions only if target is a shared library SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}) - IF(LIB_PREFIX) - SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${LIB_PREFIX}) - ENDIF(LIB_PREFIX) + IF(NL_LIB_PREFIX) + SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) + ENDIF(NL_LIB_PREFIX) ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") From 2d8136a283d8e9209d3ffe62d0e079d9261f1dea Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 15 May 2011 17:11:16 +0200 Subject: [PATCH 26/29] Changed: #1275 Create an OpenGL ES driver --- .../driver/opengl/driver_opengl_material.cpp | 29 ++++++++-- .../3d/driver/opengl/driver_opengl_states.h | 14 +++-- .../driver/opengl/driver_opengl_texture.cpp | 29 ++++++++++ .../driver_opengl_vertex_buffer_hard.cpp | 53 ++++++++++++++++++- .../3d/driver/opengl/driver_opengl_window.cpp | 4 ++ 5 files changed, 119 insertions(+), 10 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 9dd08a51f..c7bc0d35d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -35,10 +35,18 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum) case CMaterial::srccolor: glenum=GL_SRC_COLOR; break; case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break; // Extended Blend modes. +#ifdef USE_OPENGLES + case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR; break; + case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR; break; + case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA; break; + case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA; break; +#else case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break; case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA_EXT; break; +#endif + default: nlstop; } } @@ -242,7 +250,9 @@ void CDriverGL::setTextureShaders(const uint8 *addressingModes, const CSmartPtr< if (glAddrMode != _CurrentTexAddrMode[stage]) // addressing mode different from the one in the device? { _DriverGLStates.activeTextureARB(stage); +#ifndef USE_OPENGLES glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, glAddrMode); +#endif _CurrentTexAddrMode[stage] = glAddrMode; } } @@ -1971,7 +1981,9 @@ void CDriverGL::endCloudMultiPass() nlassert(_CurrentMaterial->getShader() == CMaterial::Cloud); if (ATICloudShaderHandle) { +#ifndef USE_OPENGLES glDisable(GL_FRAGMENT_SHADER_ATI); +#endif } } @@ -1989,7 +2001,9 @@ sint CDriverGL::beginWaterMultiPass() */ void CDriverGL::setupWaterPassR200(const CMaterial &mat) { - H_AUTO_OGL(CDriverGL_setupWaterPassR200) + H_AUTO_OGL(CDriverGL_setupWaterPassR200); + +#ifndef USE_OPENGLES uint k; ITexture *tex = mat.getTexture(0); if (tex) @@ -2061,6 +2075,7 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat) float cst[4] = { 1.f, 1.f, 1.f, 0.f }; nglSetFragmentShaderConstantATI(GL_CON_0_ATI, cst); } +#endif } // *************************************************************************** @@ -2068,7 +2083,9 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat) */ void CDriverGL::setupWaterPassARB(const CMaterial &mat) { - H_AUTO_OGL(CDriverGL_setupWaterPassARB) + H_AUTO_OGL(CDriverGL_setupWaterPassARB); + +#ifndef USE_OPENGLES uint k; ITexture *tex = mat.getTexture(0); if (tex) @@ -2147,6 +2164,7 @@ void CDriverGL::setupWaterPassARB(const CMaterial &mat) } } } +#endif } // *************************************************************************** @@ -2175,6 +2193,7 @@ void CDriverGL::setupWaterPassNV20(const CMaterial &mat) { H_AUTO_OGL(CDriverGL_setupWaterPassNV20) +#ifndef USE_OPENGLES static bool setupDone = false; static CMaterial::CTexEnv texEnvReplace; static CMaterial::CTexEnv texEnvModulate; @@ -2259,6 +2278,7 @@ void CDriverGL::setupWaterPassNV20(const CMaterial &mat) activateTexEnvMode(2, texEnvReplace); activateTexEnvMode(3, texEnvModulate); } +#endif } // *************************************************************************** @@ -2286,7 +2306,9 @@ void CDriverGL::setupWaterPass(uint /* pass */) // *************************************************************************** void CDriverGL::endWaterMultiPass() { - H_AUTO_OGL(CDriverGL_endWaterMultiPass) + H_AUTO_OGL(CDriverGL_endWaterMultiPass); + +#ifndef USE_OPENGLES nlassert(_CurrentMaterial->getShader() == CMaterial::Water); // NB : as fragment shaders / programs bypass the texture envs, no special env enum is added (c.f CTexEnvSpecial) if (_Extensions.NVTextureShader) return; @@ -2298,6 +2320,7 @@ void CDriverGL::endWaterMultiPass() { glDisable(GL_FRAGMENT_SHADER_ATI); } +#endif } } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.h b/code/nel/src/3d/driver/opengl/driver_opengl_states.h index 9a8aa3e4f..e3820c4a8 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.h @@ -20,11 +20,15 @@ #include "nel/misc/types_nl.h" #include "nel/3d/vertex_buffer.h" -#ifdef NL_OS_MAC -# define GL_GLEXT_LEGACY -# include +#ifdef USE_OPENGLES +# include #else -# include +# ifdef NL_OS_MAC +# define GL_GLEXT_LEGACY +# include +# else +# include +# endif #endif @@ -41,7 +45,7 @@ namespace NL3D - GL_ALPHA_TEST - GL_LIGHTING - GL_LIGHT0 + i ..... - - GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB. + - GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB/OES. - GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R - GL_COLOR_MATERIAL - GL_FOG diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 6079dc6f3..f3e59c65e 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -155,7 +155,11 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) // check status GLenum status; +#ifdef USE_OPENGLES + status = (GLenum) nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); +#else status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); +#endif switch(status) { case GL_FRAMEBUFFER_COMPLETE_EXT: InitFBO = true; @@ -204,12 +208,24 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) // clean up resources if allocation failed if (!InitFBO) { +#ifdef USE_OPENGLES + nglDeleteFramebuffersOES(1, &FBOId); +#else nglDeleteFramebuffersEXT(1, &FBOId); +#endif if (AttachDepthStencil) { +#ifdef USE_OPENGLES + nglDeleteRenderbuffersOES(1, &DepthFBOId); +#else nglDeleteRenderbuffersEXT(1, &DepthFBOId); +#endif if(!UsePackedDepthStencil) +#ifdef USE_OPENGLES + nglDeleteRenderbuffersOES(1, &StencilFBOId); +#else nglDeleteRenderbuffersEXT(1, &StencilFBOId); +#endif } } @@ -226,14 +242,22 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex) if(initFrameBufferObject(tex)) { glBindTexture(TextureMode, 0); +#ifdef USE_OPENGLES + nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId); +#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId); +#endif } else return false; } else { +#ifdef USE_OPENGLES + nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); +#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +#endif } return true; @@ -840,8 +864,13 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, sint size= tex.getPixels(i).size(); if (bUpload) { +#ifdef USE_OPENGLES + glCompressedTexImage2D (GL_TEXTURE_2D, i-decalMipMapResize, glfmt, + tex.getWidth(i),tex.getHeight(i), 0, size, ptr); +#else nglCompressedTexImage2DARB (GL_TEXTURE_2D, i-decalMipMapResize, glfmt, tex.getWidth(i),tex.getHeight(i), 0, size, ptr); +#endif bAllUploaded = true; } else diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 3c74d02b4..ba471b8dd 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -69,7 +69,7 @@ IVertexBufferHardGL::~IVertexBufferHardGL() H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor) } - +#ifndef USE_OPENGLES // *************************************************************************** // *************************************************************************** @@ -1133,7 +1133,7 @@ void CVertexArrayRangeMapObjectATI::updateLostBuffers() } #endif - +#endif // USE_OPENGLES // *************************************************************************** @@ -1328,6 +1328,12 @@ CVertexBufferHardARB::CVertexBufferHardARB(CDriverGL *drv, CVertexBuffer *vb) : #ifdef NL_DEBUG _Unmapping = false; #endif + +#ifdef USE_OPENGLES + _Buffer = NULL; + _BufferSize = 0; + _LastBufferSize = 0; +#endif } // *************************************************************************** @@ -1369,6 +1375,14 @@ CVertexBufferHardARB::~CVertexBufferHardARB() _VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList); } #endif + +#ifdef USE_OPENGLES + if (_Buffer) + { + delete [] _Buffer; + _Buffer = NULL; + } +#endif } // *************************************************************************** @@ -1450,6 +1464,39 @@ void *CVertexBufferHardARB::lock() beforeLock= CTime::getPerformanceTime(); } _Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId); + +#ifdef USE_OPENGLES + if (_Driver->_Extensions.OESMapBuffer) + { + _VertexPtr = nglMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES); + if (!_VertexPtr) + { + nglUnmapBufferOES(GL_ARRAY_BUFFER); + nlassert(glIsBuffer(_VertexObjectId)); + invalidate(); + return &_DummyVB[0]; + } + } + else + { + const uint size = VB->getNumVertices() * VB->getVertexSize(); + + if (size > _BufferSize) + { + if (_Buffer) delete [] _Buffer; + + _Buffer = new uint8[size+3]; + _BufferSize = size; + } + + uint8 offset = (size_t)_Buffer % 4; + + if (offset > 0) offset = 4 - offset; + + _VertexPtr = _Buffer + offset; + _LastBufferSize = size; + } +#else _VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); if (!_VertexPtr) { @@ -1458,6 +1505,8 @@ void *CVertexBufferHardARB::lock() invalidate(); return &_DummyVB[0]; } +#endif + #ifdef NL_DEBUG _VertexArrayRange->_MappedVBList.push_front(this); _IteratorInMappedVBList = _VertexArrayRange->_MappedVBList.begin(); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 48af6cf05..eb3083729 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -2376,11 +2376,15 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height) if (_CurrentMode.OffScreen) { #ifdef NL_OS_WINDOWS + +#ifndef USE_OPENGLES if (_PBuffer) { nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ); nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ); } +#endif + #endif } else From d6b53a3ceffb16afc2f7bc7033b1d2e5f6a9a93f Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 20 May 2011 21:32:31 +0200 Subject: [PATCH 27/29] Fixed: #1297 CMake - improper detection architecture under linux (patch provided by Naush) --- code/CMakeModules/nel.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index f20febe4d..20364b1ef 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -335,7 +335,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(WIN32) # Determine target CPU - IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") +# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") IF(NOT CMAKE_SIZEOF_VOID_P) INCLUDE (CheckTypeSize) CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) @@ -352,7 +352,7 @@ MACRO(NL_SETUP_BUILD) ADD_DEFINITIONS(-DHAVE_X86) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) # ADD_DEFINITIONS(-DHAVE_IA64) - ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") +# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") ENDMACRO(NL_SETUP_BUILD) From 351047bb515b618956c4c75eec3853094c1d54ed Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 21 May 2011 01:54:20 +0300 Subject: [PATCH 28/29] Fixed: #1193 Settings of "remap extensions" loads from settings file. --- .../object_viewer_qt/src/plugins/core/core_constants.h | 1 + .../src/plugins/core/search_paths_settings_page.cpp | 9 ++++++--- .../src/plugins/core/search_paths_settings_page.h | 1 + .../object_viewer_qt/src/plugins/example/qnel_widget.cpp | 2 +- .../src/plugins/object_viewer/graphics_viewport.cpp | 2 +- .../plugins/object_viewer/particle_workspace_dialog.cpp | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index a3b7c0d72..b902b6c0f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -78,6 +78,7 @@ const char * const SEARCH_PATHS = "SearchPaths"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; const char * const LEVELDESIGN_PATH = "LevelDesignPath"; const char * const ASSETS_PATH = "AssetsPath"; +const char * const REMAP_EXTENSIONS = "RemapExtensions"; //resources const char * const ICON_NEL = ":/core/images/nel.png"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp index 6f0fcb47d..94ebec8d1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp @@ -92,17 +92,20 @@ void CSearchPathsSettingsPage::finish() void CSearchPathsSettingsPage::applySearchPaths() { - QStringList paths; + QStringList paths, remapExt; QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); + remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList(); settings->endGroup(); + + for (int i = 1; i < remapExt.size(); i += 2) + NLMISC::CPath::remapExtension(remapExt.at(i - 1).toStdString(), remapExt.at(i).toStdString(), true); + Q_FOREACH(QString path, paths) { NLMISC::CPath::addSearchPath(path.toStdString(), false, false); } - NLMISC::CPath::remapExtension("png", "tga", true); - NLMISC::CPath::remapExtension("png", "dds", true); } void CSearchPathsSettingsPage::addPath() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h index 15f28f6c8..90eab513a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h @@ -49,6 +49,7 @@ public: void apply(); void finish(); + // Set of the search paths(not recursive) and the remap extensions (loading from settings file) void applySearchPaths(); private Q_SLOTS: diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp index 759e8f304..4872923db 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp @@ -38,7 +38,7 @@ QNLWidget::QNLWidget(QWidget *parent) m_initialized(false), m_interval(25) { - setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_PaintOnScreen); setMouseTracking(true); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp index 7eaed0a1b..c5d1ae677 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp @@ -49,7 +49,7 @@ namespace NLQT CGraphicsViewport::CGraphicsViewport(QWidget *parent) : QNLWidget(parent) { - setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_PaintOnScreen); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index 4d6d35c9f..858922af1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -226,7 +226,7 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); _currentItem = static_cast(index.internalPointer()); - + if (_currentItem == 0) return; From a2c71aba53355812954431551420f4fb94177557 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 21 May 2011 03:50:01 +0300 Subject: [PATCH 29/29] Fixed: #1193 Updated icon. --- .../src/plugins/object_viewer/animation_form.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui index 90d496d17..3660afe45 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui @@ -193,7 +193,7 @@ - :/images/animset.png:/images/animset.png + :/icons/ic_nel_animset.png:/icons/ic_nel_animset.png