diff --git a/.hgeol b/.hgeol index e13b08ced..c7a59fec5 100644 --- a/.hgeol +++ b/.hgeol @@ -1,6 +1,9 @@ [patterns] **.h = native **.cpp = native + +**/database.xml = BIN +**/msg.xml = BIN **.txt = native **.xml = native diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index d444bfa3d..042f6b0cc 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -33,9 +33,9 @@ ENDIF(MSVC) # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) SET(PCH_FLAGS) - SET(PCH_ARCHS) - - SET(FLAGS) + SET(PCH_ARCHS) + SET(_FLAGS) + LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) @@ -81,10 +81,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND _FLAGS " ${_directory_flags}") LIST(APPEND _FLAGS " ${_directory_definitions}") - STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) - # Format definitions - SEPARATE_ARGUMENTS(_FLAGS) + IF(MSVC) + # Fix path with space + SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}") + ELSE(MSVC) + STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) + SEPARATE_ARGUMENTS(_FLAGS) + ENDIF(MSVC) + IF(CLANG) # Determining all architectures and get common flags diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 4308d0b44..834a5da5b 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -123,7 +123,7 @@ MACRO(NL_DEFAULT_PROPS name label) VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} COMPILE_FLAGS "/GA" - LINK_FLAGS "/VERSION:${NL_VERSION}") + LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}") ENDIF(${type} STREQUAL EXECUTABLE AND WIN32) IF(WITH_STLPORT AND WIN32) diff --git a/code/nel/include/nel/gui/interface_link.h b/code/nel/include/nel/gui/interface_link.h index ffa6ac0c7..42fb2bbcf 100644 --- a/code/nel/include/nel/gui/interface_link.h +++ b/code/nel/include/nel/gui/interface_link.h @@ -66,6 +66,11 @@ namespace NLGUI */ bool affect(const CInterfaceExprValue &value); }; + struct CCDBTargetInfo + { + NLMISC::CRefPtr Leaf; + std::string LeafName; + }; /// Updates triggered interface links when triggered by the observed branch @@ -85,7 +90,7 @@ namespace NLGUI * If there are no target element, the link is permanent (removed at exit) * NB : The target is not updated during this call. */ - bool init(const std::vector &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent); + bool init(const std::vector &targets, const std::vector &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent); // force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved. static void updateAllLinks(); // force all trigered links to be updated @@ -119,6 +124,7 @@ namespace NLGUI * \return true if all targets are valid */ static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector &targetsVect); + static bool splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup, std::vector &targetsVect, std::vector &cdbTargetsVect); //////////////////////////////////////////////////////////////////////////////////////////////////////// private: friend struct CRemoveTargetPred; @@ -135,12 +141,14 @@ namespace NLGUI typedef std::vector TNodeVect; private: std::vector _Targets; + std::vector _CDBTargets; TNodeVect _ObservedNodes; std::string _Expr; CInterfaceExprNode *_ParseTree; std::string _ActionHandler; std::string _AHParams; std::string _AHCond; + CInterfaceExprNode *_AHCondParsed; CInterfaceGroup *_AHParent; static TLinkList _LinkList; TLinkList::iterator _ListEntry; diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 7fedc6240..00723faea 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -444,7 +444,7 @@ namespace NLGUI } float getAlphaRolloverSpeed(); - void resetAlphaRolloverSpeed(); + void resetAlphaRolloverSpeedProps(); void setContainerAlpha( uint8 alpha ); uint8 getContainerAlpha() const { return _ContainerAlpha; } @@ -454,6 +454,7 @@ namespace NLGUI uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; } void updateGlobalAlphas(); + void resetGlobalAlphasProps(); const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; } void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; } @@ -527,6 +528,11 @@ namespace NLGUI NLMISC::CCDBNodeLeaf *_BProp; NLMISC::CCDBNodeLeaf *_AProp; NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB; + + NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB; + NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB; + NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB; + NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB; uint8 _ContainerAlpha; uint8 _GlobalContentAlpha; diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 6485960f7..ce9d88bae 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -104,6 +104,8 @@ // Windows 64bits platform SDK compilers doesn't support inline assembler # define NL_NO_ASM # endif +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits # endif // define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template # define NOMINMAX diff --git a/code/nel/src/3d/zone_lighter.cpp b/code/nel/src/3d/zone_lighter.cpp index 112df54e0..0fe7e9b48 100644 --- a/code/nel/src/3d/zone_lighter.cpp +++ b/code/nel/src/3d/zone_lighter.cpp @@ -1170,8 +1170,7 @@ void CZoneLighter::light (CLandscape &landscape, CZone& output, uint zoneToLight { // Last patch uint lastPatch=firstPatch+patchCountByThread; - if (lastPatch>patchCount) - lastPatch=patchCount; + lastPatch %= patchCount; // Last patch computed _LastPatchComputed[process] = firstPatch; @@ -3772,6 +3771,8 @@ uint CZoneLighter::getAPatch (uint process) uint index = _LastPatchComputed[process]; uint firstIndex = index; + nlassert(index < _PatchInfo.size()); + if (access.value().size() == 0) // no more patches return 0xffffffff; diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index f981814ba..4e8919e5c 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -2325,7 +2325,8 @@ namespace NLGUI _LUAOnDbChange[dbList]= newLink; // Init and attach to list of untargeted links std::vector noTargets; - newLink->init(noTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this); + std::vector noCdbTargets; + newLink->init(noTargets, noCdbTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this); } // ------------------------------------------------------------------------------------------------ diff --git a/code/nel/src/gui/interface_link.cpp b/code/nel/src/gui/interface_link.cpp index d672e9402..282199ee7 100644 --- a/code/nel/src/gui/interface_link.cpp +++ b/code/nel/src/gui/interface_link.cpp @@ -165,6 +165,7 @@ namespace NLGUI _NextTriggeredLink[0] = _NextTriggeredLink[1] = NULL; _Triggered[0] = _Triggered[1] = false; _ParseTree = NULL; + _AHCondParsed = NULL; } //=========================================================== @@ -187,10 +188,13 @@ namespace NLGUI _LinkList.erase(_ListEntry); delete _ParseTree; + _ParseTree = NULL; + delete _AHCondParsed; + _AHCondParsed = NULL; } //=========================================================== - bool CInterfaceLink::init(const std::vector &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup) + bool CInterfaceLink::init(const std::vector &targets, const std::vector &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup) { CInterfaceExprValue result; // Build the parse tree @@ -236,6 +240,7 @@ namespace NLGUI // There are no target for this link, so, put in a dedicated list to ensure that the link will be destroyed at exit _LinksWithNoTarget.push_back(TLinkSmartPtr(this)); } + _CDBTargets = cdbTargets; // create observers createObservers(_ObservedNodes); @@ -243,7 +248,12 @@ namespace NLGUI // _ActionHandler = actionHandler; _AHParams = ahParams; + nlassert(!_AHCondParsed); _AHCond = ahCond; + if (!ahCond.empty()) + { + _AHCondParsed = CInterfaceExpr::buildExprTree(ahCond); + } _AHParent = parentGroup; return true; } @@ -356,19 +366,47 @@ namespace NLGUI } } } + if (_CDBTargets.size()) + { + CInterfaceExprValue resultCopy = result; + if (resultCopy.toInteger()) + { + sint64 resultValue = resultCopy.getInteger(); + for (uint k = 0; k < _CDBTargets.size(); ++k) + { + NLMISC::CCDBNodeLeaf *node = _CDBTargets[k].Leaf; + if (!node) + { + node = _CDBTargets[k].Leaf = NLGUI::CDBManager::getInstance()->getDbProp(_CDBTargets[k].LeafName, false); + } + if (node) + { + // assuming setvalue64 always works + node->setValue64(resultValue); + } + else + { + nlwarning("CInterfaceLink::update: Node does not exist: '%s'", _CDBTargets[k].LeafName.c_str()); + } + } + } + else + { + nlwarning("CInterfaceLink::update: Result conversion to db target failed"); + } + } // if there's an action handler, execute it if (!_ActionHandler.empty()) { // If there is a condition, test it. - bool launch= true; - if(!_AHCond.empty()) + bool launch = _AHCond.empty(); + if (_AHCondParsed) // todo: maybe makes more sense to make condition also cover target { - launch= false; - CInterfaceExprValue result; - if(CInterfaceExpr::eval(_AHCond, result)) - launch= result.getBool(); + CInterfaceExprValue result; + _AHCondParsed->eval(result); + launch = result.getBool(); } - if(launch) + if (launch) { CAHManager::getInstance()->runActionHandler(_ActionHandler, _AHParent, _AHParams); // do not add any code after this line because this can be deleted !!!! @@ -517,6 +555,11 @@ namespace NLGUI continue; } std::string::size_type lastPos = targetNames[k].find_last_not_of(" "); + if (startPos >= lastPos) + { + nlwarning(" empty target encountered"); + continue; + } if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem)) { @@ -531,6 +574,70 @@ namespace NLGUI } + // *************************************************************************** + bool CInterfaceLink::splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup,std::vector &targetsVect, std::vector &cdbTargetsVect) + { + std::vector targetNames; + NLMISC::splitString(targets, ",", targetNames); + targetsVect.clear(); + targetsVect.reserve(targetNames.size()); + cdbTargetsVect.clear(); // no reserve because less used + bool everythingOk = true; + for (uint k = 0; k < targetNames.size(); ++k) + { + std::string::size_type startPos = targetNames[k].find_first_not_of(" "); + if(startPos == std::string::npos) + { + // todo hulud interface syntax error + nlwarning(" empty target encountered"); + continue; + } + std::string::size_type lastPos = targetNames[k].find_last_not_of(" "); + if (startPos >= (lastPos+1)) + { + nlwarning(" empty target encountered"); + continue; + } + + if (targetNames[k][startPos] == '@') + { + CInterfaceLink::CCDBTargetInfo ti; + ti.LeafName = targetNames[k].substr((startPos+1), (lastPos+1) - (startPos+1)); + // Do not allow Write on SERVER: or LOCAL: + static const std::string dbServer= "SERVER:"; + static const std::string dbLocal= "LOCAL:"; + static const std::string dbLocalR2= "LOCAL:R2"; + if( (0==ti.LeafName.compare(0, dbServer.size(), dbServer)) || + (0==ti.LeafName.compare(0, dbLocal.size(), dbLocal)) + ) + { + if (0!=ti.LeafName.compare(0, dbLocalR2.size(), dbLocalR2)) + { + //nlwarning("You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database"); + nlstop; + return false; + } + } + ti.Leaf = NLGUI::CDBManager::getInstance()->getDbProp(ti.LeafName, false); + cdbTargetsVect.push_back(ti); + } + else + { + CInterfaceLink::CTargetInfo ti; + if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem)) + { + // todo hulud interface syntax error + nlwarning(" Can't get link target"); + everythingOk = false; + continue; + } + targetsVect.push_back(ti); + } + } + return everythingOk; + } + + //=========================================================== void CInterfaceLink::checkNbRefs() { diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 76f5df1ed..da8bd1e52 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -997,6 +997,7 @@ namespace NLGUI std::vector targets; + std::vector cdbTargets; ptr = (char*) xmlGetProp (cur, (xmlChar*)"target"); std::string target; @@ -1004,7 +1005,7 @@ namespace NLGUI { target = std::string( (const char*)ptr ); if( !editorMode ) - CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets); + CInterfaceLink::splitLinkTargetsExt(std::string((const char*)ptr), parentGroup, targets, cdbTargets); } // optional action handler @@ -1022,7 +1023,7 @@ namespace NLGUI if( !editorMode ) { CInterfaceLink *il = new CInterfaceLink; - il->init(targets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm' + il->init(targets, cdbTargets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm' } else { diff --git a/code/nel/src/gui/lua_helper.cpp b/code/nel/src/gui/lua_helper.cpp index 16dca8d7a..fb9466b36 100644 --- a/code/nel/src/gui/lua_helper.cpp +++ b/code/nel/src/gui/lua_helper.cpp @@ -197,6 +197,8 @@ namespace NLGUI { #ifdef LUA_NEVRAX_VERSION _State = lua_open(l_realloc_func, l_free_func); + #elif defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + _State = luaL_newstate(); #else _State = lua_open(); #endif diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 363abd64d..4d7ada23d 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -1035,8 +1035,8 @@ namespace NLGUI setCapturePointerRight(NULL); resetColorProps(); - - _AlphaRolloverSpeedDB = NULL; + resetAlphaRolloverSpeedProps(); + resetGlobalAlphasProps(); activeAnims.clear(); } @@ -1967,10 +1967,18 @@ namespace NLGUI } // Update global color from database - setGlobalColor( NLMISC::CRGBA ( (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) ); + if (!_RProp) + { + _RProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R"); + _GProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G"); + _BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B"); + _AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A"); + } + setGlobalColor(NLMISC::CRGBA( + (uint8)_RProp->getValue32(), + (uint8)_GProp->getValue32(), + (uint8)_BProp->getValue32(), + (uint8)_AProp->getValue32())); NLMISC::CRGBA c = getGlobalColorForContent(); NLMISC::CRGBA gc = getGlobalColor(); @@ -2965,7 +2973,7 @@ namespace NLGUI return fTmp*fTmp*fTmp; } - void CWidgetManager::resetAlphaRolloverSpeed() + void CWidgetManager::resetAlphaRolloverSpeedProps() { _AlphaRolloverSpeedDB = NULL; } @@ -2981,10 +2989,29 @@ namespace NLGUI void CWidgetManager::updateGlobalAlphas() { - _GlobalContentAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32(); - _GlobalContainerAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32(); - _GlobalRolloverFactorContent = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32(); - _GlobalRolloverFactorContainer = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32(); + if (!_GlobalContentAlphaDB) + { + _GlobalContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA"); + nlassert(_GlobalContentAlphaDB); + _GlobalContainerAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA"); + nlassert(_GlobalContainerAlphaDB); + _GlobalContentRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR"); + nlassert(_GlobalContentRolloverFactorDB); + _GlobalContainerRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR"); + nlassert(_GlobalContainerRolloverFactorDB); + } + _GlobalContentAlpha = (uint8)_GlobalContentAlphaDB->getValue32(); + _GlobalContainerAlpha = (uint8)_GlobalContainerAlphaDB->getValue32(); + _GlobalRolloverFactorContent = (uint8)_GlobalContentRolloverFactorDB->getValue32(); + _GlobalRolloverFactorContainer = (uint8)_GlobalContainerRolloverFactorDB->getValue32(); + } + + void CWidgetManager::resetGlobalAlphasProps() + { + _GlobalContentAlphaDB = NULL; + _GlobalContainerAlphaDB = NULL; + _GlobalContentRolloverFactorDB = NULL; + _GlobalContainerRolloverFactorDB = NULL; } void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler ) @@ -3172,6 +3199,8 @@ namespace NLGUI _LastYContextHelp= -10000; resetColorProps(); + resetAlphaRolloverSpeedProps(); + resetGlobalAlphasProps(); _GlobalColor = NLMISC::CRGBA(255,255,255,255); _GlobalColorForContent = _GlobalColor; diff --git a/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png b/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png index 217259d04..1ec9d823f 100644 Binary files a/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png and b/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png differ diff --git a/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py b/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py index f034c5d19..cd8a9039f 100644 --- a/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py +++ b/code/nel/tools/build_gamedata/generators/generate_simple_max_exporters.py @@ -88,8 +88,6 @@ def generateSimpleMaxExporter(processName, fileExtension, sourceDirectoriesVaria -generateSimpleMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimInstallDirectory") - generateSimpleMaxExporter("skel", "skel", "SkelSourceDirectories", "SkelExportDirectory", "SkelInstallDirectory") generateSimpleMaxExporter("swt", "swt", "SwtSourceDirectories", "SwtExportDirectory", "SwtInstallDirectory") diff --git a/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py b/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py index e10a23cea..89a65d3fb 100644 --- a/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py +++ b/code/nel/tools/build_gamedata/generators/generate_tagged_max_exporters.py @@ -100,6 +100,8 @@ def generateTaggedMaxExporter(processName, fileExtension, sourceDirectoriesVaria +generateTaggedMaxExporter("pacs_prim", "pacs_prim", "PacsPrimSourceDirectories", "PacsPrimExportDirectory", "PacsPrimTagExportDirectory", "PacsPrimInstallDirectory") + generateTaggedMaxExporter("clodbank", "clod", "ClodSourceDirectories", "ClodExportDirectory", "ClodTagExportDirectory", "ClodInstallDirectory") generateTaggedMaxScript("ig", "ig") diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py index b793fe0f8..f551228c0 100644 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export pacs_prim -# \date 2011-09-28-07-42-GMT +# \date 2013-07-24-14-21-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export pacs_prim @@ -33,7 +33,9 @@ sys.path.append("../../configuration") if os.path.isfile("log.log"): os.remove("log.log") -log = open("log.log", "w") +if os.path.isfile("temp_log.log"): + os.remove("temp_log.log") +log = open("temp_log.log", "w") from scripts import * from buildsite import * from process import * @@ -47,6 +49,7 @@ printLog(log, "-------") printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") + # Find tools # ... @@ -58,15 +61,18 @@ if MaxAvailable: printLog(log, ">>> Export pacs_prim 3dsmax <<<") mkPath(log, ExportBuildDirectory + "/" + PacsPrimExportDirectory) + mkPath(log, ExportBuildDirectory + "/" + PacsPrimTagExportDirectory) for dir in PacsPrimSourceDirectories: mkPath(log, DatabaseDirectory + "/" + dir) - if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimExportDirectory, ".pacs_prim")): + if (needUpdateDirByTagLog(log, DatabaseDirectory + "/" + dir, ".max", ExportBuildDirectory + "/" + PacsPrimTagExportDirectory, ".max.tag")): scriptSrc = "maxscript/pacs_prim_export.ms" scriptDst = MaxUserDirectory + "/scripts/pacs_prim_export.ms" outputLogfile = ScriptDirectory + "/processes/pacs_prim/log.log" outputDirectory = ExportBuildDirectory + "/" + PacsPrimExportDirectory + tagDirectory = ExportBuildDirectory + "/" + PacsPrimTagExportDirectory maxSourceDir = DatabaseDirectory + "/" + dir - tagList = findFiles(log, outputDirectory, "", ".pacs_prim") + maxRunningTagFile = tagDirectory + "/max_running.tag" + tagList = findFiles(log, tagDirectory, "", ".max.tag") tagLen = len(tagList) if os.path.isfile(scriptDst): os.remove(scriptDst) @@ -77,18 +83,50 @@ if MaxAvailable: newline = line.replace("%OutputLogfile%", outputLogfile) newline = newline.replace("%MaxSourceDirectory%", maxSourceDir) newline = newline.replace("%OutputDirectory%", outputDirectory) + newline = newline.replace("%TagDirectory%", tagDirectory) sDst.write(newline) sSrc.close() sDst.close() + zeroRetryLimit = 3 while tagDiff > 0: + mrt = open(maxRunningTagFile, "w") + mrt.write("moe-moe-kyun") + mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ]) - tagList = findFiles(log, outputDirectory, "", ".pacs_prim") + if os.path.exists(outputLogfile): + try: + lSrc = open(outputLogfile, "r") + for line in lSrc: + lineStrip = line.strip() + if (len(lineStrip) > 0): + printLog(log, lineStrip) + lSrc.close() + os.remove(outputLogfile) + except Exception: + printLog(log, "ERROR Failed to read 3dsmax log") + else: + printLog(log, "WARNING No 3dsmax log") + tagList = findFiles(log, tagDirectory, "", ".max.tag") newTagLen = len(tagList) tagDiff = newTagLen - tagLen tagLen = newTagLen - printLog(log, "Exported " + str(tagDiff) + " .pacs_prim files!") + addTagDiff = 0 + if os.path.exists(maxRunningTagFile): + printLog(log, "FAIL 3ds Max crashed and/or file export failed!") + if tagDiff == 0: + if zeroRetryLimit > 0: + zeroRetryLimit = zeroRetryLimit - 1 + addTagDiff = 1 + else: + printLog(log, "FAIL Retry limit reached!") + else: + addTagDiff = 1 + os.remove(maxRunningTagFile) + printLog(log, "Exported " + str(tagDiff) + " .max files!") + tagDiff += addTagDiff os.remove(scriptDst) + printLog(log, "") @@ -99,8 +137,10 @@ if os.path.isfile(listPath): -printLog(log, "") log.close() +if os.path.isfile("log.log"): + os.remove("log.log") +shutil.move("temp_log.log", "log.log") # end of file diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms index 21bdcdd4c..ddfc0014a 100644 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms @@ -8,6 +8,9 @@ -- 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 @@ -110,75 +113,128 @@ fn runNelMaxExport inputMaxFile = +removeRunningTag = true + try ( - -- Get files in the %MaxSourceDirectory% directory - files = getFiles "%MaxSourceDirectory%/*.max" - gc() - - -- Sort files - sort files - gc() - - -- No file ? - if files.count != 0 then + undo off ( - -- For each files - for i = 1 to files.count do + -- Get files in the %MaxSourceDirectory% directory + files = getFiles "%MaxSourceDirectory%/*.max" + gc() + + -- Sort files + sort files + gc() + + -- No file ? + if files.count != 0 then ( - inputMaxFile = files[i] - outputNelFile = ("%OutputDirectory%/" + (getFilenameFile inputMaxFile) + ".pacs_prim") - - try + -- For each files + for i = 1 to files.count do ( - -- Compare file date - if (NeLTestFileDate outputNelFile 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 + inputMaxFile = files[i] + outputTagFile = ("%TagDirectory%/" + (getFilenameFile inputMaxFile) + (getFilenameType inputMaxFile) + ".tag") + + --try + --( + -- Compare file date + if (NeLTestFileDate outputTagFile inputMaxFile) == true then ( - runNelMaxExport(inputMaxFile) + -- 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 ( - -- Error - nlerror("ERROR exporting 'pacs_prim': can't open the file " + inputMaxFile) + nlerror("SKIPPED BY TAG " + inputMaxFile) ) - ) - else - ( - nlerror("SKIPPED " + inputMaxFile) - ) - ) - catch - ( - -- Error - nlerror("ERROR error exporting 'pacs_prim' in files " + inputMaxFile) + --) + --catch + --( + -- -- Error + -- nlerror("ERROR error exporting 'pacs_prim' in file " + inputMaxFile) + -- removeRunningTag = false + --) ) ) + else + ( + nlerror("WARNING no *.max file in folder %MaxSourceDirectory%") + ) ) - else +) +catch +( + -- Error + nlerror("ERROR Fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%") + nlerror("FAIL Fatal error occured") + NelForceQuitRightNow() + removeRunningTag = false +) + +try +( + if (removeRunningTag) then ( - nlerror("WARNING no *.max file in folder %MaxSourceDirectory%") + resetMAXFile #noPrompt ) ) catch ( - -- Error - nlerror("ERROR fatal error exporting 'pacs_prim' in folder %MaxSourceDirectory%") + nlerror("FAIL Last reset fails") + removeRunningTag = false ) --- Bye +if (removeRunningTag) then +( + nlerror("SUCCESS All .max files have been successfully exported") + deleteFile("%TagDirectory%/max_running.tag") +) +else +( + nlerror("FAIL One or more issues occured") + NelForceQuitRightNow() +) -resetMAXFile #noprompt +-- Bye +nlerror("BYE") quitMAX #noPrompt quitMAX() #noPrompt diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml index 630ecd4c6..4114143e5 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml @@ -2882,15 +2882,12 @@ This MUST follow the Enum MISSION_DESC::TIconId type="bool" value="true" /> - - - + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml b/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml index 9d3ff0052..648cbbb6a 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml @@ -1,837 +1,837 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -