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 43900fe9e..5d4ca10d4 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 @@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(georges_editor) +ADD_SUBDIRECTORY(material_editor) IF(WITH_GUI) ADD_SUBDIRECTORY(gui_editor) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt new file mode 100644 index 000000000..a5a1e3817 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/CMakeLists.txt @@ -0,0 +1,59 @@ +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${QT_INCLUDES} + ) + +FILE(GLOB SRC *.cpp *.h) + +SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) + +SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR + material_editor_context.h + material_editor_plugin.h + material_editor_window.h + material_editor_core_listener.h + ) + +SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS + material_editor_window.ui + ) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +QT4_ADD_RESOURCES(OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS ${OVQT_PLUGIN_MATERIAL_EDITOR_RCS}) +QT4_WRAP_CPP(OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC ${OVQT_PLUGIN_MATERIAL_EDITOR_HDR}) +QT4_WRAP_UI(OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS}) + +SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS}) +SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS}) +SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC} OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS) +SOURCE_GROUP("Material Editor Plugin" FILES ${SRC}) +SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) + +ADD_LIBRARY(ovqt_plugin_material_editor MODULE ${SRC} + ${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC} + ${OVQT_EXT_SYS_SRC} + ${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS} + ${OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS} + ) + +TARGET_LINK_LIBRARIES( + ovqt_plugin_material_editor + ovqt_plugin_core + nelmisc + nel3d + ${QT_LIBRARIES} + ${QT_QTOPENGL_LIBRARY} + ) + +NL_DEFAULT_PROPS(ovqt_plugin_material_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Material Editor") +NL_ADD_RUNTIME_FLAGS(ovqt_plugin_material_editor) +NL_ADD_LIB_SUFFIX(ovqt_plugin_material_editor) + +ADD_DEFINITIONS(-DMATERIAL_EDITOR_LIBRARY -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) + +INSTALL(TARGETS ovqt_plugin_material_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h new file mode 100644 index 000000000..1df628298 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_constants.h @@ -0,0 +1,33 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#ifndef MATERIAL_EDITOR_CONSTANTS_H +#define MATERIAL_EDITOR_CONSTANTS_H + +namespace MaterialEditor +{ + namespace Constants + { + + const char * const GUI_EDITOR_PLUGIN = "MaterialEditor"; + const char * const GUI_EDITOR_SECTION = "MaterialEditor"; + + } + +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp new file mode 100644 index 000000000..3bc3185a8 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.cpp @@ -0,0 +1,57 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + + +#include "material_editor_context.h" +#include "material_editor_window.h" + +namespace MaterialEditor +{ + MaterialEditorContext::MaterialEditorContext( QObject *parent ) : + IContext( parent ), + m_materialEditorWindow( 0 ) + { + m_materialEditorWindow = new MaterialEditorWindow(); + } + + void MaterialEditorContext::open() + { + } + + void MaterialEditorContext::newDocument() + { + } + + void MaterialEditorContext::save() + { + } + + void MaterialEditorContext::saveAs() + { + } + + void MaterialEditorContext::close() + { + m_materialEditorWindow->close(); + } + + QWidget *MaterialEditorContext::widget() + { + return m_materialEditorWindow; + } + +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h new file mode 100644 index 000000000..f04e502dd --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_context.h @@ -0,0 +1,64 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + + +#ifndef MATERIAL_EDITOR_CONTEXT_H +#define MATERIAL_EDITOR_CONTEXT_H + +#include "../core/icontext.h" + +#include "nel/misc/app_context.h" + +#include +#include + +namespace MaterialEditor +{ + class MaterialEditorWindow; + + class MaterialEditorContext: public Core::IContext + { + Q_OBJECT + public: + MaterialEditorContext(QObject *parent = 0); + virtual ~MaterialEditorContext() {} + + virtual QString id() const{ return QLatin1String("MaterialEditorContext"); } + + virtual QString trName() const{ return tr("Material Editor"); } + + virtual QIcon icon() const{ return QIcon(); } + + void open(); + + void newDocument(); + + void save(); + + void saveAs(); + + void close(); + + virtual QUndoStack *undoStack(){ return NULL; } + + virtual QWidget *widget(); + + MaterialEditorWindow *m_materialEditorWindow; + }; + +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp new file mode 100644 index 000000000..21d015dd9 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.cpp @@ -0,0 +1,28 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#include "material_editor_core_listener.h" +#include "material_editor_window.h" + +namespace MaterialEditor +{ + bool MaterialEditorCoreListener::closeMainWindow() const + { + return mainWindow->close(); + } +} + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h new file mode 100644 index 000000000..fd148683e --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_core_listener.h @@ -0,0 +1,41 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + + +#ifndef MATERIAL_EDITOR_CORE_LISTENER_H +#define MATERIAL_EDITOR_CORE_LISTENER_H + +#include "../core/icore_listener.h" + +namespace MaterialEditor +{ + class MaterialEditorWindow; + + class MaterialEditorCoreListener : public Core::ICoreListener + { + Q_OBJECT + public: + MaterialEditorCoreListener( MaterialEditorWindow *mainWindow, QObject *parent = NULL ){ this->mainWindow = mainWindow; } + ~MaterialEditorCoreListener(){} + bool closeMainWindow() const; + + private: + MaterialEditorWindow *mainWindow; + }; +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h new file mode 100644 index 000000000..82fb39e14 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_global.h @@ -0,0 +1,30 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + + +#ifndef MATERIAL_EDITOR_GLOBAL_H +#define MATERIAL_EDITOR_GLOBAL_H + +#include + +#if defined( MATERIAL_EDITOR_LIBRARY ) +# define MATERIAL_EDITOR_EXPORT Q_DECL_EXPORT +#else +# define MATERIAL_EDITOR_EXPORT Q_DECL_IMPORT +#endif + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp new file mode 100644 index 000000000..af4740c21 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.cpp @@ -0,0 +1,82 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#include "material_editor_plugin.h" +#include "material_editor_window.h" +#include "material_editor_context.h" +#include "material_editor_core_listener.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" + +#include "nel/misc/debug.h" + +#include + +namespace MaterialEditor +{ + MaterialEditorPlugin::~MaterialEditorPlugin() + { + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); + } + + bool MaterialEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) + { + Q_UNUSED(errorString); + m_plugMan = pluginManager; + MaterialEditorContext *context = new MaterialEditorContext( this ); + MaterialEditorWindow *window = static_cast< MaterialEditorWindow* >( context->widget() ); + + addAutoReleasedObject( context ); + addAutoReleasedObject( new MaterialEditorCoreListener( window, this ) ); + + return true; + } + + void MaterialEditorPlugin::extensionsInitialized() + { + } + + void MaterialEditorPlugin::shutdown() + { + } + + void MaterialEditorPlugin::setNelContext(NLMISC::INelContext *nelContext) + { + +#ifdef NL_OS_WINDOWS + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); +#endif // NL_OS_WINDOWS + m_libContext = new NLMISC::CLibraryContext(*nelContext); + } + + void MaterialEditorPlugin::addAutoReleasedObject(QObject *obj) + { + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); + } + +} + +Q_EXPORT_PLUGIN(MaterialEditor::MaterialEditorPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h new file mode 100644 index 000000000..0e4b1769c --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_plugin.h @@ -0,0 +1,69 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#ifndef MATERIAL_EDITOR_PLUGIN_H +#define MATERIAL_EDITOR_PLUGIN_H + +#include "material_editor_constants.h" +#include "../../extension_system/iplugin.h" +#include "../core/icontext.h" + +#include "nel/misc/app_context.h" + +#include +#include + +namespace NLMISC +{ + class CLibraryContext; +} + +namespace ExtensionSystem +{ + class IPluginSpec; +} + +namespace MaterialEditor +{ + class MaterialEditorWindow; + + class MaterialEditorPlugin : public QObject, public ExtensionSystem::IPlugin + { + Q_OBJECT + Q_INTERFACES(ExtensionSystem::IPlugin) + public: + virtual ~MaterialEditorPlugin(); + + bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); + + void extensionsInitialized(); + + void shutdown(); + + void setNelContext(NLMISC::INelContext *nelContext); + + void addAutoReleasedObject(QObject *obj); + + protected: + NLMISC::CLibraryContext *m_libContext; + + private: + ExtensionSystem::IPluginManager *m_plugMan; + QList m_autoReleaseObjects; + }; +} + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp new file mode 100644 index 000000000..1f6136ba4 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.cpp @@ -0,0 +1,51 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#include "material_editor_window.h" +#include "material_editor_constants.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" +#include "../core/core.h" +#include "../core/menu_manager.h" + +#include + +namespace MaterialEditor +{ + MaterialEditorWindow::MaterialEditorWindow(QWidget *parent) : + QMainWindow(parent) + { + m_ui.setupUi(this); + createMenus(); + } + + MaterialEditorWindow::~MaterialEditorWindow() + { + } + + void MaterialEditorWindow::createMenus() + { + Core::MenuManager *mm = Core::ICore::instance()->menuManager(); + + QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); + if( menu != NULL ) + { + QMenu *m = menu->addMenu( "Material Editor" ); + } + } + +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h new file mode 100644 index 000000000..10d34bbba --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.h @@ -0,0 +1,40 @@ +// Object Viewer Qt Material Editor plugin +// 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 . + +#ifndef MATERIAL_EDITOR_WINDOW_H +#define MATERIAL_EDITOR_WINDOW_H + +#include "ui_material_editor_window.h" + +namespace MaterialEditor +{ + + class MaterialEditorWindow: public QMainWindow + { + Q_OBJECT +public: + MaterialEditorWindow( QWidget *parent = NULL ); + ~MaterialEditorWindow(); + +private: + void createMenus(); + Ui::MaterialEditorWindow m_ui; + }; + +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui new file mode 100644 index 000000000..f510d5e29 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/material_editor_window.ui @@ -0,0 +1,33 @@ + + + MaterialEditorWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml new file mode 100644 index 000000000..6ca757caa --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/material_editor/ovqt_plugin_material_editor.xml @@ -0,0 +1,10 @@ + + ovqt_plugin_material_editor + Material Editor + 0.0.1 + Ryzom Core + Material Editor plugin. + + + + \ No newline at end of file