mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-09 16:59:02 +00:00
correction du merge
This commit is contained in:
parent
3e9c116530
commit
6a92d08499
91 changed files with 155477 additions and 183810 deletions
|
@ -48,7 +48,7 @@ MACRO(NL_CONFIGURE_CHECKS)
|
|||
SET(COPYRIGHT "${YEAR} ${AUTHOR}")
|
||||
|
||||
IF(NOT RYZOM_CLIENT_ICON)
|
||||
SET(RYZOM_CLIENT_ICON "khanat_client")
|
||||
SET(RYZOM_CLIENT_ICON "ryzom_client")
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
||||
|
|
|
@ -1,101 +1,101 @@
|
|||
# - Find DirectInput
|
||||
# Find the DirectSound includes and libraries
|
||||
#
|
||||
# MAXSDK_DIR - 3DSMAX SDK root directory
|
||||
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
||||
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
||||
# MAXSDK_FOUND - True if MAX SDK found.
|
||||
|
||||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
FIND_PATH(MAXSDK_DIR
|
||||
"include/maxversion.h"
|
||||
HINTS
|
||||
"$ENV{MAXSDK_DIR}"
|
||||
PATHS
|
||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
|
||||
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_INCLUDE_DIR
|
||||
max.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include/CS
|
||||
)
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release)
|
||||
ELSE()
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO()
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GFX_LIBRARY gfx)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MESH_LIBRARY mesh)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXUTIL_LIBRARY maxutil)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXSCRIPT_LIBRARY maxscrpt)
|
||||
FIND_3DS_LIBRARY(MAXSDK_PARAMBLK2_LIBRARY paramblk2)
|
||||
FIND_3DS_LIBRARY(MAXSDK_BMM_LIBRARY bmm)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set MAXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MAXSDK DEFAULT_MSG
|
||||
MAXSDK_INCLUDE_DIR MAXSDK_CORE_LIBRARY)
|
||||
|
||||
if(MAXSDK_FOUND)
|
||||
SET(MAXSDK_LIBRARIES
|
||||
${MAXSDK_CORE_LIBRARY}
|
||||
${MAXSDK_GEOM_LIBRARY}
|
||||
${MAXSDK_GFX_LIBRARY}
|
||||
${MAXSDK_MESH_LIBRARY}
|
||||
${MAXSDK_MAXUTIL_LIBRARY}
|
||||
${MAXSDK_MAXSCRIPT_LIBRARY}
|
||||
${MAXSDK_PARAMBLK2_LIBRARY}
|
||||
${MAXSDK_BMM_LIBRARY})
|
||||
|
||||
# parse maxversion.h to determine SDK version
|
||||
IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h")
|
||||
FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)")
|
||||
|
||||
STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}")
|
||||
UNSET(LINES)
|
||||
ELSE()
|
||||
SET(MAXSDK_VERSION "Unknown")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}")
|
||||
|
||||
# 3ds Max 2013 and later are always Unicode
|
||||
IF(MAXSDK_VERSION VERSION_GREATER 2012)
|
||||
SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE)
|
||||
ELSE()
|
||||
SET(MAXSDK_DEFINITIONS)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
set(MAXSDK_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)
|
||||
# - Find DirectInput
|
||||
# Find the DirectSound includes and libraries
|
||||
#
|
||||
# MAXSDK_DIR - 3DSMAX SDK root directory
|
||||
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
||||
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
||||
# MAXSDK_FOUND - True if MAX SDK found.
|
||||
|
||||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
FIND_PATH(MAXSDK_DIR
|
||||
"include/maxversion.h"
|
||||
HINTS
|
||||
"$ENV{MAXSDK_DIR}"
|
||||
PATHS
|
||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
|
||||
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_INCLUDE_DIR
|
||||
max.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include/CS
|
||||
)
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release)
|
||||
ELSE()
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO()
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GFX_LIBRARY gfx)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MESH_LIBRARY mesh)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXUTIL_LIBRARY maxutil)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXSCRIPT_LIBRARY maxscrpt)
|
||||
FIND_3DS_LIBRARY(MAXSDK_PARAMBLK2_LIBRARY paramblk2)
|
||||
FIND_3DS_LIBRARY(MAXSDK_BMM_LIBRARY bmm)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set MAXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MAXSDK DEFAULT_MSG
|
||||
MAXSDK_INCLUDE_DIR MAXSDK_CORE_LIBRARY)
|
||||
|
||||
if(MAXSDK_FOUND)
|
||||
SET(MAXSDK_LIBRARIES
|
||||
${MAXSDK_CORE_LIBRARY}
|
||||
${MAXSDK_GEOM_LIBRARY}
|
||||
${MAXSDK_GFX_LIBRARY}
|
||||
${MAXSDK_MESH_LIBRARY}
|
||||
${MAXSDK_MAXUTIL_LIBRARY}
|
||||
${MAXSDK_MAXSCRIPT_LIBRARY}
|
||||
${MAXSDK_PARAMBLK2_LIBRARY}
|
||||
${MAXSDK_BMM_LIBRARY})
|
||||
|
||||
# parse maxversion.h to determine SDK version
|
||||
IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h")
|
||||
FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)")
|
||||
|
||||
STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}")
|
||||
UNSET(LINES)
|
||||
ELSE()
|
||||
SET(MAXSDK_VERSION "Unknown")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}")
|
||||
|
||||
# 3ds Max 2013 and later are always Unicode
|
||||
IF(MAXSDK_VERSION VERSION_GREATER 2012)
|
||||
SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE)
|
||||
ELSE()
|
||||
SET(MAXSDK_DEFINITIONS)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
set(MAXSDK_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
# - Locate MFC libraries
|
||||
# This module defines
|
||||
# MFC_FOUND, if false, do not try to link to MFC
|
||||
# MFC_LIBRARY_DIR, where to find libraries
|
||||
# MFC_INCLUDE_DIR, where to find headers
|
||||
|
||||
IF(CustomMFC_FIND_REQUIRED)
|
||||
SET(MFC_FIND_REQUIRED TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MFC_DIR)
|
||||
# If MFC have been found, remember their directory
|
||||
IF(VC_DIR)
|
||||
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(MFC_DIR
|
||||
include/afxwin.h
|
||||
HINTS
|
||||
${MFC_STANDARD_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Display an error message if MFC are not found, MFC_FOUND is updated
|
||||
# User will be able to update MFC_DIR to the correct directory
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
|
||||
|
||||
IF(MFC_FOUND)
|
||||
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
|
||||
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
IF(TARGET_X64)
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
|
||||
ELSE()
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
|
||||
ENDIF()
|
||||
|
||||
# Add MFC libraries directory to default library path
|
||||
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
|
||||
|
||||
# Set definitions for using MFC in DLL
|
||||
<<<<<<< HEAD
|
||||
SET(MFC_DEFINITIONS -D_AFXDLL)
|
||||
=======
|
||||
SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE)
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
# Set CMake flag to use MFC DLL
|
||||
SET(CMAKE_MFC_FLAG 2)
|
||||
ENDIF()
|
||||
|
||||
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
|
|
@ -1,50 +0,0 @@
|
|||
# - Locate MFC libraries
|
||||
# This module defines
|
||||
# MFC_FOUND, if false, do not try to link to MFC
|
||||
# MFC_LIBRARY_DIR, where to find libraries
|
||||
# MFC_INCLUDE_DIR, where to find headers
|
||||
|
||||
IF(CustomMFC_FIND_REQUIRED)
|
||||
SET(MFC_FIND_REQUIRED TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MFC_DIR)
|
||||
# If MFC have been found, remember their directory
|
||||
IF(VC_DIR)
|
||||
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(MFC_DIR
|
||||
include/afxwin.h
|
||||
HINTS
|
||||
${MFC_STANDARD_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Display an error message if MFC are not found, MFC_FOUND is updated
|
||||
# User will be able to update MFC_DIR to the correct directory
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
|
||||
|
||||
IF(MFC_FOUND)
|
||||
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
|
||||
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
IF(TARGET_X64)
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
|
||||
ELSE()
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
|
||||
ENDIF()
|
||||
|
||||
# Add MFC libraries directory to default library path
|
||||
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
|
||||
|
||||
# Set definitions for using MFC in DLL
|
||||
SET(MFC_DEFINITIONS -D_AFXDLL)
|
||||
|
||||
# Set CMake flag to use MFC DLL
|
||||
SET(CMAKE_MFC_FLAG 2)
|
||||
ENDIF()
|
||||
|
||||
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
|
|
@ -1,50 +0,0 @@
|
|||
# - Locate MFC libraries
|
||||
# This module defines
|
||||
# MFC_FOUND, if false, do not try to link to MFC
|
||||
# MFC_LIBRARY_DIR, where to find libraries
|
||||
# MFC_INCLUDE_DIR, where to find headers
|
||||
|
||||
IF(CustomMFC_FIND_REQUIRED)
|
||||
SET(MFC_FIND_REQUIRED TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MFC_DIR)
|
||||
# If MFC have been found, remember their directory
|
||||
IF(VC_DIR)
|
||||
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(MFC_DIR
|
||||
include/afxwin.h
|
||||
HINTS
|
||||
${MFC_STANDARD_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Display an error message if MFC are not found, MFC_FOUND is updated
|
||||
# User will be able to update MFC_DIR to the correct directory
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
|
||||
|
||||
IF(MFC_FOUND)
|
||||
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
|
||||
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
IF(TARGET_X64)
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
|
||||
ELSE()
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
|
||||
ENDIF()
|
||||
|
||||
# Add MFC libraries directory to default library path
|
||||
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
|
||||
|
||||
# Set definitions for using MFC in DLL
|
||||
SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE)
|
||||
|
||||
# Set CMake flag to use MFC DLL
|
||||
SET(CMAKE_MFC_FLAG 2)
|
||||
ENDIF()
|
||||
|
||||
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -865,7 +865,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
|
|||
}
|
||||
|
||||
// make sure the CSheetId singleton has been properly initialised
|
||||
NLMISC::CSheetId::init(updatePackedSheet);
|
||||
// NLMISC::CSheetId::init(updatePackedSheet);
|
||||
|
||||
// load the packed sheet if exists
|
||||
try
|
||||
|
|
|
@ -224,9 +224,6 @@ public:
|
|||
// ** Atom element methods
|
||||
|
||||
|
||||
/// Returns the type of the atom. NULL otherwise.
|
||||
virtual const class UType *getType () = 0;
|
||||
|
||||
/// Returns the type of the atom. NULL otherwise.
|
||||
virtual const class UType *getType () = 0;
|
||||
|
||||
|
|
|
@ -1,875 +0,0 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef __PRIMITIVE_H__
|
||||
#define __PRIMITIVE_H__
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/rgba.h"
|
||||
|
||||
// Forward declarations for libxml2
|
||||
typedef struct _xmlNode xmlNode;
|
||||
typedef xmlNode *xmlNodePtr;
|
||||
|
||||
typedef struct _xmlDoc xmlDoc;
|
||||
typedef xmlDoc *xmlDocPtr;
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NLLIGO
|
||||
{
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
# define NLLIGO_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Ligo primitives are used to add logical geometrical gameplay information.
|
||||
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
|
||||
* Ligo primitives have a CLASS.
|
||||
*
|
||||
* The primitive class defines the properties attached to the primitive
|
||||
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
|
||||
*/
|
||||
|
||||
class CPrimitives;
|
||||
class CLigoConfig;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void Register ();
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
*/
|
||||
class IProperty : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
IProperty ()
|
||||
{
|
||||
Default = false;
|
||||
}
|
||||
|
||||
// This property is set to default
|
||||
bool Default;
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const = 0;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a simple string
|
||||
*/
|
||||
class CPropertyString : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyString () {}
|
||||
<<<<<<< HEAD
|
||||
CPropertyString (const char *str);
|
||||
CPropertyString (const std::string &str);
|
||||
CPropertyString (const char *str, bool _default);
|
||||
=======
|
||||
CPropertyString (const std::string &str);
|
||||
CPropertyString (const std::string &str, bool _default);
|
||||
>>>>>>> ryzomcore
|
||||
virtual ~CPropertyString () {}
|
||||
std::string String;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyString)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(String);
|
||||
}
|
||||
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyStringArray : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyStringArray () {}
|
||||
virtual ~CPropertyStringArray () {}
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray);
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
|
||||
std::vector<std::string> StringArray;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyStringArray)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serialCont(StringArray);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyColor : public IProperty
|
||||
{
|
||||
public:
|
||||
NLMISC::CRGBA Color;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyColor)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(Color);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
|
||||
// ctors
|
||||
CPropertyColor() {}
|
||||
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimVector : public NLMISC::CVector
|
||||
{
|
||||
public:
|
||||
CPrimVector ()
|
||||
{
|
||||
Selected = false;
|
||||
}
|
||||
CPrimVector (const NLMISC::CVector &v)
|
||||
{
|
||||
CVector::operator= (v);
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
void serial(NLMISC::IStream &f)
|
||||
{
|
||||
CVector::serial(f);
|
||||
f.serial(Selected);
|
||||
}
|
||||
|
||||
bool Selected;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is the base class for ligo primitive.
|
||||
*
|
||||
* Provide access to common properties.
|
||||
* Provide access to the primitive hierachy
|
||||
*/
|
||||
class IPrimitive : public NLMISC::IStreamable
|
||||
{
|
||||
friend class CPrimitives;
|
||||
public:
|
||||
|
||||
// Deprecated
|
||||
// std::string Layer;
|
||||
// Deprecated
|
||||
// std::string Name;
|
||||
|
||||
// Expended in the tree view
|
||||
// bool Expanded;
|
||||
|
||||
enum
|
||||
{
|
||||
NotAnArray,
|
||||
AtTheEnd = 0xffffffff,
|
||||
};
|
||||
|
||||
/// \name Hierarchy
|
||||
IPrimitive ();
|
||||
|
||||
virtual ~IPrimitive ();
|
||||
|
||||
IPrimitive (const IPrimitive &node);
|
||||
|
||||
virtual void operator= (const IPrimitive &node);
|
||||
|
||||
/** Get the children primitive count */
|
||||
uint getNumChildren () const
|
||||
{
|
||||
return (uint)_Children.size ();
|
||||
}
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (const IPrimitive *&result, uint childId) const;
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (IPrimitive *&result, uint childId);
|
||||
|
||||
/** Get the parent primitive */
|
||||
IPrimitive *getParent ()
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
const IPrimitive *getParent () const
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
|
||||
/** Get the primitive relative to this and the given path */
|
||||
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
|
||||
|
||||
/** Get the id of the child, return 0xffffffff if not found */
|
||||
bool getChildId (uint &childId, const IPrimitive *child) const;
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (IPrimitive *child);
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (uint childId);
|
||||
|
||||
/// Remove the child primitive from the children list, don't delete it
|
||||
bool unlinkChild(IPrimitive *child);
|
||||
|
||||
/** Remove and delete all children primitives */
|
||||
void removeChildren ();
|
||||
|
||||
/**
|
||||
* Insert a child primitive before the index.
|
||||
* The pointer will be deleted by the parent primitive using the ::delete operator.
|
||||
* return false if the index is invalid
|
||||
*/
|
||||
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
|
||||
|
||||
/// \name Properties
|
||||
|
||||
/**
|
||||
* Get a num properties
|
||||
**/
|
||||
uint getNumProperty () const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, IProperty *&result);
|
||||
|
||||
/** Check the existence of a named property */
|
||||
bool checkProperty(const std::string &property_name) const;
|
||||
|
||||
/**
|
||||
* Add a property
|
||||
* If the property already exist, the method does nothing and returns false.
|
||||
* The pointer will be deleted by the primitive using the ::delete operator.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool addPropertyByName (const char *property_name, IProperty *result);
|
||||
=======
|
||||
bool addPropertyByName (const std::string &property_name, IProperty *result);
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, const IProperty *&result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, IProperty *&result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, IProperty *&result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, std::string *&result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, std::string *&result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, std::string &result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, std::string &result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Get a color property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
|
||||
=======
|
||||
bool getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
|
||||
**/
|
||||
bool removeProperty (uint index);
|
||||
|
||||
/**
|
||||
* Remove a property by its name
|
||||
**/
|
||||
<<<<<<< HEAD
|
||||
bool removePropertyByName (const char *property_name);
|
||||
=======
|
||||
bool removePropertyByName (const std::string &property_name);
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
/**
|
||||
* Remove all the properties
|
||||
**/
|
||||
void removeProperties ();
|
||||
|
||||
/* Init default primitive's parameters
|
||||
*
|
||||
* This method will add all the properties declared in the primitive class and create default properties.
|
||||
*/
|
||||
void initDefaultValues (CLigoConfig &config);
|
||||
|
||||
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &property_name, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &property_name) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const = 0;
|
||||
virtual const CPrimVector *getPrimVector () const = 0;
|
||||
virtual CPrimVector *getPrimVector () = 0;
|
||||
|
||||
// Make a copy
|
||||
virtual IPrimitive *copy () const = 0;
|
||||
|
||||
// used for fast binary save/load (exploitation mode)
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// shortcut to getPropertyByName("name", ret); return ret;
|
||||
std::string getName() const;
|
||||
|
||||
const std::string &getUnparsedProperties() const;
|
||||
void setUnparsedProperties(const std::string &unparsedProperties) const;
|
||||
|
||||
private:
|
||||
|
||||
// callback called just after the node is attach under a parent
|
||||
virtual void onLinkToParent() {}
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onUnlinkFromParent() {}
|
||||
|
||||
/// Callback called just after an ancestor is linked
|
||||
virtual void onBranchLink() {}
|
||||
/// Callback called just before an ancestor is unlinked
|
||||
virtual void onBranchUnlink() {}
|
||||
|
||||
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
|
||||
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
|
||||
|
||||
// internal recusive call
|
||||
void branchLink();
|
||||
void branchUnlink();
|
||||
|
||||
// Update child Id
|
||||
void updateChildId (uint index);
|
||||
|
||||
// Child id
|
||||
uint32 _ChildId;
|
||||
|
||||
// Parent
|
||||
IPrimitive *_Parent;
|
||||
|
||||
// Children
|
||||
std::vector<IPrimitive*> _Children;
|
||||
|
||||
// Single properties
|
||||
std::map<std::string, IProperty*> _Properties;
|
||||
|
||||
// Editor specific properties (unparsed)
|
||||
mutable std::string _UnparsedProperties;
|
||||
|
||||
|
||||
#ifdef NLLIGO_DEBUG
|
||||
std::string _DebugClassName;
|
||||
std::string _DebugPrimitiveName;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
// Simple primitive node
|
||||
class CPrimNode : public IPrimitive
|
||||
{
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimNode)
|
||||
|
||||
protected:
|
||||
|
||||
// void operator= (const CPrimNode &node);
|
||||
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimPoint : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CPrimPoint ()
|
||||
{
|
||||
Angle = 0;
|
||||
}
|
||||
|
||||
|
||||
CPrimVector Point;
|
||||
float Angle; // Angle on OZ, CCW
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPoint &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPoint);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CPrimPath : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPath &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPath);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimZone : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
|
||||
|
||||
public:
|
||||
|
||||
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
|
||||
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
|
||||
|
||||
// void operator= (const CPrimZone &node);
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
|
||||
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
|
||||
NLMISC::CVector getBarycentre() const;
|
||||
|
||||
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
|
||||
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
|
||||
|
||||
/// Return the area of the axis-aligned box containing the zone
|
||||
float getAreaOfAABox() const;
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimZone);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** This primitive type is used to handle unique alias across a primitive file.
|
||||
* Usage of this primitive imply the setting of the appropriate 'ligo context'
|
||||
* before reading or copy/pasting alias.
|
||||
*/
|
||||
class CPrimAlias : public IPrimitive
|
||||
{
|
||||
friend class CPrimitives;
|
||||
|
||||
/// The 'dynamic' part of the alias
|
||||
uint32 _Alias;
|
||||
/// The primitive container
|
||||
class CPrimitives *_Container;
|
||||
|
||||
// Needed overloads (not used)
|
||||
virtual uint getNumVector () const
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual const CPrimVector *getPrimVector () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual CPrimVector *getPrimVector ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
virtual void onBranchLink();
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onBranchUnlink();
|
||||
|
||||
void regenAlias();
|
||||
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimAlias);
|
||||
|
||||
// private default constructor
|
||||
CPrimAlias();
|
||||
// copy constructor needed
|
||||
CPrimAlias(const CPrimAlias &other);
|
||||
|
||||
~CPrimAlias();
|
||||
|
||||
// return the dynamic part of the alias
|
||||
uint32 getAlias() const;
|
||||
|
||||
// Return the full alias, merge of the static and dynamic part
|
||||
uint32 getFullAlias() const;
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
=======
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
>>>>>>> ryzomcore
|
||||
// Create a copy of this primitive
|
||||
virtual IPrimitive *copy () const;
|
||||
// serial for binary save
|
||||
virtual void serial (NLMISC::IStream &f);
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
This class is deprecated.
|
||||
*/
|
||||
class CPrimRegion
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::string Name;
|
||||
std::vector<CPrimPoint> VPoints;
|
||||
std::vector<CPrimZone> VZones;
|
||||
std::vector<CPrimPath> VPaths;
|
||||
|
||||
std::vector<bool> VHidePoints;
|
||||
std::vector<bool> VHideZones;
|
||||
std::vector<bool> VHidePaths;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/**
|
||||
* This class is a ligo primitives set
|
||||
*/
|
||||
class CPrimitives
|
||||
{
|
||||
public:
|
||||
|
||||
CPrimitives ();
|
||||
CPrimitives (const CPrimitives &other);
|
||||
~CPrimitives ();
|
||||
|
||||
// Operator copy
|
||||
CPrimitives& operator= (const CPrimitives &other);
|
||||
|
||||
// Convert from old format to the new one
|
||||
void convert (const CPrimRegion ®ion);
|
||||
|
||||
// Read the primitive
|
||||
<<<<<<< HEAD
|
||||
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlDocPtr xmlNode, const char *filename) const;
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlNodePtr root, const char *filename) const;
|
||||
=======
|
||||
bool read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlDocPtr xmlNode, const std::string &filename) const;
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlNodePtr root, const std::string &filename) const;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// serial the primitive. Used for binary files.
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// Root primitive hierarchy
|
||||
CPrimNode *RootNode;
|
||||
|
||||
// get the static alias part for this primitive
|
||||
uint32 getAliasStaticPart();
|
||||
|
||||
// set the static alias part for this primitive
|
||||
void setAliasStaticPart(uint32 staticPart);
|
||||
|
||||
// Build an alias by combining the static and dynamic part
|
||||
uint32 buildFullAlias(uint32 dynamicPart);
|
||||
|
||||
// Generate a new unique alias (dynamic part only)
|
||||
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
|
||||
// Reserve an alias and store it in the used alias list (dynamic part only)
|
||||
// void reserveAlias(uint32 dynamicAlias);
|
||||
// Remove an alias from the list of alias in use (dynamic part only)
|
||||
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
|
||||
|
||||
// Force the assignation of the specified alias to the primitive. If another primitive
|
||||
// already hold the alias, this other primitive is assigned a new alias.
|
||||
void forceAlias(CPrimAlias *prim, uint32 alias);
|
||||
|
||||
// get the last generated alias value (for debug only)
|
||||
uint32 getLastGeneratedAlias();
|
||||
|
||||
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
|
||||
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
|
||||
|
||||
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
|
||||
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
|
||||
|
||||
|
||||
private:
|
||||
// Conversion internal methods
|
||||
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
|
||||
void convertPrimitive (const IPrimitive *prim, bool hidden);
|
||||
|
||||
/// Optional context information
|
||||
CLigoConfig *_LigoConfig;
|
||||
/// Static part alias mapping (can be 0 if no mapping is defined)
|
||||
uint32 _AliasStaticPart;
|
||||
/// Last generated Alias, used to compute the next alias
|
||||
uint32 _LastGeneratedAlias;
|
||||
/// List of alias in use in the primitive (dynamic part only)
|
||||
std::map<uint32, IPrimitive*> _AliasInUse;
|
||||
// Store the filename
|
||||
// This allows to retrieve the static alias when reloading from binary file
|
||||
std::string _Filename;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** Singleton to manage special loading feature related to
|
||||
* unique alias assignment
|
||||
*/
|
||||
class CPrimitiveContext
|
||||
{
|
||||
static CPrimitiveContext *_Instance;
|
||||
|
||||
// private ctor
|
||||
CPrimitiveContext();
|
||||
public:
|
||||
|
||||
// get the singleton reference
|
||||
static CPrimitiveContext &instance()
|
||||
{
|
||||
if (!_Instance)
|
||||
{
|
||||
_Instance = new CPrimitiveContext;
|
||||
}
|
||||
|
||||
return *_Instance;
|
||||
}
|
||||
|
||||
/// The current ligo configuration file.
|
||||
CLigoConfig *CurrentLigoConfig;
|
||||
/// The current primitives container.
|
||||
CPrimitives *CurrentPrimitive;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace NLLIGO
|
||||
|
||||
#endif // __PRIMITIVE_H__
|
||||
|
|
@ -1,781 +0,0 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef __PRIMITIVE_H__
|
||||
#define __PRIMITIVE_H__
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/rgba.h"
|
||||
|
||||
// Include from libxml2
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NLLIGO
|
||||
{
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
# define NLLIGO_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Ligo primitives are used to add logical geometrical gameplay informations.
|
||||
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
|
||||
* Ligo primitives have a CLASS.
|
||||
*
|
||||
* The primitive class defines the properties attached to the primitive
|
||||
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
|
||||
*/
|
||||
|
||||
class CPrimitives;
|
||||
class CLigoConfig;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void Register ();
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
*/
|
||||
class IProperty : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
IProperty ()
|
||||
{
|
||||
Default = false;
|
||||
}
|
||||
|
||||
// This property is set to default
|
||||
bool Default;
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const = 0;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a simple string
|
||||
*/
|
||||
class CPropertyString : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyString () {}
|
||||
CPropertyString (const char *str);
|
||||
CPropertyString (const std::string &str);
|
||||
CPropertyString (const char *str, bool _default);
|
||||
virtual ~CPropertyString () {}
|
||||
std::string String;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyString)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(String);
|
||||
}
|
||||
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyStringArray : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyStringArray () {}
|
||||
virtual ~CPropertyStringArray () {}
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray);
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
|
||||
std::vector<std::string> StringArray;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyStringArray)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serialCont(StringArray);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyColor : public IProperty
|
||||
{
|
||||
public:
|
||||
NLMISC::CRGBA Color;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyColor)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(Color);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
|
||||
// ctors
|
||||
CPropertyColor() {}
|
||||
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimVector : public NLMISC::CVector
|
||||
{
|
||||
public:
|
||||
CPrimVector ()
|
||||
{
|
||||
Selected = false;
|
||||
}
|
||||
CPrimVector (const NLMISC::CVector &v)
|
||||
{
|
||||
CVector::operator= (v);
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
void serial(NLMISC::IStream &f)
|
||||
{
|
||||
CVector::serial(f);
|
||||
f.serial(Selected);
|
||||
}
|
||||
|
||||
bool Selected;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is the base class for ligo primitive.
|
||||
*
|
||||
* Provide access to common properties.
|
||||
* Provide access to the primitive hierachy
|
||||
*/
|
||||
class IPrimitive : public NLMISC::IStreamable
|
||||
{
|
||||
friend class CPrimitives;
|
||||
public:
|
||||
|
||||
// Deprecated
|
||||
// std::string Layer;
|
||||
// Deprecated
|
||||
// std::string Name;
|
||||
|
||||
// Expended in the tree view
|
||||
// bool Expanded;
|
||||
|
||||
enum
|
||||
{
|
||||
NotAnArray,
|
||||
AtTheEnd = 0xffffffff,
|
||||
};
|
||||
|
||||
/// \name Hierarchy
|
||||
IPrimitive ();
|
||||
|
||||
virtual ~IPrimitive ();
|
||||
|
||||
IPrimitive (const IPrimitive &node);
|
||||
|
||||
virtual void operator= (const IPrimitive &node);
|
||||
|
||||
/** Get the children primitive count */
|
||||
uint getNumChildren () const
|
||||
{
|
||||
return _Children.size ();
|
||||
}
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (const IPrimitive *&result, uint childId) const;
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (IPrimitive *&result, uint childId);
|
||||
|
||||
/** Get the parent primitive */
|
||||
IPrimitive *getParent ()
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
const IPrimitive *getParent () const
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
|
||||
/** Get the primitive relative to this and the given path */
|
||||
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
|
||||
|
||||
/** Get the id of the child, return 0xffffffff if not found */
|
||||
bool getChildId (uint &childId, const IPrimitive *child) const;
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (IPrimitive *child);
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (uint childId);
|
||||
|
||||
/// Remove the child primitive from the children list, don't delete it
|
||||
bool unlinkChild(IPrimitive *child);
|
||||
|
||||
/** Remove and delete all children primitives */
|
||||
void removeChildren ();
|
||||
|
||||
/**
|
||||
* Insert a child primitive before the index.
|
||||
* The pointer will be deleted by the parent primitive using the ::delete operator.
|
||||
* return false if the index is invalid
|
||||
*/
|
||||
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
|
||||
|
||||
/// \name Properties
|
||||
|
||||
/**
|
||||
* Get a num properties
|
||||
**/
|
||||
uint getNumProperty () const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, IProperty *&result);
|
||||
|
||||
/** Check the existence of a named property */
|
||||
bool checkProperty(const std::string &property_name) const;
|
||||
|
||||
/**
|
||||
* Add a property
|
||||
* If the property already exist, the method does nothing and returns false.
|
||||
* The pointer will be deleted by the primitive using the ::delete operator.
|
||||
**/
|
||||
bool addPropertyByName (const char *property_name, IProperty *result);
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::string *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::string &result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a color property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
|
||||
**/
|
||||
bool removeProperty (uint index);
|
||||
|
||||
/**
|
||||
* Remove a property by its name
|
||||
**/
|
||||
bool removePropertyByName (const char *property_name);
|
||||
|
||||
/**
|
||||
* Remove all the properties
|
||||
**/
|
||||
void removeProperties ();
|
||||
|
||||
/* Init default primitive's parameters
|
||||
*
|
||||
* This method will add all the properties declared in the primitive class and create default properties.
|
||||
*/
|
||||
void initDefaultValues (CLigoConfig &config);
|
||||
|
||||
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const = 0;
|
||||
virtual const CPrimVector *getPrimVector () const = 0;
|
||||
virtual CPrimVector *getPrimVector () = 0;
|
||||
|
||||
// Make a copy
|
||||
virtual IPrimitive *copy () const = 0;
|
||||
|
||||
// used for fast binary save/load (exploitation mode)
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// shortcut to getPropertyByName("name", ret); return ret;
|
||||
std::string getName() const;
|
||||
|
||||
const std::string &getUnparsedProperties() const;
|
||||
void setUnparsedProperties(const std::string &unparsedProperties) const;
|
||||
|
||||
private:
|
||||
|
||||
// callback called just after the node is attach under a parent
|
||||
virtual void onLinkToParent() {}
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onUnlinkFromParent() {}
|
||||
|
||||
/// Callback called just after an ancestor is linked
|
||||
virtual void onBranchLink() {}
|
||||
/// Callback called just before an ancestor is unlinked
|
||||
virtual void onBranchUnlink() {}
|
||||
|
||||
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
|
||||
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
|
||||
|
||||
// internal recusive call
|
||||
void branchLink();
|
||||
void branchUnlink();
|
||||
|
||||
// Update child Id
|
||||
void updateChildId (uint index);
|
||||
|
||||
// Child id
|
||||
uint32 _ChildId;
|
||||
|
||||
// Parent
|
||||
IPrimitive *_Parent;
|
||||
|
||||
// Children
|
||||
std::vector<IPrimitive*> _Children;
|
||||
|
||||
// Single properties
|
||||
std::map<std::string, IProperty*> _Properties;
|
||||
|
||||
// Editor specific properties (unparsed)
|
||||
mutable std::string _UnparsedProperties;
|
||||
|
||||
|
||||
#ifdef NLLIGO_DEBUG
|
||||
std::string _DebugClassName;
|
||||
std::string _DebugPrimitiveName;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
// Simple primitive node
|
||||
class CPrimNode : public IPrimitive
|
||||
{
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimNode)
|
||||
|
||||
protected:
|
||||
|
||||
// void operator= (const CPrimNode &node);
|
||||
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimPoint : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CPrimPoint ()
|
||||
{
|
||||
Angle = 0;
|
||||
}
|
||||
|
||||
|
||||
CPrimVector Point;
|
||||
float Angle; // Angle on OZ, CCW
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPoint &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPoint);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CPrimPath : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPath &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPath);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimZone : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
|
||||
|
||||
public:
|
||||
|
||||
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
|
||||
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
|
||||
|
||||
// void operator= (const CPrimZone &node);
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
|
||||
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
|
||||
NLMISC::CVector getBarycentre() const;
|
||||
|
||||
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
|
||||
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
|
||||
|
||||
/// Return the area of the axis-aligned box containing the zone
|
||||
float getAreaOfAABox() const;
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimZone);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** This primitive type is used to handle unique alias across a primitive file.
|
||||
* Usage of this primitive imply the setting of the appropriate 'ligo context'
|
||||
* before reading or copy/pasting alias.
|
||||
*/
|
||||
class CPrimAlias : public IPrimitive
|
||||
{
|
||||
friend class CPrimitives;
|
||||
|
||||
/// The 'dynamic' part of the alias
|
||||
uint32 _Alias;
|
||||
/// The primitive container
|
||||
class CPrimitives *_Container;
|
||||
|
||||
// Needed overloads (not used)
|
||||
virtual uint getNumVector () const
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual const CPrimVector *getPrimVector () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual CPrimVector *getPrimVector ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
virtual void onBranchLink();
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onBranchUnlink();
|
||||
|
||||
void regenAlias();
|
||||
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimAlias);
|
||||
|
||||
// private default constructor
|
||||
CPrimAlias();
|
||||
// copy constructor needed
|
||||
CPrimAlias(const CPrimAlias &other);
|
||||
|
||||
~CPrimAlias();
|
||||
|
||||
// return the dynamic part of the alias
|
||||
uint32 getAlias() const;
|
||||
|
||||
// Return the full alias, merge of the static and dynamic part
|
||||
uint32 getFullAlias() const;
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
// Create a copy of this primitive
|
||||
virtual IPrimitive *copy () const;
|
||||
// serial for binary save
|
||||
virtual void serial (NLMISC::IStream &f);
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
This class is deprecated.
|
||||
*/
|
||||
class CPrimRegion
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::string Name;
|
||||
std::vector<CPrimPoint> VPoints;
|
||||
std::vector<CPrimZone> VZones;
|
||||
std::vector<CPrimPath> VPaths;
|
||||
|
||||
std::vector<bool> VHidePoints;
|
||||
std::vector<bool> VHideZones;
|
||||
std::vector<bool> VHidePaths;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/**
|
||||
* This class is a ligo primitives set
|
||||
*/
|
||||
class CPrimitives
|
||||
{
|
||||
public:
|
||||
|
||||
CPrimitives ();
|
||||
CPrimitives (const CPrimitives &other);
|
||||
~CPrimitives ();
|
||||
|
||||
// Operator copy
|
||||
CPrimitives& operator= (const CPrimitives &other);
|
||||
|
||||
// Convert from old format to the new one
|
||||
void convert (const CPrimRegion ®ion);
|
||||
|
||||
// Read the primitive
|
||||
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlDocPtr xmlNode, const char *filename) const;
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlNodePtr root, const char *filename) const;
|
||||
|
||||
// serial the primitive. Used for binary files.
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// Root primitive hierarchy
|
||||
CPrimNode *RootNode;
|
||||
|
||||
// get the static alias part for this primitive
|
||||
uint32 getAliasStaticPart();
|
||||
|
||||
// set the static alias part for this primitive
|
||||
void setAliasStaticPart(uint32 staticPart);
|
||||
|
||||
// Build an alias by combining the static and dynamic part
|
||||
uint32 buildFullAlias(uint32 dynamicPart);
|
||||
|
||||
// Generate a new unique alias (dynamic part only)
|
||||
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
|
||||
// Reserve an alias and store it in the used alias list (dynamic part only)
|
||||
// void reserveAlias(uint32 dynamicAlias);
|
||||
// Remove an alias from the list of alias in use (dynamic part only)
|
||||
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
|
||||
|
||||
// Force the assignation of the specified alias the the primitive. If another primitive
|
||||
// already hold the alias, this other primitive is assigned a new alias.
|
||||
void forceAlias(CPrimAlias *prim, uint32 alias);
|
||||
|
||||
// get the last generated alias value (for debug only)
|
||||
uint32 getLastGeneratedAlias();
|
||||
|
||||
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
|
||||
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
|
||||
|
||||
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
|
||||
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
|
||||
|
||||
|
||||
private:
|
||||
// Conversion internal methods
|
||||
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
|
||||
void convertPrimitive (const IPrimitive *prim, bool hidden);
|
||||
|
||||
/// Optional context information
|
||||
CLigoConfig *_LigoConfig;
|
||||
/// Static part alias mapping (can be 0 if no mapping is defined)
|
||||
uint32 _AliasStaticPart;
|
||||
/// Last generated Alias, used to compute the next alias
|
||||
uint32 _LastGeneratedAlias;
|
||||
/// List of alias in use in the primitive (dynamic part only)
|
||||
std::map<uint32, IPrimitive*> _AliasInUse;
|
||||
// Store the filename
|
||||
// This allows to retrieve the static alias when reloading from binary file
|
||||
std::string _Filename;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** Singleton to manage special loading feature related to
|
||||
* unique alias assignment
|
||||
*/
|
||||
class CPrimitiveContext
|
||||
{
|
||||
static CPrimitiveContext *_Instance;
|
||||
|
||||
// private ctor
|
||||
CPrimitiveContext();
|
||||
public:
|
||||
|
||||
// get the singleton reference
|
||||
static CPrimitiveContext &instance()
|
||||
{
|
||||
if (!_Instance)
|
||||
{
|
||||
_Instance = new CPrimitiveContext;
|
||||
}
|
||||
|
||||
return *_Instance;
|
||||
}
|
||||
|
||||
/// The current ligo configuration file.
|
||||
CLigoConfig *CurrentLigoConfig;
|
||||
/// The current primitives container.
|
||||
CPrimitives *CurrentPrimitive;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace NLLIGO
|
||||
|
||||
#endif // __PRIMITIVE_H__
|
||||
|
|
@ -1,786 +0,0 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef __PRIMITIVE_H__
|
||||
#define __PRIMITIVE_H__
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/rgba.h"
|
||||
|
||||
// Forward declarations for libxml2
|
||||
typedef struct _xmlNode xmlNode;
|
||||
typedef xmlNode *xmlNodePtr;
|
||||
|
||||
typedef struct _xmlDoc xmlDoc;
|
||||
typedef xmlDoc *xmlDocPtr;
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NLLIGO
|
||||
{
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
# define NLLIGO_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Ligo primitives are used to add logical geometrical gameplay information.
|
||||
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
|
||||
* Ligo primitives have a CLASS.
|
||||
*
|
||||
* The primitive class defines the properties attached to the primitive
|
||||
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
|
||||
*/
|
||||
|
||||
class CPrimitives;
|
||||
class CLigoConfig;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void Register ();
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
*/
|
||||
class IProperty : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
IProperty ()
|
||||
{
|
||||
Default = false;
|
||||
}
|
||||
|
||||
// This property is set to default
|
||||
bool Default;
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const = 0;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a simple string
|
||||
*/
|
||||
class CPropertyString : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyString () {}
|
||||
CPropertyString (const char *str);
|
||||
CPropertyString (const std::string &str);
|
||||
CPropertyString (const char *str, bool _default);
|
||||
virtual ~CPropertyString () {}
|
||||
std::string String;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyString)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(String);
|
||||
}
|
||||
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyStringArray : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyStringArray () {}
|
||||
virtual ~CPropertyStringArray () {}
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray);
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
|
||||
std::vector<std::string> StringArray;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyStringArray)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serialCont(StringArray);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyColor : public IProperty
|
||||
{
|
||||
public:
|
||||
NLMISC::CRGBA Color;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyColor)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(Color);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
|
||||
// ctors
|
||||
CPropertyColor() {}
|
||||
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimVector : public NLMISC::CVector
|
||||
{
|
||||
public:
|
||||
CPrimVector ()
|
||||
{
|
||||
Selected = false;
|
||||
}
|
||||
CPrimVector (const NLMISC::CVector &v)
|
||||
{
|
||||
CVector::operator= (v);
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
void serial(NLMISC::IStream &f)
|
||||
{
|
||||
CVector::serial(f);
|
||||
f.serial(Selected);
|
||||
}
|
||||
|
||||
bool Selected;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is the base class for ligo primitive.
|
||||
*
|
||||
* Provide access to common properties.
|
||||
* Provide access to the primitive hierachy
|
||||
*/
|
||||
class IPrimitive : public NLMISC::IStreamable
|
||||
{
|
||||
friend class CPrimitives;
|
||||
public:
|
||||
|
||||
// Deprecated
|
||||
// std::string Layer;
|
||||
// Deprecated
|
||||
// std::string Name;
|
||||
|
||||
// Expended in the tree view
|
||||
// bool Expanded;
|
||||
|
||||
enum
|
||||
{
|
||||
NotAnArray,
|
||||
AtTheEnd = 0xffffffff,
|
||||
};
|
||||
|
||||
/// \name Hierarchy
|
||||
IPrimitive ();
|
||||
|
||||
virtual ~IPrimitive ();
|
||||
|
||||
IPrimitive (const IPrimitive &node);
|
||||
|
||||
virtual void operator= (const IPrimitive &node);
|
||||
|
||||
/** Get the children primitive count */
|
||||
uint getNumChildren () const
|
||||
{
|
||||
return (uint)_Children.size ();
|
||||
}
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (const IPrimitive *&result, uint childId) const;
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (IPrimitive *&result, uint childId);
|
||||
|
||||
/** Get the parent primitive */
|
||||
IPrimitive *getParent ()
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
const IPrimitive *getParent () const
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
|
||||
/** Get the primitive relative to this and the given path */
|
||||
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
|
||||
|
||||
/** Get the id of the child, return 0xffffffff if not found */
|
||||
bool getChildId (uint &childId, const IPrimitive *child) const;
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (IPrimitive *child);
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (uint childId);
|
||||
|
||||
/// Remove the child primitive from the children list, don't delete it
|
||||
bool unlinkChild(IPrimitive *child);
|
||||
|
||||
/** Remove and delete all children primitives */
|
||||
void removeChildren ();
|
||||
|
||||
/**
|
||||
* Insert a child primitive before the index.
|
||||
* The pointer will be deleted by the parent primitive using the ::delete operator.
|
||||
* return false if the index is invalid
|
||||
*/
|
||||
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
|
||||
|
||||
/// \name Properties
|
||||
|
||||
/**
|
||||
* Get a num properties
|
||||
**/
|
||||
uint getNumProperty () const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, IProperty *&result);
|
||||
|
||||
/** Check the existence of a named property */
|
||||
bool checkProperty(const std::string &property_name) const;
|
||||
|
||||
/**
|
||||
* Add a property
|
||||
* If the property already exist, the method does nothing and returns false.
|
||||
* The pointer will be deleted by the primitive using the ::delete operator.
|
||||
**/
|
||||
bool addPropertyByName (const char *property_name, IProperty *result);
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::string *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, std::string &result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a color property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
|
||||
**/
|
||||
bool removeProperty (uint index);
|
||||
|
||||
/**
|
||||
* Remove a property by its name
|
||||
**/
|
||||
bool removePropertyByName (const char *property_name);
|
||||
|
||||
/**
|
||||
* Remove all the properties
|
||||
**/
|
||||
void removeProperties ();
|
||||
|
||||
/* Init default primitive's parameters
|
||||
*
|
||||
* This method will add all the properties declared in the primitive class and create default properties.
|
||||
*/
|
||||
void initDefaultValues (CLigoConfig &config);
|
||||
|
||||
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const = 0;
|
||||
virtual const CPrimVector *getPrimVector () const = 0;
|
||||
virtual CPrimVector *getPrimVector () = 0;
|
||||
|
||||
// Make a copy
|
||||
virtual IPrimitive *copy () const = 0;
|
||||
|
||||
// used for fast binary save/load (exploitation mode)
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// shortcut to getPropertyByName("name", ret); return ret;
|
||||
std::string getName() const;
|
||||
|
||||
const std::string &getUnparsedProperties() const;
|
||||
void setUnparsedProperties(const std::string &unparsedProperties) const;
|
||||
|
||||
private:
|
||||
|
||||
// callback called just after the node is attach under a parent
|
||||
virtual void onLinkToParent() {}
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onUnlinkFromParent() {}
|
||||
|
||||
/// Callback called just after an ancestor is linked
|
||||
virtual void onBranchLink() {}
|
||||
/// Callback called just before an ancestor is unlinked
|
||||
virtual void onBranchUnlink() {}
|
||||
|
||||
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
|
||||
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
|
||||
|
||||
// internal recusive call
|
||||
void branchLink();
|
||||
void branchUnlink();
|
||||
|
||||
// Update child Id
|
||||
void updateChildId (uint index);
|
||||
|
||||
// Child id
|
||||
uint32 _ChildId;
|
||||
|
||||
// Parent
|
||||
IPrimitive *_Parent;
|
||||
|
||||
// Children
|
||||
std::vector<IPrimitive*> _Children;
|
||||
|
||||
// Single properties
|
||||
std::map<std::string, IProperty*> _Properties;
|
||||
|
||||
// Editor specific properties (unparsed)
|
||||
mutable std::string _UnparsedProperties;
|
||||
|
||||
|
||||
#ifdef NLLIGO_DEBUG
|
||||
std::string _DebugClassName;
|
||||
std::string _DebugPrimitiveName;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
// Simple primitive node
|
||||
class CPrimNode : public IPrimitive
|
||||
{
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimNode)
|
||||
|
||||
protected:
|
||||
|
||||
// void operator= (const CPrimNode &node);
|
||||
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimPoint : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CPrimPoint ()
|
||||
{
|
||||
Angle = 0;
|
||||
}
|
||||
|
||||
|
||||
CPrimVector Point;
|
||||
float Angle; // Angle on OZ, CCW
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPoint &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPoint);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CPrimPath : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPath &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPath);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimZone : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
|
||||
|
||||
public:
|
||||
|
||||
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
|
||||
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
|
||||
|
||||
// void operator= (const CPrimZone &node);
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
|
||||
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
|
||||
NLMISC::CVector getBarycentre() const;
|
||||
|
||||
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
|
||||
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
|
||||
|
||||
/// Return the area of the axis-aligned box containing the zone
|
||||
float getAreaOfAABox() const;
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimZone);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** This primitive type is used to handle unique alias across a primitive file.
|
||||
* Usage of this primitive imply the setting of the appropriate 'ligo context'
|
||||
* before reading or copy/pasting alias.
|
||||
*/
|
||||
class CPrimAlias : public IPrimitive
|
||||
{
|
||||
friend class CPrimitives;
|
||||
|
||||
/// The 'dynamic' part of the alias
|
||||
uint32 _Alias;
|
||||
/// The primitive container
|
||||
class CPrimitives *_Container;
|
||||
|
||||
// Needed overloads (not used)
|
||||
virtual uint getNumVector () const
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual const CPrimVector *getPrimVector () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual CPrimVector *getPrimVector ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
virtual void onBranchLink();
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onBranchUnlink();
|
||||
|
||||
void regenAlias();
|
||||
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimAlias);
|
||||
|
||||
// private default constructor
|
||||
CPrimAlias();
|
||||
// copy constructor needed
|
||||
CPrimAlias(const CPrimAlias &other);
|
||||
|
||||
~CPrimAlias();
|
||||
|
||||
// return the dynamic part of the alias
|
||||
uint32 getAlias() const;
|
||||
|
||||
// Return the full alias, merge of the static and dynamic part
|
||||
uint32 getFullAlias() const;
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
|
||||
// Create a copy of this primitive
|
||||
virtual IPrimitive *copy () const;
|
||||
// serial for binary save
|
||||
virtual void serial (NLMISC::IStream &f);
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
This class is deprecated.
|
||||
*/
|
||||
class CPrimRegion
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::string Name;
|
||||
std::vector<CPrimPoint> VPoints;
|
||||
std::vector<CPrimZone> VZones;
|
||||
std::vector<CPrimPath> VPaths;
|
||||
|
||||
std::vector<bool> VHidePoints;
|
||||
std::vector<bool> VHideZones;
|
||||
std::vector<bool> VHidePaths;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/**
|
||||
* This class is a ligo primitives set
|
||||
*/
|
||||
class CPrimitives
|
||||
{
|
||||
public:
|
||||
|
||||
CPrimitives ();
|
||||
CPrimitives (const CPrimitives &other);
|
||||
~CPrimitives ();
|
||||
|
||||
// Operator copy
|
||||
CPrimitives& operator= (const CPrimitives &other);
|
||||
|
||||
// Convert from old format to the new one
|
||||
void convert (const CPrimRegion ®ion);
|
||||
|
||||
// Read the primitive
|
||||
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlDocPtr xmlNode, const char *filename) const;
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlNodePtr root, const char *filename) const;
|
||||
|
||||
// serial the primitive. Used for binary files.
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// Root primitive hierarchy
|
||||
CPrimNode *RootNode;
|
||||
|
||||
// get the static alias part for this primitive
|
||||
uint32 getAliasStaticPart();
|
||||
|
||||
// set the static alias part for this primitive
|
||||
void setAliasStaticPart(uint32 staticPart);
|
||||
|
||||
// Build an alias by combining the static and dynamic part
|
||||
uint32 buildFullAlias(uint32 dynamicPart);
|
||||
|
||||
// Generate a new unique alias (dynamic part only)
|
||||
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
|
||||
// Reserve an alias and store it in the used alias list (dynamic part only)
|
||||
// void reserveAlias(uint32 dynamicAlias);
|
||||
// Remove an alias from the list of alias in use (dynamic part only)
|
||||
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
|
||||
|
||||
// Force the assignation of the specified alias to the primitive. If another primitive
|
||||
// already hold the alias, this other primitive is assigned a new alias.
|
||||
void forceAlias(CPrimAlias *prim, uint32 alias);
|
||||
|
||||
// get the last generated alias value (for debug only)
|
||||
uint32 getLastGeneratedAlias();
|
||||
|
||||
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
|
||||
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
|
||||
|
||||
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
|
||||
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
|
||||
|
||||
|
||||
private:
|
||||
// Conversion internal methods
|
||||
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
|
||||
void convertPrimitive (const IPrimitive *prim, bool hidden);
|
||||
|
||||
/// Optional context information
|
||||
CLigoConfig *_LigoConfig;
|
||||
/// Static part alias mapping (can be 0 if no mapping is defined)
|
||||
uint32 _AliasStaticPart;
|
||||
/// Last generated Alias, used to compute the next alias
|
||||
uint32 _LastGeneratedAlias;
|
||||
/// List of alias in use in the primitive (dynamic part only)
|
||||
std::map<uint32, IPrimitive*> _AliasInUse;
|
||||
// Store the filename
|
||||
// This allows to retrieve the static alias when reloading from binary file
|
||||
std::string _Filename;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** Singleton to manage special loading feature related to
|
||||
* unique alias assignment
|
||||
*/
|
||||
class CPrimitiveContext
|
||||
{
|
||||
static CPrimitiveContext *_Instance;
|
||||
|
||||
// private ctor
|
||||
CPrimitiveContext();
|
||||
public:
|
||||
|
||||
// get the singleton reference
|
||||
static CPrimitiveContext &instance()
|
||||
{
|
||||
if (!_Instance)
|
||||
{
|
||||
_Instance = new CPrimitiveContext;
|
||||
}
|
||||
|
||||
return *_Instance;
|
||||
}
|
||||
|
||||
/// The current ligo configuration file.
|
||||
CLigoConfig *CurrentLigoConfig;
|
||||
/// The current primitives container.
|
||||
CPrimitives *CurrentPrimitive;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace NLLIGO
|
||||
|
||||
#endif // __PRIMITIVE_H__
|
||||
|
|
@ -1,785 +0,0 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef __PRIMITIVE_H__
|
||||
#define __PRIMITIVE_H__
|
||||
|
||||
#include "nel/misc/vector.h"
|
||||
#include "nel/misc/rgba.h"
|
||||
|
||||
// Forward declarations for libxml2
|
||||
typedef struct _xmlNode xmlNode;
|
||||
typedef xmlNode *xmlNodePtr;
|
||||
|
||||
typedef struct _xmlDoc xmlDoc;
|
||||
typedef xmlDoc *xmlDocPtr;
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NLLIGO
|
||||
{
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
# define NLLIGO_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Ligo primitives are used to add logical geometrical gameplay information.
|
||||
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
|
||||
* Ligo primitives have a CLASS.
|
||||
*
|
||||
* The primitive class defines the properties attached to the primitive
|
||||
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
|
||||
*/
|
||||
|
||||
class CPrimitives;
|
||||
class CLigoConfig;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void Register ();
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
*/
|
||||
class IProperty : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
IProperty ()
|
||||
{
|
||||
Default = false;
|
||||
}
|
||||
|
||||
// This property is set to default
|
||||
bool Default;
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const = 0;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a simple string
|
||||
*/
|
||||
class CPropertyString : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyString () {}
|
||||
CPropertyString (const std::string &str);
|
||||
CPropertyString (const std::string &str, bool _default);
|
||||
virtual ~CPropertyString () {}
|
||||
std::string String;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyString)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(String);
|
||||
}
|
||||
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyStringArray : public IProperty
|
||||
{
|
||||
public:
|
||||
CPropertyStringArray () {}
|
||||
virtual ~CPropertyStringArray () {}
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray);
|
||||
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
|
||||
std::vector<std::string> StringArray;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyStringArray)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serialCont(StringArray);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is a property class for ligo primitive.
|
||||
* This is a string array
|
||||
*/
|
||||
class CPropertyColor : public IProperty
|
||||
{
|
||||
public:
|
||||
NLMISC::CRGBA Color;
|
||||
|
||||
NLMISC_DECLARE_CLASS (CPropertyColor)
|
||||
|
||||
virtual void serial(NLMISC::IStream &f)
|
||||
{
|
||||
f.serial(Default);
|
||||
f.serial(Color);
|
||||
}
|
||||
// Force class to be polymorphic
|
||||
virtual void foo () const {}
|
||||
|
||||
// ctors
|
||||
CPropertyColor() {}
|
||||
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimVector : public NLMISC::CVector
|
||||
{
|
||||
public:
|
||||
CPrimVector ()
|
||||
{
|
||||
Selected = false;
|
||||
}
|
||||
CPrimVector (const NLMISC::CVector &v)
|
||||
{
|
||||
CVector::operator= (v);
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
void serial(NLMISC::IStream &f)
|
||||
{
|
||||
CVector::serial(f);
|
||||
f.serial(Selected);
|
||||
}
|
||||
|
||||
bool Selected;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
* This class is the base class for ligo primitive.
|
||||
*
|
||||
* Provide access to common properties.
|
||||
* Provide access to the primitive hierachy
|
||||
*/
|
||||
class IPrimitive : public NLMISC::IStreamable
|
||||
{
|
||||
friend class CPrimitives;
|
||||
public:
|
||||
|
||||
// Deprecated
|
||||
// std::string Layer;
|
||||
// Deprecated
|
||||
// std::string Name;
|
||||
|
||||
// Expended in the tree view
|
||||
// bool Expanded;
|
||||
|
||||
enum
|
||||
{
|
||||
NotAnArray,
|
||||
AtTheEnd = 0xffffffff,
|
||||
};
|
||||
|
||||
/// \name Hierarchy
|
||||
IPrimitive ();
|
||||
|
||||
virtual ~IPrimitive ();
|
||||
|
||||
IPrimitive (const IPrimitive &node);
|
||||
|
||||
virtual void operator= (const IPrimitive &node);
|
||||
|
||||
/** Get the children primitive count */
|
||||
uint getNumChildren () const
|
||||
{
|
||||
return (uint)_Children.size ();
|
||||
}
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (const IPrimitive *&result, uint childId) const;
|
||||
|
||||
/** Get a child primitive */
|
||||
bool getChild (IPrimitive *&result, uint childId);
|
||||
|
||||
/** Get the parent primitive */
|
||||
IPrimitive *getParent ()
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
const IPrimitive *getParent () const
|
||||
{
|
||||
return _Parent;
|
||||
}
|
||||
|
||||
/** Get the primitive relative to this and the given path */
|
||||
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
|
||||
|
||||
/** Get the id of the child, return 0xffffffff if not found */
|
||||
bool getChildId (uint &childId, const IPrimitive *child) const;
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (IPrimitive *child);
|
||||
|
||||
/** Remove and delete a child primitive */
|
||||
bool removeChild (uint childId);
|
||||
|
||||
/// Remove the child primitive from the children list, don't delete it
|
||||
bool unlinkChild(IPrimitive *child);
|
||||
|
||||
/** Remove and delete all children primitives */
|
||||
void removeChildren ();
|
||||
|
||||
/**
|
||||
* Insert a child primitive before the index.
|
||||
* The pointer will be deleted by the parent primitive using the ::delete operator.
|
||||
* return false if the index is invalid
|
||||
*/
|
||||
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
|
||||
|
||||
/// \name Properties
|
||||
|
||||
/**
|
||||
* Get a num properties
|
||||
**/
|
||||
uint getNumProperty () const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a properties by its index
|
||||
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
|
||||
**/
|
||||
bool getProperty (uint index, std::string &property_name, IProperty *&result);
|
||||
|
||||
/** Check the existence of a named property */
|
||||
bool checkProperty(const std::string &property_name) const;
|
||||
|
||||
/**
|
||||
* Add a property
|
||||
* If the property already exist, the method does nothing and returns false.
|
||||
* The pointer will be deleted by the primitive using the ::delete operator.
|
||||
**/
|
||||
bool addPropertyByName (const std::string &property_name, IProperty *result);
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, const IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a property with its name
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, IProperty *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, std::string *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a string property with its name. Return false if the property is not found or is not a string property.
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, std::string &result) const;
|
||||
|
||||
/**
|
||||
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const;
|
||||
|
||||
/**
|
||||
* Get a color property with its name. Return false if the property is not found or is not a string array property.
|
||||
**/
|
||||
bool getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const;
|
||||
|
||||
/**
|
||||
* Remove a property
|
||||
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
|
||||
**/
|
||||
bool removeProperty (uint index);
|
||||
|
||||
/**
|
||||
* Remove a property by its name
|
||||
**/
|
||||
bool removePropertyByName (const std::string &property_name);
|
||||
|
||||
/**
|
||||
* Remove all the properties
|
||||
**/
|
||||
void removeProperties ();
|
||||
|
||||
/* Init default primitive's parameters
|
||||
*
|
||||
* This method will add all the properties declared in the primitive class and create default properties.
|
||||
*/
|
||||
void initDefaultValues (CLigoConfig &config);
|
||||
|
||||
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &property_name, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &property_name) const;
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const = 0;
|
||||
virtual const CPrimVector *getPrimVector () const = 0;
|
||||
virtual CPrimVector *getPrimVector () = 0;
|
||||
|
||||
// Make a copy
|
||||
virtual IPrimitive *copy () const = 0;
|
||||
|
||||
// used for fast binary save/load (exploitation mode)
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// shortcut to getPropertyByName("name", ret); return ret;
|
||||
std::string getName() const;
|
||||
|
||||
const std::string &getUnparsedProperties() const;
|
||||
void setUnparsedProperties(const std::string &unparsedProperties) const;
|
||||
|
||||
private:
|
||||
|
||||
// callback called just after the node is attach under a parent
|
||||
virtual void onLinkToParent() {}
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onUnlinkFromParent() {}
|
||||
|
||||
/// Callback called just after an ancestor is linked
|
||||
virtual void onBranchLink() {}
|
||||
/// Callback called just before an ancestor is unlinked
|
||||
virtual void onBranchUnlink() {}
|
||||
|
||||
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
|
||||
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
|
||||
|
||||
// internal recusive call
|
||||
void branchLink();
|
||||
void branchUnlink();
|
||||
|
||||
// Update child Id
|
||||
void updateChildId (uint index);
|
||||
|
||||
// Child id
|
||||
uint32 _ChildId;
|
||||
|
||||
// Parent
|
||||
IPrimitive *_Parent;
|
||||
|
||||
// Children
|
||||
std::vector<IPrimitive*> _Children;
|
||||
|
||||
// Single properties
|
||||
std::map<std::string, IProperty*> _Properties;
|
||||
|
||||
// Editor specific properties (unparsed)
|
||||
mutable std::string _UnparsedProperties;
|
||||
|
||||
|
||||
#ifdef NLLIGO_DEBUG
|
||||
std::string _DebugClassName;
|
||||
std::string _DebugPrimitiveName;
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
// Simple primitive node
|
||||
class CPrimNode : public IPrimitive
|
||||
{
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimNode)
|
||||
|
||||
protected:
|
||||
|
||||
// void operator= (const CPrimNode &node);
|
||||
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimPoint : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CPrimPoint ()
|
||||
{
|
||||
Angle = 0;
|
||||
}
|
||||
|
||||
|
||||
CPrimVector Point;
|
||||
float Angle; // Angle on OZ, CCW
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPoint &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPoint);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CPrimPath : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// void operator= (const CPrimPath &node);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimPath);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
class CPrimZone : public IPrimitive
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::vector<CPrimVector> VPoints;
|
||||
|
||||
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
|
||||
|
||||
public:
|
||||
|
||||
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
|
||||
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
|
||||
|
||||
// void operator= (const CPrimZone &node);
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
// Returns true if the vector v is inside of the patatoid
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
|
||||
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
|
||||
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
|
||||
|
||||
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
|
||||
NLMISC::CVector getBarycentre() const;
|
||||
|
||||
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
|
||||
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
|
||||
|
||||
/// Return the area of the axis-aligned box containing the zone
|
||||
float getAreaOfAABox() const;
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimZone);
|
||||
|
||||
protected:
|
||||
|
||||
// Get the vertices
|
||||
virtual uint getNumVector () const;
|
||||
virtual const CPrimVector *getPrimVector () const;
|
||||
virtual CPrimVector *getPrimVector ();
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
|
||||
// \name From IPrimitive
|
||||
virtual IPrimitive *copy () const;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** This primitive type is used to handle unique alias across a primitive file.
|
||||
* Usage of this primitive imply the setting of the appropriate 'ligo context'
|
||||
* before reading or copy/pasting alias.
|
||||
*/
|
||||
class CPrimAlias : public IPrimitive
|
||||
{
|
||||
friend class CPrimitives;
|
||||
|
||||
/// The 'dynamic' part of the alias
|
||||
uint32 _Alias;
|
||||
/// The primitive container
|
||||
class CPrimitives *_Container;
|
||||
|
||||
// Needed overloads (not used)
|
||||
virtual uint getNumVector () const
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
virtual const CPrimVector *getPrimVector () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual CPrimVector *getPrimVector ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
virtual void onBranchLink();
|
||||
// callback called just before the node is removed from it's parent
|
||||
virtual void onBranchUnlink();
|
||||
|
||||
void regenAlias();
|
||||
|
||||
public:
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimAlias);
|
||||
|
||||
// private default constructor
|
||||
CPrimAlias();
|
||||
// copy constructor needed
|
||||
CPrimAlias(const CPrimAlias &other);
|
||||
|
||||
~CPrimAlias();
|
||||
|
||||
// return the dynamic part of the alias
|
||||
uint32 getAlias() const;
|
||||
|
||||
// Return the full alias, merge of the static and dynamic part
|
||||
uint32 getFullAlias() const;
|
||||
|
||||
// Read the primitive
|
||||
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
|
||||
// Write the primitive
|
||||
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
|
||||
// Create a copy of this primitive
|
||||
virtual IPrimitive *copy () const;
|
||||
// serial for binary save
|
||||
virtual void serial (NLMISC::IStream &f);
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/*
|
||||
This class is deprecated.
|
||||
*/
|
||||
class CPrimRegion
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
std::string Name;
|
||||
std::vector<CPrimPoint> VPoints;
|
||||
std::vector<CPrimZone> VZones;
|
||||
std::vector<CPrimPath> VPaths;
|
||||
|
||||
std::vector<bool> VHidePoints;
|
||||
std::vector<bool> VHideZones;
|
||||
std::vector<bool> VHidePaths;
|
||||
|
||||
public:
|
||||
|
||||
void serial (NLMISC::IStream &f);
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/**
|
||||
* This class is a ligo primitives set
|
||||
*/
|
||||
class CPrimitives
|
||||
{
|
||||
public:
|
||||
|
||||
CPrimitives ();
|
||||
CPrimitives (const CPrimitives &other);
|
||||
~CPrimitives ();
|
||||
|
||||
// Operator copy
|
||||
CPrimitives& operator= (const CPrimitives &other);
|
||||
|
||||
// Convert from old format to the new one
|
||||
void convert (const CPrimRegion ®ion);
|
||||
|
||||
// Read the primitive
|
||||
bool read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config);
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlDocPtr xmlNode, const std::string &filename) const;
|
||||
|
||||
// Write the primitive
|
||||
void write (xmlNodePtr root, const std::string &filename) const;
|
||||
|
||||
// serial the primitive. Used for binary files.
|
||||
void serial(NLMISC::IStream &f);
|
||||
|
||||
// Root primitive hierarchy
|
||||
CPrimNode *RootNode;
|
||||
|
||||
// get the static alias part for this primitive
|
||||
uint32 getAliasStaticPart();
|
||||
|
||||
// set the static alias part for this primitive
|
||||
void setAliasStaticPart(uint32 staticPart);
|
||||
|
||||
// Build an alias by combining the static and dynamic part
|
||||
uint32 buildFullAlias(uint32 dynamicPart);
|
||||
|
||||
// Generate a new unique alias (dynamic part only)
|
||||
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
|
||||
// Reserve an alias and store it in the used alias list (dynamic part only)
|
||||
// void reserveAlias(uint32 dynamicAlias);
|
||||
// Remove an alias from the list of alias in use (dynamic part only)
|
||||
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
|
||||
|
||||
// Force the assignation of the specified alias to the primitive. If another primitive
|
||||
// already hold the alias, this other primitive is assigned a new alias.
|
||||
void forceAlias(CPrimAlias *prim, uint32 alias);
|
||||
|
||||
// get the last generated alias value (for debug only)
|
||||
uint32 getLastGeneratedAlias();
|
||||
|
||||
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
|
||||
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
|
||||
|
||||
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
|
||||
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
|
||||
|
||||
|
||||
private:
|
||||
// Conversion internal methods
|
||||
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
|
||||
void convertPrimitive (const IPrimitive *prim, bool hidden);
|
||||
|
||||
/// Optional context information
|
||||
CLigoConfig *_LigoConfig;
|
||||
/// Static part alias mapping (can be 0 if no mapping is defined)
|
||||
uint32 _AliasStaticPart;
|
||||
/// Last generated Alias, used to compute the next alias
|
||||
uint32 _LastGeneratedAlias;
|
||||
/// List of alias in use in the primitive (dynamic part only)
|
||||
std::map<uint32, IPrimitive*> _AliasInUse;
|
||||
// Store the filename
|
||||
// This allows to retrieve the static alias when reloading from binary file
|
||||
std::string _Filename;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
/** Singleton to manage special loading feature related to
|
||||
* unique alias assignment
|
||||
*/
|
||||
class CPrimitiveContext
|
||||
{
|
||||
static CPrimitiveContext *_Instance;
|
||||
|
||||
// private ctor
|
||||
CPrimitiveContext();
|
||||
public:
|
||||
|
||||
// get the singleton reference
|
||||
static CPrimitiveContext &instance()
|
||||
{
|
||||
if (!_Instance)
|
||||
{
|
||||
_Instance = new CPrimitiveContext;
|
||||
}
|
||||
|
||||
return *_Instance;
|
||||
}
|
||||
|
||||
/// The current ligo configuration file.
|
||||
CLigoConfig *CurrentLigoConfig;
|
||||
/// The current primitives container.
|
||||
CPrimitives *CurrentPrimitive;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace NLLIGO
|
||||
|
||||
#endif // __PRIMITIVE_H__
|
||||
|
|
@ -521,20 +521,6 @@ public:
|
|||
*/
|
||||
static bool isAbsolutePath (const std::string &path);
|
||||
|
||||
/** Make path absolute
|
||||
* \param relativePath - The relative path
|
||||
* \param directory - the directory to which the path is relative to
|
||||
* \param simplify - if we should simplify or not the path (convert . and .. in path)
|
||||
* returns the absolute path, or empty if something went wrong.
|
||||
*/
|
||||
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory, bool simplify = false );
|
||||
|
||||
/** Return if a path is absolute or not.
|
||||
* \param path - The path
|
||||
* returns true if path is absolute or false if relative.
|
||||
*/
|
||||
static bool isAbsolutePath (const std::string &path);
|
||||
|
||||
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
|
||||
*/
|
||||
static void addIgnoredDoubleFile(const std::string &ignoredFile);
|
||||
|
|
|
@ -102,6 +102,10 @@ CBloomEffect::~CBloomEffect()
|
|||
if (_Driver) _Driver->deleteMaterial(_BlurMat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
void CBloomEffect::init()
|
||||
{
|
||||
if (!((CDriverUser *)_Driver)->getDriver()->supportBloomEffect())
|
||||
|
|
|
@ -31,6 +31,7 @@ using namespace std;
|
|||
#ifdef DEBUG_NEW
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "../stdopengl.h"
|
||||
#include "../driver_opengl.h"
|
||||
|
||||
#import "cocoa_opengl_view.h"
|
||||
|
||||
static void viewDidResize(NSView* view, CDriverGL* driver)
|
||||
{
|
||||
NSRect rect = [[view superview] frame];
|
||||
driver->_CurrentMode.Height = rect.size.height;
|
||||
driver->_CurrentMode.Width = rect.size.width;
|
||||
}
|
||||
|
||||
@implementation CocoaOpenGLView
|
||||
|
||||
-(id)initWithFrame:(NSRect)frame
|
||||
{
|
||||
if((self = [super initWithFrame:frame]))
|
||||
{
|
||||
_characterStorage = [[NSMutableAttributedString alloc] initWithString:@""];
|
||||
_driver = nil;
|
||||
return self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[_characterStorage release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)keyDown:(NSEvent*)event
|
||||
{
|
||||
#ifdef NL_MAC_VERSION_10_6_UP
|
||||
[[self inputContext] handleEvent:event];
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)setDriver:(CDriverGL*)driver
|
||||
{
|
||||
_driver = driver;
|
||||
}
|
||||
|
||||
-(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize
|
||||
{
|
||||
[super resizeWithOldSuperviewSize:oldBoundsSize];
|
||||
|
||||
if(!_driver)
|
||||
return;
|
||||
|
||||
viewDidResize(self, _driver);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* NSTextInputClient Protocol */
|
||||
|
||||
-(BOOL)hasMarkedText
|
||||
{
|
||||
return (_markedRange.location == NSNotFound ? NO : YES);
|
||||
}
|
||||
|
||||
-(NSRange)markedRange
|
||||
{
|
||||
return _markedRange;
|
||||
}
|
||||
|
||||
-(NSRange)selectedRange
|
||||
{
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
-(void)setMarkedText:(id)aString
|
||||
selectedRange:(NSRange)newSelection
|
||||
replacementRange:(NSRange)replacementRange
|
||||
{
|
||||
if(replacementRange.location == NSNotFound)
|
||||
replacementRange = _markedRange;
|
||||
|
||||
if([aString length] == 0)
|
||||
{
|
||||
[_characterStorage deleteCharactersInRange:replacementRange];
|
||||
[self unmarkText];
|
||||
}
|
||||
else
|
||||
{
|
||||
_markedRange = NSMakeRange(replacementRange.location, [aString length]);
|
||||
[_characterStorage replaceCharactersInRange:replacementRange
|
||||
withString:aString];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)unmarkText
|
||||
{
|
||||
_markedRange = NSMakeRange(NSNotFound, 0);
|
||||
[[self inputContext] discardMarkedText];
|
||||
}
|
||||
|
||||
-(NSArray*)validAttributesForMarkedText
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
NSMarkedClauseSegmentAttributeName, NSGlyphInfoAttributeName, nil];
|
||||
}
|
||||
|
||||
-(NSAttributedString*)attributedSubstringForProposedRange:(NSRange)aRange
|
||||
actualRange:(NSRangePointer)actualRange
|
||||
{
|
||||
return [_characterStorage attributedSubstringFromRange:aRange];
|
||||
}
|
||||
|
||||
-(void)insertText:(id)aString
|
||||
replacementRange:(NSRange)replacementRange
|
||||
{
|
||||
if(replacementRange.location == NSNotFound)
|
||||
replacementRange = _markedRange;
|
||||
|
||||
[_characterStorage replaceCharactersInRange:replacementRange
|
||||
withString:aString];
|
||||
}
|
||||
|
||||
-(NSUInteger)characterIndexForPoint:(NSPoint)aPoint
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(NSRect)firstRectForCharacterRange:(NSRange)aRange
|
||||
actualRange:(NSRangePointer)actualRange
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
-(void)doCommandBySelector:(SEL)aSelector
|
||||
{
|
||||
[super doCommandBySelector:aSelector];
|
||||
}
|
||||
|
||||
@end
|
|
@ -25,7 +25,7 @@ BEGIN
|
|||
VALUE "OriginalFilename", "nel_drv_opengl_win_d.dll"
|
||||
#else
|
||||
VALUE "OriginalFilename", "nel_drv_opengl_win_r.dll"
|
||||
#endif
|
||||
#endif
|
||||
VALUE "ProductName", "Ryzom Core"
|
||||
VALUE "ProductVersion", NL_VERSION
|
||||
END
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "nel/3d/water_pool_manager.h"
|
||||
#include "nel/3d/u_camera.h"
|
||||
#include "nel/3d/debug_vb.h"
|
||||
#include "nel/misc/event_emitter.h"
|
||||
|
||||
#include "nel/misc/hierarchical_timer.h"
|
||||
#include "nel/misc/event_emitter.h"
|
||||
|
||||
|
|
|
@ -3785,8 +3785,6 @@ uint CZoneLighter::getAPatch (uint process)
|
|||
|
||||
nlassert(index < _PatchInfo.size());
|
||||
|
||||
nlassert(index < _PatchInfo.size());
|
||||
|
||||
if (access.value().empty())
|
||||
// no more patches
|
||||
return 0xffffffff;
|
||||
|
|
|
@ -496,7 +496,6 @@ void CZoneBank::reset ()
|
|||
_Selection.clear ();
|
||||
}
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
// ---------------------------------------------------------------------------
|
||||
bool CZoneBank::initFromPath(const std::string &sPathName, std::string &error)
|
||||
{
|
||||
|
@ -516,7 +515,6 @@ bool CZoneBank::initFromPath(const std::string &sPathName, std::string &error)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif // NL_OS_WINDOWS
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool CZoneBank::addElement (const std::string &elementName, std::string &error)
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include "nel/misc/o_xml.h"
|
||||
|
||||
#include "nel/misc/o_xml.h"
|
||||
|
||||
using namespace NLMISC;
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/**
|
||||
* \file fast_id_map.cpp
|
||||
* \brief CFastIdMap
|
||||
* \date 2012-04-10 19:28GMT
|
||||
* \author Jan Boon (Kaetemi)
|
||||
* CFastIdMap
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by authors
|
||||
*
|
||||
* This file is part of RYZOM CORE.
|
||||
* RYZOM CORE 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.
|
||||
*
|
||||
* RYZOM CORE 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 RYZOM CORE. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include <nel/misc/fast_id_map.h>
|
||||
|
||||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
// #include <nel/misc/debug.h>
|
||||
|
||||
// Project includes
|
||||
|
||||
#ifdef DEBUG_NEW
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
void dummytoavoidthecompilerwarningfastidmap() { }
|
||||
|
||||
} /* namespace NLMISC */
|
||||
|
||||
/* end of file */
|
|
@ -1854,84 +1854,6 @@ std::string CFileContainer::getTemporaryDirectory()
|
|||
return path;
|
||||
}
|
||||
|
||||
std::string CPath::getApplicationDirectory(const std::string &appName, bool local)
|
||||
{
|
||||
return getInstance()->_FileContainer.getApplicationDirectory(appName, local);
|
||||
}
|
||||
|
||||
std::string CFileContainer::getApplicationDirectory(const std::string &appName, bool local)
|
||||
{
|
||||
static std::string appPaths[2];
|
||||
|
||||
std::string &appPath = appPaths[local ? 1 : 0];
|
||||
|
||||
if (appPath.empty())
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
wchar_t buffer[MAX_PATH];
|
||||
#ifdef CSIDL_LOCAL_APPDATA
|
||||
if (local)
|
||||
{
|
||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
|
||||
}
|
||||
appPath = CPath::standardizePath(wideToUtf8(buffer));
|
||||
#else
|
||||
// get user home directory from HOME environment variable
|
||||
const char* homePath = getenv("HOME");
|
||||
appPath = CPath::standardizePath(homePath ? homePath : ".");
|
||||
|
||||
#if defined(NL_OS_MAC)
|
||||
appPath += "Library/Application Support/";
|
||||
#else
|
||||
// recommended for applications data that are owned by user
|
||||
appPath += ".local/share/";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return CPath::standardizePath(appPath + appName);
|
||||
}
|
||||
|
||||
std::string CPath::getTemporaryDirectory()
|
||||
{
|
||||
return getInstance()->_FileContainer.getTemporaryDirectory();
|
||||
}
|
||||
|
||||
std::string CFileContainer::getTemporaryDirectory()
|
||||
{
|
||||
static std::string path;
|
||||
if (path.empty())
|
||||
{
|
||||
const char *temp = getenv("TEMP");
|
||||
const char *tmp = getenv("TMP");
|
||||
|
||||
std::string tempDir;
|
||||
|
||||
if (temp)
|
||||
tempDir = temp;
|
||||
|
||||
if (tempDir.empty() && tmp)
|
||||
tempDir = tmp;
|
||||
|
||||
#ifdef NL_OS_UNIX
|
||||
if (tempDir.empty())
|
||||
tempDir = "/tmp";
|
||||
#else
|
||||
if (tempDir.empty())
|
||||
tempDir = ".";
|
||||
#endif
|
||||
|
||||
path = CPath::standardizePath(tempDir);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -24,10 +24,6 @@ using namespace std;
|
|||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_NEW
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ using namespace std;
|
|||
|
||||
const string DefaultColTitle = "name";
|
||||
|
||||
#ifdef DEBUG_NEW
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
NL_INSTANCE_COUNTER_IMPL(CWordsDictionary);
|
||||
|
|
|
@ -233,50 +233,6 @@ void EditPatchMod::SetSelLevel(DWORD level)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void EditPatchMod::SelectSubPatch(int index)
|
||||
{
|
||||
if (!ip)
|
||||
return;
|
||||
TimeValue t = ip->GetTime();
|
||||
|
||||
ip->ClearCurNamedSelSet();
|
||||
|
||||
ModContextList mcList;
|
||||
INodeTab nodes;
|
||||
ip->GetModContexts(mcList, nodes);
|
||||
|
||||
for (int i = 0; i < mcList.Count(); i++)
|
||||
{
|
||||
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
|
||||
|
||||
if (!patchData)
|
||||
return;
|
||||
|
||||
RPatchMesh *rpatch;
|
||||
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
|
||||
if (!patch)
|
||||
return;
|
||||
|
||||
patchData->BeginEdit(t);
|
||||
if (theHold.Holding())
|
||||
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent"));
|
||||
|
||||
patch->patchSel.Set(index);
|
||||
|
||||
patchData->UpdateChanges(patch, rpatch, FALSE);
|
||||
if (patchData->tempData)
|
||||
{
|
||||
patchData->tempData->Invalidate(PART_SELECT);
|
||||
}
|
||||
}
|
||||
PatchSelChanged();
|
||||
|
||||
UpdateSelectDisplay();
|
||||
NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void EditPatchMod::SelectSubPatch(int index)
|
||||
{
|
||||
if (!ip)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,378 +1,378 @@
|
|||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
fn findFile dir fileName =
|
||||
(
|
||||
if (doesFileExist (dir + "\\" + fileName)) then
|
||||
(
|
||||
return (dir + "\\" + fileName)
|
||||
)
|
||||
|
||||
dirArr = GetDirectories (dir + "\\*")
|
||||
|
||||
for d in dirArr do
|
||||
(
|
||||
local fileFound = findFile d fileName
|
||||
if (fileFound != "") then
|
||||
return fileFound
|
||||
)
|
||||
|
||||
return ""
|
||||
)
|
||||
|
||||
fn getFixedPath ps =
|
||||
(
|
||||
if not (doesFileExist ps) then
|
||||
(
|
||||
local fileName = filenameFromPath ps
|
||||
local fileFound = findFile "W:\\database\\sfx" fileName
|
||||
if (fileFound != "") then
|
||||
return fileFound
|
||||
else
|
||||
return fileName
|
||||
)
|
||||
else
|
||||
(
|
||||
return ps
|
||||
)
|
||||
)
|
||||
|
||||
fn renameParticleSystem ps =
|
||||
(
|
||||
local newFileName = getFixedPath ps.ps_file_name
|
||||
if (newFileName != ps.ps_file_name) then
|
||||
(
|
||||
ps.ps_file_name = newFileName
|
||||
return 1
|
||||
)
|
||||
else
|
||||
(
|
||||
return 0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
rollout assets_ps_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
local result = 0
|
||||
|
||||
for m in getClassInstances nel_ps do
|
||||
(
|
||||
if (renameParticleSystem m) == 1 then
|
||||
result = 1
|
||||
)
|
||||
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return result
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Open the max project
|
||||
if loadMaxFile file quiet:true == true then
|
||||
(
|
||||
objXRefMgr.UpdateAllRecords()
|
||||
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_ps_floater = newRolloutFloater "NeL Assets PS Database" 550 400
|
||||
addrollout assets_ps_rollout assets_ps_floater rolledUp:false
|
||||
|
||||
|
||||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
fn findFile dir fileName =
|
||||
(
|
||||
if (doesFileExist (dir + "\\" + fileName)) then
|
||||
(
|
||||
return (dir + "\\" + fileName)
|
||||
)
|
||||
|
||||
dirArr = GetDirectories (dir + "\\*")
|
||||
|
||||
for d in dirArr do
|
||||
(
|
||||
local fileFound = findFile d fileName
|
||||
if (fileFound != "") then
|
||||
return fileFound
|
||||
)
|
||||
|
||||
return ""
|
||||
)
|
||||
|
||||
fn getFixedPath ps =
|
||||
(
|
||||
if not (doesFileExist ps) then
|
||||
(
|
||||
local fileName = filenameFromPath ps
|
||||
local fileFound = findFile "W:\\database\\sfx" fileName
|
||||
if (fileFound != "") then
|
||||
return fileFound
|
||||
else
|
||||
return fileName
|
||||
)
|
||||
else
|
||||
(
|
||||
return ps
|
||||
)
|
||||
)
|
||||
|
||||
fn renameParticleSystem ps =
|
||||
(
|
||||
local newFileName = getFixedPath ps.ps_file_name
|
||||
if (newFileName != ps.ps_file_name) then
|
||||
(
|
||||
ps.ps_file_name = newFileName
|
||||
return 1
|
||||
)
|
||||
else
|
||||
(
|
||||
return 0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
rollout assets_ps_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
local result = 0
|
||||
|
||||
for m in getClassInstances nel_ps do
|
||||
(
|
||||
if (renameParticleSystem m) == 1 then
|
||||
result = 1
|
||||
)
|
||||
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return result
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Open the max project
|
||||
if loadMaxFile file quiet:true == true then
|
||||
(
|
||||
objXRefMgr.UpdateAllRecords()
|
||||
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_ps_floater = newRolloutFloater "NeL Assets PS Database" 550 400
|
||||
addrollout assets_ps_rollout assets_ps_floater rolledUp:false
|
||||
|
||||
|
||||
|
|
|
@ -1,329 +1,329 @@
|
|||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
rollout assets_resave_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Open the max project
|
||||
if loadMaxFile file quiet:true == true then
|
||||
(
|
||||
origAnimStart = animationRange.start
|
||||
origAnimEnd = animationRange.end
|
||||
origFrameRate = frameRate
|
||||
|
||||
resetMAXFile #noprompt
|
||||
|
||||
animationRange = interval origAnimStart origAnimEnd
|
||||
frameRate = origFrameRate
|
||||
|
||||
-- Merge the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_resave_floater = newRolloutFloater "NeL Assets Resave Database" 550 874
|
||||
addrollout assets_resave_rollout assets_resave_floater rolledUp:false
|
||||
|
||||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
rollout assets_resave_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Open the max project
|
||||
if loadMaxFile file quiet:true == true then
|
||||
(
|
||||
origAnimStart = animationRange.start
|
||||
origAnimEnd = animationRange.end
|
||||
origFrameRate = frameRate
|
||||
|
||||
resetMAXFile #noprompt
|
||||
|
||||
animationRange = interval origAnimStart origAnimEnd
|
||||
frameRate = origFrameRate
|
||||
|
||||
-- Merge the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_resave_floater = newRolloutFloater "NeL Assets Resave Database" 550 874
|
||||
addrollout assets_resave_rollout assets_resave_floater rolledUp:false
|
||||
|
||||
|
|
|
@ -1,316 +1,316 @@
|
|||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
rollout assets_resave_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Merge the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_resave_floater = newRolloutFloater "NeL Assets Resave Database Hard" 550 874
|
||||
addrollout assets_resave_rollout assets_resave_floater rolledUp:false
|
||||
|
||||
|
||||
NEL3D_APPDATA_INTERFACE_FILE = 1423062700
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
nlErrorFilename = "W:/database/conversion.log"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"w"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Log a message
|
||||
fn nllog message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
include "nel_utility.ms"
|
||||
|
||||
rollout assets_resave_rollout "Properties"
|
||||
(
|
||||
fn do_it =
|
||||
(
|
||||
max select none
|
||||
|
||||
actionMan.executeAction 0 "40021" -- Selection: Select All
|
||||
actionMan.executeAction 0 "311" -- Tools: Zoom Extents All Selected
|
||||
actionMan.executeAction 0 "40807" -- Views: Activate All Maps
|
||||
actionMan.executeAction 0 "63508" -- Views: Standard Display with Maps
|
||||
actionMan.executeAction 0 "40043" -- Selection: Select None
|
||||
|
||||
max views redraw
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:true enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:false enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:false enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:false enabled:false
|
||||
CheckBox UseTag "Use tag" checked:false enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
UseTag.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
local origAnimStart
|
||||
local origAnimEnd
|
||||
local origFrameRate
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
if (UseTag.checked == false) or ((NeLTestFileDate file "W:/database/conversion.tag") == true) then
|
||||
(
|
||||
resetMAXFile #noprompt
|
||||
|
||||
nllog("CONVERT " + file)
|
||||
|
||||
-- Merge the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nllog("SKIP " + file + " by tag")
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
)
|
||||
|
||||
assets_resave_floater = newRolloutFloater "NeL Assets Resave Database Hard" 550 874
|
||||
addrollout assets_resave_rollout assets_resave_floater rolledUp:false
|
||||
|
||||
|
|
|
@ -1,251 +1,251 @@
|
|||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:false enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:true enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:true enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:true enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
-- This script is a base script to include to add multiple functionality to your script
|
||||
|
||||
-- To use this script
|
||||
-- Include it in your script into the rollout at the beginning.
|
||||
-- Implement a do_it function to do the job in your rollout.
|
||||
-- The function should retun -1 if an arror occurred, else the count of modification done
|
||||
-- It the function returns <1, the project will not be overwritten
|
||||
|
||||
Group "Running properties"
|
||||
(
|
||||
RadioButtons SourceFiles "Source projects" labels:#("Current project", "All Projects in a folder") align:#left
|
||||
|
||||
Label DirectoryLabel "Source directory" align:#left
|
||||
EditText Directory "" width:500 align:#left enabled:false
|
||||
Button BrowseDirectory "Browse..." align:#left enabled:false
|
||||
|
||||
CheckBox Recurse "Look in subfolders" checked:false enabled:false
|
||||
CheckBox Test "Test only, do not save" checked:true enabled:false
|
||||
CheckBox BackupFiles "Backup files" checked:true enabled:false
|
||||
CheckBox StopOnError "Stop on error" checked:true enabled:false
|
||||
|
||||
Label ProgressText width:500 align:#left
|
||||
ProgressBar Progress width:500 align:#left
|
||||
|
||||
Button GoButton "Go" width:500 align:#left
|
||||
)
|
||||
local countModifications
|
||||
local countErrors
|
||||
local fileModified
|
||||
local fileParsed
|
||||
|
||||
fn UpdateData =
|
||||
(
|
||||
if SourceFiles.state == 2 then
|
||||
isSourceDir = true
|
||||
else
|
||||
isSourceDir = false
|
||||
if Test.checked == true then
|
||||
isTest = true
|
||||
else
|
||||
isTest = false
|
||||
|
||||
Directory.enabled = isSourceDir
|
||||
BrowseDirectory.enabled = isSourceDir
|
||||
Recurse.enabled = isSourceDir
|
||||
Test.enabled = isSourceDir
|
||||
BackupFiles.enabled = isSourceDir and (isTest == false)
|
||||
StopOnError.enabled = isSourceDir
|
||||
)
|
||||
|
||||
on SourceFiles changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
on Test changed state do
|
||||
(
|
||||
UpdateData ()
|
||||
)
|
||||
|
||||
fn call_do_it =
|
||||
(
|
||||
local result
|
||||
|
||||
-- One more project
|
||||
fileParsed = fileParsed + 1
|
||||
|
||||
-- Call it
|
||||
result = do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
countErrors = countErrors + 1
|
||||
else
|
||||
countModifications = countModifications + result
|
||||
|
||||
-- Return result
|
||||
return result
|
||||
)
|
||||
|
||||
fn BackupFile file =
|
||||
(
|
||||
local i
|
||||
local newFilename
|
||||
|
||||
i = 0
|
||||
while true do
|
||||
(
|
||||
-- New file name
|
||||
newFilename = file + ".backup_" + (i as string)
|
||||
|
||||
-- File exist ?
|
||||
if (fileExist newFilename) == false then
|
||||
(
|
||||
if (copyFile file newFilename) == false then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
i = i + 1
|
||||
)
|
||||
)
|
||||
|
||||
fn RecurseFolder currentDirectory =
|
||||
(
|
||||
local result
|
||||
local file
|
||||
local files
|
||||
|
||||
-- Parse files
|
||||
files = getFiles (currentDirectory+"/*.max")
|
||||
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
-- File name
|
||||
file = files[i]
|
||||
|
||||
-- Progress bar
|
||||
ProgressText.text = "In directory "+currentDirectory+", compute file \"" + (getFilenameFile file) + "\""
|
||||
Progress.value = i*100/files.count
|
||||
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
if mergeMaxFile file quiet:true == true then
|
||||
(
|
||||
result = call_do_it ()
|
||||
|
||||
-- Error ?
|
||||
if result < 0 then
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Error in file " + file)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Save the max project ?
|
||||
if (Test.checked == false) and (result != 0) then
|
||||
(
|
||||
-- Backup the max project ?
|
||||
local ok
|
||||
ok = true
|
||||
if BackupFiles.checked == true then
|
||||
(
|
||||
-- Backup the file
|
||||
if (BackupFile file) == false then
|
||||
(
|
||||
-- Don't save the file because backup has failed
|
||||
ok = false
|
||||
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't backup file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Save the max project ?
|
||||
if ok == true then
|
||||
(
|
||||
if (saveMaxFile file) == true then
|
||||
(
|
||||
fileModified = fileModified + 1
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't write file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if StopOnError.checked == true then
|
||||
Messagebox ("Can't load file " + file)
|
||||
|
||||
-- One more error
|
||||
countErrors = countErrors + 1
|
||||
)
|
||||
)
|
||||
|
||||
-- Parse sub directory ?
|
||||
if (Recurse.checked == true) then
|
||||
(
|
||||
local directories
|
||||
|
||||
-- Get the directories
|
||||
directories = getDirectories (currentDirectory+"/*")
|
||||
|
||||
-- For each directories
|
||||
for dir in directories do
|
||||
(
|
||||
RecurseFolder dir
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
on BrowseDirectory pressed do
|
||||
(
|
||||
local dir
|
||||
try
|
||||
(
|
||||
dir = getSavePath () -- caption:"Select the projects directory"
|
||||
if dir != undefined then
|
||||
Directory.text = dir
|
||||
)
|
||||
catch
|
||||
(
|
||||
)
|
||||
)
|
||||
|
||||
on GoButton pressed do
|
||||
(
|
||||
-- Reset count
|
||||
countModifications = 0
|
||||
countErrors = 0
|
||||
fileModified = 0
|
||||
fileParsed = 0
|
||||
|
||||
-- Get files in the shape_source_directory
|
||||
if SourceFiles.state == 2 then
|
||||
(
|
||||
-- Should warning user ?
|
||||
if (SourceFiles.state == 2) and (Test.checked == false) then
|
||||
(
|
||||
-- Warning !
|
||||
if ((queryBox "Warning, all the files in the specified folders will be overwrited.\nYou should backup your files before executing this script.\nDo you want to continue executing this script ?" beep:true) == true) then
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
else
|
||||
(
|
||||
RecurseFolder (adjustPathStringForScript Directory.text)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Just compute the current project
|
||||
call_do_it ()
|
||||
)
|
||||
|
||||
-- Show errors
|
||||
ProgressText.text = (fileParsed as string) + " project(s) opened, " + (countModifications as string) + " project modification(s), " + (fileModified as string) + " project(s) saved, " + (countErrors as string) + " error(s)."
|
||||
Progress.value = 100
|
||||
)
|
||||
|
|
|
@ -1,392 +1,392 @@
|
|||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
|
||||
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
|
||||
-- "1" = is an accelerator type PORTAL
|
||||
-- "2" = is an accelerator type CLUSTER
|
||||
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
|
||||
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
|
||||
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
|
||||
-- "17" = is an accelerator type PORTAL DYNAMIC
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
|
||||
NEL3D_APPDATA_LOD = 1423062537
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
|
||||
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
|
||||
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
|
||||
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
|
||||
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
|
||||
NEL3D_APPDATA_COLLISION = 1423062613
|
||||
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
|
||||
NEL3D_APPDATA_AUTOMATIC_ANIMATION = 1423062617
|
||||
|
||||
-- This node is n accelerator ?
|
||||
fn isAccelerator node =
|
||||
(
|
||||
accel = getappdata node NEL3D_APPDATA_ACCEL
|
||||
if (accel != undefined) then
|
||||
(
|
||||
if (accel == "0") or (accel == "32") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if (isAccelerator node) == true then
|
||||
return false
|
||||
|
||||
if ((classof node) == RklPatch) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_ps) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
return true
|
||||
)
|
||||
|
||||
-- Must export this node ?
|
||||
fn isAnimToBeExported node =
|
||||
(
|
||||
automaticAnimation = getappdata node NEL3D_APPDATA_AUTOMATIC_ANIMATION
|
||||
if (automaticAnimation == undefined) then
|
||||
return false
|
||||
if (automaticAnimation == "0") then
|
||||
return false
|
||||
|
||||
if (isAccelerator node) == true then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
return true
|
||||
)
|
||||
|
||||
-- Cast shadow ?
|
||||
fn isCastShadow node =
|
||||
(
|
||||
if (classof node == nel_ps) then
|
||||
return false
|
||||
|
||||
if (isAccelerator node) == true then
|
||||
(
|
||||
return false
|
||||
)
|
||||
else
|
||||
(
|
||||
return true
|
||||
)
|
||||
)
|
||||
|
||||
-- List the lod
|
||||
lod_array = #()
|
||||
|
||||
-- is a lod ?
|
||||
fn isLod node =
|
||||
(
|
||||
for i = 1 to lod_array.count do
|
||||
(
|
||||
if (lod_array[i] == node) then
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- have a coarse mesh ?
|
||||
fn haveCoarseMesh node =
|
||||
(
|
||||
-- Get lod count
|
||||
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
|
||||
if (nodeCount != undefined) then
|
||||
(
|
||||
-- For each lod
|
||||
nodeCountNum = nodeCount as Integer
|
||||
for lod = 1 to nodeCountNum do
|
||||
(
|
||||
-- Get the lod
|
||||
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
|
||||
|
||||
-- Exist ?
|
||||
if (lod != undefined) then
|
||||
(
|
||||
-- Select a node
|
||||
nd = execute ("$'"+lod+"'")
|
||||
|
||||
-- Node exist ?
|
||||
if (nd != undefined) then
|
||||
(
|
||||
-- Is a coarse mesh ?
|
||||
if (getappdata nd NEL3D_APPDATA_LOD_COARSE_MESH == "1") then
|
||||
return true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
fn getRoot node = if isvalidnode node.parent then getRoot node.parent else node
|
||||
|
||||
fn runNelMaxExportSub inputMaxFile retryCount =
|
||||
(
|
||||
tagThisFile = false
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- Add the lod
|
||||
for node in geometry do
|
||||
(
|
||||
-- Get lod count
|
||||
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
|
||||
if (nodeCount != undefined) then
|
||||
(
|
||||
-- For each lod
|
||||
nodeCountNum = nodeCount as Integer
|
||||
for lod = 1 to nodeCountNum do
|
||||
(
|
||||
-- Get the lod
|
||||
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
|
||||
|
||||
-- Exist ?
|
||||
if (lod != undefined) then
|
||||
(
|
||||
-- Select a node
|
||||
try
|
||||
(
|
||||
nd = execute("$'"+lod+"'")
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("Error in Execute $'"+lod+"' from node "+node.name)
|
||||
nd = undefined
|
||||
)
|
||||
|
||||
-- Node exist ?
|
||||
if (nd != undefined) then
|
||||
(
|
||||
append lod_array nd
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Select objects for shadows
|
||||
for node in geometry do
|
||||
(
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Cast shadow ?
|
||||
if (isCastShadow node == true) then
|
||||
(
|
||||
-- Select this node
|
||||
selectmore node
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Tag this file ?
|
||||
tagThisFile = true
|
||||
|
||||
-- Array of node to export
|
||||
array_node = #()
|
||||
|
||||
-- Add geometry
|
||||
for node in geometry do
|
||||
append array_node node
|
||||
|
||||
-- Add shapes
|
||||
for node in shapes do
|
||||
append array_node node
|
||||
|
||||
-- For each node
|
||||
for node in array_node do
|
||||
(
|
||||
-- Is not a skeleton ?
|
||||
if (((substring node.name 1 3) != "Bip") and ((substring (getRoot node).name 1 3) != "Bip")) then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Not a lod ?
|
||||
if ((isLod node) == false) then
|
||||
(
|
||||
-- Output directory
|
||||
if (haveCoarseMesh node) == true then
|
||||
output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape")
|
||||
else
|
||||
output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate output inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the shape
|
||||
if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then
|
||||
(
|
||||
nlerror("OK "+output)
|
||||
exported = exported +1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED " + output)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Export default animations
|
||||
|
||||
for node in objects do
|
||||
(
|
||||
-- Can export it ?
|
||||
if (isAnimToBeExported node) == true then
|
||||
(
|
||||
-- Anim output directory
|
||||
output = ("%OutputDirectoryAnim%/" + (node.name) + ".anim")
|
||||
|
||||
-- Export the animation
|
||||
if (NelExportAnimation #(node) output false) == false then
|
||||
(
|
||||
nlerror ("ERROR exporting animation " + output)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK " + output)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if exported == 0 then
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING no shape exported from the file " + inputMaxFile)
|
||||
if tagThisFile then
|
||||
(
|
||||
if retryCount < 2 then
|
||||
(
|
||||
nlerror("INFO retry this file")
|
||||
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExportSub inputMaxFile (retryCount + 1)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
|
||||
nlerror("FAIL Mysterious error occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
return runNelMaxExportSub inputMaxFile 0
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
|
||||
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
|
||||
-- "1" = is an accelerator type PORTAL
|
||||
-- "2" = is an accelerator type CLUSTER
|
||||
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
|
||||
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
|
||||
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
|
||||
-- "17" = is an accelerator type PORTAL DYNAMIC
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
|
||||
NEL3D_APPDATA_LOD = 1423062537
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
|
||||
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
|
||||
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
|
||||
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
|
||||
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
|
||||
NEL3D_APPDATA_COLLISION = 1423062613
|
||||
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
|
||||
NEL3D_APPDATA_AUTOMATIC_ANIMATION = 1423062617
|
||||
|
||||
-- This node is n accelerator ?
|
||||
fn isAccelerator node =
|
||||
(
|
||||
accel = getappdata node NEL3D_APPDATA_ACCEL
|
||||
if (accel != undefined) then
|
||||
(
|
||||
if (accel == "0") or (accel == "32") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if (isAccelerator node) == true then
|
||||
return false
|
||||
|
||||
if ((classof node) == RklPatch) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_ps) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
return true
|
||||
)
|
||||
|
||||
-- Must export this node ?
|
||||
fn isAnimToBeExported node =
|
||||
(
|
||||
automaticAnimation = getappdata node NEL3D_APPDATA_AUTOMATIC_ANIMATION
|
||||
if (automaticAnimation == undefined) then
|
||||
return false
|
||||
if (automaticAnimation == "0") then
|
||||
return false
|
||||
|
||||
if (isAccelerator node) == true then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
return true
|
||||
)
|
||||
|
||||
-- Cast shadow ?
|
||||
fn isCastShadow node =
|
||||
(
|
||||
if (classof node == nel_ps) then
|
||||
return false
|
||||
|
||||
if (isAccelerator node) == true then
|
||||
(
|
||||
return false
|
||||
)
|
||||
else
|
||||
(
|
||||
return true
|
||||
)
|
||||
)
|
||||
|
||||
-- List the lod
|
||||
lod_array = #()
|
||||
|
||||
-- is a lod ?
|
||||
fn isLod node =
|
||||
(
|
||||
for i = 1 to lod_array.count do
|
||||
(
|
||||
if (lod_array[i] == node) then
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- have a coarse mesh ?
|
||||
fn haveCoarseMesh node =
|
||||
(
|
||||
-- Get lod count
|
||||
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
|
||||
if (nodeCount != undefined) then
|
||||
(
|
||||
-- For each lod
|
||||
nodeCountNum = nodeCount as Integer
|
||||
for lod = 1 to nodeCountNum do
|
||||
(
|
||||
-- Get the lod
|
||||
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
|
||||
|
||||
-- Exist ?
|
||||
if (lod != undefined) then
|
||||
(
|
||||
-- Select a node
|
||||
nd = execute ("$'"+lod+"'")
|
||||
|
||||
-- Node exist ?
|
||||
if (nd != undefined) then
|
||||
(
|
||||
-- Is a coarse mesh ?
|
||||
if (getappdata nd NEL3D_APPDATA_LOD_COARSE_MESH == "1") then
|
||||
return true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
fn getRoot node = if isvalidnode node.parent then getRoot node.parent else node
|
||||
|
||||
fn runNelMaxExportSub inputMaxFile retryCount =
|
||||
(
|
||||
tagThisFile = false
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- Add the lod
|
||||
for node in geometry do
|
||||
(
|
||||
-- Get lod count
|
||||
nodeCount = getappdata node NEL3D_APPDATA_LOD_NAME_COUNT
|
||||
if (nodeCount != undefined) then
|
||||
(
|
||||
-- For each lod
|
||||
nodeCountNum = nodeCount as Integer
|
||||
for lod = 1 to nodeCountNum do
|
||||
(
|
||||
-- Get the lod
|
||||
lod = getappdata node (NEL3D_APPDATA_LOD_NAME+lod-1)
|
||||
|
||||
-- Exist ?
|
||||
if (lod != undefined) then
|
||||
(
|
||||
-- Select a node
|
||||
try
|
||||
(
|
||||
nd = execute("$'"+lod+"'")
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("Error in Execute $'"+lod+"' from node "+node.name)
|
||||
nd = undefined
|
||||
)
|
||||
|
||||
-- Node exist ?
|
||||
if (nd != undefined) then
|
||||
(
|
||||
append lod_array nd
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Select objects for shadows
|
||||
for node in geometry do
|
||||
(
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Cast shadow ?
|
||||
if (isCastShadow node == true) then
|
||||
(
|
||||
-- Select this node
|
||||
selectmore node
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Tag this file ?
|
||||
tagThisFile = true
|
||||
|
||||
-- Array of node to export
|
||||
array_node = #()
|
||||
|
||||
-- Add geometry
|
||||
for node in geometry do
|
||||
append array_node node
|
||||
|
||||
-- Add shapes
|
||||
for node in shapes do
|
||||
append array_node node
|
||||
|
||||
-- For each node
|
||||
for node in array_node do
|
||||
(
|
||||
-- Is not a skeleton ?
|
||||
if (((substring node.name 1 3) != "Bip") and ((substring (getRoot node).name 1 3) != "Bip")) then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Not a lod ?
|
||||
if ((isLod node) == false) then
|
||||
(
|
||||
-- Output directory
|
||||
if (haveCoarseMesh node) == true then
|
||||
output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape")
|
||||
else
|
||||
output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate output inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the shape
|
||||
if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then
|
||||
(
|
||||
nlerror("OK "+output)
|
||||
exported = exported +1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED " + output)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Export default animations
|
||||
|
||||
for node in objects do
|
||||
(
|
||||
-- Can export it ?
|
||||
if (isAnimToBeExported node) == true then
|
||||
(
|
||||
-- Anim output directory
|
||||
output = ("%OutputDirectoryAnim%/" + (node.name) + ".anim")
|
||||
|
||||
-- Export the animation
|
||||
if (NelExportAnimation #(node) output false) == false then
|
||||
(
|
||||
nlerror ("ERROR exporting animation " + output)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK " + output)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if exported == 0 then
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING no shape exported from the file " + inputMaxFile)
|
||||
if tagThisFile then
|
||||
(
|
||||
if retryCount < 2 then
|
||||
(
|
||||
nlerror("INFO retry this file")
|
||||
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExportSub inputMaxFile (retryCount + 1)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
|
||||
nlerror("FAIL Mysterious error occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
return runNelMaxExportSub inputMaxFile 0
|
||||
)
|
||||
|
||||
|
|
|
@ -1,127 +1,127 @@
|
|||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting '%PreGenFileExtension%' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting '%PreGenFileExtension%' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting '%PreGenFileExtension%': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting '%PreGenFileExtension%' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting '%PreGenFileExtension%' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,271 +1,271 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
NEL3D_APPDATA_EXPORT_NODE_ANIMATION = 1423062800
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".anim")
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select Bip01, not very smart
|
||||
if $Bip01 != undefined then
|
||||
(
|
||||
select $Bip01
|
||||
|
||||
-- Always uncheck triangle pelvis
|
||||
if (classof $Bip01) == Biped_Object then
|
||||
(
|
||||
$Bip01.controller.figureMode = true
|
||||
$Bip01.controller.trianglepelvis = false
|
||||
$Bip01.controller.figureMode = false
|
||||
)
|
||||
)
|
||||
|
||||
-- For each node
|
||||
for node in objects do
|
||||
(
|
||||
exportNodeAnmation = getappdata node NEL3D_APPDATA_EXPORT_NODE_ANIMATION
|
||||
if (exportNodeAnmation != undefined) then
|
||||
(
|
||||
if (exportNodeAnmation == "1") then
|
||||
(
|
||||
selectmore node
|
||||
|
||||
-- Is it a biped ?
|
||||
if (classof node.controller) == Vertical_Horizontal_Turn then
|
||||
(
|
||||
-- Always uncheck triangle pelvis
|
||||
node.controller.trianglepelvis = false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if ((selection as array).count != 0) then
|
||||
(
|
||||
-- Export the animation
|
||||
if (NelExportAnimation (selection as array) outputNelFile false) == false then
|
||||
(
|
||||
nlerror("ERROR exporting animation " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING exporting animation: no node animated to export in file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'anim': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'anim' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'anim' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
NEL3D_APPDATA_EXPORT_NODE_ANIMATION = 1423062800
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".anim")
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select Bip01, not very smart
|
||||
if $Bip01 != undefined then
|
||||
(
|
||||
select $Bip01
|
||||
|
||||
-- Always uncheck triangle pelvis
|
||||
if (classof $Bip01) == Biped_Object then
|
||||
(
|
||||
$Bip01.controller.figureMode = true
|
||||
$Bip01.controller.trianglepelvis = false
|
||||
$Bip01.controller.figureMode = false
|
||||
)
|
||||
)
|
||||
|
||||
-- For each node
|
||||
for node in objects do
|
||||
(
|
||||
exportNodeAnmation = getappdata node NEL3D_APPDATA_EXPORT_NODE_ANIMATION
|
||||
if (exportNodeAnmation != undefined) then
|
||||
(
|
||||
if (exportNodeAnmation == "1") then
|
||||
(
|
||||
selectmore node
|
||||
|
||||
-- Is it a biped ?
|
||||
if (classof node.controller) == Vertical_Horizontal_Turn then
|
||||
(
|
||||
-- Always uncheck triangle pelvis
|
||||
node.controller.trianglepelvis = false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if ((selection as array).count != 0) then
|
||||
(
|
||||
-- Export the animation
|
||||
if (NelExportAnimation (selection as array) outputNelFile false) == false then
|
||||
(
|
||||
nlerror("ERROR exporting animation " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING exporting animation: no node animated to export in file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'anim': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'anim' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'anim' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,328 +1,328 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
NEL3D_APPDATA_CHARACTER_LOD = 1423062618 -- "1": I am a character lod if "1". "0" or undefined: I am not.
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if ((classof node) == RklPatch) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_ps) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
return true
|
||||
)
|
||||
|
||||
|
||||
-- is this node flagged as a LodCharacter ??
|
||||
fn isLodCharacter node =
|
||||
(
|
||||
isCLod = getappdata node NEL3D_APPDATA_CHARACTER_LOD
|
||||
if (isCLod == undefined) then
|
||||
return false
|
||||
if (isCLod == "1") then
|
||||
return true
|
||||
return false
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- For each node
|
||||
for node in geometry do
|
||||
(
|
||||
-- It is root ?
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Is a Lod character?
|
||||
if ((isLodCharacter node) == true) then
|
||||
(
|
||||
-- Output directory
|
||||
outputNelFile = ("%OutputDirectory%/" + (node.name) + ".clod")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the shape
|
||||
if (NelExportLodCharacter node outputNelFile false) == true then
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
exported = exported+1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting .clod " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting .clod " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if (exported == 0) then
|
||||
(
|
||||
-- Error
|
||||
nlerror ("WARNING no .clod exported from the file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'clod': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'clod' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'clod' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
NEL3D_APPDATA_CHARACTER_LOD = 1423062618 -- "1": I am a character lod if "1". "0" or undefined: I am not.
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if ((classof node) == RklPatch) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_ps) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_cylinder) then
|
||||
return false
|
||||
|
||||
if ((classof node) == nel_pacs_box) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
return true
|
||||
)
|
||||
|
||||
|
||||
-- is this node flagged as a LodCharacter ??
|
||||
fn isLodCharacter node =
|
||||
(
|
||||
isCLod = getappdata node NEL3D_APPDATA_CHARACTER_LOD
|
||||
if (isCLod == undefined) then
|
||||
return false
|
||||
if (isCLod == "1") then
|
||||
return true
|
||||
return false
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- For each node
|
||||
for node in geometry do
|
||||
(
|
||||
-- It is root ?
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Is a Lod character?
|
||||
if ((isLodCharacter node) == true) then
|
||||
(
|
||||
-- Output directory
|
||||
outputNelFile = ("%OutputDirectory%/" + (node.name) + ".clod")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the shape
|
||||
if (NelExportLodCharacter node outputNelFile false) == true then
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
exported = exported+1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting .clod " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting .clod " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if (exported == 0) then
|
||||
(
|
||||
-- Error
|
||||
nlerror ("WARNING no .clod exported from the file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'clod': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'clod' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'clod' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,378 +1,378 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
|
||||
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
|
||||
-- "1" = is an accelerator type PORTAL
|
||||
-- "2" = is an accelerator type CLUSTER
|
||||
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
|
||||
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
|
||||
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
|
||||
-- "17" = is an accelerator type PORTAL DYNAMIC
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_IGNAME = 1423062564 -- string : name of the Instance Group
|
||||
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
|
||||
NEL3D_APPDATA_LOD = 1423062537
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
|
||||
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
|
||||
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
|
||||
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
|
||||
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
|
||||
|
||||
NEL_OBJECT_NAME_DATA = 1970
|
||||
|
||||
|
||||
-- This node is n accelerator ?
|
||||
fn isAccelerator node =
|
||||
(
|
||||
accel = getappdata node NEL3D_APPDATA_ACCEL
|
||||
if (accel != undefined) then
|
||||
(
|
||||
if (accel == "0") or (accel == "32") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- Get the ig name of this object
|
||||
fn getIg node =
|
||||
(
|
||||
return (getappdata node NEL3D_APPDATA_IGNAME)
|
||||
)
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- Ig array
|
||||
ig_array = #()
|
||||
|
||||
-- Scan all the ig in this project
|
||||
for node in objects do
|
||||
(
|
||||
ig = getIg node
|
||||
if ( (ig != undefined) and (ig != "") ) then
|
||||
(
|
||||
-- Found ?
|
||||
found = false
|
||||
|
||||
-- Already found ?
|
||||
for j = 1 to ig_array.count do
|
||||
(
|
||||
if (ig_array[j]==ig) then
|
||||
(
|
||||
found = true
|
||||
exit
|
||||
)
|
||||
)
|
||||
|
||||
-- Found ?
|
||||
if (found == false) then
|
||||
(
|
||||
append ig_array ig
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Have some ig ?
|
||||
if (ig_array.count != 0) then
|
||||
(
|
||||
-- For each ig
|
||||
for ig = 1 to ig_array.count do
|
||||
(
|
||||
-- Output filename
|
||||
outputNelFile = ("%OutputDirectory%/" + ig_array[ig] + ".ig")
|
||||
|
||||
-- Check date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
-- Select none
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Select all node in this ig
|
||||
for node in geometry do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in lights do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in helpers do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
|
||||
-- Check export
|
||||
try
|
||||
(
|
||||
-- Export the ig
|
||||
instancegroup2export = $selection as array
|
||||
if (NelExportInstanceGroup instancegroup2export outputNelFile) == true then
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting ig " + ig_array[ig] + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting ig " + ig_array[ig] + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING nothing exported from ig max file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'ig': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'ig' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'ig' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_ACCEL = 1423062561 -- type of accelerator : "32" = is not an accelerator and IS clusterized
|
||||
-- "0" = is not an accelerator and IS NOT clusterized (always visible)
|
||||
-- "1" = is an accelerator type PORTAL
|
||||
-- "2" = is an accelerator type CLUSTER
|
||||
-- "6" = is an accelerator type CLUSTER FATHER-VISIBLE
|
||||
-- "10" = is an accelerator type CLUSTER VISIBLE-FROM-FATHER
|
||||
-- "14" = is an accelerator type CLUSTER FATHER-VISIBLE and VISIBLE-FROM-FATHER
|
||||
-- "17" = is an accelerator type PORTAL DYNAMIC
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_IGNAME = 1423062564 -- string : name of the Instance Group
|
||||
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT_MAX = 10
|
||||
NEL3D_APPDATA_LOD = 1423062537
|
||||
NEL3D_APPDATA_LOD_NAME_COUNT = NEL3D_APPDATA_LOD
|
||||
NEL3D_APPDATA_LOD_NAME = NEL3D_APPDATA_LOD_NAME_COUNT+1
|
||||
NEL3D_APPDATA_LOD_BLEND_IN = NEL3D_APPDATA_LOD_NAME+NEL3D_APPDATA_LOD_NAME_COUNT_MAX
|
||||
NEL3D_APPDATA_LOD_BLEND_OUT = NEL3D_APPDATA_LOD_BLEND_IN+1
|
||||
NEL3D_APPDATA_LOD_COARSE_MESH = NEL3D_APPDATA_LOD_BLEND_OUT+1
|
||||
|
||||
NEL_OBJECT_NAME_DATA = 1970
|
||||
|
||||
|
||||
-- This node is n accelerator ?
|
||||
fn isAccelerator node =
|
||||
(
|
||||
accel = getappdata node NEL3D_APPDATA_ACCEL
|
||||
if (accel != undefined) then
|
||||
(
|
||||
if (accel == "0") or (accel == "32") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
)
|
||||
return false
|
||||
)
|
||||
|
||||
-- Get the ig name of this object
|
||||
fn getIg node =
|
||||
(
|
||||
return (getappdata node NEL3D_APPDATA_IGNAME)
|
||||
)
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- Ig array
|
||||
ig_array = #()
|
||||
|
||||
-- Scan all the ig in this project
|
||||
for node in objects do
|
||||
(
|
||||
ig = getIg node
|
||||
if ( (ig != undefined) and (ig != "") ) then
|
||||
(
|
||||
-- Found ?
|
||||
found = false
|
||||
|
||||
-- Already found ?
|
||||
for j = 1 to ig_array.count do
|
||||
(
|
||||
if (ig_array[j]==ig) then
|
||||
(
|
||||
found = true
|
||||
exit
|
||||
)
|
||||
)
|
||||
|
||||
-- Found ?
|
||||
if (found == false) then
|
||||
(
|
||||
append ig_array ig
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Have some ig ?
|
||||
if (ig_array.count != 0) then
|
||||
(
|
||||
-- For each ig
|
||||
for ig = 1 to ig_array.count do
|
||||
(
|
||||
-- Output filename
|
||||
outputNelFile = ("%OutputDirectory%/" + ig_array[ig] + ".ig")
|
||||
|
||||
-- Check date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
-- Select none
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Select all node in this ig
|
||||
for node in geometry do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in lights do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
-- Select all lights in this ig
|
||||
for node in helpers do
|
||||
(
|
||||
-- Select it if in the ig
|
||||
if ((getIg node) == ig_array[ig]) then
|
||||
selectmore node
|
||||
)
|
||||
|
||||
-- Check export
|
||||
try
|
||||
(
|
||||
-- Export the ig
|
||||
instancegroup2export = $selection as array
|
||||
if (NelExportInstanceGroup instancegroup2export outputNelFile) == true then
|
||||
(
|
||||
nlerror("OK " + outputNelFile)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting ig " + ig_array[ig] + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fatal error exporting ig " + ig_array[ig] + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING nothing exported from ig max file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'ig': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'ig' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'ig' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,251 +1,251 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim")
|
||||
tagThisFile = false
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select none
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Select all PACS primitives
|
||||
for i in geometry do
|
||||
(
|
||||
if ((classof i) == nel_pacs_cylinder) or ((classof i) == nel_pacs_box) then
|
||||
selectmore i
|
||||
)
|
||||
|
||||
-- Array of node
|
||||
arrayNode = selection as array
|
||||
|
||||
-- Something to export ?
|
||||
if (arrayNode.count != 0) then
|
||||
(
|
||||
-- Export the collision
|
||||
if (NelExportPACSPrimitives arrayNode outputNelFile) == false then
|
||||
(
|
||||
nlerror("ERROR exporting PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = true
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = true
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'pacs_prim' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim")
|
||||
tagThisFile = false
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select none
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Select all PACS primitives
|
||||
for i in geometry do
|
||||
(
|
||||
if ((classof i) == nel_pacs_cylinder) or ((classof i) == nel_pacs_box) then
|
||||
selectmore i
|
||||
)
|
||||
|
||||
-- Array of node
|
||||
arrayNode = selection as array
|
||||
|
||||
-- Something to export ?
|
||||
if (arrayNode.count != 0) then
|
||||
(
|
||||
-- Export the collision
|
||||
if (NelExportPACSPrimitives arrayNode outputNelFile) == false then
|
||||
(
|
||||
nlerror("ERROR exporting PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = true
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no PACS primitives in file " + inputMaxFile)
|
||||
tagThisFile = true
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'pacs_prim' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,263 +1,263 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
NEL3D_APPDATA_COLLISION = 1423062613
|
||||
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return true
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return true
|
||||
)
|
||||
|
||||
return false
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelDir = "%OutputDirectory%"
|
||||
|
||||
-- Tag this file ?
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select all collision mesh
|
||||
max select none
|
||||
clearSelection()
|
||||
for m in geometry do
|
||||
(
|
||||
if (isToBeExported m) == true then
|
||||
selectmore m
|
||||
)
|
||||
|
||||
-- Export the collision
|
||||
if (NelExportCollision ($selection as array) outputNelDir) == false then
|
||||
(
|
||||
nlerror("ERROR exporting collision " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK collision in folder " + outputNelDir)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'cmb': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'cmb' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'cmb' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
NEL3D_APPDATA_COLLISION = 1423062613
|
||||
NEL3D_APPDATA_COLLISION_EXTERIOR = 1423062614
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return true
|
||||
)
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_COLLISION_EXTERIOR
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return true
|
||||
)
|
||||
|
||||
return false
|
||||
)
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
outputNelDir = "%OutputDirectory%"
|
||||
|
||||
-- Tag this file ?
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidecategory()
|
||||
|
||||
-- Select all collision mesh
|
||||
max select none
|
||||
clearSelection()
|
||||
for m in geometry do
|
||||
(
|
||||
if (isToBeExported m) == true then
|
||||
selectmore m
|
||||
)
|
||||
|
||||
-- Export the collision
|
||||
if (NelExportCollision ($selection as array) outputNelDir) == false then
|
||||
(
|
||||
nlerror("ERROR exporting collision " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("OK collision in folder " + outputNelDir)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'cmb': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'cmb' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'cmb' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,318 +1,318 @@
|
|||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_VEGETABLE = 1423062580 -- "undefined" = not vegetable
|
||||
-- "0" = not vegetable
|
||||
-- "1" = vegetable
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if (classof node == nel_ps) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
vegetable = getappdata node NEL3D_APPDATA_VEGETABLE
|
||||
if (vegetable != undefined) then
|
||||
if (vegetable == "1") then
|
||||
return true
|
||||
|
||||
-- Do not export
|
||||
return false
|
||||
)
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- For each node
|
||||
for node in geometry do
|
||||
(
|
||||
-- It is root ?
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Is not a skeleton ?
|
||||
if (node.name != "Bip01") then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Output directory
|
||||
outputNelFile = ("%OutputDirectory%/" + (node.name) + ".veget")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the veget
|
||||
if (NelExportVegetable node outputNelFile false) == true then
|
||||
(
|
||||
nlerror("OK "+outputNelFile)
|
||||
exported = exported+1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting veget " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fata error exporting veget " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if exported == 0 then
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING no veget exported from the file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'veget': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'veget' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'veget' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
||||
|
||||
-- #################################################################
|
||||
-- ## WARNING : this is a generated file, don't change it !
|
||||
-- #################################################################
|
||||
|
||||
|
||||
-- Allocate 20 Me for the script
|
||||
heapSize += 15000000
|
||||
|
||||
-- In case of error just abort the app and don't show nel report window
|
||||
NelForceQuitOnMsgDisplayer()
|
||||
|
||||
nlErrorFilename = "%OutputLogfile%"
|
||||
nlErrorStream = openFile nlErrorFilename mode:"a"
|
||||
if nlErrorStream == undefined then
|
||||
nlErrorStream = createFile nlErrorFilename
|
||||
|
||||
-- Unhide layers
|
||||
fn unhidelayers =
|
||||
(
|
||||
for i = 0 to (LayerManager.count - 1) do
|
||||
(
|
||||
layer = (LayerManager.getLayer i)
|
||||
layer.ishidden = false
|
||||
)
|
||||
)
|
||||
|
||||
-- Unhide category
|
||||
fn unhidecategory =
|
||||
(
|
||||
if (geometry.count > 0) then
|
||||
(
|
||||
unhide geometry[1]
|
||||
if (geometry[1].ishidden == true) then
|
||||
max hide object toggle
|
||||
)
|
||||
if (shapes.count > 0) then
|
||||
(
|
||||
unhide shapes[1]
|
||||
if (shapes[1].ishidden == true) then
|
||||
max hide shape toggle
|
||||
)
|
||||
if (lights.count > 0) then
|
||||
(
|
||||
unhide lights[1]
|
||||
if (lights[1].ishidden == true) then
|
||||
max hide light toggle
|
||||
)
|
||||
if (cameras.count > 0) then
|
||||
(
|
||||
unhide cameras[1]
|
||||
if (cameras[1].ishidden == true) then
|
||||
max hide camera toggle
|
||||
)
|
||||
if (helpers.count > 0) then
|
||||
(
|
||||
unhide helpers[1]
|
||||
if (helpers[1].ishidden == true) then
|
||||
max hide helper toggle
|
||||
)
|
||||
)
|
||||
|
||||
-- Log a message
|
||||
fn nlerror message =
|
||||
(
|
||||
if nlErrorStream != undefined then
|
||||
(
|
||||
format "%\n" message to:nlErrorStream
|
||||
flush nlErrorStream
|
||||
)
|
||||
|
||||
-- To the console
|
||||
print message
|
||||
)
|
||||
|
||||
|
||||
|
||||
-- Some globals
|
||||
|
||||
NEL3D_APPDATA_DONOTEXPORT = 1423062565 -- do not export me : "undefined" = export me
|
||||
-- "0" = export me
|
||||
-- "1" = DONT export me
|
||||
|
||||
NEL3D_APPDATA_VEGETABLE = 1423062580 -- "undefined" = not vegetable
|
||||
-- "0" = not vegetable
|
||||
-- "1" = vegetable
|
||||
|
||||
|
||||
-- Must export this node ?
|
||||
fn isToBeExported node =
|
||||
(
|
||||
if (classof node == nel_ps) then
|
||||
return false
|
||||
|
||||
doNotExport = getappdata node NEL3D_APPDATA_DONOTEXPORT
|
||||
if (doNotExport != undefined) then
|
||||
(
|
||||
if (doNotExport == "1") then
|
||||
return false
|
||||
)
|
||||
|
||||
vegetable = getappdata node NEL3D_APPDATA_VEGETABLE
|
||||
if (vegetable != undefined) then
|
||||
if (vegetable == "1") then
|
||||
return true
|
||||
|
||||
-- Do not export
|
||||
return false
|
||||
)
|
||||
|
||||
|
||||
fn runNelMaxExport inputMaxFile =
|
||||
(
|
||||
tagThisFile = true
|
||||
|
||||
-- Unhide category
|
||||
unhidelayers()
|
||||
unhidecategory()
|
||||
|
||||
-- Unhide
|
||||
max unhide all
|
||||
|
||||
-- unselect
|
||||
max select none
|
||||
clearSelection()
|
||||
|
||||
-- Exported object count
|
||||
exported = 0
|
||||
|
||||
-- For each node
|
||||
for node in geometry do
|
||||
(
|
||||
-- It is root ?
|
||||
if (node.parent == undefined) then
|
||||
(
|
||||
-- Is not a skeleton ?
|
||||
if (node.name != "Bip01") then
|
||||
(
|
||||
-- Can be exported ?
|
||||
if (isToBeExported node == true) then
|
||||
(
|
||||
-- Output directory
|
||||
outputNelFile = ("%OutputDirectory%/" + (node.name) + ".veget")
|
||||
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputNelFile inputMaxFile) == true then
|
||||
(
|
||||
try
|
||||
(
|
||||
-- Export the veget
|
||||
if (NelExportVegetable node outputNelFile false) == true then
|
||||
(
|
||||
nlerror("OK "+outputNelFile)
|
||||
exported = exported+1
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting veget " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR fata error exporting veget " + node.name + " in file " + inputMaxFile)
|
||||
tagThisFile = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("SKIPPED " + outputNelFile)
|
||||
exported = exported + 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Something exported
|
||||
if exported == 0 then
|
||||
(
|
||||
-- Error
|
||||
nlerror("WARNING no veget exported from the file " + inputMaxFile)
|
||||
)
|
||||
|
||||
return tagThisFile
|
||||
)
|
||||
|
||||
|
||||
|
||||
removeRunningTag = true
|
||||
|
||||
try
|
||||
(
|
||||
undo off
|
||||
(
|
||||
-- Get files in the %MaxSourceDirectory% directory
|
||||
files = getFiles "%MaxSourceDirectory%/*.max"
|
||||
gc()
|
||||
|
||||
-- Sort files
|
||||
sort files
|
||||
gc()
|
||||
|
||||
-- No file ?
|
||||
if files.count != 0 then
|
||||
(
|
||||
-- For each files
|
||||
for i = 1 to files.count do
|
||||
(
|
||||
inputMaxFile = files[i]
|
||||
outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag")
|
||||
|
||||
--try
|
||||
--(
|
||||
-- Compare file date
|
||||
if (NeLTestFileDate outputTagFile inputMaxFile) == true then
|
||||
(
|
||||
-- Free memory and file handles
|
||||
gc()
|
||||
heapfree
|
||||
|
||||
-- Reset 3dsmax
|
||||
resetMAXFile #noprompt
|
||||
|
||||
-- Open the max project
|
||||
nlerror("Scanning file " + inputMaxFile + " ...")
|
||||
if (loadMaxFile inputMaxFile quiet:true) == true then
|
||||
(
|
||||
tagThisFile = runNelMaxExport(inputMaxFile)
|
||||
|
||||
-- Write a tag file
|
||||
if tagThisFile == true then
|
||||
(
|
||||
tagFile = createFile outputTagFile
|
||||
if tagFile == undefined then
|
||||
(
|
||||
nlerror("WARNING can't create tag file " + outputTagFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
else
|
||||
(
|
||||
print "mukyu" to: tagFile
|
||||
close tagFile
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR exporting 'veget': can't open the file " + inputMaxFile)
|
||||
removeRunningTag = false
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("SKIPPED BY TAG " + inputMaxFile)
|
||||
)
|
||||
--)
|
||||
--catch
|
||||
--(
|
||||
-- -- Error
|
||||
-- nlerror("ERROR error exporting 'veget' in file " + inputMaxFile)
|
||||
-- removeRunningTag = false
|
||||
--)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("WARNING no *.max file in folder %MaxSourceDirectory%")
|
||||
)
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
-- Error
|
||||
nlerror("ERROR Fatal error exporting 'veget' in folder %MaxSourceDirectory%")
|
||||
nlerror("FAIL Fatal error occurred")
|
||||
NelForceQuitRightNow()
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
try
|
||||
(
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
resetMAXFile #noPrompt
|
||||
)
|
||||
)
|
||||
catch
|
||||
(
|
||||
nlerror("FAIL Last reset fails")
|
||||
removeRunningTag = false
|
||||
)
|
||||
|
||||
if (removeRunningTag) then
|
||||
(
|
||||
nlerror("SUCCESS All .max files have been successfully exported")
|
||||
deleteFile("%TagDirectory%/max_running.tag")
|
||||
)
|
||||
else
|
||||
(
|
||||
nlerror("FAIL One or more issues occurred")
|
||||
NelForceQuitRightNow()
|
||||
)
|
||||
|
||||
-- Bye
|
||||
nlerror("BYE")
|
||||
quitMAX #noPrompt
|
||||
quitMAX() #noPrompt
|
||||
|
||||
|
|
|
@ -1,430 +0,0 @@
|
|||
// Condition.cpp: implementation of the CCondition class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "logic_editor.h"
|
||||
#include "condition.h"
|
||||
#include "nel/logic/logic_condition.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace NLLOGIC;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CConditionNode implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CConditionNode::CConditionNode(const CConditionNode &node)
|
||||
{
|
||||
this->m_dComparand = node.m_dComparand;
|
||||
this->m_pParentNode = node.m_pParentNode;
|
||||
this->m_sConditionName = node.m_sConditionName;
|
||||
this->m_sOperator = node.m_sOperator;
|
||||
this->m_sVariableName = node.m_sVariableName;
|
||||
this->m_type = node.m_type;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = node.m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctSubTree.AddTail( newNode );
|
||||
newNode->m_pParentNode = this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CConditionNode::~CConditionNode()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CString & CConditionNode::getNodeAsString() const
|
||||
{
|
||||
m_sNodeString.Empty();
|
||||
|
||||
if (m_type == NOT)
|
||||
m_sNodeString = "NOT";
|
||||
else if (m_type == TERMINATOR)
|
||||
m_sNodeString = "term";
|
||||
else if (m_type == SUB_CONDITION)
|
||||
m_sNodeString = m_sConditionName;
|
||||
else // comparison
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
=======
|
||||
m_sNodeString.Format(_T("%s %s %g"),LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
>>>>>>> ryzomcore
|
||||
}
|
||||
|
||||
return m_sNodeString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName(old, newName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if ( m_sConditionName == old)
|
||||
m_sConditionName = newName;
|
||||
}
|
||||
|
||||
void CConditionNode::conditionDeleted( const CString &name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctSubTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CCondition implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
CCondition::CCondition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCondition::CCondition( const CCondition &cond)
|
||||
{
|
||||
this->m_sName = cond.m_sName;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctConditionTree.AddTail( newNode );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CCondition::~CCondition()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCondition::changeConditionName( CString old, const CString &newName) const
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName( old, newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCondition::conditionDeleted( CString name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctConditionTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionNodeToCLogicConditionNode (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
|
||||
{
|
||||
// if this node is a terminator node
|
||||
if( conditionNode->m_type == CConditionNode::TERMINATOR )
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
|
||||
}
|
||||
else
|
||||
// this node is a logic node
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
|
||||
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( conditionNode->m_type )
|
||||
{
|
||||
case CConditionNode::NOT :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::COMPARISON :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
|
||||
|
||||
<<<<<<< HEAD
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
|
||||
=======
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
|
||||
>>>>>>> ryzomcore
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::SUB_CONDITION :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
|
||||
|
||||
<<<<<<< HEAD
|
||||
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
|
||||
=======
|
||||
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
|
||||
>>>>>>> ryzomcore
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
POSITION pos;
|
||||
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
|
||||
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
|
||||
logicConditionNode->addNode( logicConditionNodeTmp );
|
||||
}
|
||||
}
|
||||
|
||||
} // cConditionNodeToCLogicConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionToCLogicCondition (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
|
||||
{
|
||||
// condition name
|
||||
<<<<<<< HEAD
|
||||
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
|
||||
=======
|
||||
logicCondition.setName(tStrToUtf8(condition.m_sName));
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// nodes
|
||||
POSITION pos;
|
||||
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
// get the node
|
||||
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
|
||||
|
||||
// convert the node
|
||||
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
|
||||
|
||||
// add the node
|
||||
logicCondition.addNode( *logicConditionNode );
|
||||
}
|
||||
|
||||
} // cConditionToCLogicCondition //
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cLogicConditionNodeToCConditionNode (Service --> Editor)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
|
||||
{
|
||||
// terminator node
|
||||
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
// logic block with condition sub tree
|
||||
else
|
||||
{
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( logicConditionNode->LogicBlock.Type )
|
||||
{
|
||||
case CLogicConditionLogicBlock::NOT :
|
||||
{
|
||||
node->m_type = CConditionNode::NOT;
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::COMPARISON :
|
||||
{
|
||||
node->m_type = CConditionNode::COMPARISON;
|
||||
|
||||
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
|
||||
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
|
||||
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
|
||||
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::SUB_CONDITION :
|
||||
{
|
||||
node->m_type = CConditionNode::SUB_CONDITION;
|
||||
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
|
||||
};
|
||||
break;
|
||||
|
||||
default :
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
vector<CLogicConditionNode *>::const_iterator itNode;
|
||||
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
|
||||
{
|
||||
CConditionNode * nodeTmp = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
|
||||
nodeTmp->m_pParentNode = node;
|
||||
node->m_ctSubTree.AddTail( nodeTmp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // cLogicConditionNodeToCConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// cLogicConditionToCCondition
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
|
||||
{
|
||||
// condition name
|
||||
condition.m_sName = CString( logicCondition.getName().c_str() );
|
||||
|
||||
// condition tree
|
||||
vector<CLogicConditionNode>::const_iterator itNode;
|
||||
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
|
||||
{
|
||||
// convert the node
|
||||
CConditionNode * node = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( &(*itNode), node );
|
||||
|
||||
// add the node
|
||||
condition.m_ctConditionTree.AddTail( node );
|
||||
}
|
||||
|
||||
} // cLogicConditionToCCondition //
|
||||
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
// Condition.cpp: implementation of the CCondition class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "logic_editor.h"
|
||||
#include "condition.h"
|
||||
#include "nel/logic/logic_condition.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace NLLOGIC;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CConditionNode implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CConditionNode::CConditionNode(const CConditionNode &node)
|
||||
{
|
||||
this->m_dComparand = node.m_dComparand;
|
||||
this->m_pParentNode = node.m_pParentNode;
|
||||
this->m_sConditionName = node.m_sConditionName;
|
||||
this->m_sOperator = node.m_sOperator;
|
||||
this->m_sVariableName = node.m_sVariableName;
|
||||
this->m_type = node.m_type;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = node.m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctSubTree.AddTail( newNode );
|
||||
newNode->m_pParentNode = this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CConditionNode::~CConditionNode()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CString & CConditionNode::getNodeAsString() const
|
||||
{
|
||||
m_sNodeString.Empty();
|
||||
|
||||
if (m_type == NOT)
|
||||
m_sNodeString = "NOT";
|
||||
else if (m_type == TERMINATOR)
|
||||
m_sNodeString = "term";
|
||||
else if (m_type == SUB_CONDITION)
|
||||
m_sNodeString = m_sConditionName;
|
||||
else // comparison
|
||||
{
|
||||
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
}
|
||||
|
||||
return m_sNodeString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName(old, newName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if ( m_sConditionName == old)
|
||||
m_sConditionName = newName;
|
||||
}
|
||||
|
||||
void CConditionNode::conditionDeleted( const CString &name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctSubTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CCondition implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
CCondition::CCondition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCondition::CCondition( const CCondition &cond)
|
||||
{
|
||||
this->m_sName = cond.m_sName;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctConditionTree.AddTail( newNode );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CCondition::~CCondition()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCondition::changeConditionName( CString old, const CString &newName) const
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName( old, newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCondition::conditionDeleted( CString name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctConditionTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionNodeToCLogicConditionNode (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
|
||||
{
|
||||
// if this node is a terminator node
|
||||
if( conditionNode->m_type == CConditionNode::TERMINATOR )
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
|
||||
}
|
||||
else
|
||||
// this node is a logic node
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
|
||||
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( conditionNode->m_type )
|
||||
{
|
||||
case CConditionNode::NOT :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::COMPARISON :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
|
||||
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::SUB_CONDITION :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
|
||||
|
||||
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
POSITION pos;
|
||||
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
|
||||
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
|
||||
logicConditionNode->addNode( logicConditionNodeTmp );
|
||||
}
|
||||
}
|
||||
|
||||
} // cConditionNodeToCLogicConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionToCLogicCondition (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
|
||||
{
|
||||
// condition name
|
||||
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
|
||||
|
||||
// nodes
|
||||
POSITION pos;
|
||||
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
// get the node
|
||||
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
|
||||
|
||||
// convert the node
|
||||
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
|
||||
|
||||
// add the node
|
||||
logicCondition.addNode( *logicConditionNode );
|
||||
}
|
||||
|
||||
} // cConditionToCLogicCondition //
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cLogicConditionNodeToCConditionNode (Service --> Editor)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
|
||||
{
|
||||
// terminator node
|
||||
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
// logic block with condition sub tree
|
||||
else
|
||||
{
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( logicConditionNode->LogicBlock.Type )
|
||||
{
|
||||
case CLogicConditionLogicBlock::NOT :
|
||||
{
|
||||
node->m_type = CConditionNode::NOT;
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::COMPARISON :
|
||||
{
|
||||
node->m_type = CConditionNode::COMPARISON;
|
||||
|
||||
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
|
||||
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
|
||||
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
|
||||
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::SUB_CONDITION :
|
||||
{
|
||||
node->m_type = CConditionNode::SUB_CONDITION;
|
||||
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
|
||||
};
|
||||
break;
|
||||
|
||||
default :
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
vector<CLogicConditionNode *>::const_iterator itNode;
|
||||
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
|
||||
{
|
||||
CConditionNode * nodeTmp = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
|
||||
nodeTmp->m_pParentNode = node;
|
||||
node->m_ctSubTree.AddTail( nodeTmp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // cLogicConditionNodeToCConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// cLogicConditionToCCondition
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
|
||||
{
|
||||
// condition name
|
||||
condition.m_sName = CString( logicCondition.getName().c_str() );
|
||||
|
||||
// condition tree
|
||||
vector<CLogicConditionNode>::const_iterator itNode;
|
||||
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
|
||||
{
|
||||
// convert the node
|
||||
CConditionNode * node = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( &(*itNode), node );
|
||||
|
||||
// add the node
|
||||
condition.m_ctConditionTree.AddTail( node );
|
||||
}
|
||||
|
||||
} // cLogicConditionToCCondition //
|
||||
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
// Condition.cpp: implementation of the CCondition class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "logic_editor.h"
|
||||
#include "condition.h"
|
||||
#include "nel/logic/logic_condition.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace NLLOGIC;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CConditionNode implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CConditionNode::CConditionNode(const CConditionNode &node)
|
||||
{
|
||||
this->m_dComparand = node.m_dComparand;
|
||||
this->m_pParentNode = node.m_pParentNode;
|
||||
this->m_sConditionName = node.m_sConditionName;
|
||||
this->m_sOperator = node.m_sOperator;
|
||||
this->m_sVariableName = node.m_sVariableName;
|
||||
this->m_type = node.m_type;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = node.m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctSubTree.AddTail( newNode );
|
||||
newNode->m_pParentNode = this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CConditionNode::~CConditionNode()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CString & CConditionNode::getNodeAsString() const
|
||||
{
|
||||
m_sNodeString.Empty();
|
||||
|
||||
if (m_type == NOT)
|
||||
m_sNodeString = "NOT";
|
||||
else if (m_type == TERMINATOR)
|
||||
m_sNodeString = "term";
|
||||
else if (m_type == SUB_CONDITION)
|
||||
m_sNodeString = m_sConditionName;
|
||||
else // comparison
|
||||
{
|
||||
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
}
|
||||
|
||||
return m_sNodeString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName(old, newName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if ( m_sConditionName == old)
|
||||
m_sConditionName = newName;
|
||||
}
|
||||
|
||||
void CConditionNode::conditionDeleted( const CString &name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctSubTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CCondition implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
CCondition::CCondition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCondition::CCondition( const CCondition &cond)
|
||||
{
|
||||
this->m_sName = cond.m_sName;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctConditionTree.AddTail( newNode );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CCondition::~CCondition()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCondition::changeConditionName( CString old, const CString &newName) const
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName( old, newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCondition::conditionDeleted( CString name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctConditionTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionNodeToCLogicConditionNode (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
|
||||
{
|
||||
// if this node is a terminator node
|
||||
if( conditionNode->m_type == CConditionNode::TERMINATOR )
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
|
||||
}
|
||||
else
|
||||
// this node is a logic node
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
|
||||
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( conditionNode->m_type )
|
||||
{
|
||||
case CConditionNode::NOT :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::COMPARISON :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
|
||||
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::SUB_CONDITION :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
|
||||
|
||||
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
POSITION pos;
|
||||
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
|
||||
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
|
||||
logicConditionNode->addNode( logicConditionNodeTmp );
|
||||
}
|
||||
}
|
||||
|
||||
} // cConditionNodeToCLogicConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionToCLogicCondition (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
|
||||
{
|
||||
// condition name
|
||||
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
|
||||
|
||||
// nodes
|
||||
POSITION pos;
|
||||
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
// get the node
|
||||
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
|
||||
|
||||
// convert the node
|
||||
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
|
||||
|
||||
// add the node
|
||||
logicCondition.addNode( *logicConditionNode );
|
||||
}
|
||||
|
||||
} // cConditionToCLogicCondition //
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cLogicConditionNodeToCConditionNode (Service --> Editor)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
|
||||
{
|
||||
// terminator node
|
||||
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
// logic block with condition sub tree
|
||||
else
|
||||
{
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( logicConditionNode->LogicBlock.Type )
|
||||
{
|
||||
case CLogicConditionLogicBlock::NOT :
|
||||
{
|
||||
node->m_type = CConditionNode::NOT;
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::COMPARISON :
|
||||
{
|
||||
node->m_type = CConditionNode::COMPARISON;
|
||||
|
||||
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
|
||||
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
|
||||
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
|
||||
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::SUB_CONDITION :
|
||||
{
|
||||
node->m_type = CConditionNode::SUB_CONDITION;
|
||||
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
|
||||
};
|
||||
break;
|
||||
|
||||
default :
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
vector<CLogicConditionNode *>::const_iterator itNode;
|
||||
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
|
||||
{
|
||||
CConditionNode * nodeTmp = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
|
||||
nodeTmp->m_pParentNode = node;
|
||||
node->m_ctSubTree.AddTail( nodeTmp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // cLogicConditionNodeToCConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// cLogicConditionToCCondition
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
|
||||
{
|
||||
// condition name
|
||||
condition.m_sName = CString( logicCondition.getName().c_str() );
|
||||
|
||||
// condition tree
|
||||
vector<CLogicConditionNode>::const_iterator itNode;
|
||||
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
|
||||
{
|
||||
// convert the node
|
||||
CConditionNode * node = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( &(*itNode), node );
|
||||
|
||||
// add the node
|
||||
condition.m_ctConditionTree.AddTail( node );
|
||||
}
|
||||
|
||||
} // cLogicConditionToCCondition //
|
||||
|
||||
|
|
@ -1,413 +0,0 @@
|
|||
// Condition.cpp: implementation of the CCondition class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "logic_editor.h"
|
||||
#include "condition.h"
|
||||
#include "nel/logic/logic_condition.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace NLLOGIC;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CConditionNode implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CConditionNode::CConditionNode(const CConditionNode &node)
|
||||
{
|
||||
this->m_dComparand = node.m_dComparand;
|
||||
this->m_pParentNode = node.m_pParentNode;
|
||||
this->m_sConditionName = node.m_sConditionName;
|
||||
this->m_sOperator = node.m_sOperator;
|
||||
this->m_sVariableName = node.m_sVariableName;
|
||||
this->m_type = node.m_type;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = node.m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctSubTree.AddTail( newNode );
|
||||
newNode->m_pParentNode = this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CConditionNode::~CConditionNode()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const CString & CConditionNode::getNodeAsString() const
|
||||
{
|
||||
m_sNodeString.Empty();
|
||||
|
||||
if (m_type == NOT)
|
||||
m_sNodeString = "NOT";
|
||||
else if (m_type == TERMINATOR)
|
||||
m_sNodeString = "term";
|
||||
else if (m_type == SUB_CONDITION)
|
||||
m_sNodeString = m_sConditionName;
|
||||
else // comparison
|
||||
{
|
||||
m_sNodeString.Format(_T("%s %s %g"),LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
}
|
||||
|
||||
return m_sNodeString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName(old, newName);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if ( m_sConditionName == old)
|
||||
m_sConditionName = newName;
|
||||
}
|
||||
|
||||
void CConditionNode::conditionDeleted( const CString &name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctSubTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctSubTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctSubTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CCondition implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
CCondition::CCondition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CCondition::CCondition( const CCondition &cond)
|
||||
{
|
||||
this->m_sName = cond.m_sName;
|
||||
|
||||
// copy sub condition node tree
|
||||
CConditionNode *pNode, *newNode;
|
||||
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
newNode = new CConditionNode( *pNode );
|
||||
this->m_ctConditionTree.AddTail( newNode );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
CCondition::~CCondition()
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
// delete all sub nodes
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCondition::changeConditionName( CString old, const CString &newName) const
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
pNode->changeConditionName( old, newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCondition::conditionDeleted( CString name)
|
||||
{
|
||||
CConditionNode *pNode = NULL;
|
||||
|
||||
POSITION oldpos;
|
||||
POSITION pos = m_ctConditionTree.GetHeadPosition();
|
||||
while (pos != NULL)
|
||||
{
|
||||
oldpos = pos;
|
||||
pNode = m_ctConditionTree.GetNext( pos );
|
||||
|
||||
if (pNode != NULL)
|
||||
{
|
||||
if ( pNode->m_sConditionName != name)
|
||||
pNode->conditionDeleted(name);
|
||||
else
|
||||
{
|
||||
this->m_ctConditionTree.RemoveAt( oldpos );
|
||||
delete pNode;
|
||||
pNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionNodeToCLogicConditionNode (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
|
||||
{
|
||||
// if this node is a terminator node
|
||||
if( conditionNode->m_type == CConditionNode::TERMINATOR )
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
|
||||
}
|
||||
else
|
||||
// this node is a logic node
|
||||
{
|
||||
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
|
||||
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( conditionNode->m_type )
|
||||
{
|
||||
case CConditionNode::NOT :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::COMPARISON :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
|
||||
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
|
||||
}
|
||||
break;
|
||||
|
||||
case CConditionNode::SUB_CONDITION :
|
||||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
|
||||
|
||||
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
POSITION pos;
|
||||
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
|
||||
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
|
||||
logicConditionNode->addNode( logicConditionNodeTmp );
|
||||
}
|
||||
}
|
||||
|
||||
} // cConditionNodeToCLogicConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cConditionToCLogicCondition (Editor --> Service)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
|
||||
{
|
||||
// condition name
|
||||
logicCondition.setName(tStrToUtf8(condition.m_sName));
|
||||
|
||||
// nodes
|
||||
POSITION pos;
|
||||
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
|
||||
{
|
||||
// get the node
|
||||
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
|
||||
|
||||
// convert the node
|
||||
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
|
||||
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
|
||||
|
||||
// add the node
|
||||
logicCondition.addNode( *logicConditionNode );
|
||||
}
|
||||
|
||||
} // cConditionToCLogicCondition //
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// cLogicConditionNodeToCConditionNode (Service --> Editor)
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
|
||||
{
|
||||
// terminator node
|
||||
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
// logic block with condition sub tree
|
||||
else
|
||||
{
|
||||
// part 1 : a logic block(not/comparison/subcondition)
|
||||
switch( logicConditionNode->LogicBlock.Type )
|
||||
{
|
||||
case CLogicConditionLogicBlock::NOT :
|
||||
{
|
||||
node->m_type = CConditionNode::NOT;
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::COMPARISON :
|
||||
{
|
||||
node->m_type = CConditionNode::COMPARISON;
|
||||
|
||||
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
|
||||
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
|
||||
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
|
||||
|
||||
};
|
||||
break;
|
||||
|
||||
case CLogicConditionLogicBlock::SUB_CONDITION :
|
||||
{
|
||||
node->m_type = CConditionNode::SUB_CONDITION;
|
||||
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
|
||||
};
|
||||
break;
|
||||
|
||||
default :
|
||||
{
|
||||
node->m_type = CConditionNode::TERMINATOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// part 2 : a condition sub tree
|
||||
vector<CLogicConditionNode *>::const_iterator itNode;
|
||||
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
|
||||
{
|
||||
CConditionNode * nodeTmp = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
|
||||
nodeTmp->m_pParentNode = node;
|
||||
node->m_ctSubTree.AddTail( nodeTmp );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // cLogicConditionNodeToCConditionNode //
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------
|
||||
// cLogicConditionToCCondition
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
|
||||
{
|
||||
// condition name
|
||||
condition.m_sName = CString( logicCondition.getName().c_str() );
|
||||
|
||||
// condition tree
|
||||
vector<CLogicConditionNode>::const_iterator itNode;
|
||||
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
|
||||
{
|
||||
// convert the node
|
||||
CConditionNode * node = new CConditionNode();
|
||||
cLogicConditionNodeToCConditionNode( &(*itNode), node );
|
||||
|
||||
// add the node
|
||||
condition.m_ctConditionTree.AddTail( node );
|
||||
}
|
||||
|
||||
} // cLogicConditionToCCondition //
|
||||
|
||||
|
|
@ -1,68 +1,68 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CrashReportWidget</class>
|
||||
<widget class="QWidget" name="CrashReportWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>NeL report</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="descrLabel">
|
||||
<property name="text">
|
||||
<string>What were you doing when the crash occurred?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="reportLabel">
|
||||
<property name="text">
|
||||
<string>Contents of the report ( automatically generated )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="descriptionEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="emailCB">
|
||||
<property name="text">
|
||||
<string>Email me if you have further questions, or updates on this issue</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="emailEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter your email address here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="reportEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CrashReportWidget</class>
|
||||
<widget class="QWidget" name="CrashReportWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>NeL report</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="descrLabel">
|
||||
<property name="text">
|
||||
<string>What were you doing when the crash occurred?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="reportLabel">
|
||||
<property name="text">
|
||||
<string>Contents of the report ( automatically generated )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="descriptionEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="emailCB">
|
||||
<property name="text">
|
||||
<string>Email me if you have further questions, or updates on this issue</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="emailEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter your email address here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="reportEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -157,8 +157,6 @@ int main(int argc, char **argv)
|
|||
|
||||
// init the Nel context
|
||||
CApplicationContext *appContext = new CApplicationContext;
|
||||
DisableNLDebug = true;
|
||||
#endif
|
||||
|
||||
// disable nldebug messages in logs in Release
|
||||
#ifdef NL_RELEASE
|
||||
|
@ -169,17 +167,12 @@ int main(int argc, char **argv)
|
|||
createDebug(NULL, false);
|
||||
|
||||
INelContext::getInstance().setWindowedApplication(true);
|
||||
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
|
||||
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
|
||||
INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD");
|
||||
#endif // NL_DEBUG
|
||||
|
||||
#ifndef NL_DEBUG
|
||||
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
|
||||
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
|
||||
INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD");
|
||||
#endif // NL_DEBUG
|
||||
Args.addAdditionalArg("shard_id", "Shard ID to use", true, false);
|
||||
|
||||
Args.setVersion(getDisplayVersion());
|
||||
Args.setDescription("Ryzom client");
|
||||
|
@ -207,12 +200,10 @@ int main(int argc, char **argv)
|
|||
if (Args.haveAdditionalArg("login"))
|
||||
{
|
||||
LoginLogin = Args.getAdditionalArg("login").front();
|
||||
LoginPassword = Args.getAdditionalArg("password").front();
|
||||
|
||||
if (Args.haveAdditionalArg("password"))
|
||||
{
|
||||
LoginPassword = Args.getAdditionalArg("password").front();
|
||||
LoginShardId = std::numeric_limits<uint32>::max();
|
||||
|
||||
if (Args.haveAdditionalArg("shard_id"))
|
||||
sLoginShardId = Args.getAdditionalArg("shard_id").front();
|
||||
|
@ -226,11 +217,13 @@ int main(int argc, char **argv)
|
|||
if (Args.haveArg("p") || !CFile::isExists("client_default.cfg"))
|
||||
{
|
||||
std::string currentPath = CPath::getApplicationDirectory("Khanat");
|
||||
|
||||
// create parent directory
|
||||
if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath);
|
||||
|
||||
// append profile ID to directory
|
||||
if (Args.haveArg("p"))
|
||||
{
|
||||
currentPath = NLMISC::CPath::standardizePath(currentPath) + Args.getArg("p").front();
|
||||
|
||||
if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath);
|
||||
|
|
|
@ -1198,52 +1198,6 @@ NLMISC_COMMAND(db, "Modify Database","<Property> <Value>")
|
|||
return true;
|
||||
}
|
||||
|
||||
NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc..","<sheet_id> <name> <desc> <desc2>")
|
||||
{
|
||||
if (args.size() < 2) return false;
|
||||
CSheetId id(args[0]);
|
||||
ucstring name;
|
||||
name.fromUtf8(args[1]);
|
||||
ucstring desc;
|
||||
ucstring desc2;
|
||||
if (args.size() > 2)
|
||||
desc.fromUtf8(args[2]);
|
||||
if (args.size() > 2)
|
||||
desc2.fromUtf8(args[3]);
|
||||
|
||||
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
|
||||
if (pSMC)
|
||||
pSMC->replaceSBrickName(id, name, desc, desc2);
|
||||
else
|
||||
else
|
||||
{
|
||||
ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat, nb);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
NLMISC_COMMAND(setMissingDynstringText, "set text of missing dynamic string"," <name> <text>")
|
||||
{
|
||||
if (args.size() < 2) return false;
|
||||
ucstring name;
|
||||
name.fromUtf8(args[0]);
|
||||
ucstring text;
|
||||
text.fromUtf8(args[1]);
|
||||
|
||||
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
|
||||
if (pSMC)
|
||||
pSMC->replaceDynString(name, text);
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc..","<sheet_id> <name> <desc> <desc2>")
|
||||
{
|
||||
if (args.size() < 2) return false;
|
||||
|
@ -4304,8 +4258,8 @@ NLMISC_COMMAND(debugItemInfo, "simulate a ItemInfo received from server", "itemS
|
|||
itemInfo.DesertMagicResistance= 133;
|
||||
itemInfo.ForestMagicResistance= 500;
|
||||
itemInfo.PrimaryRootMagicResistance= 341;
|
||||
itemInfo.Hp= 66;
|
||||
itemInfo.HpMax= 100;
|
||||
itemInfo.ChaScore1= 66;
|
||||
itemInfo.ChaScore1Max= 100;
|
||||
itemInfo.Range= 169;
|
||||
itemInfo.SapLoadCurrent= 6;
|
||||
itemInfo.SapLoadMax= 30;
|
||||
|
@ -5747,74 +5701,7 @@ NLMISC_COMMAND(em, "emote command", "<emote phrase>")
|
|||
return false;
|
||||
}
|
||||
|
||||
NLMISC_COMMAND(me, "emote command", "<emote phrase>")
|
||||
{
|
||||
if (args.size() < 1) return false;
|
||||
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
if( pIM )
|
||||
{
|
||||
string emotePhrase;
|
||||
if( args.size() > 0 )
|
||||
{
|
||||
emotePhrase = args[0];
|
||||
}
|
||||
for(uint i = 1; i < args.size(); ++i )
|
||||
{
|
||||
emotePhrase += " ";
|
||||
emotePhrase += args[i];
|
||||
}
|
||||
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NLMISC_COMMAND(emote, "emote command", "<emote phrase>")
|
||||
{
|
||||
if (args.size() < 1) return false;
|
||||
|
||||
NLMISC_COMMAND(guildmotd, "Set or see the guild message of the day","<msg of the day>")
|
||||
if( pIM )
|
||||
{
|
||||
string emotePhrase;
|
||||
if( args.size() > 0 )
|
||||
{
|
||||
emotePhrase = args[0];
|
||||
}
|
||||
for(uint i = 1; i < args.size(); ++i )
|
||||
{
|
||||
emotePhrase += " ";
|
||||
emotePhrase += args[i];
|
||||
}
|
||||
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NLMISC_COMMAND(m, "emote command", "<emote phrase>")
|
||||
{
|
||||
if (args.size() < 1) return false;
|
||||
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
if( pIM )
|
||||
{
|
||||
string emotePhrase;
|
||||
if( args.size() > 0 )
|
||||
{
|
||||
emotePhrase = args[0];
|
||||
}
|
||||
for(uint i = 1; i < args.size(); ++i )
|
||||
{
|
||||
emotePhrase += " ";
|
||||
emotePhrase += args[i];
|
||||
}
|
||||
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
NLMISC_COMMAND(guildmotd, "Set or see the guild message of the day","<msg of the day>")
|
||||
|
|
|
@ -258,8 +258,6 @@ void CLoginStateMachine::run()
|
|||
SM_END_EVENT_TABLE
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LoginCustomParameters.empty())
|
||||
{
|
||||
// standard procedure
|
||||
SM_BEGIN_EVENT_TABLE
|
||||
|
@ -268,16 +266,6 @@ void CLoginStateMachine::run()
|
|||
SM_EVENT(ev_quit, st_end);
|
||||
SM_END_EVENT_TABLE
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// alternate login procedure
|
||||
SM_BEGIN_EVENT_TABLE
|
||||
SM_EVENT(ev_init_done, st_alt_login);
|
||||
SM_EVENT(ev_skip_all_login, st_ingame);
|
||||
SM_EVENT(ev_quit, st_end);
|
||||
SM_END_EVENT_TABLE
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -355,38 +355,15 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
|
|||
vt->setMultiLineSpace(getTextMultiLineSpace());
|
||||
vt->setModulateGlobalColor(false);
|
||||
|
||||
ucstring cur_time;
|
||||
if (showTimestamps())
|
||||
{
|
||||
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false);
|
||||
if (node && node->getValueBool())
|
||||
cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] ");
|
||||
else
|
||||
cur_time = CInterfaceManager::getTimestampHuman();
|
||||
}
|
||||
|
||||
// if text contain any color code, set the text formated and white,
|
||||
// otherwise, set text normal and apply global color
|
||||
size_t codePos = msg.find(ucstring("@{"));
|
||||
if (codePos != ucstring::npos)
|
||||
if (msg.find(ucstring("@{")) != ucstring::npos)
|
||||
{
|
||||
// Prepend the current time (do it after the color if the color at first position.
|
||||
if (codePos == 0)
|
||||
{
|
||||
codePos = msg.find(ucstring("}"));
|
||||
msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = cur_time + msg;
|
||||
}
|
||||
|
||||
vt->setTextFormatTaged(msg);
|
||||
vt->setColor(NLMISC::CRGBA::White);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = cur_time + msg;
|
||||
vt->setText(msg);
|
||||
vt->setColor(col);
|
||||
}
|
||||
|
|
|
@ -134,13 +134,6 @@ int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
|
||||
{
|
||||
CLuaIHM::pushUIOnStack(ls, dynamic_cast<CInterfaceElement *>( dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) ));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
int CDBCtrlSheet::luaGetChaScore1Buff(CLuaState &ls)
|
||||
{
|
||||
|
|
|
@ -682,34 +682,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
|||
}
|
||||
else
|
||||
pvpFactionLogo->setActive(false);
|
||||
}
|
||||
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFaction)
|
||||
{
|
||||
if (pPlayer->getPvpMode() & PVP_MODE::PvpZoneSafe)
|
||||
pvpFactionBitmap->setTexture("pvp_neutral.tga");
|
||||
else
|
||||
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
|
||||
}
|
||||
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged)
|
||||
{
|
||||
if (pPlayer->getPvpMode() & PVP_MODE::PvpChallenge)
|
||||
pvpFactionBitmap->setTexture("ico_curse.tga");
|
||||
else if (pPlayer->isNeutralPVP())
|
||||
pvpFactionBitmap->setTexture("pvp_neutral.tga");
|
||||
else if (pPlayer->isAlly() && (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged))
|
||||
pvpFactionBitmap->setTexture("pvp_ally_flag.tga");
|
||||
else if (pPlayer->isAlly() && (pPlayer->getPvpMode() & PVP_MODE::PvpFaction))
|
||||
pvpFactionBitmap->setTexture("pvp_ally_tag.tga");
|
||||
else if (pPlayer->isEnemy() && (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged))
|
||||
pvpFactionBitmap->setTexture("pvp_enemy_flag.tga");
|
||||
else if (pPlayer->isEnemy() && (pPlayer->getPvpMode() & PVP_MODE::PvpFaction))
|
||||
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
|
||||
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged)
|
||||
pvpFactionBitmap->setTexture("pvp_enemy_flag.tga");
|
||||
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFaction)
|
||||
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
|
||||
else
|
||||
pvpFactionLogo->setActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -733,7 +705,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
|||
pvpFactionLogo->setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pvpOutpostLogo)
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "group_in_scene.h"
|
||||
|
||||
/**
|
||||
* Compas group
|
||||
* \author Cyril 'Hulud' Corvazier
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CGroupInSceneUserInfo : public CGroupInScene
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
|
||||
// Constructor
|
||||
CGroupInSceneUserInfo(const TCtorParam ¶m);
|
||||
~CGroupInSceneUserInfo();
|
||||
|
||||
// Build the bar
|
||||
// You must rebuild if guild or title change
|
||||
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
|
||||
|
||||
// release a group in scene. The group is then put in cache for futur reuse
|
||||
//static void release(CGroupInSceneUserInfo *group);
|
||||
|
||||
// Show or hide the bar group
|
||||
void setLeftGroupActive( bool active );
|
||||
|
||||
// Update dynamic data : "Selection", "Bars"
|
||||
// Call it at each frame for visible title
|
||||
void updateDynamicData ();
|
||||
|
||||
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
|
||||
bool needGuildNameId() const {return _NeedGuildNameId;}
|
||||
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
|
||||
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
|
||||
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
|
||||
protected:
|
||||
|
||||
enum TBar
|
||||
{
|
||||
// Living entity Forage source
|
||||
<<<<<<< HEAD
|
||||
ChaScore1 = 0, Time = ChaScore1, // If making changes to this enum, please update
|
||||
ChaScore3, Amount = ChaScore3, // CForageSourceCL::updateVisualPropertyBars() and
|
||||
ChaScore2, Life = ChaScore2, // updateVisiblePostPos() because the ChaScore1/ChaScore3/ChaScore2
|
||||
ChaScore4, Danger = ChaScore4, // properties are *not* in an array in CEntityCL.
|
||||
=======
|
||||
HP = 0, Time = HP, // If making changes to this enum, please update
|
||||
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
|
||||
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
|
||||
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
|
||||
>>>>>>> ryzomcore
|
||||
Action, Spawn = Action,
|
||||
NumBars
|
||||
};
|
||||
|
||||
/// Fill NumBars elements into bars and set dbEntry
|
||||
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
|
||||
|
||||
// The entity (character or forage source)
|
||||
CEntityCL *_Entity;
|
||||
|
||||
// View text
|
||||
class CViewText *_Name;
|
||||
class CViewText *_Title;
|
||||
class CViewText *_GuildName;
|
||||
class CViewText *_TribeName;
|
||||
class CViewText *_EventFaction;
|
||||
// for Ring, symbol of permanent content
|
||||
class CViewBitmap *_PermanentContent;
|
||||
class CViewBitmap *_Bars[NumBars];
|
||||
class CViewBitmap *_Target;
|
||||
class CViewBitmap *_MissionTarget;
|
||||
static uint _BatLength;
|
||||
static NLMISC::CRGBA BarColor[NumBars];
|
||||
<<<<<<< HEAD
|
||||
static NLMISC::CRGBA BarColorChaScore1Negative;
|
||||
=======
|
||||
static NLMISC::CRGBA BarColorHPNegative;
|
||||
>>>>>>> ryzomcore
|
||||
|
||||
// Node user leaf
|
||||
static NLMISC::CCDBNodeLeaf *_Value;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueBegin;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueEnd;
|
||||
|
||||
// Guild icon leafs
|
||||
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
|
||||
|
||||
// Special guild
|
||||
bool _NeedGuildNameId;
|
||||
bool _NeedGuildSymbolId;
|
||||
bool _IsLeftGroupActive;
|
||||
|
||||
|
||||
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
|
@ -1,111 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "group_in_scene.h"
|
||||
|
||||
/**
|
||||
* Compas group
|
||||
* \author Cyril 'Hulud' Corvazier
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CGroupInSceneUserInfo : public CGroupInScene
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
|
||||
// Constructor
|
||||
CGroupInSceneUserInfo(const TCtorParam ¶m);
|
||||
~CGroupInSceneUserInfo();
|
||||
|
||||
// Build the bar
|
||||
// You must rebuild if guild or title change
|
||||
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
|
||||
|
||||
// release a group in scene. The group is then put in cache for futur reuse
|
||||
//static void release(CGroupInSceneUserInfo *group);
|
||||
|
||||
// Show or hide the bar group
|
||||
void setLeftGroupActive( bool active );
|
||||
|
||||
// Update dynamic data : "Selection", "Bars"
|
||||
// Call it at each frame for visible title
|
||||
void updateDynamicData ();
|
||||
|
||||
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
|
||||
bool needGuildNameId() const {return _NeedGuildNameId;}
|
||||
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
|
||||
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
|
||||
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
|
||||
protected:
|
||||
|
||||
enum TBar
|
||||
{
|
||||
// Living entity Forage source
|
||||
HP = 0, Time = HP, // If making changes to this enum, please update
|
||||
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
|
||||
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
|
||||
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
|
||||
Action, Spawn = Action,
|
||||
NumBars
|
||||
};
|
||||
|
||||
/// Fill NumBars elements into bars and set dbEntry
|
||||
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars );
|
||||
|
||||
// The entity (character or forage source)
|
||||
CEntityCL *_Entity;
|
||||
|
||||
// View text
|
||||
class CViewText *_Name;
|
||||
class CViewText *_Title;
|
||||
class CViewText *_GuildName;
|
||||
class CViewText *_TribeName;
|
||||
class CViewText *_EventFaction;
|
||||
// for Ring, symbol of permanent content
|
||||
class CViewBitmap *_PermanentContent;
|
||||
class CViewBitmap *_Bars[NumBars];
|
||||
class CViewBitmap *_Target;
|
||||
class CViewBitmap *_MissionTarget;
|
||||
static uint _BatLength;
|
||||
static NLMISC::CRGBA BarColor[NumBars];
|
||||
static NLMISC::CRGBA BarColorHPNegative;
|
||||
|
||||
// Node user leaf
|
||||
static CCDBNodeLeaf *_Value;
|
||||
static CCDBNodeLeaf *_ValueBegin;
|
||||
static CCDBNodeLeaf *_ValueEnd;
|
||||
|
||||
// Special guild
|
||||
bool _NeedGuildNameId;
|
||||
bool _NeedGuildSymbolId;
|
||||
bool _IsLeftGroupActive;
|
||||
|
||||
|
||||
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
|
@ -1,114 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "group_in_scene.h"
|
||||
|
||||
/**
|
||||
* Compas group
|
||||
* \author Cyril 'Hulud' Corvazier
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CGroupInSceneUserInfo : public CGroupInScene
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
|
||||
// Constructor
|
||||
CGroupInSceneUserInfo(const TCtorParam ¶m);
|
||||
~CGroupInSceneUserInfo();
|
||||
|
||||
// Build the bar
|
||||
// You must rebuild if guild or title change
|
||||
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
|
||||
|
||||
// release a group in scene. The group is then put in cache for futur reuse
|
||||
//static void release(CGroupInSceneUserInfo *group);
|
||||
|
||||
// Show or hide the bar group
|
||||
void setLeftGroupActive( bool active );
|
||||
|
||||
// Update dynamic data : "Selection", "Bars"
|
||||
// Call it at each frame for visible title
|
||||
void updateDynamicData ();
|
||||
|
||||
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
|
||||
bool needGuildNameId() const {return _NeedGuildNameId;}
|
||||
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
|
||||
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
|
||||
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
|
||||
protected:
|
||||
|
||||
enum TBar
|
||||
{
|
||||
// Living entity Forage source
|
||||
ChaScore1 = 0, Time = ChaScore1, // If making changes to this enum, please update
|
||||
ChaScore3, Amount = ChaScore3, // CForageSourceCL::updateVisualPropertyBars() and
|
||||
ChaScore2, Life = ChaScore2, // updateVisiblePostPos() because the ChaScore1/ChaScore3/ChaScore2
|
||||
ChaScore4, Danger = ChaScore4, // properties are *not* in an array in CEntityCL.
|
||||
Action, Spawn = Action,
|
||||
NumBars
|
||||
};
|
||||
|
||||
/// Fill NumBars elements into bars and set dbEntry
|
||||
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
|
||||
|
||||
// The entity (character or forage source)
|
||||
CEntityCL *_Entity;
|
||||
|
||||
// View text
|
||||
class CViewText *_Name;
|
||||
class CViewText *_Title;
|
||||
class CViewText *_GuildName;
|
||||
class CViewText *_TribeName;
|
||||
class CViewText *_EventFaction;
|
||||
// for Ring, symbol of permanent content
|
||||
class CViewBitmap *_PermanentContent;
|
||||
class CViewBitmap *_Bars[NumBars];
|
||||
class CViewBitmap *_Target;
|
||||
class CViewBitmap *_MissionTarget;
|
||||
static uint _BatLength;
|
||||
static NLMISC::CRGBA BarColor[NumBars];
|
||||
static NLMISC::CRGBA BarColorChaScore1Negative;
|
||||
|
||||
// Node user leaf
|
||||
static NLMISC::CCDBNodeLeaf *_Value;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueBegin;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueEnd;
|
||||
|
||||
// Guild icon leafs
|
||||
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
|
||||
|
||||
// Special guild
|
||||
bool _NeedGuildNameId;
|
||||
bool _NeedGuildSymbolId;
|
||||
bool _IsLeftGroupActive;
|
||||
|
||||
|
||||
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
|
@ -1,114 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "group_in_scene.h"
|
||||
|
||||
/**
|
||||
* Compas group
|
||||
* \author Cyril 'Hulud' Corvazier
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CGroupInSceneUserInfo : public CGroupInScene
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
|
||||
// Constructor
|
||||
CGroupInSceneUserInfo(const TCtorParam ¶m);
|
||||
~CGroupInSceneUserInfo();
|
||||
|
||||
// Build the bar
|
||||
// You must rebuild if guild or title change
|
||||
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
|
||||
|
||||
// release a group in scene. The group is then put in cache for futur reuse
|
||||
//static void release(CGroupInSceneUserInfo *group);
|
||||
|
||||
// Show or hide the bar group
|
||||
void setLeftGroupActive( bool active );
|
||||
|
||||
// Update dynamic data : "Selection", "Bars"
|
||||
// Call it at each frame for visible title
|
||||
void updateDynamicData ();
|
||||
|
||||
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
|
||||
bool needGuildNameId() const {return _NeedGuildNameId;}
|
||||
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
|
||||
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
|
||||
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
|
||||
protected:
|
||||
|
||||
enum TBar
|
||||
{
|
||||
// Living entity Forage source
|
||||
HP = 0, Time = HP, // If making changes to this enum, please update
|
||||
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
|
||||
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
|
||||
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
|
||||
Action, Spawn = Action,
|
||||
NumBars
|
||||
};
|
||||
|
||||
/// Fill NumBars elements into bars and set dbEntry
|
||||
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
|
||||
|
||||
// The entity (character or forage source)
|
||||
CEntityCL *_Entity;
|
||||
|
||||
// View text
|
||||
class CViewText *_Name;
|
||||
class CViewText *_Title;
|
||||
class CViewText *_GuildName;
|
||||
class CViewText *_TribeName;
|
||||
class CViewText *_EventFaction;
|
||||
// for Ring, symbol of permanent content
|
||||
class CViewBitmap *_PermanentContent;
|
||||
class CViewBitmap *_Bars[NumBars];
|
||||
class CViewBitmap *_Target;
|
||||
class CViewBitmap *_MissionTarget;
|
||||
static uint _BatLength;
|
||||
static NLMISC::CRGBA BarColor[NumBars];
|
||||
static NLMISC::CRGBA BarColorHPNegative;
|
||||
|
||||
// Node user leaf
|
||||
static NLMISC::CCDBNodeLeaf *_Value;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueBegin;
|
||||
static NLMISC::CCDBNodeLeaf *_ValueEnd;
|
||||
|
||||
// Guild icon leafs
|
||||
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
|
||||
|
||||
// Special guild
|
||||
bool _NeedGuildNameId;
|
||||
bool _NeedGuildSymbolId;
|
||||
bool _IsLeftGroupActive;
|
||||
|
||||
|
||||
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H
|
|
@ -1497,14 +1497,7 @@ void CInterfaceManager::updateFrameEvents()
|
|||
|
||||
// literal version
|
||||
// str = CI18N::get("uiDate");
|
||||
/* str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - ";
|
||||
str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + ", ";
|
||||
str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)RT.getRyzomMonthInCurrentCycle() )) + " ";
|
||||
str += toString("%02d", RT.getRyzomDayOfMonth()+1) + ", ";
|
||||
str += CI18N::get("uiAtysianCycle" + toString(RT.getRyzomCycle()+1) + "Ordinal") + " " + CI18N::get("uiAtysianCycle") + " ";
|
||||
str += toString("%04d", RT.getRyzomYear());*/
|
||||
|
||||
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time"));
|
||||
str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - ";
|
||||
str += toString("%d", (sint)RT.getRyzomWeek()) + " ";
|
||||
str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + " - ";
|
||||
ucstring year = RT.getRyzomYearStr();
|
||||
|
@ -1529,8 +1522,6 @@ void CInterfaceManager::updateFrameEvents()
|
|||
pVT->setText(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1961,19 +1952,22 @@ bool CInterfaceManager::saveConfig (const string &filename)
|
|||
{
|
||||
nlwarning("Bad user dyn chat saving");
|
||||
return false;
|
||||
catch(const NLMISC::EStream &)
|
||||
{
|
||||
nlwarning("Bad user dyn chat saving");
|
||||
return false;
|
||||
}
|
||||
|
||||
f.close();
|
||||
}
|
||||
catch(const NLMISC::EStream &)
|
||||
{
|
||||
nlwarning("Config saving failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
ContinentMngr.serialFOWMaps();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceManager::drawViews(NL3D::UCamera camera)
|
||||
{
|
||||
IngameDbMngr.flushObserverCalls();
|
||||
|
@ -2062,6 +2056,7 @@ public:
|
|||
{
|
||||
this->reset = reset;
|
||||
}
|
||||
|
||||
void visitGroup( CInterfaceGroup *group )
|
||||
{
|
||||
const std::vector< CViewBase* > &vs = group->getViews();
|
||||
|
|
|
@ -896,55 +896,6 @@ void initAltLogin()
|
|||
LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt);
|
||||
}
|
||||
|
||||
void initAltLogin()
|
||||
{
|
||||
// Check the alt param
|
||||
if (!LoginCustomParameters.empty())
|
||||
{
|
||||
// don't use login and password for alternate login
|
||||
string res = checkLogin("", "", ClientApp, LoginCustomParameters);
|
||||
if (res.empty())
|
||||
{
|
||||
if (ClientCfg.R2Mode)
|
||||
{
|
||||
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Select good shard
|
||||
ShardSelected = -1;
|
||||
for (uint32 i = 0; i < Shards.size(); ++i)
|
||||
{
|
||||
if (Shards[i].ShardId == LoginShardId)
|
||||
{
|
||||
ShardSelected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ShardSelected == -1)
|
||||
{
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
pIM->messageBoxWithHelp(CI18N::get("uiErrServerLost"), "ui:login");
|
||||
LoginSM.pushEvent(CLoginStateMachine::ev_quit);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// close the socket in case of error
|
||||
HttpClient.disconnect();
|
||||
|
||||
// ignore error
|
||||
LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt);
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// Called from client.cpp
|
||||
|
@ -1195,7 +1146,7 @@ void initShardDisplay()
|
|||
for (uint fff = 0; fff < 20; ++fff)
|
||||
{
|
||||
CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff),
|
||||
32*fff%46546, "32.32.32.32", "http://www.ryzomcore.org" );
|
||||
32*fff%46546, "32.32.32.32", "http://www.ryzom.com" );
|
||||
Shards.push_back(s);
|
||||
}*/
|
||||
|
||||
|
@ -1322,7 +1273,7 @@ void onlogin(bool vanishScreen = true)
|
|||
// for (uint fff = 0; fff < 20; ++fff)
|
||||
// {
|
||||
// CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff),
|
||||
// 32*fff%46546, "32.32.32.32", "http://www.ryzomcore.org" );
|
||||
// 32*fff%46546, "32.32.32.32", "http://www.ryzom.com" );
|
||||
// Shards.push_back(s);
|
||||
// }*/
|
||||
//
|
||||
|
|
|
@ -323,152 +323,6 @@ static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
|
|||
UIntToStr_2(s, sec); s[2] = 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef USE_WINDOWS_FILE
|
||||
static UINT g_FileCodePage = CP_ACP;
|
||||
#endif
|
||||
#define MY_FILE_CODE_PAGE_PARAM ,g_FileCodePage
|
||||
#else
|
||||
#define MY_FILE_CODE_PAGE_PARAM
|
||||
#endif
|
||||
|
||||
static WRes MyCreateDir(const UInt16 *name)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
return CreateDirectoryW((LPCWSTR)name, NULL) ? 0 : GetLastError();
|
||||
|
||||
#else
|
||||
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
|
||||
res =
|
||||
#ifdef _WIN32
|
||||
_mkdir((const char *)buf.data)
|
||||
#else
|
||||
mkdir((const char *)buf.data, 0777)
|
||||
#endif
|
||||
== 0 ? 0 : errno;
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
return OutFile_OpenW(p, (const WCHAR *)name);
|
||||
#else
|
||||
CBuf buf;
|
||||
WRes res;
|
||||
Buf_Init(&buf);
|
||||
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
|
||||
res = OutFile_Open(p, (const char *)buf.data);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
static SRes PrintString(const UInt16 *s)
|
||||
{
|
||||
CBuf buf;
|
||||
SRes res;
|
||||
Buf_Init(&buf);
|
||||
res = Utf16_To_Char(&buf, s
|
||||
#ifndef _USE_UTF8
|
||||
, CP_OEMCP
|
||||
#endif
|
||||
);
|
||||
if (res == SZ_OK)
|
||||
fputs((const char *)buf.data, stdout);
|
||||
Buf_Free(&buf, &g_Alloc);
|
||||
return res;
|
||||
}
|
||||
|
||||
static void UInt64ToStr(UInt64 value, char *s)
|
||||
{
|
||||
char temp[32];
|
||||
int pos = 0;
|
||||
do
|
||||
{
|
||||
temp[pos++] = (char)('0' + (unsigned)(value % 10));
|
||||
value /= 10;
|
||||
}
|
||||
while (value != 0);
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
static char *UIntToStr(char *s, unsigned value, int numDigits)
|
||||
{
|
||||
char temp[16];
|
||||
int pos = 0;
|
||||
do
|
||||
temp[pos++] = (char)('0' + (value % 10));
|
||||
while (value /= 10);
|
||||
for (numDigits -= pos; numDigits > 0; numDigits--)
|
||||
*s++ = '0';
|
||||
do
|
||||
*s++ = temp[--pos];
|
||||
while (pos);
|
||||
*s = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static void UIntToStr_2(char *s, unsigned value)
|
||||
{
|
||||
s[0] = (char)('0' + (value / 10));
|
||||
s[1] = (char)('0' + (value % 10));
|
||||
}
|
||||
|
||||
#define PERIOD_4 (4 * 365 + 1)
|
||||
#define PERIOD_100 (PERIOD_4 * 25 - 1)
|
||||
#define PERIOD_400 (PERIOD_100 * 4 + 1)
|
||||
|
||||
static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
|
||||
{
|
||||
unsigned year, mon, hour, min, sec;
|
||||
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
unsigned t;
|
||||
UInt32 v;
|
||||
UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
|
||||
v64 /= 10000000;
|
||||
sec = (unsigned)(v64 % 60); v64 /= 60;
|
||||
min = (unsigned)(v64 % 60); v64 /= 60;
|
||||
hour = (unsigned)(v64 % 24); v64 /= 24;
|
||||
|
||||
v = (UInt32)v64;
|
||||
|
||||
year = (unsigned)(1601 + v / PERIOD_400 * 400);
|
||||
v %= PERIOD_400;
|
||||
|
||||
t = v / PERIOD_100; if (t == 4) t = 3; year += t * 100; v -= t * PERIOD_100;
|
||||
t = v / PERIOD_4; if (t == 25) t = 24; year += t * 4; v -= t * PERIOD_4;
|
||||
t = v / 365; if (t == 4) t = 3; year += t; v -= t * 365;
|
||||
|
||||
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
|
||||
ms[1] = 29;
|
||||
for (mon = 0;; mon++)
|
||||
{
|
||||
unsigned d = ms[mon];
|
||||
if (v < d)
|
||||
break;
|
||||
v -= d;
|
||||
}
|
||||
s = UIntToStr(s, year, 4); *s++ = '-';
|
||||
UIntToStr_2(s, mon + 1); s[2] = '-'; s += 3;
|
||||
UIntToStr_2(s, (unsigned)v + 1); s[2] = ' '; s += 3;
|
||||
UIntToStr_2(s, hour); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, min); s[2] = ':'; s += 3;
|
||||
UIntToStr_2(s, sec); s[2] = 0;
|
||||
}
|
||||
|
||||
void PrintError(const char *sz)
|
||||
{
|
||||
printf("\nERROR: %s\n", sz);
|
||||
|
|
|
@ -1626,17 +1626,10 @@ Arguments: s(actionName),s(url) ->
|
|||
()setUrl("Click on Me", "http://www.domain.com/script.pChaScore1");
|
||||
@endcode
|
||||
|
||||
*/
|
||||
// CGroup
|
||||
void setUrl_ss_(CStateInstance* entity, CScriptStack& stack)
|
||||
{
|
||||
std::string url = (std::string)stack.top();stack.pop();
|
||||
std::string actionName = (std::string)stack.top();stack.pop();
|
||||
|
||||
CSpawnBot* pbot = botIt->getSpawnObj();
|
||||
if (pbot!=NULL)
|
||||
{
|
||||
msg.Entities.push_back(pbot->dataSetRow());
|
||||
}
|
||||
}
|
||||
|
||||
std::string url = (std::string)stack.top();stack.pop();
|
||||
std::string actionName = (std::string)stack.top();stack.pop();
|
||||
|
||||
|
|
|
@ -952,19 +952,19 @@ ENTITY_VARIABLE(ChaScore1, "ChaScore1 of a player")
|
|||
}
|
||||
}
|
||||
|
||||
ENTITY_VARIABLE(MaxHP, "Max hit points of a player")
|
||||
ENTITY_VARIABLE(MaxChaScore1, "Max ChaScore1 of a player")
|
||||
{
|
||||
ENTITY_GET_ENTITY
|
||||
|
||||
if (get)
|
||||
{
|
||||
value = toString (e->maxHp());
|
||||
value = toString (e->maxChaScore1());
|
||||
}
|
||||
else
|
||||
{
|
||||
sint32 v;
|
||||
NLMISC::fromString(value, v);
|
||||
e->getScores()._PhysicalScores[SCORES::hit_points].Max = v;
|
||||
e->getScores()._PhysicalScores[SCORES::cha_score1].Max = v;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2801,7 +2801,7 @@ NLMISC_COMMAND(respawnAfterDeath,"respawnAfterDeath at re-spawn point name, it m
|
|||
//-----------------------------------------------
|
||||
// Simulate Resurrection by other PC until UI is ready
|
||||
//-----------------------------------------------
|
||||
NLMISC_COMMAND(resurrected,"Another PC resurrect PC by giving some energy","<player id(id:type:crea:dyn)><Hp gived><Sta gived><Sap gived><Focus gived>")
|
||||
NLMISC_COMMAND(resurrected,"Another PC resurrect PC by giving some energy","<player id(id:type:crea:dyn)><ChaScore1 removed><ChaScore2 removed><ChaScore3 removed><ChaScore4 gived>")
|
||||
{
|
||||
if( args.size() == 1 )
|
||||
{
|
||||
|
|
|
@ -1359,16 +1359,6 @@ void addParam(const std::string ¶mStr, std::vector<TBrickParam::IIdPtr> &Par
|
|||
Params.push_back(new CSBrickParamChaScore3Aura2(tail));
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_SAP_AURA2:
|
||||
// $*STRUCT CSBrickParamSapAura2 TBrickParam::SP_SAP_AURA2
|
||||
// $*-i uint16 RegenMod // regen modifier (in %) proportionally to item level
|
||||
// $*-f float Duration // duration in seconds
|
||||
// $*-f float Radius // aura radius in meters
|
||||
// $*-f float TargetDisableTime // disable life aura for x seconds on targets
|
||||
// $*-f float UserDisableTime // disable life aura for x seconds on user
|
||||
Params.push_back(new CSBrickParamSapAura2(tail));
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_SPEEDING_UP:
|
||||
// $*STRUCT CSBrickParamSpeedingUp TBrickParam::SP_SPEEDING_UP
|
||||
// $*-i uint16 SpeedMod // speed modifier (in %)
|
||||
|
|
|
@ -3851,53 +3851,7 @@ struct CSBrickParamChaScore1Aura : public TBrickParam::IId
|
|||
|
||||
struct CSBrickParamChaScore1Aura2 : public TBrickParam::IId
|
||||
{
|
||||
// regen modifier (in %)
|
||||
uint16 RegenMod;
|
||||
// duration in seconds
|
||||
float Duration;
|
||||
// aura radius in meters
|
||||
float Radius;
|
||||
// disable life aura for x seconds on targets
|
||||
float TargetDisableTime;
|
||||
// disable life aura for x seconds on user
|
||||
float UserDisableTime;
|
||||
|
||||
CSBrickParamLifeAura2():
|
||||
RegenMod(),
|
||||
Duration(),
|
||||
Radius(),
|
||||
TargetDisableTime(),
|
||||
UserDisableTime()
|
||||
{
|
||||
_Id = TBrickParam::SP_LIFE_AURA2;
|
||||
}
|
||||
|
||||
CSBrickParamLifeAura2(const std::string&str)
|
||||
{
|
||||
*this=CSBrickParamLifeAura2();
|
||||
*this=str;
|
||||
}
|
||||
|
||||
const CSBrickParamLifeAura2& operator=(const std::string& input)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
convertInput(args, input);
|
||||
|
||||
if (args.size()!=5)
|
||||
return *this;
|
||||
|
||||
ParsedOk=true;
|
||||
RegenMod=atoi(args[0].c_str());
|
||||
Duration=(float)atof(args[1].c_str());
|
||||
Radius=(float)atof(args[2].c_str());
|
||||
TargetDisableTime=(float)atof(args[3].c_str());
|
||||
UserDisableTime=(float)atof(args[4].c_str());
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
// regen modifier (in %)
|
||||
uint16 RegenMod;
|
||||
// duration in seconds
|
||||
|
|
|
@ -198,25 +198,6 @@ void CSpecialPowerPhrase::processParams(const vector<TBrickParam::IIdPtr> ¶m
|
|||
}
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_LIFE_AURA2:
|
||||
{
|
||||
// $*STRUCT CSBrickParamLifeAura: public TBrickParam::CId <TBrickParam::SP_LIFE_AURA2>
|
||||
// $*-i uint16 RegenMod // regen modifier proportionally to item level
|
||||
// $*-f float Duration // duration in seconds
|
||||
// $*-f float Radius // aura radius in meters
|
||||
// $*-f float TargetDisableTime // disable life aura for x seconds on targets
|
||||
// $*-f float UserDisableTime // disable life aura for x seconds on user
|
||||
CSpecialPowerBasicAura *lifeAura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamLifeAura *)param)->Duration, ((CSBrickParamLifeAura *)param)->UserDisableTime, ((CSBrickParamLifeAura *)param)->TargetDisableTime, POWERS::LifeAura);
|
||||
if (lifeAura)
|
||||
{
|
||||
lifeAura->setRadius(((CSBrickParamLifeAura *)param)->Radius);
|
||||
lifeAura->setFamilies(EFFECT_FAMILIES::PowerRootLifeAura,EFFECT_FAMILIES::PowerLifeAura );
|
||||
lifeAura->setParamValue(((CSBrickParamLifeAura *)param)->RegenMod*quality);
|
||||
lifeAura->setByPass(isConsumable);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_ChaScore1_AURA2:
|
||||
{
|
||||
// $*STRUCT CSBrickParamChaSCore1Aura: public TBrickParam::CId <TBrickParam::SP_ChaScore1_AURA2>
|
||||
|
@ -237,19 +218,6 @@ void CSpecialPowerPhrase::processParams(const vector<TBrickParam::IIdPtr> ¶m
|
|||
}
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_STAMINA_AURA2:
|
||||
{
|
||||
CSpecialPowerBasicAura *staminaAura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamStaminaAura*)param)->Duration, ((CSBrickParamLifeAura *)param)->UserDisableTime, ((CSBrickParamStaminaAura *)param)->TargetDisableTime, POWERS::StaminaAura);
|
||||
if (staminaAura)
|
||||
{
|
||||
staminaAura->setRadius(((CSBrickParamStaminaAura *)param)->Radius);
|
||||
staminaAura->setFamilies(EFFECT_FAMILIES::PowerRootStaminaAura,EFFECT_FAMILIES::PowerStaminaAura );
|
||||
staminaAura->setParamValue(((CSBrickParamStaminaAura *)param)->RegenMod*quality);
|
||||
staminaAura->setByPass(isConsumable);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TBrickParam::SP_ChaScore2_AURA:
|
||||
{
|
||||
CSpecialPowerBasicAura *ChaScore2Aura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamChaScore2Aura*)param)->Duration, ((CSBrickParamChaScore1Aura *)param)->UserDisableTime, ((CSBrickParamChaScore2Aura *)param)->TargetDisableTime, POWERS::ChaScore2Aura);
|
||||
|
|
|
@ -15886,18 +15886,6 @@ bool CCharacter::isFriendOf(const NLMISC::CEntityId &id)
|
|||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// CCharacter::referencedAsFriendBy()
|
||||
//--------------------------------------------------------------
|
||||
void CCharacter::referencedAsFriendBy( const NLMISC::CEntityId &id)
|
||||
{
|
||||
if (isFriendOf(id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// CCharacter::referencedAsFriendBy()
|
||||
//--------------------------------------------------------------
|
||||
|
@ -19565,6 +19553,9 @@ void CCharacter::setLeagueId(TChanID id, bool removeIfEmpty)
|
|||
CPVPManager2::getInstance()->broadcastMessage(id, string("<INFO>"), "<-- "+name);
|
||||
}
|
||||
|
||||
_LeagueId = id;
|
||||
updatePVPClanVP();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -528,15 +528,6 @@ void CPVPManager2::removeFactionChannelForCharacter(TChanID channel, CCharacter
|
|||
_CharacterChannels.erase(user->getId());
|
||||
_CharacterChannels.insert(make_pair(user->getId(), currentChannels));
|
||||
}
|
||||
|
||||
// Update channel list for player
|
||||
currentChannels.erase(currentChannels.begin() + i);
|
||||
std::map< NLMISC::CEntityId, std::vector<TChanID> >::iterator it = _CharacterChannels.find(user->getId());
|
||||
if( it != _CharacterChannels.end() )
|
||||
{
|
||||
_CharacterChannels.erase(user->getId());
|
||||
_CharacterChannels.insert(make_pair(user->getId(), currentChannels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,7 +769,6 @@ PVP_RELATION::TPVPRelation CPVPManager2::getPVPRelation( CCharacter * actor, CEn
|
|||
relationTmp = PVP_RELATION::NeutralPVP;
|
||||
}
|
||||
relation = relationTmp;
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
|
@ -1,43 +0,0 @@
|
|||
*HASH_VALUE bodypartID name ia da p pia pda description
|
||||
_ACB9BC721BA65099 HHead head a the heads \d the
|
||||
_278A7C5D654814CD HChest chest a the chests \d the
|
||||
_A2D940906B29B889 HArms arms \d the arms \d the
|
||||
_B1CAFC85DB767C9C HHands hands \d the hands \d the
|
||||
_20A8389BAC987C9F HLegs legs \d the legs \d the
|
||||
_E18820962C586494 HFeet feet \d the feet \d the
|
||||
_ACB9BC7B1B375099 QHead head a the heads \d the
|
||||
_E80BB4A21A9838B5 QBody body a the bodies \d the
|
||||
_C96F0919D2F8DC71 QFrontPaws forelegs \d the forelegs \d the
|
||||
_08A1A8FEABC3CD11 QFrontHooves forelegs \d the forelegs \d the
|
||||
_23B95F02A87957B0 QRearPaws hind legs \d the hind legs \d the
|
||||
_D880990C5BE9DCB7 QRearHooves hind legs \d the hind legs \d the
|
||||
_2836645DDE8874AD LKHead head a the heads \d the
|
||||
_ED86C05FE298A4B9 LKBody body a the bodies \d the
|
||||
_39BFC0EBE486B512 LKFrontPaws1 forelegs \d the forelegs \d the
|
||||
_79BFC0EBE486B512 LKFrontPaws2 forelegs \d the forelegs \d the
|
||||
_D92BB508D8F884A6 LKRearPaws1 hind legs \d the hind legs \d the
|
||||
_D93BB508D8F884A6 LKRearPaws2 hind legs \d the hind legs \d the
|
||||
_283664575C8874AD FKHead head a the heads \d the
|
||||
_ED86C0596098A4B9 FKBody body a the bodies \d the
|
||||
_DBBA7473640310B0 FKPaws1 legs \d the legs \d the
|
||||
_1BBA7473641310B0 FKPaws2 legs \d the legs \d the
|
||||
_66B6A47A4A7ADCC2 FKWings1 wings \d the wings \d the
|
||||
_66B6A47ACA7ADCC2 FKWings2 wings \d the wings \d the
|
||||
_ACB9BC701B865099 FHead head a the heads \d the
|
||||
_E80BB4971AE738B5 FBody body a the bodies \d the
|
||||
_C40D15A82A36DF2C FFrontFins1 fore fins \d the fore fins \d the
|
||||
_C41D15A82A36DF2C FFrontFins2 fore fins \d the fore fins \d the
|
||||
_67B624EBAAF630A4 FRearFins1 hind fins \d the hind fins \d the
|
||||
_67B628EBAAF630A4 FRearFins2 hind fins \d the hind fins \d the
|
||||
_ACB9BC6C1B465099 BHead head a the heads \d the
|
||||
_E80BB4931AA738B5 BBody body a the bodies \d the
|
||||
_25897F8F25594780 BFeet1 feet \d the feet \d the
|
||||
_2589838F25594B80 BFeet2 feet \d the feet \d the
|
||||
_2C68746BA436D3C2 BWings1 wings \d the wings \d the
|
||||
_2C68746BA446D7C2 BWings2 wings \d the wings \d the
|
||||
_8061E6E18C3EA521 PUpperTrunk upper trunk an the upper trunks \d the
|
||||
_ECEA3087A666CCC3 Ptrunk trunk a the trunks \d the
|
||||
_E7469C4D9B5A0C9D PLeaves1 leaf a the leaves \d the
|
||||
_E7469C4DDB5A0C9D PLeaves2 leaf a the leaves \d the
|
||||
_C3EE9906771FB524 PLowerTrunk lower trunk a the lower trunks \d the
|
||||
_DFA67A5CC7DECDE6 PVisibleRoots visible root a the visible roots \d the
|
|
@ -0,0 +1,9 @@
|
|||
*HASH_VALUE career ID name * noms français ia da p pia pda
|
||||
_1700C956C37FB64F MeleeFighter Melee Fighter Combattant Contact a the Melee Fighters the
|
||||
_9720B95DC35FBA54 RangeFighter Range Fighter Combattant Distance a the Range Fighters the
|
||||
_D32171700AD23D57 AttackCaster Attack Caster Caster Attaque an the Attack Casters the
|
||||
_9A511D668371AE04 BufferCaster Buffer Caster Caster Buffer a the Buffer Casters the
|
||||
_1C01F56701816E0A HealerCaster Healer Caster Caster Healer a the Healer Casters the
|
||||
_A6473C7A6A380099 Ranger Ranger Ranger a the Rangers the
|
||||
_EA665D00EAE788B3 Shopkeeper Merchant Marchand a the Merchants the
|
||||
_2D28B08D636AEC9E Artisan Crafter Crafter a the Crafters the
|
|
@ -0,0 +1,9 @@
|
|||
*HASH_VALUE characteristic_ID name
|
||||
_B009C46E316AACBF Constitution constitution
|
||||
_661AAC8EE6098C96 Metabolism metabolism
|
||||
_E45ADC6364A9D4A6 Intelligence intelligence
|
||||
_E7DB9090281BA0A8 Wisdom wisdom
|
||||
_649C448C681C74B8 Strength strength
|
||||
_6A880849E7D8DC86 WellBalanced balance
|
||||
_ADB8DC9A6C5A10B6 Dexterity dexterity
|
||||
_6C18945C6C1894DC Will will
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
33
code/ryzom/tools/translation/translated/job_words_wk.txt
Normal file
33
code/ryzom/tools/translation/translated/job_words_wk.txt
Normal file
|
@ -0,0 +1,33 @@
|
|||
*HASH_VALUE job ID name * noms français ia da p pia pda
|
||||
_7B0C6949087BEF17 IreFighter Ire Fighter guerrier fou an the Ire Fighters the
|
||||
_DA264262C82FA5E4 Swashbuckler Swashbuckler bretteur a the Swashbucklers the
|
||||
_FF1001FD1B8460C5 KamicFist Kamic Fist poing kamique a the Kamic Fists the
|
||||
_E9959ADC3E303D21 BladeBearer Blade Bearer porte lame a the Blade Bearers the
|
||||
_AF5E35F1250C04D2 WindChild Wind Child enfant des vents a the Wind Children the
|
||||
_2F47F87A6F381C99 Runner Runner courreur a the Runners the
|
||||
_73AAF09AE4B710A3 Scout Scout éclaireur a the Scouts the
|
||||
_C66185C2249CA8A6 FireLance Fire Lancer lance-feu a the Fire Lancers the
|
||||
_296AE474AB790894 Witherer Witherer fletrisseur a the Witherers the
|
||||
_AD68C069ED7714A0 Fouler Fouler pestilent a the Foulers the
|
||||
_B290F10227B8C8B3 Disturber Disturber troubleur d'esprit a the Disturbers the
|
||||
_0250C5039B06F5C8 KamicFury Kamic Fury furie kamique a the Kamic Furies the
|
||||
_757B279C53FC9BAB SpiritualShield Spiritual Shield bouclier spirituel a the Spiritual Shields the
|
||||
_EE4990771C86D494 Faker Faker trompeur a the Fakers the
|
||||
_A045250E026EC63E WindGuardian Wind Guardian gardien des vents a the Wind Guardians the
|
||||
_0B806EC710885A48 KamicGuardian Kamic Guardian bouclier kamique a the Kamic Guardians the
|
||||
_C4438A71C41C6642 SecondBreath Second Breath second souffle a the Second Breaths the
|
||||
_2FE51E469C502DFD LifeStealer Life Stealer voleur de vie a the Life Stealers the
|
||||
_FEBE4D8AEEBD5D18 SecondLife Second Life seconde vie a the Second Lives the
|
||||
_B7AF21058A5F88E1 SapCristal Sap Crystal cristal de sève a the Sap Crystals the
|
||||
_DE48CAEB05734249 ScarletHunter Scarlet Hunter chasseur écarlate a the Scarlet Hunters the
|
||||
_31D7E2E30551753A GreenHunter Green Hunter chasseur vert a the Green Hunters the
|
||||
_06635A6B444DEE4C ShadowHunter Shadow Hunter chasseur de l'ombre a the Shadow Hunters the
|
||||
_99D26A1506D4F24B AtysGuardian Atys Guardian gardien d'atys an the Atys Guardians the
|
||||
_2BB7F7E25BC3D54D SandCaravanner Sand Karavanner caravanier des sables a the Sand Karavanners the
|
||||
_7CD608D036D57BF2 ImperialSupplier Imperial Supplier pourvoyeur impérial an the Imperial Suppliers the
|
||||
_6C49C893E6B9849D Steward Steward intendants a the Stewards the
|
||||
_A8C84C6F6A9710A2 Hawker Hawker colporteurs a the Hawkers the
|
||||
_44BE25E43BDAF009 FireMaster Fire Master maitre du feu a the Fire Masters the
|
||||
_0BF32E6C860E7A26 FlowerMaster Flower Master maitre des fleurs a the Flower Masters the
|
||||
_802D1DEA3BDAF002 LakeMaster Lake Master maitre des lacs a the Lake Masters the
|
||||
_348DF50C62FA70BB SapMaster Sap Master maitre de la sève a the Sap Masters the
|
|
@ -0,0 +1,5 @@
|
|||
*HASH_VALUE score_ID name point ia points
|
||||
_BE6C89EE2F599BBE HitPoints HP hit point a hit points
|
||||
_B0DF4A6ECA004C1B Stamina stamina stamina point a stamina points
|
||||
_174A57AA672A04AA Sap sap sap point a sap points
|
||||
_DB69E9025629B0BA Focus focus focus point a focus points
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue