merge from default

This commit is contained in:
dnk-88 2011-09-14 12:16:59 +03:00
parent 504e430c1a
commit d5aba92b5a
151 changed files with 7790 additions and 1617 deletions

View file

@ -143,11 +143,11 @@ IF(WITH_RYZOM)
ENDIF(WITH_RYZOM) ENDIF(WITH_RYZOM)
IF(WITH_NELNS) IF(WITH_NELNS)
# ADD_SUBDIRECTORY(nelns) ADD_SUBDIRECTORY(nelns)
ENDIF(WITH_NELNS) ENDIF(WITH_NELNS)
IF(WITH_SNOWBALLS) IF(WITH_SNOWBALLS)
# ADD_SUBDIRECTORY(snowballs2) ADD_SUBDIRECTORY(snowballs2)
ENDIF(WITH_SNOWBALLS) ENDIF(WITH_SNOWBALLS)
IF(WITH_TOOLS) IF(WITH_TOOLS)

View file

@ -12,32 +12,35 @@ endif(MAXSDK_INCLUDE_DIR)
find_path(MAXSDK_INCLUDE_DIR max.h find_path(MAXSDK_INCLUDE_DIR max.h
PATHS PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include"
) )
find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h
PATHS PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include/CS"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS"
) )
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY} FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME} NAMES ${MYLIBRARYNAME}
PATHS PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/lib"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib" )
)
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core) FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)

View file

@ -8,7 +8,7 @@
# EXTERNAL_FOUND - True if the external libraries are available # EXTERNAL_FOUND - True if the external libraries are available
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH}) SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
SET(EXTERNAL_TEMP_FILE "include/zlib.h") SET(EXTERNAL_TEMP_FILE "include/wwwconf.h")
SET(EXTERNAL_NAME "external") SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport # If using STLport preprend external_stlport
@ -36,18 +36,18 @@ IF(EXTERNAL_PATH)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
# Using 32 or 64 bits binaries # Using 32 or 64 bits binaries
IF(TARGET_X64) IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64") SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
ELSE(TARGET_X64) ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
ENDIF(TARGET_X64) ENDIF(TARGET_X64 AND WIN32)
# Using 32 or 64 bits libraries # Using 32 or 64 bits libraries
IF(TARGET_X64) IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(TARGET_X64) ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib") SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(TARGET_X64) ENDIF(TARGET_X64 AND WIN32)
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}") SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake # Stupid hack for FindOpenAL.cmake

View file

@ -41,7 +41,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
FIND_LIBRARY(FREETYPE_LIBRARY FIND_LIBRARY(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219 NAMES freetype libfreetype freetype219 freetype246
PATHS PATHS
$ENV{FREETYPE_DIR}/lib $ENV{FREETYPE_DIR}/lib
/usr/local/lib /usr/local/lib

View file

@ -6,6 +6,8 @@
# LIBWWW_LIBRARY, where to find the LibWWW library. # LIBWWW_LIBRARY, where to find the LibWWW library.
# LIBWWW_FOUND, If false, do not try to use LibWWW. # LIBWWW_FOUND, If false, do not try to use LibWWW.
OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF)
SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY})
# also defined, but not for general use are # also defined, but not for general use are
@ -46,6 +48,11 @@ ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
# helper to find all the libwww sub libraries # helper to find all the libwww sub libraries
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
FIND_LIBRARY(${MYLIBRARY} FIND_LIBRARY(${MYLIBRARY}
NAMES ${ARGN} NAMES ${ARGN}
PATHS PATHS
@ -60,21 +67,27 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
/usr/freeware/lib64 /usr/freeware/lib64
) )
IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
IF(${MYLIBRARY}) IF(${MYLIBRARY})
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSE(${MYLIBRARY}) ELSE(${MYLIBRARY})
IF(NOT LIBWWW_FIND_QUIETLY) IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}")
ENDIF(NOT LIBWWW_FIND_QUIETLY) ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY}) ENDIF(${MYLIBRARY})
MARK_AS_ADVANCED(${MYLIBRARY}) MARK_AS_ADVANCED(${MYLIBRARY})
ENDMACRO(FIND_WWW_LIBRARY) ENDMACRO(FIND_WWW_LIBRARY)
MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL)
LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL})
ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
ENDMACRO(LINK_WWW_LIBRARY) ENDMACRO(LINK_WWW_LIBRARY)
# Find and link required libs for static or dynamic # Find and link required libs for static or dynamic

View file

@ -33,6 +33,12 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
${WINSDKCURRENT_DIR}/Include ${WINSDKCURRENT_DIR}/Include
) )
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
PATHS
${WINSDK71_DIR}/Bin
${WINSDKCURRENT_DIR}/Bin
)
IF(WINSDK_INCLUDE_DIR) IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND TRUE) SET(WINSDK_FOUND TRUE)
ELSE(WINSDK_INCLUDE_DIR) ELSE(WINSDK_INCLUDE_DIR)

View file

@ -3,10 +3,10 @@
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc" # Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
### ###
MACRO(NL_GEN_PC name) MACRO(NL_GEN_PC name)
IF(NOT WIN32) IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig)
ENDIF(NOT WIN32) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDMACRO(NL_GEN_PC) ENDMACRO(NL_GEN_PC)
### ###
@ -37,9 +37,7 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument: # Argument:
### ###
MACRO(NL_DEFAULT_PROPS name label) MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10) SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
GET_TARGET_PROPERTY(type ${name} TYPE) GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY) IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library # Set versions only if target is a shared library
@ -49,6 +47,15 @@ MACRO(NL_DEFAULT_PROPS name label)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
ENDIF(NL_LIB_PREFIX) ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY) ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(${type} STREQUAL EXECUTABLE AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
IF(WITH_STLPORT AND WIN32) IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
ENDIF(WITH_STLPORT AND WIN32) ENDIF(WITH_STLPORT AND WIN32)
@ -171,7 +178,13 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(WITH_STATIC "With static libraries." OFF) OPTION(WITH_STATIC "With static libraries." OFF)
ENDIF(WIN32) ENDIF(WIN32)
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON )
ELSE(WIN32)
OPTION(WITH_EXTERNAL "With provided external." OFF)
ENDIF(WIN32)
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON )
### ###
# GUI toolkits # GUI toolkits
@ -196,10 +209,10 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF) OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
OPTION(WITH_NEL "Build NeL (nearly always required)." ON ) OPTION(WITH_NEL "Build NeL (nearly always required)." ON )
OPTION(WITH_NELNS "Build NeL Network Services." OFF) OPTION(WITH_NELNS "Build NeL Network Services." OFF)
OPTION(WITH_RYZOM "Build Ryzom Core." ON ) OPTION(WITH_RYZOM "Build Ryzom Core." ON )
OPTION(WITH_SNOWBALLS "Build Snowballs." OFF) OPTION(WITH_SNOWBALLS "Build Snowballs." OFF)
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS) ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
@ -308,25 +321,32 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# ADD_DEFINITIONS(-DHAVE_IA64) # ADD_DEFINITIONS(-DHAVE_IA64)
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") # ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
IF(WIN32) IF(WIN32)
IF(MSVC10) IF(MSVC10)
# /Ox is working with VC++ 2010, but custom optimizations don't exist # /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1") SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10) ELSEIF(MSVC90)
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1") SET(MIN_OPTIMIZATIONS "/Ob1")
ELSEIF(MSVC80)
# don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC10) ENDIF(MSVC10)
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
# Common link flags # Common link flags
SET(PLATFORM_LINKFLAGS "-DEBUG") SET(PLATFORM_LINKFLAGS "-DEBUG")
IF(TARGET_X64) IF(TARGET_X64)
# Fix a bug with Intellisense # Fix a bug with Intellisense
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
@ -354,6 +374,11 @@ MACRO(NL_SETUP_BUILD)
SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}")
ENDIF(APPLE) ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
SET(PLATFORM_CXXFLAGS ${PLATFORM_CFLAGS}) SET(PLATFORM_CXXFLAGS ${PLATFORM_CFLAGS})
IF(NOT APPLE) IF(NOT APPLE)
@ -456,54 +481,60 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
IF(WIN32) IF(WIN32)
SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ELSE(WIN32) ELSE(WIN32)
SET(RYZOM_ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/ryzom" CACHE PATH "Installation path for configurations") SET(RYZOM_ETC_PREFIX "${RYZOM_PREFIX}/etc/ryzom" CACHE PATH "Installation path for configurations")
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT RYZOM_ETC_PREFIX) ENDIF(NOT RYZOM_ETC_PREFIX)
## Allow override of install_prefix/share path. ## Allow override of install_prefix/share path.
IF(NOT RYZOM_SHARE_PREFIX) IF(NOT RYZOM_SHARE_PREFIX)
IF(WIN32) IF(WIN32)
SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ELSE(WIN32) ELSE(WIN32)
SET(RYZOM_SHARE_PREFIX "${CMAKE_INSTALL_PREFIX}/share/ryzom" CACHE PATH "Installation path for data.") SET(RYZOM_SHARE_PREFIX "${RYZOM_PREFIX}/share/ryzom" CACHE PATH "Installation path for data.")
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT RYZOM_SHARE_PREFIX) ENDIF(NOT RYZOM_SHARE_PREFIX)
## Allow override of install_prefix/sbin path. ## Allow override of install_prefix/sbin path.
IF(NOT RYZOM_SBIN_PREFIX) IF(NOT RYZOM_SBIN_PREFIX)
IF(WIN32) IF(WIN32)
SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ELSE(WIN32) ELSE(WIN32)
SET(RYZOM_SBIN_PREFIX "${CMAKE_INSTALL_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.") SET(RYZOM_SBIN_PREFIX "${RYZOM_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.")
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT RYZOM_SBIN_PREFIX) ENDIF(NOT RYZOM_SBIN_PREFIX)
## Allow override of install_prefix/bin path. ## Allow override of install_prefix/bin path.
IF(NOT RYZOM_BIN_PREFIX) IF(NOT RYZOM_BIN_PREFIX)
IF(WIN32) IF(WIN32)
SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ELSE(WIN32) ELSE(WIN32)
SET(RYZOM_BIN_PREFIX "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation path for tools.") SET(RYZOM_BIN_PREFIX "${RYZOM_PREFIX}/bin" CACHE PATH "Installation path for tools.")
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT RYZOM_BIN_PREFIX) ENDIF(NOT RYZOM_BIN_PREFIX)
## Allow override of install_prefix/games path. ## Allow override of install_prefix/games path.
IF(NOT RYZOM_GAMES_PREFIX) IF(NOT RYZOM_GAMES_PREFIX)
IF(WIN32) IF(WIN32)
SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.") SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ELSE(WIN32) ELSE(WIN32)
SET(RYZOM_GAMES_PREFIX "${CMAKE_INSTALL_PREFIX}/games" CACHE PATH "Installation path for client.") SET(RYZOM_GAMES_PREFIX "${RYZOM_PREFIX}/games" CACHE PATH "Installation path for client.")
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT RYZOM_GAMES_PREFIX) ENDIF(NOT RYZOM_GAMES_PREFIX)
ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) ENDMACRO(RYZOM_SETUP_PREFIX_PATHS)
MACRO(SETUP_EXTERNAL) MACRO(SETUP_EXTERNAL)
IF(WIN32) IF(WITH_EXTERNAL)
FIND_PACKAGE(External REQUIRED) FIND_PACKAGE(External REQUIRED)
ENDIF(WITH_EXTERNAL)
IF(WIN32)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
IF(MSVC10) IF(MSVC10)
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found # VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry") IF(VC_ROOT_DIR MATCHES "registry")
@ -544,5 +575,4 @@ MACRO(SETUP_EXTERNAL)
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR})
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(WITH_STLPORT) ENDIF(WITH_STLPORT)
ENDMACRO(SETUP_EXTERNAL) ENDMACRO(SETUP_EXTERNAL)

View file

@ -54,24 +54,27 @@ IF(WITH_GTK)
FIND_PACKAGE(GTK2) FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK) ENDIF(WITH_GTK)
IF(UNIX) IF(WITH_INSTALL_LIBRARIES)
SET(prefix ${CMAKE_INSTALL_PREFIX}) IF(UNIX)
SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(libdir ${CMAKE_INSTALL_PREFIX}/lib) SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
SET(includedir ${CMAKE_INSTALL_PREFIX}/include) SET(libdir ${CMAKE_INSTALL_PREFIX}/lib)
SET(enable_ligo ${WITH_LIGO}) SET(includedir ${CMAKE_INSTALL_PREFIX}/include)
SET(enable_logic ${WITH_LOGIC}) SET(enable_ligo ${WITH_LIGO})
SET(enable_georges ${WITH_GEORGES}) SET(enable_logic ${WITH_LOGIC})
SET(enable_net ${WITH_NET}) SET(enable_georges ${WITH_GEORGES})
SET(enable_3d ${WITH_3D}) SET(enable_net ${WITH_NET})
SET(enable_pacs ${WITH_PACS}) SET(enable_3d ${WITH_3D})
SET(enable_sound ${WITH_SOUND}) SET(enable_pacs ${WITH_PACS})
CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config) SET(enable_sound ${WITH_SOUND})
CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION bin) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION bin)
ENDIF(UNIX) ENDIF(UNIX)
ADD_SUBDIRECTORY(include)
ENDIF(WITH_INSTALL_LIBRARIES)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
IF(WITH_NEL_SAMPLES) IF(WITH_NEL_SAMPLES)

View file

@ -706,6 +706,9 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-3d.pc) NL_GEN_PC(nel-3d.pc)
INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ADD_SUBDIRECTORY(driver) ADD_SUBDIRECTORY(driver)

View file

@ -16,7 +16,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -61,7 +61,9 @@ IF(NOT APPLE AND WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
ENDIF(NOT APPLE AND WITH_PCH) ENDIF(NOT APPLE AND WITH_PCH)
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -11,4 +11,6 @@ NL_ADD_LIB_SUFFIX(nelceguirenderer)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS)
INSTALL(TARGETS nelceguirenderer RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelceguirenderer RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -21,4 +21,7 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-georges.pc) NL_GEN_PC(nel-georges.pc)
INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -19,4 +19,7 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-ligo.pc) NL_GEN_PC(nel-ligo.pc)
INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -14,4 +14,6 @@ NL_ADD_LIB_SUFFIX(nellogic)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -53,4 +53,7 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-misc.pc) NL_GEN_PC(nel-misc.pc)
INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -24,4 +24,7 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-net.pc) NL_GEN_PC(nel-net.pc)
INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -19,4 +19,7 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-pacs.pc) NL_GEN_PC(nel-pacs.pc)
INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -19,6 +19,9 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
NL_GEN_PC(nel-sound.pc) NL_GEN_PC(nel-sound.pc)
INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ADD_SUBDIRECTORY(driver) ADD_SUBDIRECTORY(driver)

View file

@ -23,7 +23,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelsnd_lowlevel ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nelsnd_lowlevel ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
IF(WITH_DRIVER_OPENAL) IF(WITH_DRIVER_OPENAL)
ADD_SUBDIRECTORY(openal) ADD_SUBDIRECTORY(openal)

View file

@ -13,7 +13,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_dsound_win ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_dsound_win ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -13,7 +13,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_fmod_win ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.h ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_fmod_win ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.h ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -44,7 +44,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_AL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.cpp) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_AL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -40,7 +40,9 @@ IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_xaudio2_win ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.h ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_xaudio2_win ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.h ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) IF(WITH_MAXPLUGIN)
ENDIF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
ENDIF(WITH_MAXPLUGIN)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)

View file

@ -18,6 +18,7 @@
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include "../../plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../../plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
extern ClassDesc2* GetLigoscapeDesc(); extern ClassDesc2* GetLigoscapeDesc();
@ -44,7 +45,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
if (!controlsInit) if (!controlsInit)
{ {
controlsInit = TRUE; controlsInit = TRUE;
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); // Initialize MAX's custom controls InitCustomControls(hInstance); // Initialize MAX's custom controls
#endif
InitCommonControls(); // Initialize Win95 controls InitCommonControls(); // Initialize Win95 controls
} }

View file

@ -17,7 +17,12 @@
#include <assert.h> #include <assert.h>
// From MAXSDK // From MAXSDK
#include <MaxScrpt/maxscrpt.h> #include <maxversion.h>
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/maxscript.h>
#else
# include <MaxScrpt/maxscrpt.h>
#endif
#include "max_to_ligo.h" #include "max_to_ligo.h"

View file

@ -19,17 +19,30 @@
#include <assert.h> #include <assert.h>
// Various MAX and MXS includes // Various MAX and MXS includes
#include <MaxScrpt/MAXScrpt.h> #include <maxversion.h>
#include <MaxScrpt/3dmath.h> #if MAX_VERSION_MAJOR >= 14
#include <MaxScrpt/Numbers.h> # include <maxscript/maxscript.h>
#include <MaxScrpt/MAXclses.h> # include <maxscript/foundation/3dmath.h>
#include <MaxScrpt/Streams.h> # include <maxscript/foundation/numbers.h>
#include <MaxScrpt/MSTime.h> # include <maxscript/maxwrapper/maxclasses.h>
#include <MaxScrpt/MAXObj.h> # include <maxscript/foundation/streams.h>
#include <MaxScrpt/Parser.h> # include <maxscript/foundation/mxstime.h>
# include <maxscript/maxwrapper/mxsobjects.h>
# include <maxscript/compiler/parser.h>
# include <maxscript/foundation/functions.h>
#else
# include <MaxScrpt/MAXScrpt.h>
# include <MaxScrpt/3dmath.h>
# include <MaxScrpt/Numbers.h>
# include <MaxScrpt/MAXclses.h>
# include <MaxScrpt/Streams.h>
# include <MaxScrpt/MSTime.h>
# include <MaxScrpt/MAXObj.h>
# include <MaxScrpt/Parser.h>
# include <MaxScrpt/definsfn.h>
#endif
#include <max.h> #include <max.h>
#include <stdmat.h> #include <stdmat.h>
#include <MaxScrpt/definsfn.h>
// Visual // Visual
#include <direct.h> #include <direct.h>

View file

@ -36,6 +36,15 @@ LIST(REMOVE_ITEM QT_PROPERTY_EDITOR_MOC_SRC ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbu
${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx) ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx)
# We need to add new depencencies on removed files because we need them to be still generated
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtbuttonpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qteditorfactory.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtgroupboxpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertymanager.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qttreepropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx)
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtvariantproperty.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx)
#set( #set(
# qtpropertyeditor_HEADERS_ONLY_MOC # qtpropertyeditor_HEADERS_ONLY_MOC
# ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cpp # ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cpp
@ -79,7 +88,7 @@ TARGET_LINK_LIBRARIES(qt_property_browser ${QT_LIBRARIES})
ADD_DEFINITIONS(${QT_DEFINITIONS}) ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_DLL) ADD_DEFINITIONS(-DQT_DLL)
#ADD_DEFINITIONS(-DQT_QTPROPERTYBROWSER_EXPORT) ADD_DEFINITIONS(-DQT_QTPROPERTYBROWSER_EXPORT)
ADD_DEFINITIONS(-DQT_PLUGIN) ADD_DEFINITIONS(-DQT_PLUGIN)
#ADD_DEFINITIONS(-DQT_NO_DEBUG) #ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED) ADD_DEFINITIONS(-DQT_SHARED)

View file

@ -105,6 +105,6 @@ public:
}; //namespace ExtensionSystem }; //namespace ExtensionSystem
Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.1") Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.2")
#endif // IPLUGIN_H #endif // IPLUGIN_H

View file

@ -98,7 +98,7 @@ public:
{ {
QList<QObject *> all = allObjects(); QList<QObject *> all = allObjects();
QObject *result = 0; QObject *result = 0;
Q_FOREACH (QObject *qobj, all) Q_FOREACH(QObject *qobj, all)
{ {
if (qobj->objectName() == name) if (qobj->objectName() == name)
{ {

View file

@ -71,9 +71,13 @@ public:
virtual IPlugin *plugin() const = 0; virtual IPlugin *plugin() const = 0;
// state // state
virtual int getState() const = 0; virtual int state() const = 0;
virtual bool hasError() const = 0; virtual bool hasError() const = 0;
virtual QString errorString() const = 0; virtual QString errorString() const = 0;
/// Enables/disables load this plugin after restart the program
virtual void setEnabled(bool enabled) = 0;
virtual bool isEnabled() const = 0;
}; };
} // namespace ExtensionSystem } // namespace ExtensionSystem

View file

@ -34,6 +34,7 @@ CPluginManager::CPluginManager(QObject *parent)
CPluginManager::~CPluginManager() CPluginManager::~CPluginManager()
{ {
writeSettings();
stopAll(); stopAll();
deleteAll(); deleteAll();
qDeleteAll(m_pluginSpecs); qDeleteAll(m_pluginSpecs);
@ -114,6 +115,7 @@ void CPluginManager::setPluginPaths(const QStringList &paths)
{ {
m_pluginPaths = paths; m_pluginPaths = paths;
readPluginPaths(); readPluginPaths();
readSettings();
} }
QList<IPluginSpec *> CPluginManager::plugins() const QList<IPluginSpec *> CPluginManager::plugins() const
@ -133,10 +135,41 @@ QSettings *CPluginManager::settings() const
void CPluginManager::readSettings() void CPluginManager::readSettings()
{ {
if (m_settings)
{
QStringList blackList;
m_settings->beginGroup("PluginManager");
blackList = m_settings->value("BlackList").toStringList();
m_settings->endGroup();
Q_FOREACH (CPluginSpec *spec, m_pluginSpecs)
{
QString pluginName = spec->fileName();
if (blackList.contains(pluginName))
{
spec->setEnabled(false);
spec->setEnabledStartup(false);
}
}
}
} }
void CPluginManager::writeSettings() void CPluginManager::writeSettings()
{ {
if (m_settings)
{
QStringList blackList;
Q_FOREACH(CPluginSpec *spec, m_pluginSpecs)
{
nlinfo(spec->fileName().toStdString().c_str());
if (!spec->isEnabled())
blackList.push_back(spec->fileName());
}
m_settings->beginGroup("PluginManager");
m_settings->setValue("BlackList", blackList);
m_settings->endGroup();
m_settings->sync();
}
} }
void CPluginManager::readPluginPaths() void CPluginManager::readPluginPaths()
@ -176,7 +209,11 @@ void CPluginManager::readPluginPaths()
void CPluginManager::setPluginState(CPluginSpec *spec, int destState) void CPluginManager::setPluginState(CPluginSpec *spec, int destState)
{ {
if (spec->hasError() || spec->getState() != destState-1) if (spec->hasError() || spec->state() != destState-1)
return;
// plugin in black list
if (!spec->isEnabledStartup())
return; return;
switch (destState) switch (destState)
@ -198,7 +235,7 @@ void CPluginManager::setPluginState(CPluginSpec *spec, int destState)
} }
Q_FOREACH (const CPluginSpec *depSpec, spec->dependencySpecs()) Q_FOREACH (const CPluginSpec *depSpec, spec->dependencySpecs())
{ {
if (depSpec->getState() != destState) if (depSpec->state() != destState)
{ {
spec->m_hasError = true; spec->m_hasError = true;
spec->m_errorString = tr("Cannot initializing plugin because dependency failed to load: %1\nReason: %2") spec->m_errorString = tr("Cannot initializing plugin because dependency failed to load: %1\nReason: %2")
@ -251,7 +288,7 @@ bool CPluginManager::loadQueue(CPluginSpec *spec, QList<CPluginSpec *> &queue,
} }
circularityCheckQueue.append(spec); circularityCheckQueue.append(spec);
// check if we have the dependencies // check if we have the dependencies
if (spec->getState() == State::Invalid || spec->getState() == State::Read) if (spec->state() == State::Invalid || spec->state() == State::Read)
{ {
queue.append(spec); queue.append(spec);
return false; return false;

View file

@ -40,6 +40,8 @@ CPluginSpec::CPluginSpec()
m_vendor(""), m_vendor(""),
m_description(""), m_description(""),
m_state(State::Invalid), m_state(State::Invalid),
m_enabled(true),
m_enabledStartup(true),
m_hasError(false), m_hasError(false),
m_errorString(""), m_errorString(""),
m_plugin(0), m_plugin(0),
@ -82,12 +84,12 @@ QString CPluginSpec::fileName() const
return m_fileName; return m_fileName;
} }
IPlugin* CPluginSpec::plugin() const IPlugin *CPluginSpec::plugin() const
{ {
return m_plugin; return m_plugin;
} }
int CPluginSpec::getState() const int CPluginSpec::state() const
{ {
return m_state; return m_state;
} }
@ -124,6 +126,16 @@ bool CPluginSpec::setFileName(const QString &fileName)
return true; return true;
} }
void CPluginSpec::setEnabled(bool enabled)
{
m_enabled = enabled;
}
bool CPluginSpec::isEnabled() const
{
return m_enabled;
}
bool CPluginSpec::loadLibrary() bool CPluginSpec::loadLibrary()
{ {
if (m_hasError) if (m_hasError)
@ -259,6 +271,16 @@ void CPluginSpec::kill()
m_state = State::Deleted; m_state = State::Deleted;
} }
void CPluginSpec::setEnabledStartup(bool enabled)
{
m_enabledStartup = enabled;
}
bool CPluginSpec::isEnabledStartup() const
{
return m_enabledStartup;
}
bool CPluginSpec::reportError(const QString &err) bool CPluginSpec::reportError(const QString &err)
{ {
m_errorString = err; m_errorString = err;

View file

@ -41,11 +41,15 @@ public:
virtual IPlugin *plugin() const; virtual IPlugin *plugin() const;
// state // state
virtual int getState() const; virtual int state() const;
virtual bool hasError() const; virtual bool hasError() const;
virtual QString errorString() const; virtual QString errorString() const;
QList<CPluginSpec *> dependencySpecs() const; QList<CPluginSpec *> dependencySpecs() const;
/// Enables/disables load this plugin after restart the program
virtual void setEnabled(bool enabled);
virtual bool isEnabled() const;
private: private:
CPluginSpec(); CPluginSpec();
@ -57,6 +61,11 @@ private:
void stop(); void stop();
void kill(); void kill();
/// Enables/disables load this plugin on startup the program
/// Method is used for disabling startup plugin by pluginmanager
void setEnabledStartup(bool enabled);
bool isEnabledStartup() const;
bool reportError(const QString &err); bool reportError(const QString &err);
QString m_location; QString m_location;
@ -69,6 +78,7 @@ private:
QString m_description; QString m_description;
int m_state; int m_state;
bool m_enabled, m_enabledStartup;
bool m_hasError; bool m_hasError;
QString m_errorString; QString m_errorString;

View file

@ -132,7 +132,7 @@ sint main(int argc, char **argv)
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("RyzomCore"), QLatin1String(appNameC)); QLatin1String("RyzomCore"), QLatin1String(appNameC));
QTranslator translator; QTranslator translator;
QTranslator qtTranslator; QTranslator qtTranslator;
@ -162,17 +162,8 @@ sint main(int argc, char **argv)
splash->hide(); splash->hide();
const QList<ExtensionSystem::IPluginSpec *> plugins = pluginManager.plugins(); ExtensionSystem::IPluginSpec *corePlugin = pluginManager.pluginByName("Core");
ExtensionSystem::IPluginSpec *corePlugin = 0;
Q_FOREACH(ExtensionSystem::IPluginSpec *spec, plugins)
{
if (spec->name() == QLatin1String("Core"))
{
corePlugin = spec;
break;
}
}
if (!corePlugin) if (!corePlugin)
{ {
QDir absolutePluginPaths(pluginPaths.join(QLatin1String(","))); QDir absolutePluginPaths(pluginPaths.join(QLatin1String(",")));
@ -183,8 +174,8 @@ sint main(int argc, char **argv)
QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath()); QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath());
bool ok; bool ok;
QString text = QInputDialog::getText(0, QCoreApplication::translate("Application", "Enter the plugins path"), QString text = QInputDialog::getText(0, QCoreApplication::translate("Application", "Enter the plugins path"),
QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal, QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal,
newPath, &ok); newPath, &ok);
if (ok && !text.isEmpty()) if (ok && !text.isEmpty())
settings->setValue("PluginPath", text); settings->setValue("PluginPath", text);
settings->sync(); settings->sync();
@ -203,7 +194,7 @@ sint main(int argc, char **argv)
if (!errors.isEmpty()) if (!errors.isEmpty())
QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"), QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
errors.join(QString::fromLatin1("\n\n"))); errors.join(QString::fromLatin1("\n\n")));
int result = app.exec(); int result = app.exec();
return result; return result;

View file

@ -5,11 +5,13 @@ ADD_SUBDIRECTORY(landscape_editor)
ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(zone_painter)
ADD_SUBDIRECTORY(georges_editor) ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(world_editor) ADD_SUBDIRECTORY(world_editor)
# Note: Temporarily disabled until development continues.
#ADD_SUBDIRECTORY(zone_painter)
# Ryzom Specific Plugins # Ryzom Specific Plugins
IF(WITH_RYZOM AND WITH_RYZOM_TOOLS) IF(WITH_RYZOM AND WITH_RYZOM_TOOLS)
ADD_SUBDIRECTORY(mission_compiler) ADD_SUBDIRECTORY(mission_compiler)
ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS) ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS)

View file

@ -37,6 +37,8 @@
using namespace Core; using namespace Core;
CorePlugin::CorePlugin() CorePlugin::CorePlugin()
: m_plugMan(0),
m_mainWindow(0)
{ {
} }
@ -49,7 +51,8 @@ CorePlugin::~CorePlugin()
qDeleteAll(m_autoReleaseObjects); qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear(); m_autoReleaseObjects.clear();
delete m_mainWindow; if (m_mainWindow)
delete m_mainWindow;
} }
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)

View file

@ -87,9 +87,11 @@ void GeneralSettingsPage::applyGeneralSettings()
settings->beginGroup(Core::Constants::DATA_PATH_SECTION); settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString(); QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString();
QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString(); QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString();
QString leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false); NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false);
NLMISC::CPath::display(); NLMISC::CPath::display();
NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString()); NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString());
NLMISC::CPath::addSearchPath(leveldesignPath.toStdString(), true, false);
settings->endGroup(); settings->endGroup();
} }

View file

@ -107,8 +107,8 @@ bool MainWindow::initialize(QString *errorString)
void MainWindow::extensionsInitialized() void MainWindow::extensionsInitialized()
{ {
readSettings(); readSettings();
connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)), connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext *)),
this, SLOT(updateContext(Core::IContext*))); this, SLOT(updateContext(Core::IContext *)));
if (m_contextManager->currentContext() != NULL) if (m_contextManager->currentContext() != NULL)
updateContext(m_contextManager->currentContext()); updateContext(m_contextManager->currentContext());
show(); show();
@ -437,7 +437,7 @@ void MainWindow::createStatusBar()
void MainWindow::createDialogs() void MainWindow::createDialogs()
{ {
m_pluginView = new ExtensionSystem::CPluginView(m_pluginManager, this); m_pluginView = new PluginView(m_pluginManager, this);
// Create undo/redo command list // Create undo/redo command list
m_dockWidget = new QDockWidget("Command List", this); m_dockWidget = new QDockWidget("Command List", this);

View file

@ -93,7 +93,7 @@ private:
void writeSettings(); void writeSettings();
ExtensionSystem::IPluginManager *m_pluginManager; ExtensionSystem::IPluginManager *m_pluginManager;
ExtensionSystem::CPluginView *m_pluginView; PluginView *m_pluginView;
MenuManager *m_menuManager; MenuManager *m_menuManager;
ContextManager *m_contextManager; ContextManager *m_contextManager;
CoreImpl *m_coreImpl; CoreImpl *m_coreImpl;

View file

@ -16,11 +16,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "plugin_view_dialog.h" #include "plugin_view_dialog.h"
#include "core_constants.h"
#include "nel/misc/debug.h"
// Qt includes // Qt includes
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QStyle> #include <QtGui/QStyle>
#include <QtGui/QTreeWidgetItem> #include <QtGui/QTreeWidgetItem>
@ -29,45 +30,79 @@
#include "../../extension_system/iplugin_spec.h" #include "../../extension_system/iplugin_spec.h"
#include "../../extension_system/iplugin_manager.h" #include "../../extension_system/iplugin_manager.h"
namespace ExtensionSystem namespace Core
{ {
CPluginView::CPluginView(IPluginManager *pluginManager, QWidget *parent) PluginView::PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent)
: QDialog(parent) : QDialog(parent),
m_checkStateColumn(0)
{ {
_ui.setupUi(this); m_ui.setupUi(this);
_pluginManager = pluginManager; m_pluginManager = pluginManager;
connect(_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); connect(m_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
connect(this, SIGNAL(accepted()), this, SLOT(updateSettings()));
// WhiteList is list of plugins which can not disable.
m_whiteList << Constants::OVQT_CORE_PLUGIN;
updateList(); updateList();
} }
CPluginView::~CPluginView() PluginView::~PluginView()
{ {
} }
void CPluginView::updateList() void PluginView::updateList()
{ {
static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton); static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton);
static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
static QIcon notLoadedIcon = QApplication::style()->standardIcon(QStyle::SP_DialogResetButton);
m_specToItem.clear();
QList<QTreeWidgetItem *> items; QList<QTreeWidgetItem *> items;
Q_FOREACH (IPluginSpec *spec, _pluginManager->plugins()) Q_FOREACH (ExtensionSystem::IPluginSpec *spec, m_pluginManager->plugins())
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() QTreeWidgetItem *item = new QTreeWidgetItem(QStringList()
<< ""
<< spec->name() << spec->name()
<< QString("%1").arg(spec->version()) << QString("%1").arg(spec->version())
<< spec->vendor() << spec->vendor()
<< QDir::toNativeSeparators(spec->filePath())); << QDir::toNativeSeparators(spec->filePath()));
item->setIcon(0, spec->hasError() ? errorIcon : okIcon);
bool ok = !spec->hasError();
QIcon icon = ok ? okIcon : errorIcon;
if (ok && (spec->state() != ExtensionSystem::State::Running))
icon = notLoadedIcon;
item->setIcon(m_checkStateColumn, icon);
if (!m_whiteList.contains(spec->name()))
item->setCheckState(m_checkStateColumn, spec->isEnabled() ? Qt::Checked : Qt::Unchecked);
items.append(item); items.append(item);
m_specToItem.insert(spec, item);
} }
_ui.pluginTreeWidget->clear(); m_ui.pluginTreeWidget->clear();
if (!items.isEmpty()) if (!items.isEmpty())
_ui.pluginTreeWidget->addTopLevelItems(items); m_ui.pluginTreeWidget->addTopLevelItems(items);
m_ui.pluginTreeWidget->resizeColumnToContents(m_checkStateColumn);
} }
} /* namespace NLQT */ void PluginView::updateSettings()
{
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, m_pluginManager->plugins())
{
if (m_specToItem.contains(spec) && (!m_whiteList.contains(spec->name())))
{
QTreeWidgetItem *item = m_specToItem.value(spec);
if (item->checkState(m_checkStateColumn) == Qt::Checked)
spec->setEnabled(true);
else
spec->setEnabled(false);
}
}
}
} /* namespace Core */

View file

@ -20,28 +20,39 @@
#include "ui_plugin_view_dialog.h" #include "ui_plugin_view_dialog.h"
#include <QtCore/QMap>
#include <QtCore/QStringList>
namespace ExtensionSystem namespace ExtensionSystem
{ {
class IPluginManager; class IPluginManager;
class IPluginSpec;
}
class CPluginView: public QDialog namespace Core
{
class PluginView: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CPluginView(IPluginManager *pluginManager, QWidget *parent = 0); PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0);
~CPluginView(); ~PluginView();
private Q_SLOTS: private Q_SLOTS:
void updateList(); void updateList();
void updateSettings();
private: private:
IPluginManager *_pluginManager; const int m_checkStateColumn;
Ui::CPluginView _ui; QMap<ExtensionSystem::IPluginSpec *, QTreeWidgetItem *> m_specToItem;
}; /* class CPluginView */ QStringList m_whiteList;
ExtensionSystem::IPluginManager *m_pluginManager;
Ui::PluginView m_ui;
}; /* class PluginView */
} /* namespace NLQT */ } /* namespace Core */
#endif // PLUGIN_VIEW_H #endif // PLUGIN_VIEW_H

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CPluginView</class> <class>PluginView</class>
<widget class="QDialog" name="CPluginView"> <widget class="QDialog" name="PluginView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>691</width> <width>756</width>
<height>249</height> <height>296</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -37,14 +37,6 @@
<property name="sortingEnabled"> <property name="sortingEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="headerDefaultSectionSize">
<number>100</number>
</attribute>
<column>
<property name="text">
<string>State</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Name</string> <string>Name</string>
@ -126,7 +118,7 @@
<connection> <connection>
<sender>closePushButton</sender> <sender>closePushButton</sender>
<signal>clicked()</signal> <signal>clicked()</signal>
<receiver>CPluginView</receiver> <receiver>PluginView</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

View file

@ -10,10 +10,14 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin
SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
georges_editor_form.h georges_editor_form.h
georges_dirtree_dialog.h) georges_dirtree_dialog.h
georges_filesystem_model.h
georges_treeview_dialog.h
expandable_headerview.h)
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
georges_dirtree_form.ui) georges_dirtree_form.ui
georges_treeview_form.ui)
SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc) SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)
@ -32,7 +36,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS}) ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS})
TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES}) TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc nelgeorges ${QT_LIBRARIES})
NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor") NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor) NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor)

View file

@ -0,0 +1,143 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
// Project includes
#include "expandable_headerview.h"
// Qt includes
#include <QApplication>
#include <QMouseEvent>
#include <QPainter>
namespace Plugin
{
ExpandableHeaderView::ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent)
: QHeaderView(orientation, parent),
m_expanded(true),
m_inDecoration(false)
{
}
void ExpandableHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
{
painter->save();
QHeaderView::paintSection(painter, rect, logicalIndex);
painter->restore();
if (logicalIndex == 0)
{
QRect sectionRect = this->orientation() == Qt::Horizontal ?
QRect(this->sectionPosition(logicalIndex), 0,
this->sectionSize(logicalIndex), this->height()):
QRect(0, this->sectionPosition(logicalIndex),
this->width(), this->sectionSize(logicalIndex));
QStyleOptionHeader opt;
initStyleOption(&opt);
opt.iconAlignment = Qt::AlignVCenter;
QVariant variant = this->model()->headerData(logicalIndex, this->orientation(),
Qt::DecorationRole);
opt.icon = qvariant_cast<QIcon>(variant);
if (opt.icon.isNull())
{
opt.icon = qvariant_cast<QPixmap>(variant);
}
QRect headerLabelRect = this->style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this);
QPixmap pixmap
= opt.icon.pixmap(this->style()->pixelMetric(QStyle::PM_SmallIconSize),
(opt.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled);
QRect aligned = this->style()->alignedRect(opt.direction, QFlag(opt.iconAlignment),
pixmap.size(), headerLabelRect);
QRect inter = aligned.intersected(headerLabelRect);
QStyleOption option;
option.rect = QRect(inter.x()-2,inter.y(),inter.width(),inter.height());
if (m_expanded)
option.state = QStyle::State_Children | QStyle::State_Open;
else
option.state = QStyle::State_Children;
if (m_inDecoration)
option.state |= QStyle::State_MouseOver;
QApplication::style()->drawPrimitive(QStyle::PE_IndicatorBranch, &option, painter);
}
}
void ExpandableHeaderView::mousePressEvent(QMouseEvent *e)
{
int section = logicalIndexAt(e->x());
if (section == 0 && m_inDecoration) {
if (m_expanded)
m_expanded = false;
else
m_expanded = true;
this->QHeaderView::mousePressEvent(e);
Q_EMIT headerClicked(section);
}
}
void ExpandableHeaderView::mouseMoveEvent(QMouseEvent *e)
{
int section = this->logicalIndexAt(e->x());
if (section != 0)
return;
bool tmp = m_inDecoration;
if (isPointInDecoration(section, e->pos()))
m_inDecoration = true;
else
m_inDecoration = false;
if (m_inDecoration != tmp)
updateSection(0);
}
bool ExpandableHeaderView::isPointInDecoration(int section, QPoint pos)const
{
QRect sectionRect = this->orientation() == Qt::Horizontal ?
QRect(this->sectionPosition(section), 0,
this->sectionSize(section), this->height()):
QRect(0, this->sectionPosition(section),
this->width(), this->sectionSize(section));
QStyleOptionHeader opt;
this->initStyleOption(&opt);
opt.iconAlignment = Qt::AlignVCenter;
QVariant variant = this->model()->headerData(section, this->orientation(),
Qt::DecorationRole);
opt.icon = qvariant_cast<QIcon>(variant);
if (opt.icon.isNull())
{
opt.icon = qvariant_cast<QPixmap>(variant);
}
QRect headerLabelRect = this->style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this);
// from qcommonstyle.cpp
if (opt.icon.isNull())
{
return false;
}
QPixmap pixmap
= opt.icon.pixmap(this->style()->pixelMetric(QStyle::PM_SmallIconSize),
(opt.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled);
QRect aligned = this->style()->alignedRect(opt.direction, QFlag(opt.iconAlignment),
pixmap.size(), headerLabelRect);
QRect inter = aligned.intersected(headerLabelRect);
return inter.contains(pos);
}
}

View file

@ -0,0 +1,49 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef EXPANDABLE_HEADERVIEW_H
#define EXPANDABLE_HEADERVIEW_H
// Qt includes
#include <QHeaderView>
namespace Plugin
{
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

View file

@ -0,0 +1,278 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#include "formdelegate.h"
// NeL includes
#include <nel/misc/debug.h>
#include <nel/georges/u_type.h>
#include <nel/georges/u_form_elm.h>
// Qt includes
#include <QSpinBox>
#include <QLineEdit>
#include <QDoubleSpinBox>
#include <QColorDialog>
#include <QComboBox>
#include <QApplication>
#include <QTextDocument>
#include <QAbstractTextDocumentLayout>
#include <QPainter>
// Project includes
#include "georgesform_model.h"
#include "georgesform_proxy_model.h"
#include "formitem.h"
namespace Plugin
{
FormDelegate::FormDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{
}
QWidget *FormDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option ,
const QModelIndex &index) const
{
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
CFormItem *item = static_cast<CFormItem*>(mp->mapToSource(index).internalPointer());
QString value = item->data(1).toString();
if (value.isEmpty() || !mp || !m)
return 0;
CFormItem* curItem = m->getItem(mp->mapToSource(index));
NLGEORGES::UFormElm *curElm = curItem->getFormElm();
if (!curElm) {
// TODO: create new Element
return 0;
}
const NLGEORGES::UType *type = curElm->getType();
if(type)
{
int numDefinitions = type->getNumDefinition();
if (numDefinitions)
{
std::string l, v;
QString label,value;
QComboBox *editor = new QComboBox(parent);
for (int i = 0; i < numDefinitions; i++)
{
type->getDefinition(i,l,v);
label = l.c_str();
value = v.c_str();
editor->addItem(label);
}
return editor;
}
else
{
switch (type->getType())
{
case NLGEORGES::UType::UnsignedInt:
case NLGEORGES::UType::SignedInt:
{
QSpinBox *editor = new QSpinBox(parent);
//QString min = QString(type->getMin().c_str());
//QString max = QString(type->getMax().c_str());
//QString inc = QString(type->getIncrement().c_str());
//nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str());
// TODO: use saved min/max values
editor->setMinimum(-99999);
editor->setMaximum(99999);
editor->setSingleStep(1);
return editor;
}
case NLGEORGES::UType::Double:
{
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
//QString min = QString(type->getMin().c_str());
//QString max = QString(type->getMax().c_str());
//QString inc = QString(type->getIncrement().c_str());
//nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str());
// TODO: use saved min/max values
editor->setMinimum(-99999);
editor->setMaximum(99999);
editor->setSingleStep(0.1);
editor->setDecimals(1);
return editor;
}
case NLGEORGES::UType::Color:
{
return new QColorDialog();
}
default: // UType::String
{
QLineEdit *editor = new QLineEdit(parent);
return editor;
}
}
}
}
return 0;
}
void FormDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
int numDefinitions = type->getNumDefinition();
QString value = index.model()->data(index, Qt::DisplayRole).toString();
if (numDefinitions)
{
QComboBox *cb = static_cast<QComboBox*>(editor);
cb->setCurrentIndex(cb->findText(value));
}
else
{
switch (type->getType())
{
case NLGEORGES::UType::UnsignedInt:
case NLGEORGES::UType::SignedInt:
{
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
spinBox->setValue((int)value.toDouble());
break;
}
case NLGEORGES::UType::Double:
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->setValue(value.toDouble());
break;
}
case NLGEORGES::UType::Color:
{
break;
}
default:
{
QLineEdit *textEdit = static_cast<QLineEdit*>(editor);
textEdit->setText(value);
break;
}
}
}
}
void FormDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
int numDefinitions = type->getNumDefinition();
if (numDefinitions)
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
QString value = comboBox->currentText();
QString oldValue = index.model()->data(index, Qt::DisplayRole).toString();
if (value == oldValue)
{
// nothing's changed
}
else
{
nldebug(QString("setModelData from %1 to %2")
.arg(oldValue).arg(value).toStdString().c_str());
model->setData(index, value, Qt::EditRole);
}
}
else
{
switch (type->getType())
{
case NLGEORGES::UType::UnsignedInt:
case NLGEORGES::UType::SignedInt:
{
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
int value = spinBox->value();
QString oldValue = index.model()->data(index, Qt::DisplayRole).toString();
if (QString("%1").arg(value) == oldValue)
{
// nothing's changed
}
else
{
nldebug(QString("setModelData from %1 to %2")
.arg(oldValue).arg(value).toStdString().c_str());
model->setData(index, value, Qt::EditRole);
}
break;
}
case NLGEORGES::UType::Double:
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
double value = spinBox->value();
QString oldValue = index.model()->data(index, Qt::DisplayRole).toString();
if (QString("%1").arg(value) == oldValue)
{
// nothing's changed
}
else
{
nldebug(QString("setModelData from %1 to %2")
.arg(oldValue).arg(value).toStdString().c_str());
model->setData(index, value, Qt::EditRole);
}
break;
}
case NLGEORGES::UType::Color:
{
break; // TODO
}
default: // UType::String
{
QLineEdit *textEdit = static_cast<QLineEdit*>(editor);
QString value = textEdit->text();
QString oldValue = index.model()->data(index, Qt::DisplayRole).toString();
if (value == oldValue)
{
// nothing's changed
}
else
{
nldebug(QString("setModelData from %1 to %2")
.arg(oldValue).arg(value).toStdString().c_str());
model->setData(index, value, Qt::EditRole);
}
break;
}
}
}
}
void FormDelegate::updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QRect r = option.rect;
editor->setGeometry(r);
}
} /* namespace Plugin */

View file

@ -0,0 +1,41 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef FORMDELEGATE_H
#define FORMDELEGATE_H
#include <QStyledItemDelegate>
namespace Plugin
{
class FormDelegate : public QStyledItemDelegate
{
public:
FormDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
}
#endif // FORMDELEGATE_H

View file

@ -0,0 +1,162 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#include "formitem.h"
// Qt includes
// NeL includes
#include <nel/misc/o_xml.h>
#include <nel/georges/u_type.h>
#include <nel/georges/form.h>
namespace Plugin
{
CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList<QVariant> &data, CFormItem *parent,
NLGEORGES::UFormElm::TWhereIsValue wV, NLGEORGES::UFormElm::TWhereIsNode wN)
{
parentItem = parent;
itemData = data;
formElm = elm;
whereV = wV;
whereN = wN;
}
CFormItem::~CFormItem()
{
qDeleteAll(childItems);
}
void CFormItem::appendChild(CFormItem *item)
{
childItems.append(item);
}
CFormItem *CFormItem::child(int row)
{
return childItems.value(row);
}
int CFormItem::childCount() const
{
return childItems.count();
}
int CFormItem::columnCount() const
{
//nlinfo("columnCount %d",itemData.count());
return itemData.count();
}
QVariant CFormItem::data(int column) const
{
return itemData.value(column);
}
CFormItem *CFormItem::parent()
{
return parentItem;
}
int CFormItem::row() const
{
if (parentItem)
return parentItem->childItems.indexOf(const_cast<CFormItem*>(this));
return 0;
}
bool CFormItem::setData(int column, const QVariant &value)
{
if (column < 0 || column >= itemData.size())
return false;
// TODO: default values
if (!formElm)
return false;
itemData[column] = value;
if (formElm->isAtom())
{
const NLGEORGES::UType *type = formElm->getType();
if (type)
{
switch (type->getType())
{
case NLGEORGES::UType::UnsignedInt:
case NLGEORGES::UType::SignedInt:
case NLGEORGES::UType::Double:
case NLGEORGES::UType::String:
if (parentItem->formElm->isArray())
{
//((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName(
//if(parentItem->formElm->getArrayNode(elmName, num))
//{
//}
bool ok;
// TODO: the node can be renamed from eg "#0" to "foobar"
int arrayIndex = itemData[0].toString().remove("#").toInt(&ok);
if(ok)
{
NLGEORGES::UFormElm *elmt = 0;
if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt)
{
if (elmt->isAtom())
{
((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str());
nldebug(QString("array element string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
}
}
}
else
{
if(parentItem->formElm->setValueByName(
value.toString().toStdString().c_str(),
itemData[0].toString().toStdString().c_str()))
{
nldebug(QString("string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
else
{
nldebug(QString("FAILED string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
}
break;
case NLGEORGES::UType::Color:
nldebug("Color is TODO");
break;
default:
break;
}
}
}
else
{
nldebug("setting sth other than Atom");
}
//formElm->setValueByName();
return true;
}
}

View file

@ -0,0 +1,69 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef FORMITEM_H
#define FORMITEM_H
// NeL includes
#include <nel/georges/u_form_elm.h>
// Qt includes
#include <QList>
#include <QVariant>
namespace Plugin
{
class CFormItem
{
public:
CFormItem(NLGEORGES::UFormElm *elm, const QList<QVariant> &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<CFormItem*> childItems;
QList<QVariant> itemData;
CFormItem *parentItem;
NLGEORGES::UFormElm* formElm;
NLGEORGES::UFormElm::TWhereIsValue whereV;
NLGEORGES::UFormElm::TWhereIsNode whereN;
}; // CFormItem
}
#endif // FORMITEM_H

View file

@ -0,0 +1,64 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#include "georges.h"
#include "nel/misc/o_xml.h"
// STL includes
// NeL includes
#include <nel/georges/u_form_loader.h>
#include <nel/georges/u_form.h>
#include <nel/georges/u_type.h>
// Project includes
using namespace NLGEORGES;
namespace Plugin
{
CGeorges::CGeorges(): FormLoader(0)
{
FormLoader = UFormLoader::createLoader();
}
CGeorges::~CGeorges()
{
}
UForm *CGeorges::loadForm(std::string formName)
{
UForm *form = FormLoader->loadForm(formName.c_str());
return form;
}
UFormDfn *CGeorges::loadFormDfn(std::string formName)
{
UFormDfn *formdfn = FormLoader->loadFormDfn(formName.c_str());
return formdfn;
}
UType *CGeorges::loadFormType(std::string formName)
{
UType *type = FormLoader->loadFormType(formName.c_str());
return type;
}
} /* namespace Plugin */

View file

@ -0,0 +1,69 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef GEORGES_H
#define GEORGES_H
// Misc
// STL includes
#include <string>
// NeL includes
// Qt includes
// Project includes
namespace NLGEORGES
{
class UType;
class UForm;
class UFormDfn;
class UFormLoader;
}
using namespace NLGEORGES;
namespace Plugin
{
/**
@class CGeorges
A CGeorges class loading and viewing sheets.
*/
class CGeorges
{
public:
/// Default constructor.
CGeorges();
virtual ~CGeorges();
// Load the given form root
UForm* loadForm(std::string formName);
// Load a dfn
UFormDfn* loadFormDfn(std::string formName);
// Load a type
UType *loadFormType (std::string formName);
// A form loader
UFormLoader *FormLoader;
};/* class CGeorges */
} /* namespace Plugin */
#endif // GEORGES_H

View file

@ -23,20 +23,30 @@
// NeL includes // NeL includes
//using namespace NLMISC;
namespace Plugin namespace Plugin
{ {
CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent) CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent)
:QDockWidget(parent), m_ldPath(ldPath) :QDockWidget(parent),
m_ldPath(ldPath)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
m_ui.filterResetButton->setIcon(
QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
m_dirModel = new CGeorgesFileSystemModel(m_ldPath); m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
//m_proxyModel = new CGeorgesFileSystemProxyModel(this);
//m_proxyModel->setSourceModel(m_dirModel);
m_ui.dirTree->setModel(m_dirModel); m_ui.dirTree->setModel(m_dirModel);
// TODO: filtering in tree model is ... complicated - so hide it for now
m_ui.filterLineEdit->hide();
m_ui.filterResetButton->hide();
m_ui.label->hide();
if (m_dirModel->isCorrectLDPath()) if (m_dirModel->isCorrectLDPath())
{ {
m_dirModel->setRootPath(m_ldPath); m_dirModel->setRootPath(m_ldPath);
@ -61,7 +71,6 @@ CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog()
void CGeorgesDirTreeDialog::fileSelected(QModelIndex index) void CGeorgesDirTreeDialog::fileSelected(QModelIndex index)
{ {
QString name;
if (index.isValid() && !m_dirModel->isDir(index)) if (index.isValid() && !m_dirModel->isDir(index))
{ {
Q_EMIT selectedForm(m_dirModel->fileName(index)); Q_EMIT selectedForm(m_dirModel->fileName(index));
@ -81,8 +90,12 @@ void CGeorgesDirTreeDialog::ldPathChanged(QString path)
m_ldPath = path; m_ldPath = path;
delete m_dirModel; delete m_dirModel;
//delete m_proxyModel;
m_dirModel = new CGeorgesFileSystemModel(m_ldPath); m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
//m_proxyModel = new CGeorgesFileSystemProxyModel(this);
//m_proxyModel->setSourceModel(m_dirModel);
m_ui.dirTree->setModel(m_dirModel); m_ui.dirTree->setModel(m_dirModel);
if (m_dirModel->isCorrectLDPath()) if (m_dirModel->isCorrectLDPath())

View file

@ -45,6 +45,7 @@ private:
Ui::CGeorgesDirTreeDialog m_ui; Ui::CGeorgesDirTreeDialog m_ui;
CGeorgesFileSystemModel *m_dirModel; CGeorgesFileSystemModel *m_dirModel;
//CGeorgesFileSystemProxyModel *m_proxyModel;
QString m_ldPath; QString m_ldPath;
Q_SIGNALS: Q_SIGNALS:
@ -54,7 +55,6 @@ private Q_SLOTS:
void fileSelected(QModelIndex index); void fileSelected(QModelIndex index);
void changeFile(QString file); void changeFile(QString file);
friend class CMainWindow;
}; /* CGEorgesDirTreeDialog */ }; /* CGEorgesDirTreeDialog */
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -19,7 +19,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
<height>111</height> <height>141</height>
</size> </size>
</property> </property>
<property name="features"> <property name="features">
@ -36,7 +36,7 @@
</size> </size>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="1" column="0" colspan="3">
<widget class="QTreeView" name="dirTree"> <widget class="QTreeView" name="dirTree">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -46,9 +46,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="filterLineEdit"/>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="filterResetButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="georges_editor.qrc">
<normaloff>:/images/ic_nel_georges_editor.png</normaloff>:/images/ic_nel_georges_editor.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
<resources/> <resources>
<include location="../../object_viewer_qt.qrc"/>
<include location="../core/core.qrc"/>
<include location="georges_editor.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -18,6 +18,7 @@
#include "georges_editor_form.h" #include "georges_editor_form.h"
#include "georges_editor_constants.h" #include "georges_editor_constants.h"
#include "georges_dirtree_dialog.h" #include "georges_dirtree_dialog.h"
#include "georges_treeview_dialog.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/imenu_manager.h"
@ -30,110 +31,257 @@
#include <QSettings> #include <QSettings>
#include <QFileDialog> #include <QFileDialog>
#include <QToolBar> #include <QToolBar>
#include <QDebug>
namespace Plugin namespace Plugin
{ {
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
: QMainWindow(parent), : QMainWindow(parent),
m_georgesDirTreeDialog(0) m_georgesDirTreeDialog(0),
{ m_mainDock(0),
m_ui.setupUi(this); m_lastActiveDock(0)
m_undoStack = new QUndoStack(this);
_openAction = new QAction(tr("&Open..."), this);
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
_openAction->setShortcut(QKeySequence::Open);
_openAction->setStatusTip(tr("Open an existing file"));
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
_newAction = new QAction(tr("&New..."), this);
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
_newAction->setShortcut(QKeySequence::New);
_newAction->setStatusTip(tr("Create a new file"));
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
_saveAction = new QAction(tr("&Save..."), this);
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
_saveAction->setShortcut(QKeySequence::Save);
_saveAction->setStatusTip(tr("Save the current file"));
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
_fileToolBar = addToolBar(tr("&File"));
_fileToolBar->addAction(_openAction);
_fileToolBar->addAction(_newAction);
_fileToolBar->addAction(_saveAction);
readSettings();
// create leveldesign directory tree dockwidget
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
//m_georgesDirTreeDialog->setVisible(false);
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
this, SLOT(settingsChanged()));
}
GeorgesEditorForm::~GeorgesEditorForm()
{
writeSettings();
}
QUndoStack *GeorgesEditorForm::undoStack() const
{
return m_undoStack;
}
void GeorgesEditorForm::open()
{
// TODO: FileDialog & loadFile();
//QString fileName = QFileDialog::getOpenFileName();
//loadFile(fileName);
}
void GeorgesEditorForm::newFile()
{
}
void GeorgesEditorForm::save()
{
}
void GeorgesEditorForm::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->sync();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString oldLDPath = m_leveldesignPath;
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
if (oldLDPath != m_leveldesignPath)
{ {
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath); m_ui.setupUi(this);
}
}
// background for the mainwindow
QString css = "QWidget#centralwidget {";
css += "image: url(:/images/ic_nel_georges_editor.png);";
css += "}";
// add new mainwindow for sheet dockwidgets
QWidget *widget = new QWidget(this);
widget->setObjectName("centralwidget");
widget->setStyleSheet(css);
setCentralWidget(widget);
QGridLayout *layout = new QGridLayout(widget);
layout->setContentsMargins(0,0,0,0);
widget->setLayout(layout);
m_mainDock = new QMainWindow(this);
m_mainDock->setDockNestingEnabled(true);
layout->addWidget(m_mainDock);
m_undoStack = new QUndoStack(this);
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
m_openAction = menuManager->action(Core::Constants::OPEN);
m_newAction = new QAction(tr("&New..."), this);
m_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
m_newAction->setShortcut(QKeySequence::New);
m_newAction->setStatusTip(tr("Create a new file"));
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
m_saveAction = new QAction(tr("&Save..."), this);
m_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
m_saveAction->setShortcut(QKeySequence::Save);
m_saveAction->setStatusTip(tr("Save the current file"));
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
m_fileToolBar = addToolBar(tr("&File"));
m_fileToolBar->addAction(m_openAction);
m_fileToolBar->addAction(m_newAction);
m_fileToolBar->addAction(m_saveAction);
m_saveAction->setEnabled(false);
readSettings();
// create leveldesign directory tree dockwidget
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
restoreDockWidget(m_georgesDirTreeDialog);
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
this, SLOT(settingsChanged()));
connect(m_georgesDirTreeDialog, SIGNAL(selectedForm(const QString)),
this, SLOT(loadFile(const QString)));
connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
this, SLOT(focusChanged(QWidget*, QWidget*)));
}
GeorgesEditorForm::~GeorgesEditorForm()
{
writeSettings();
}
QUndoStack *GeorgesEditorForm::undoStack() const
{
return m_undoStack;
}
void GeorgesEditorForm::open()
{
/*qDebug() << "GeorgesEditorForm::open()";
if (!m_dockedWidgets.size())
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
}
else
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
Q_ASSERT(m_dockedWidgets.size() > 1);
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}*/
// TODO: FileDialog & loadFile();
//m_mainDock->addDockWidget(Qt::TopDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true));
//m_mainDock->addDockWidget(Qt::LeftDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true));
//QString fileName = QFileDialog::getOpenFileName();
//loadFile(fileName);
}
void GeorgesEditorForm::newFile()
{
}
void GeorgesEditorForm::save()
{
}
void GeorgesEditorForm::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
restoreGeometry(settings->value("geometry").toByteArray());
restoreState(settings->value("windowState").toByteArray());
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->setValue("geometry", saveGeometry());
settings->setValue("windowState", saveState());
settings->endGroup();
settings->sync();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString oldLDPath = m_leveldesignPath;
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
if (oldLDPath != m_leveldesignPath)
{
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath);
}
}
void GeorgesEditorForm::loadFile(const QString fileName)
{
QFileInfo info(fileName);
if (!m_dockedWidgets.size())
{
CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
m_lastActiveDock = dock;
m_dockedWidgets.append(dock);
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
connect(m_dockedWidgets.last(), SIGNAL(closing()),
this, SLOT(closingTreeView()));
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)),
m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
}
else
{
Q_FOREACH(CGeorgesTreeViewDialog *wgt, m_dockedWidgets)
{
if (info.fileName() == wgt->loadedForm)
{
wgt->raise();
return;
}
}
CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
m_dockedWidgets.append(dock);
connect(m_dockedWidgets.last(), SIGNAL(closing()),
this, SLOT(closingTreeView()));
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)),
m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
Q_ASSERT(m_dockedWidgets.size() > 1);
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}
CForm *form = m_dockedWidgets.last()->getFormByName(info.fileName());
if (form)
{
m_dockedWidgets.last()->setForm(form);
m_dockedWidgets.last()->loadFormIntoDialog(form);
QApplication::processEvents();
connect(m_dockedWidgets.last(), SIGNAL(modified()),
this, SLOT(setModified()));
m_dockedWidgets.last()->raise();
connect(m_dockedWidgets.last(), SIGNAL(changeFile(QString)),
m_georgesDirTreeDialog, SLOT(changeFile(QString)));
}
else
{
m_dockedWidgets.last()->close();
}
}
void GeorgesEditorForm::closingTreeView()
{
//qDebug() << "closingTreeView";
m_dockedWidgets.removeAll(qobject_cast<CGeorgesTreeViewDialog*>(sender()));
if (qobject_cast<CGeorgesTreeViewDialog*>(sender()) == m_lastActiveDock)
m_lastActiveDock = 0;
}
void GeorgesEditorForm::setModified ()
{
qDebug() << "setModified";
if (m_lastActiveDock)
m_saveAction->setEnabled(m_lastActiveDock->isModified());
else
m_saveAction->setEnabled(false);
}
void GeorgesEditorForm::focusChanged ( QWidget * old, QWidget * now )
{
if (now)
{
// ugly, UGLY hack for compensating QDockWidgets failure in focus API
if (now->objectName() == "treeView" ||
now->objectName() == "checkBoxDefaults" ||
now->objectName() == "checkBoxParent" ||
now->objectName() == "commentEdit")
{
QWidget *dlg = 0;
QApplication::focusWidget()?
QApplication::focusWidget()->parentWidget()?
QApplication::focusWidget()->parentWidget()->parentWidget()?
QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()?
QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()?
QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()?
dlg=QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget():dlg=0:dlg=0:dlg=0:dlg=0:dlg=0:dlg=0;
CGeorgesTreeViewDialog *active = qobject_cast<CGeorgesTreeViewDialog*>(dlg);
if(active)
{
//qDebug() << "focusChanged" << active->loadedForm;
m_lastActiveDock = active;
m_saveAction->setEnabled(active->isModified());
}
}
}
}
} /* namespace Plugin */ } /* namespace Plugin */

View file

@ -27,6 +27,7 @@ namespace Plugin
{ {
class CGeorgesDirTreeDialog; class CGeorgesDirTreeDialog;
class CGeorgesTreeViewDialog;
class GeorgesEditorForm: public QMainWindow class GeorgesEditorForm: public QMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -39,9 +40,14 @@ public:
public Q_SLOTS: public Q_SLOTS:
void open(); void open();
void loadFile(const QString fileName);
void newFile(); void newFile();
void save(); void save();
void settingsChanged(); void settingsChanged();
void closingTreeView();
void setModified();
void focusChanged(QWidget *old, QWidget *now);
private: private:
void readSettings(); void readSettings();
@ -51,12 +57,17 @@ private:
Ui::GeorgesEditorForm m_ui; Ui::GeorgesEditorForm m_ui;
CGeorgesDirTreeDialog *m_georgesDirTreeDialog; CGeorgesDirTreeDialog *m_georgesDirTreeDialog;
QToolBar *_fileToolBar; QToolBar *m_fileToolBar;
QAction *_openAction; QAction *m_openAction;
QAction *_newAction; QAction *m_newAction;
QAction *_saveAction; QAction *m_saveAction;
QString m_leveldesignPath; QString m_leveldesignPath;
QMainWindow *m_mainDock;
QList<CGeorgesTreeViewDialog*> m_dockedWidgets;
CGeorgesTreeViewDialog *m_lastActiveDock;
}; /* class GeorgesEditorForm */ }; /* class GeorgesEditorForm */
} /* namespace Plugin */ } /* namespace Plugin */

View file

@ -13,12 +13,16 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Georges Editor</string> <string>Georges Editor</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QWidget#centralwidget { <string notr="true">QWidget#centralwidget {
image: url(:/images/ic_nel_georges_editor.png); image: url(:/images/ic_nel_georges_editor.png);
}</string> }</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"/>
</widget> </widget>
</widget> </widget>
<resources> <resources>

View file

@ -74,7 +74,7 @@ QString GeorgesEditorPlugin::name() const
QString GeorgesEditorPlugin::version() const QString GeorgesEditorPlugin::version() const
{ {
return "0.2"; return "0.4";
} }
QString GeorgesEditorPlugin::vendor() const QString GeorgesEditorPlugin::vendor() const
@ -90,8 +90,9 @@ QString GeorgesEditorPlugin::description() const
QStringList GeorgesEditorPlugin::dependencies() const QStringList GeorgesEditorPlugin::dependencies() const
{ {
QStringList list; QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN); // TODO
list.append("ObjectViewer"); // TODO //list.append(Core::Constants::OVQT_CORE_PLUGIN);
//list.append("ObjectViewer");
return list; return list;
} }

View file

@ -28,6 +28,10 @@ CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent
m_correct(false) m_correct(false)
{ {
checkLDPath(); checkLDPath();
// this yielded no relevant performance boost on my observations
//connect(this, SIGNAL(directoryLoaded(QString)),
// this, SLOT(dir(const QString)));
} }
CGeorgesFileSystemModel::~CGeorgesFileSystemModel() CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
@ -35,6 +39,23 @@ CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
} }
void CGeorgesFileSystemModel::dir(const QString &dir)
{
// in theory this should prefetch all directory entries for the
// filesystem model to speed up later work
QModelIndex i = index(dir);
if (hasChildren(i)) {
int childCount = rowCount(i);
for (int c=0; c<childCount; c++) {
const QModelIndex child = index(c, 0, i);
if (child.isValid()) {
fetchMore(child);
}
}
}
}
QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const
{ {
@ -90,6 +111,54 @@ void CGeorgesFileSystemModel::checkLDPath()
m_correct = false; m_correct = false;
} }
} }
//
//bool CGeorgesFileSystemModel::canFetchMore(const QModelIndex &parent) const
//{
// return true;
//
// /* Q_D(const QFileSystemModel);
// const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent);
// return (!indexNode->populatedChildren);*/
//}
//CGeorgesFileSystemProxyModel::CGeorgesFileSystemProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
//{
// setFilterCaseSensitivity(Qt::CaseInsensitive);
//}
//bool CGeorgesFileSystemProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
//{
// TODO this is not perfect as it could be
// eg it should filter all dirs which have no entry
//QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
//if (sourceModel()->hasChildren(idx))
//{
// QString d = sourceModel()->data(idx).toString();
// //QModelIndex i = mapFromSource(source_parent);
// //if (hasChildren(i)) {
// int childCount = sourceModel()->rowCount(idx);
// for (int c=0; c<childCount; c++) {
// /*const QModelIndex child = sourceModel()->index(c, 0, idx);
// if (child.isValid()) {
// bool test = filterAcceptsRow(c, child);
// }*/
// }
// return true;
//}
//return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
//}
//QVariant CGeorgesFileSystemProxyModel::data ( const QModelIndex & index, int role ) const
//{
// if (role == Qt::DisplayRole)
// {
// QString test = QSortFilterProxyModel::data(index, role).toString();
// return test.append(QString(" (%1/%2)")).
// arg(rowCount(index)).
// arg(sourceModel()->rowCount(mapToSource(index)));
// }
// return QSortFilterProxyModel::data(index, role);
//}
} /* namespace NLQT */ } /* namespace NLQT */
/* end of file */ /* end of file */

View file

@ -18,32 +18,61 @@
#define GEORGES_FILESYSTEM_MODEL_H #define GEORGES_FILESYSTEM_MODEL_H
#include <QtGui/QFileSystemModel> #include <QtGui/QFileSystemModel>
#include <QSortFilterProxyModel>
namespace Plugin namespace Plugin
{ {
class CGeorgesFileSystemModel : public QFileSystemModel class CGeorgesFileSystemModel : public QFileSystemModel
{
QString m_ldPath;
public:
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
~CGeorgesFileSystemModel();
int columnCount(const QModelIndex &/*parent*/) const;
int rowCount(const QModelIndex &/*parent*/) const;
QVariant data(const QModelIndex& index, int role) const ;
bool isCorrectLDPath()
{ {
return m_correct; Q_OBJECT
}
void checkLDPath();
private: public:
bool m_correct; CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
};/* class CGeorgesFileSystemModel */ ~CGeorgesFileSystemModel();
int columnCount(const QModelIndex &/*parent*/) const;
int rowCount(const QModelIndex &/*parent*/) const;
QVariant data(const QModelIndex& index, int role) const ;
bool isCorrectLDPath()
{
return m_correct;
}
bool isInitialized()
{
return m_initialized;
}
void setInitialized( bool init)
{
m_initialized = init;
}
void checkLDPath();
private:
bool m_correct;
bool m_initialized;
QString m_ldPath;
private Q_SLOTS:
void dir(const QString&);
};/* class CGeorgesFileSystemModel */
// A modified QSortFilterProxyModel that always accepts the root nodes in the tree
// so filtering is only done on the children.
//class CGeorgesFileSystemProxyModel : public QSortFilterProxyModel
//{
// Q_OBJECT
//public:
// CGeorgesFileSystemProxyModel(QObject *parent = 0);
//QVariant data(const QModelIndex& index, int role) const ;
//protected:
// bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
//};
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -0,0 +1,388 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#include "georges_treeview_dialog.h"
// Qt includes
#include <QtGui/QWidget>
#include <QSettings>
#include <QFileDialog>
#include <QDebug>
// NeL includes
#include <nel/misc/path.h>
#include <nel/misc/file.h>
#include <nel/misc/o_xml.h>
#include <nel/georges/form.h>
// Project includes
#include "georges.h"
#include "georgesform_model.h"
#include "georgesform_proxy_model.h"
#include "formitem.h"
#include "formdelegate.h"
#include "expandable_headerview.h"
using namespace NLMISC;
using namespace NLGEORGES;
namespace Plugin
{
CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/)
: QDockWidget(parent),
m_header(0),
m_modified(false)
{
m_georges = new CGeorges;
loadedForm = "";
m_ui.setupUi(this);
m_header = new ExpandableHeaderView(Qt::Horizontal, m_ui.treeView);
m_ui.treeView->setHeader(m_header);
m_ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents);
m_ui.treeView->header()->setStretchLastSection(true);
m_ui.treeViewTabWidget->setTabEnabled (2,false);
m_ui.checkBoxParent->setStyleSheet("background-color: rgba(0,255,0,30)");
m_ui.checkBoxDefaults->setStyleSheet("background-color: rgba(255,0,0,30)");
m_form = 0;
FormDelegate *formdelegate = new FormDelegate(this);
m_ui.treeView->setItemDelegateForColumn(1, formdelegate);
connect(m_ui.treeView, SIGNAL(doubleClicked (QModelIndex)),
this, SLOT(doubleClicked (QModelIndex)));
connect(m_ui.checkBoxParent, SIGNAL(toggled(bool)),
this, SLOT(filterRows()));
connect(m_ui.checkBoxDefaults, SIGNAL(toggled(bool)),
this, SLOT(filterRows()));
connect(m_header, SIGNAL(headerClicked(int)),
this, SLOT(headerClicked(int)));
}
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
{
delete m_form;
qDebug() << "DTOR";
}
void CGeorgesTreeViewDialog::headerClicked(int section)
{
if (section == 0)
if (*(m_header->expanded()))
m_ui.treeView->expandAll();
else
m_ui.treeView->collapseAll();
}
void CGeorgesTreeViewDialog::setForm(const CForm *form)
{
m_form = (UForm*)form;
}
CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName)
{
if(NLMISC::CPath::exists(formName.toStdString()))
{
return (CForm*)m_georges->loadForm(formName.toStdString());
}
//else
//{
// CForm *form = 0;
// // Load the DFN
// std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() );
// QString dfnName = QString("%1.dfn").arg(extStr.c_str());
// UFormDfn *formdfn;
// if (NLMISC::CPath::exists(dfnName.toStdString()))
// {
// formdfn = _georges->loadFormDfn (dfnName.toStdString());
// if (!formdfn)
// {
// nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str());
// return 0;
// }
// }
// else
// {
// nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str());
// return 0;
// }
// form = new CForm;
// // Build the root element
// ((CFormElmStruct*)&form->getRootNode())->build((CFormDfn*)formdfn);
// uint i;
// for (i=0; i<CForm::HeldElementCount; i++)
// {
// ((CFormElmStruct*)(((CForm*)form)->HeldElements[i]))->build ((CFormDfn*)formdfn);
// }
// return form;
//}
return 0;
}
void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form)
{
if(form)
m_form = form;
else
return;
UFormElm *root = 0;
root = &m_form->getRootNode();
QStringList parents;
for (uint i = 0; i < m_form->getNumParent(); i++)
{
UForm *u = m_form->getParentForm(i);
parents << u->getFilename().c_str();
}
QString comments;
comments = m_form->getComment().c_str();
if (!comments.isEmpty())
{
m_ui.treeViewTabWidget->setTabEnabled (1,true);
m_ui.commentEdit->setPlainText(comments);
}
QStringList strList;
std::set<std::string> dependencies;
m_form->getDependencies(dependencies);
QMap< QString, QStringList> deps;
Q_FOREACH(std::string str, dependencies)
{
QString file = str.c_str();
if (str == m_form->getFilename()) continue;
deps[file.remove(0,file.indexOf(".")+1)] << str.c_str();
}
nlinfo("typ's %d",deps["typ"].count());
nlinfo("dfn's %d",deps["dfn"].count());
//nlwarning(strList.join(";").toStdString().c_str());
if (root)
{
loadedForm = m_form->getFilename().c_str();
CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents,m_header->expanded());
CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel();
proxyModel->setSourceModel(model);
m_ui.treeView->setModel(proxyModel);
m_ui.treeView->expandAll();
// this is a debug output row
m_ui.treeView->hideColumn(3);
filterRows();
// //_ui.treeView->setRowHidden(0,QModelIndex(),true);
connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
this, SLOT(modifiedFile()));
setWindowTitle(loadedForm);
// //Modules::mainWin().getTabBar();
}
}
void CGeorgesTreeViewDialog::addParentForm(CForm *form)
{
//((CForm*)_form)->insertParent(((CForm*)_form)->getParentCount(), form->getFilename().c_str(), form);
}
void CGeorgesTreeViewDialog::modifiedFile( )
{
if (!m_modified)
{
m_modified = true;
setWindowTitle(windowTitle() + "*");
}
Q_EMIT modified();
}
void CGeorgesTreeViewDialog::write( )
{
//COFile file;
//std::string s = CPath::lookup(loadedForm.toStdString(), false);
//if (file.open (s))
//{
// try
// {
// if (loadedForm.contains(".typ"))
// {
// //nlassert (Type != NULL);
// //// Write the file
// //// Modified ?
// //if (IsModified ())
// //{
// // Type->Header.MinorVersion++;
// // flushValueChange ();
// //}
// //Type->write (xmlStream.getDocument (), theApp.Georges4CVS);
// //modify (NULL, NULL, false);
// //flushValueChange ();
// //UpdateAllViews (NULL);
// //return TRUE;
// }
// else if (loadedForm.contains(".dfn"))
// {
// //nlassert (Dfn != NULL);
// //// Write the file
// //if (IsModified ())
// //{
// // Dfn->Header.MinorVersion++;
// // flushValueChange ();
// //}
// //Dfn->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
// //modify (NULL, NULL, false);
// //UpdateAllViews (NULL);
// //return TRUE;
// }
// else
// {
// nlassert (_form != NULL);
// // Write the file
// /*if (IsModified ())
// {
// ((CForm*)(UForm*)Form)->Header.MinorVersion++;
// }*/
// //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
// _form->write(file, false);
// setWindowTitle(windowTitle().remove("*"));
// _modified = false;
// //if (strcmp (xmlStream.getErrorString (), "") != 0)
// //{
// // char message[512];
// // smprintf (message, 512, "Error while saving file: %s", xmlStream.getErrorString ());
// //theApp.outputError (message);
// //}
// //modify (NULL, NULL, false);
// //flushValueChange ();
// //UpdateAllViews (NULL);
// // Get the left view
// //CView* pView = getLeftView ();
// }
// }
// catch (Exception &e)
// {
// nlerror("Error while loading file: %s", e.what());
// }
//}
//else
//{ //if (!file.open())
// nlerror("Can't open the file %s for writing.", s.c_str());
//}
}
void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index )
{
// TODO: this is messy :( perhaps this can be done better
CGeorgesFormProxyModel * proxyModel =
dynamic_cast<CGeorgesFormProxyModel *>(m_ui.treeView->model());
CGeorgesFormModel *model =
dynamic_cast<CGeorgesFormModel *>(proxyModel->sourceModel());
QModelIndex sourceIndex = proxyModel->mapToSource(index);
CFormItem *item = model->getItem(sourceIndex);
if (item->parent() && item->parent()->data(0) == "parents")
{
Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toStdString(),false).c_str());
}
//// col containing additional stuff like icons
//if (index.column() == 2)
//{
// QModelIndex in2 = m->index(in.row(),in.column()-1,in.parent());
// CFormItem *item = m->getItem(in2);
// QString value = item->data(1).toString();
// QString path = CPath::lookup(value.toStdString(),false).c_str();
// if(value.contains(".tga") || value.contains(".png"))
// {
// QString file = QFileDialog::getOpenFileName(
// this,
// "Select a new image",
// path,
// "Images (*.png *.tga)"
// );
// if (file.isNull())
// return;
// QFileInfo info = QFileInfo(file);
// // TODO?
// // right way would be another delegate but im too lazy :)
// // so for now i just call it directly
// m->setData(in2, info.fileName());
// return;
// }
// else
// {
// if (path.contains(".shape") || path.contains(".ps"))
// {
// if (Modules::objViewInt())
// {
// Modules::objViewInt()->resetScene();
// //Modules::config().configRemapExtensions();
// Modules::objViewInt()->loadMesh(path.toStdString(),"");
// }
// return;
// }
// }
// // open eg parent files
// if (!path.isEmpty())
// Q_EMIT changeFile(path);
//}
}
void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event)
{
Q_EMIT closing();
deleteLater();
}
void CGeorgesTreeViewDialog::checkVisibility(bool visible) {
// this prevents invisible docks from getting tab focus
qDebug() << "checkVisibility" << visible;
setEnabled(visible);
//if (visible)
Q_EMIT modified();
}
void CGeorgesTreeViewDialog::filterRows()
{
CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(m_ui.treeView->model());
CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
if (m) {
m->setShowParents(m_ui.checkBoxParent->isChecked());
m->setShowDefaults(m_ui.checkBoxDefaults->isChecked());
}
}
} /* namespace NLQT */

View file

@ -0,0 +1,96 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef GEORGES_TREEVIEWER_DIALOG_H
#define GEORGES_TREEVIEWER_DIALOG_H
#include "ui_georges_treeview_form.h"
#include "expandable_headerview.h"
// Qt includes
#include <QtGui/QDockWidget>
// STL includes
// NeL includes
// Project includes
namespace NLGEORGES
{
class UForm;
class CForm;
}
using namespace NLGEORGES;
namespace Plugin
{
class CGeorges;
class CGeorgesTreeViewDialog: public QDockWidget
{
Q_OBJECT
public:
CGeorgesTreeViewDialog(QWidget *parent = 0);
~CGeorgesTreeViewDialog();
bool isModified() {return m_modified;}
void setModified(bool m) {m_modified = m;}
CForm* getFormByName(const QString);
void addParentForm(CForm *form);
void write ( );
QTabWidget* tabWidget() { return m_ui.treeViewTabWidget; }
QString loadedForm;
protected:
void closeEvent(QCloseEvent *event);
Q_SIGNALS:
void changeFile(QString);
void modified();
void closing();
public Q_SLOTS:
void setForm(const CForm*);
void loadFormIntoDialog(CForm *form = 0);
void modifiedFile( );
void checkVisibility(bool);
private Q_SLOTS:
void doubleClicked ( const QModelIndex & index );
void filterRows();
void headerClicked(int);
private:
Ui::CGeorgesTreeViewDialog m_ui;
ExpandableHeaderView *m_header;
UForm *m_form;
CGeorges *m_georges;
bool m_modified;
}; /* CGeorgesTreeViewDialog */
} /* namespace NLQT */
#endif // GEORGES_TREEVIEWER_DIALOG_H

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CGeorgesTreeViewDialog</class>
<widget class="QDockWidget" name="CGeorgesTreeViewDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>199</width>
<height>165</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="windowTitle">
<string/>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="treeViewTabWidget">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="form_tab">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<attribute name="title">
<string>Form</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="QTreeView" name="treeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxParent">
<property name="text">
<string>Parent</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxDefaults">
<property name="text">
<string>Defaults</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="comment_tab">
<attribute name="title">
<string>Comment</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="commentEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="log_tab">
<attribute name="title">
<string>Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="logEdit"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="georges_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,674 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#include "georgesform_model.h"
// NeL includes
#include <nel/misc/types_nl.h>
#include <nel/misc/rgba.h>
#include <nel/misc/path.h>
#include <nel/georges/u_form_elm.h>
#include <nel/georges/u_type.h>
#include <nel/georges/u_form_dfn.h>
// Qt includes
#include <QColor>
#include <QBrush>
#include <QApplication>
#include <QStyle>
#include <QDebug>
#include <QStylePainter>
#include <QStyleOption>
#include <QLabel>
#include <QPixmap>
// project includes
#include "formitem.h"
using namespace NLGEORGES;
namespace Plugin
{
CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps,
QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent)
{
QList<QVariant> rootData;
rootData << "Value" << "Data" << "Extra";// << "Type";
m_rootElm = rootElm;
m_rootItem = new CFormItem(m_rootElm, rootData);
m_dependencies = deps;
m_comments = comment;
m_parents = parents;
m_parentRows = new QList<const QModelIndex*>;
m_expanded = expanded;
setupModelData();
}
CGeorgesFormModel::~CGeorgesFormModel()
{
delete m_rootItem;
}
/******************************************************************************/
QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const
{
if (!p_index.isValid())
return QVariant();
switch (p_role)
{
case Qt::DisplayRole:
{
return getItem(p_index)->data(p_index.column());
}
case Qt::BackgroundRole:
{
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
QBrush parentBrush = QBrush(QColor(0,255,0,30));
// if elm not existing it must be some kind of default or type value
if(!getItem(p_index)->getFormElm())
{
return defaultBrush;
}
// else it might be some parent elm
switch (getItem(p_index)->nodeFrom())
{
case NLGEORGES::UFormElm::NodeParentForm:
{
return parentBrush;
}
case NLGEORGES::UFormElm::NodeForm:
{
switch (getItem(p_index)->valueFrom())
{
case NLGEORGES::UFormElm::ValueParentForm:
{
return parentBrush;
}
default:
{
// parent status test kindof ugly, testing only 2 steps deep
// only needed for colorization as treeview default hides childs
// when parent is hidden
CFormItem *parent = getItem(p_index)->parent();
if (parent)
{
if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
}
CFormItem *parentParent = parent->parent();
if (parentParent)
{
if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
}
} // endif parentParent
} // endif parent
} // end default
} // end switch valueFrom
} // end case nodeForm
} // end switch nodeFrom
return QVariant();
}
case Qt::DecorationRole:
{
if (p_index.column() == 2)
{
//p_index.
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
CFormItem *item = getItem(in);
QString value = item->data(1).toString();
//QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
/*if (value.contains(".shape"))
{
if (Modules::objViewInt())
{
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
if (icon)
{
if(icon->isNull())
return QIcon(":/images/pqrticles.png");
else
return QIcon(*icon);
}
else
{
return QIcon();
}
}
}*/
if(value.contains(".tga") || value.contains(".png"))
{
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
if(path.isEmpty())
{
path = ":/images/pqrticles.png";
}
return QIcon(path);
}
}
return QVariant();
break;
}
case Qt::ToolTipRole:
{
if (p_index.column() == 2)
{
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
CFormItem *item = getItem(in);
QString value = item->data(1).toString();
/*if (value.contains(".shape"))
{
if (Modules::objViewInt())
{
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
if (icon)
{
if(icon->isNull())
return QIcon(":/images/pqrticles.png");
else
return QIcon(*icon);
}
else
{
return QIcon();
}
}
}*/
if(value.contains(".tga") || value.contains(".png"))
{
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
if(path.isEmpty())
{
path = ":/images/pqrticles.png";
}
QString imageTooltip = QString("<img src='%1'>").arg(path);
return imageTooltip;
}
}
return QVariant();
break;
}
default:
return QVariant();
}
}
/******************************************************************************/
CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const
{
if (index.isValid())
{
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
if (item)
return item;
}
return m_rootItem;
}
/******************************************************************************/
bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value,
int role)
{
if (role != Qt::EditRole)
return false;
CFormItem *item = getItem(index);
bool result = item->setData(index.column(), value);
Q_EMIT dataChanged(index, index);
//setupModelData();
return result;
}
/******************************************************************************/
Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const {
if (!index.isValid())
return 0;
Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
if(index.column() == 1)
returnValue |= Qt::ItemIsEditable;
return returnValue;
}
/******************************************************************************/
QVariant CGeorgesFormModel::headerData(int section,
Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal)
{
if (role == Qt::DisplayRole)
return m_rootItem->data(section);
if (role == Qt::TextAlignmentRole)
return Qt::AlignLeft;
if (section == 0 && role == Qt::DecorationRole)
{
// transparent pixmap as we paint it ourself with tree brach
// if we extend the HeaderView::paintSection for the CE_HeaderLabel
// we could drop this
QPixmap pixmap = QPixmap(
QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize),
QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize));
// Create new picture for transparent
QPixmap transparent(pixmap.size());
// Do transparency
transparent.fill(Qt::transparent);
QPainter p(&transparent);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.drawPixmap(0, 0, pixmap);
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
// Set transparency level to 150 (possible values are 0-255)
// The alpha channel of a color specifies the transparency effect,
// 0 represents a fully transparent color, while 255 represents
// a fully opaque color.
p.fillRect(transparent.rect(), QColor(0, 0, 0, 0));
p.end();
// Set original picture's reference to new transparent one
pixmap = transparent;
return pixmap;
}
}
return QVariant();
}
/******************************************************************************/
QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent)
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
CFormItem *parentItem;
if (!parent.isValid())
parentItem = m_rootItem;
else
parentItem = static_cast<CFormItem*>(parent.internalPointer());
CFormItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
/******************************************************************************/
QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
CFormItem *childItem = static_cast<CFormItem*>(index.internalPointer());
CFormItem *parentItem = childItem->parent();
if (parentItem == m_rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
/******************************************************************************/
int CGeorgesFormModel::rowCount(const QModelIndex &parent) const {
CFormItem *parentItem;
if (parent.column() > 0)
return 0;
if (!parent.isValid())
parentItem = m_rootItem;
else
parentItem = static_cast<CFormItem*>(parent.internalPointer());
return parentItem->childCount();
}
/******************************************************************************/
int CGeorgesFormModel::columnCount(const QModelIndex &parent) const {
if (parent.isValid())
return static_cast<CFormItem*>(parent.internalPointer())->columnCount();
else
return m_rootItem->columnCount();
}
/******************************************************************************/
void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) {
if (!root)
return;
uint num = 0;
if (root->isStruct())
{
//((CFormElm*)root)->getForm()->getComment();
uint structSize = 0;
root->getStructSize(structSize);
while (num < structSize)
{
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
// Append a new item to the current parent's list of children.
std::string elmName;
if(root->getStructNodeName(num, elmName))
{
QList<QVariant> columnData;
//QVariant value;
std::string value;
//NLMISC::CRGBA value_color;
//uint value_uint;
//sint value_sint;
//double value_double;
QString elmtType = "";
UFormElm *elmt = 0;
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
{
if (elmt)
{
if (elmt->isArray())
elmtType = "Array";
if (elmt->isStruct())
elmtType = "Struct";
if (elmt->isAtom())
{
elmtType = "Atom";
uint numDefinitions = 0;
const UType *type = elmt->getType();
if (type)
{
numDefinitions = type->getNumDefinition();
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
switch (type->getType())
{
case UType::UnsignedInt:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString();
elmtType.append("_uint");break;
case UType::SignedInt:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString();
elmtType.append("_sint");break;
case UType::Double:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toStdString();
elmtType.append("_double");break;
case UType::String:
elmtType.append("_string");break;
case UType::Color:
elmtType.append("_color");break;
default:
elmtType.append("_unknownType");
}
}
else
{
elmtType.append("_noType");
}
if (numDefinitions)
{
std::string l, v;
QString tmpLabel, tmpValue;
for (uint i = 0; i < numDefinitions; i++)
{
type->getDefinition(i,l,v);
tmpLabel = l.c_str();
tmpValue = v.c_str();
if (type->getType() == UType::SignedInt)
{
if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) {
value = l;
break;
}
}
if (type->getType() == UType::String)
{
if (QString(value.c_str()) == tmpValue)
{
value = l;
break;
}
}
}
}
}
if (elmt->isVirtualStruct())
{
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
elmtType = "VirtualStruct";
}
switch (*whereN)
{
case UFormElm::NodeForm:
elmtType.append("_fromForm"); break;
case UFormElm::NodeParentForm:
elmtType.append("_fromParentForm"); break;
case UFormElm::NodeDfn:
elmtType.append("_isDFN"); break;
case UFormElm::NodeType:
elmtType.append("_isType"); break;
default:
elmtType.append("_noNode");
}
switch (*whereV)
{
case UFormElm::ValueForm:
elmtType.append("_formValue"); break;
case UFormElm::ValueParentForm:
elmtType.append("_parentValue"); break;
case UFormElm::ValueDefaultDfn:
elmtType.append("_dfnValue"); break;
case UFormElm::ValueDefaultType:
elmtType.append("_typeValue"); break;
default:
elmtType.append("_noValue");
}
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
//if (parents.last()->childCount() > 0) {
// parents << parents.last()->child(parents.last()->childCount()-1);
//}
loadFormData(elmt, parent->child(parent->childCount()-1));
}
else
{
// add Defaults
// TODO: spams warnings for non ATOM values but i dont get type of non existing nodes
bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
switch (*whereN)
{
case UFormElm::NodeForm:
elmtType.append("_fromForm"); break;
case UFormElm::NodeParentForm:
elmtType.append("_fromParentForm"); break;
case UFormElm::NodeDfn:
elmtType.append("_isDFN"); break;
case UFormElm::NodeType:
elmtType.append("_isType"); break;
default:
elmtType.append("_noNode");
}
switch (*whereV)
{
case UFormElm::ValueForm:
elmtType.append("_formValue"); break;
case UFormElm::ValueParentForm:
elmtType.append("_parentValue"); break;
case UFormElm::ValueDefaultDfn:
elmtType.append("_dfnValue"); break;
case UFormElm::ValueDefaultType:
elmtType.append("_typeValue"); break;
default:
elmtType.append("_noValue");
}
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
}
}
else
{
nlinfo("getNodeByName returned false");
}
}
num++;
}
}
if (root->isArray())
{
uint arraySize = 0;
root->getArraySize(arraySize);
while (num < arraySize)
{
std::string elmName;
if(root->getArrayNodeName(elmName, num))
{
QList<QVariant> columnData;
std::string value;
QString elmtType = "";
UFormElm *elmt = 0;
if(root->getArrayNode(&elmt,0) && elmt)
{
if (elmt->isArray())
elmtType = "Array";
if (elmt->isStruct()) {
elmtType = "Struct";
}
if (elmt->isAtom())
{
elmt->getValue(value);
elmtType = "Atom";
}
if (elmt->isVirtualStruct())
elmtType = "VirtualStruct";
elmtType.append("_arrayValue");
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent));
loadFormData(elmt, parent->child(parent->childCount()-1));
}
}
num++;
}
}
}
/******************************************************************************/
void CGeorgesFormModel::loadFormHeader()
{
if (m_parents.size())
{
CFormItem *fi_pars = new CFormItem(m_rootElm, QList<QVariant>() << "parents" << "" << "", m_rootItem);
m_rootItem->appendChild(fi_pars);
Q_FOREACH(QString str, m_parents)
{
fi_pars->appendChild(new CFormItem(m_rootElm, QList<QVariant>() << str << "" << "", fi_pars));
}
}
/*QStringList dfns = _dependencies["dfn"];
QStringList typs = _dependencies["typ"];
_dependencies.remove("dfn");
_dependencies.remove("typ");
CFormItem *fi_dep = new CFormItem(_rootElm, QList<QVariant>() << "dependencies", _rootItem);
_rootItem->appendChild(fi_dep);
if (!dfns.isEmpty()) {
CFormItem *fi_dfn = new CFormItem(_rootElm, QList<QVariant>() << "dfn", fi_dep);
fi_dep->appendChild(fi_dfn);
foreach(QString str, dfns) {
fi_dfn->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_dfn));
}
}
if (!typs.isEmpty()) {
CFormItem *fi_typ = new CFormItem(_rootElm, QList<QVariant>() << "typ", fi_dep);
fi_dep->appendChild(fi_typ);
foreach(QString str, typs) {
fi_typ->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_typ));
}
}
if (!_dependencies.isEmpty()) {
CFormItem *fi_other = new CFormItem(_rootElm, QList<QVariant>() << "other", fi_dep);
fi_dep->appendChild(fi_other);
foreach(QStringList list, _dependencies) {
foreach(QString str, list) {
fi_other->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_other));
}
}
}*/
}
/******************************************************************************/
void CGeorgesFormModel::setupModelData()
{
loadFormHeader();
loadFormData(m_rootElm, m_rootItem);
}
/******************************************************************************/
void CGeorgesFormModel::setShowParents( bool show ) {
m_showParents = show;
Q_EMIT layoutAboutToBeChanged();
Q_EMIT layoutChanged();
}
void CGeorgesFormModel::setShowDefaults( bool show )
{
m_showDefaults = show;
Q_EMIT layoutAboutToBeChanged();
Q_EMIT layoutChanged();
}
} /* namespace Plugin */
/* end of file */

View file

@ -0,0 +1,80 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef GEORGESFORM_MODEL_H
#define GEORGESFORM_MODEL_H
// Qt includes
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QStringList>
#include <QVariant>
// project includes
namespace NLGEORGES {
class UFormElm;
}
namespace Plugin
{
class CFormItem;
class CGeorgesFormModel : public QAbstractItemModel
{
public:
CGeorgesFormModel(NLGEORGES::UFormElm *root, QMap< QString, QStringList> deps,
QString comment, QStringList parents, bool* expanded, QObject *parent = 0);
~CGeorgesFormModel();
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
CFormItem *getItem(const QModelIndex &index) const;
CGeorgesFormModel *model() { return this; }
bool showParents() { return m_showParents;}
bool showDefaults() { return m_showDefaults;}
void setShowParents( bool show );
void setShowDefaults( bool show );
private:
void setupModelData();
void loadFormData(NLGEORGES::UFormElm *rootElm, CFormItem *parent);
void loadFormHeader();
CFormItem* m_rootItem;
NLGEORGES::UFormElm* m_rootElm;
QMap< QString, QStringList> m_dependencies;
QString m_comments;
QStringList m_parents;
QList<const QModelIndex*>* m_parentRows;
bool m_showParents;
bool m_showDefaults;
bool *m_expanded;
};/* class CGeorgesFormModel */
} /* namespace Plugin */
#endif // GEORGESFORM_MODEL_H

View file

@ -0,0 +1,81 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
// NeL includes
#include <nel/misc/debug.h>
#include <nel/georges/u_form_elm.h>
// project includes
#include "formitem.h"
#include "georgesform_proxy_model.h"
#include "georgesform_model.h"
namespace Plugin
{
bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
// column doesnt matter for item
CGeorgesFormModel *smodel = dynamic_cast<CGeorgesFormModel *>(sourceModel());
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
CFormItem *item = smodel->getItem(index);
// if elm not existing it must be some kind of default or type value
if(!item->getFormElm())
{
return smodel->showDefaults();
}
// else it might be some parent elm
switch (item->nodeFrom())
{
case NLGEORGES::UFormElm::NodeParentForm:
{
return smodel->showParents();
}
case NLGEORGES::UFormElm::NodeForm:
{
switch (item->valueFrom())
{
case NLGEORGES::UFormElm::ValueParentForm:
{
return smodel->showParents();
}
default:
{
CFormItem *parent = item->parent();
if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm))
{
return smodel->showParents();
}
}
}
}
}
return true;
}
/******************************************************************************/
bool CGeorgesFormProxyModel::filterAcceptsColumn(int sourceRow,
const QModelIndex &sourceParent) const
{
return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent);
}
} /* namespace Plugin */
/* end of file */

View file

@ -0,0 +1,45 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 <http://www.gnu.org/licenses/>.
#ifndef GEORGESFORM_PROXY_MODEL_H
#define GEORGESFORM_PROXY_MODEL_H
// Qt includes
#include <QSortFilterProxyModel>
namespace Plugin
{
class CGeorgesFormProxyModel : public QSortFilterProxyModel
{
public:
CGeorgesFormProxyModel(QObject *parent = 0): QSortFilterProxyModel(parent)
{
}
~CGeorgesFormProxyModel()
{
}
protected:
virtual bool filterAcceptsColumn ( int source_column, const QModelIndex & source_parent ) const ;
virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const ;
};/* class CGeorgesFormProxyModel */
} /* namespace NLQT */
#endif // GEORGESFORM_PROXY_MODEL_H

View file

@ -97,7 +97,7 @@ public:
_AttrbDlg[k]->init(); _AttrbDlg[k]->init();
} }
static const char * const operators[] = static const char *const operators[] =
{ {
QT_TR_NOOP("Select Arg1"), QT_TR_NOOP("Select Arg1"),
QT_TR_NOOP("Select Arg2"), QT_TR_NOOP("Select Arg2"),

View file

@ -141,7 +141,7 @@ public:
float getAnimLength(std::string name); float getAnimLength(std::string name);
/// Get slot infomation /// Get slot infomation
void setSlotInfo(uint num, CSlotInfo& slotInfo) void setSlotInfo(uint num, CSlotInfo &slotInfo)
{ {
_SlotInfo[num] = slotInfo; _SlotInfo[num] = slotInfo;
} }

View file

@ -135,7 +135,7 @@ bool CGraphicsViewport::winEvent(MSG *message, long *result)
{ {
winProc proc = (winProc)driver->getWindowProc(); winProc proc = (winProc)driver->getWindowProc();
// TODO: shouldn't it return false like the others? // TODO: shouldn't it return false like the others?
// see macEvent() and x11Event() below // see macEvent() and x11Event() below
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
} }
@ -163,7 +163,7 @@ bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event)
} }
} }
// return false to let Qt handle the event as well, // return false to let Qt handle the event as well,
// else the widget would never get focus // else the widget would never get focus
return false; return false;
} }
@ -184,7 +184,7 @@ bool CGraphicsViewport::x11Event(XEvent *event)
} }
} }
// return false to let Qt handle the event as well, // return false to let Qt handle the event as well,
// else the widget would never get focus // else the widget would never get focus
// TODO: test me please, i have no linux at hand (rti) // TODO: test me please, i have no linux at hand (rti)
return false; return false;

View file

@ -59,7 +59,7 @@ public:
CGraphicsViewport(QWidget *parent); CGraphicsViewport(QWidget *parent);
virtual ~CGraphicsViewport(); virtual ~CGraphicsViewport();
virtual QPaintEngine* paintEngine() const virtual QPaintEngine *paintEngine() const
{ {
return NULL; return NULL;
} }

View file

@ -161,7 +161,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
case QEvent::TouchBegin: case QEvent::TouchBegin:
case QEvent::TouchUpdate: case QEvent::TouchUpdate:
{ {
const QTouchEvent *const touchEvent = static_cast<const QTouchEvent*>(event); const QTouchEvent *const touchEvent = static_cast<const QTouchEvent *>(event);
const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints(); const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height()); const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height());
Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points) Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points)

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -91,7 +91,7 @@ QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const
} }
else else
{ {
QString error = qobject_cast<CMeshWidget*>(QObject::parent())->getShapeErrorString(numVerts); QString error = qobject_cast<CMeshWidget *>(QObject::parent())->getShapeErrorString(numVerts);
QString result = _CM->getShape(shapeIndex).c_str() + QString(" (%1)").arg(error); QString result = _CM->getShape(shapeIndex).c_str() + QString(" (%1)").arg(error);
return result; return result;
} }

View file

@ -435,7 +435,7 @@ void CObjectViewer::setCurrentObject(const std::string &name)
nlinfo("set current entity %s", _CurrentInstance.c_str()); nlinfo("set current entity %s", _CurrentInstance.c_str());
} }
CEntity& CObjectViewer::getEntity(const std::string &name) CEntity &CObjectViewer::getEntity(const std::string &name)
{ {
if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str());
EIT eit = _Entities.find (name); EIT eit = _Entities.find (name);

View file

@ -152,7 +152,7 @@ public:
/// Get entity from the scene /// Get entity from the scene
/// @return ref Entity /// @return ref Entity
CEntity& getEntity(const std::string &name); CEntity &getEntity(const std::string &name);
/// Get full list instances from the scene /// Get full list instances from the scene
/// @param listObj - ref of return list instances /// @param listObj - ref of return list instances

View file

@ -33,6 +33,7 @@
<file>icons/ic_nel_water.png</file> <file>icons/ic_nel_water.png</file>
<file>icons/ic_nel_wind.png</file> <file>icons/ic_nel_wind.png</file>
<file>icons/ic_nel_workspace_item.png</file> <file>icons/ic_nel_workspace_item.png</file>
<file>icons/ic_nel_pill.png</file>
<file>images/nel.png</file> <file>images/nel.png</file>
<file>icons/particles_system_24/ic_nel_collision_zone_item_24.png</file> <file>icons/particles_system_24/ic_nel_collision_zone_item_24.png</file>
<file>icons/particles_system_24/ic_nel_emitter_item_24.png</file> <file>icons/particles_system_24/ic_nel_emitter_item_24.png</file>

View file

@ -74,7 +74,7 @@ public:
virtual QIcon icon() const virtual QIcon icon() const
{ {
return QIcon(); return QIcon(":/icons/ic_nel_pill.png");
} }
virtual QUndoStack *undoStack(); virtual QUndoStack *undoStack();

View file

@ -404,7 +404,7 @@ bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const Q
bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent) bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent)
{ {
beginInsertRows(parent, position, position); beginInsertRows(parent, position, position);
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem *>(parent.internalPointer())); createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem *>(parent.internalPointer()));
endInsertRows(); endInsertRows();
return true; return true;
} }
@ -424,7 +424,7 @@ bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
removeRows(0, parent.child(position, 0)); removeRows(0, parent.child(position, 0));
beginRemoveRows(parent, position, position); beginRemoveRows(parent, position, position);
static_cast<CParticleTreeItem*>(parent.internalPointer())->deleteChild(position); static_cast<CParticleTreeItem *>(parent.internalPointer())->deleteChild(position);
endRemoveRows(); endRemoveRows();
return false; return false;
} }

View file

@ -46,7 +46,7 @@
namespace NLQT namespace NLQT
{ {
static const char * const LocatedBindable[] = static const char *const LocatedBindable[] =
{ {
QT_TR_NOOP("Point"), QT_TR_NOOP("Point"),
QT_TR_NOOP("LookAt"), QT_TR_NOOP("LookAt"),
@ -220,7 +220,7 @@ void CParticleWorkspaceDialog::touchPSState(CParticleTreeItem *item)
} }
} }
void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) void CParticleWorkspaceDialog::clickedItem(const QModelIndex &index)
{ {
if (_currentItem != 0) if (_currentItem != 0)
_treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL);

View file

@ -59,7 +59,7 @@ Q_SIGNALS:
void changeActiveNode(); void changeActiveNode();
private Q_SLOTS: private Q_SLOTS:
void clickedItem(const QModelIndex & index); void clickedItem(const QModelIndex &index);
void customContextMenu(); void customContextMenu();
void setActiveNode(); void setActiveNode();

View file

@ -107,6 +107,9 @@ void CSoundSystem::init()
std::string mess = std::string("Unable to init sound :") + e.what(); std::string mess = std::string("Unable to init sound :") + e.what();
nlwarning ("Init sound: %s", mess.c_str()); nlwarning ("Init sound: %s", mess.c_str());
_AudioMixer = NULL; _AudioMixer = NULL;
QSettings *settings = Core::ICore::instance()->settings();
if (settings->group() == Constants::OBJECT_VIEWER_SECTION)
settings->endGroup();
return; return;
} }

View file

@ -61,13 +61,13 @@ public:
} }
/// Sets the path which contains samples /// Sets the path which contains samples
void setSamplePath(std::string& path) void setSamplePath(std::string &path)
{ {
_SamplePath = NLMISC::CPath::standardizePath(path, true); _SamplePath = NLMISC::CPath::standardizePath(path, true);
} }
/// Sets the path which contains packed sheet /// Sets the path which contains packed sheet
void setPackedSheetPath(std::string& path) void setPackedSheetPath(std::string &path)
{ {
_PackedSheetPath = NLMISC::CPath::standardizePath(path, true); _PackedSheetPath = NLMISC::CPath::standardizePath(path, true);
} }
@ -88,13 +88,13 @@ public:
NLSOUND::USource *create(const std::string &soundName); NLSOUND::USource *create(const std::string &soundName);
/// Load the sound animation with the specified name /// Load the sound animation with the specified name
void loadAnimation(std::string& name) void loadAnimation(std::string &name)
{ {
_AnimManager->loadAnimation(name); _AnimManager->loadAnimation(name);
} }
/// Start playing a sound animation. /// Start playing a sound animation.
void playAnimation(std::string& name, float lastTime, float curTime, NLSOUND::CSoundContext &context); void playAnimation(std::string &name, float lastTime, float curTime, NLSOUND::CSoundContext &context);
// Update the sound animations. // Update the sound animations.
//static void updateAnimations(float lastTime, float curTime) { _AnimManager->update(lastTime, curTime); }; //static void updateAnimations(float lastTime, float curTime) { _AnimManager->update(lastTime, curTime); };

View file

@ -60,7 +60,7 @@ CVegetableApperancePage::CVegetableApperancePage(QWidget *parent)
connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(removeColor())); connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(removeColor()));
connect(_ui.getListPushButton, SIGNAL(clicked()), this, SLOT(getFromListColors())); connect(_ui.getListPushButton, SIGNAL(clicked()), this, SLOT(getFromListColors()));
connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(browseColor(QListWidgetItem*))); connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(browseColor(QListWidgetItem *)));
setEnabled(false); setEnabled(false);
} }

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>337</width> <width>235</width>
<height>232</height> <height>293</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -130,7 +130,51 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="3">
<widget class="QToolButton" name="unloadToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Unload</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/icons/ic_nel_particle_system_close.png</normaloff>:/icons/ic_nel_particle_system_close.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="saveToolButton"> <widget class="QToolButton" name="saveToolButton">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -177,7 +221,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5"> <item row="1" column="2">
<widget class="QToolButton" name="saveAsToolButton"> <widget class="QToolButton" name="saveAsToolButton">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -221,50 +265,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3">
<widget class="QToolButton" name="unloadToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Unload</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/icons/ic_nel_particle_system_close.png</normaloff>:/icons/ic_nel_particle_system_close.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -19,7 +19,7 @@
#include "nel/3d/register_3d.h" #include "nel/3d/register_3d.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
extern ClassDesc2* GetCNelExportDesc(); extern ClassDesc2* GetCNelExportDesc();
@ -42,7 +42,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
if (!controlsInit) { if (!controlsInit) {
controlsInit = TRUE; controlsInit = TRUE;
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); // Initialize MAX's custom controls InitCustomControls(hInstance); // Initialize MAX's custom controls
#endif
InitCommonControls(); // Initialize Win95 controls InitCommonControls(); // Initialize Win95 controls
} }

View file

@ -16,7 +16,12 @@
#include "std_afx.h" #include "std_afx.h"
#include "nel_export.h" #include "nel_export.h"
#include <MaxScrpt/strings.h> #include <maxversion.h>
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/foundation/strings.h>
#else
# include <MaxScrpt/strings.h>
#endif
#include "../nel_mesh_lib/export_nel.h" #include "../nel_mesh_lib/export_nel.h"
#include "../nel_mesh_lib/export_appdata.h" #include "../nel_mesh_lib/export_appdata.h"

View file

@ -26,16 +26,29 @@
#include <utilapi.h> #include <utilapi.h>
#include <shlobj.h> #include <shlobj.h>
#undef STRICT #undef STRICT
#include <MaxScrpt/maxscrpt.h> #include <maxversion.h>
#include <MaxScrpt/3dmath.h> #if MAX_VERSION_MAJOR >= 14
#include <MaxScrpt/numbers.h> # include <maxscript/maxscript.h>
#include <MaxScrpt/maxclses.h> # include <maxscript/foundation/3dmath.h>
#include <MaxScrpt/streams.h> # include <maxscript/foundation/numbers.h>
#include <MaxScrpt/mstime.h> # include <maxscript/maxwrapper/maxclasses.h>
#include <MaxScrpt/maxobj.h> # include <maxscript/foundation/streams.h>
#include <MaxScrpt/parser.h> # include <maxscript/foundation/mxstime.h>
# include <maxscript/maxwrapper/mxsobjects.h>
# include <maxscript/compiler/parser.h>
# include <maxscript/foundation/functions.h>
#else
# include <MaxScrpt/maxscrpt.h>
# include <MaxScrpt/3dmath.h>
# include <MaxScrpt/numbers.h>
# include <MaxScrpt/maxclses.h>
# include <MaxScrpt/streams.h>
# include <MaxScrpt/mstime.h>
# include <MaxScrpt/maxobj.h>
# include <MaxScrpt/parser.h>
# include <MaxScrpt/definsfn.h>
#endif
#include <stdmat.h> #include <stdmat.h>
#include <MaxScrpt/definsfn.h>
#include <animtbl.h> #include <animtbl.h>
#ifdef min #ifdef min
#undef min #undef min

View file

@ -32,7 +32,12 @@
#include <stdmat.h> #include <stdmat.h>
#include <shaders.h> #include <shaders.h>
#include <iparamb2.h> #include <iparamb2.h>
#include <Maxscrpt/maxscrpt.h> #include <maxversion.h>
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/maxscript.h>
#else
# include <MaxScrpt/maxscrpt.h>
#endif
//#include <parser.h> //#include <parser.h>
// Character Studio SDK include // Character Studio SDK include

View file

@ -260,7 +260,11 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName)
if (strcmp (paramDef.int_name, sName)==0) if (strcmp (paramDef.int_name, sName)==0)
{ {
// ok, return this subanim // ok, return this subanim
#if MAX_VERSION_MAJOR >= 14
return param->GetControllerByID(id);
#else
return param->GetController(id); return param->GetController(id);
#endif
} }
} }
} }

View file

@ -15,8 +15,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h" #include "stdafx.h"
#include <MaxScrpt/parser.h> #include <maxversion.h>
#include <MaxScrpt/strings.h> #if MAX_VERSION_MAJOR >= 14
# include <maxscript/compiler/parser.h>
# include <maxscript/foundation/strings.h>
#else
# include <MaxScrpt/parser.h>
# include <MaxScrpt/strings.h>
#endif
#include "export_nel.h" #include "export_nel.h"
#include "export_appdata.h" #include "export_appdata.h"

View file

@ -20,6 +20,7 @@
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
extern ClassDesc2* GetPO2RPODesc(); extern ClassDesc2* GetPO2RPODesc();
extern ClassDesc* GetRPODesc(); extern ClassDesc* GetRPODesc();
@ -58,7 +59,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
{ {
// This method has been deprecated. // This method has been deprecated.
controlsInit = TRUE; controlsInit = TRUE;
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); // Initialize MAX's custom controls InitCustomControls(hInstance); // Initialize MAX's custom controls
#endif
InitCommonControls(); // Initialize Win95 controls InitCommonControls(); // Initialize Win95 controls
} }
return (TRUE); return (TRUE);

View file

@ -22,24 +22,38 @@
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE
#include <assert.h> #include <assert.h>
#include <MaxScrpt/maxscrpt.h>
#include <MaxScrpt/3dmath.h>
// Various MAX and MXS includes #include <maxversion.h>
#include <MaxScrpt/Numbers.h> #if MAX_VERSION_MAJOR >= 14
#include <MaxScrpt/MAXclses.h> # include <maxscript/maxscript.h>
#include <MaxScrpt/Streams.h> # include <maxscript/foundation/3dmath.h>
#include <MaxScrpt/MSTime.h> # include <maxscript/foundation/numbers.h>
#include <MaxScrpt/MAXObj.h> # include <maxscript/maxwrapper/maxclasses.h>
#include <MaxScrpt/Parser.h> # include <maxscript/foundation/streams.h>
# include <maxscript/foundation/mxstime.h>
# include <maxscript/maxwrapper/mxsobjects.h>
# include <maxscript/compiler/parser.h>
# include <maxscript/foundation/functions.h>
#else
# include <MaxScrpt/maxscrpt.h>
# include <MaxScrpt/3dmath.h>
// Various MAX and MXS includes
# include <MaxScrpt/Numbers.h>
# include <MaxScrpt/MAXclses.h>
# include <MaxScrpt/Streams.h>
# include <MaxScrpt/MSTime.h>
# include <MaxScrpt/MAXObj.h>
# include <MaxScrpt/Parser.h>
// define the new primitives using macros from SDK
# include <MaxScrpt/definsfn.h>
#endif
#include <modstack.h> #include <modstack.h>
#include <decomp.h> #include <decomp.h>
#include <max.h> #include <max.h>
#include <stdmat.h> #include <stdmat.h>
// define the new primitives using macros from SDK
#include <MaxScrpt/definsfn.h>
#undef _CRT_SECURE_NO_DEPRECATE #undef _CRT_SECURE_NO_DEPRECATE
@ -109,9 +123,9 @@ def_visible_primitive( set_tile_bank, "NelSetTileBank");
def_visible_primitive( export_zone, "ExportRykolZone"); def_visible_primitive( export_zone, "ExportRykolZone");
def_visible_primitive( import_zone, "NeLImportZone"); def_visible_primitive( import_zone, "NeLImportZone");
/* permettre l'acces à auto/manual intrior edges /* permettre l'acces <EFBFBD>Eauto/manual intrior edges
faire une methode pour interfacer la fonction compute interior edge faire une methode pour interfacer la fonction compute interior edge
donner un acces à tiledmode/patchmode (on/off) donner un acces <EFBFBD>Etiledmode/patchmode (on/off)
faire un getselectedvertex faire un getselectedvertex
faire un getselectedpatch faire un getselectedpatch
faire un getselectedtile */ faire un getselectedtile */

View file

@ -17,6 +17,8 @@
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
HINSTANCE hInstance; HINSTANCE hInstance;
int controlsInit = FALSE; int controlsInit = FALSE;
@ -42,7 +44,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
controlsInit = TRUE; controlsInit = TRUE;
// jaguar controls // jaguar controls
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); InitCustomControls(hInstance);
#endif
#ifdef OLD3DCONTROLS #ifdef OLD3DCONTROLS
// initialize 3D controls // initialize 3D controls

View file

@ -18,7 +18,12 @@
// For MAX_RELEASE // For MAX_RELEASE
#include <plugapi.h> #include <plugapi.h>
#include <MaxScrpt/maxscrpt.h> #include <maxversion.h>
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/maxscript.h>
#else
# include <MaxScrpt/maxscrpt.h>
#endif
#include "rpo.h" #include "rpo.h"
#include "nel/3d/zone.h" #include "nel/3d/zone.h"

View file

@ -3,6 +3,7 @@
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
HINSTANCE hInstance; HINSTANCE hInstance;
int controlsInit = FALSE; int controlsInit = FALSE;
@ -26,7 +27,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
controlsInit = TRUE; controlsInit = TRUE;
// jaguar controls // jaguar controls
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); InitCustomControls(hInstance);
#endif
#ifdef OLD3DCONTROLS #ifdef OLD3DCONTROLS
// initialize 3D controls // initialize 3D controls

View file

@ -3,7 +3,12 @@
#include "resource.h" #include "resource.h"
#include <algorithm> #include <algorithm>
#include <MaxScrpt/maxscrpt.h> #include <maxversion.h>
#if MAX_VERSION_MAJOR >= 14
# include <maxscript/maxscript.h>
#else
# include <MaxScrpt/maxscrpt.h>
#endif
#include "namesel.h" #include "namesel.h"
#include "nsclip.h" #include "nsclip.h"
#include "sbmtlapi.h" #include "sbmtlapi.h"

View file

@ -1,6 +1,6 @@
#include "vertex_tree_paint.h" #include "vertex_tree_paint.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <maxversion.h>
HINSTANCE hInstance; HINSTANCE hInstance;
@ -18,7 +18,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
switch (fdwReason) { switch (fdwReason) {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); // Initialize MAX's custom controls InitCustomControls(hInstance); // Initialize MAX's custom controls
#endif
InitCommonControls(); // Initialize Win95 controls InitCommonControls(); // Initialize Win95 controls
break; break;
} }

View file

@ -20,6 +20,7 @@
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h"
#include <vector> #include <vector>
#include <maxversion.h>
extern ClassDesc2* GetTile_utilityDesc(); extern ClassDesc2* GetTile_utilityDesc();
extern ClassDesc* GetRGBAddDesc(); extern ClassDesc* GetRGBAddDesc();
@ -46,7 +47,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
if (!controlsInit) { if (!controlsInit) {
controlsInit = TRUE; controlsInit = TRUE;
#if MAX_VERSION_MAJOR < 14
InitCustomControls(hInstance); // Initialize MAX's custom controls InitCustomControls(hInstance); // Initialize MAX's custom controls
#endif
InitCommonControls(); // Initialize Win95 controls InitCommonControls(); // Initialize Win95 controls
} }

Some files were not shown because too many files have changed in this diff Show more