From b6ca251a8de0fb938facab824f68ced4a8b94352 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 6 Oct 2013 15:50:49 +0200 Subject: [PATCH] Merge with default --- code/CMakeLists.txt | 7 +- code/CMakeModules/FindLua52.cmake | 81 + code/CMakeModules/FindLuabind.cmake | 45 + code/CMakeModules/FindMSVC.cmake | 30 +- code/CMakeModules/FindWindowsSDK.cmake | 219 ++- code/CMakeModules/PCHSupport.cmake | 36 +- code/CMakeModules/nel.cmake | 3 +- code/nel/include/nel/georges/load_form.h | 2 +- code/nel/include/nel/misc/stream.h | 7 + code/nel/src/3d/animation.cpp | 4 +- code/nel/src/3d/animation_set.cpp | 6 +- .../src/3d/driver/opengl/driver_opengl.cpp | 3 + .../driver/opengl/driver_opengl_material.cpp | 2 +- .../opengl/driver_opengl_pixel_program.cpp | 19 +- .../3d/driver/opengl/unix_event_emitter.cpp | 3 +- code/nel/src/3d/lod_character_shape.cpp | 12 +- code/nel/src/3d/packed_world.cpp | 2 +- code/nel/src/3d/ps_located.cpp | 2 +- code/nel/src/3d/scene_group.cpp | 2 +- code/nel/src/3d/shape.cpp | 2 +- code/nel/src/3d/skeleton_weight.cpp | 2 +- code/nel/src/3d/tile_far_bank.cpp | 4 +- code/nel/src/3d/vegetable_shape.cpp | 8 +- code/nel/src/3d/vertex_program_parse.cpp | 2 +- code/nel/src/3d/zone.cpp | 2 +- code/nel/src/gui/CMakeLists.txt | 19 +- code/nel/src/gui/ctrl_base_button.cpp | 12 +- code/nel/src/gui/group_container.cpp | 16 +- code/nel/src/gui/group_editbox.cpp | 2 +- code/nel/src/gui/group_modal.cpp | 24 +- code/nel/src/gui/group_wheel.cpp | 4 +- code/nel/src/gui/interface_group.cpp | 12 +- code/nel/src/gui/interface_parser.cpp | 10 +- code/nel/src/ligo/ligo_material.cpp | 2 +- code/nel/src/ligo/transition.cpp | 2 +- code/nel/src/ligo/zone_region.cpp | 2 +- code/nel/src/misc/system_info.cpp | 9 +- code/nel/src/pacs/primitive_block_pacs.cpp | 3 +- .../tools/3d/object_viewer/object_viewer.cpp | 4 +- .../georges_editor/expandable_headerview.h | 64 +- .../src/plugins/gui_editor/CMakeLists.txt | 4 +- .../src/plugins/log/log_plugin.cpp | 374 ++-- .../src/plugins/log/log_plugin.h | 66 +- .../src/plugins/log/log_settings_page.cpp | 244 +-- .../mission_compiler_main_window.h | 132 +- .../mission_compiler_main_window.ui | 3 - .../mission_compiler/server_entry_dialog.cpp | 146 +- .../mission_compiler/server_entry_dialog.h | 4 +- .../particle_system/scheme_manager.cpp | 4 +- .../zone_painter/zone_painter_main_window.cpp | 310 ++-- .../zone_painter/zone_painter_main_window.h | 104 +- .../src/object_viewer_widget.cpp | 1568 ++++++++--------- .../src/object_viewer_widget.h | 452 ++--- .../3d/object_viewer_widget/src/stdpch.cpp | 2 +- .../s3tc_compressor_lib/s3tc_compressor.cpp | 6 +- .../nel/tools/pacs/build_rbank/prim_checker.h | 2 +- code/nelns/CMakeLists.txt | 1 - .../nel_launcher_windows_ext2/CMakeLists.txt | 2 +- code/ryzom/CMakeLists.txt | 12 +- code/ryzom/client/src/character_cl.cpp | 4 +- code/ryzom/client/src/fx_cl.cpp | 2 +- code/ryzom/client/src/fx_manager.h | 2 +- code/ryzom/client/src/hair_set.cpp | 4 +- .../interface_v3/animal_position_state.cpp | 18 +- .../client/src/interface_v3/dbctrl_sheet.cpp | 2 +- .../src/interface_v3/dbgroup_list_sheet.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_text.cpp | 2 +- .../interface_v3/filtered_chat_summary.cpp | 4 +- .../client/src/interface_v3/group_compas.cpp | 15 +- .../src/interface_v3/interface_manager.cpp | 8 +- .../src/interface_v3/people_interraction.cpp | 12 +- code/ryzom/client/src/login.cpp | 18 +- code/ryzom/client/src/projectile_manager.cpp | 2 +- code/ryzom/client/src/r2/island_collision.cpp | 2 +- code/ryzom/client/src/release.cpp | 2 - code/ryzom/client/src/string_manager_client.h | 4 +- code/ryzom/client/src/timed_fx_manager.cpp | 2 +- .../src/game_share/persistent_data_template.h | 2 + .../common/src/game_share/security_check.cpp | 4 +- .../common/src/game_share/security_check.h | 4 +- .../server/src/ai_data_service/pacs_scan.cpp | 2 +- code/ryzom/server/src/ai_service/commands.cpp | 2 +- .../server/src/ai_share/ai_spawn_commands.h | 114 +- code/ryzom/server/src/ai_share/world_map.cpp | 2 +- code/ryzom/server/src/ai_share/world_map.h | 17 +- .../src/entities_game_service/fame_pd.cpp | 2 +- .../guild_manager/guild_member_module.cpp | 2 +- .../entities_game_service/harvest_source.cpp | 2 +- .../phrase_manager/combat_action.cpp | 7 +- .../phrase_manager/fg_prospection_phrase.cpp | 2 +- .../player_manager/character_interface.h | 8 +- .../stat_char_commands.cpp | 4 +- .../src/input_output_service/messages.cpp | 2 +- .../input_output_service/parameter_traits.cpp | 2 +- .../src/logger_service/logger_service.cpp | 4 +- .../ryzom/server/src/pd_lib/db_delta_file.cpp | 4 +- code/ryzom/server/src/pd_lib/db_delta_file.h | 2 +- .../server/src/pd_lib/db_reference_file.cpp | 4 +- .../server/src/pd_lib/db_reference_file.h | 2 +- code/ryzom/server/src/pd_lib/pd_messages.h | 2 +- .../server/src/pd_lib/pd_server_utils.cpp | 2 +- .../ryzom/server/src/pd_lib/pd_server_utils.h | 2 +- .../server/src/pd_lib/pd_string_mapper.cpp | 2 +- code/ryzom/server/src/pd_lib/pd_utils.h | 2 +- .../src/pd_support_service/daily_commands.cpp | 2 +- .../pd_support_service/stat_char_commands.cpp | 4 +- .../persistant_data_service/db_manager.cpp | 4 +- .../persistant_data_service/pds_database.cpp | 2 +- .../src/persistant_data_service/pds_type.cpp | 2 +- .../src/server_share/light_ig_loader.cpp | 2 +- .../shard_unifier_service/name_manager.cpp | 7 +- .../ring_session_manager.cpp | 2 +- .../client/client_config_qt/CMakeLists.txt | 17 +- .../client_config_qt/client_config_dialog.cpp | 1 + .../tools/client/client_config_qt/config.cpp | 7 +- .../tools/client/client_config_qt/config.h | 2 +- .../display_settings_advanced_widget.cpp | 2 + .../display_settings_details_widget.cpp | 4 +- .../display_settings_widget.cpp | 47 +- .../general_settings_widget.cpp | 6 +- .../general_settings_widget.h | 5 +- .../tools/client/client_config_qt/main.cpp | 3 +- .../sound_settings_widget.cpp | 2 + .../client_config_qt/sound_settings_widget.h | 1 - .../tools/client/client_config_qt/stdpch.cpp | 17 + .../tools/client/client_config_qt/stdpch.h | 29 + .../client_config_qt/sys_info_d3d_widget.cpp | 4 + .../client_config_qt/sys_info_d3d_widget.h | 4 +- .../sys_info_opengl_widget.cpp | 2 + .../client_config_qt/sys_info_widget.cpp | 2 + .../tools/client/client_config_qt/system.cpp | 76 +- .../tools/client/client_config_qt/system.h | 39 +- .../georges_editor_qt/src/formitem.h | 112 +- .../georges_plugin_sound/PageBgFades.cpp | 1 + .../georges_plugin_sound/PageBgFlags.cpp | 1 + .../georges_plugin_sound/PageComtext.cpp | 1 + .../georges_plugin_sound/std_sound_plugin.h | 6 +- .../mission_compiler_lib/mission_compiler.cpp | 4 +- .../mission_compiler_lib/variables.cpp | 2 +- .../build_world_packed_col.cpp | 6 +- .../packed_world_builder.cpp | 2 +- .../build_world_packed_col/test_col_world.cpp | 2 +- 142 files changed, 2631 insertions(+), 2236 deletions(-) create mode 100644 code/CMakeModules/FindLua52.cmake create mode 100644 code/ryzom/tools/client/client_config_qt/stdpch.cpp create mode 100644 code/ryzom/tools/client/client_config_qt/stdpch.h diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 97feb494c..926d28345 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -134,7 +134,7 @@ IF(FINAL_VERSION) ENDIF(FINAL_VERSION) IF(WITH_QT) - FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED) + FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED) ENDIF(WITH_QT) IF(WITH_NEL) @@ -144,11 +144,6 @@ IF(WITH_NEL) IF(WITH_GUI) FIND_PACKAGE(Libwww REQUIRED) - IF(WITH_LUA51) - FIND_PACKAGE(Lua51 REQUIRED) - ELSE(WITH_LUA51) - FIND_PACKAGE(Lua50 REQUIRED) - ENDIF(WITH_LUA51) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) diff --git a/code/CMakeModules/FindLua52.cmake b/code/CMakeModules/FindLua52.cmake new file mode 100644 index 000000000..0c25ea840 --- /dev/null +++ b/code/CMakeModules/FindLua52.cmake @@ -0,0 +1,81 @@ +# Locate Lua library +# This module defines +# LUA52_FOUND, if false, do not try to link to Lua +# LUA_LIBRARIES +# LUA_INCLUDE_DIR, where to find lua.h +# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUA_LIBRARY + NAMES lua52 lua5.2 lua-5.2 lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUA_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52 + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index c94a61e30..f61885be8 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -4,6 +4,48 @@ # LUABIND_FOUND, if false, do not try to link to LUABIND # LUABIND_INCLUDE_DIR, where to find headers. +MACRO(FIND_CORRECT_LUA_VERSION) + # Check Lua version linked to Luabind under Linux + IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + INCLUDE(CheckDepends) + + SET(LUA52_LIBRARY "liblua5.2") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.2") + FIND_PACKAGE(Lua52 REQUIRED) + ELSE(LUALIB_FOUND) + SET(LUA51_LIBRARY "liblua5.1") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.1") + FIND_PACKAGE(Lua51 REQUIRED) + ELSE(LUALIB_FOUND) + SET(LUA50_LIBRARY "liblua5.0") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.0") + FIND_PACKAGE(Lua50 REQUIRED) + ELSE(LUALIB_FOUND) + MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") + ENDIF(LUALIB_FOUND) + ENDIF(LUALIB_FOUND) + ENDIF(LUALIB_FOUND) + ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + # TODO: find a way to detect Lua version + IF(WITH_LUA52) + FIND_PACKAGE(Lua52 REQUIRED) + ELSEIF(WITH_LUA51) + FIND_PACKAGE(Lua51 REQUIRED) + ELSE(WITH_LUA52) + FIND_PACKAGE(Lua50 REQUIRED) + ENDIF(WITH_LUA52) + ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") +ENDMACRO(FIND_CORRECT_LUA_VERSION) + IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(Luabind_FIND_QUIETLY TRUE) @@ -84,6 +126,9 @@ IF(LUABIND_FOUND) IF(LUABIND_VERSION_FILE) SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION") ENDIF(LUABIND_VERSION_FILE) + + FIND_CORRECT_LUA_VERSION() + IF(NOT Luabind_FIND_QUIETLY) MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}") ENDIF(NOT Luabind_FIND_QUIETLY) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 822e752dd..16455b02d 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -19,8 +19,13 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND ON) + DETECT_EXPRESS_VERSION(${_VERSION}) IF(NOT MSVC_FIND_QUIETLY) - MESSAGE(STATUS "Found Visual C++ ${_VERSION} in ${VC${_VERSION}_DIR}") + SET(_VERSION_STR ${_VERSION}) + IF(MSVC_EXPRESS) + SET(_VERSION_STR "${_VERSION_STR} Express") + ENDIF(MSVC_EXPRESS) + MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") ENDIF(NOT MSVC_FIND_QUIETLY) ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND OFF) @@ -36,13 +41,28 @@ MACRO(DETECT_VC_VERSION _VERSION) DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) ENDIF(NOT VC${_VERSION}_FOUND) - IF(NOT VC${_VERSION}_FOUND) + IF(VC${_VERSION}_FOUND) SET(VC_FOUND ON) SET(VC_DIR "${VC${_VERSION}_DIR}") - ENDIF(NOT VC${_VERSION}_FOUND) + ENDIF(VC${_VERSION}_FOUND) ENDMACRO(DETECT_VC_VERSION) -IF(MSVC11) +MACRO(DETECT_EXPRESS_VERSION _VERSION) + GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) + + IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") + SET(MSVC_EXPRESS ON) + ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") +ENDMACRO(DETECT_EXPRESS_VERSION) + +IF(MSVC12) + DETECT_VC_VERSION("12.0") + + IF(NOT MSVC12_REDIST_DIR) + # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC11_REDIST_DIR) +ELSEIF(MSVC11) DETECT_VC_VERSION("11.0") IF(NOT MSVC11_REDIST_DIR) @@ -60,7 +80,7 @@ ELSEIF(MSVC90) DETECT_VC_VERSION("9.0") ELSEIF(MSVC80) DETECT_VC_VERSION("8.0") -ENDIF(MSVC11) +ENDIF(MSVC12) # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable IF(NOT VC_DIR) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 1b2affb99..fd32d92b5 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -11,6 +11,7 @@ IF(WINSDK_FOUND) RETURN() ENDIF(WINSDK_FOUND) +# Values can be CURRENT or any existing versions 7.1, 8.0A, etc... SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION) @@ -22,7 +23,7 @@ MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION) IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") ENDIF(NOT WindowsSDK_FIND_QUIETLY) - ELSEIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") SET(WINSDK${_VERSION}_DIR "") ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") ENDMACRO(DETECT_WINSDK_VERSION_HELPER) @@ -30,17 +31,22 @@ ENDMACRO(DETECT_WINSDK_VERSION_HELPER) MACRO(DETECT_WINSDK_VERSION _VERSION) SET(WINSDK${_VERSION}_FOUND OFF) DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) - + IF(NOT WINSDK${_VERSION}_FOUND) DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) ENDIF(NOT WINSDK${_VERSION}_FOUND) ENDMACRO(DETECT_WINSDK_VERSION) -SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.0A" "6.1" "6.0" "6.0A") +SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") +SET(WINSDK_DETECTED_VERSIONS) # Search all supported Windows SDKs FOREACH(_VERSION ${WINSDK_VERSIONS}) DETECT_WINSDK_VERSION(${_VERSION}) + + IF(WINSDK${_VERSION}_FOUND) + LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) + ENDIF(WINSDK${_VERSION}_FOUND) ENDFOREACH(_VERSION) SET(WINSDK_SUFFIX) @@ -54,51 +60,186 @@ ELSEIF(TARGET_X86) SET(WINSDK8_SUFFIX "x86") ENDIF(TARGET_ARM) -GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME) +SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE}) -IF(WINSDKCURRENT_VERSION AND NOT WINSDKCURRENT_VERSION STREQUAL "/registry") - IF(NOT WindowsSDK_FIND_QUIETLY) -# MESSAGE(STATUS "Current version is ${WINSDKCURRENT_VERSION}") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) -ENDIF(WINSDKCURRENT_VERSION AND NOT WINSDKCURRENT_VERSION STREQUAL "/registry") +IF(WINSDKCURRENT_VERSION_INCLUDE) + FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE) +ENDIF(WINSDKCURRENT_VERSION_INCLUDE) SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) +MACRO(FIND_WINSDK_VERSION_HEADERS) + IF(WINSDK_DIR AND NOT WINSDK_VERSION) + # Search version in headers + IF(EXISTS ${WINSDK_DIR}/include/Msi.h) + SET(_MSI_FILE ${WINSDK_DIR}/include/Msi.h) + ENDIF(EXISTS ${WINSDK_DIR}/include/Msi.h) + + IF(_MSI_FILE) + # Look for Windows SDK 8.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8") + + IF(_CONTENT) + SET(WINSDK_VERSION "8.0") + ENDIF(_CONTENT) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 7.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7") + + IF(_CONTENT) + IF(EXISTS ${WINSDK_DIR}/include/winsdkver.h) + SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/winsdkver.h) + ELSEIF(EXISTS ${WINSDK_DIR}/include/WinSDKVer.h) + SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/WinSDKVer.h) + ENDIF(EXISTS ${WINSDK_DIR}/include/winsdkver.h) + + IF(_WINSDKVER_FILE) + # Load WinSDKVer.h content + FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER") + + # Get NTDDI_MAXVER value + STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}") + + # In Windows SDK 7.1, NTDDI_MAXVER is wrong + IF(_WINSDKVER STREQUAL "06010000") + SET(WINSDK_VERSION "7.1") + ELSEIF(_WINSDKVER STREQUAL "0601") + SET(WINSDK_VERSION "7.0A") + ELSE(_WINSDKVER STREQUAL "06010000") + MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}") + ENDIF(_WINSDKVER STREQUAL "06010000") + ELSE(_WINSDKVER_FILE) + SET(WINSDK_VERSION "7.0") + ENDIF(_WINSDKVER_FILE) + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 6.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA") + + IF(_CONTENT) + SET(WINSDK_VERSION "6.0") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.2 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.2") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.1 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.1") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.0") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + ELSE(_MSI_FILE) + MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}") + ENDIF(_MSI_FILE) + ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION) +ENDMACRO(FIND_WINSDK_VERSION_HEADERS) + MACRO(USE_CURRENT_WINSDK) - IF(WINSDKENV_DIR) - SET(WINSDK_VERSION "") - SET(WINSDK_VERSION_FULL "") + SET(WINSDK_DIR "") + SET(WINSDK_VERSION "") + SET(WINSDK_VERSION_FULL "") + + # Use WINSDK environment variable + IF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h) SET(WINSDK_DIR ${WINSDKENV_DIR}) - FOREACH(_VERSION ${WINSDK_VERSIONS}) - IF(WINSDK_DIR STREQUAL WINSDK${_VERSION}_DIR) - SET(WINSDK_VERSION ${_VERSION}) - SET(WINSDK_VERSION_FULL "${WINSDK${_VERSION}_VERSION_FULL}") + ENDIF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h) + + # Use INCLUDE environment variable + IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE}) + FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE) + + # Look for Windows.h because there are several paths + IF(EXISTS ${_INCLUDE}/Windows.h) + STRING(REGEX REPLACE "/(include|INCLUDE|Include)" "" WINSDK_DIR ${_INCLUDE}) + MESSAGE(STATUS "Found Windows SDK environment variable in ${WINSDK_DIR}") BREAK() - ENDIF(WINSDK_DIR STREQUAL WINSDK${_VERSION}_DIR) + ENDIF(EXISTS ${_INCLUDE}/Windows.h) + ENDFOREACH(_INCLUDE) + ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + + IF(WINSDK_DIR) + # Compare WINSDK_DIR with registered Windows SDKs + FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) + IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") + SET(WINSDK_VERSION ${_VERSION}) + SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") + BREAK() + ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") ENDFOREACH(_VERSION) - ELSE(WINSDKENV_DIR) - # Windows SDK 7.0A doesn't provide 64bits compilers, use SDK 7.1 for 64 bits - IF(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL) - IF(TARGET_X64) - SET(WINSDK_VERSION "7.1") - SET(WINSDK_VERSION_FULL ${WINSDK7.1_VERSION_FULL}) - SET(WINSDK_DIR ${WINSDK7.1_DIR}) - ELSE(TARGET_X64) + + FIND_WINSDK_VERSION_HEADERS() + ENDIF(WINSDK_DIR) + + IF(NOT WINSDK_DIR) + # Use Windows SDK versions installed with VC++ when possible + IF(MSVC12) + SET(WINSDK_VERSION "8.1A") + ELSEIF(MSVC11) + SET(WINSDK_VERSION "8.0A") + ELSEIF(MSVC10) + IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) SET(WINSDK_VERSION "7.0A") - SET(WINSDK_VERSION_FULL ${WINSDK7.0A_VERSION_FULL}) - SET(WINSDK_DIR ${WINSDK7.0A_DIR}) - ENDIF(TARGET_X64) - ELSE(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL) - FOREACH(_VERSION ${WINSDK_VERSIONS}) - IF(WINSDKCURRENT_VERSION STREQUAL WINSDK${_VERSION}_VERSION) - SET(WINSDK_VERSION ${_VERSION}) - SET(WINSDK_VERSION_FULL "${WINSDK${_VERSION}_VERSION_FULL}") - SET(WINSDK_DIR "${WINSDK${_VERSION}_DIR}") - BREAK() - ENDIF(WINSDKCURRENT_VERSION STREQUAL WINSDK${_VERSION}_VERSION) - ENDFOREACH(_VERSION) - ENDIF(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL) - ENDIF(WINSDKENV_DIR) + ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) + ELSEIF(MSVC90) + IF(NOT MSVC_EXPRESS) + SET(WINSDK_VERSION "6.0A") + ENDIF(NOT MSVC_EXPRESS) + ELSEIF(MSVC80) + IF(NOT MSVC_EXPRESS) + # TODO: fix this version + SET(WINSDK_VERSION "5.2A") + ENDIF(NOT MSVC_EXPRESS) + ELSE(MSVC12) + MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.") + ENDIF(MSVC12) + + # Use installed Windows SDK + IF(NOT WINSDK_VERSION) + IF(WINSDK7.1_FOUND) + SET(WINSDK_VERSION "7.1") + ELSEIF(WINSDK7.0_FOUND) + SET(WINSDK_VERSION "7.0") + ELSEIF(WINSDK6.1_FOUND) + SET(WINSDK_VERSION "6.1") + ELSEIF(WINSDK6.0_FOUND) + SET(WINSDK_VERSION "6.0") + ELSE(WINSDK7.1_FOUND) + MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.") + ENDIF(WINSDK7.1_FOUND) + ENDIF(NOT WINSDK_VERSION) + + # Look for correct registered Windows SDK version + FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) + IF(WINSDK_VERSION STREQUAL _VERSION) + SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") + SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") + BREAK() + ENDIF(WINSDK_VERSION STREQUAL _VERSION) + ENDFOREACH(_VERSION) + ENDIF(NOT WINSDK_DIR) ENDMACRO(USE_CURRENT_WINSDK) IF(WINSDK_VERSION STREQUAL "CURRENT") diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 9033f6583..97b5ed88d 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -273,15 +273,22 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) # Ninja PCH Support # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}") - + # NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain) # we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx - GET_TARGET_PROPERTY(DEPS ${_targetName} LINK_LIBRARIES) - if (NOT DEPS) - set (DEPS) - endif () - list (INSERT DEPS 0 "${PCH_OUTPUT}.obj") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES LINK_LIBRARIES "${DEPS}") + GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS) + IF(NOT _STATIC_LIBRARY_FLAGS) + SET(_STATIC_LIBRARY_FLAGS) + ENDIF(NOT _STATIC_LIBRARY_FLAGS) + SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}") + + GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS) + IF(NOT _LINK_FLAGS) + SET(_LINK_FLAGS) + ENDIF(NOT _LINK_FLAGS) + SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}") + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS}) ELSE(MSVC) # for use with distcc and gcc >4.0.1 if preprocessed files are accessible # on all remote machines set @@ -369,17 +376,6 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}") ENDMACRO(ADD_PRECOMPILED_HEADER) -# Macro to move PCH creation file to the front of files list -# or remove .cpp from library/executable to avoid warning -MACRO(FIX_PRECOMPILED_HEADER _files _pch) - # Remove .cpp creating PCH from the list - LIST(REMOVE_ITEM ${_files} ${_pch}) - IF(MSVC) - # Prepend .cpp creating PCH to the list - LIST(INSERT ${_files} 0 ${_pch}) - ENDIF(MSVC) -ENDMACRO(FIX_PRECOMPILED_HEADER) - MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) IF(NOT PCHSupport_FOUND) MESSAGE(STATUS "PCH disabled because compiler doesn't support them") @@ -391,10 +387,6 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) # 2 => setting PCH for XCode project, works for XCode projects IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(PCH_METHOD 1) - ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG) - # To fix a bug with MFC - # Don't forget to use FIX_PRECOMPILED_HEADER before creating the target -# SET(PCH_METHOD 1) ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") SET(PCH_METHOD 2) ELSE(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 2fa51eb3a..f239ec779 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -345,7 +345,8 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) ### # Optional support ### - OPTION(WITH_LUA51 "Build Ryzom Core using Lua51" ON ) + OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON ) + OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) diff --git a/code/nel/include/nel/georges/load_form.h b/code/nel/include/nel/georges/load_form.h index 6bf6c83c3..4aaab43d0 100644 --- a/code/nel/include/nel/georges/load_form.h +++ b/code/nel/include/nel/georges/load_form.h @@ -109,7 +109,7 @@ struct TLoadFormDicoEntry } }; */ -const uint32 PACKED_SHEET_HEADER = 'PKSH'; +const uint32 PACKED_SHEET_HEADER = NELID("PKSH"); const uint32 PACKED_SHEET_VERSION = 5; // This Version may be used if you want to use the serialVersion() system in loadForm() const uint32 PACKED_SHEET_VERSION_COMPATIBLE = 0; diff --git a/code/nel/include/nel/misc/stream.h b/code/nel/include/nel/misc/stream.h index ad0e8ddd4..5a342643d 100644 --- a/code/nel/include/nel/misc/stream.h +++ b/code/nel/include/nel/misc/stream.h @@ -53,6 +53,13 @@ class CMemStream; # endif # define NLMISC_BSWAP64(src) (src) = (((src)>>56)&0xFF) | ((((src)>>48)&0xFF)<<8) | ((((src)>>40)&0xFF)<<16) | ((((src)>>32)&0xFF)<<24) | ((((src)>>24)&0xFF)<<32) | ((((src)>>16)&0xFF)<<40) | ((((src)>>8)&0xFF)<<48) | (((src)&0xFF)<<56) +// convert a 4 characters string to uint32 +#ifdef NL_LITTLE_ENDIAN +# define NELID(x) (uint32((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3]))) +#else +# define NELID(x) (uint32((x[3] << 24) | (x[2] << 16) | (x[1] << 8) | (x[0]))) +#endif + // ====================================================================================================== /** * Stream Exception. diff --git a/code/nel/src/3d/animation.cpp b/code/nel/src/3d/animation.cpp index 9cfd3f26b..a604d2bde 100644 --- a/code/nel/src/3d/animation.cpp +++ b/code/nel/src/3d/animation.cpp @@ -89,8 +89,8 @@ void CAnimation::serial (NLMISC::IStream& f) nlassert(_IdByChannelId.empty()); // Serial a header - f.serialCheck ((uint32)'_LEN'); - f.serialCheck ((uint32)'MINA'); + f.serialCheck (NELID("_LEN")); + f.serialCheck (NELID("MINA")); // Serial a version sint version=f.serialVersion (2); diff --git a/code/nel/src/3d/animation_set.cpp b/code/nel/src/3d/animation_set.cpp index 94946799b..05db8a7be 100644 --- a/code/nel/src/3d/animation_set.cpp +++ b/code/nel/src/3d/animation_set.cpp @@ -185,9 +185,9 @@ void CAnimationSet::serial (NLMISC::IStream& f) nlassert(!_AnimHeaderOptimisation); // Serial an header - f.serialCheck ((uint32)'_LEN'); - f.serialCheck ((uint32)'MINA'); - f.serialCheck ((uint32)'TES_'); + f.serialCheck (NELID("_LEN")); + f.serialCheck (NELID("MINA")); + f.serialCheck (NELID("TES_")); // Serial a version uint ver= f.serialVersion (1); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 45bba3bc1..02617990d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -1406,6 +1406,7 @@ void CDriverGL::setupFog(float start, float end, CRGBA color) glFogfv(GL_FOG_COLOR, _CurrentFogColor); +#ifndef USE_OPENGLES /** Special : with vertex program, using the extension EXT_vertex_shader, fog is emulated using 1 more constant to scale result to [0, 1] */ if (_Extensions.EXTVertexShader && !_Extensions.NVVertexProgram && !_Extensions.ARBVertexProgram) @@ -1425,6 +1426,8 @@ void CDriverGL::setupFog(float start, float end, CRGBA color) } } } +#endif + _FogStart = start; _FogEnd = end; } 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 d5920fe64..ed43fe8c3 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -1502,7 +1502,7 @@ CTextureCube *CDriverGL::getSpecularCubeMap(uint exp) { 1.f, 4.f, 8.f, 24.f, 48.f, 128.f, 256.f, 511.f }; - const uint numCubeMap = sizeof(expToCubeMap) / sizeof(float); + const uint numCubeMap = sizeof(cubeMapExp) / sizeof(float); static bool tableBuilt = false; if (!tableBuilt) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp index d1ef146f2..899511a1b 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp @@ -54,6 +54,8 @@ namespace NLDRIVERGL { CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it) { H_AUTO_OGL(CPixelProgamDrvInfosGL_CPixelProgamDrvInfosGL) + +#ifndef USE_OPENGLES // Extension must exist nlassert(drv->_Extensions.ARBFragmentProgram); @@ -61,6 +63,7 @@ CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoP { nglGenProgramsARB(1, &ID); } +#endif } // *************************************************************************** @@ -96,6 +99,7 @@ bool CDriverGL::activePixelProgram(CPixelProgram *program) bool CDriverGL::compilePixelProgram(NL3D::CPixelProgram *program) { +#ifndef USE_OPENGLES // Program setuped ? if (program->m_DrvInfo == NULL) { @@ -121,6 +125,9 @@ bool CDriverGL::compilePixelProgram(NL3D::CPixelProgram *program) } return true; +#else + return false; +#endif } // *************************************************************************** @@ -129,6 +136,7 @@ bool CDriverGL::activeARBPixelProgram(CPixelProgram *program) { H_AUTO_OGL(CDriverGL_activeARBPixelProgram) +#ifndef USE_OPENGLES // Setup or unsetup ? if (program) { @@ -151,14 +159,18 @@ bool CDriverGL::activeARBPixelProgram(CPixelProgram *program) } return true; +#else + return false; +#endif } // *************************************************************************** bool CDriverGL::setupPixelProgram(CPixelProgram *program, GLuint id/*, bool &specularWritten*/) { - H_AUTO_OGL(CDriverGL_setupARBPixelProgram) + H_AUTO_OGL(CDriverGL_setupARBPixelProgram); +#ifndef USE_OPENGLES CPixelProgamDrvInfosGL *drvInfo = static_cast((IProgramDrvInfos *)program->m_DrvInfo); // Find a supported pixel program profile @@ -226,7 +238,10 @@ bool CDriverGL::setupPixelProgram(CPixelProgram *program, GLuint id/*, bool &spe // Build the feature info program->buildInfo(source); - return true; + return true; +#else + return false; +#endif } #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index c59167183..c3a8552ac 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "nel/misc/debug.h" @@ -566,7 +567,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) } else { - k = XKeycodeToKeysym(_dpy, keyCode, 0); + k = XkbKeycodeToKeysym(_dpy, keyCode, 0, 0); } // send CEventKeyDown event only if keyCode is defined diff --git a/code/nel/src/3d/lod_character_shape.cpp b/code/nel/src/3d/lod_character_shape.cpp index 09aded766..6250f2fb5 100644 --- a/code/nel/src/3d/lod_character_shape.cpp +++ b/code/nel/src/3d/lod_character_shape.cpp @@ -264,9 +264,9 @@ void CLodCharacterShapeBuild::compile(const std::vector &triangleSelection void CLodCharacterShapeBuild::serial(NLMISC::IStream &f) { // NEL_CLODBULD - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'DOLC'); - f.serialCheck((uint32)'DLUB'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("DOLC")); + f.serialCheck(NELID("DLUB")); /* Version 1: @@ -525,9 +525,9 @@ void CLodCharacterShape::CBoneInfluence::serial(NLMISC::IStream &f) void CLodCharacterShape::serial(NLMISC::IStream &f) { // NEL_CLODSHAP - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'DOLC'); - f.serialCheck((uint32)'PAHS'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("DOLC")); + f.serialCheck(NELID("PAHS")); /* Version 1: diff --git a/code/nel/src/3d/packed_world.cpp b/code/nel/src/3d/packed_world.cpp index 64b669fc4..15d59c724 100644 --- a/code/nel/src/3d/packed_world.cpp +++ b/code/nel/src/3d/packed_world.cpp @@ -152,7 +152,7 @@ void CPackedWorld::getZones(std::vector &zones) void CPackedWorld::serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); - f.serialCheck((uint32) 'OWPA'); + f.serialCheck(NELID("OWPA")); f.serialCont(ZoneNames); } diff --git a/code/nel/src/3d/ps_located.cpp b/code/nel/src/3d/ps_located.cpp index f066b6f3c..9be0baf41 100644 --- a/code/nel/src/3d/ps_located.cpp +++ b/code/nel/src/3d/ps_located.cpp @@ -73,7 +73,7 @@ CPSLocated::CPSLocated() : /*_MaxNumFaces(0),*/ _ParametricMotion(false), _TriggerOnDeath(false), _LastForever(true), - _TriggerID((uint32) 'NONE'), + _TriggerID(NELID("NONE")), _NonIntegrableForceNbRefs(0), _NumIntegrableForceWithDifferentBasis(0) { diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index 7cfa56b02..d539278cd 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -405,7 +405,7 @@ void CInstanceGroup::serial (NLMISC::IStream& f) * ***********************************************/ // Serial a header - f.serialCheck ((uint32)'TPRG'); + f.serialCheck (NELID("TPRG")); /* Version 5: diff --git a/code/nel/src/3d/shape.cpp b/code/nel/src/3d/shape.cpp index adc610827..cf61185cd 100644 --- a/code/nel/src/3d/shape.cpp +++ b/code/nel/src/3d/shape.cpp @@ -116,7 +116,7 @@ IShape* CShapeStream::getShapePointer () const void CShapeStream::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // First, serial an header or checking if it is correct - f.serialCheck ((uint32)'PAHS'); + f.serialCheck (NELID("PAHS")); // Then, serial the shape f.serialPolyPtr (_Shape); diff --git a/code/nel/src/3d/skeleton_weight.cpp b/code/nel/src/3d/skeleton_weight.cpp index 4668a005a..ba037236a 100644 --- a/code/nel/src/3d/skeleton_weight.cpp +++ b/code/nel/src/3d/skeleton_weight.cpp @@ -60,7 +60,7 @@ void CSkeletonWeight::build (const TNodeArray& array) void CSkeletonWeight::serial (NLMISC::IStream& f) { // Serial a header - f.serialCheck ((uint32)'TWKS'); + f.serialCheck (NELID("TWKS")); // Serial a version number (void)f.serialVersion (0); diff --git a/code/nel/src/3d/tile_far_bank.cpp b/code/nel/src/3d/tile_far_bank.cpp index 75a758560..e62903904 100644 --- a/code/nel/src/3d/tile_far_bank.cpp +++ b/code/nel/src/3d/tile_far_bank.cpp @@ -104,8 +104,8 @@ const sint CTileFarBank::_Version=0x0; void CTileFarBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // Write/Check "FAR_BANK" in header of the stream - f.serialCheck ((uint32)'_RAF'); - f.serialCheck ((uint32)'KNAB'); + f.serialCheck (NELID("_RAF")); + f.serialCheck (NELID("KNAB")); // Serial version (void)f.serialVersion(_Version); diff --git a/code/nel/src/3d/vegetable_shape.cpp b/code/nel/src/3d/vegetable_shape.cpp index 0b8697d63..7d9991b65 100644 --- a/code/nel/src/3d/vegetable_shape.cpp +++ b/code/nel/src/3d/vegetable_shape.cpp @@ -192,10 +192,10 @@ void CVegetableShape::serial(NLMISC::IStream &f) - BestSidedPreComputeLighting */ sint ver= f.serialVersion(1); - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'GEV_'); - f.serialCheck((uint32)'BATE'); - f.serialCheck((uint32)'__EL'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("GEV_")); + f.serialCheck(NELID("BATE")); + f.serialCheck(NELID("__EL")); f.serial(Lighted); f.serial(DoubleSided); diff --git a/code/nel/src/3d/vertex_program_parse.cpp b/code/nel/src/3d/vertex_program_parse.cpp index 9b535d551..af3a70b96 100644 --- a/code/nel/src/3d/vertex_program_parse.cpp +++ b/code/nel/src/3d/vertex_program_parse.cpp @@ -885,7 +885,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput } // it is not allowed to write to an adress register except for ARL - if (instrStr != 'ARL ') + if (instrStr != NELID("ARL")) { if (instr.Dest.Type == CVPOperand::AddressRegister) { diff --git a/code/nel/src/3d/zone.cpp b/code/nel/src/3d/zone.cpp index 4acca80f5..c601f0fa4 100644 --- a/code/nel/src/3d/zone.cpp +++ b/code/nel/src/3d/zone.cpp @@ -458,7 +458,7 @@ void CZone::serial(NLMISC::IStream &f) throw EOlderStream(f); } - f.serialCheck((uint32)'ENOZ'); + f.serialCheck(NELID("ENOZ")); f.xmlSerial (ZoneId, "ZONE_ID"); f.xmlSerial (ZoneBB, "BB"); diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index e6a943594..e3d501e23 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -6,26 +6,15 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) +INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES}) SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI") NL_ADD_RUNTIME_FLAGS(nelgui) -INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR}) - NL_ADD_LIB_SUFFIX(nelgui) -#MESSAGE( "libww libs: ${LIBWWW_LIBRARIES}" ) - -TARGET_LINK_LIBRARIES( nelgui - nelmisc - nel3d - ${LUA_LIBRARIES} - ${LUABIND_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${LIBWWW_LIBRARIES} - ${CURL_LIBRARIES} - ) - ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS}) IF(WITH_PCH) @@ -33,5 +22,5 @@ IF(WITH_PCH) ENDIF(WITH_PCH) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) - INSTALL(TARGETS nelgui LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + INSTALL(TARGETS nelgui LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/gui/ctrl_base_button.cpp b/code/nel/src/gui/ctrl_base_button.cpp index 8c74e3bfc..4a0c53cf4 100644 --- a/code/nel/src/gui/ctrl_base_button.cpp +++ b/code/nel/src/gui/ctrl_base_button.cpp @@ -549,27 +549,27 @@ namespace NLGUI if( editorMode ) { prop = (char*) xmlGetProp( cur, BAD_CAST "onover" ); - if( prop != NULL ) + if (prop) mapAHString( "onover", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "onclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "ondblclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "ondblclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_r" ); - if( prop != NULL ) + if (prop) mapAHString( "onclick_r", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onlongclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "onlongclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclock_tick" ); - if( prop != NULL ) + if (prop) mapAHString( "onclock_tick", std::string( (const char*)prop ) ); } diff --git a/code/nel/src/gui/group_container.cpp b/code/nel/src/gui/group_container.cpp index 9cb31deab..c3a7834c5 100644 --- a/code/nel/src/gui/group_container.cpp +++ b/code/nel/src/gui/group_container.cpp @@ -2233,35 +2233,35 @@ namespace NLGUI if( editorMode ) { ptr = xmlGetProp( cur, BAD_CAST "on_open" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_open", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_close" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_close", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_close_button" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_close_button", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_move" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_move", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_deactive_check" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_deactive_check", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_resize" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_resize", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_alpha_settings_changed" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_alpha_settings_changed", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_begin_move" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_begin_move", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 4e8eb3e36..5c2f3bf1d 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -540,7 +540,7 @@ namespace NLGUI if( editorMode ) { prop = (char*) xmlGetProp( cur, BAD_CAST "onenter" ); - if( prop != NULL ) + if (prop) mapAHString( "onenter", std::string( (const char*)prop ) ); } diff --git a/code/nel/src/gui/group_modal.cpp b/code/nel/src/gui/group_modal.cpp index 654a372f0..fb4c6d129 100644 --- a/code/nel/src/gui/group_modal.cpp +++ b/code/nel/src/gui/group_modal.cpp @@ -244,29 +244,29 @@ namespace NLGUI // read modal option CXMLAutoPtr prop; prop = xmlGetProp (cur, (xmlChar*)"mouse_pos"); - if ( prop ) SpawnOnMousePos= convertBool(prop); + if (prop) SpawnOnMousePos= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_out"); - if ( prop ) ExitClickOut= convertBool(prop); + if (prop) ExitClickOut= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_l"); - if ( prop ) ExitClickL= convertBool(prop); + if (prop) ExitClickL= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_r"); - if ( prop ) ExitClickR= convertBool(prop); + if (prop) ExitClickR= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_b"); - if ( prop ) ExitClickR= ExitClickL= convertBool(prop); + if (prop) ExitClickR= ExitClickL= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"force_inside_screen"); - if ( prop ) ForceInsideScreen= convertBool(prop); + if (prop) ForceInsideScreen= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"category"); - if ( prop ) Category= (const char *) prop; + if (prop) Category= (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onclick_out"); - if ( prop ) OnClickOut = (const char *) prop; + if (prop) OnClickOut = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onclick_out_params"); - if ( prop ) OnClickOutParams = (const char *) prop; + if (prop) OnClickOutParams = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out"); - if ( prop ) OnPostClickOut = (const char *) prop; + if (prop) OnPostClickOut = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out_params"); - if ( prop ) OnPostClickOutParams = (const char *) prop; + if (prop) OnPostClickOutParams = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"exit_key_pushed"); - if ( prop ) ExitKeyPushed= convertBool(prop); + if (prop) ExitKeyPushed= convertBool(prop); // Force parent hotspot for spawn on mouse if(SpawnOnMousePos) diff --git a/code/nel/src/gui/group_wheel.cpp b/code/nel/src/gui/group_wheel.cpp index 59172382e..6f4c96484 100644 --- a/code/nel/src/gui/group_wheel.cpp +++ b/code/nel/src/gui/group_wheel.cpp @@ -119,11 +119,11 @@ namespace NLGUI if( editorMode ) { CXMLAutoPtr ptr( (char*) xmlGetProp( cur, BAD_CAST "on_wheel_up" ) ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_wheel_up", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_wheel_down" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_wheel_down", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 4e8919e5c..b2de26527 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -349,27 +349,27 @@ namespace NLGUI if( editorMode ) { ptr = (char*) xmlGetProp( cur, BAD_CAST "on_active" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_active", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_deactive" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_deactive", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_r" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "group_onclick_r", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_l" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "group_onclick_l", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_enter" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_enter", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_escape" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_escape", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index da8bd1e52..01e47bb80 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -41,7 +41,7 @@ #ifdef LUA_NEVRAX_VERSION #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger #endif -const uint32 UI_CACHE_SERIAL_CHECK = (uint32) 'IUG_'; +const uint32 UI_CACHE_SERIAL_CHECK = NELID("IUG_"); using namespace NLMISC; using namespace std; @@ -1001,7 +1001,7 @@ namespace NLGUI ptr = (char*) xmlGetProp (cur, (xmlChar*)"target"); std::string target; - if( ptr != NULL ) + if( ptr ) { target = std::string( (const char*)ptr ); if( !editorMode ) @@ -1136,17 +1136,17 @@ namespace NLGUI VariableData data; ptr = xmlGetProp( cur, BAD_CAST "entry" ); - if( ptr != NULL ) + if( ptr ) data.entry = std::string( (const char*)ptr ); data.type = type; ptr = xmlGetProp( cur, BAD_CAST "value" ); - if( ptr != NULL ) + if( ptr ) data.value = std::string( (const char*)ptr ); ptr = xmlGetProp( cur, BAD_CAST "size" ); - if( ptr != NULL ) + if( ptr ) fromString( std::string( (const char*)ptr ), data.size ); variableCache[ data.entry ] = data; diff --git a/code/nel/src/ligo/ligo_material.cpp b/code/nel/src/ligo/ligo_material.cpp index 643629648..c5e7541a3 100644 --- a/code/nel/src/ligo/ligo_material.cpp +++ b/code/nel/src/ligo/ligo_material.cpp @@ -80,7 +80,7 @@ void CMaterial::serial (NLMISC::IStream &s) s.xmlPush ("LIGO_MATERIAL"); // Serial the header - s.serialCheck ((uint32)'TMOL'); + s.serialCheck (NELID("TMOL")); // Serial the version /*sint ver =*/ s.serialVersion (0); diff --git a/code/nel/src/ligo/transition.cpp b/code/nel/src/ligo/transition.cpp index b13c4f566..ee6921c78 100644 --- a/code/nel/src/ligo/transition.cpp +++ b/code/nel/src/ligo/transition.cpp @@ -199,7 +199,7 @@ void CTransition::serial (NLMISC::IStream &s) s.xmlPush ("LIGO_TRANSITION"); // Serial the header - s.serialCheck ((uint32)'STGL'); + s.serialCheck (NELID("STGL")); // Serial the version /*sint ver =*/ s.serialVersion (0); diff --git a/code/nel/src/ligo/zone_region.cpp b/code/nel/src/ligo/zone_region.cpp index ad65aec8e..9926d3757 100644 --- a/code/nel/src/ligo/zone_region.cpp +++ b/code/nel/src/ligo/zone_region.cpp @@ -153,7 +153,7 @@ void CZoneRegion::serial (NLMISC::IStream &f) f.xmlPush ("LAND"); sint32 version = f.serialVersion (1); - f.serialCheck ((uint32)'DNAL'); + f.serialCheck (NELID("DNAL")); f.xmlSerial (_MinX, "MIN_X"); f.xmlSerial (_MinY, "MIN_Y"); diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 7ef96ec58..1fa91db6c 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -231,7 +231,14 @@ string CSystemInfo::getOS() } else if ( osvi.dwMajorVersion == 6 ) { - if ( osvi.dwMinorVersion == 1 ) + if ( osvi.dwMinorVersion == 2 ) + { + if( osvi.wProductType == VER_NT_WORKSTATION ) + OSString += " Windows 8"; + else + OSString += " Windows Server 2012"; + } + else if ( osvi.dwMinorVersion == 1 ) { if( osvi.wProductType == VER_NT_WORKSTATION ) OSString += " Windows 7"; diff --git a/code/nel/src/pacs/primitive_block_pacs.cpp b/code/nel/src/pacs/primitive_block_pacs.cpp index 0681d2eea..1ee0615ea 100644 --- a/code/nel/src/pacs/primitive_block_pacs.cpp +++ b/code/nel/src/pacs/primitive_block_pacs.cpp @@ -16,6 +16,7 @@ #include "stdpacs.h" #include "nel/misc/i_xml.h" +#include "nel/misc/stream.h" #include "nel/pacs/primitive_block.h" @@ -85,7 +86,7 @@ void CPrimitiveBlock::serial (NLMISC::IStream &s) s.xmlPush ("PRIMITIVE_BLOCK"); // Serial checks - s.serialCheck ((uint32)'KBRP'); + s.serialCheck (NELID("KBRP")); // Serial the version (void)s.serialVersion (0); diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index bc9949079..ff530e007 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -1711,8 +1711,8 @@ void CObjectViewer::serial (NLMISC::IStream& f) { // version 4: include particle workspace infos // serial "OBJV_CFG" - f.serialCheck ((uint32)'VJBO'); - f.serialCheck ((uint32)'GFC_'); + f.serialCheck (NELID("VJBO")); + f.serialCheck (NELID("GFC_")); // serial the version int ver=f.serialVersion (4); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h index f7f26eafc..4071b4637 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h @@ -15,35 +15,35 @@ // along with this program. If not, see . #ifndef EXPANDABLE_HEADERVIEW_H -#define EXPANDABLE_HEADERVIEW_H - -// Qt includes -#include - -namespace GeorgesQt -{ - class ExpandableHeaderView : public QHeaderView - { - Q_OBJECT - public: - ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0); - - bool* expanded() { return &m_expanded; } - - protected: - void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; - bool isPointInDecoration(int section, QPoint pos)const; - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - - private: - bool m_expanded; - bool m_inDecoration; - -Q_SIGNALS: - void headerClicked(int); - }; - -} /* namespace NLQT */ - -#endif // EXPANDABLE_HEADERVIEW_H +#define EXPANDABLE_HEADERVIEW_H + +// Qt includes +#include + +namespace GeorgesQt +{ + class ExpandableHeaderView : public QHeaderView + { + Q_OBJECT + public: + ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0); + + bool* expanded() { return &m_expanded; } + + protected: + void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; + bool isPointInDecoration(int section, QPoint pos)const; + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + + private: + bool m_expanded; + bool m_inDecoration; + +Q_SIGNALS: + void headerClicked(int); + }; + +} /* namespace NLQT */ + +#endif // EXPANDABLE_HEADERVIEW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt index 409005a6a..a9083613e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -1,7 +1,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} - ${QT_INCLUDES}) + ${QT_INCLUDES} + ${LUA_INCLUDE_DIR}) FILE(GLOB SRC *.cpp *.h) @@ -71,6 +72,7 @@ TARGET_LINK_LIBRARIES( nelgui ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} + ${LIBXML2_LIBRARIES} qt_property_browser ) 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 5a8c64f93..0f86ab90c 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 @@ -1,191 +1,191 @@ -// Object Viewer Qt - Log Plugin - MMORPG Framework -// Copyright (C) 2011 Adrian Jaekel -// -// 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 "log_plugin.h" -#include "log_settings_page.h" -#include "qt_displayer.h" - -#include "../core/icore.h" -#include "../core/core_constants.h" -#include "../core/menu_manager.h" -#include "../../extension_system/iplugin_spec.h" - -// Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// NeL includes -#include - -namespace Plugin -{ - - CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) - { - m_ui.setupUi(this); - } - - CLogPlugin::~CLogPlugin() - { - Q_FOREACH(QObject *obj, m_autoReleaseObjects) - { - m_plugMan->removeObject(obj); - } - qDeleteAll(m_autoReleaseObjects); - m_autoReleaseObjects.clear(); - - NLMISC::ErrorLog->removeDisplayer(m_displayer); - NLMISC::WarningLog->removeDisplayer(m_displayer); - NLMISC::DebugLog->removeDisplayer(m_displayer); - NLMISC::AssertLog->removeDisplayer(m_displayer); - NLMISC::InfoLog->removeDisplayer(m_displayer); - delete m_displayer; - } - - bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) - { - Q_UNUSED(errorString); - m_plugMan = pluginManager; - m_logSettingsPage = new CLogSettingsPage(this, this); - addAutoReleasedObject(m_logSettingsPage); - return true; - } - - void CLogPlugin::extensionsInitialized() - { - setDisplayers(); - - Core::ICore *core = Core::ICore::instance(); - Core::MenuManager *menuManager = core->menuManager(); - QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); - - QMainWindow *wnd = Core::ICore::instance()->mainWindow(); - wnd->addDockWidget(Qt::RightDockWidgetArea, this); - hide(); - - viewMenu->addAction(this->toggleViewAction()); - } - - 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()); -#endif // fdef NL_OS_WINDOWS^M - m_libContext = new NLMISC::CLibraryContext(*nelContext); - - m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); - - } - - QString CLogPlugin::name() const - { - return "LogPlugin"; - } - - QString CLogPlugin::version() const - { - return "1.1"; - } - - QString CLogPlugin::vendor() const - { - return "aquiles"; - } - - QString CLogPlugin::description() const - { - return tr("DockWidget to display all log messages from NeL."); - } - - QStringList CLogPlugin::dependencies() const - { - QStringList list; - list.append(Core::Constants::OVQT_CORE_PLUGIN); - return list; - } - - void CLogPlugin::addAutoReleasedObject(QObject *obj) - { - m_plugMan->addObject(obj); - m_autoReleaseObjects.prepend(obj); - } - - void CLogPlugin::setDisplayers() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); +// Object Viewer Qt - Log Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 "log_plugin.h" +#include "log_settings_page.h" +#include "qt_displayer.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" +#include "../core/menu_manager.h" +#include "../../extension_system/iplugin_spec.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// NeL includes +#include + +namespace Plugin +{ + + CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) + { + m_ui.setupUi(this); + } + + CLogPlugin::~CLogPlugin() + { + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); + + NLMISC::ErrorLog->removeDisplayer(m_displayer); + NLMISC::WarningLog->removeDisplayer(m_displayer); + NLMISC::DebugLog->removeDisplayer(m_displayer); + NLMISC::AssertLog->removeDisplayer(m_displayer); + NLMISC::InfoLog->removeDisplayer(m_displayer); + delete m_displayer; + } + + bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) + { + Q_UNUSED(errorString); + m_plugMan = pluginManager; + m_logSettingsPage = new CLogSettingsPage(this, this); + addAutoReleasedObject(m_logSettingsPage); + return true; + } + + void CLogPlugin::extensionsInitialized() + { + setDisplayers(); + + Core::ICore *core = Core::ICore::instance(); + Core::MenuManager *menuManager = core->menuManager(); + QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); + + QMainWindow *wnd = Core::ICore::instance()->mainWindow(); + wnd->addDockWidget(Qt::RightDockWidgetArea, this); + hide(); + + viewMenu->addAction(this->toggleViewAction()); + } + + 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()); +#endif // fdef NL_OS_WINDOWS^M + m_libContext = new NLMISC::CLibraryContext(*nelContext); + + m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); + + } + + QString CLogPlugin::name() const + { + return "LogPlugin"; + } + + QString CLogPlugin::version() const + { + return "1.1"; + } + + QString CLogPlugin::vendor() const + { + return "aquiles"; + } + + QString CLogPlugin::description() const + { + return tr("DockWidget to display all log messages from NeL."); + } + + QStringList CLogPlugin::dependencies() const + { + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + return list; + } + + void CLogPlugin::addAutoReleasedObject(QObject *obj) + { + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); + } + + void CLogPlugin::setDisplayers() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); - bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); - settings->endGroup(); - - if (error) { - if (!NLMISC::ErrorLog->attached(m_displayer)) - NLMISC::ErrorLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::ErrorLog->removeDisplayer(m_displayer); - } - } - if (warning) { - if (!NLMISC::WarningLog->attached(m_displayer)) - NLMISC::WarningLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::WarningLog->removeDisplayer(m_displayer); - } - } - if (debug) { - if (!NLMISC::DebugLog->attached(m_displayer)) - NLMISC::DebugLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::DebugLog->removeDisplayer(m_displayer); - } - } - if (assert) { - if (!NLMISC::AssertLog->attached(m_displayer)) - NLMISC::AssertLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::AssertLog->removeDisplayer(m_displayer); - } - } - if (info) { - if (!NLMISC::InfoLog->attached(m_displayer)) - NLMISC::InfoLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::InfoLog->removeDisplayer(m_displayer); - } - } - } -} -Q_EXPORT_PLUGIN(Plugin::CLogPlugin) + bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + + if (error) { + if (!NLMISC::ErrorLog->attached(m_displayer)) + NLMISC::ErrorLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::ErrorLog->removeDisplayer(m_displayer); + } + } + if (warning) { + if (!NLMISC::WarningLog->attached(m_displayer)) + NLMISC::WarningLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::WarningLog->removeDisplayer(m_displayer); + } + } + if (debug) { + if (!NLMISC::DebugLog->attached(m_displayer)) + NLMISC::DebugLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::DebugLog->removeDisplayer(m_displayer); + } + } + if (assert) { + if (!NLMISC::AssertLog->attached(m_displayer)) + NLMISC::AssertLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::AssertLog->removeDisplayer(m_displayer); + } + } + if (info) { + if (!NLMISC::InfoLog->attached(m_displayer)) + NLMISC::InfoLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::InfoLog->removeDisplayer(m_displayer); + } + } + } +} +Q_EXPORT_PLUGIN(Plugin::CLogPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h index 6a2d78f79..2221195a8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h @@ -1,33 +1,33 @@ -/* -Log Plugin Qt -Copyright (C) 2011 Adrian Jaekel - -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 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 . - +/* +Log Plugin Qt +Copyright (C) 2011 Adrian Jaekel + +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 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 . + */ #ifndef LOG_PLUGIN_H #define LOG_PLUGIN_H -// Project includes +// Project includes #include "ui_log_form.h" #include "../../extension_system/iplugin.h" // NeL includes #include "nel/misc/app_context.h" -// Qt includes +// Qt includes #include namespace NLMISC @@ -54,7 +54,7 @@ namespace Plugin Q_OBJECT Q_INTERFACES(ExtensionSystem::IPlugin) public: - CLogPlugin(QWidget *parent = 0); + CLogPlugin(QWidget *parent = 0); ~CLogPlugin(); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); @@ -63,26 +63,26 @@ namespace Plugin void setNelContext(NLMISC::INelContext *nelContext); NLQT::CQtDisplayer* displayer() { return m_displayer; } - QString name() const; - QString version() const; - QString vendor() const; + QString name() const; + QString version() const; + QString vendor() const; QString description() const; - QStringList dependencies() const; - - void addAutoReleasedObject(QObject *obj); - - void setDisplayers(); - - protected: - NLMISC::CLibraryContext *m_libContext; + QStringList dependencies() const; + + void addAutoReleasedObject(QObject *obj); + + void setDisplayers(); + + protected: + NLMISC::CLibraryContext *m_libContext; private: ExtensionSystem::IPluginManager *m_plugMan; QList m_autoReleaseObjects; CLogSettingsPage *m_logSettingsPage; - Ui::CLogPlugin m_ui; - + Ui::CLogPlugin m_ui; + NLQT::CQtDisplayer *m_displayer; }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp index 3aba359a5..4b3fa1ebb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp @@ -1,133 +1,133 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Adrian Jaekel -// -// 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 "log_settings_page.h" -#include "log_plugin.h" -#include "../core/core_constants.h" -#include "../core/icore.h" -#include "../../extension_system/plugin_manager.h" - -// NeL includes - -// Qt includes -#include -#include - +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Adrian Jaekel +// +// 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 "log_settings_page.h" +#include "log_plugin.h" +#include "../core/core_constants.h" +#include "../core/icore.h" +#include "../../extension_system/plugin_manager.h" + +// NeL includes + +// Qt includes +#include +#include + namespace ExtensionSystem { - class IPluginManager; -} - -namespace Plugin -{ - - class CLogPlugin; - - CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent) - : IOptionsPage(parent), - m_logPlugin(logPlugin), - m_currentPage(NULL), + class IPluginManager; +} + +namespace Plugin +{ + + class CLogPlugin; + + CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent) + : IOptionsPage(parent), + m_logPlugin(logPlugin), + m_currentPage(NULL), m_error(true), m_warning(true), m_debug(true), m_assert(true), - m_info(true) - { - } - - QString CLogSettingsPage::id() const - { - return QLatin1String("log"); - } - - QString CLogSettingsPage::trName() const - { - return tr("Log"); - } - - QString CLogSettingsPage::category() const - { - return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL); - } - - QString CLogSettingsPage::trCategory() const - { - return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL); - } - - QIcon CLogSettingsPage::categoryIcon() const - { - return QIcon(); - } - - QWidget *CLogSettingsPage::createPage(QWidget *parent) - { - m_currentPage = new QWidget(parent); - m_ui.setupUi(m_currentPage); - - readSettings(); - m_ui.errorCheck->setChecked(m_error); - m_ui.warningCheck->setChecked(m_warning); - m_ui.debugCheck->setChecked(m_debug); - m_ui.assertCheck->setChecked(m_assert); - m_ui.infoCheck->setChecked(m_info); - - return m_currentPage; - } - - void CLogSettingsPage::apply() - { - m_error = m_ui.errorCheck->isChecked(); - m_warning = m_ui.warningCheck->isChecked(); - m_debug = m_ui.debugCheck->isChecked(); - m_assert = m_ui.assertCheck->isChecked(); - m_info = m_ui.infoCheck->isChecked(); - - writeSettings(); - m_logPlugin->setDisplayers(); - } - - void CLogSettingsPage::readSettings() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); + m_info(true) + { + } + + QString CLogSettingsPage::id() const + { + return QLatin1String("log"); + } + + QString CLogSettingsPage::trName() const + { + return tr("Log"); + } + + QString CLogSettingsPage::category() const + { + return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL); + } + + QString CLogSettingsPage::trCategory() const + { + return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL); + } + + QIcon CLogSettingsPage::categoryIcon() const + { + return QIcon(); + } + + QWidget *CLogSettingsPage::createPage(QWidget *parent) + { + m_currentPage = new QWidget(parent); + m_ui.setupUi(m_currentPage); + + readSettings(); + m_ui.errorCheck->setChecked(m_error); + m_ui.warningCheck->setChecked(m_warning); + m_ui.debugCheck->setChecked(m_debug); + m_ui.assertCheck->setChecked(m_assert); + m_ui.infoCheck->setChecked(m_info); + + return m_currentPage; + } + + void CLogSettingsPage::apply() + { + m_error = m_ui.errorCheck->isChecked(); + m_warning = m_ui.warningCheck->isChecked(); + m_debug = m_ui.debugCheck->isChecked(); + m_assert = m_ui.assertCheck->isChecked(); + m_info = m_ui.infoCheck->isChecked(); + + writeSettings(); + m_logPlugin->setDisplayers(); + } + + void CLogSettingsPage::readSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); m_error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); m_warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); m_debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); m_assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); - m_info = settings->value(Core::Constants::LOG_INFO, true).toBool(); - settings->endGroup(); - } - - void CLogSettingsPage::writeSettings() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); - settings->setValue(Core::Constants::LOG_ERROR, m_error); - settings->setValue(Core::Constants::LOG_WARNING, m_warning); - settings->setValue(Core::Constants::LOG_DEBUG, m_debug); - settings->setValue(Core::Constants::LOG_ASSERT, m_assert); - settings->setValue(Core::Constants::LOG_INFO, m_info); - settings->endGroup(); - - settings->sync(); - } - + m_info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + } + + void CLogSettingsPage::writeSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); + settings->setValue(Core::Constants::LOG_ERROR, m_error); + settings->setValue(Core::Constants::LOG_WARNING, m_warning); + settings->setValue(Core::Constants::LOG_DEBUG, m_debug); + settings->setValue(Core::Constants::LOG_ASSERT, m_assert); + settings->setValue(Core::Constants::LOG_INFO, m_info); + settings->endGroup(); + + settings->sync(); + } + } /* namespace Plugin */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h index 1dffea313..dc19db1c6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h @@ -1,56 +1,56 @@ -#ifndef MISSION_COMPILER_MAIN_WINDOW_H -#define MISSION_COMPILER_MAIN_WINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace Ui { - class MissionCompilerMainWindow; -} - -struct CMission; - -class MissionCompilerMainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MissionCompilerMainWindow(QWidget *parent = 0); - ~MissionCompilerMainWindow(); - - void loadConfig(); - void saveConfig(); - QUndoStack *getUndoStack() { return m_undoStack; } - - typedef std::map TMissionContainer; - -public Q_SLOTS: - void handleFilterChanged(const QString &text); - void handleValidation(); - void handleCompile(); - void handlePublish(); - void handleAllDoubleClick(const QModelIndex &index); - void handleSelDoubleClick(const QModelIndex &index); - void handleMoveSelectedRight(); - void handleMoveSelectedLeft(); - void handleMoveAllRight(); - void handleMoveAllLeft(); - void handleDataDirButton(); - void handleDataDirChanged(const QString &text); - void handleResetFiltersButton(); - void handleChangedSettings(); - -private: - Ui::MissionCompilerMainWindow *ui; +#ifndef MISSION_COMPILER_MAIN_WINDOW_H +#define MISSION_COMPILER_MAIN_WINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace Ui { + class MissionCompilerMainWindow; +} + +struct CMission; + +class MissionCompilerMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MissionCompilerMainWindow(QWidget *parent = 0); + ~MissionCompilerMainWindow(); + + void loadConfig(); + void saveConfig(); + QUndoStack *getUndoStack() { return m_undoStack; } + + typedef std::map TMissionContainer; + +public Q_SLOTS: + void handleFilterChanged(const QString &text); + void handleValidation(); + void handleCompile(); + void handlePublish(); + void handleAllDoubleClick(const QModelIndex &index); + void handleSelDoubleClick(const QModelIndex &index); + void handleMoveSelectedRight(); + void handleMoveSelectedLeft(); + void handleMoveAllRight(); + void handleMoveAllLeft(); + void handleDataDirButton(); + void handleDataDirChanged(const QString &text); + void handleResetFiltersButton(); + void handleChangedSettings(); + +private: + Ui::MissionCompilerMainWindow *ui; void updateCompileLog(); void populateAllPrimitives(const QString &dataDir = QString()); @@ -60,16 +60,16 @@ private: void applyCheckboxes(const QStringList &servers); - QMenu *_toolModeMenu; - QUndoStack *m_undoStack; - QStringListModel *m_allPrimitivesModel; - QStringListModel *m_selectedPrimitivesModel; - QSortFilterProxyModel *m_filteredProxyModel; - QRegExp *m_regexpFilter; - QString m_compileLog; - QString m_lastDir; - - NLLIGO::CLigoConfig m_ligoConfig; -}; - -#endif // MISSION_COMPILER_MAIN_WINDOW_H + QMenu *_toolModeMenu; + QUndoStack *m_undoStack; + QStringListModel *m_allPrimitivesModel; + QStringListModel *m_selectedPrimitivesModel; + QSortFilterProxyModel *m_filteredProxyModel; + QRegExp *m_regexpFilter; + QString m_compileLog; + QString m_lastDir; + + NLLIGO::CLigoConfig m_ligoConfig; +}; + +#endif // MISSION_COMPILER_MAIN_WINDOW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui index dace315ab..3adc8e176 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui @@ -253,10 +253,7 @@ - horizontalLayoutWidget dataDirLabel - horizontalLayoutWidget - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp index a9ef08f50..206f0db77 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp @@ -1,63 +1,63 @@ -// 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 "server_entry_dialog.h" - -#include "ui_server_entry_dialog.h" - -// NeL includes - -// Qt includes -#include - -namespace MissionCompiler -{ - -ServerEntryDialog::ServerEntryDialog(QWidget *parent) - : QDialog(parent), - m_ui(new Ui::ServerEntryDialog) -{ - m_ui->setupUi(this); - - connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath())); - connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath())); -} - -ServerEntryDialog::~ServerEntryDialog() -{ - delete m_ui; -} - +// 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 "server_entry_dialog.h" + +#include "ui_server_entry_dialog.h" + +// NeL includes + +// Qt includes +#include + +namespace MissionCompiler +{ + +ServerEntryDialog::ServerEntryDialog(QWidget *parent) + : QDialog(parent), + m_ui(new Ui::ServerEntryDialog) +{ + m_ui->setupUi(this); + + connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath())); + connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath())); +} + +ServerEntryDialog::~ServerEntryDialog() +{ + delete m_ui; +} + QString ServerEntryDialog::getServerName() { return m_ui->serverNameEdit->text(); } -QString ServerEntryDialog::getTextPath() -{ - return m_ui->serverTextPathEdit->text(); -} - -QString ServerEntryDialog::getPrimPath() -{ - return m_ui->serverPrimPathEdit->text(); -} - +QString ServerEntryDialog::getTextPath() +{ + return m_ui->serverTextPathEdit->text(); +} + +QString ServerEntryDialog::getPrimPath() +{ + return m_ui->serverPrimPathEdit->text(); +} + void ServerEntryDialog::setServerName(QString name) { m_ui->serverNameEdit->setText(name); @@ -68,22 +68,22 @@ void ServerEntryDialog::setTextPath(QString path) m_ui->serverTextPathEdit->setText(path); } -void ServerEntryDialog::setPrimPath(QString path) -{ - m_ui->serverPrimPathEdit->setText(path); -} - -void ServerEntryDialog::lookupTextPath() -{ - QString curPath = m_ui->serverTextPathEdit->text(); - QString path = QFileDialog::getExistingDirectory(this, "", curPath); - m_ui->serverTextPathEdit->setText(path); -} - -void ServerEntryDialog::lookupPrimPath() -{ - QString curPath = m_ui->serverPrimPathEdit->text(); - QString path = QFileDialog::getExistingDirectory(this, "", curPath); - m_ui->serverPrimPathEdit->setText(path); -} +void ServerEntryDialog::setPrimPath(QString path) +{ + m_ui->serverPrimPathEdit->setText(path); +} + +void ServerEntryDialog::lookupTextPath() +{ + QString curPath = m_ui->serverTextPathEdit->text(); + QString path = QFileDialog::getExistingDirectory(this, "", curPath); + m_ui->serverTextPathEdit->setText(path); +} + +void ServerEntryDialog::lookupPrimPath() +{ + QString curPath = m_ui->serverPrimPathEdit->text(); + QString path = QFileDialog::getExistingDirectory(this, "", curPath); + m_ui->serverPrimPathEdit->setText(path); +} } /* namespace MissionCompiler */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h index 98a086cd0..6dd560876 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h @@ -21,8 +21,8 @@ #include -namespace Ui { - class ServerEntryDialog; +namespace Ui { + class ServerEntryDialog; } namespace MissionCompiler diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp index 74b5cfbdb..b859d9d66 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp @@ -50,8 +50,8 @@ void CSchemeManager::getSchemes(const std::string &type, std::vector -#include -#include -#include -#include - -#include "qnel_widget.h" -#include "painter_dock_widget.h" - -#include "../core/icore.h" -#include "../core/menu_manager.h" -#include "../core/core_constants.h" - -ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::ZonePainterMainWindow) -{ - ui->setupUi(this); - m_nelWidget = new NLQT::QNLWidget(this); - setCentralWidget(m_nelWidget); - - // Load the settings. - loadConfig(); - - // Set up dock widget(s) and toolbar. - m_painterDockWidget = new PainterDockWidget(this); - addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); - m_painterDockWidget->setVisible(true); - - // Insert tool modes - _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); - _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - ui->painterToolBar->addAction(_toolModeMenu->menuAction()); - //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); - - QSignalMapper *modeMapper = new QSignalMapper(this); - - _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); - _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - _toolPaintModeAction->setStatusTip(tr("Set paint mode")); - connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolPaintModeAction, 0); - - _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); - _toolFillModeAction->setStatusTip(tr("Set fill mode")); - _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); - connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolFillModeAction, 1); - - _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); - _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); - _toolSelectModeAction->setStatusTip(tr("Set select mode")); - connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolSelectModeAction, 2); - - _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); - _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); - _toolPickModeAction->setStatusTip(tr("Set color picking mode")); - connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolPickModeAction, 2); - - connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); - - m_statusBarTimer = new QTimer(this); - connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); - m_statusInfo = new QLabel(this); - m_statusInfo->hide(); - - // Set Background Color Toolbar - - - connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); - - - Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); - - m_undoStack = new QUndoStack(this); -} - -void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) -{ - QMainWindow::showEvent(showEvent); - m_statusBarTimer->start(1000); - m_statusInfo->show(); -} - -void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) -{ - m_statusBarTimer->stop(); - m_statusInfo->hide(); - QMainWindow::hideEvent(hideEvent); -} - -void ZonePainterMainWindow::updateStatusBar() -{ - m_statusInfo->setText(QString("Tool Mode: Paint Mode")); -} - -void ZonePainterMainWindow::setToolMode(int value) -{ - switch (value) - { - case 0: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); - break; - case 1: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); - break; - case 2: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); - break; - } -} - -void ZonePainterMainWindow::setToolMode() -{ - //switch (Modules::objView().getDriver()->getPolygonMode()) - //{ - //case NL3D::UDriver::Filled: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); - // break; - //case NL3D::UDriver::Line: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); - // break; - //case NL3D::UDriver::Point: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); - // break; - //} -} - -void ZonePainterMainWindow::setBackgroundColor() { - QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, - m_nelWidget->backgroundColor().G, - m_nelWidget->backgroundColor().B)); - if (color.isValid()) - m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); -} - -void ZonePainterMainWindow::loadConfig() { +#include "zone_painter_main_window.h" +#include "ui_zone_painter_main_window.h" + +#include +#include +#include +#include +#include + +#include "qnel_widget.h" +#include "painter_dock_widget.h" + +#include "../core/icore.h" +#include "../core/menu_manager.h" +#include "../core/core_constants.h" + +ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::ZonePainterMainWindow) +{ + ui->setupUi(this); + m_nelWidget = new NLQT::QNLWidget(this); + setCentralWidget(m_nelWidget); + + // Load the settings. + loadConfig(); + + // Set up dock widget(s) and toolbar. + m_painterDockWidget = new PainterDockWidget(this); + addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); + m_painterDockWidget->setVisible(true); + + // Insert tool modes + _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); + _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + ui->painterToolBar->addAction(_toolModeMenu->menuAction()); + //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); + + QSignalMapper *modeMapper = new QSignalMapper(this); + + _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); + _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + _toolPaintModeAction->setStatusTip(tr("Set paint mode")); + connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPaintModeAction, 0); + + _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); + _toolFillModeAction->setStatusTip(tr("Set fill mode")); + _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); + connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolFillModeAction, 1); + + _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); + _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); + _toolSelectModeAction->setStatusTip(tr("Set select mode")); + connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolSelectModeAction, 2); + + _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); + _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); + _toolPickModeAction->setStatusTip(tr("Set color picking mode")); + connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPickModeAction, 2); + + connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); + + m_statusBarTimer = new QTimer(this); + connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); + m_statusInfo = new QLabel(this); + m_statusInfo->hide(); + + // Set Background Color Toolbar + + + connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); + + + Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); + + m_undoStack = new QUndoStack(this); +} + +void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) +{ + QMainWindow::showEvent(showEvent); + m_statusBarTimer->start(1000); + m_statusInfo->show(); +} + +void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) +{ + m_statusBarTimer->stop(); + m_statusInfo->hide(); + QMainWindow::hideEvent(hideEvent); +} + +void ZonePainterMainWindow::updateStatusBar() +{ + m_statusInfo->setText(QString("Tool Mode: Paint Mode")); +} + +void ZonePainterMainWindow::setToolMode(int value) +{ + switch (value) + { + case 0: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + break; + case 1: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + break; + case 2: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + break; + } +} + +void ZonePainterMainWindow::setToolMode() +{ + //switch (Modules::objView().getDriver()->getPolygonMode()) + //{ + //case NL3D::UDriver::Filled: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + // break; + //case NL3D::UDriver::Line: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + // break; + //case NL3D::UDriver::Point: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + // break; + //} +} + +void ZonePainterMainWindow::setBackgroundColor() { + QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, + m_nelWidget->backgroundColor().G, + m_nelWidget->backgroundColor().B)); + if (color.isValid()) + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); +} + +void ZonePainterMainWindow::loadConfig() { QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("ZonePainter"); QColor color; color = settings->value("BackgroundColor", QColor(80, 80, 80)).value(); settings->endGroup(); - m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); -} - -void ZonePainterMainWindow::saveConfig() { + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); +} + +void ZonePainterMainWindow::saveConfig() { QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("ZonePainter" ); @@ -157,12 +157,12 @@ void ZonePainterMainWindow::saveConfig() { settings->setValue("BackgroundColor", color); settings->endGroup(); - settings->sync(); -} - -ZonePainterMainWindow::~ZonePainterMainWindow() -{ - delete ui; - delete m_nelWidget; - delete m_painterDockWidget; -} + settings->sync(); +} + +ZonePainterMainWindow::~ZonePainterMainWindow() +{ + delete ui; + delete m_nelWidget; + delete m_painterDockWidget; +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h index 0dbfd9948..caa4433e4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h @@ -1,57 +1,57 @@ -#ifndef ZONE_PAINTER_MAIN_WINDOW_H -#define ZONE_PAINTER_MAIN_WINDOW_H - -#include -#include -#include -#include -#include - -namespace NLQT { - class QNLWidget; -} - -namespace Ui { - class ZonePainterMainWindow; -} - -class PainterDockWidget; - -class ZonePainterMainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit ZonePainterMainWindow(QWidget *parent = 0); - ~ZonePainterMainWindow(); - - void loadConfig(); - void saveConfig(); - QUndoStack *getUndoStack() { return m_undoStack; } -public Q_SLOTS: +#ifndef ZONE_PAINTER_MAIN_WINDOW_H +#define ZONE_PAINTER_MAIN_WINDOW_H + +#include +#include +#include +#include +#include + +namespace NLQT { + class QNLWidget; +} + +namespace Ui { + class ZonePainterMainWindow; +} + +class PainterDockWidget; + +class ZonePainterMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ZonePainterMainWindow(QWidget *parent = 0); + ~ZonePainterMainWindow(); + + void loadConfig(); + void saveConfig(); + QUndoStack *getUndoStack() { return m_undoStack; } +public Q_SLOTS: void setToolMode(int value); - void setToolMode(); - void updateStatusBar(); - void setBackgroundColor(); - -protected: - virtual void showEvent(QShowEvent *showEvent); - virtual void hideEvent(QHideEvent *hideEvent); - -private: - Ui::ZonePainterMainWindow *ui; - NLQT::QNLWidget *m_nelWidget; - PainterDockWidget *m_painterDockWidget; - QTimer *m_statusBarTimer; - QLabel *m_statusInfo; - + void setToolMode(); + void updateStatusBar(); + void setBackgroundColor(); + +protected: + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); + +private: + Ui::ZonePainterMainWindow *ui; + NLQT::QNLWidget *m_nelWidget; + PainterDockWidget *m_painterDockWidget; + QTimer *m_statusBarTimer; + QLabel *m_statusInfo; + QAction *_toolPaintModeAction; QAction *_toolFillModeAction; QAction *_toolSelectModeAction; QAction *_toolPickModeAction; - QMenu *_toolModeMenu; - QUndoStack *m_undoStack; - //QAction *m_setBackColorAction; -}; - -#endif // ZONE_PAINTER_MAIN_WINDOW_H + QMenu *_toolModeMenu; + QUndoStack *m_undoStack; + //QAction *m_setBackColorAction; +}; + +#endif // ZONE_PAINTER_MAIN_WINDOW_H 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 70bf51f81..af026b3df 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 @@ -1,724 +1,724 @@ -/* -Object Viewer Qt Widget -Copyright (C) 2010 Adrian Jaekel - -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 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 . -*/ - -#include "object_viewer_widget.h" - -// STL includes - -// NeL includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt includes -#include - -// Project includes - -Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget) - -using namespace NLMISC; -using namespace NL3D; -using namespace std; - -namespace NLQT -{ - CObjectViewerWidget *CObjectViewerWidget::_objectViewerWidget = NULL; - - CObjectViewerWidget::CObjectViewerWidget(QWidget *parent) - : _isGraphicsInitialized(false), _isGraphicsEnabled(false), - _Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2), - _CameraFocal(75), _CurrentInstance(""), _BloomEffect(false), - _Scene(0), QWidget(parent) - { +/* +Object Viewer Qt Widget +Copyright (C) 2010 Adrian Jaekel + +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 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 . +*/ + +#include "object_viewer_widget.h" + +// STL includes + +// NeL includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include + +// Project includes + +Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget) + +using namespace NLMISC; +using namespace NL3D; +using namespace std; + +namespace NLQT +{ + CObjectViewerWidget *CObjectViewerWidget::_objectViewerWidget = NULL; + + CObjectViewerWidget::CObjectViewerWidget(QWidget *parent) + : _isGraphicsInitialized(false), _isGraphicsEnabled(false), + _Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2), + _CameraFocal(75), _CurrentInstance(""), _BloomEffect(false), + _Scene(0), QWidget(parent) + { setMouseTracking(true); - setFocusPolicy(Qt::StrongFocus); - _objectViewerWidget = this; - - _isGraphicsEnabled = true; - - // As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed. - // This can be used to do heavy work while providing a snappy user interface. - _mainTimer = new QTimer(this); - connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender())); - // timer->start(); // <- timeout 0 - // it's heavy on cpu, though, when no 3d driver initialized :) - _mainTimer->start(25); // 25fps - } - - CObjectViewerWidget::~CObjectViewerWidget() - { - release(); - } - - void CObjectViewerWidget::showEvent ( QShowEvent * event ) - { - if (!_mainTimer->isActive()) - { - _mainTimer->start(25); - } - } - - void CObjectViewerWidget::setNelContext(NLMISC::INelContext &nelContext) - { - _LibContext = new CLibraryContext(nelContext); - } - - void CObjectViewerWidget::init() - { - - connect(this, SIGNAL(topLevelChanged(bool)), - this, SLOT(topLevelChanged(bool))); - //H_AUTO2 - //nldebug("%d %d %d",_nlw->winId(), width(), height()); - - -#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - //dynamic_cast(widget())->makeCurrent(); -#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - - nlWindow wnd = (nlWindow)winId(); - uint16 w = width(); - uint16 h = height(); - - setMouseTracking(true); - - // set background color from config - //NLMISC::CConfigFile::CVar v = Modules::config().getConfigFile().getVar("BackgroundColor"); - //_BackgroundColor = CRGBA(v.asInt(0), v.asInt(1), v.asInt(2)); - _BackgroundColor = CRGBA(255, 255, 255); - - // set graphics driver from config - //NLMISC::CConfigFile::CVar v2 = Modules::config().getConfigFile().getVar("GraphicsDriver"); - // Choose driver opengl to work correctly under Linux example - _Direct3D = false; //_Driver = OpenGL; - -#ifdef NL_OS_WINDOWS - //std::string driver = v2.asString(); - //if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D; - //else if (driver == "OpenGL") _Direct3D = false; //m_Driver = OpenGL; - //else nlwarning("Invalid driver specified, defaulting to OpenGL"); -#endif - - //Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal)); - //Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect)); - - // create the driver - nlassert(!_Driver); - - _Driver = UDriver::createDriver(0, _Direct3D, 0); - nlassert(_Driver); - - // initialize the window with config file values - _Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32)); - - //_Light = ULight::createLight(); - - //// set mode of the light - //_Light->setMode(ULight::DirectionalLight); - - //// set position of the light - //_Light->setPosition(CVector(-20.f, 30.f, 10.f)); - - //// white light - //_Light->setAmbiant(CRGBA(255, 255, 255)); - - //// set and enable the light - //_Driver->setLight(0, *_Light); - //_Driver->enableLight(0); - - // Create a scene - _Scene = _Driver->createScene(true); - - _PlayListManager = _Scene->createPlayListManager(); - - //_Scene->enableLightingSystem(true); - - // create the camera - UCamera camera = _Scene->getCam(); - - camera.setTransformMode (UTransformable::DirectMatrix); - - setSizeViewport(w, h); - - // camera will look at entities - camera.lookAt(NLMISC::CVector(_dist,0,1), NLMISC::CVector(0,0,0.5)); - - NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0); - - _MouseListener = _Driver->create3dMouseListener(); - _MouseListener->setMatrix(_Scene->getCam().getMatrix()); - _MouseListener->setFrustrum(_Scene->getCam().getFrustum()); - _MouseListener->setHotSpot(hotSpot); - _MouseListener->setMouseMode(U3dMouseListener::edit3d); - - NL3D::CBloomEffect::instance().setDriver(_Driver); - NL3D::CBloomEffect::instance().setScene(_Scene); - NL3D::CBloomEffect::instance().init(!_Direct3D); - //NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt()); - //NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool()); - } - - void CObjectViewerWidget::release() - { - //H_AUTO2 - nldebug(""); - - _Driver->delete3dMouseListener(_MouseListener); - - // delete all entities - deleteEntities(); - - _Scene->deletePlayListManager(_PlayListManager); - - // delete the scene - _Driver->deleteScene(_Scene); - - // delete the light - delete _Light; - - // release driver - nlassert(_Driver); - _Driver->release(); - delete _Driver; - _Driver = NULL; - } - - void CObjectViewerWidget::updateRender() - { - //nldebug("CMainWindow::updateRender"); - updateInitialization(isVisible()); - - //QModelIndex index = _dirModel->setRootPath("D:/Dev/Ryzom/code/ryzom/common/data_leveldesign/leveldesign"); - //_dirTree->setRootIndex(index); - - if (isVisible()) - { - // call all update functions - // 01. Update Utilities (configuration etc) - - // 02. Update Time (deltas) - // ... - - // 03. Update Receive (network, servertime, receive messages) - // ... - - // 04. Update Input (keyboard controls, etc) - if (_isGraphicsInitialized) - updateInput(); - - // 05. Update Weather (sky, snow, wind, fog, sun) - // ... - - // 06. Update Entities (movement, do after possible tp from incoming messages etc) - // - Move other entities - // - Update self entity - // - Move bullets - // ... - - // 07. Update Landscape (async zone loading near entity) - // ... - - // 08. Update Collisions (entities) - // - Update entities - // - Update move container (swap with Update entities? todo: check code!) - // - Update bullets - // ... - - // 09. Update Animations (playlists) - // - Needs to be either before or after entities, not sure, - // there was a problem with wrong order a while ago!!! - - - //updateAnimation(_AnimationDialog->getTime()); - updateAnimatePS(); - // 10. Update Camera (depends on entities) - // ... - - // 11. Update Interface (login, ui, etc) - // ... - - // 12. Update Sound (sound driver) - // ... - - // 13. Update Send (network, send new position etc) - // ... - - // 14. Update Debug (stuff for dev) - // ... - - if (_isGraphicsInitialized && !getDriver()->isLost()) - { - // 01. Render Driver (background color) - renderDriver(); // clear all buffers - - // 02. Render Sky (sky scene) - // ... - - // 04. Render Scene (entity scene) - renderScene(); - - // 05. Render Effects (flare) - // ... - - // 06. Render Interface 3D (player names) - // ... - - // 07. Render Debug 3D - // ... - - // 08. Render Interface 2D (chatboxes etc, optionally does have 3d) - // ... - - // 09. Render Debug 2D (stuff for dev) - renderDebug2D(); - - // swap 3d buffers - getDriver()->swapBuffers(); - } - } - } - - void CObjectViewerWidget::updateInitialization(bool visible) - { - //nldebug("CMainWindow::updateInitialization"); - bool done; - do - { - done = true; // set false whenever change - bool wantGraphics = _isGraphicsEnabled && visible; - // bool wantLandscape = wantGraphics && m_IsGraphicsInitialized && isLandscapeEnabled; - - // .. stuff that depends on other stuff goes on top to prioritize deinitialization - - // Landscape - // ... - - // Graphics (Driver) - if (_isGraphicsInitialized) - { - if (!wantGraphics) - { - //_isGraphicsInitialized = false; - //release(); - _mainTimer->stop(); - //done = false; - } - } - else - { - if (wantGraphics) - { - init(); - _isGraphicsInitialized = true; - _mainTimer->start(25); - //done = false; - } - } - } - while (!done); - } - - void CObjectViewerWidget::updateInput() - { - _Driver->EventServer.pump(); - - // New matrix from camera - _Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix); - _Scene->getCam().setMatrix (_MouseListener->getViewMatrix()); - - //nldebug("%s",_Scene->getCam().getMatrix().getPos().asString().c_str()); - } - - void CObjectViewerWidget::renderDriver() - { - // Render the scene. - if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) - { - NL3D::CBloomEffect::instance().initBloom(); - } - _Driver->clearBuffers(_BackgroundColor); - } - - void CObjectViewerWidget::renderScene() - { - // render the scene - _Scene->render(); - - if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) - { - NL3D::CBloomEffect::instance().endBloom(); - NL3D::CBloomEffect::instance().endInterfacesDisplayBloom(); - } - } - - void CObjectViewerWidget::renderDebug2D() - { - } - - void CObjectViewerWidget::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga) - { - //H_AUTO2 - - // FIXME: create screenshot path if it doesn't exist! - - // empty bitmap - CBitmap bitmap; - // copy the driver buffer to the bitmap - _Driver->getBuffer(bitmap); - // create the file name - string filename = std::string("./") + nameFile; - // write the bitmap as a jpg, png or tga to the file - if (jpg) - { - string newfilename = CFile::findNewFile(filename + ".jpg"); - COFile outputFile(newfilename); - bitmap.writeJPG(outputFile, 100); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - if (png) - { - string newfilename = CFile::findNewFile(filename + ".png"); - COFile outputFile(newfilename); - bitmap.writePNG(outputFile, 24); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - if (tga) - { - string newfilename = CFile::findNewFile(filename + ".tga"); - COFile outputFile(newfilename); - bitmap.writeTGA(outputFile, 24, false); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - } - - bool CObjectViewerWidget::loadMesh(const std::string &meshFileName, const std::string &skelFileName) - { - std::string fileName = CFile::getFilenameWithoutExtension(meshFileName); - if ( _Entities.count(fileName) != 0) - return false; - - CPath::addSearchPath(CFile::getPath(meshFileName), false, false); - - // create instance of the mesh character - UInstance Entity = _Scene->createInstance(meshFileName); - - CAABBox bbox; - Entity.getShapeAABBox(bbox); - setCamera(_Scene, bbox , Entity, true); - - _MouseListener->setMatrix(_Scene->getCam().getMatrix()); - - USkeleton Skeleton = _Scene->createSkeleton(skelFileName); - - // if we can't create entity, skip it - if (Entity.empty()) return false; - - // create a new entity - EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first; - CEntity &entity = (*eit).second; - - // set the entity up - entity._Name = fileName; - entity._FileNameShape = meshFileName; - entity._FileNameSkeleton = skelFileName; - entity._Instance = Entity; - if (!Skeleton.empty()) - { - entity._Skeleton = Skeleton; - entity._Skeleton.bindSkin (entity._Instance); - } - entity._AnimationSet = _Driver->createAnimationSet(false); - entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet); - return true; - } - - void CObjectViewerWidget::setVisible(bool visible) - { - // called by show() - // code assuming visible window needed to init the 3d driver - nldebug("%d", visible); - if (visible) - { - QWidget::setVisible(true); - } - else - { - QWidget::setVisible(false); - } - } - - void CObjectViewerWidget::resetScene() - { - deleteEntities(); - - // Reset camera. - //.. - - // to load files with the same name but located in different directories - //CPath::clearMap(); - - // load and set search paths from config - //Modules::config().configSearchPaths(); - - _CurrentInstance = ""; - - nlinfo("Scene cleared"); - } - - void CObjectViewerWidget::setBackgroundColor(NLMISC::CRGBA backgroundColor) - { - _BackgroundColor = backgroundColor; - - // config file variable changes - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0); - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1); - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.B, 2); - } - - void CObjectViewerWidget::setGraphicsDriver(bool Direct3D) - { - //_Direct3D = Direct3D; - - //if (_Direct3D) Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("Direct3D"); - //else Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("OpenGL"); - } - - void CObjectViewerWidget::setSizeViewport(uint16 w, uint16 h) - { - _Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); - } - - void CObjectViewerWidget::setCurrentObject(const std::string &name) - { - if ((_Entities.count(name) != 0) || ( name.empty() )) _CurrentInstance = name; - else nlerror ("Entity %s not found", name.c_str()); - nlinfo("set current entity %s", _CurrentInstance.c_str()); - } - - CEntity& CObjectViewerWidget::getEntity(const std::string &name) - { - if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); - EIT eit = _Entities.find (name); - return (*eit).second; - } - - void CObjectViewerWidget::getListObjects(std::vector &listObj) - { - listObj.clear(); - for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) - listObj.push_back((*eit).second._Name); - } - - void CObjectViewerWidget::deleteEntity(CEntity &entity) - { - if (entity._PlayList != NULL) - { - _PlayListManager->deletePlayList (entity._PlayList); - entity._PlayList = NULL; - } - - if (entity._AnimationSet != NULL) - { - _Driver->deleteAnimationSet(entity._AnimationSet); - entity._AnimationSet = NULL; - } - - if (!entity._Skeleton.empty()) - { - entity._Skeleton.detachSkeletonSon(entity._Instance); - - _Scene->deleteSkeleton(entity._Skeleton); - entity._Skeleton = NULL; - } - - if (!entity._Instance.empty()) - { - _Scene->deleteInstance(entity._Instance); - entity._Instance = NULL; - } - } - - void CObjectViewerWidget::deleteEntities() - { - for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) - { - CEntity &entity = (*eit).second; - deleteEntity(entity); - } - _Entities.clear(); - } - - void CObjectViewerWidget::setCamera(NL3D::UScene *scene, CAABBox &bbox, UTransform &entity, bool high_z) - { - CVector pos(0.f, 0.f, 0.f); - CQuat quat(0.f, 0.f, 0.f, 0.f); - NL3D::UInstance inst; - inst.cast(entity); - if (!inst.empty()) - { - inst.getDefaultPos(pos); - inst.getDefaultRotQuat(quat); - } - - // fix scale (some shapes have a different value) - entity.setScale(1.f, 1.f, 1.f); - - UCamera Camera = scene->getCam(); - CVector max_radius = bbox.getHalfSize(); - - CVector center = bbox.getCenter(); - entity.setPivot(center); - center += pos; - - //scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); - float fov = float(_CameraFocal * (float)Pi/180.0); - //Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f); - float radius = max(max(max_radius.x, max_radius.y), max_radius.z); - if (radius == 0.f) radius = 1.f; - float left, right, bottom, top, znear, zfar; - Camera.getFrustum(left, right, bottom, top, znear, zfar); - float dist = (radius / (tan(fov/2))) * 0.2; - CVector eye(center); - CVector ax(quat.getAxis()); - - if (ax.isNull() || ax == CVector::I) - { - ax = CVector::J; - } - else if (ax == -CVector::K) - { - ax = -CVector::J; - } - - eye -= ax * (dist+radius); - if (high_z) - eye.z += max_radius.z/1.0f; - Camera.lookAt(eye, center); - setupLight(eye, center - eye); - } - - bool CObjectViewerWidget::setupLight(const CVector &position, const CVector &direction) - { - if (!_Light) - _Light = ULight::createLight(); - if (!_Light) return false; - - // set mode of the light - _Light->setMode(ULight::DirectionalLight); - - // set position of the light - // Light->setupDirectional(settings.light_ambiant, settings.light_diffuse, settings.light_specular, settings.light_direction); - NLMISC::CRGBA light_ambiant = CRGBA(0,0,0); - NLMISC::CRGBA light_diffuse = CRGBA(255,255,255); - NLMISC::CRGBA light_specular = CRGBA(255,255,255); - NLMISC::CVector light_direction = CVector(0.25, 0.25, 0.25); - _Light->setupPointLight(light_ambiant, light_diffuse, light_specular, position, direction + light_direction); - - // set and enable the light - _Driver->setLight(0, *_Light); - _Driver->enableLight(0); - - return true; - } - - QIcon* CObjectViewerWidget::saveOneImage(string shapename) - { - int output_width = 128; - int output_height = 128; - - // Create a scene - NL3D::UScene* Scene = _Driver->createScene(true); - if (!Scene) return 0; - - // get scene camera - if (Scene->getCam().empty()) - { - nlwarning("can't get camera from scene"); - return 0; - } - - // add an entity to the scene - UInstance Entity = Scene->createInstance(shapename.c_str()); - - // if we can't create entity, skip it - if (Entity.empty()) - { - nlwarning("can't create instance from %s", shapename.c_str()); - return 0; - } - - // get AABox of Entity - CAABBox bbox; - Entity.getShapeAABBox(bbox); - setCamera(Scene, bbox , Entity, true); - Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)output_width/output_height, 0.1f, 1000); - - string filename = CPath::standardizePath("") + toString("%s.%s", shapename.c_str(), "png"); - - // the background is white - _Driver->clearBuffers(); - - // render the scene - Scene->render(); - - CBitmap btm; - _Driver->getBuffer(btm); - - btm.resample(output_width, output_height); - - COFile fs; - - if (fs.open(filename)) - { - if (!btm.writePNG(fs, 24)) - { - nlwarning("can't save image to PNG"); - return 0; - } - } - else - { - nlwarning("can't create %s", "test.png"); - return 0; - } - fs.close(); - - QIcon *icon = new QIcon(QString(filename.c_str())); - //CFile::deleteFile(filename); - return icon; - } + setFocusPolicy(Qt::StrongFocus); + _objectViewerWidget = this; + + _isGraphicsEnabled = true; + + // As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed. + // This can be used to do heavy work while providing a snappy user interface. + _mainTimer = new QTimer(this); + connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender())); + // timer->start(); // <- timeout 0 + // it's heavy on cpu, though, when no 3d driver initialized :) + _mainTimer->start(25); // 25fps + } + + CObjectViewerWidget::~CObjectViewerWidget() + { + release(); + } + + void CObjectViewerWidget::showEvent ( QShowEvent * event ) + { + if (!_mainTimer->isActive()) + { + _mainTimer->start(25); + } + } + + void CObjectViewerWidget::setNelContext(NLMISC::INelContext &nelContext) + { + _LibContext = new CLibraryContext(nelContext); + } + + void CObjectViewerWidget::init() + { + + connect(this, SIGNAL(topLevelChanged(bool)), + this, SLOT(topLevelChanged(bool))); + //H_AUTO2 + //nldebug("%d %d %d",_nlw->winId(), width(), height()); + + +#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) + //dynamic_cast(widget())->makeCurrent(); +#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) + + nlWindow wnd = (nlWindow)winId(); + uint16 w = width(); + uint16 h = height(); + + setMouseTracking(true); + + // set background color from config + //NLMISC::CConfigFile::CVar v = Modules::config().getConfigFile().getVar("BackgroundColor"); + //_BackgroundColor = CRGBA(v.asInt(0), v.asInt(1), v.asInt(2)); + _BackgroundColor = CRGBA(255, 255, 255); + + // set graphics driver from config + //NLMISC::CConfigFile::CVar v2 = Modules::config().getConfigFile().getVar("GraphicsDriver"); + // Choose driver opengl to work correctly under Linux example + _Direct3D = false; //_Driver = OpenGL; + +#ifdef NL_OS_WINDOWS + //std::string driver = v2.asString(); + //if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D; + //else if (driver == "OpenGL") _Direct3D = false; //m_Driver = OpenGL; + //else nlwarning("Invalid driver specified, defaulting to OpenGL"); +#endif + + //Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal)); + //Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect)); + + // create the driver + nlassert(!_Driver); + + _Driver = UDriver::createDriver(0, _Direct3D, 0); + nlassert(_Driver); + + // initialize the window with config file values + _Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32)); + + //_Light = ULight::createLight(); + + //// set mode of the light + //_Light->setMode(ULight::DirectionalLight); + + //// set position of the light + //_Light->setPosition(CVector(-20.f, 30.f, 10.f)); + + //// white light + //_Light->setAmbiant(CRGBA(255, 255, 255)); + + //// set and enable the light + //_Driver->setLight(0, *_Light); + //_Driver->enableLight(0); + + // Create a scene + _Scene = _Driver->createScene(true); + + _PlayListManager = _Scene->createPlayListManager(); + + //_Scene->enableLightingSystem(true); + + // create the camera + UCamera camera = _Scene->getCam(); + + camera.setTransformMode (UTransformable::DirectMatrix); + + setSizeViewport(w, h); + + // camera will look at entities + camera.lookAt(NLMISC::CVector(_dist,0,1), NLMISC::CVector(0,0,0.5)); + + NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0); + + _MouseListener = _Driver->create3dMouseListener(); + _MouseListener->setMatrix(_Scene->getCam().getMatrix()); + _MouseListener->setFrustrum(_Scene->getCam().getFrustum()); + _MouseListener->setHotSpot(hotSpot); + _MouseListener->setMouseMode(U3dMouseListener::edit3d); + + NL3D::CBloomEffect::instance().setDriver(_Driver); + NL3D::CBloomEffect::instance().setScene(_Scene); + NL3D::CBloomEffect::instance().init(!_Direct3D); + //NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt()); + //NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool()); + } + + void CObjectViewerWidget::release() + { + //H_AUTO2 + nldebug(""); + + _Driver->delete3dMouseListener(_MouseListener); + + // delete all entities + deleteEntities(); + + _Scene->deletePlayListManager(_PlayListManager); + + // delete the scene + _Driver->deleteScene(_Scene); + + // delete the light + delete _Light; + + // release driver + nlassert(_Driver); + _Driver->release(); + delete _Driver; + _Driver = NULL; + } + + void CObjectViewerWidget::updateRender() + { + //nldebug("CMainWindow::updateRender"); + updateInitialization(isVisible()); + + //QModelIndex index = _dirModel->setRootPath("D:/Dev/Ryzom/code/ryzom/common/data_leveldesign/leveldesign"); + //_dirTree->setRootIndex(index); + + if (isVisible()) + { + // call all update functions + // 01. Update Utilities (configuration etc) + + // 02. Update Time (deltas) + // ... + + // 03. Update Receive (network, servertime, receive messages) + // ... + + // 04. Update Input (keyboard controls, etc) + if (_isGraphicsInitialized) + updateInput(); + + // 05. Update Weather (sky, snow, wind, fog, sun) + // ... + + // 06. Update Entities (movement, do after possible tp from incoming messages etc) + // - Move other entities + // - Update self entity + // - Move bullets + // ... + + // 07. Update Landscape (async zone loading near entity) + // ... + + // 08. Update Collisions (entities) + // - Update entities + // - Update move container (swap with Update entities? todo: check code!) + // - Update bullets + // ... + + // 09. Update Animations (playlists) + // - Needs to be either before or after entities, not sure, + // there was a problem with wrong order a while ago!!! + + + //updateAnimation(_AnimationDialog->getTime()); + updateAnimatePS(); + // 10. Update Camera (depends on entities) + // ... + + // 11. Update Interface (login, ui, etc) + // ... + + // 12. Update Sound (sound driver) + // ... + + // 13. Update Send (network, send new position etc) + // ... + + // 14. Update Debug (stuff for dev) + // ... + + if (_isGraphicsInitialized && !getDriver()->isLost()) + { + // 01. Render Driver (background color) + renderDriver(); // clear all buffers + + // 02. Render Sky (sky scene) + // ... + + // 04. Render Scene (entity scene) + renderScene(); + + // 05. Render Effects (flare) + // ... + + // 06. Render Interface 3D (player names) + // ... + + // 07. Render Debug 3D + // ... + + // 08. Render Interface 2D (chatboxes etc, optionally does have 3d) + // ... + + // 09. Render Debug 2D (stuff for dev) + renderDebug2D(); + + // swap 3d buffers + getDriver()->swapBuffers(); + } + } + } + + void CObjectViewerWidget::updateInitialization(bool visible) + { + //nldebug("CMainWindow::updateInitialization"); + bool done; + do + { + done = true; // set false whenever change + bool wantGraphics = _isGraphicsEnabled && visible; + // bool wantLandscape = wantGraphics && m_IsGraphicsInitialized && isLandscapeEnabled; + + // .. stuff that depends on other stuff goes on top to prioritize deinitialization + + // Landscape + // ... + + // Graphics (Driver) + if (_isGraphicsInitialized) + { + if (!wantGraphics) + { + //_isGraphicsInitialized = false; + //release(); + _mainTimer->stop(); + //done = false; + } + } + else + { + if (wantGraphics) + { + init(); + _isGraphicsInitialized = true; + _mainTimer->start(25); + //done = false; + } + } + } + while (!done); + } + + void CObjectViewerWidget::updateInput() + { + _Driver->EventServer.pump(); + + // New matrix from camera + _Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix); + _Scene->getCam().setMatrix (_MouseListener->getViewMatrix()); + + //nldebug("%s",_Scene->getCam().getMatrix().getPos().asString().c_str()); + } + + void CObjectViewerWidget::renderDriver() + { + // Render the scene. + if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) + { + NL3D::CBloomEffect::instance().initBloom(); + } + _Driver->clearBuffers(_BackgroundColor); + } + + void CObjectViewerWidget::renderScene() + { + // render the scene + _Scene->render(); + + if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) + { + NL3D::CBloomEffect::instance().endBloom(); + NL3D::CBloomEffect::instance().endInterfacesDisplayBloom(); + } + } + + void CObjectViewerWidget::renderDebug2D() + { + } + + void CObjectViewerWidget::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga) + { + //H_AUTO2 + + // FIXME: create screenshot path if it doesn't exist! + + // empty bitmap + CBitmap bitmap; + // copy the driver buffer to the bitmap + _Driver->getBuffer(bitmap); + // create the file name + string filename = std::string("./") + nameFile; + // write the bitmap as a jpg, png or tga to the file + if (jpg) + { + string newfilename = CFile::findNewFile(filename + ".jpg"); + COFile outputFile(newfilename); + bitmap.writeJPG(outputFile, 100); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + if (png) + { + string newfilename = CFile::findNewFile(filename + ".png"); + COFile outputFile(newfilename); + bitmap.writePNG(outputFile, 24); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + if (tga) + { + string newfilename = CFile::findNewFile(filename + ".tga"); + COFile outputFile(newfilename); + bitmap.writeTGA(outputFile, 24, false); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + } + + bool CObjectViewerWidget::loadMesh(const std::string &meshFileName, const std::string &skelFileName) + { + std::string fileName = CFile::getFilenameWithoutExtension(meshFileName); + if ( _Entities.count(fileName) != 0) + return false; + + CPath::addSearchPath(CFile::getPath(meshFileName), false, false); + + // create instance of the mesh character + UInstance Entity = _Scene->createInstance(meshFileName); + + CAABBox bbox; + Entity.getShapeAABBox(bbox); + setCamera(_Scene, bbox , Entity, true); + + _MouseListener->setMatrix(_Scene->getCam().getMatrix()); + + USkeleton Skeleton = _Scene->createSkeleton(skelFileName); + + // if we can't create entity, skip it + if (Entity.empty()) return false; + + // create a new entity + EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first; + CEntity &entity = (*eit).second; + + // set the entity up + entity._Name = fileName; + entity._FileNameShape = meshFileName; + entity._FileNameSkeleton = skelFileName; + entity._Instance = Entity; + if (!Skeleton.empty()) + { + entity._Skeleton = Skeleton; + entity._Skeleton.bindSkin (entity._Instance); + } + entity._AnimationSet = _Driver->createAnimationSet(false); + entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet); + return true; + } + + void CObjectViewerWidget::setVisible(bool visible) + { + // called by show() + // code assuming visible window needed to init the 3d driver + nldebug("%d", visible); + if (visible) + { + QWidget::setVisible(true); + } + else + { + QWidget::setVisible(false); + } + } + + void CObjectViewerWidget::resetScene() + { + deleteEntities(); + + // Reset camera. + //.. + + // to load files with the same name but located in different directories + //CPath::clearMap(); + + // load and set search paths from config + //Modules::config().configSearchPaths(); + + _CurrentInstance = ""; + + nlinfo("Scene cleared"); + } + + void CObjectViewerWidget::setBackgroundColor(NLMISC::CRGBA backgroundColor) + { + _BackgroundColor = backgroundColor; + + // config file variable changes + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0); + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1); + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.B, 2); + } + + void CObjectViewerWidget::setGraphicsDriver(bool Direct3D) + { + //_Direct3D = Direct3D; + + //if (_Direct3D) Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("Direct3D"); + //else Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("OpenGL"); + } + + void CObjectViewerWidget::setSizeViewport(uint16 w, uint16 h) + { + _Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); + } + + void CObjectViewerWidget::setCurrentObject(const std::string &name) + { + if ((_Entities.count(name) != 0) || ( name.empty() )) _CurrentInstance = name; + else nlerror ("Entity %s not found", name.c_str()); + nlinfo("set current entity %s", _CurrentInstance.c_str()); + } + + CEntity& CObjectViewerWidget::getEntity(const std::string &name) + { + if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); + EIT eit = _Entities.find (name); + return (*eit).second; + } + + void CObjectViewerWidget::getListObjects(std::vector &listObj) + { + listObj.clear(); + for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) + listObj.push_back((*eit).second._Name); + } + + void CObjectViewerWidget::deleteEntity(CEntity &entity) + { + if (entity._PlayList != NULL) + { + _PlayListManager->deletePlayList (entity._PlayList); + entity._PlayList = NULL; + } + + if (entity._AnimationSet != NULL) + { + _Driver->deleteAnimationSet(entity._AnimationSet); + entity._AnimationSet = NULL; + } + + if (!entity._Skeleton.empty()) + { + entity._Skeleton.detachSkeletonSon(entity._Instance); + + _Scene->deleteSkeleton(entity._Skeleton); + entity._Skeleton = NULL; + } + + if (!entity._Instance.empty()) + { + _Scene->deleteInstance(entity._Instance); + entity._Instance = NULL; + } + } + + void CObjectViewerWidget::deleteEntities() + { + for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) + { + CEntity &entity = (*eit).second; + deleteEntity(entity); + } + _Entities.clear(); + } + + void CObjectViewerWidget::setCamera(NL3D::UScene *scene, CAABBox &bbox, UTransform &entity, bool high_z) + { + CVector pos(0.f, 0.f, 0.f); + CQuat quat(0.f, 0.f, 0.f, 0.f); + NL3D::UInstance inst; + inst.cast(entity); + if (!inst.empty()) + { + inst.getDefaultPos(pos); + inst.getDefaultRotQuat(quat); + } + + // fix scale (some shapes have a different value) + entity.setScale(1.f, 1.f, 1.f); + + UCamera Camera = scene->getCam(); + CVector max_radius = bbox.getHalfSize(); + + CVector center = bbox.getCenter(); + entity.setPivot(center); + center += pos; + + //scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); + float fov = float(_CameraFocal * (float)Pi/180.0); + //Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f); + float radius = max(max(max_radius.x, max_radius.y), max_radius.z); + if (radius == 0.f) radius = 1.f; + float left, right, bottom, top, znear, zfar; + Camera.getFrustum(left, right, bottom, top, znear, zfar); + float dist = (radius / (tan(fov/2))) * 0.2; + CVector eye(center); + CVector ax(quat.getAxis()); + + if (ax.isNull() || ax == CVector::I) + { + ax = CVector::J; + } + else if (ax == -CVector::K) + { + ax = -CVector::J; + } + + eye -= ax * (dist+radius); + if (high_z) + eye.z += max_radius.z/1.0f; + Camera.lookAt(eye, center); + setupLight(eye, center - eye); + } + + bool CObjectViewerWidget::setupLight(const CVector &position, const CVector &direction) + { + if (!_Light) + _Light = ULight::createLight(); + if (!_Light) return false; + + // set mode of the light + _Light->setMode(ULight::DirectionalLight); + + // set position of the light + // Light->setupDirectional(settings.light_ambiant, settings.light_diffuse, settings.light_specular, settings.light_direction); + NLMISC::CRGBA light_ambiant = CRGBA(0,0,0); + NLMISC::CRGBA light_diffuse = CRGBA(255,255,255); + NLMISC::CRGBA light_specular = CRGBA(255,255,255); + NLMISC::CVector light_direction = CVector(0.25, 0.25, 0.25); + _Light->setupPointLight(light_ambiant, light_diffuse, light_specular, position, direction + light_direction); + + // set and enable the light + _Driver->setLight(0, *_Light); + _Driver->enableLight(0); + + return true; + } + + QIcon* CObjectViewerWidget::saveOneImage(string shapename) + { + int output_width = 128; + int output_height = 128; + + // Create a scene + NL3D::UScene* Scene = _Driver->createScene(true); + if (!Scene) return 0; + + // get scene camera + if (Scene->getCam().empty()) + { + nlwarning("can't get camera from scene"); + return 0; + } + + // add an entity to the scene + UInstance Entity = Scene->createInstance(shapename.c_str()); + + // if we can't create entity, skip it + if (Entity.empty()) + { + nlwarning("can't create instance from %s", shapename.c_str()); + return 0; + } + + // get AABox of Entity + CAABBox bbox; + Entity.getShapeAABBox(bbox); + setCamera(Scene, bbox , Entity, true); + Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)output_width/output_height, 0.1f, 1000); + + string filename = CPath::standardizePath("") + toString("%s.%s", shapename.c_str(), "png"); + + // the background is white + _Driver->clearBuffers(); + + // render the scene + Scene->render(); + + CBitmap btm; + _Driver->getBuffer(btm); + + btm.resample(output_width, output_height); + + COFile fs; + + if (fs.open(filename)) + { + if (!btm.writePNG(fs, 24)) + { + nlwarning("can't save image to PNG"); + return 0; + } + } + else + { + nlwarning("can't create %s", "test.png"); + return 0; + } + fs.close(); + + QIcon *icon = new QIcon(QString(filename.c_str())); + //CFile::deleteFile(filename); + return icon; + } void CObjectViewerWidget::updateAnimatePS(uint64 deltaTime) { @@ -731,67 +731,67 @@ namespace NLQT lastTime += deltaTime; float fdelta = 0.001f * (float) (lastTime - firstTime); _Scene->animate ( fdelta); - } - -#if defined(NL_OS_WINDOWS) - - typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - - bool CObjectViewerWidget::winEvent(MSG * message, long * result) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - winProc proc = (winProc)driver->getWindowProc(); - return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); - } - } - - return false; - } - -#elif defined(NL_OS_MAC) - - typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); - - bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event) - { - if(caller) - nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); - - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - cocoaProc proc = (cocoaProc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } - -#elif defined(NL_OS_UNIX) - - typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); - - bool CObjectViewerWidget::x11Event(XEvent *event) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - x11Proc proc = (x11Proc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } -#endif - -} /* namespace NLQT */ + } + +#if defined(NL_OS_WINDOWS) + + typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + bool CObjectViewerWidget::winEvent(MSG * message, long * result) + { + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + winProc proc = (winProc)driver->getWindowProc(); + return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); + } + } + + return false; + } + +#elif defined(NL_OS_MAC) + + typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); + + bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event) + { + if(caller) + nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); + + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + cocoaProc proc = (cocoaProc)driver->getWindowProc(); + return proc(driver, event); + } + } + + return false; + } + +#elif defined(NL_OS_UNIX) + + typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); + + bool CObjectViewerWidget::x11Event(XEvent *event) + { + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + x11Proc proc = (x11Proc)driver->getWindowProc(); + return proc(driver, event); + } + } + + return false; + } +#endif + +} /* namespace NLQT */ 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 15c9b0fa9..fb6656679 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 @@ -1,229 +1,229 @@ -/* -Object Viewer Qt Widget -Copyright (C) 2010 Adrian Jaekel - -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 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 . -*/ - -#ifndef OBJECT_VIEWER_WIDGET_H -#define OBJECT_VIEWER_WIDGET_H - -// STL includes - -// Qt includes -#include -#include - -// NeL includes -#include -#include - -// Project includes -#include "entity.h" -#include "interfaces.h" - -namespace NL3D -{ - class UDriver; - class UScene; - class ULight; - class UInstance; - class UCamera; - class USkeleton; - class UPlayListManager; - class U3dMouseListener; -} - -class QIcon; -/** -namespace NLQT -@brief namespace NLQT -*/ -namespace NLQT -{ - class CObjectViewerWidget: - public QWidget, - public IObjectViewer - { - Q_OBJECT - Q_INTERFACES(NLQT::IObjectViewer) - - public: - /// Default constructor. - CObjectViewerWidget(QWidget *parent = 0); - virtual ~CObjectViewerWidget(); - - virtual QPaintEngine* paintEngine() const { return NULL; } - virtual void showEvent ( QShowEvent * event ); - - void setNelContext(NLMISC::INelContext &nelContext); - - static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; } - - /// Init a driver and create scene. - void init(); - - /// Release class. - void release(); - - /// Update mouse and keyboard events. And update camera matrix. - void updateInput(); - - /// Render Driver (clear all buffers and set background color). - void renderDriver(); - - /// Render current scene. - void renderScene(); - - /// Render Debug 2D (stuff for dev). - void renderDebug2D(); - - /// Make a screenshot of the current scene and save. - void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga); - - /// Load a mesh or particle system and add to current scene. - /// @param meshFileName - name loading shape or ps file. - /// @param skelFileName - name loading skeletin file. - /// @return true if file have been loaded, false if file have not been loaded. - bool loadMesh (const std::string &meshFileName, const std::string &skelFileName); - - /// Reset current scene. - void resetScene(); - - /// Set the background color. - /// @param backgroundColor - background color. - void setBackgroundColor(NLMISC::CRGBA backgroundColor); - - /// Set type driver. - /// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL) - void setGraphicsDriver(bool Direct3D); - - /// Set size viewport for correct set perspective - /// @param w - width window. - /// @param h - height window. - void setSizeViewport(uint16 w, uint16 h); - - void setBloomEffect(bool enabled) { _BloomEffect = enabled; } - - /// Select instance from the scene - /// @param name - name instance, "" if no instance edited - void setCurrentObject(const std::string &name); - - /// Get current instance from the scene - /// @return name current instance, "" if no instance edited - const std::string& getCurrentObject() { return _CurrentInstance; } - - /// Get entity from the scene - /// @return ref Entity - CEntity& getEntity(const std::string &name); - - /// Get full list instances from the scene - /// @param listObj - ref of return list instances - void getListObjects(std::vector &listObj); - - /// Get value background color. - /// @return background color. - NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; } - - /// Get type driver. - /// @return true if have used Direct3D driver, false OpenGL driver. - inline bool getDirect3D() { return _Direct3D; } - - inline bool getBloomEffect() const { return _BloomEffect; } - - /// Get a pointer to the driver. - /// @return pointer to the driver. - inline NL3D::UDriver *getDriver() { return _Driver; } - - /// Get a pointer to the scene. - /// @return pointer to the scene. - inline NL3D::UScene *getScene() { return _Scene; } - - /// Get a manager of playlist - /// @return pointer to the UPlayListManager - inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; } - - void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false); - bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction); - - QIcon* saveOneImage(std::string shapename); - - virtual void setVisible(bool visible); - - QWidget* getWidget() {return this;} - - virtual QString name() const {return ("ObjectViewerWidget");} - - protected: -#if defined(NL_OS_WINDOWS) - virtual bool winEvent(MSG * message, long * result); -#elif defined(NL_OS_MAC) - virtual bool macEvent(EventHandlerCallRef caller, EventRef event); -#elif defined(NL_OS_UNIX) - virtual bool x11Event(XEvent *event); -#endif - - private Q_SLOTS: - void updateRender(); - - private: +/* +Object Viewer Qt Widget +Copyright (C) 2010 Adrian Jaekel + +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 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 . +*/ + +#ifndef OBJECT_VIEWER_WIDGET_H +#define OBJECT_VIEWER_WIDGET_H + +// STL includes + +// Qt includes +#include +#include + +// NeL includes +#include +#include + +// Project includes +#include "entity.h" +#include "interfaces.h" + +namespace NL3D +{ + class UDriver; + class UScene; + class ULight; + class UInstance; + class UCamera; + class USkeleton; + class UPlayListManager; + class U3dMouseListener; +} + +class QIcon; +/** +namespace NLQT +@brief namespace NLQT +*/ +namespace NLQT +{ + class CObjectViewerWidget: + public QWidget, + public IObjectViewer + { + Q_OBJECT + Q_INTERFACES(NLQT::IObjectViewer) + + public: + /// Default constructor. + CObjectViewerWidget(QWidget *parent = 0); + virtual ~CObjectViewerWidget(); + + virtual QPaintEngine* paintEngine() const { return NULL; } + virtual void showEvent ( QShowEvent * event ); + + void setNelContext(NLMISC::INelContext &nelContext); + + static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; } + + /// Init a driver and create scene. + void init(); + + /// Release class. + void release(); + + /// Update mouse and keyboard events. And update camera matrix. + void updateInput(); + + /// Render Driver (clear all buffers and set background color). + void renderDriver(); + + /// Render current scene. + void renderScene(); + + /// Render Debug 2D (stuff for dev). + void renderDebug2D(); + + /// Make a screenshot of the current scene and save. + void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga); + + /// Load a mesh or particle system and add to current scene. + /// @param meshFileName - name loading shape or ps file. + /// @param skelFileName - name loading skeletin file. + /// @return true if file have been loaded, false if file have not been loaded. + bool loadMesh (const std::string &meshFileName, const std::string &skelFileName); + + /// Reset current scene. + void resetScene(); + + /// Set the background color. + /// @param backgroundColor - background color. + void setBackgroundColor(NLMISC::CRGBA backgroundColor); + + /// Set type driver. + /// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL) + void setGraphicsDriver(bool Direct3D); + + /// Set size viewport for correct set perspective + /// @param w - width window. + /// @param h - height window. + void setSizeViewport(uint16 w, uint16 h); + + void setBloomEffect(bool enabled) { _BloomEffect = enabled; } + + /// Select instance from the scene + /// @param name - name instance, "" if no instance edited + void setCurrentObject(const std::string &name); + + /// Get current instance from the scene + /// @return name current instance, "" if no instance edited + const std::string& getCurrentObject() { return _CurrentInstance; } + + /// Get entity from the scene + /// @return ref Entity + CEntity& getEntity(const std::string &name); + + /// Get full list instances from the scene + /// @param listObj - ref of return list instances + void getListObjects(std::vector &listObj); + + /// Get value background color. + /// @return background color. + NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; } + + /// Get type driver. + /// @return true if have used Direct3D driver, false OpenGL driver. + inline bool getDirect3D() { return _Direct3D; } + + inline bool getBloomEffect() const { return _BloomEffect; } + + /// Get a pointer to the driver. + /// @return pointer to the driver. + inline NL3D::UDriver *getDriver() { return _Driver; } + + /// Get a pointer to the scene. + /// @return pointer to the scene. + inline NL3D::UScene *getScene() { return _Scene; } + + /// Get a manager of playlist + /// @return pointer to the UPlayListManager + inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; } + + void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false); + bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction); + + QIcon* saveOneImage(std::string shapename); + + virtual void setVisible(bool visible); + + QWidget* getWidget() {return this;} + + virtual QString name() const {return ("ObjectViewerWidget");} + + protected: +#if defined(NL_OS_WINDOWS) + virtual bool winEvent(MSG * message, long * result); +#elif defined(NL_OS_MAC) + virtual bool macEvent(EventHandlerCallRef caller, EventRef event); +#elif defined(NL_OS_UNIX) + virtual bool x11Event(XEvent *event); +#endif + + private Q_SLOTS: + 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; - - NLMISC::CLibraryContext *_LibContext; - - // render stuff - QTimer *_mainTimer; - bool _isGraphicsInitialized, _isGraphicsEnabled; - - void updateInitialization(bool visible); - - void deleteEntity (CEntity &entity); - - /// Delete all entities - void deleteEntities(); - - NLMISC::CRGBA _BackgroundColor; - - NL3D::UDriver *_Driver; - NL3D::UScene *_Scene; - NL3D::UPlayListManager *_PlayListManager; - NL3D::ULight *_Light; - NL3D::UCamera *_Camera; - NL3D::U3dMouseListener *_MouseListener; - - // The entities storage - CEntities _Entities; - - /// Camera parameters. - float _phi, _psi, _dist; - float _CameraFocal; - - bool _Direct3D; - bool _BloomEffect; - - std::string _CurrentInstance; - - // a temporary solution, and later remove - friend class CAnimationSetDialog; - - };/* class CObjectViewerWidget */ - -} /* namespace NLQT */ - -#endif // OBJECT_VIEWER_WIDGET_H + void updateAnimatePS(uint64 deltaTime = 0); + + static CObjectViewerWidget *_objectViewerWidget; + + NLMISC::CLibraryContext *_LibContext; + + // render stuff + QTimer *_mainTimer; + bool _isGraphicsInitialized, _isGraphicsEnabled; + + void updateInitialization(bool visible); + + void deleteEntity (CEntity &entity); + + /// Delete all entities + void deleteEntities(); + + NLMISC::CRGBA _BackgroundColor; + + NL3D::UDriver *_Driver; + NL3D::UScene *_Scene; + NL3D::UPlayListManager *_PlayListManager; + NL3D::ULight *_Light; + NL3D::UCamera *_Camera; + NL3D::U3dMouseListener *_MouseListener; + + // The entities storage + CEntities _Entities; + + /// Camera parameters. + float _phi, _psi, _dist; + float _CameraFocal; + + bool _Direct3D; + bool _BloomEffect; + + std::string _CurrentInstance; + + // a temporary solution, and later remove + friend class CAnimationSetDialog; + + };/* class CObjectViewerWidget */ + +} /* namespace NLQT */ + +#endif // OBJECT_VIEWER_WIDGET_H diff --git a/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp b/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp index e5875aca1..3dd66d085 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp @@ -1,5 +1,5 @@ /* -Object Viewer Qt Widget +Object Viewer Qt Widget Copyright (C) 2010 Adrian Jaekel This program is free software: you can redistribute it and/or modify diff --git a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp index 0d2ea6a7e..9d6506197 100644 --- a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp +++ b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp @@ -42,15 +42,15 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vectorFX.empty()) { - if (!(*tmpItAttached)->FX.removeByID('STOP') && !(*tmpItAttached)->FX.removeByID('main')) + if (!(*tmpItAttached)->FX.removeByID(NELID("STOP")) && !(*tmpItAttached)->FX.removeByID(NELID("main"))) { (*tmpItAttached)->FX.activateEmitters(false); } @@ -9373,7 +9373,7 @@ void CCharacterCL::CWornItem::enableAdvantageFX(NL3D::UInstance parent) if (!enabled) { // well, it is unlikely that player will loses its ability to master an item after he gained it, but manage the case anyway. - if (!AdvantageFX.removeByID('STOP') && !AdvantageFX.removeByID('main')) + if (!AdvantageFX.removeByID(NELID("STOP")) && !AdvantageFX.removeByID(NELID("main"))) { AdvantageFX.activateEmitters(false); } diff --git a/code/ryzom/client/src/fx_cl.cpp b/code/ryzom/client/src/fx_cl.cpp index 971100386..7a5418c3a 100644 --- a/code/ryzom/client/src/fx_cl.cpp +++ b/code/ryzom/client/src/fx_cl.cpp @@ -263,7 +263,7 @@ CFxCL::~CFxCL() // Stop emitters UParticleSystemInstance fxInst; fxInst.cast (_Instance); - if (!fxInst.removeByID( 'STOP' ) && !fxInst.removeByID( 'main' ) ) + if (!fxInst.removeByID(NELID("STOP")) && !fxInst.removeByID(NELID("main"))) { fxInst.activateEmitters( false ); } diff --git a/code/ryzom/client/src/fx_manager.h b/code/ryzom/client/src/fx_manager.h index 71df3f2c4..e41171e9e 100644 --- a/code/ryzom/client/src/fx_manager.h +++ b/code/ryzom/client/src/fx_manager.h @@ -77,7 +77,7 @@ protected: float TimeOut; bool TestNoMoreParticles; public: - CFX2Remove(NL3D::UParticleSystemInstance instance=NL3D::UParticleSystemInstance(), float timeOut = NULL, bool testNoMoreParticles = false) + CFX2Remove(NL3D::UParticleSystemInstance instance=NL3D::UParticleSystemInstance(), float timeOut = 0.f, bool testNoMoreParticles = false) { Instance = instance; TimeOut = timeOut; diff --git a/code/ryzom/client/src/hair_set.cpp b/code/ryzom/client/src/hair_set.cpp index 1bc6f030c..d82733162 100644 --- a/code/ryzom/client/src/hair_set.cpp +++ b/code/ryzom/client/src/hair_set.cpp @@ -47,8 +47,8 @@ void CHairSet::init (NLMISC::IProgressCallback &progress) const CItemSheet *item = SheetMngr.getItem(SLOTTYPE::HEAD_SLOT, k); if( (item) && (!item->getShape().empty()) ) { - std::string itemName = item->getShape(); - itemName = NLMISC::strlwr(itemName); + std::string itemName = NLMISC::toLower(item->getShape()); + if (item->getShape().find("cheveux", 0) != std::string::npos) { // get race diff --git a/code/ryzom/client/src/interface_v3/animal_position_state.cpp b/code/ryzom/client/src/interface_v3/animal_position_state.cpp index 9789d4012..50e6d4265 100644 --- a/code/ryzom/client/src/interface_v3/animal_position_state.cpp +++ b/code/ryzom/client/src/interface_v3/animal_position_state.cpp @@ -64,7 +64,7 @@ bool CPositionState::getPos(sint32 &px, sint32 &py) // *************************************************************************** void CPositionState::serialNodeLeaf(NLMISC::IStream &f, CCDBNodeLeaf *&dbNode) { - f.serialCheck((uint32) 'NL__'); + f.serialCheck(NELID("NL__")); f.serialVersion(0); std::string dbPath; if (f.isReading()) @@ -85,18 +85,18 @@ void CPositionState::serialNodeLeaf(NLMISC::IStream &f, CCDBNodeLeaf *&dbNode) } f.serial(dbPath); } - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } // *************************************************************************** void CUIDEntityPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'UIDE'); + f.serialCheck(NELID("UIDE")); f.serialVersion(0); serialNodeLeaf(f, _DBPos); serialNodeLeaf(f, _Uid); - f.serialCheck((uint32) '_END'); + f.serialCheck(NELID("_END")); } // *************************************************************************** @@ -241,11 +241,11 @@ bool CAnimalPositionState::getPos(sint32 &px, sint32 &py) // *************************************************************************** void CAnimalPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'APS_'); + f.serialCheck(NELID("APS_")); f.serialVersion(0); CUIDEntityPositionState::serial(f); serialNodeLeaf(f, _Status); - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } @@ -257,7 +257,7 @@ void CAnimalPositionState::serial(NLMISC::IStream &f) // *************************************************************************** CEntityCL *CNamedEntityPositionState::getEntity() { - if (!dbOk()) return false; + if (!dbOk()) return NULL; return EntitiesMngr.getEntityByName(_Name->getValue32()); } @@ -299,11 +299,11 @@ bool CDialogEntityPositionState::getDbPos(sint32 &px, sint32 &py) // *************************************************************************** void CNamedEntityPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'NEPS'); + f.serialCheck(NELID("NEPS")); f.serialVersion(0); serialNodeLeaf(f, _Name); serialNodeLeaf(f, _X); serialNodeLeaf(f, _Y); - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index ae06d0997..293582f52 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -591,7 +591,7 @@ bool CDBCtrlSheet::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) return false; prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" ); - if( prop != NULL ) + if (prop) setDraggable( CInterfaceElement::convertBool(prop) ); else setDraggable( false ); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp index 5db9ce827..b5092be67 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp @@ -110,7 +110,7 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // value prop = xmlGetProp (cur, (xmlChar*)"value"); - if ( prop ) + if (prop) { // get a branch in the database. CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 6007c33b8..9d108926c 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -94,7 +94,7 @@ bool CDBGroupListSheetText::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // value prop = xmlGetProp (cur, (xmlChar*)"value"); - if ( prop ) + if (prop) { // get a branch in the database. CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); diff --git a/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp b/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp index 40b8c7bd4..d4a00e8e4 100644 --- a/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp +++ b/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp @@ -23,7 +23,7 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { sint ver= f.serialVersion(2); - f.serialCheck((uint32) 'USHC'); + f.serialCheck(NELID("USHC")); f.serial(SrcGuild); f.serial(SrcTeam); f.serial(SrcAroundMe); @@ -42,7 +42,7 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) void CFilteredDynChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { sint ver = f.serialVersion(0); - f.serialCheck((uint32) 'USHC'); + f.serialCheck(NELID("USHC")); if (ver >= 0) { for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++) diff --git a/code/ryzom/client/src/interface_v3/group_compas.cpp b/code/ryzom/client/src/interface_v3/group_compas.cpp index 20257cbaa..d4d0631ce 100644 --- a/code/ryzom/client/src/interface_v3/group_compas.cpp +++ b/code/ryzom/client/src/interface_v3/group_compas.cpp @@ -68,7 +68,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) return; } } - f.serialCheck((uint32) 'CTAR'); + f.serialCheck(NELID("CTAR")); f.serialVersion(0); f.serial(Pos); // for the name, try to save a string identifier if possible, because language may be changed between @@ -95,7 +95,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) _PositionState = NULL; } } - f.serialCheck((uint32) '_END'); + f.serialCheck(NELID("_END")); // if language has been modified, then we are not able to display correctly the name, so just // reset the compass to north to avoid incoherency if (f.isReading()) @@ -811,18 +811,19 @@ void CGroupCompasMenu::setActive (bool state) uint nbUserLandMarks = std::min( uint(currCont->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks() ); // Sort the landmarks - std::sort(currCont->UserLandMarks.begin(), currCont->UserLandMarks.end(), UserLandMarksSortPredicate); + std::vector sortedLandmarks(currCont->UserLandMarks); + std::sort(sortedLandmarks.begin(), sortedLandmarks.end(), UserLandMarksSortPredicate); for(k = 0; k < nbUserLandMarks; ++k) { - if (currCont->UserLandMarks[k].Type < CUserLandMark::UserLandMarkTypeCount) + if (sortedLandmarks[k].Type < CUserLandMark::UserLandMarkTypeCount) { CCompassTarget ct; ct.setType(CCompassTarget::UserLandMark); - ct.Pos = currCont->UserLandMarks[k].Pos; - ct.Name = currCont->UserLandMarks[k].Title; + ct.Pos = sortedLandmarks[k].Pos; + ct.Name = sortedLandmarks[k].Title; Targets.push_back(ct); - landMarkSubMenus[currCont->UserLandMarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 9d1cb364a..9db2282fc 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1663,7 +1663,7 @@ bool CInterfaceManager::loadConfig (const string &filename) // serial user chats info (serial it before position of windows so that they can be updated properly) if (ver >= 1) { - f.serialCheck(uint32('_ICU')); + f.serialCheck(NELID("_ICU")); if (!PeopleInterraction.loadUserChatsInfos(f)) { nlwarning("Bad user chat saving"); @@ -1671,7 +1671,7 @@ bool CInterfaceManager::loadConfig (const string &filename) } // header - f.serialCheck(uint32('GFCI')); + f.serialCheck(NELID("GFCI")); f.serial(nNbMode); f.serial(_CurrentMode); if(ver>=10) @@ -1897,7 +1897,7 @@ bool CInterfaceManager::saveConfig (const string &filename) f.serialVersion(ICFG_STREAM_VERSION); // serial user chats info (serial it before position of windows so that they can be updated properly) - f.serialCheck(uint32('_ICU')); + f.serialCheck(NELID("_ICU")); if (!PeopleInterraction.saveUserChatsInfos(f)) { nlwarning("Config saving failed"); @@ -1907,7 +1907,7 @@ bool CInterfaceManager::saveConfig (const string &filename) } // header - f.serialCheck(uint32('GFCI')); + f.serialCheck(NELID("GFCI")); f.serial(i); f.serial(_CurrentMode); f.serial(_LastInGameScreenW); diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 95b091c22..332bcac57 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1695,14 +1695,14 @@ bool CPeopleInterraction::saveUserChatsInfos(NLMISC::IStream &f) try { sint ver= f.serialVersion(USER_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); //saveFilteredChat(f, MainChat); saveFilteredChat(f, ChatGroup); for(uint k = 0; k < MaxNumUserChats; ++k) { saveFilteredChat(f, UserChat[k]); } - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); if (ver>=1) { CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); @@ -1732,7 +1732,7 @@ bool CPeopleInterraction::saveUserDynChatsInfos(NLMISC::IStream &f) try { sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'OMGY'); + f.serialCheck(NELID("OMGY")); if (ver >= 1) { saveFilteredDynChat(f, TheUserChat); @@ -1755,7 +1755,7 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f) { bool present; sint ver = f.serialVersion(USER_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); f.serial(present); if (!present) { @@ -1777,7 +1777,7 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f) setupUserChatFromSummary(fcs, UserChat[k]); } } - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); if (ver>=1) { // CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); @@ -1819,7 +1819,7 @@ bool CPeopleInterraction::loadUserDynChatsInfos(NLMISC::IStream &f) { bool present; sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'OMGY'); + f.serialCheck(NELID("OMGY")); f.serial(present); if (!present) { diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 69fc35230..45e3fea51 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1943,16 +1943,21 @@ class CAHInitResLod : public IActionHandler VideoModes.clear(); StringModeList.clear(); - StringModeList.push_back("uiConfigWindowed"); CurrentMode = getRyzomModes(VideoModes, StringModeList); + // getRyzomModes() expects empty list, so we need to insert 'Windowed' after mode list is filled + StringModeList.insert(StringModeList.begin(), "uiConfigWindowed"); + // If the client is in windowed mode, still in windowed mode and do not change anything if (ClientCfg.Windowed) CurrentMode = 0; // If we have not found the mode so it can be an error or machine change, so propose the first available else if (CurrentMode == -1) CurrentMode = 1; + // We inserted 'Windowed' as first mode, so index needs to move too + else + ++CurrentMode; CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:res_value")); @@ -2111,7 +2116,12 @@ class CAHUninitResLod : public IActionHandler //nlinfo("CAHUninitResLod called"); // If the mode requested is a windowed mode do nothnig - if (CurrentMode != 0) + if (CurrentMode == 0) + { + ClientCfg.Windowed = true; + ClientCfg.writeBool("FullScreen", false); + } + else { ClientCfg.Windowed = false; // Get W, H @@ -2125,6 +2135,10 @@ class CAHUninitResLod : public IActionHandler } ClientCfg.Width = w; ClientCfg.Height = h; + + ClientCfg.writeBool("FullScreen", true); + ClientCfg.writeInt("Width", w); + ClientCfg.writeInt("Height", h); } if (CurrentPreset != 4) // CInterfaceDDX::CustomPreset diff --git a/code/ryzom/client/src/projectile_manager.cpp b/code/ryzom/client/src/projectile_manager.cpp index 80db533c5..6b4e6c7c1 100644 --- a/code/ryzom/client/src/projectile_manager.cpp +++ b/code/ryzom/client/src/projectile_manager.cpp @@ -648,7 +648,7 @@ void CProjectileManager::CProjectile::shutDown(CCharacterCL *target) target->buildAlignMatrix(userMatrix); FX[k].forceSetUserMatrix(userMatrix); } - if (!FX[k].removeByID('STOP') && !FX[k].removeByID('main')) + if (!FX[k].removeByID(NELID("STOP")) && !FX[k].removeByID(NELID("main"))) { FX[k].activateEmitters(false); //nlwarning("Projectile with a particle system that has no 'STOP' emitter"); diff --git a/code/ryzom/client/src/r2/island_collision.cpp b/code/ryzom/client/src/r2/island_collision.cpp index 5018e41aa..fbc5a14ba 100644 --- a/code/ryzom/client/src/r2/island_collision.cpp +++ b/code/ryzom/client/src/r2/island_collision.cpp @@ -429,7 +429,7 @@ CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::C try { CIFile f(CPath::lookup(islandDesc.Island + ".island_hm")); - f.serialCheck((uint32) 'MHSI'); + f.serialCheck(NELID("MHSI")); f.serial(_HeightMap); } catch(const Exception &e) diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index 42427830c..b40d68b35 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -468,8 +468,6 @@ void releaseOutGame() // flush the server string cache STRING_MANAGER::CStringManagerClient::instance()->flushStringCache(); - ClientCfg.release (); - // Disconnect the client from the server. NetMngr.disconnect(); diff --git a/code/ryzom/client/src/string_manager_client.h b/code/ryzom/client/src/string_manager_client.h index 89e05acd0..14f541c10 100644 --- a/code/ryzom/client/src/string_manager_client.h +++ b/code/ryzom/client/src/string_manager_client.h @@ -341,8 +341,8 @@ private: void serial(NLMISC::IStream &f) { - f.serialCheck((uint32)'_RTS'); - f.serialCheck((uint32)'KCAP'); + f.serialCheck(NELID("_RTS")); + f.serialCheck(NELID("KCAP")); f.serialVersion(0); f.serial(PackedVersion); f.serial(LanguageCode); diff --git a/code/ryzom/client/src/timed_fx_manager.cpp b/code/ryzom/client/src/timed_fx_manager.cpp index 6ea6f273b..89b71974f 100644 --- a/code/ryzom/client/src/timed_fx_manager.cpp +++ b/code/ryzom/client/src/timed_fx_manager.cpp @@ -544,7 +544,7 @@ void CTimedFXManager::CManagedFX::shutDown(NL3D::UScene *scene, CFXManager &fxMa // fx isn't spwaned, so must tell fx to stop its emitters if (Instance.isSystemPresent() && Instance.isValid()) { - if (!Instance.removeByID('main') && !Instance.removeByID('STOP')) + if (!Instance.removeByID(NELID("main")) && !Instance.removeByID(NELID("STOP"))) { // if a specific emitter has not be tagged, just stop all emitters if there's no better solution Instance.activateEmitters(false); diff --git a/code/ryzom/common/src/game_share/persistent_data_template.h b/code/ryzom/common/src/game_share/persistent_data_template.h index 87a110d16..560603f0a 100644 --- a/code/ryzom/common/src/game_share/persistent_data_template.h +++ b/code/ryzom/common/src/game_share/persistent_data_template.h @@ -325,9 +325,11 @@ static _TOKENS_CLASSNAME _TOKENS_OBJNAME; #else +#ifdef NL_OS_WINDOWS #pragma message( " ") #pragma message( "NON-OPTIMISED: Persistent data class " NL_MACRO_TO_STR(PERSISTENT_CLASS) " not using a token family") #pragma message( " ") +#endif #endif diff --git a/code/ryzom/common/src/game_share/security_check.cpp b/code/ryzom/common/src/game_share/security_check.cpp index bbc0d46d1..6acd2aeac 100644 --- a/code/ryzom/common/src/game_share/security_check.cpp +++ b/code/ryzom/common/src/game_share/security_check.cpp @@ -43,7 +43,7 @@ void CSecurityCheckForFastDisconnection::forwardSecurityCode(NLMISC::IStream& ms } // -CSecurityCode CSecurityCheckForFastDisconnection::encode(char *passPhrase) +CSecurityCode CSecurityCheckForFastDisconnection::encode(const char *passPhrase) { if (!passPhrase) throw Exception("Null passPhrase"); @@ -56,7 +56,7 @@ CSecurityCode CSecurityCheckForFastDisconnection::encode(char *passPhrase) } // -void CSecurityCheckForFastDisconnection::check(char *passPhrase) +void CSecurityCheckForFastDisconnection::check(const char *passPhrase) { if (SecurityCode != encode(passPhrase)) throw Exception("Check not passed"); diff --git a/code/ryzom/common/src/game_share/security_check.h b/code/ryzom/common/src/game_share/security_check.h index 60c736f72..640fec93a 100644 --- a/code/ryzom/common/src/game_share/security_check.h +++ b/code/ryzom/common/src/game_share/security_check.h @@ -61,9 +61,9 @@ public: /// Set cookie void setCookie(const NLNET::CLoginCookie& cookie) { Block.Cookie.set(cookie.getUserAddr(), cookie.getUserKey(), cookie.getUserId()); } // don't use the default generated bitwise assignment operator, because of padding junk that would be copied /// Return the security code - CSecurityCode encode(char *passPhrase); + CSecurityCode encode(const char *passPhrase); /// Check the security code - void check(char *passPhrase); + void check(const char *passPhrase); /// Read some data from stream void receiveSecurityCode(NLMISC::IStream& msgin); diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index 6a15900d0..b593c7a37 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -2277,7 +2277,7 @@ public: sint32 xmax = (sint32) max.x(); sint32 ymin = (sint32) (sint16) min.y(); sint32 ymax = (sint32) (sint16) max.y(); - output.serialCheck((uint32) 'OBSI'); + output.serialCheck(NELID("OBSI")); output.serial(xmin); output.serial(xmax); output.serial(ymin); diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index 92193e6c5..07e9023bf 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -1700,7 +1700,7 @@ NLMISC_COMMAND(scriptHex,"execute a hex-encoded script for a group in the given return true; } -static char* hexEncoderTcl = +static const char* hexEncoderTcl = "proc copy_encoded {} {" " # Get the args from the text fields" " set group [ .group.name get 1.0 end ]" diff --git a/code/ryzom/server/src/ai_share/ai_spawn_commands.h b/code/ryzom/server/src/ai_share/ai_spawn_commands.h index 96f2d99a0..059f08f1b 100644 --- a/code/ryzom/server/src/ai_share/ai_spawn_commands.h +++ b/code/ryzom/server/src/ai_share/ai_spawn_commands.h @@ -1,59 +1,59 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// 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 . - - - +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 RYAI_SPAWN_COMMANDS_H #define RYAI_SPAWN_COMMANDS_H - -#include "nel/misc/types_nl.h" -#include "nel/misc/debug.h" - -#include - - -//class CAISpawnCtrl -//{ -//public: -// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); } -// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); } -// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); } -// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); } -// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); } -// -// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); } -// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); } -// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); } -// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); } -// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); } -// -//protected: -// virtual bool _spawn (int aiInstance, const std::string &name)=0; -// virtual bool _spawnMap (int aiInstance, const std::string &name)=0; -// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0; -// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0; -// virtual bool _spawnAll (int aiInstance)=0; -// -// virtual bool _despawn (int aiInstance, const std::string &name)=0; -// virtual bool _despawnMap (int aiInstance, const std::string &name)=0; -// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0; -// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0; -// virtual bool _despawnAll (int aiInstance)=0; -// -// static CAISpawnCtrl *_instance; -//}; - -#endif + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" + +#include + + +//class CAISpawnCtrl +//{ +//public: +// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); } +// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); } +// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); } +// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); } +// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); } +// +// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); } +// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); } +// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); } +// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); } +// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); } +// +//protected: +// virtual bool _spawn (int aiInstance, const std::string &name)=0; +// virtual bool _spawnMap (int aiInstance, const std::string &name)=0; +// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0; +// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0; +// virtual bool _spawnAll (int aiInstance)=0; +// +// virtual bool _despawn (int aiInstance, const std::string &name)=0; +// virtual bool _despawnMap (int aiInstance, const std::string &name)=0; +// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0; +// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0; +// virtual bool _despawnAll (int aiInstance)=0; +// +// static CAISpawnCtrl *_instance; +//}; + +#endif diff --git a/code/ryzom/server/src/ai_share/world_map.cpp b/code/ryzom/server/src/ai_share/world_map.cpp index fae9ad50f..eae84acbf 100644 --- a/code/ryzom/server/src/ai_share/world_map.cpp +++ b/code/ryzom/server/src/ai_share/world_map.cpp @@ -553,7 +553,7 @@ void CWorldMap::clear() void CWorldMap::serial(NLMISC::IStream &f) { - f.serialCheck((uint32)'WMAP'); + f.serialCheck(NELID("WMAP")); // Version // 0: initial version diff --git a/code/ryzom/server/src/ai_share/world_map.h b/code/ryzom/server/src/ai_share/world_map.h index 48dcfee77..f9e46ecfc 100644 --- a/code/ryzom/server/src/ai_share/world_map.h +++ b/code/ryzom/server/src/ai_share/world_map.h @@ -1633,18 +1633,27 @@ CTopology::CTopology() { } +// convert a 2 characters string to uint16 +#ifdef NL_LITTLE_ENDIAN +# define NELID16(x) (uint16((x[0] << 8) | (x[1]))) +#else +# define NELID16(x) (uint16((x[1] << 8) | (x[0]))) +#endif + + + inline void CTopology::serial(NLMISC::IStream& f) { uint version = 0; - uint16 check = (uint16)'Tp'; + uint16 check = NELID16("Tp"); f.serial(check); - if (check != (uint16)'TP') + if (check != NELID16("TP")) { - nlassert(check == (uint16)'Tp'); + nlassert(check == NELID16("Tp")); version = f.serialVersion(3); } @@ -2285,7 +2294,7 @@ sint CWhiteCell::getHeight(CWorldPosition const& wpos) const inline void CWhiteCell::serial(NLMISC::IStream& f) { - f.serialCheck((uint16)'WC'); + f.serialCheck(NELID16("WC")); if (f.isReading()) _HeightMap = I16x16Layer::load(f); else diff --git a/code/ryzom/server/src/entities_game_service/fame_pd.cpp b/code/ryzom/server/src/entities_game_service/fame_pd.cpp index cf27d6459..db2104c5d 100644 --- a/code/ryzom/server/src/entities_game_service/fame_pd.cpp +++ b/code/ryzom/server/src/entities_game_service/fame_pd.cpp @@ -21,7 +21,7 @@ namespace EGSPD { -static const struct { char* Name; CFameTrend::TFameTrend Value; } TFameTrendConvert[] = +static const struct { const char* Name; CFameTrend::TFameTrend Value; } TFameTrendConvert[] = { { "FameUpward", CFameTrend::FameUpward }, { "FameDownward", CFameTrend::FameDownward }, diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp index f62af0007..03a105445 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp @@ -494,7 +494,7 @@ bool CGuildMemberModule::canAffectGrade(EGSPD::CGuildGrade::TGuildGrade)const CMissionGuild * CGuildMemberModule::pickMission( TAIAlias alias ) { /// todo guild mission - return false; + return NULL; } //---------------------------------------------------------------------------- diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.cpp b/code/ryzom/server/src/entities_game_service/harvest_source.cpp index 6c5f85a61..dcae55a60 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -1270,7 +1270,7 @@ bool forageTestDoExtract( testSource->extractMaterial( req, abs, ForageQualityCeilingFactor.get(), ForageQualitySlowFactor.get(), res, successFactor, 0, row, propDrop ); fprintf( f, "%g;%g;%g;%g;%g;%g;%g;%g;%g;%u;%u;\n", res[CHarvestSource::A], res[CHarvestSource::Q], - testSource->getD(), testSource->getE(), 0 /*testSource->getC()*/, + testSource->getD(), testSource->getE(), 0.f /*testSource->getC()*/, reqS, reqA, reqQ, testSource->quantity(), testSource->getImpactScheme()*5, 127 ); if ( (!eventD) && (testSource->getD() > 127) ) diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp index ac50c52cd..c6cddb5e5 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp @@ -29,11 +29,8 @@ CCombatAction * CCombatAIActionFactory::buildAiAction(const CStaticAiAction *aiA nlassert(phrase); #endif const AI_ACTION::TAiActionType actionType = aiAction->getType(); - if (actionType != AI_ACTION::Melee && actionType != AI_ACTION::Range) - { - return false; - } - + if (actionType != AI_ACTION::Melee && actionType != AI_ACTION::Range) return NULL; + AI_ACTION::TAiEffectType effectType = aiAction->getData().Combat.EffectFamily; //get appropriate factory diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp index fbb16a296..010176023 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp @@ -1936,7 +1936,7 @@ void CDepositMapsBatchTask::run() CSString res; disp.write( res ); res = res.replace( "\n", "
\n" ); - fprintf( outputF, res.c_str() ); + fprintf( outputF, "%s", res.c_str() ); // Close files fclose( inputF ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h b/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h index ecc133f54..7e6a47064 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h @@ -22,13 +22,17 @@ class CEntityState; class COfflineEntityState; class CCharacterRespawnPoints; class CFarPosition; -class NLNET::CMessage; class CModuleParent; +namespace NLNET +{ + class CMessage; +} + namespace R2 { struct TUserRole; -}; +} class CRingRewardPoints; diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp index 1db7c68b8..a8203bb03 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp @@ -349,13 +349,13 @@ static std::string getActiveOutputPath() if (TheCharScanScriptFile==NULL) { nlwarning("There is no active script file right now from which to extract output directory"); - return false; + return ""; } bool isOK=true; // write the current script file to a tmp file isOK=TheCharScanScriptFile->writeToFile(TmpScriptFileName); - if (!isOK) return false; + if (!isOK) return ""; // create a new script object and assign the tmp file to it CCharScanScript script; diff --git a/code/ryzom/server/src/input_output_service/messages.cpp b/code/ryzom/server/src/input_output_service/messages.cpp index 1abec0011..4af959590 100644 --- a/code/ryzom/server/src/input_output_service/messages.cpp +++ b/code/ryzom/server/src/input_output_service/messages.cpp @@ -336,7 +336,7 @@ void cbImpulsionFilter( CMessage& msgin, const string &serviceName, TServiceId s } // impulsionFilter // -static char*DebugChatModeName[] = +static const char* DebugChatModeName[] = { "say", "shout", diff --git a/code/ryzom/server/src/input_output_service/parameter_traits.cpp b/code/ryzom/server/src/input_output_service/parameter_traits.cpp index 8eecfd1de..a0b45fcf7 100644 --- a/code/ryzom/server/src/input_output_service/parameter_traits.cpp +++ b/code/ryzom/server/src/input_output_service/parameter_traits.cpp @@ -42,7 +42,7 @@ extern CVariable VerboseStringManager; #define LOG if (!VerboseStringManager) {} else nlinfo -char *OperatorNames[] = +const char *OperatorNames[] = { "equal", "notEqual", diff --git a/code/ryzom/server/src/logger_service/logger_service.cpp b/code/ryzom/server/src/logger_service/logger_service.cpp index 245fe4c89..dba4cae57 100644 --- a/code/ryzom/server/src/logger_service/logger_service.cpp +++ b/code/ryzom/server/src/logger_service/logger_service.cpp @@ -521,9 +521,7 @@ public: BsiGlobal); saveFile.FileName = threadResult.OutputFilename; - char *newLine="\n"; - - + const char *newLine="\n"; list::const_iterator first(threadResult.Lines->begin()), last(threadResult.Lines->end()); for (uint32 localCounter = 0; first != last; ++first, ++localCounter) diff --git a/code/ryzom/server/src/pd_lib/db_delta_file.cpp b/code/ryzom/server/src/pd_lib/db_delta_file.cpp index ded4e57c1..4ca800256 100644 --- a/code/ryzom/server/src/pd_lib/db_delta_file.cpp +++ b/code/ryzom/server/src/pd_lib/db_delta_file.cpp @@ -259,7 +259,7 @@ bool CDBDeltaFile::preload() */ bool CDBDeltaFile::serialHeader() { - serialCheck((uint32)'DbDt'); + serialCheck(NELID("DbDt")); uint version = serialVersion(0); if (isReading()) @@ -280,7 +280,7 @@ bool CDBDeltaFile::serialHeader() serial(_Header); } - serialCheck((uint32)'Data'); + serialCheck(NELID("Data")); _DataStart = ftell(_File); diff --git a/code/ryzom/server/src/pd_lib/db_delta_file.h b/code/ryzom/server/src/pd_lib/db_delta_file.h index a8d8776cf..f33feaa52 100644 --- a/code/ryzom/server/src/pd_lib/db_delta_file.h +++ b/code/ryzom/server/src/pd_lib/db_delta_file.h @@ -189,7 +189,7 @@ private: void serial(NLMISC::IStream& s) { - s.serialCheck((uint32)'DHdr'); + s.serialCheck(NELID("DHdr")); uint version = s.serialVersion(0); s.serial(RowSize); diff --git a/code/ryzom/server/src/pd_lib/db_reference_file.cpp b/code/ryzom/server/src/pd_lib/db_reference_file.cpp index 7ae9ecb1c..edb8c596e 100644 --- a/code/ryzom/server/src/pd_lib/db_reference_file.cpp +++ b/code/ryzom/server/src/pd_lib/db_reference_file.cpp @@ -483,7 +483,7 @@ bool CDBReferenceFile::read(uint32 index, uint8* rowdata) */ bool CDBReferenceFile::serialHeader() { - serialCheck((uint32)'DbRf'); + serialCheck(NELID("DbRf")); uint version = serialVersion(0); if (isReading()) @@ -504,7 +504,7 @@ bool CDBReferenceFile::serialHeader() serial(_Header); } - serialCheck((uint32)'Data'); + serialCheck(NELID("Data")); _DataStart = ftell(_File); diff --git a/code/ryzom/server/src/pd_lib/db_reference_file.h b/code/ryzom/server/src/pd_lib/db_reference_file.h index 72fcffb88..269e5278f 100644 --- a/code/ryzom/server/src/pd_lib/db_reference_file.h +++ b/code/ryzom/server/src/pd_lib/db_reference_file.h @@ -199,7 +199,7 @@ private: void serial(NLMISC::IStream& s) { - s.serialCheck((uint32)'RHdr'); + s.serialCheck(NELID("RHdr")); uint version = s.serialVersion(0); s.serial(BaseIndex); diff --git a/code/ryzom/server/src/pd_lib/pd_messages.h b/code/ryzom/server/src/pd_lib/pd_messages.h index 0dac4215c..25ea12c4b 100644 --- a/code/ryzom/server/src/pd_lib/pd_messages.h +++ b/code/ryzom/server/src/pd_lib/pd_messages.h @@ -1436,7 +1436,7 @@ inline uint32 CDbMessage::getMessageHeaderSize() */ inline void CUpdateLog::serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'ULOG'); + f.serialCheck(NELID("ULOG")); uint version = f.serialVersion(1); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.cpp b/code/ryzom/server/src/pd_lib/pd_server_utils.cpp index 9b27b1d23..1ca303b0f 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.cpp +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.cpp @@ -331,7 +331,7 @@ void CDatabaseState::serial(NLMISC::IStream& s) { s.xmlPush("database_state"); - s.serialCheck((uint32)'DBST'); + s.serialCheck(NELID("DBST")); uint version = s.serialVersion(0); s.xmlPush("name"); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.h b/code/ryzom/server/src/pd_lib/pd_server_utils.h index 97f0ebec0..ac67e8a7a 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h @@ -60,7 +60,7 @@ public: { s.xmlPush("reference"); - s.serialCheck((uint32)'RIDX'); + s.serialCheck(NELID("RIDX")); uint version = s.serialVersion(0); s.xmlPush("database"); diff --git a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp index f4277b61a..184d4bb7f 100644 --- a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp +++ b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp @@ -73,7 +73,7 @@ void CPDStringMapper::setMapping(const std::string& str, uint32 id) */ void CPDStringMapper::serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'PDSM'); + f.serialCheck(NELID("PDSM")); uint version = f.serialVersion(0); diff --git a/code/ryzom/server/src/pd_lib/pd_utils.h b/code/ryzom/server/src/pd_lib/pd_utils.h index 07744d3ad..73a0268d8 100644 --- a/code/ryzom/server/src/pd_lib/pd_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_utils.h @@ -714,7 +714,7 @@ public: void serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'IALC'); + f.serialCheck(NELID("IALC")); f.serialVersion(0); f.serial(_NextIndex); diff --git a/code/ryzom/server/src/pd_support_service/daily_commands.cpp b/code/ryzom/server/src/pd_support_service/daily_commands.cpp index 429823160..e3f6d718c 100644 --- a/code/ryzom/server/src/pd_support_service/daily_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/daily_commands.cpp @@ -104,7 +104,7 @@ public: FILE* fileHandle= fopen(DailyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CDailyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", - ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, startTime/3600%24, startTime/60%60, endTime/3600%24, endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); + ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); nlinfo("JobManager state: %s",CJobManager::getInstance()->getStatus().c_str()); fclose(fileHandle); } diff --git a/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp b/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp index 611bd9b6b..ed5641455 100644 --- a/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp @@ -518,13 +518,13 @@ static std::string getActiveOutputPath() if (TheCharScanScriptFile==NULL) { nlwarning("There is no active script file right now from which to extract output directory"); - return false; + return ""; } bool isOK=true; // write the current script file to a tmp file isOK=TheCharScanScriptFile->writeToFile(TmpScriptFileName); - if (!isOK) return false; + if (!isOK) return ""; // create a new script object and assign the tmp file to it CCharScanScriptFile script; diff --git a/code/ryzom/server/src/persistant_data_service/db_manager.cpp b/code/ryzom/server/src/persistant_data_service/db_manager.cpp index 3160b9689..6acdf687c 100644 --- a/code/ryzom/server/src/persistant_data_service/db_manager.cpp +++ b/code/ryzom/server/src/persistant_data_service/db_manager.cpp @@ -176,7 +176,7 @@ CTimestamp CDbManager::_LastUpdateTime; */ CDatabase* CDbManager::createDatabase(TDatabaseId id, CLog* log) { - CHECK_DB_MGR_INIT(createDatabase, false); + CHECK_DB_MGR_INIT(createDatabase, NULL); // check db doesn't exist yet CDatabase* db = getDatabase(id); @@ -229,7 +229,7 @@ bool CDbManager::deleteDatabase(TDatabaseId id, CLog* log) */ CDatabase* CDbManager::loadDatabase(TDatabaseId id, const string& description, CLog* log) { - CHECK_DB_MGR_INIT(loadDatabase, false); + CHECK_DB_MGR_INIT(loadDatabase, NULL); nlinfo("CDbManager::loadDatabase(): load/setup database '%d'", id); diff --git a/code/ryzom/server/src/persistant_data_service/pds_database.cpp b/code/ryzom/server/src/persistant_data_service/pds_database.cpp index 13202bb1e..66b272d5c 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_database.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_database.cpp @@ -1195,7 +1195,7 @@ CDatabase* CDatabase::adapt(const string& description) if (!buildReference()) { PDS_WARNING("adapt(): failed to buildReference()"); - return false; + return NULL; } } diff --git a/code/ryzom/server/src/persistant_data_service/pds_type.cpp b/code/ryzom/server/src/persistant_data_service/pds_type.cpp index eb8ea5f19..46f9fb924 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_type.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_type.cpp @@ -194,7 +194,7 @@ string CType::getIndexName(TEnumValue value, bool verbose) const if (!isIndex()) { PDS_WARNING("getIndexName(): type is not an index"); - return false; + return ""; } if (isEnum()) diff --git a/code/ryzom/server/src/server_share/light_ig_loader.cpp b/code/ryzom/server/src/server_share/light_ig_loader.cpp index f9fd3aa1f..de29ad949 100644 --- a/code/ryzom/server/src/server_share/light_ig_loader.cpp +++ b/code/ryzom/server/src/server_share/light_ig_loader.cpp @@ -114,7 +114,7 @@ void CLightIGLoader::loadIG(const string &filename) // Serial a header - _File.serialCheck ((uint32)'TPRG'); + _File.serialCheck (NELID("TPRG")); // Serial a version number sint version = _File.serialVersion (5); diff --git a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp index ff05659c1..5b50f6359 100644 --- a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp @@ -1187,9 +1187,14 @@ bool CNameManager::loadForbiddenNames() while (true) { char str[512]; - fgets(str, 511, fp); + char *fgres = fgets(str, 511, fp); if(feof(fp)) break; + if (fgres == NULL) + { + nlwarning("NAMEMGR: Error reading file"); + break; + } if (strlen(str) > 0) { str[strlen(str)-1] = '\0'; diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp index 987d4c86b..8d6c2a91f 100644 --- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp @@ -208,7 +208,7 @@ namespace RSMGR public: CRingSessionManager() : _DontUsePerm(false), - _CharSync(false) + _CharSync(NULL) { CRingSessionManagerSkel::init(this); CWelcomeServiceClientSkel::init(this); diff --git a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt index 87c5d7b05..82c1f6e3d 100644 --- a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt +++ b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt @@ -1,6 +1,5 @@ -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${QT_INCLUDES} ) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) +INCLUDE( ${QT_USE_FILE} ) FILE( GLOB SRC *.cpp *.h ) @@ -36,9 +35,6 @@ SET( CLIENT_CONFIG_TRANS CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY ) SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ) -SET( QT_USE_QTGUI TRUE ) -SET( QT_USE_QTOPENGL TRUE ) -SET( QT_USE_QTCORE TRUE ) QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} ) QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} ) QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} ) @@ -52,6 +48,11 @@ ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFI NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" ) NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt ) NL_ADD_LIB_SUFFIX( ryzom_configuration_qt ) -TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ) -INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications ) +TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY}) + +IF(WITH_PCH) + ADD_NATIVE_PRECOMPILED_HEADER(ryzom_configuration_qt ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) +ENDIF(WITH_PCH) + +INSTALL(TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications) diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp index 5c6801152..df3596980 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "client_config_dialog.h" #include "general_settings_widget.h" diff --git a/code/ryzom/tools/client/client_config_qt/config.cpp b/code/ryzom/tools/client/client_config_qt/config.cpp index 93a757b27..55854862f 100644 --- a/code/ryzom/tools/client/client_config_qt/config.cpp +++ b/code/ryzom/tools/client/client_config_qt/config.cpp @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "Config.h" +#include "stdpch.h" +#include "config.h" CConfig::CConfig() { @@ -237,7 +238,7 @@ void CConfig::setFloat( const char *key, float value ) } } -void CConfig::setString( const char *key, std::string &value ) +void CConfig::setString( const char *key, const std::string &value ) { NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); @@ -252,4 +253,4 @@ void CConfig::setString( const char *key, std::string &value ) { nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/client/client_config_qt/config.h b/code/ryzom/tools/client/client_config_qt/config.h index df48e19e0..d9ddb536e 100644 --- a/code/ryzom/tools/client/client_config_qt/config.h +++ b/code/ryzom/tools/client/client_config_qt/config.h @@ -108,7 +108,7 @@ public: @param key - the key we want to alter @param value - the value we want to set */ - void setString( const char *key, std::string &value ); + void setString( const char *key, const std::string &value ); private: // config file diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp index 211a4911b..0e0293555 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "display_settings_advanced_widget.h" + #include "system.h" CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp index aeddcf628..74b48cc45 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp @@ -14,9 +14,11 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "system.h" +#include "stdpch.h" #include "display_settings_details_widget.h" +#include "system.h" + CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) : CWidgetBase( parent ) { diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp index f6775a0b7..f0dba2a07 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp @@ -14,9 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include -#include +#include "stdpch.h" #include "display_settings_widget.h" + #include "system.h" #include @@ -30,6 +30,10 @@ CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) : ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) ); load(); +#ifndef Q_OS_WIN32 + direct3dRadioButton->setEnabled(false); +#endif + connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); @@ -71,7 +75,7 @@ void CDisplaySettingsWidget::load() CVideoMode mode; - mode.widht = s.config.getInt( "Width" ); + mode.width = s.config.getInt( "Width" ); mode.height = s.config.getInt( "Height" ); mode.depth = s.config.getInt( "Depth" ); mode.frequency = s.config.getInt( "Frequency" ); @@ -86,7 +90,7 @@ void CDisplaySettingsWidget::load() windowedRadioButton->setChecked( true ); } - widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) ); + widthLineEdit->setText( QString( "%1" ).arg( mode.width ) ); heightLineEdit->setText( QString( "%1" ).arg( mode.height ) ); xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) ); ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) ); @@ -99,8 +103,10 @@ void CDisplaySettingsWidget::save() if( openglRadioButton->isChecked() ) s.config.setString( "Driver3D", std::string( "OpenGL" ) ); +#ifdef Q_OS_WIN32 else if( direct3dRadioButton->isChecked() ) s.config.setString( "Driver3D", std::string( "Direct3D" ) ); +#endif else s.config.setString( "Driver3D", std::string( "Auto" ) ); @@ -112,12 +118,14 @@ void CDisplaySettingsWidget::save() CVideoMode mode; // OpenGL should be available everywhere! +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) mode = s.d3dInfo.modes[ index ]; else +#endif mode = s.openglInfo.modes[ index ]; - s.config.setInt( "Width", mode.widht ); + s.config.setInt( "Width", mode.width ); s.config.setInt( "Height", mode.height ); s.config.setInt( "Depth", mode.depth ); s.config.setInt( "Frequency", mode.frequency ); @@ -151,24 +159,27 @@ void CDisplaySettingsWidget::updateVideoModes() videomodeComboBox->clear(); + std::vector< CVideoMode >::iterator itr, iend; + +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { - for( std::vector< CVideoMode >::iterator itr = s.d3dInfo.modes.begin(); itr != s.d3dInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.d3dInfo.modes.begin(); + iend = s.d3dInfo.modes.end(); } else +#endif { // OpenGL should be available everywhere! - for( std::vector< CVideoMode >::iterator itr = s.openglInfo.modes.begin(); itr != s.openglInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.openglInfo.modes.begin(); + iend = s.openglInfo.modes.end(); + } + + while(itr != iend) + { + videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); + + ++itr; } } @@ -192,6 +203,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) CVideoMode &m = *mode; CSystem &s = CSystem::GetInstance(); +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ ) @@ -199,6 +211,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) return i; } else +#endif { // Again OpenGL should be available everywhere! for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ ) diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp index fcb85dec2..bb402b328 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "general_settings_widget.h" + #include "system.h" #include @@ -46,7 +48,7 @@ void CGeneralSettingsWidget::load() { CSystem &s = CSystem::GetInstance(); - sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) ); + sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); if( cbIndex != -1 ){ languageComboBox->setCurrentIndex( cbIndex ); onLanguageChanged(); @@ -111,7 +113,7 @@ void CGeneralSettingsWidget::changeEvent( QEvent *event ) QWidget::changeEvent( event ); } -int CGeneralSettingsWidget::getIndexForLanguageCode( QString &languageCode ) +int CGeneralSettingsWidget::getIndexForLanguageCode(const QString &languageCode) { for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ ) if( languageCode.compare( languageCodes[ i ] ) == 0 ) diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h index c8d530ea5..412658a72 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h @@ -19,7 +19,6 @@ #include "ui_general_settings_widget.h" #include "widget_base.h" -#include class QTranslator; @@ -37,7 +36,7 @@ class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_w public: CGeneralSettingsWidget( QWidget *parent = NULL ); - ~CGeneralSettingsWidget(); + virtual ~CGeneralSettingsWidget(); void load(); void save(); @@ -54,7 +53,7 @@ private: @param languageCode - Reference to the language code, we are trying to find. @return Returns the index on success, returns -1 if the language code cannot be found. */ - sint32 getIndexForLanguageCode( QString &languageCode ); + sint32 getIndexForLanguageCode(const QString &languageCode); // Contains the language codes used in the config file // They are in the same order as the options in languageComboBox diff --git a/code/ryzom/tools/client/client_config_qt/main.cpp b/code/ryzom/tools/client/client_config_qt/main.cpp index 758598e92..0f41c508b 100644 --- a/code/ryzom/tools/client/client_config_qt/main.cpp +++ b/code/ryzom/tools/client/client_config_qt/main.cpp @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include +#include "stdpch.h" + #include "client_config_dialog.h" #include "system.h" diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp index 5436ac2b4..be637f8d8 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sound_settings_widget.h" + #include "system.h" CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h index d98a89d82..c995f1206 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h @@ -19,7 +19,6 @@ #include "ui_sound_settings_widget.h" #include "widget_base.h" -#include /** @brief The sound settings page of the configuration tool diff --git a/code/ryzom/tools/client/client_config_qt/stdpch.cpp b/code/ryzom/tools/client/client_config_qt/stdpch.cpp new file mode 100644 index 000000000..a3d45576c --- /dev/null +++ b/code/ryzom/tools/client/client_config_qt/stdpch.cpp @@ -0,0 +1,17 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 . + +#include "stdpch.h" diff --git a/code/ryzom/tools/client/client_config_qt/stdpch.h b/code/ryzom/tools/client/client_config_qt/stdpch.h new file mode 100644 index 000000000..6f6655761 --- /dev/null +++ b/code/ryzom/tools/client/client_config_qt/stdpch.h @@ -0,0 +1,29 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 STDPCH_H +#define STDPCH_H + +#include + +#include +#include + +#include +#include + +#endif + diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp index 894ea07ac..140a75adc 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_d3d_widget.h" + #include "system.h" CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : @@ -22,9 +24,11 @@ CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : { setupUi( this ); +#ifdef Q_OS_WIN32 descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() ); driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() ); versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() ); +#endif } CSysInfoD3DWidget::~CSysInfoD3DWidget() diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h index 6f79782ae..a77d89fa9 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h @@ -17,7 +17,7 @@ #ifndef SYSINFOD3DWIDGET_H #define SYSINFOD3DWIDGET_H -#include "ui_sys_Info_d3d_widget.h" +#include "ui_sys_info_d3d_widget.h" /** @@ -28,7 +28,7 @@ class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget Q_OBJECT public: CSysInfoD3DWidget( QWidget *parent = NULL ); - ~CSysInfoD3DWidget(); + virtual ~CSysInfoD3DWidget(); protected: void changeEvent( QEvent *event ); diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp index 0665025be..55deea24e 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_opengl_widget.h" + #include "system.h" CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp index 26d52ddb8..fcc0940dd 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_widget.h" + #include "system.h" CSysInfoWidget::CSysInfoWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/system.cpp b/code/ryzom/tools/client/client_config_qt/system.cpp index c4c93f76d..6070e4abd 100644 --- a/code/ryzom/tools/client/client_config_qt/system.cpp +++ b/code/ryzom/tools/client/client_config_qt/system.cpp @@ -14,18 +14,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "system.h" -#include + #include #include #include -CSystem *CSystem::instance = NULL; - CSystem::CSystem() { GatherSysInfo(); -#ifdef WIN32 +#ifdef Q_OS_WIN32 GatherD3DInfo(); #endif GatherOpenGLInfo(); @@ -33,9 +32,32 @@ CSystem::CSystem() CSystem::~CSystem() { - instance = 0; } +bool CSystem::parseDriverVersion(const std::string &device, uint64 driver, std::string &version) +{ + // file version + uint32 version1 = driver >> 48; + uint32 version2 = (driver >> 32) & 0xffff; + uint32 version3 = (driver >> 16) & 0xffff; + uint32 version4 = driver & 0xffff; + + if (device.find("NVIDIA") != std::string::npos) + { + // nvidia should be something like 9.18.13.2018 and 9.18.13.1422 + // which respectively corresponds to drivers 320.18 and 314.22 + uint32 nvVersionMajor = (version3 % 10) * 100 + (version4 / 100); + uint32 nvVersionMinor = version4 % 100; + + version = NLMISC::toString("%u.%u", nvVersionMajor, nvVersionMinor); + } + else + { + version = NLMISC::toString("%u.%u.%u.%u", version1, version2, version3, version4); + } + + return true; +} void CSystem::GatherSysInfo() { @@ -46,24 +68,7 @@ void CSystem::GatherSysInfo() { sysInfo.videoDevice = device; - ////////////////////////////////////////////////////////////// - // FIXME - // This is taken from the original configuration tool, and - // it generates the same *wrong* version number - ////////////////////////////////////////////////////////////// - uint32 version = static_cast< uint32 >( driver & 0xffff ); - std::stringstream ss; - - ss << ( version / 1000 % 10 ); - ss << "."; - ss << ( version / 100 % 10 ); - ss << "."; - ss << ( version / 10 % 10 ); - ss << "."; - ss << ( version % 10 ); - - sysInfo.videoDriverVersion = ss.str(); - ////////////////////////////////////////////////////////////// + CSystem::parseDriverVersion(device, driver, sysInfo.videoDriverVersion); } else { @@ -77,7 +82,7 @@ void CSystem::GatherSysInfo() sysInfo.totalRAM /= ( 1024 * 1024 ); } -#ifdef WIN32 +#ifdef Q_OS_WIN32 void CSystem::GatherD3DInfo() { NL3D::IDriver *driver = NULL; @@ -92,16 +97,7 @@ void CSystem::GatherD3DInfo() d3dInfo.device = adapter.Description; d3dInfo.driver = adapter.Driver; - sint64 ver = adapter.DriverVersion; - std::stringstream ss; - ss << static_cast< uint16 >( ver >> 48 ); - ss << "."; - ss << static_cast< uint16 >( ver >> 32 ); - ss << "."; - ss << static_cast< uint16 >( ver >> 16 ); - ss << "."; - ss << static_cast< uint16 >( ver & 0xFFFF ); - d3dInfo.driverVersion = ss.str(); + CSystem::parseDriverVersion(d3dInfo.device, adapter.DriverVersion, d3dInfo.driverVersion); } GetVideoModes( d3dInfo.modes, driver ); @@ -109,7 +105,7 @@ void CSystem::GatherD3DInfo() driver->release(); } - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { nlwarning( e.what() ); } @@ -146,15 +142,13 @@ void CSystem::GatherOpenGLInfo() delete gl; - NL3D::IDriver *driver = NULL; try { - driver = NL3D::CDRU::createGlDriver(); + NL3D::IDriver *driver = NL3D::CDRU::createGlDriver(); GetVideoModes( openglInfo.modes, driver ); driver->release(); } - - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { nlwarning( e.what() ); } @@ -171,11 +165,11 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv { CVideoMode mode; mode.depth = itr->Depth; - mode.widht = itr->Width; + mode.width = itr->Width; mode.height = itr->Height; mode.frequency = itr->Frequency; dst.push_back( mode ); } } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/client/client_config_qt/system.h b/code/ryzom/tools/client/client_config_qt/system.h index bcb5f90bf..1cc25a4bf 100644 --- a/code/ryzom/tools/client/client_config_qt/system.h +++ b/code/ryzom/tools/client/client_config_qt/system.h @@ -27,22 +27,22 @@ class IDriver; struct CVideoMode { - unsigned int widht; - unsigned int height; - unsigned int depth; - unsigned int frequency; + uint16 width; + uint16 height; + uint8 depth; + uint8 frequency; CVideoMode() { - widht = 0; + width = 0; height = 0; depth = 0; frequency = 0; } - bool operator==( CVideoMode &o ) + bool operator== (const CVideoMode &o) { - if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) ) + if ((o.width == width) && (o.height == height) && (o.depth == depth) && (o.frequency == frequency)) return true; else return false; @@ -60,11 +60,8 @@ public: static CSystem &GetInstance() { - if( instance == 0 ) - { - instance = new CSystem; - } - return *instance; + static CSystem sInstance; + return sInstance; } struct CSysInfo @@ -74,16 +71,18 @@ public: std::string osName; std::string cpuName; uint64 totalRAM; - } sysInfo; + } + sysInfo; -#ifdef WIN32 +#ifdef Q_OS_WIN32 struct CD3DInfo { std::string device; std::string driver; std::string driverVersion; std::vector< CVideoMode > modes; - } d3dInfo; + } + d3dInfo; #endif struct COpenGLInfo @@ -93,20 +92,22 @@ public: std::string driverVersion; std::string extensions; std::vector< CVideoMode > modes; - } openglInfo; + } + openglInfo; CConfig config; private: void GatherSysInfo(); -#ifdef WIN32 +#ifdef Q_OS_WIN32 void GatherD3DInfo(); #endif void GatherOpenGLInfo(); - void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const; + void GetVideoModes(std::vector &dst, NL3D::IDriver *driver) const; - static CSystem *instance; + static bool parseDriverVersion(const std::string &device, uint64 driver, std::string &version); }; #endif // SYSTEM_H + diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h index 18a0ae23e..3f4ad0c98 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h @@ -1,5 +1,5 @@ /* -Georges Editor Qt +Georges Editor Qt Copyright (C) 2010 Adrian Jaekel This program is free software: you can redistribute it and/or modify @@ -14,58 +14,58 @@ 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 . -*/ - -#ifndef FORMITEM_H -#define FORMITEM_H - -// NeL includes -#include - -// Qt includes -#include -#include - -namespace NLQT -{ - - class CFormItem - - { - public: - CFormItem(NLGEORGES::UFormElm *elm, const QList &data, - CFormItem *parent = 0, - NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, - NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); - ~CFormItem(); - - void appendChild(CFormItem *child); - - CFormItem *child(int row); - int childCount() const; - int columnCount() const; - QVariant data(int column) const; - int row() const; - CFormItem *parent(); - bool setData(int column, const QVariant &value); - NLGEORGES::UFormElm* getFormElm() {return formElm;} - NLGEORGES::UFormElm::TWhereIsValue valueFrom() - { - return whereV; - } - NLGEORGES::UFormElm::TWhereIsNode nodeFrom() - { - return whereN; - } - - private: - QList childItems; - QList itemData; - CFormItem *parentItem; - NLGEORGES::UFormElm* formElm; - NLGEORGES::UFormElm::TWhereIsValue whereV; - NLGEORGES::UFormElm::TWhereIsNode whereN; - }; // CFormItem - -} -#endif // FORMITEM_H +*/ + +#ifndef FORMITEM_H +#define FORMITEM_H + +// NeL includes +#include + +// Qt includes +#include +#include + +namespace NLQT +{ + + class CFormItem + + { + public: + CFormItem(NLGEORGES::UFormElm *elm, const QList &data, + CFormItem *parent = 0, + NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, + NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); + ~CFormItem(); + + void appendChild(CFormItem *child); + + CFormItem *child(int row); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + int row() const; + CFormItem *parent(); + bool setData(int column, const QVariant &value); + NLGEORGES::UFormElm* getFormElm() {return formElm;} + NLGEORGES::UFormElm::TWhereIsValue valueFrom() + { + return whereV; + } + NLGEORGES::UFormElm::TWhereIsNode nodeFrom() + { + return whereN; + } + + private: + QList childItems; + QList itemData; + CFormItem *parentItem; + NLGEORGES::UFormElm* formElm; + NLGEORGES::UFormElm::TWhereIsValue whereV; + NLGEORGES::UFormElm::TWhereIsNode whereN; + }; // CFormItem + +} +#endif // FORMITEM_H diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp index e0285a3fb..8b9092b4c 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp @@ -25,6 +25,7 @@ #include "nel/sound/u_audio_mixer.h" #include "PageBgFades.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp index bc0d108f4..239c5b370 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp @@ -25,6 +25,7 @@ #include "nel/sound/u_audio_mixer.h" #include "PageBgFlags.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp index 46856b955..b3add5365 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp @@ -21,6 +21,7 @@ #include "georges_plugin_sound.h" #include #include "PageComtext.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h index 3e5c33d17..9122d1f49 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h @@ -14,16 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDAFX_H +#define STDAFX_H + #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #define _WIN32_WINNT 0x0500 #include // MFC core and standard components #include // MFC extensions -#include "resource.h" #include "nel/misc/types_nl.h" #include "nel/misc/debug.h" #include "nel/georges/u_form_elm.h" -#include "georges_plugin_sound.h" +#endif diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index 4fdd68869..5e54e5298 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -177,8 +177,8 @@ GenderExtractor::GenderExtractor(const std::string & literal, const std::string& static const char * es[] ={"e", "e1", "e2", "e3"}; - static char * fs[] ={"f", "f1", "f2", "f3"}; - static char * hs[] ={"h", "h1", "h2", "h3"}; + static const char * fs[] ={"f", "f1", "f2", "f3"}; + static const char * hs[] ={"h", "h1", "h2", "h3"}; const char * e = es[level]; const char * f = fs[level]; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp index 853d487ba..bf405ab5c 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp @@ -331,7 +331,7 @@ REGISTER_VAR_INDIRECT(CVarSBrick, "var_sbrick"); /* for special item */ -char *SpecialItemProp[] = +const char *SpecialItemProp[] = { "Durability", "Weight", diff --git a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp index e7a1b2a33..a9d1daa9e 100644 --- a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp @@ -276,7 +276,7 @@ int main(int argc, char* argv[]) try { CIFile f(builderConfig.CWMapCachePath + "/" + shortname + ".cw_height"); - f.serialCheck((uint32) 'OBSI'); + f.serialCheck(NELID("OBSI")); f.serial(xmin); f.serial(xmax); f.serial(ymin); @@ -322,7 +322,7 @@ int main(int argc, char* argv[]) // now extract each island height // read back coordinates CIFile f(builderConfig.CWMapCachePath + "/" + shortname + ".cw_height"); - f.serialCheck((uint32) 'OBSI'); + f.serialCheck(NELID("OBSI")); f.serial(xmin); f.serial(xmax); f.serial(ymin); @@ -349,7 +349,7 @@ int main(int argc, char* argv[]) try { COFile f(builderConfig.OutputPath + "/" + completeIslands[l]->Island + ".island_hm"); - f.serialCheck((uint32) 'MHSI'); + f.serialCheck(NELID("MHSI")); f.serial(island); // export tga for check if (builderConfig.HeightMapsAsTga) diff --git a/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp b/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp index d08982ae4..810540cf8 100644 --- a/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp @@ -401,7 +401,7 @@ void CPackedWorldBuilder::fly(std::vector &islands, float camSpeed // fly into scene try { - CNELU::init(1024, 768, CViewport(), 32, true, NULL, false, true); + CNELU::init(1024, 768, CViewport(), 32, true, EmptyWindow, false, true); } catch(const Exception &e) { diff --git a/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp b/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp index 21f85b760..27e56403f 100644 --- a/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp @@ -607,7 +607,7 @@ int main(int argc, char* argv[]) // fly into scene try { - CNELU::init(1024, 768, CViewport(), 32, true, NULL, false, true); + CNELU::init(1024, 768, CViewport(), 32, true, EmptyWindow, false, true); } catch(const Exception &e) {