From 99387de82736bbcc47d2623dc0d7f653848d101d Mon Sep 17 00:00:00 2001 From: sfb Date: Thu, 2 Jun 2011 15:15:12 -0500 Subject: [PATCH] Changed: Implemented basic mission compilation without publishing. --- .../src/plugins/CMakeLists.txt | 6 +- .../plugins/mission_compiler/CMakeLists.txt | 8 +- .../mission_compiler_main_window.cpp | 77 ++++++++++++++++++- .../mission_compiler_main_window.h | 3 + 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index c5d49418d..66cbdb188 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -7,4 +7,8 @@ ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(zone_painter) ADD_SUBDIRECTORY(georges_editor) -ADD_SUBDIRECTORY(mission_compiler) \ No newline at end of file + +# Ryzom Specific Plugins +IF(WITH_RYZOM AND WITH_RYZOM_TOOLS) + ADD_SUBDIRECTORY(mission_compiler) +ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS) \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt index af39fc18a..4d11e808e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt @@ -28,9 +28,15 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_MISSION_COMPILER_MOC_SRC} ${OVQ SOURCE_GROUP("Mission Compiler Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) +# Mission Compiler Library +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ryzom/tools/leveldesign/mission_compiler_lib) + +# Game Share Library +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/src) + ADD_LIBRARY(ovqt_plugin_mission_compiler MODULE ${SRC} ${OVQT_PLUG_MISSION_COMPILER_MOC_SRC} ${OVQT_PLUG_MISSION_COMPILER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_MISSION_COMPILER_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_mission_compiler ovqt_plugin_core nelmisc nelligo ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) +TARGET_LINK_LIBRARIES(ovqt_plugin_mission_compiler ovqt_plugin_core nelmisc nelligo ryzom_mission_compiler_lib ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) NL_DEFAULT_PROPS(ovqt_plugin_mission_compiler "NeL, Tools, 3D: Object Viewer Qt Plugin: Mission Compiler") NL_ADD_RUNTIME_FLAGS(ovqt_plugin_mission_compiler) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp index 0cbb1e708..e760d9f94 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -1,6 +1,7 @@ #include "mission_compiler_main_window.h" #include "ui_mission_compiler_main_window.h" #include "validation_file.h" +#include "mission_compiler.h" #include #include @@ -62,6 +63,8 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : connect(ui->filterEdit, SIGNAL(textEdited(const QString&)), this, SLOT(handleFilterChanged(const QString&))); connect(ui->actionValidate, SIGNAL(triggered()), this, SLOT(handleValidation())); + connect(ui->actionCompile, SIGNAL(triggered()), this, SLOT(handleCompile())); + connect(ui->actionPublish, SIGNAL(triggered()), this, SLOT(handlePublish())); NLLIGO::Register(); m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); @@ -74,6 +77,79 @@ void MissionCompilerMainWindow::handleFilterChanged(const QString &text) m_filteredProxyModel->setFilterRegExp(*m_regexpFilter); } +void MissionCompilerMainWindow::handleCompile() +{ + compileMission(); +} + +void MissionCompilerMainWindow::handlePublish() +{ + compileMission(true); +} + +void MissionCompilerMainWindow::compileMission(bool publish) +{ + uint nbMission = 0; + + // First switch toolbox pages to show the compilation output. + ui->toolBox->setCurrentIndex(2); + + m_compileLog.append("Begin mission compilation.\n"); + updateCompileLog(); + + // Go through each file. + QStringList list = m_selectedPrimitivesModel->stringList(); + QStringListIterator itr(list); + while(itr.hasNext()) + { + QString filename = itr.next(); + m_compileLog.append("Compiling '"+filename+"'...\n"); + updateCompileLog(); + + NLLIGO::CPrimitives primDoc; + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = &primDoc; + NLLIGO::loadXmlPrimitiveFile(primDoc, NLMISC::CPath::lookup(filename.toAscii().data(), false), m_ligoConfig); + NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; + + try + { + CMissionCompiler mc; + mc.compileMissions(primDoc.RootNode, filename.toStdString()); + m_compileLog.append("Found "+QString::number(mc.getMissionsCount())+" valid missions\n"); + updateCompileLog(); + + mc.installCompiledMission(m_ligoConfig, filename.toStdString()); + nbMission += mc.getMissionsCount(); + + // publish files to selected servers + //if (publish) + //for (uint i=0 ; i