Added the skeleton of the OVQT Material Editor plugin.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 8fa5067506
commit ca52a76e5d

@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(georges_editor) ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(material_editor)
IF(WITH_GUI) IF(WITH_GUI)
ADD_SUBDIRECTORY(gui_editor) ADD_SUBDIRECTORY(gui_editor)

@ -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)

@ -0,0 +1,33 @@
// Object Viewer Qt Material Editor plugin <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 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

@ -0,0 +1,57 @@
// Object Viewer Qt Material Editor plugin <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/>.
#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;
}
}

@ -0,0 +1,64 @@
// Object Viewer Qt Material Editor plugin <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 MATERIAL_EDITOR_CONTEXT_H
#define MATERIAL_EDITOR_CONTEXT_H
#include "../core/icontext.h"
#include "nel/misc/app_context.h"
#include <QtCore/QObject>
#include <QtGui/QIcon>
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

@ -0,0 +1,28 @@
// Object Viewer Qt Material Editor plugin <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/>.
#include "material_editor_core_listener.h"
#include "material_editor_window.h"
namespace MaterialEditor
{
bool MaterialEditorCoreListener::closeMainWindow() const
{
return mainWindow->close();
}
}

@ -0,0 +1,41 @@
// Object Viewer Qt Material Editor plugin <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 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

@ -0,0 +1,30 @@
// Object Viewer Qt Material Editor plugin <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 MATERIAL_EDITOR_GLOBAL_H
#define MATERIAL_EDITOR_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined( MATERIAL_EDITOR_LIBRARY )
# define MATERIAL_EDITOR_EXPORT Q_DECL_EXPORT
#else
# define MATERIAL_EDITOR_EXPORT Q_DECL_IMPORT
#endif
#endif

@ -0,0 +1,82 @@
// Object Viewer Qt Material Editor plugin <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/>.
#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 <QtCore/QObject>
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)

@ -0,0 +1,69 @@
// Object Viewer Qt Material Editor plugin <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 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 <QtCore/QObject>
#include <QtGui/QIcon>
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<QObject *> m_autoReleaseObjects;
};
}
#endif

@ -0,0 +1,51 @@
// Object Viewer Qt Material Editor plugin <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/>.
#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 <nel/misc/debug.h>
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" );
}
}
}

@ -0,0 +1,40 @@
// Object Viewer Qt Material Editor plugin <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 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

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MaterialEditorWindow</class>
<widget class="QMainWindow" name="MaterialEditorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_material_editor</library-name>
<name>Material Editor</name>
<version>0.0.1</version>
<vendor>Ryzom Core</vendor>
<description>Material Editor plugin.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>
Loading…
Cancel
Save