mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 18:08:44 +00:00
Changed: #1307 Merge from default and fixing the bug when you switch windows
This commit is contained in:
commit
e1a206385b
170 changed files with 8439 additions and 2033 deletions
|
@ -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)
|
||||||
|
|
|
@ -12,31 +12,34 @@ 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)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
|
||||||
LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL})
|
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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
@ -315,14 +328,21 @@ MACRO(NL_SETUP_BUILD)
|
||||||
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")
|
||||||
|
@ -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,7 +481,7 @@ 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)
|
||||||
|
|
||||||
|
@ -465,7 +490,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||||
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)
|
||||||
|
|
||||||
|
@ -474,7 +499,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||||
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)
|
||||||
|
|
||||||
|
@ -483,7 +508,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||||
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)
|
||||||
|
|
||||||
|
@ -492,18 +517,24 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||||
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)
|
||||||
|
|
|
@ -54,6 +54,7 @@ IF(WITH_GTK)
|
||||||
FIND_PACKAGE(GTK2)
|
FIND_PACKAGE(GTK2)
|
||||||
ENDIF(WITH_GTK)
|
ENDIF(WITH_GTK)
|
||||||
|
|
||||||
|
IF(WITH_INSTALL_LIBRARIES)
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
|
SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
|
||||||
|
@ -72,6 +73,8 @@ IF(UNIX)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(include)
|
ADD_SUBDIRECTORY(include)
|
||||||
|
ENDIF(WITH_INSTALL_LIBRARIES)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
|
|
||||||
IF(WITH_NEL_SAMPLES)
|
IF(WITH_NEL_SAMPLES)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
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 LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -11,4 +11,6 @@ NL_ADD_LIB_SUFFIX(nelceguirenderer)
|
||||||
|
|
||||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS)
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS)
|
||||||
|
|
||||||
|
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)
|
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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -14,4 +14,6 @@ NL_ADD_LIB_SUFFIX(nellogic)
|
||||||
|
|
||||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
|
||||||
INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
|
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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
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 bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
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 bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -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)
|
||||||
|
INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
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 bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound)
|
||||||
IF(WITH_MAXPLUGIN)
|
IF(WITH_MAXPLUGIN)
|
||||||
INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound)
|
||||||
ENDIF(WITH_MAXPLUGIN)
|
ENDIF(WITH_MAXPLUGIN)
|
||||||
|
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,12 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// From MAXSDK
|
// From MAXSDK
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
#else
|
||||||
# include <MaxScrpt/maxscrpt.h>
|
# include <MaxScrpt/maxscrpt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "max_to_ligo.h"
|
#include "max_to_ligo.h"
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,18 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// Various MAX and MXS includes
|
// Various MAX and MXS includes
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
# include <maxscript/foundation/3dmath.h>
|
||||||
|
# include <maxscript/foundation/numbers.h>
|
||||||
|
# include <maxscript/maxwrapper/maxclasses.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/MAXScrpt.h>
|
||||||
# include <MaxScrpt/3dmath.h>
|
# include <MaxScrpt/3dmath.h>
|
||||||
# include <MaxScrpt/Numbers.h>
|
# include <MaxScrpt/Numbers.h>
|
||||||
|
@ -27,9 +39,10 @@
|
||||||
# include <MaxScrpt/MSTime.h>
|
# include <MaxScrpt/MSTime.h>
|
||||||
# include <MaxScrpt/MAXObj.h>
|
# include <MaxScrpt/MAXObj.h>
|
||||||
# include <MaxScrpt/Parser.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>
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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),
|
||||||
|
@ -87,7 +89,7 @@ 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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -162,16 +162,7 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,10 @@ 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(translation_manager)
|
ADD_SUBDIRECTORY(translation_manager)
|
||||||
|
# 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)
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
CorePlugin::CorePlugin()
|
CorePlugin::CorePlugin()
|
||||||
|
: m_plugMan(0),
|
||||||
|
m_mainWindow(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +51,7 @@ CorePlugin::~CorePlugin()
|
||||||
qDeleteAll(m_autoReleaseObjects);
|
qDeleteAll(m_autoReleaseObjects);
|
||||||
m_autoReleaseObjects.clear();
|
m_autoReleaseObjects.clear();
|
||||||
|
|
||||||
|
if (m_mainWindow)
|
||||||
delete m_mainWindow;
|
delete m_mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 */
|
|
@ -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
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
|
@ -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 */
|
|
@ -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
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
|
@ -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 */
|
|
@ -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
|
|
@ -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())
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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,49 +31,73 @@
|
||||||
#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_lastActiveDock(0)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
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);
|
m_undoStack = new QUndoStack(this);
|
||||||
|
|
||||||
_openAction = new QAction(tr("&Open..."), this);
|
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
|
||||||
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
|
m_openAction = menuManager->action(Core::Constants::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);
|
m_newAction = new QAction(tr("&New..."), this);
|
||||||
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
m_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
|
||||||
_newAction->setShortcut(QKeySequence::New);
|
m_newAction->setShortcut(QKeySequence::New);
|
||||||
_newAction->setStatusTip(tr("Create a new file"));
|
m_newAction->setStatusTip(tr("Create a new file"));
|
||||||
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||||
|
|
||||||
_saveAction = new QAction(tr("&Save..."), this);
|
m_saveAction = new QAction(tr("&Save..."), this);
|
||||||
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
m_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
|
||||||
_saveAction->setShortcut(QKeySequence::Save);
|
m_saveAction->setShortcut(QKeySequence::Save);
|
||||||
_saveAction->setStatusTip(tr("Save the current file"));
|
m_saveAction->setStatusTip(tr("Save the current file"));
|
||||||
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
|
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
|
||||||
|
|
||||||
_fileToolBar = addToolBar(tr("&File"));
|
m_fileToolBar = addToolBar(tr("&File"));
|
||||||
_fileToolBar->addAction(_openAction);
|
m_fileToolBar->addAction(m_openAction);
|
||||||
_fileToolBar->addAction(_newAction);
|
m_fileToolBar->addAction(m_newAction);
|
||||||
_fileToolBar->addAction(_saveAction);
|
m_fileToolBar->addAction(m_saveAction);
|
||||||
|
|
||||||
|
m_saveAction->setEnabled(false);
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
// create leveldesign directory tree dockwidget
|
// create leveldesign directory tree dockwidget
|
||||||
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
|
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
|
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
|
||||||
//m_georgesDirTreeDialog->setVisible(false);
|
restoreDockWidget(m_georgesDirTreeDialog);
|
||||||
|
|
||||||
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
|
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
|
||||||
this, SLOT(settingsChanged()));
|
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()
|
GeorgesEditorForm::~GeorgesEditorForm()
|
||||||
|
@ -87,7 +112,22 @@ QUndoStack *GeorgesEditorForm::undoStack() const
|
||||||
|
|
||||||
void GeorgesEditorForm::open()
|
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();
|
// 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();
|
//QString fileName = QFileDialog::getOpenFileName();
|
||||||
//loadFile(fileName);
|
//loadFile(fileName);
|
||||||
}
|
}
|
||||||
|
@ -106,6 +146,10 @@ void GeorgesEditorForm::readSettings()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
||||||
|
|
||||||
|
restoreGeometry(settings->value("geometry").toByteArray());
|
||||||
|
restoreState(settings->value("windowState").toByteArray());
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
||||||
|
@ -117,6 +161,10 @@ void GeorgesEditorForm::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
||||||
|
|
||||||
|
settings->setValue("geometry", saveGeometry());
|
||||||
|
settings->setValue("windowState", saveState());
|
||||||
|
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->sync();
|
settings->sync();
|
||||||
}
|
}
|
||||||
|
@ -136,4 +184,104 @@ void GeorgesEditorForm::settingsChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
|
@ -18,13 +18,14 @@
|
||||||
#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;
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
|
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
|
||||||
|
@ -39,12 +40,40 @@ public:
|
||||||
{
|
{
|
||||||
return m_correct;
|
return m_correct;
|
||||||
}
|
}
|
||||||
|
bool isInitialized()
|
||||||
|
{
|
||||||
|
return m_initialized;
|
||||||
|
}
|
||||||
|
void setInitialized( bool init)
|
||||||
|
{
|
||||||
|
m_initialized = init;
|
||||||
|
}
|
||||||
void checkLDPath();
|
void checkLDPath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_correct;
|
bool m_correct;
|
||||||
|
bool m_initialized;
|
||||||
|
QString m_ldPath;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void dir(const QString&);
|
||||||
};/* class CGeorgesFileSystemModel */
|
};/* 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 */
|
||||||
|
|
||||||
#endif // GEORGES_FILESYSTEM_MODEL_H
|
#endif // GEORGES_FILESYSTEM_MODEL_H
|
|
@ -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 */
|
|
@ -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
|
|
@ -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>
|
|
@ -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 */
|
|
@ -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
|
|
@ -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 */
|
|
@ -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
|
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
|
@ -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>
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtCore/Qfile>
|
#include <QtCore/QFile>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#include "ui_ftp_selection.h"
|
#include "ui_ftp_selection.h"
|
||||||
|
|
|
@ -194,7 +194,8 @@ void CMainWindow::updateWindowsList()
|
||||||
windowMenu->addAction(action);
|
windowMenu->addAction(action);
|
||||||
windowMapper->setMapping(action, subWindows.at(i));
|
windowMapper->setMapping(action, subWindows.at(i));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
windowMenu->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,6 +644,6 @@ bool CMainWindow::isPhraseEditor(QString filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace Plugin */
|
} /* namespace TranslationManager */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,6 @@ private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
void save();
|
void save();
|
||||||
void saveAs();
|
void saveAs();
|
||||||
void activeSubWindowChanged();
|
|
||||||
void setActiveSubWindow(QWidget *window);
|
void setActiveSubWindow(QWidget *window);
|
||||||
void updateWindowsList();
|
void updateWindowsList();
|
||||||
void mergeSingleFile();
|
void mergeSingleFile();
|
||||||
|
@ -127,7 +126,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Plugin
|
} // namespace TranslationManager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,12 @@
|
||||||
|
|
||||||
#include "std_afx.h"
|
#include "std_afx.h"
|
||||||
#include "nel_export.h"
|
#include "nel_export.h"
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/foundation/strings.h>
|
||||||
|
#else
|
||||||
# include <MaxScrpt/strings.h>
|
# 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"
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,18 @@
|
||||||
#include <utilapi.h>
|
#include <utilapi.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#undef STRICT
|
#undef STRICT
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
# include <maxscript/foundation/3dmath.h>
|
||||||
|
# include <maxscript/foundation/numbers.h>
|
||||||
|
# include <maxscript/maxwrapper/maxclasses.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/maxscrpt.h>
|
||||||
# include <MaxScrpt/3dmath.h>
|
# include <MaxScrpt/3dmath.h>
|
||||||
# include <MaxScrpt/numbers.h>
|
# include <MaxScrpt/numbers.h>
|
||||||
|
@ -34,8 +46,9 @@
|
||||||
# include <MaxScrpt/mstime.h>
|
# include <MaxScrpt/mstime.h>
|
||||||
# include <MaxScrpt/maxobj.h>
|
# include <MaxScrpt/maxobj.h>
|
||||||
# include <MaxScrpt/parser.h>
|
# include <MaxScrpt/parser.h>
|
||||||
#include <stdmat.h>
|
|
||||||
# include <MaxScrpt/definsfn.h>
|
# include <MaxScrpt/definsfn.h>
|
||||||
|
#endif
|
||||||
|
#include <stdmat.h>
|
||||||
#include <animtbl.h>
|
#include <animtbl.h>
|
||||||
#ifdef min
|
#ifdef min
|
||||||
#undef min
|
#undef min
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -288,6 +288,14 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime)
|
||||||
string tmp = *ntExclu.Addr(i);
|
string tmp = *ntExclu.Addr(i);
|
||||||
this->setExclusion.insert(tmp);
|
this->setExclusion.insert(tmp);
|
||||||
}
|
}
|
||||||
|
#else // (MAX_RELEASE < 4000)
|
||||||
|
ExclList& exclusionList = maxLight->GetExclusionList();
|
||||||
|
for (sint i = 0; i < exclusionList.Count(); ++i)
|
||||||
|
{
|
||||||
|
INode *exclNode = exclusionList[i];
|
||||||
|
string tmp = exclNode->GetName();
|
||||||
|
this->setExclusion.insert(tmp);
|
||||||
|
}
|
||||||
#endif // (MAX_RELEASE < 4000)
|
#endif // (MAX_RELEASE < 4000)
|
||||||
|
|
||||||
// Get Soft Shadow informations
|
// Get Soft Shadow informations
|
||||||
|
@ -1999,11 +2007,12 @@ void CExportNel::deleteLM(INode& ZeNode)
|
||||||
sprintf( tmp, "%d", i );
|
sprintf( tmp, "%d", i );
|
||||||
sSaveName += tmp;
|
sSaveName += tmp;
|
||||||
sSaveName += ".tga";
|
sSaveName += ".tga";
|
||||||
FILE *file;
|
if (CFile::fileExists(sSaveName))
|
||||||
if( file = fopen(sSaveName.c_str(),"rb") )
|
|
||||||
{
|
{
|
||||||
fclose( file );
|
if (!CFile::deleteFile(sSaveName))
|
||||||
DeleteFile( sSaveName.c_str() );
|
{
|
||||||
|
nlwarning("Failed to delete file %s.", sSaveName.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2576,11 +2585,12 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB
|
||||||
for (i = 0; i < 256; ++i)
|
for (i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
string sLMName = sBaseName + NLMISC::toString(i) + ".tga";
|
string sLMName = sBaseName + NLMISC::toString(i) + ".tga";
|
||||||
CIFile ifi;
|
if (CFile::fileExists(sLMName))
|
||||||
if (ifi.open(sLMName))
|
|
||||||
{
|
{
|
||||||
ifi.close ();
|
if (!CFile::deleteFile(sLMName))
|
||||||
DeleteFile (sLMName.c_str());
|
{
|
||||||
|
nlwarning("Failed to delete file %s.", sLMName.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time)
|
||||||
// if not found, get from the APP_DATAS
|
// if not found, get from the APP_DATAS
|
||||||
shapeName = CExportNel::getNelObjectName(node);
|
shapeName = CExportNel::getNelObjectName(node);
|
||||||
if (shapeName.empty()) return NULL;
|
if (shapeName.empty()) return NULL;
|
||||||
shapeName = NLMISC::CPath::lookup("shapeName", false);
|
shapeName = NLMISC::CPath::lookup(shapeName, false);
|
||||||
if (shapeName.empty()) return NULL;
|
if (shapeName.empty()) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "../nel_patch_lib/rpo.h"
|
#include "../nel_patch_lib/rpo.h"
|
||||||
#include "../../ig_lighter_lib/ig_lighter_lib.h"
|
#include "../../ig_lighter_lib/ig_lighter_lib.h"
|
||||||
|
|
||||||
|
#include "nel/misc/path.h"
|
||||||
#include "nel/3d/scene_group.h"
|
#include "nel/3d/scene_group.h"
|
||||||
#include "nel/3d/scene.h"
|
#include "nel/3d/scene.h"
|
||||||
#include "nel/3d/shape_bank.h"
|
#include "nel/3d/shape_bank.h"
|
||||||
|
@ -418,12 +419,21 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector<INode*>& vectNode, v
|
||||||
if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
|
if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID)
|
||||||
{
|
{
|
||||||
// build the shape from the file name
|
// build the shape from the file name
|
||||||
std::string objName = CExportNel::getNelObjectName(*pNode);
|
// std::string objName = CExportNel::getNelObjectName(*pNode);
|
||||||
if (!objName.empty())
|
std::string psFilePath;
|
||||||
|
// try to get the complete path
|
||||||
|
if (!CExportNel::getValueByNameUsingParamBlock2(*pNode, "ps_file_name", (ParamType2) TYPE_STRING, &psFilePath, 0))
|
||||||
|
{
|
||||||
|
// if not found, get from the APP_DATAS
|
||||||
|
psFilePath = CExportNel::getNelObjectName(*pNode);
|
||||||
|
if (!psFilePath.empty())
|
||||||
|
psFilePath = CPath::lookup(psFilePath, false);
|
||||||
|
}
|
||||||
|
if (!psFilePath.empty())
|
||||||
{
|
{
|
||||||
NL3D::CShapeStream ss;
|
NL3D::CShapeStream ss;
|
||||||
NLMISC::CIFile iF;
|
NLMISC::CIFile iF;
|
||||||
if (iF.open(objName.c_str()))
|
if (iF.open(psFilePath.c_str()))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/compiler/parser.h>
|
||||||
|
# include <maxscript/foundation/strings.h>
|
||||||
|
#else
|
||||||
# include <MaxScrpt/parser.h>
|
# include <MaxScrpt/parser.h>
|
||||||
# include <MaxScrpt/strings.h>
|
# include <MaxScrpt/strings.h>
|
||||||
|
#endif
|
||||||
#include "export_nel.h"
|
#include "export_nel.h"
|
||||||
#include "export_appdata.h"
|
#include "export_appdata.h"
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -22,9 +22,21 @@
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
# include <maxscript/foundation/3dmath.h>
|
||||||
|
# include <maxscript/foundation/numbers.h>
|
||||||
|
# include <maxscript/maxwrapper/maxclasses.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/maxscrpt.h>
|
||||||
# include <MaxScrpt/3dmath.h>
|
# include <MaxScrpt/3dmath.h>
|
||||||
|
|
||||||
// Various MAX and MXS includes
|
// Various MAX and MXS includes
|
||||||
# include <MaxScrpt/Numbers.h>
|
# include <MaxScrpt/Numbers.h>
|
||||||
# include <MaxScrpt/MAXclses.h>
|
# include <MaxScrpt/MAXclses.h>
|
||||||
|
@ -32,14 +44,16 @@
|
||||||
# include <MaxScrpt/MSTime.h>
|
# include <MaxScrpt/MSTime.h>
|
||||||
# include <MaxScrpt/MAXObj.h>
|
# include <MaxScrpt/MAXObj.h>
|
||||||
# include <MaxScrpt/Parser.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 */
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -18,7 +18,12 @@
|
||||||
|
|
||||||
// For MAX_RELEASE
|
// For MAX_RELEASE
|
||||||
#include <plugapi.h>
|
#include <plugapi.h>
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
#else
|
||||||
# include <MaxScrpt/maxscrpt.h>
|
# include <MaxScrpt/maxscrpt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "rpo.h"
|
#include "rpo.h"
|
||||||
#include "nel/3d/zone.h"
|
#include "nel/3d/zone.h"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <maxversion.h>
|
||||||
|
#if MAX_VERSION_MAJOR >= 14
|
||||||
|
# include <maxscript/maxscript.h>
|
||||||
|
#else
|
||||||
# include <MaxScrpt/maxscrpt.h>
|
# include <MaxScrpt/maxscrpt.h>
|
||||||
|
#endif
|
||||||
#include "namesel.h"
|
#include "namesel.h"
|
||||||
#include "nsclip.h"
|
#include "nsclip.h"
|
||||||
#include "sbmtlapi.h"
|
#include "sbmtlapi.h"
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,27 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("configuration")
|
sys.path.append("configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Setup')
|
||||||
|
parser.add_argument('--noconf', '-nc', action='store_true')
|
||||||
|
parser.add_argument('--noverify', '-nv', action='store_true')
|
||||||
|
# parser.add_argument('--haltonerror', '-eh', action='store_true')
|
||||||
|
parser.add_argument('--includeproject', '-ipj', nargs='+')
|
||||||
|
parser.add_argument('--excludeproject', '-epj', nargs='+')
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.includeproject == None and not args.excludeproject == None:
|
||||||
|
print "ERROR --includeproject cannot be combined with --excludeproject, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if not args.includeprocess == None and not args.excludeprocess == None:
|
||||||
|
print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -35,8 +53,12 @@ try:
|
||||||
from buildsite import *
|
from buildsite import *
|
||||||
except ImportError:
|
except ImportError:
|
||||||
printLog(log, "*** FIRST RUN ***")
|
printLog(log, "*** FIRST RUN ***")
|
||||||
|
if args.noconf:
|
||||||
|
printLog(log, "ERROR --noconf is invalid on first run, exit.")
|
||||||
|
exit()
|
||||||
from tools import *
|
from tools import *
|
||||||
|
|
||||||
|
if not args.noconf:
|
||||||
try:
|
try:
|
||||||
BuildQuality
|
BuildQuality
|
||||||
except NameError:
|
except NameError:
|
||||||
|
@ -44,11 +66,11 @@ except NameError:
|
||||||
try:
|
try:
|
||||||
ToolDirectories
|
ToolDirectories
|
||||||
except NameError:
|
except NameError:
|
||||||
ToolDirectories = [ 'R:/code/nel', 'R:/code/ryzom/tools' ]
|
ToolDirectories = [ 'R:/build/dev/bin/Release', 'D:/libraries/external/bin' ]
|
||||||
try:
|
try:
|
||||||
ToolSuffix
|
ToolSuffix
|
||||||
except NameError:
|
except NameError:
|
||||||
ToolSuffix = "_r.exe"
|
ToolSuffix = ".exe"
|
||||||
try:
|
try:
|
||||||
ScriptDirectory
|
ScriptDirectory
|
||||||
except NameError:
|
except NameError:
|
||||||
|
@ -112,7 +134,7 @@ except NameError:
|
||||||
try:
|
try:
|
||||||
WindowsExeDllCfgDirectories
|
WindowsExeDllCfgDirectories
|
||||||
except NameError:
|
except NameError:
|
||||||
WindowsExeDllCfgDirectories = [ 'C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86', 'D:/source/external_local/bin/x86', 'D:/source/external_shared/bin/x86', 'R:/code/nel/lib', 'R:/code/ryzom/bin', 'R:/code/ryzom/client', 'R:/code/ryzom/tools/client/client_config/bin' ]
|
WindowsExeDllCfgDirectories = [ 'C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86', 'D:/libraries/external/bin', 'R:/build/dev/bin/Release', 'R:/code/ryzom/client', 'R:/code/nel/lib', 'R:/code/ryzom/bin', 'R:/code/ryzom/tools/client/client_config/bin' ]
|
||||||
try:
|
try:
|
||||||
MaxAvailable
|
MaxAvailable
|
||||||
except NameError:
|
except NameError:
|
||||||
|
@ -262,9 +284,16 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each project
|
# For each project
|
||||||
for projectName in ProjectsToProcess:
|
for projectName in ProjectsToProcess:
|
||||||
|
if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
|
||||||
|
printLog(log, "PROJECT " + projectName)
|
||||||
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
||||||
os.chdir("processes")
|
os.chdir("processes")
|
||||||
try:
|
try:
|
||||||
|
if not args.includeprocess == None:
|
||||||
|
subprocess.call([ "python", "0_setup.py", "--includeprocess" ] + args.includeprocess)
|
||||||
|
elif not args.excludeprocess == None:
|
||||||
|
subprocess.call([ "python", "0_setup.py", "--excludeprocess" ] + args.excludeprocess)
|
||||||
|
else:
|
||||||
subprocess.call([ "python", "0_setup.py" ])
|
subprocess.call([ "python", "0_setup.py" ])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
@ -276,8 +305,62 @@ for projectName in ProjectsToProcess:
|
||||||
log.write(projectLogData)
|
log.write(projectLogData)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROJECT " + projectName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
|
# Additional directories
|
||||||
|
printLog(log, ">>> Setup additional directories <<<")
|
||||||
|
mkPath(log, ClientDevDirectory)
|
||||||
|
mkPath(log, ClientPatchDirectory)
|
||||||
|
mkPath(log, ClientInstallDirectory)
|
||||||
|
|
||||||
|
if not args.noverify:
|
||||||
|
printLog(log, "")
|
||||||
|
printLog(log, "-------")
|
||||||
|
printLog(log, "--- Verify tool paths")
|
||||||
|
printLog(log, "-------")
|
||||||
|
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
|
printLog(log, "")
|
||||||
|
if MaxAvailable:
|
||||||
|
findMax(log, MaxDirectory, MaxExecutable)
|
||||||
|
findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, ZoneDependenciesTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, ZoneWelderTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildRbankTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildIndoorRbankTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildIgBoxesTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, GetNeighborsTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, ZoneLighterTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, ZoneIgLighterTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, IgLighterTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, TileEditTool, ToolSuffix)
|
||||||
|
# findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) # kaetemi stuff, ignore this
|
||||||
|
findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix)
|
||||||
|
# findTool(log, ToolDirectories, BuildSheetsTool, ToolSuffix) # kaetemi stuff, ignore this
|
||||||
|
# findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix) # kaetemi stuff, ignore this
|
||||||
|
findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, LandExportTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, PrimExportTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, IgElevationTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, IgAddTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, TgaCutTool, ToolSuffix)
|
||||||
|
findTool(log, ToolDirectories, PatchGenTool, ToolSuffix)
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
if os.path.isfile("0_setup.log"):
|
if os.path.isfile("0_setup.log"):
|
||||||
os.remove("0_setup.log")
|
os.remove("0_setup.log")
|
||||||
|
|
|
@ -24,9 +24,25 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("configuration")
|
sys.path.append("configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Export')
|
||||||
|
# parser.add_argument('--haltonerror', '-eh', action='store_true')
|
||||||
|
parser.add_argument('--includeproject', '-ipj', nargs='+')
|
||||||
|
parser.add_argument('--excludeproject', '-epj', nargs='+')
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.includeproject == None and not args.excludeproject == None:
|
||||||
|
print "ERROR --includeproject cannot be combined with --excludeproject, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if not args.includeprocess == None and not args.excludeprocess == None:
|
||||||
|
print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -46,9 +62,16 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each project
|
# For each project
|
||||||
for projectName in ProjectsToProcess:
|
for projectName in ProjectsToProcess:
|
||||||
|
if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
|
||||||
|
printLog(log, "PROJECT " + projectName)
|
||||||
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
||||||
os.chdir("processes")
|
os.chdir("processes")
|
||||||
try:
|
try:
|
||||||
|
if not args.includeprocess == None:
|
||||||
|
subprocess.call([ "python", "1_export.py", "--includeprocess" ] + args.includeprocess)
|
||||||
|
elif not args.excludeprocess == None:
|
||||||
|
subprocess.call([ "python", "1_export.py", "--excludeprocess" ] + args.excludeprocess)
|
||||||
|
else:
|
||||||
subprocess.call([ "python", "1_export.py" ])
|
subprocess.call([ "python", "1_export.py" ])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
@ -60,6 +83,8 @@ for projectName in ProjectsToProcess:
|
||||||
log.write(projectLogData)
|
log.write(projectLogData)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROJECT " + projectName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -24,9 +24,25 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("configuration")
|
sys.path.append("configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Build')
|
||||||
|
# parser.add_argument('--haltonerror', '-eh', action='store_true')
|
||||||
|
parser.add_argument('--includeproject', '-ipj', nargs='+')
|
||||||
|
parser.add_argument('--excludeproject', '-epj', nargs='+')
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.includeproject == None and not args.excludeproject == None:
|
||||||
|
print "ERROR --includeproject cannot be combined with --excludeproject, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if not args.includeprocess == None and not args.excludeprocess == None:
|
||||||
|
print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -46,9 +62,16 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each project
|
# For each project
|
||||||
for projectName in ProjectsToProcess:
|
for projectName in ProjectsToProcess:
|
||||||
|
if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
|
||||||
|
printLog(log, "PROJECT " + projectName)
|
||||||
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
||||||
os.chdir("processes")
|
os.chdir("processes")
|
||||||
try:
|
try:
|
||||||
|
if not args.includeprocess == None:
|
||||||
|
subprocess.call([ "python", "2_build.py", "--includeprocess" ] + args.includeprocess)
|
||||||
|
elif not args.excludeprocess == None:
|
||||||
|
subprocess.call([ "python", "2_build.py", "--excludeprocess" ] + args.excludeprocess)
|
||||||
|
else:
|
||||||
subprocess.call([ "python", "2_build.py" ])
|
subprocess.call([ "python", "2_build.py" ])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
@ -60,6 +83,8 @@ for projectName in ProjectsToProcess:
|
||||||
log.write(projectLogData)
|
log.write(projectLogData)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROJECT " + projectName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -24,9 +24,25 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("configuration")
|
sys.path.append("configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Install')
|
||||||
|
# parser.add_argument('--haltonerror', '-eh', action='store_true')
|
||||||
|
parser.add_argument('--includeproject', '-ipj', nargs='+')
|
||||||
|
parser.add_argument('--excludeproject', '-epj', nargs='+')
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.includeproject == None and not args.excludeproject == None:
|
||||||
|
print "ERROR --includeproject cannot be combined with --excludeproject, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
|
if not args.includeprocess == None and not args.excludeprocess == None:
|
||||||
|
print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
|
||||||
|
exit()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -46,9 +62,16 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each project
|
# For each project
|
||||||
for projectName in ProjectsToProcess:
|
for projectName in ProjectsToProcess:
|
||||||
|
if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
|
||||||
|
printLog(log, "PROJECT " + projectName)
|
||||||
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
|
||||||
os.chdir("processes")
|
os.chdir("processes")
|
||||||
try:
|
try:
|
||||||
|
if not args.includeprocess == None:
|
||||||
|
subprocess.call([ "python", "3_install.py", "--includeprocess" ] + args.includeprocess)
|
||||||
|
elif not args.excludeprocess == None:
|
||||||
|
subprocess.call([ "python", "3_install.py", "--excludeprocess" ] + args.excludeprocess)
|
||||||
|
else:
|
||||||
subprocess.call([ "python", "3_install.py" ])
|
subprocess.call([ "python", "3_install.py" ])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
@ -60,6 +83,8 @@ for projectName in ProjectsToProcess:
|
||||||
log.write(projectLogData)
|
log.write(projectLogData)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + projectName + "> " + str(e))
|
printLog(log, "<" + projectName + "> " + str(e))
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROJECT " + projectName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -45,13 +45,6 @@ printLog(log, "-------")
|
||||||
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
# Find tools
|
|
||||||
BnpMake = findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix)
|
|
||||||
printLog(log, "")
|
|
||||||
|
|
||||||
if BnpMake == "":
|
|
||||||
toolLogFail(log, BnpMakeTool, ToolSuffix)
|
|
||||||
else:
|
|
||||||
for category in InstallClientData:
|
for category in InstallClientData:
|
||||||
printLog(log, "CATEGORY " + category["Name"])
|
printLog(log, "CATEGORY " + category["Name"])
|
||||||
if (category["UnpackTo"] != None):
|
if (category["UnpackTo"] != None):
|
||||||
|
@ -64,26 +57,18 @@ else:
|
||||||
mkPath(log, InstallDirectory + "/" + package[0])
|
mkPath(log, InstallDirectory + "/" + package[0])
|
||||||
copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath)
|
copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath)
|
||||||
else:
|
else:
|
||||||
|
sourcePath = ClientPatchDirectory + "/bnp"
|
||||||
targetPath = ClientInstallDirectory + "/data"
|
targetPath = ClientInstallDirectory + "/data"
|
||||||
mkPath(log, targetPath)
|
mkPath(log, targetPath)
|
||||||
for package in category["Packages"]:
|
for package in category["Packages"]:
|
||||||
printLog(log, "PACKAGE " + package[0])
|
printLog(log, "PACKAGE " + package[0])
|
||||||
sourcePath = InstallDirectory + "/" + package[0]
|
sourceBnp = sourcePath + "/" + package[0] + ".bnp"
|
||||||
mkPath(log, sourcePath)
|
|
||||||
targetBnp = targetPath + "/" + package[0] + ".bnp"
|
targetBnp = targetPath + "/" + package[0] + ".bnp"
|
||||||
if (len(package[1]) > 0):
|
if (len(package[1]) > 0):
|
||||||
|
sourceBnp = sourcePath + "/" + package[1][0]
|
||||||
targetBnp = targetPath + "/" + package[1][0]
|
targetBnp = targetPath + "/" + package[1][0]
|
||||||
printLog(log, "TARGET " + package[1][0])
|
printLog(log, "TARGET " + package[1][0])
|
||||||
needUpdateBnp = 1
|
copyFileIfNeeded(log, sourceBnp, targetBnp)
|
||||||
if (len(package) > 2):
|
|
||||||
needUpdateBnp = needUpdate(log, sourcePath + "/" + package[2], targetBnp)
|
|
||||||
else:
|
|
||||||
needUpdateBnp = needUpdateDirNoSubdirFile(log, sourcePath, targetBnp)
|
|
||||||
if (needUpdateBnp):
|
|
||||||
printLog(log, "BNP " + targetBnp)
|
|
||||||
subprocess.call([ BnpMake, "/p", sourcePath, targetPath ] + package[1])
|
|
||||||
else:
|
|
||||||
printLog(log, "SKIP " + targetBnp)
|
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -69,10 +69,10 @@ ZoneIgLighterTool = "zone_ig_lighter"
|
||||||
IgLighterTool = "ig_lighter"
|
IgLighterTool = "ig_lighter"
|
||||||
AnimBuilderTool = "anim_builder"
|
AnimBuilderTool = "anim_builder"
|
||||||
TileEditTool = "tile_edit"
|
TileEditTool = "tile_edit"
|
||||||
BuildImagesetTool = "th_build_imageset"
|
# BuildImagesetTool = "th_build_imageset" # kaetemi stuff, ignore this
|
||||||
MakeSheetIdTool = "make_sheet_id"
|
MakeSheetIdTool = "make_sheet_id"
|
||||||
BuildSheetsTool = "th_build_sheets"
|
# BuildSheetsTool = "th_build_sheets" # kaetemi stuff, ignore this
|
||||||
BuildSoundTool = "th_build_sound"
|
# BuildSoundTool = "th_build_sound" # kaetemi stuff, ignore this
|
||||||
BuildCoarseMeshTool = "build_coarse_mesh"
|
BuildCoarseMeshTool = "build_coarse_mesh"
|
||||||
LightmapOptimizerTool = "lightmap_optimizer"
|
LightmapOptimizerTool = "lightmap_optimizer"
|
||||||
BuildClodtexTool = "build_clodtex"
|
BuildClodtexTool = "build_clodtex"
|
||||||
|
|
|
@ -24,8 +24,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/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("../configuration")
|
sys.path.append("../configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -60,6 +66,8 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each process
|
# For each process
|
||||||
for processName in ProcessToComplete:
|
for processName in ProcessToComplete:
|
||||||
|
if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)):
|
||||||
|
printLog(log, "PROCESS " + processName)
|
||||||
os.chdir(processName)
|
os.chdir(processName)
|
||||||
try:
|
try:
|
||||||
subprocess.call([ "python", "0_setup.py" ])
|
subprocess.call([ "python", "0_setup.py" ])
|
||||||
|
@ -74,6 +82,8 @@ for processName in ProcessToComplete:
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + processName + "> " + str(e))
|
printLog(log, "<" + processName + "> " + str(e))
|
||||||
# subprocess.call("idle.bat")
|
# subprocess.call("idle.bat")
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROCESS " + processName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
|
@ -24,9 +24,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/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
import time, sys, os, shutil, subprocess, distutils.dir_util
|
import time, sys, os, shutil, subprocess, distutils.dir_util, argparse
|
||||||
sys.path.append("../configuration")
|
sys.path.append("../configuration")
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--includeprocess', '-ipc', nargs='+')
|
||||||
|
parser.add_argument('--excludeprocess', '-epc', nargs='+')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if os.path.isfile("log.log"):
|
if os.path.isfile("log.log"):
|
||||||
os.remove("log.log")
|
os.remove("log.log")
|
||||||
log = open("log.log", "w")
|
log = open("log.log", "w")
|
||||||
|
@ -45,6 +50,8 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
# For each process
|
# For each process
|
||||||
for processName in ProcessToComplete:
|
for processName in ProcessToComplete:
|
||||||
|
if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)):
|
||||||
|
printLog(log, "PROCESS " + processName)
|
||||||
os.chdir(processName)
|
os.chdir(processName)
|
||||||
try:
|
try:
|
||||||
subprocess.call([ "python", "1_export.py" ])
|
subprocess.call([ "python", "1_export.py" ])
|
||||||
|
@ -59,6 +66,8 @@ for processName in ProcessToComplete:
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
printLog(log, "<" + processName + "> " + str(e))
|
printLog(log, "<" + processName + "> " + str(e))
|
||||||
# subprocess.call("idle.bat")
|
# subprocess.call("idle.bat")
|
||||||
|
else:
|
||||||
|
printLog(log, "IGNORE PROCESS " + processName)
|
||||||
printLog(log, "")
|
printLog(log, "")
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue