mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
Changed: Merge
This commit is contained in:
commit
4c7c4f8a21
93 changed files with 1534 additions and 631 deletions
|
@ -74,7 +74,7 @@ MACRO(NL_ADD_RUNTIME_FLAGS name)
|
|||
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
|
||||
ENDIF(WIN32)
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
|
||||
|
||||
|
@ -182,7 +182,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
|||
ELSE(WIN32 AND MFC_FOUND)
|
||||
OPTION(WITH_MFC "With MFC Support" OFF)
|
||||
ENDIF(WIN32 AND MFC_FOUND)
|
||||
|
||||
|
||||
###
|
||||
# Optional support
|
||||
###
|
||||
|
@ -191,7 +191,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
|||
ELSE(WIN32)
|
||||
OPTION(WITH_STLPORT "With STLport support." OFF)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
|
||||
|
||||
OPTION(WITH_NEL "Build NeL (nearly always required)." ON )
|
||||
|
@ -345,7 +345,7 @@ MACRO(NL_SETUP_BUILD_FLAGS)
|
|||
|
||||
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
|
||||
|
||||
|
||||
## Debug
|
||||
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
||||
|
@ -415,7 +415,7 @@ MACRO(NL_SETUP_PREFIX_PATHS)
|
|||
SET(NL_DRIVER_PREFIX "${CMAKE_INSTALL_PREFIX}/lib/nel" CACHE PATH "Installation path for drivers.")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT NL_DRIVER_PREFIX)
|
||||
|
||||
|
||||
ENDMACRO(NL_SETUP_PREFIX_PATHS)
|
||||
|
||||
MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||
|
|
|
@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp)
|
|||
|
||||
ADD_EXECUTABLE(nl_sample_command ${SRC})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nl_sample_command ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nl_sample_command nelmisc)
|
||||
NL_DEFAULT_PROPS(nl_sample_command "NeL, Samples, Misc: Commands")
|
||||
NL_ADD_RUNTIME_FLAGS(nl_sample_command)
|
||||
|
|
|
@ -691,10 +691,6 @@ NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nel3d ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY})
|
||||
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
|
||||
|
|
|
@ -16,10 +16,6 @@ NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
|
||||
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
||||
|
|
|
@ -7,10 +7,6 @@ NL_TARGET_LIB(nelgeorges ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelgeorges ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelgeorges ${LIBXML2_LIBRARIES} nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelgeorges PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelgeorges "NeL, Library: NeL Georges")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelligo ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelligo ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelligo ${LIBXML2_LIBRARIES} nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelligo PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelligo "NeL, Library: NeL Ligo")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nellogic ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nellogic ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nellogic ${LIBXML2_LIBRARIES} nelmisc nelnet)
|
||||
SET_TARGET_PROPERTIES(nellogic PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nellogic "NeL, Library: NeL Logic")
|
||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_GTK)
|
|||
ENDIF(GTK2_FOUND)
|
||||
ENDIF(WITH_GTK)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelnet ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelnet nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelnet PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelpacs ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelpacs ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelpacs nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelpacs PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelpacs "NeL, Library: NeL PACS")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelsound ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelsound ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelsound ${LIBXML2_LIBRARIES} nelmisc nelligo nelgeorges nel3d nelsnd_lowlevel)
|
||||
SET_TARGET_PROPERTIES(nelsound PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelsound "NeL, Library: NeL Sound")
|
||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_STATIC)
|
|||
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${OGG_LIBRARY})
|
||||
ENDIF(WITH_STATIC)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelsnd_lowlevel "NeL, Library: Sound Lowlevel")
|
||||
NL_ADD_RUNTIME_FLAGS(nelsnd_lowlevel)
|
||||
|
|
|
@ -28,10 +28,6 @@ NL_TARGET_DRIVER(${NLDRV_AL_LIB} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${OPENAL_LIBRARY} nelmisc nelsnd_lowlevel)
|
||||
NL_DEFAULT_PROPS(${NLDRV_AL_LIB} "NeL, Driver, Sound: OpenAL")
|
||||
NL_ADD_RUNTIME_FLAGS(${NLDRV_AL_LIB})
|
||||
|
|
|
@ -22,7 +22,7 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h
|
|||
vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h
|
||||
vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
||||
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h camera_control.h
|
||||
extension_system/iplugin_manager.h extension_system/plugin_manager.h)
|
||||
|
||||
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||
|
|
|
@ -45,12 +45,12 @@ namespace NLQT
|
|||
|
||||
CAttribWidget::CAttribWidget(QWidget *parent)
|
||||
: QGroupBox(parent),
|
||||
_SrcInputEnabled(true),
|
||||
_EnableConstantValue(true),
|
||||
_DisableMemoryScheme(false),
|
||||
_NbCycleEnabled(true),
|
||||
_Node(NULL),
|
||||
_SchemeWidget(NULL)
|
||||
_SrcInputEnabled(true),
|
||||
_EnableConstantValue(true),
|
||||
_DisableMemoryScheme(false),
|
||||
_NbCycleEnabled(true),
|
||||
_Node(NULL),
|
||||
_SchemeWidget(NULL)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
_ui.constRangeUIntWidget->hide();
|
||||
|
|
|
@ -32,9 +32,9 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_PS(ps)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_PS(ps)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ public:
|
|||
private Q_SLOTS:
|
||||
void setDegradationExponent(int value);
|
||||
void setSkipParticles(bool state);
|
||||
|
||||
void setDistRatio(float value);
|
||||
void setMaxDistLODBias(float value);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
private Q_SLOTS:
|
||||
void updateGraphics();
|
||||
|
||||
private:
|
||||
private:
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
// wrapper to the datas
|
||||
|
|
|
@ -47,7 +47,7 @@ class CBinOpDialog : public QDialog
|
|||
|
||||
public:
|
||||
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
||||
~CBinOpDialog();
|
||||
virtual ~CBinOpDialog();
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
|
@ -86,7 +86,6 @@ public:
|
|||
_SchemeWrapper[k].Index = k ;
|
||||
}
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
uint k ;
|
||||
|
|
285
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
285
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/3d/u_driver.h"
|
||||
#include "nel/3d/u_scene.h"
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include <nel/3d/u_3d_mouse_listener.h>
|
||||
|
||||
// Project includes
|
||||
#include "modules.h"
|
||||
|
||||
static int camId = 0;
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
CCameraItem::CCameraItem(const QString &name):
|
||||
_cameraFocal(75),
|
||||
_speed(5.0),
|
||||
_active(false),
|
||||
_name(name)
|
||||
{
|
||||
_camera = Modules::objView().getScene()->createCamera();
|
||||
_camera.setTransformMode (NL3D::UTransformable::DirectMatrix);
|
||||
reset();
|
||||
}
|
||||
|
||||
CCameraItem::~CCameraItem()
|
||||
{
|
||||
Modules::objView().getScene()->deleteCamera(_camera);
|
||||
}
|
||||
|
||||
void CCameraItem::setActive(bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
sint w = Modules::objView().getDriver()->getWindowWidth();
|
||||
sint h = Modules::objView().getDriver()->getWindowHeight();
|
||||
_camera.setPerspective(_cameraFocal * float(NLMISC::Pi) / 180.f, float(w) / h, 0.1f, 1000);
|
||||
Modules::objView().getScene()->setCam(_camera);
|
||||
setupListener();
|
||||
}
|
||||
else
|
||||
{
|
||||
_hotSpot = Modules::objView().get3dMouseListener()->getHotSpot();
|
||||
}
|
||||
_active = active;
|
||||
}
|
||||
|
||||
void CCameraItem::setSpeed(float value)
|
||||
{
|
||||
_speed = value;
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
void CCameraItem::reset()
|
||||
{
|
||||
_hotSpot = NLMISC::CVector(0, 0, 0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_camera.lookAt(_hotSpot + NLMISC::CVector(0.57735f, 0.57735f, 0.57735f) * radius, _hotSpot);
|
||||
|
||||
if (_active)
|
||||
setupListener();
|
||||
}
|
||||
|
||||
void CCameraItem::setupListener()
|
||||
{
|
||||
NL3D::U3dMouseListener *_mouseListener = Modules::objView().get3dMouseListener();
|
||||
_mouseListener->setMatrix (_camera.getMatrix());
|
||||
_mouseListener->setFrustrum (_camera.getFrustum());
|
||||
_mouseListener->setViewport (NL3D::CViewport());
|
||||
_mouseListener->setHotSpot (_hotSpot);
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
CCameraControl::CCameraControl(QWidget *parent)
|
||||
: QObject(parent),
|
||||
_currentCamera(0)
|
||||
{
|
||||
_camToolBar = new QToolBar(tr("CameraControl"), parent);
|
||||
|
||||
_fpsAction = _camToolBar->addAction(tr("Fly"));
|
||||
_fpsAction->setStatusTip(tr("Set firstPerson camera mode"));
|
||||
_fpsAction->setCheckable(true);
|
||||
|
||||
_edit3dAction = _camToolBar->addAction(tr("Edit"));
|
||||
_edit3dAction->setStatusTip(tr("Set edit3d camera mode"));
|
||||
_edit3dAction->setCheckable(true);
|
||||
|
||||
QActionGroup *cameraModeGroup = new QActionGroup(this);
|
||||
cameraModeGroup->addAction(_fpsAction);
|
||||
cameraModeGroup->addAction(_edit3dAction);
|
||||
_edit3dAction->setChecked(true);
|
||||
|
||||
connect(_fpsAction, SIGNAL(triggered()), this, SLOT(setFirstPersonMode()));
|
||||
connect(_edit3dAction, SIGNAL(triggered()), this, SLOT(setEditMode()));
|
||||
|
||||
_renderModeMenu = new QMenu(tr("Render Mode"), _camToolBar);
|
||||
_renderModeMenu->setIcon(QIcon(":/images/polymode.png"));
|
||||
_camToolBar->addAction(_renderModeMenu->menuAction());
|
||||
connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
|
||||
|
||||
QSignalMapper *modeMapper = new QSignalMapper(this);
|
||||
|
||||
_pointRenderModeAction = _renderModeMenu->addAction(tr("Point mode"));
|
||||
_pointRenderModeAction->setIcon(QIcon(":/images/rmpoints.png"));
|
||||
_pointRenderModeAction->setStatusTip(tr("Set point render mode"));
|
||||
connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_pointRenderModeAction, 0);
|
||||
|
||||
_lineRenderModeAction = _renderModeMenu->addAction(tr("Line mode"));
|
||||
_lineRenderModeAction->setStatusTip(tr("Set line render mode"));
|
||||
_lineRenderModeAction->setIcon(QIcon(":/images/rmline.png"));
|
||||
connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_lineRenderModeAction, 1);
|
||||
|
||||
_fillRenderModeAction = _renderModeMenu->addAction(tr("Fill mode"));
|
||||
_fillRenderModeAction->setIcon(QIcon(":/images/rmfill.png"));
|
||||
_fillRenderModeAction->setStatusTip(tr("Set fill render mode"));
|
||||
connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_fillRenderModeAction, 2);
|
||||
|
||||
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_speedLabel = new QLabel(tr("Speed:"), _camToolBar);
|
||||
_camToolBar->addWidget(_speedLabel);
|
||||
_speedSpinBox = new QSpinBox(_camToolBar);
|
||||
_speedSpinBox->setMinimum(1);
|
||||
_speedSpinBox->setMaximum(1000);
|
||||
_camToolBar->addWidget(_speedSpinBox);
|
||||
connect(_speedSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_addCamAction = _camToolBar->addAction(tr("Create camera"));
|
||||
_addCamAction->setIcon(QIcon(":/images/cam_add.png"));
|
||||
_addCamAction->setStatusTip(tr("Create new camera"));
|
||||
connect(_addCamAction, SIGNAL(triggered()), this, SLOT(addCamera()));
|
||||
|
||||
_delCamAction = _camToolBar->addAction(tr("Delete camera"));
|
||||
_delCamAction->setIcon(QIcon(":/images/cam_del.png"));
|
||||
_delCamAction->setStatusTip(tr("Delete current camera"));
|
||||
connect(_delCamAction, SIGNAL(triggered()), this, SLOT(delCamera()));
|
||||
|
||||
_listCamComboBox = new QComboBox(_camToolBar);
|
||||
connect(_listCamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCamera(int)));
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("defaultCamera")));
|
||||
_camToolBar->addWidget(_listCamComboBox);
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_resetCamAction = _camToolBar->addAction(tr("Reset camera"));
|
||||
_resetCamAction->setStatusTip(tr("Reset current camera"));
|
||||
//_resetCamAction->setShortcut(tr("Ctrl+R"));
|
||||
connect(_resetCamAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
}
|
||||
|
||||
CCameraControl::~CCameraControl()
|
||||
{
|
||||
for(size_t i = 0; i < _cameraList.size(); ++i)
|
||||
delete _cameraList[i];
|
||||
_cameraList.clear();
|
||||
}
|
||||
|
||||
void CCameraControl::setEditMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
}
|
||||
|
||||
void CCameraControl::setFirstPersonMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
}
|
||||
|
||||
void CCameraControl::addCamera()
|
||||
{
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("%1_Camera").arg(++camId)));
|
||||
}
|
||||
|
||||
void CCameraControl::delCamera()
|
||||
{
|
||||
int index = _listCamComboBox->currentIndex();
|
||||
_listCamComboBox->setCurrentIndex(index - 1);
|
||||
|
||||
_listCamComboBox->removeItem(index);
|
||||
delete _cameraList[index];
|
||||
_cameraList.erase(_cameraList.begin() + index);
|
||||
}
|
||||
|
||||
void CCameraControl::setSpeed(int value)
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setSpeed(value);
|
||||
}
|
||||
|
||||
void CCameraControl::changeCamera(int index)
|
||||
{
|
||||
if (_currentCamera)
|
||||
_currentCamera->setActive(false);
|
||||
|
||||
if (index == 0)
|
||||
_delCamAction->setEnabled(false);
|
||||
else
|
||||
_delCamAction->setEnabled(true);
|
||||
|
||||
_currentCamera = _cameraList[index];
|
||||
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setActive(true);
|
||||
_speedSpinBox->setValue(int(_currentCamera->getSpeed()));
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case 1:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case 2:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode()
|
||||
{
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::resetCamera()
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->reset();
|
||||
}
|
||||
|
||||
int CCameraControl::createCamera(const QString &name)
|
||||
{
|
||||
CCameraItem *newCamera = new CCameraItem(name);
|
||||
_cameraList.push_back(newCamera);
|
||||
_listCamComboBox->addItem(newCamera->getName());
|
||||
return _cameraList.size() - 1;
|
||||
}
|
||||
|
||||
} /* namespace NLQT */
|
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CAMERA_CONTROL_H
|
||||
#define CAMERA_CONTROL_H
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
// NeL includes
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include "nel/misc/vector.h"
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
class CCameraItem
|
||||
{
|
||||
public:
|
||||
CCameraItem(const QString &name);
|
||||
~CCameraItem();
|
||||
|
||||
void setSpeed(float value);
|
||||
float getSpeed()
|
||||
{
|
||||
return _speed;
|
||||
}
|
||||
void setActive(bool active);
|
||||
void setName(const QString &name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
QString getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
void reset();
|
||||
|
||||
private:
|
||||
void setupListener();
|
||||
|
||||
NL3D::UCamera _camera;
|
||||
NLMISC::CVector _hotSpot;
|
||||
|
||||
float _cameraFocal;
|
||||
float _speed;
|
||||
bool _active;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
class CCameraControl: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCameraControl(QWidget *parent = 0);
|
||||
~CCameraControl();
|
||||
|
||||
QToolBar *getToolBar() const
|
||||
{
|
||||
return _camToolBar;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setEditMode();
|
||||
void setFirstPersonMode();
|
||||
void addCamera();
|
||||
void delCamera();
|
||||
void setSpeed(int value);
|
||||
void changeCamera(int index);
|
||||
void setRenderMode(int value);
|
||||
void setRenderMode();
|
||||
void resetCamera();
|
||||
|
||||
private:
|
||||
int createCamera(const QString &name);
|
||||
|
||||
QAction *_fpsAction;
|
||||
QAction *_edit3dAction;
|
||||
QAction *_pointRenderModeAction;
|
||||
QAction *_lineRenderModeAction;
|
||||
QAction *_fillRenderModeAction;
|
||||
QAction *_addCamAction;
|
||||
QAction *_delCamAction;
|
||||
QAction *_resetCamAction;
|
||||
QSpinBox *_speedSpinBox;
|
||||
QComboBox *_listCamComboBox;
|
||||
QMenu *_renderModeMenu;
|
||||
QLabel *_speedLabel;
|
||||
QToolBar *_camToolBar;
|
||||
|
||||
CCameraItem *_currentCamera;
|
||||
std::vector<CCameraItem *> _cameraList;
|
||||
|
||||
}; /* class CCameraControl */
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif // CAMERA_CONTROL_H
|
|
@ -201,7 +201,7 @@ CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaul
|
|||
{
|
||||
if (var.size() >= 3)
|
||||
{
|
||||
if (var.size() > 4)
|
||||
if (var.size() > 4)
|
||||
nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
||||
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_scale(1.0),
|
||||
_pos(0.0),
|
||||
_Node(ownerNode),
|
||||
_Curve(curve)
|
||||
: QDialog(parent),
|
||||
_scale(1.0),
|
||||
_pos(0.0),
|
||||
_Node(ownerNode),
|
||||
_Curve(curve)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
float _pos;
|
||||
|
||||
CWorkspaceNode *_Node;
|
||||
|
||||
|
||||
/// the scheme being edited
|
||||
NL3D::CPSFloatCurveFunctor *_Curve;
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ namespace NLQT
|
|||
const int max_range = 9999;
|
||||
|
||||
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
_Wrapper(NULL),
|
||||
_emit(true)
|
||||
: QWidget(parent),
|
||||
_Wrapper(NULL),
|
||||
_emit(true)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -44,18 +44,18 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CSlotInfo::CSlotInfo()
|
||||
: Animation("empty"),
|
||||
Skeleton("empty"),
|
||||
Offset(0),
|
||||
StartTime(0),
|
||||
EndTime(0),
|
||||
StartBlend(1),
|
||||
EndBlend (1),
|
||||
Smoothness(1),
|
||||
SpeedFactor(1),
|
||||
ClampMode(0),
|
||||
SkeletonInverted(false),
|
||||
Enable(true)
|
||||
: Animation("empty"),
|
||||
Skeleton("empty"),
|
||||
Offset(0),
|
||||
StartTime(0),
|
||||
EndTime(0),
|
||||
StartBlend(1),
|
||||
EndBlend (1),
|
||||
Smoothness(1),
|
||||
SpeedFactor(1),
|
||||
ClampMode(0),
|
||||
SkeletonInverted(false),
|
||||
Enable(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -80,15 +80,15 @@ CSlotInfo &CSlotInfo::operator=(const CSlotInfo &slotInfo)
|
|||
}
|
||||
|
||||
CEntity::CEntity(void)
|
||||
: _Name("<Unknown>"),
|
||||
_FileNameShape(""),
|
||||
_FileNameSkeleton(""),
|
||||
_inPlace(false),
|
||||
_incPos(false),
|
||||
_Instance(NULL),
|
||||
_Skeleton(NULL),
|
||||
_PlayList(NULL),
|
||||
_AnimationSet(NULL)
|
||||
: _Name("<Unknown>"),
|
||||
_FileNameShape(""),
|
||||
_FileNameSkeleton(""),
|
||||
_inPlace(false),
|
||||
_incPos(false),
|
||||
_Instance(NULL),
|
||||
_Skeleton(NULL),
|
||||
_PlayList(NULL),
|
||||
_AnimationSet(NULL)
|
||||
{
|
||||
_CharacterScalePos = 1;
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ public:
|
|||
|
||||
SAnimationStatus()
|
||||
: LoopAnim(false), PlayAnim(false),
|
||||
CurrentTimeAnim(0), StartAnim(0),
|
||||
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
||||
CurrentTimeAnim(0), StartAnim(0),
|
||||
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
||||
};
|
||||
|
||||
/// Destructor
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
{
|
||||
return _SWTList;
|
||||
}
|
||||
|
||||
|
||||
/// Get game interface for manipulating Skeleton.
|
||||
NL3D::UInstance getInstance() const
|
||||
{
|
||||
|
|
|
@ -25,20 +25,20 @@
|
|||
|
||||
#include "iplugin_manager.h"
|
||||
|
||||
namespace NLMISC
|
||||
namespace NLMISC
|
||||
{
|
||||
class INelContext;
|
||||
class INelContext;
|
||||
}
|
||||
|
||||
namespace ExtensionSystem
|
||||
{
|
||||
|
||||
/**
|
||||
@interface IPlugin
|
||||
@brief Base class for all plugins.
|
||||
@details The IPlugin class is an abstract class that must be implemented
|
||||
once for each plugin. The IPlugin implementation must be exported and
|
||||
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
||||
@interface IPlugin
|
||||
@brief Base class for all plugins.
|
||||
@details The IPlugin class is an abstract class that must be implemented
|
||||
once for each plugin. The IPlugin implementation must be exported and
|
||||
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
||||
see the Qt documentation for details on that.
|
||||
*/
|
||||
class IPlugin
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
virtual void extensionsInitialized() = 0;
|
||||
virtual void shutdown() { }
|
||||
|
||||
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
||||
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual QString version() const = 0;
|
||||
|
|
|
@ -23,16 +23,17 @@
|
|||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
namespace ExtensionSystem
|
||||
{
|
||||
class IPluginSpec;
|
||||
|
||||
/**
|
||||
@interface IPluginManager
|
||||
@brief Interface for plugin system that manages the plugins, their life cycle and their registered objects.
|
||||
@details The plugin manager is used for the following tasks:
|
||||
- Manage plugins and their state
|
||||
@interface IPluginManager
|
||||
@brief Interface for plugin system that manages the plugins, their life cycle and their registered objects.
|
||||
@details The plugin manager is used for the following tasks:
|
||||
- Manage plugins and their state
|
||||
- Manipulate a 'common object pool'
|
||||
*/
|
||||
class IPluginManager: public QObject
|
||||
|
@ -54,6 +55,10 @@ public:
|
|||
virtual void setPluginPaths(const QStringList &paths) = 0;
|
||||
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
|
||||
|
||||
// Settings
|
||||
virtual void setSettings(QSettings *settings) = 0;
|
||||
virtual QSettings *settings() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void objectAdded(QObject *obj);
|
||||
void aboutToRemoveObject(QObject *obj);
|
||||
|
|
|
@ -26,10 +26,10 @@ namespace ExtensionSystem
|
|||
{
|
||||
class IPlugin;
|
||||
class IPluginManager;
|
||||
|
||||
/**
|
||||
@struct State
|
||||
@details The plugin goes through several steps while being loaded.
|
||||
|
||||
/**
|
||||
@struct State
|
||||
@details The plugin goes through several steps while being loaded.
|
||||
The state gives a hint on what went wrong in case of an error.
|
||||
*/
|
||||
struct State
|
||||
|
@ -47,11 +47,11 @@ struct State
|
|||
};
|
||||
|
||||
/**
|
||||
@interface IPluginSpec
|
||||
@brief Interface for plugin spec contains the information of the plugins and
|
||||
information about the plugin's current state.
|
||||
@details The plugin spec is also filled with more information as the plugin
|
||||
goes through its loading process (see State).
|
||||
@interface IPluginSpec
|
||||
@brief Interface for plugin spec contains the information of the plugins and
|
||||
information about the plugin's current state.
|
||||
@details The plugin spec is also filled with more information as the plugin
|
||||
goes through its loading process (see State).
|
||||
If an error occurs, the plugin spec is the place to look for the error details.
|
||||
*/
|
||||
class IPluginSpec
|
||||
|
|
|
@ -28,14 +28,16 @@
|
|||
namespace ExtensionSystem
|
||||
{
|
||||
|
||||
CPluginManager::CPluginManager(QObject *parent):
|
||||
IPluginManager(parent)
|
||||
CPluginManager::CPluginManager(QObject *parent)
|
||||
:IPluginManager(parent),
|
||||
_settings(0)
|
||||
{
|
||||
}
|
||||
|
||||
CPluginManager::~CPluginManager()
|
||||
{
|
||||
stopAll();
|
||||
deleteAll();
|
||||
qDeleteAll(_pluginSpecs);
|
||||
}
|
||||
|
||||
|
@ -92,8 +94,10 @@ void CPluginManager::loadPlugins()
|
|||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Initialized);
|
||||
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Running);
|
||||
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||
it.toBack();
|
||||
while (it.hasPrevious())
|
||||
setPluginState(it.previous(), State::Running);
|
||||
|
||||
Q_EMIT pluginsChanged();
|
||||
}
|
||||
|
@ -114,6 +118,24 @@ QList<IPluginSpec *> CPluginManager::plugins() const
|
|||
return _ipluginSpecs;
|
||||
}
|
||||
|
||||
void CPluginManager::setSettings(QSettings *settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
QSettings *CPluginManager::settings() const
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
|
||||
void CPluginManager::readSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginManager::writeSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginManager::readPluginPaths()
|
||||
{
|
||||
qDeleteAll(_pluginSpecs);
|
||||
|
@ -176,9 +198,16 @@ void CPluginManager::stopAll()
|
|||
{
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Stopped);
|
||||
}
|
||||
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Deleted);
|
||||
void CPluginManager::deleteAll()
|
||||
{
|
||||
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||
it.toBack();
|
||||
while (it.hasPrevious())
|
||||
{
|
||||
setPluginState(it.previous(), State::Deleted);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace NLQT
|
|
@ -51,13 +51,21 @@ public:
|
|||
virtual void setPluginPaths(const QStringList &paths);
|
||||
virtual QList<IPluginSpec *> plugins() const;
|
||||
|
||||
// Settings
|
||||
virtual void setSettings(QSettings *settings);
|
||||
virtual QSettings *settings() const;
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
private:
|
||||
void setPluginState(CPluginSpec *spec, int destState);
|
||||
void readPluginPaths();
|
||||
void stopAll();
|
||||
void deleteAll();
|
||||
|
||||
mutable QReadWriteLock _lock;
|
||||
|
||||
QSettings *_settings;
|
||||
QList<CPluginSpec *> _pluginSpecs;
|
||||
QList<IPluginSpec *> _ipluginSpecs;
|
||||
QStringList _pluginPaths;
|
||||
|
|
|
@ -30,9 +30,9 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_FollowPath(pbfs),
|
||||
_Node(ownerNode)
|
||||
: QDialog(parent),
|
||||
_FollowPath(pbfs),
|
||||
_Node(ownerNode)
|
||||
{
|
||||
resize(270, 90);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
|
|
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -21,6 +21,7 @@
|
|||
|
||||
// Qt includes
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QSplashScreen>
|
||||
|
@ -112,11 +113,14 @@ sint main(int argc, char **argv)
|
|||
|
||||
#if defined(NL_OS_MAC)
|
||||
QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources"));
|
||||
CLibrary::addLibPath(
|
||||
(qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
||||
CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
||||
#endif
|
||||
|
||||
Modules::init();
|
||||
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
|
||||
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
|
||||
|
||||
Modules::plugMan().setSettings(settings);
|
||||
|
||||
// load and set remap extensions from config
|
||||
Modules::config().configRemapExtensions();
|
||||
|
@ -129,21 +133,20 @@ sint main(int argc, char **argv)
|
|||
#if !defined(NL_OS_MAC)
|
||||
Modules::plugMan().setPluginPaths(QStringList() << QString("./plugins"));
|
||||
#else
|
||||
Modules::plugMan().setPluginPaths(QStringList() <<
|
||||
qApp->applicationDirPath() + QString("/../PlugIns/ovqt"));
|
||||
Modules::plugMan().setPluginPaths(QStringList() <<
|
||||
qApp->applicationDirPath() + QString("/../PlugIns/ovqt"));
|
||||
#endif
|
||||
|
||||
Modules::plugMan().loadPlugins();
|
||||
|
||||
|
||||
QStringList errors;
|
||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, Modules::plugMan().plugins())
|
||||
if (spec->hasError())
|
||||
errors.append(spec->fileName() + " : " + spec->errorString());
|
||||
|
||||
if (spec->hasError())
|
||||
errors.append(spec->fileName() + " : " + spec->errorString());
|
||||
|
||||
if (!errors.isEmpty())
|
||||
QMessageBox::warning(0,
|
||||
QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
||||
errors.join(QString::fromLatin1("\n\n")));
|
||||
QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
||||
errors.join(QString::fromLatin1("\n\n")));
|
||||
|
||||
splash->finish(&Modules::mainWin());
|
||||
int result = app.exec();
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "sun_color_dialog.h"
|
||||
#include "tune_mrm_dialog.h"
|
||||
#include "tune_timer_dialog.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
@ -58,13 +59,13 @@ namespace NLQT
|
|||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
_isGraphicsInitialized(false),
|
||||
_isGraphicsEnabled(false),
|
||||
_isSoundInitialized(false),
|
||||
_isSoundEnabled(false),
|
||||
_GraphicsViewport(NULL),
|
||||
_lastDir("."),
|
||||
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
||||
_isGraphicsInitialized(false),
|
||||
_isGraphicsEnabled(false),
|
||||
_isSoundInitialized(false),
|
||||
_isSoundEnabled(false),
|
||||
_GraphicsViewport(NULL),
|
||||
_lastDir("."),
|
||||
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
||||
{
|
||||
nldebug("CMainWindow::CMainWindow:");
|
||||
setObjectName("CMainWindow");
|
||||
|
@ -83,7 +84,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||
|
||||
_GraphicsViewport->init();
|
||||
_isGraphicsInitialized = true;
|
||||
|
||||
|
||||
if (_isSoundEnabled)
|
||||
{
|
||||
Modules::sound().init();
|
||||
|
@ -144,7 +145,8 @@ CMainWindow::~CMainWindow()
|
|||
delete _TuneTimerDialog;
|
||||
delete _ParticleControlDialog;
|
||||
delete _ParticleWorkspaceDialog;
|
||||
|
||||
delete _cameraControl;
|
||||
|
||||
if (_isSoundInitialized)
|
||||
Modules::sound().releaseGraphics();
|
||||
|
||||
|
@ -162,7 +164,7 @@ void CMainWindow::setVisible(bool visible)
|
|||
{
|
||||
QMainWindow::setVisible(true);
|
||||
if (_isSoundInitialized)
|
||||
Modules::sound().initGraphics();
|
||||
Modules::sound().initGraphics();
|
||||
_mainTimer->start();
|
||||
_statusBarTimer->start(1000);
|
||||
}
|
||||
|
@ -202,7 +204,7 @@ void CMainWindow::open()
|
|||
tr("NeL skeleton file (*.skel)"));
|
||||
|
||||
Q_FOREACH(QString fileName, list)
|
||||
loadFile(fileName, skelFileName);
|
||||
loadFile(fileName, skelFileName);
|
||||
|
||||
_AnimationSetDialog->updateListObject();
|
||||
_AnimationSetDialog->updateListAnim();
|
||||
|
@ -220,43 +222,6 @@ void CMainWindow::resetScene()
|
|||
_SkeletonTreeModel->resetTreeModel();
|
||||
}
|
||||
|
||||
void CMainWindow::changeRenderMode()
|
||||
{
|
||||
// Change render mode
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::resetCamera()
|
||||
{
|
||||
Modules::objView().resetCamera();
|
||||
}
|
||||
|
||||
void CMainWindow::changeCameraMode()
|
||||
{
|
||||
switch (_mouseMode)
|
||||
{
|
||||
case NL3D::U3dMouseListener::edit3d:
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
_mouseMode = NL3D::U3dMouseListener::firstPerson;
|
||||
break;
|
||||
case NL3D::U3dMouseListener::firstPerson:
|
||||
_mouseMode = NL3D::U3dMouseListener::edit3d;
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::reloadTextures()
|
||||
{
|
||||
Modules::objView().reloadTextures();
|
||||
|
@ -286,10 +251,10 @@ void CMainWindow::updateStatusBar()
|
|||
if (_isGraphicsInitialized)
|
||||
{
|
||||
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
|
||||
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
||||
_numTri).arg(
|
||||
_texMem, 0,'f',4).arg(
|
||||
_fps, 0,'f',2));
|
||||
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
||||
_numTri).arg(
|
||||
_texMem, 0,'f',4).arg(
|
||||
_fps, 0,'f',2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,18 +279,11 @@ void CMainWindow::createActions()
|
|||
_resetCameraAction = new QAction(tr("Reset camera"), this);
|
||||
_resetCameraAction->setShortcut(tr("Ctrl+R"));
|
||||
_resetCameraAction->setStatusTip(tr("Reset current camera"));
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
|
||||
_renderModeAction = new QAction("Change render mode", this);
|
||||
_renderModeAction->setIcon(QIcon(":/images/polymode.png"));
|
||||
_renderModeAction->setShortcut(tr("Ctrl+M"));
|
||||
_renderModeAction->setStatusTip(tr("Change render mode (Line, Point, Filled)"));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), this, SLOT(changeRenderMode()));
|
||||
|
||||
_cameraModeAction = new QAction("Change camera mode", this);
|
||||
_cameraModeAction->setShortcut(tr("Ctrl+W"));
|
||||
_cameraModeAction->setStatusTip(tr("Change camera mode (edit3d, firstPerson)"));
|
||||
connect(_cameraModeAction, SIGNAL(triggered()), this, SLOT(changeCameraMode()));
|
||||
|
||||
_resetSceneAction = new QAction(tr("&Reset scene"), this);
|
||||
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
||||
|
@ -366,7 +324,6 @@ void CMainWindow::createMenus()
|
|||
_viewMenu->addAction(_setBackColorAction);
|
||||
_viewMenu->addAction(_resetCameraAction);
|
||||
_viewMenu->addAction(_renderModeAction);
|
||||
_viewMenu->addAction(_cameraModeAction);
|
||||
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
||||
|
||||
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
||||
|
@ -457,6 +414,12 @@ void CMainWindow::createToolBars()
|
|||
_toolsBar->addAction(_TuneTimerDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_TuneMRMDialog->toggleViewAction());
|
||||
|
||||
_cameraControl = new CCameraControl(this);
|
||||
this->addToolBar(_cameraControl->getToolBar());
|
||||
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), _cameraControl, SLOT(resetCamera()));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), _cameraControl, SLOT(setRenderMode()));
|
||||
}
|
||||
|
||||
void CMainWindow::createStatusBar()
|
||||
|
@ -555,7 +518,7 @@ bool CMainWindow::loadFile(const QString &fileName, const QString &skelName)
|
|||
bool loaded;
|
||||
if (fileInfo.suffix() == "ig")
|
||||
loaded = Modules::objView().loadInstanceGroup(fileName.toStdString());
|
||||
else
|
||||
else
|
||||
loaded = Modules::objView().loadMesh(fileName.toStdString(), skelName.toStdString());
|
||||
|
||||
if (!loaded)
|
||||
|
@ -646,17 +609,17 @@ void CMainWindow::updateRender()
|
|||
|
||||
// 14. Update Debug (stuff for dev)
|
||||
// ...
|
||||
|
||||
// 15. Calc FPS
|
||||
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
|
||||
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
|
||||
_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
|
||||
|
||||
// 15. Calc FPS
|
||||
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
|
||||
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
|
||||
_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
|
||||
lastTime = newTime;
|
||||
|
||||
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
||||
{
|
||||
// 01. Render Driver (background color)
|
||||
//Modules::objView().getDriver()->activate();
|
||||
//Modules::objView().getDriver()->activate();
|
||||
Modules::objView().renderDriver(); // clear all buffers
|
||||
|
||||
// 02. Render Sky (sky scene)
|
||||
|
@ -681,7 +644,7 @@ void CMainWindow::updateRender()
|
|||
Modules::objView().renderDebug2D();
|
||||
|
||||
// 10. Get profile information
|
||||
NL3D::CPrimitiveProfile in, out;
|
||||
NL3D::CPrimitiveProfile in, out;
|
||||
Modules::objView().getDriver()->profileRenderedPrimitives (in, out);
|
||||
|
||||
_numTri = in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips;
|
||||
|
|
|
@ -56,6 +56,8 @@ class CSunColorDialog;
|
|||
class CTuneMRMDialog;
|
||||
class CTuneTimerDialog;
|
||||
|
||||
class CCameraControl;
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -79,9 +81,6 @@ public:
|
|||
private Q_SLOTS:
|
||||
void open();
|
||||
void resetScene();
|
||||
void changeRenderMode();
|
||||
void resetCamera();
|
||||
void changeCameraMode();
|
||||
void reloadTextures();
|
||||
void settings();
|
||||
void about();
|
||||
|
@ -122,6 +121,8 @@ private:
|
|||
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||
CTuneTimerDialog *_TuneTimerDialog;
|
||||
|
||||
CCameraControl *_cameraControl;
|
||||
|
||||
QPalette _originalPalette;
|
||||
QString _lastDir;
|
||||
|
||||
|
@ -143,7 +144,6 @@ private:
|
|||
QAction *_frameDelayAction;
|
||||
QAction *_lightGroupAction;
|
||||
QAction *_reloadTexturesAction;
|
||||
QAction *_cameraModeAction;
|
||||
QAction *_resetCameraAction;
|
||||
QAction *_resetSceneAction;
|
||||
QAction *_saveScreenshotAction;
|
||||
|
|
|
@ -26,7 +26,7 @@ NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
|||
NLQT::CParticleEditor *Modules::_particleEditor = NULL;
|
||||
NLQT::CSoundSystem *Modules::_soundSystem = NULL;
|
||||
NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL;
|
||||
ExtensionSystem::CPluginManager *Modules::_pluginManager = NULL;
|
||||
ExtensionSystem::CPluginManager *Modules::_pluginManager = NULL;
|
||||
|
||||
void Modules::init()
|
||||
{
|
||||
|
|
|
@ -62,9 +62,9 @@ public:
|
|||
{
|
||||
return *_vegetableEditor;
|
||||
}
|
||||
static ExtensionSystem::CPluginManager &plugMan()
|
||||
{
|
||||
return *_pluginManager;
|
||||
static ExtensionSystem::CPluginManager &plugMan()
|
||||
{
|
||||
return *_pluginManager;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
static NLQT::CParticleEditor *_particleEditor;
|
||||
static NLQT::CSoundSystem *_soundSystem;
|
||||
static NLQT::CVegetableEditor *_vegetableEditor;
|
||||
static ExtensionSystem::CPluginManager *_pluginManager;
|
||||
static ExtensionSystem::CPluginManager *_pluginManager;
|
||||
};
|
||||
|
||||
#endif // MODULES_H
|
||||
|
|
|
@ -34,9 +34,9 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_CM(cm)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_CM(cm)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_MTP(mtp)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_MTP(mtp)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/debug.h>
|
||||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/bitmap.h>
|
||||
|
@ -59,13 +58,13 @@ namespace NLQT
|
|||
|
||||
CObjectViewer::CObjectViewer()
|
||||
: _IDriver(0),
|
||||
_CScene(0),
|
||||
_Driver(0),
|
||||
_Scene(0),
|
||||
_TextContext(0),
|
||||
_CameraFocal(75),
|
||||
_CurrentInstance(""),
|
||||
_BloomEffect(false)
|
||||
_CScene(0),
|
||||
_Driver(0),
|
||||
_Scene(0),
|
||||
_TextContext(0),
|
||||
_CameraFocal(75),
|
||||
_CurrentInstance(""),
|
||||
_BloomEffect(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -115,19 +114,11 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
|||
|
||||
_Scene->enableLightingSystem(true);
|
||||
|
||||
// create the camera
|
||||
UCamera camera = _Scene->getCam();
|
||||
camera.setTransformMode (UTransformable::DirectMatrix);
|
||||
|
||||
setSizeViewport(w, h);
|
||||
|
||||
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
||||
|
||||
_MouseListener = _Driver->create3dMouseListener();
|
||||
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
||||
|
||||
resetCamera();
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_Driver->setFontManagerMaxMemory(2097152);
|
||||
|
||||
|
@ -184,7 +175,7 @@ void CObjectViewer::release()
|
|||
void CObjectViewer::updateInput()
|
||||
{
|
||||
_Driver->EventServer.pump();
|
||||
|
||||
|
||||
// New matrix from camera
|
||||
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
||||
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
||||
|
@ -218,53 +209,38 @@ void CObjectViewer::renderDebug2D()
|
|||
|
||||
void CObjectViewer::reloadTextures()
|
||||
{
|
||||
// For each instances
|
||||
std::vector<std::string> listObjects;
|
||||
getListObjects(listObjects);
|
||||
|
||||
for (size_t i = 0; i < listObjects.size(); ++i)
|
||||
{
|
||||
// Get the shape
|
||||
NL3D::UInstance instance = getEntity(listObjects[i]).getInstance();
|
||||
|
||||
// For each material
|
||||
if (!instance.empty())
|
||||
{
|
||||
uint numMaterial = instance.getNumMaterials();
|
||||
uint mat;
|
||||
for (mat = 0; mat < numMaterial; mat++)
|
||||
{
|
||||
// Get the material
|
||||
NL3D::CMaterial *material = instance.getMaterial(mat).getObjectPtr();
|
||||
|
||||
// For each texture
|
||||
int tex;
|
||||
for (tex = 0; tex < NL3D::IDRV_MAT_MAXTEXTURES; tex++)
|
||||
{
|
||||
ITexture *texture = material->getTexture(tex);
|
||||
|
||||
// Touch it!
|
||||
if (texture)
|
||||
getIDriver()->invalidateShareTexture(*texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// For each instances
|
||||
std::vector<std::string> listObjects;
|
||||
getListObjects(listObjects);
|
||||
|
||||
void CObjectViewer::resetCamera()
|
||||
{
|
||||
CVector hotSpot = CVector (0,0,0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_Scene->getCam().lookAt(hotSpot + CVector(0.57735f, 0.57735f, 0.57735f) * radius, hotSpot);
|
||||
|
||||
// Setup mouse listener
|
||||
_MouseListener->setMatrix (_Scene->getCam().getMatrix());
|
||||
_MouseListener->setFrustrum (_Scene->getCam().getFrustum());
|
||||
_MouseListener->setViewport (CViewport());
|
||||
_MouseListener->setHotSpot (hotSpot);
|
||||
for (size_t i = 0; i < listObjects.size(); ++i)
|
||||
{
|
||||
// Get the shape
|
||||
NL3D::UInstance instance = getEntity(listObjects[i]).getInstance();
|
||||
|
||||
// For each material
|
||||
if (!instance.empty())
|
||||
{
|
||||
uint numMaterial = instance.getNumMaterials();
|
||||
uint mat;
|
||||
for (mat = 0; mat < numMaterial; mat++)
|
||||
{
|
||||
// Get the material
|
||||
NL3D::CMaterial *material = instance.getMaterial(mat).getObjectPtr();
|
||||
|
||||
// For each texture
|
||||
int tex;
|
||||
for (tex = 0; tex < NL3D::IDRV_MAT_MAXTEXTURES; tex++)
|
||||
{
|
||||
ITexture *texture = material->getTexture(tex);
|
||||
|
||||
// Touch it!
|
||||
if (texture)
|
||||
getIDriver()->invalidateShareTexture(*texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga)
|
||||
|
@ -316,11 +292,11 @@ bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string
|
|||
|
||||
// if we can't create entity, skip it
|
||||
if (Entity.empty()) return false;
|
||||
|
||||
CAABBox bbox;
|
||||
Entity.getShapeAABBox(bbox);
|
||||
setCamera(bbox , Entity, true);
|
||||
|
||||
|
||||
CAABBox bbox;
|
||||
Entity.getShapeAABBox(bbox);
|
||||
setCamera(bbox , Entity, true);
|
||||
|
||||
_MouseListener->setMatrix(_Scene->getCam().getMatrix());
|
||||
|
||||
USkeleton Skeleton = _Scene->createSkeleton(skelFileName);
|
||||
|
@ -348,57 +324,57 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igName)
|
|||
{
|
||||
CPath::addSearchPath (CFile::getPath(igName));
|
||||
UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(igName);
|
||||
if (ig == 0)
|
||||
if (ig == 0)
|
||||
return false;
|
||||
ig->addToScene(*_Scene, _Driver);
|
||||
ig->unfreezeHRC();
|
||||
_ListIG.push_back(ig);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CObjectViewer::setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z)
|
||||
{
|
||||
CVector pos(0.f, 0.f, 0.f);
|
||||
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
||||
NL3D::UInstance inst;
|
||||
inst.cast(entity);
|
||||
if (!inst.empty())
|
||||
{
|
||||
inst.getDefaultPos(pos);
|
||||
inst.getDefaultRotQuat(quat);
|
||||
}
|
||||
|
||||
// fix scale (some shapes have a different value)
|
||||
entity.setScale(1.f, 1.f, 1.f);
|
||||
UCamera Camera = _Scene->getCam();
|
||||
CVector max_radius = bbox.getHalfSize();
|
||||
CVector center = bbox.getCenter();
|
||||
entity.setPivot(center);
|
||||
center += pos;
|
||||
float fov = float(_CameraFocal * (float)Pi/180.0);
|
||||
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
||||
if (radius == 0.f) radius = 1.f;
|
||||
float left, right, bottom, top, znear, zfar;
|
||||
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
||||
float dist = radius / (tan(fov/2));
|
||||
CVector eye(center);
|
||||
|
||||
CVector ax(quat.getAxis());
|
||||
|
||||
if (ax.isNull() || ax == CVector::I)
|
||||
{
|
||||
ax = CVector::J;
|
||||
}
|
||||
else if (ax == -CVector::K)
|
||||
{
|
||||
ax = -CVector::J;
|
||||
}
|
||||
|
||||
eye -= ax * (dist+radius);
|
||||
if (high_z)
|
||||
eye.z += max_radius.z/1.0f;
|
||||
get3dMouseListener()->setHotSpot(center);
|
||||
Camera.lookAt(eye, center);
|
||||
|
||||
void CObjectViewer::setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z)
|
||||
{
|
||||
CVector pos(0.f, 0.f, 0.f);
|
||||
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
||||
NL3D::UInstance inst;
|
||||
inst.cast(entity);
|
||||
if (!inst.empty())
|
||||
{
|
||||
inst.getDefaultPos(pos);
|
||||
inst.getDefaultRotQuat(quat);
|
||||
}
|
||||
|
||||
// fix scale (some shapes have a different value)
|
||||
entity.setScale(1.f, 1.f, 1.f);
|
||||
UCamera Camera = _Scene->getCam();
|
||||
CVector max_radius = bbox.getHalfSize();
|
||||
CVector center = bbox.getCenter();
|
||||
entity.setPivot(center);
|
||||
center += pos;
|
||||
float fov = float(_CameraFocal * (float)Pi/180.0);
|
||||
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
||||
if (radius == 0.f) radius = 1.f;
|
||||
float left, right, bottom, top, znear, zfar;
|
||||
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
||||
float dist = radius / (tan(fov/2));
|
||||
CVector eye(center);
|
||||
|
||||
CVector ax(quat.getAxis());
|
||||
|
||||
if (ax.isNull() || ax == CVector::I)
|
||||
{
|
||||
ax = CVector::J;
|
||||
}
|
||||
else if (ax == -CVector::K)
|
||||
{
|
||||
ax = -CVector::J;
|
||||
}
|
||||
|
||||
eye -= ax * (dist+radius);
|
||||
if (high_z)
|
||||
eye.z += max_radius.z/1.0f;
|
||||
get3dMouseListener()->setHotSpot(center);
|
||||
Camera.lookAt(eye, center);
|
||||
}
|
||||
|
||||
void CObjectViewer::resetScene()
|
||||
|
|
|
@ -100,8 +100,6 @@ public:
|
|||
|
||||
void reloadTextures();
|
||||
|
||||
void resetCamera();
|
||||
|
||||
/// Make a screenshot of the current scene and save.
|
||||
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
|
||||
|
||||
|
@ -188,19 +186,19 @@ public:
|
|||
{
|
||||
return _Driver;
|
||||
}
|
||||
|
||||
|
||||
NL3D::IDriver *getIDriver() const
|
||||
{
|
||||
return _IDriver;
|
||||
}
|
||||
|
||||
|
||||
/// Get a game interface for scene.
|
||||
/// @return pointer to the scene.
|
||||
inline NL3D::UScene *getScene() const
|
||||
{
|
||||
return _Scene;
|
||||
}
|
||||
|
||||
|
||||
NL3D::CScene *getCScene() const
|
||||
{
|
||||
return _CScene;
|
||||
|
|
|
@ -36,8 +36,13 @@
|
|||
<file>images/save-as.png</file>
|
||||
<file>images/save.png</file>
|
||||
<file>images/insert-horizontal.png</file>
|
||||
<file>images/polymode.png</file>
|
||||
|
||||
<file>images/polymode.png</file>
|
||||
<file>images/rmfill.png</file>
|
||||
<file>images/rmline.png</file>
|
||||
<file>images/rmpoints.png</file>
|
||||
<file>images/cam_del.png</file>
|
||||
<file>images/cam_add.png</file>
|
||||
|
||||
<file>images/Emitter.bmp</file>
|
||||
<file>images/Force.bmp</file>
|
||||
|
||||
|
|
|
@ -35,18 +35,18 @@ namespace NLQT
|
|||
|
||||
CParticleEditor::CParticleEditor(void)
|
||||
: _ActiveNode(NULL),
|
||||
_State(State::Stopped),
|
||||
_Speed(1.0f),
|
||||
_AutoRepeat(false),
|
||||
_DisplayBBox(false),
|
||||
_DisplayHelpers(false),
|
||||
_AutoUpdateBBox(false),
|
||||
_EmptyBBox(true),
|
||||
_PW(NULL),
|
||||
_Driver(NULL),
|
||||
_Scene(NULL),
|
||||
_FontManager(NULL),
|
||||
_FontGen(NULL)
|
||||
_State(State::Stopped),
|
||||
_Speed(1.0f),
|
||||
_AutoRepeat(false),
|
||||
_DisplayBBox(false),
|
||||
_DisplayHelpers(false),
|
||||
_AutoUpdateBBox(false),
|
||||
_EmptyBBox(true),
|
||||
_PW(NULL),
|
||||
_Driver(NULL),
|
||||
_Scene(NULL),
|
||||
_FontManager(NULL),
|
||||
_FontGen(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void CWorkspaceNode::memorizeState()
|
|||
void CWorkspaceNode::restoreState()
|
||||
{
|
||||
nlassert(_WS);
|
||||
if (!_PS)
|
||||
if (!_PS)
|
||||
return;
|
||||
_InitialPos.restoreSystem();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
|||
const std::string &parentBoneName)
|
||||
{
|
||||
nlassert(_WS);
|
||||
if (!_PSM)
|
||||
if (!_PSM)
|
||||
return;
|
||||
unstickPSFromSkeleton();
|
||||
_ParentSkelName = parentSkelName;
|
||||
|
@ -293,7 +293,7 @@ bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
|
|||
if (oldSB)
|
||||
{
|
||||
Modules::psEdit().getScene()->setShapeBank(oldSB);
|
||||
}
|
||||
}
|
||||
setup(*psm);
|
||||
unload();
|
||||
// commit new values
|
||||
|
|
|
@ -126,7 +126,7 @@ bool CParticleTreeItem::replace(const QList<QVariant> &data)
|
|||
|
||||
bool CParticleTreeItem::deleteChild(int row)
|
||||
{
|
||||
_childItems.removeAt(row);
|
||||
delete _childItems.takeAt(row);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ static std::map<std::string, uint> _PSElementIdentifiers;
|
|||
|
||||
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||
: QDockWidget(parent),
|
||||
_currentItem(NULL)
|
||||
_currentItem(NULL)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace NLQT
|
|||
|
||||
/**
|
||||
@class CWorkspacePage
|
||||
@brief Page for QStackWidget, to particles workspace operation (new/load/save workspace,
|
||||
@brief Page for QStackWidget, to particles workspace operation (new/load/save workspace,
|
||||
create/insert/remove all particles system to workspace)
|
||||
*/
|
||||
class CWorkspacePage: public QWidget
|
||||
|
|
|
@ -12,7 +12,6 @@ SET(OVQT_CORE_PLUGIN_HDR
|
|||
core_plugin.h
|
||||
main_window.h
|
||||
settings_dialog.h
|
||||
qnel_widget.h
|
||||
search_paths_settings_page.h
|
||||
plugin_view_dialog.h)
|
||||
|
||||
|
@ -37,11 +36,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
|||
|
||||
ADD_LIBRARY(ovqt_plugin_core MODULE ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc ${QT_LIBRARIES})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_core)
|
||||
|
|
|
@ -15,8 +15,18 @@
|
|||
// 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/>.
|
||||
|
||||
// Project includes
|
||||
#include "core_plugin.h"
|
||||
#include "settings_dialog.h"
|
||||
#include "core_constants.h"
|
||||
#include "search_paths_settings_page.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
#include "qtwin.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
@ -24,55 +34,70 @@
|
|||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
|
||||
#include "settings_dialog.h"
|
||||
#include "core_constants.h"
|
||||
#include "search_paths_settings_page.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace Core;
|
||||
|
||||
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
// for old ovqt
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
if (!wnd)
|
||||
{
|
||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
||||
return false;
|
||||
}
|
||||
oldOVQT = false;
|
||||
|
||||
//_mainWindow = new CMainWindow(_plugMan);
|
||||
//_mainWindow->show();
|
||||
_plugMan->addObject(new CSearchPathsSettingsPage(wnd));
|
||||
_plugMan->addObject(new CSearchPathsSettingsPage(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CorePlugin::extensionsInitialized()
|
||||
{
|
||||
// for old ovqt
|
||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||
|
||||
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||
nlassert(toolsMenu);
|
||||
nlassert(helpMenu);
|
||||
// for old ovqt
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
if (wnd)
|
||||
{
|
||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||
nlassert(toolsMenu);
|
||||
nlassert(helpMenu);
|
||||
|
||||
QAction *newAction = toolsMenu->addAction(tr("New settings"));
|
||||
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
||||
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
||||
QAction *newAction = toolsMenu->addAction(tr("New settings"));
|
||||
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
||||
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
||||
|
||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||
oldOVQT = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mainWindow = new CMainWindow(this);
|
||||
#ifdef Q_WS_X11
|
||||
_mainWindow->setAttribute(Qt::WA_TranslucentBackground);
|
||||
_mainWindow->setAttribute(Qt::WA_NoSystemBackground, false);
|
||||
QPalette pal = _mainWindow->palette();
|
||||
QColor bg = pal.window().color();
|
||||
bg.setAlpha(180);
|
||||
pal.setColor(QPalette::Window, bg);
|
||||
_mainWindow->setPalette(pal);
|
||||
_mainWindow->ensurePolished(); // workaround Oxygen filling the background
|
||||
_mainWindow->setAttribute(Qt::WA_StyledBackground, false);
|
||||
#endif
|
||||
if (QtWin::isCompositionEnabled())
|
||||
{
|
||||
QtWin::extendFrameIntoClientArea(_mainWindow);
|
||||
_mainWindow->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
_mainWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
void CorePlugin::shutdown()
|
||||
{
|
||||
//delete _mainWindow;
|
||||
delete _pluginView;
|
||||
if (!oldOVQT)
|
||||
{
|
||||
delete _mainWindow;
|
||||
delete _pluginView;
|
||||
}
|
||||
}
|
||||
|
||||
void CorePlugin::execSettings()
|
||||
|
|
|
@ -58,6 +58,24 @@ public:
|
|||
|
||||
QObject *objectByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginManager *pluginManager() const
|
||||
{
|
||||
return _plugMan;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
QList<Type *> getObjects() const
|
||||
{
|
||||
QList<QObject *> all = _plugMan->allObjects();
|
||||
QList<Type *> objects;
|
||||
Q_FOREACH(QObject *obj, all)
|
||||
{
|
||||
Type *typeObj = qobject_cast<Type *>(obj);
|
||||
if (typeObj)
|
||||
objects.append(typeObj);
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
|
@ -69,6 +87,8 @@ private:
|
|||
ExtensionSystem::IPluginManager *_plugMan;
|
||||
ExtensionSystem::CPluginView *_pluginView;
|
||||
CMainWindow *_mainWindow;
|
||||
|
||||
bool oldOVQT;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 IAPP_PAGE_H
|
||||
#define IAPP_PAGE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
/**
|
||||
@interface IAppPage
|
||||
@brief The IAppPage is an interface for providing app pages in main window.
|
||||
@details You need to subclass this interface and put an instance of your subclass
|
||||
into the plugin manager object pool.
|
||||
*/
|
||||
class IAppPage
|
||||
{
|
||||
public:
|
||||
virtual ~IAppPage() {}
|
||||
|
||||
/// id() is a unique identifier for referencing this page
|
||||
virtual QString id() const = 0;
|
||||
|
||||
/// trName() is the (translated) name for display.
|
||||
virtual QString trName() const = 0;
|
||||
|
||||
/// icon() is the icon for display
|
||||
virtual QIcon icon() const = 0;
|
||||
|
||||
/// The widget will be destroyed by the widget hierarchy when the main window closes
|
||||
virtual QWidget *widget() = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_INTERFACE(Core::IAppPage, "dev.ryzom.com.IAppPage/0.1")
|
||||
|
||||
#endif // IAPP_PAGE_H
|
|
@ -0,0 +1,56 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
//
|
||||
// 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 ICORE_LISTENER_H
|
||||
#define ICORE_LISTENER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
/**
|
||||
@interface ICoreListener
|
||||
@brief The ICoreListener is an interface for providing a hook for plugins to veto on close event emitted from
|
||||
the core plugin.
|
||||
@details You implement this interface if you want to prevent the closing of the whole application.
|
||||
If the application window requests a close, then first ICoreListener::closeMainWindow() is called
|
||||
(in arbitrary order) on all registered objects implementing this interface.
|
||||
If one if these calls returns false, the process is aborted and the event is ignored. If all calls return
|
||||
true, the corresponding signal is emitted and the event is accepted/performed.
|
||||
|
||||
You need to add your implementing object to the plugin managers objects:
|
||||
PluginManager->addObject(yourImplementingObject);
|
||||
Don't forget to remove the object again at deconstruction (e.g. in the destructor of
|
||||
your plugin)
|
||||
*/
|
||||
class ICoreListener
|
||||
{
|
||||
public:
|
||||
virtual ~ICoreListener() {}
|
||||
|
||||
/// Return false from the implemented method if you want to prevent the event.
|
||||
virtual bool closeMainWindow() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_INTERFACE(Core::ICoreListener, "dev.ryzom.com.ICoreListener/0.1")
|
||||
|
||||
#endif // ICORE_LISTENER_H
|
|
@ -31,7 +31,7 @@ namespace Core
|
|||
@details You need to subclass this interface and put an instance of your subclass
|
||||
into the plugin manager object pool.
|
||||
*/
|
||||
class IOptionsPage
|
||||
class IOptionsPage
|
||||
{
|
||||
public:
|
||||
virtual ~IOptionsPage() {}
|
||||
|
@ -63,4 +63,4 @@ public:
|
|||
|
||||
Q_DECLARE_INTERFACE(Core::IOptionsPage, "dev.ryzom.com.IOptionsPage/1.0")
|
||||
|
||||
#endif // IOPTIONSPAGE_H
|
||||
#endif // IOPTIONS_PAGE_H
|
||||
|
|
|
@ -17,43 +17,40 @@
|
|||
|
||||
// Project includes
|
||||
#include "main_window.h"
|
||||
#include "core_plugin.h"
|
||||
#include "iapp_page.h"
|
||||
#include "icore_listener.h"
|
||||
#include "core_constants.h"
|
||||
#include "settings_dialog.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
// Qt includes
|
||||
#include <QtGui/QtGui>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent)
|
||||
CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
_lastDir(".")
|
||||
{
|
||||
_pluginManager = pluginManager;
|
||||
_corePlugin = corePlugin;
|
||||
_pluginManager = _corePlugin->pluginManager();
|
||||
_settings = _pluginManager->settings();
|
||||
|
||||
setObjectName(Constants::MAIN_WINDOW);
|
||||
|
||||
_tabWidget = new QTabWidget(this);
|
||||
_tabWidget->setTabPosition(QTabWidget::South);
|
||||
setCentralWidget(_tabWidget);
|
||||
|
||||
QWidget *qwidg1 = new QWidget(_tabWidget);
|
||||
QWidget *qwidg2 = new QWidget(_tabWidget);
|
||||
QList<IAppPage *> listAppPages = _corePlugin->getObjects<IAppPage>();
|
||||
|
||||
_tabWidget->addTab(qwidg1, "tab1");
|
||||
_tabWidget->addTab(qwidg2, "tab2");
|
||||
|
||||
|
||||
QGridLayout *gridLayout = new QGridLayout(qwidg1);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(qwidg1);
|
||||
_nelWidget->setObjectName(QString::fromUtf8("NELWIdget1"));
|
||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||
|
||||
QGridLayout *gridLayout2 = new QGridLayout(qwidg2);
|
||||
NLQT::QNLWidget *_nelWidget2 = new NLQT::QNLWidget(qwidg2);
|
||||
_nelWidget2->setObjectName(QString::fromUtf8("NELWIdget2"));
|
||||
gridLayout2->addWidget(_nelWidget2, 0, 0, 1, 1);
|
||||
Q_FOREACH(IAppPage *appPage, listAppPages)
|
||||
{
|
||||
addAppPage(appPage);
|
||||
}
|
||||
|
||||
setDockNestingEnabled(true);
|
||||
|
||||
|
@ -64,8 +61,12 @@ CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget
|
|||
createMenus();
|
||||
createStatusBar();
|
||||
|
||||
readSettings();
|
||||
|
||||
setWindowIcon(QIcon(Constants::ICON_NEL));
|
||||
setWindowTitle(tr("Object Viewer Qt"));
|
||||
|
||||
connect(_pluginManager, SIGNAL(objectAdded(QObject *)), this, SLOT(checkObject(QObject *)));
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
|
@ -73,6 +74,13 @@ CMainWindow::~CMainWindow()
|
|||
delete _pluginView;
|
||||
}
|
||||
|
||||
void CMainWindow::checkObject(QObject *obj)
|
||||
{
|
||||
IAppPage *appPage = qobject_cast<IAppPage *>(obj);
|
||||
if (appPage)
|
||||
addAppPage(appPage);
|
||||
}
|
||||
|
||||
bool CMainWindow::showOptionsDialog(const QString &group,
|
||||
const QString &page,
|
||||
QWidget *parent)
|
||||
|
@ -91,6 +99,33 @@ void CMainWindow::about()
|
|||
"<p> Author: dnk-88 <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
||||
}
|
||||
|
||||
void CMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QList<ICoreListener *> listeners = _corePlugin->getObjects<ICoreListener>();
|
||||
Q_FOREACH(ICoreListener *listener, listeners)
|
||||
{
|
||||
if (!listener->closeMainWindow())
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
writeSettings();
|
||||
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void CMainWindow::addAppPage(IAppPage *appPage)
|
||||
{
|
||||
QWidget *tabWidget = new QWidget(_tabWidget);
|
||||
_tabWidget->addTab(tabWidget, appPage->icon(), appPage->trName());
|
||||
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + appPage->id());
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->addWidget(appPage->widget(), 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
void CMainWindow::createActions()
|
||||
{
|
||||
_openAction = new QAction(tr("&Open..."), this);
|
||||
|
@ -150,12 +185,6 @@ void CMainWindow::createMenus()
|
|||
_helpMenu->addAction(_aboutAction);
|
||||
_helpMenu->addAction(_aboutQtAction);
|
||||
_helpMenu->addAction(_pluginViewAction);
|
||||
|
||||
_pluginManager->addObject(_fileMenu);
|
||||
_pluginManager->addObject(_editMenu);
|
||||
_pluginManager->addObject(_viewMenu);
|
||||
_pluginManager->addObject(_toolsMenu);
|
||||
_pluginManager->addObject(_helpMenu);
|
||||
}
|
||||
|
||||
void CMainWindow::createStatusBar()
|
||||
|
@ -168,6 +197,22 @@ void CMainWindow::createDialogs()
|
|||
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
||||
}
|
||||
|
||||
void CMainWindow::readSettings()
|
||||
{
|
||||
_settings->beginGroup("MainWindowSettings");
|
||||
restoreState(_settings->value("QtWindowState").toByteArray());
|
||||
restoreGeometry(_settings->value("QtWindowGeometry").toByteArray());
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
void CMainWindow::writeSettings()
|
||||
{
|
||||
_settings->beginGroup("MainWindowSettings");
|
||||
_settings->setValue("QtWindowState", saveState());
|
||||
_settings->setValue("QtWindowGeometry", saveGeometry());
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
} /* namespace Core */
|
||||
|
||||
/* end of file */
|
||||
|
|
|
@ -18,48 +18,53 @@
|
|||
#ifndef MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "plugin_view_dialog.h"
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
// Project includes
|
||||
#include "qnel_widget.h"
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "plugin_view_dialog.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class CSettingsDialog;
|
||||
class CorePlugin;
|
||||
class IAppPage;
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0);
|
||||
CMainWindow(CorePlugin *corePlugin, QWidget *parent = 0);
|
||||
~CMainWindow();
|
||||
|
||||
inline QSettings *settings() const
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
void checkObject(QObject *obj);
|
||||
bool showOptionsDialog(const QString &group = QString(),
|
||||
const QString &page = QString(),
|
||||
QWidget *parent = 0);
|
||||
const QString &page = QString(),
|
||||
QWidget *parent = 0);
|
||||
void about();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
private:
|
||||
void addAppPage(IAppPage *appPage);
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createStatusBar();
|
||||
void createDialogs();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
ExtensionSystem::IPluginManager *_pluginManager;
|
||||
ExtensionSystem::CPluginView *_pluginView;
|
||||
CorePlugin *_corePlugin;
|
||||
|
||||
QPalette _originalPalette;
|
||||
QString _lastDir;
|
||||
|
|
241
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp
Normal file
241
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp
Normal file
|
@ -0,0 +1,241 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qtwin.h"
|
||||
#include <QLibrary>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#include <qt_windows.h>
|
||||
|
||||
// Blur behind data structures
|
||||
#define DWM_BB_ENABLE 0x00000001 // fEnable has been specified
|
||||
#define DWM_BB_BLURREGION 0x00000002 // hRgnBlur has been specified
|
||||
#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 // fTransitionOnMaximized has been specified
|
||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E // Composition changed window message
|
||||
|
||||
typedef struct _DWM_BLURBEHIND
|
||||
{
|
||||
DWORD dwFlags;
|
||||
BOOL fEnable;
|
||||
HRGN hRgnBlur;
|
||||
BOOL fTransitionOnMaximized;
|
||||
} DWM_BLURBEHIND, *PDWM_BLURBEHIND;
|
||||
|
||||
typedef struct _MARGINS
|
||||
{
|
||||
int cxLeftWidth;
|
||||
int cxRightWidth;
|
||||
int cyTopHeight;
|
||||
int cyBottomHeight;
|
||||
} MARGINS, *PMARGINS;
|
||||
|
||||
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
|
||||
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
|
||||
typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
|
||||
typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend);
|
||||
|
||||
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0;
|
||||
static PtrDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = 0;
|
||||
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
|
||||
static PtrDwmGetColorizationColor pDwmGetColorizationColor = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Internal helper class that notifies windows if the
|
||||
* DWM compositing state changes and updates the widget
|
||||
* flags correspondingly.
|
||||
*/
|
||||
class WindowNotifier : public QWidget
|
||||
{
|
||||
public:
|
||||
WindowNotifier()
|
||||
{
|
||||
winId();
|
||||
}
|
||||
void addWidget(QWidget *widget)
|
||||
{
|
||||
widgets.append(widget);
|
||||
}
|
||||
void removeWidget(QWidget *widget)
|
||||
{
|
||||
widgets.removeAll(widget);
|
||||
}
|
||||
bool winEvent(MSG *message, long *result);
|
||||
|
||||
private:
|
||||
QWidgetList widgets;
|
||||
};
|
||||
|
||||
static bool resolveLibs()
|
||||
{
|
||||
if (!pDwmIsCompositionEnabled)
|
||||
{
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
pDwmIsCompositionEnabled =(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
|
||||
pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
|
||||
pDwmEnableBlurBehindWindow = (PtrDwmEnableBlurBehindWindow)dwmLib.resolve("DwmEnableBlurBehindWindow");
|
||||
pDwmGetColorizationColor = (PtrDwmGetColorizationColor)dwmLib.resolve("DwmGetColorizationColor");
|
||||
}
|
||||
return pDwmIsCompositionEnabled != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Chekcs and returns true if Windows DWM composition
|
||||
* is currently enabled on the system.
|
||||
*
|
||||
* To get live notification on the availability of
|
||||
* this feature, you will currently have to
|
||||
* reimplement winEvent() on your widget and listen
|
||||
* for the WM_DWMCOMPOSITIONCHANGED event to occur.
|
||||
*
|
||||
*/
|
||||
bool QtWin::isCompositionEnabled()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
BOOL isEnabled = false;
|
||||
hr = pDwmIsCompositionEnabled(&isEnabled);
|
||||
if (SUCCEEDED(hr))
|
||||
return isEnabled;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Enables Blur behind on a Widget.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable)
|
||||
{
|
||||
Q_ASSERT(widget);
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
DWM_BLURBEHIND bb = {0};
|
||||
HRESULT hr = S_OK;
|
||||
bb.fEnable = enable;
|
||||
bb.dwFlags = DWM_BB_ENABLE;
|
||||
bb.hRgnBlur = NULL;
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, enable);
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, enable);
|
||||
hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* ExtendFrameIntoClientArea.
|
||||
*
|
||||
* This controls the rendering of the frame inside the window.
|
||||
* Note that passing margins of -1 (the default value) will completely
|
||||
* remove the frame from the window.
|
||||
*
|
||||
* \note you should not call enableBlurBehindWindow before calling
|
||||
* this functions
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom)
|
||||
{
|
||||
|
||||
Q_ASSERT(widget);
|
||||
Q_UNUSED(left);
|
||||
Q_UNUSED(top);
|
||||
Q_UNUSED(right);
|
||||
Q_UNUSED(bottom);
|
||||
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
MARGINS m = {left, top, right, bottom};
|
||||
hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, result);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the current colorizationColor for the window.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
QColor QtWin::colorizatinColor()
|
||||
{
|
||||
QColor resultColor = QApplication::palette().window().color();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
DWORD color = 0;
|
||||
BOOL opaque = FALSE;
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
hr = pDwmGetColorizationColor(&color, &opaque);
|
||||
if (SUCCEEDED(hr))
|
||||
resultColor = QColor(color);
|
||||
}
|
||||
#endif
|
||||
return resultColor;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
WindowNotifier *QtWin::windowNotifier()
|
||||
{
|
||||
static WindowNotifier *windowNotifierInstance = 0;
|
||||
if (!windowNotifierInstance)
|
||||
windowNotifierInstance = new WindowNotifier;
|
||||
return windowNotifierInstance;
|
||||
}
|
||||
|
||||
|
||||
/* Notify all enabled windows that the DWM state changed */
|
||||
bool WindowNotifier::winEvent(MSG *message, long *result)
|
||||
{
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED)
|
||||
{
|
||||
bool compositionEnabled = QtWin::isCompositionEnabled();
|
||||
Q_FOREACH(QWidget * widget, widgets)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled);
|
||||
}
|
||||
widget->update();
|
||||
}
|
||||
}
|
||||
return QWidget::winEvent(message, result);
|
||||
}
|
||||
#endif
|
37
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h
Normal file
37
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTWIN_H
|
||||
#define QTWIN_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QWidget>
|
||||
/**
|
||||
* This is a helper class for using the Desktop Window Manager
|
||||
* functionality on Windows 7 and Windows Vista. On other platforms
|
||||
* these functions will simply not do anything.
|
||||
*/
|
||||
|
||||
class WindowNotifier;
|
||||
|
||||
class QtWin
|
||||
{
|
||||
public:
|
||||
static bool enableBlurBehindWindow(QWidget *widget, bool enable = true);
|
||||
static bool extendFrameIntoClientArea(QWidget *widget,
|
||||
int left = -1, int top = -1,
|
||||
int right = -1, int bottom = -1);
|
||||
static bool isCompositionEnabled();
|
||||
static QColor colorizatinColor();
|
||||
|
||||
private:
|
||||
static WindowNotifier *windowNotifier();
|
||||
};
|
||||
|
||||
#endif // QTWIN_H
|
|
@ -32,7 +32,7 @@ namespace Core
|
|||
/**
|
||||
@class CSearchPathsSettingsPage
|
||||
*/
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::IOptionsPage)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="searchPathsGroupBox">
|
||||
|
|
|
@ -10,7 +10,11 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||
|
||||
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h
|
||||
qnel_widget.h
|
||||
simple_viewer.h
|
||||
example_settings_page.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/iapp_page.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/icore_listener.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/ioptions_page.h)
|
||||
|
||||
SET(OVQT_PLUG_EXAMPLE_UIS example_settings_page.ui)
|
||||
|
@ -29,11 +33,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
|||
|
||||
ADD_LIBRARY(ovqt_plugin_example MODULE ${SRC} ${OVQT_PLUG_EXAMPLE_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_EXAMPLE_UI_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example nelmisc nel3d ${QT_LIBRARIES})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_example "NeL, Tools, 3D: Object Viewer Qt Plugin: Example")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_example)
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
|
@ -1,59 +1,37 @@
|
|||
#include "plugin1.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
#include "example_settings_page.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace Plugin;
|
||||
// Project includes
|
||||
#include "plugin1.h"
|
||||
#include "example_settings_page.h"
|
||||
#include "simple_viewer.h"
|
||||
#include "../core/iapp_page.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
_plugMan->addObject(new CExampleSettingsPage(wnd));
|
||||
if (!wnd)
|
||||
{
|
||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
||||
return false;
|
||||
}
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||
if (!helpMenu)
|
||||
{
|
||||
*errorString = tr("Not found QMenu Help.");
|
||||
return false;
|
||||
}
|
||||
_plugMan->addObject(new CExampleSettingsPage(this));
|
||||
_plugMan->addObject(new CExampleAppPage(this));
|
||||
_plugMan->addObject(new CCoreListener(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyPlugin::extensionsInitialized()
|
||||
{
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||
nlassert(helpMenu);
|
||||
|
||||
helpMenu->addSeparator();
|
||||
QAction *newAction = helpMenu->addAction("MyPlugin");
|
||||
|
||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execMessageBox()));
|
||||
}
|
||||
|
||||
void MyPlugin::execMessageBox()
|
||||
{
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
nlassert(wnd);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(wnd->objectName() + QString(": width=%1,height=%2").arg(wnd->width()).arg(wnd->height()));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MyPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||
|
@ -81,30 +59,32 @@ QString MyPlugin::vendor() const
|
|||
return "dnk-88";
|
||||
}
|
||||
|
||||
QString MyPlugin::description() const
|
||||
QString MyPlugin::description() const
|
||||
{
|
||||
return "Example ovqt plugin.";
|
||||
}
|
||||
|
||||
QList<QString> MyPlugin::dependencies() const
|
||||
{
|
||||
return QList<QString>();
|
||||
}
|
||||
|
||||
QObject* MyPlugin::objectByName(const QString &name) const
|
||||
{
|
||||
|
||||
QList<QString> MyPlugin::dependencies() const
|
||||
{
|
||||
return QList<QString>();
|
||||
}
|
||||
|
||||
QObject* MyPlugin::objectByName(const QString &name) const
|
||||
{
|
||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
||||
if (qobj->objectName() == name)
|
||||
return qobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
||||
{
|
||||
if (qobj->objectName() == name)
|
||||
return qobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
||||
{
|
||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||
if (spec->name() == name)
|
||||
return spec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(MyPlugin)
|
||||
if (spec->name() == name)
|
||||
return spec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(Plugin::MyPlugin)
|
|
@ -1,11 +1,17 @@
|
|||
#ifndef PLUGIN1_H
|
||||
#define PLUGIN1_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "simple_viewer.h"
|
||||
#include "../core/iapp_page.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/app_context.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
@ -17,7 +23,7 @@ namespace ExtensionSystem
|
|||
class IPluginSpec;
|
||||
}
|
||||
|
||||
namespace Plugin
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class MyPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||
|
@ -31,26 +37,49 @@ public:
|
|||
|
||||
void setNelContext(NLMISC::INelContext *nelContext);
|
||||
|
||||
QString name() const;
|
||||
QString version() const;
|
||||
QString vendor() const;
|
||||
QString name() const;
|
||||
QString version() const;
|
||||
QString vendor() const;
|
||||
QString description() const;
|
||||
QList<QString> dependencies() const;
|
||||
|
||||
QObject *objectByName(const QString &name) const;
|
||||
QList<QString> dependencies() const;
|
||||
|
||||
QObject *objectByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void execMessageBox();
|
||||
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
|
||||
private:
|
||||
ExtensionSystem::IPluginManager *_plugMan;
|
||||
|
||||
};
|
||||
|
||||
class CExampleAppPage: public QObject, public Core::IAppPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::IAppPage)
|
||||
public:
|
||||
CExampleAppPage(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~CExampleAppPage() {}
|
||||
|
||||
virtual QString id() const
|
||||
{
|
||||
return QLatin1String("ExampleAppPage");
|
||||
}
|
||||
virtual QString trName() const
|
||||
{
|
||||
return tr("SimpleViewer");
|
||||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
virtual QWidget *widget()
|
||||
{
|
||||
return new CSimpleViewer();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // PLUGIN1_H
|
||||
|
|
|
@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent)
|
|||
_initialized(false),
|
||||
_interval(25)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
init();
|
||||
_mainTimer = new QTimer(this);
|
||||
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
||||
|
@ -55,8 +58,7 @@ void QNLWidget::init()
|
|||
nlassert(_driver);
|
||||
|
||||
// initialize the nel 3d viewport
|
||||
_driver->setDisplay((nlWindow)winId(),
|
||||
NL3D::UDriver::CMode(width(), height(), 32));
|
||||
_driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_driver->setFontManagerMaxMemory(2097152);
|
||||
|
@ -111,39 +113,6 @@ void QNLWidget::showEvent(QShowEvent *showEvent)
|
|||
_mainTimer->stop();
|
||||
}
|
||||
|
||||
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
// Qt does not provide wheel events through winEvent() and macEvent() (but it
|
||||
// does through x11Event(), which is inconsistent...)
|
||||
// Workaround is to handle wheel events like implemented below.
|
||||
//
|
||||
// TODO: this is not a clean solution, because all but wheel events are
|
||||
// handled using winEvent(), x11Event(), macEvent(). But this seems to be a
|
||||
// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm)
|
||||
void QNLWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Get relative positions.
|
||||
float fX = 1.0f - (float)event->pos().x() / this->width();
|
||||
float fY = 1.0f - (float)event->pos().y() / this->height();
|
||||
|
||||
// Get the buttons currently pressed.
|
||||
uint32 buttons = NLMISC::noButton;
|
||||
if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton;
|
||||
if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton;
|
||||
if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton;
|
||||
if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton;
|
||||
if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton;
|
||||
if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton;
|
||||
|
||||
if(event->delta() > 0)
|
||||
_driver->EventServer.postEvent(
|
||||
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL));
|
||||
else
|
||||
_driver->EventServer.postEvent(
|
||||
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL));
|
||||
}
|
||||
#endif // defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
|
||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
@ -65,10 +65,6 @@ private Q_SLOTS:
|
|||
protected:
|
||||
virtual void showEvent(QShowEvent *showEvent);
|
||||
|
||||
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
virtual void wheelEvent(QWheelEvent *event);
|
||||
#endif
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
virtual bool winEvent(MSG *message, long *result);
|
||||
#elif defined(NL_OS_MAC)
|
|
@ -0,0 +1,54 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 "simple_viewer.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
CSimpleViewer::CSimpleViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayoutSimpleViewer"));
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this);
|
||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
bool CCoreListener::closeMainWindow() const
|
||||
{
|
||||
int ret = QMessageBox::question(0, tr("Example close event hook"),
|
||||
tr("Do you want to close window?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (ret == QMessageBox::Yes)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* namespace Plugin */
|
|
@ -0,0 +1,55 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 SIMPLE_VIEWER_H
|
||||
#define SIMPLE_VIEWER_H
|
||||
|
||||
// Project includes
|
||||
#include "qnel_widget.h"
|
||||
#include "../core/icore_listener.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class CSimpleViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSimpleViewer(QWidget *parent = 0);
|
||||
virtual ~CSimpleViewer() {}
|
||||
};
|
||||
|
||||
class CCoreListener : public QObject, public Core::ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::ICoreListener)
|
||||
public:
|
||||
CCoreListener(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~CCoreListener() {}
|
||||
|
||||
virtual bool closeMainWindow() const;
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // SIMPLE_VIEWER_H
|
|
@ -27,10 +27,6 @@ ADD_LIBRARY(ovqt_plugin_log MODULE ${SRC} ${OVQT_PLUG_LOG_MOC_SRC} ${OVQT_EXT_SY
|
|||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_log nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_log ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_log "NeL, Tools, 3D: Object Viewer Qt Plugin: Log")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_log)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_log)
|
||||
|
|
|
@ -23,10 +23,6 @@ ADD_LIBRARY(ovqt_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MO
|
|||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_sheet_builder "NeL, Tools, 3D: Object Viewer Qt Plugin: Sheet builder")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_sheet_builder)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder)
|
||||
|
|
|
@ -59,7 +59,7 @@ CSettingsDialog::CSettingsDialog(QWidget *parent)
|
|||
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
||||
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
||||
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
||||
|
||||
|
||||
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
||||
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
||||
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
||||
|
@ -341,9 +341,9 @@ void CSettingsDialog::saveGraphicsSettings()
|
|||
|
||||
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
|
||||
|
||||
if (ui.paletteCheckBox->isChecked())
|
||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||
else
|
||||
if (ui.paletteCheckBox->isChecked())
|
||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||
else
|
||||
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ void CSettingsDialog::saveVegetableSettings()
|
|||
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
|
||||
list.push_back(str);
|
||||
}
|
||||
|
||||
|
||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
|
||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ namespace NLQT
|
|||
|
||||
CSlotGroupBox::CSlotGroupBox(QWidget *parent)
|
||||
: QGroupBox(parent),
|
||||
_animName("empty"),
|
||||
_skelName("empty"),
|
||||
_numSlot(0)
|
||||
_animName("empty"),
|
||||
_skelName("empty"),
|
||||
_numSlot(0)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace NLQT
|
|||
|
||||
CSoundSystem::CSoundSystem()
|
||||
:_AudioMixer(NULL),
|
||||
_AnimManager(NULL),
|
||||
_Zero(NLMISC::CVector::Null)
|
||||
_AnimManager(NULL),
|
||||
_Zero(NLMISC::CVector::Null)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace NLQT
|
|||
|
||||
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
_Node(ownerNode),
|
||||
_BasicSpinner(sf)
|
||||
_Node(ownerNode),
|
||||
_BasicSpinner(sf)
|
||||
{
|
||||
nlassert(_BasicSpinner);
|
||||
|
||||
|
|
|
@ -126,15 +126,15 @@ void CTailParticleWidget::setRibbonOrientation(int index)
|
|||
}
|
||||
|
||||
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if( event->type() == QEvent::Paint )
|
||||
{
|
||||
{
|
||||
if( event->type() == QEvent::Paint )
|
||||
{
|
||||
QPainter painter(_ui.graphicsWidget);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setBrush(QBrush(Qt::white));
|
||||
painter.setPen(QPen(Qt::black, 2, Qt::SolidLine));
|
||||
painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0);
|
||||
|
||||
painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0);
|
||||
|
||||
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
|
||||
painter.scale(0.86, 0.86);
|
||||
painter.translate(6, 6);
|
||||
|
@ -167,9 +167,9 @@ bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
|||
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[0].y)),
|
||||
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
|
||||
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <nel/3d/u_scene.h>
|
||||
|
||||
// Project includes
|
||||
#include "modules.h"
|
||||
#include "modules.h"
|
||||
|
||||
const int sliderStepSize = 5000;
|
||||
|
||||
|
@ -47,8 +47,8 @@ CTuneMRMDialog::~CTuneMRMDialog()
|
|||
}
|
||||
|
||||
void CTuneMRMDialog::setMaxValue(int value)
|
||||
{
|
||||
int actualMaxValue = value * sliderStepSize;
|
||||
{
|
||||
int actualMaxValue = value * sliderStepSize;
|
||||
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
|
||||
|
||||
_ui.currentValueSlider->setMaximum(actualMaxValue);
|
||||
|
|
|
@ -38,7 +38,7 @@ class CTuneTimerDialog: public QDockWidget
|
|||
public:
|
||||
CTuneTimerDialog(QWidget *parent = 0);
|
||||
~CTuneTimerDialog();
|
||||
|
||||
|
||||
void setInterval(int value);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<enum>QSlider::TicksAbove</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>100</number>
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -96,6 +96,8 @@ template <typename T>
|
|||
class CValueBlenderDialogClientT : public IValueBlenderDialogClient
|
||||
{
|
||||
public:
|
||||
virtual ~CValueBlenderDialogClientT() {}
|
||||
|
||||
// the scheme being used. Must be set by the user
|
||||
NL3D::CPSValueBlendFuncBase<T> *SchemeFunc;
|
||||
|
||||
|
@ -143,6 +145,8 @@ protected:
|
|||
class CFloatBlenderDialogClient : public CValueBlenderDialogClientT<float>
|
||||
{
|
||||
public:
|
||||
~CFloatBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<float> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeFloatWidget *erf = new CEditRangeFloatWidget(parent);
|
||||
|
@ -158,6 +162,8 @@ public:
|
|||
class CUIntBlenderDialogClient : public CValueBlenderDialogClientT<uint32>
|
||||
{
|
||||
public:
|
||||
~CUIntBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<uint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeUIntWidget *erf = new CEditRangeUIntWidget(parent);
|
||||
|
@ -173,6 +179,8 @@ public:
|
|||
class CIntBlenderDialogClient : public CValueBlenderDialogClientT<sint32>
|
||||
{
|
||||
public:
|
||||
~CIntBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeIntWidget *erf = new CEditRangeIntWidget(parent);
|
||||
|
@ -188,6 +196,8 @@ public:
|
|||
class CRGBABlenderDialogClient : public CValueBlenderDialogClientT<NLMISC::CRGBA>
|
||||
{
|
||||
public:
|
||||
~CRGBABlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||
{
|
||||
CColorEditWidget *ce = new CColorEditWidget(parent);
|
||||
|
|
|
@ -59,6 +59,7 @@ class IValueGradientClient: public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
IValueGradientClient(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~IValueGradientClient() {}
|
||||
|
||||
virtual QWidget *createDialog(QWidget *parent) = 0;
|
||||
|
||||
|
@ -168,6 +169,7 @@ class CValueGradientClientT : public IValueGradientClient, public IPSWrapper<T>
|
|||
{
|
||||
public:
|
||||
CValueGradientClientT(QObject *parent = 0): IValueGradientClient(parent) {}
|
||||
virtual ~CValueGradientClientT() {}
|
||||
|
||||
/// the gradient being edited, must be filled by the instancier
|
||||
NL3D::CPSValueGradientFunc<T> *Scheme;
|
||||
|
@ -268,6 +270,7 @@ class CFloatGradientWrapper : public CValueGradientClientT<float>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CFloatGradientWrapper(QObject *parent = 0): CValueGradientClientT<float>(parent) {}
|
||||
~CFloatGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapperFloat *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -304,6 +307,7 @@ class CUIntGradientWrapper : public CValueGradientClientT<uint32>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CUIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<uint32>(parent) {}
|
||||
~CUIntGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapperUInt *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -340,6 +344,7 @@ class CIntGradientWrapper : public CValueGradientClientT<sint32>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<sint32>(parent) {}
|
||||
~CIntGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -376,6 +381,7 @@ class CColorGradientWrapper : public CValueGradientClientT<NLMISC::CRGBA>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CColorGradientWrapper(QObject *parent = 0): CValueGradientClientT<NLMISC::CRGBA>(parent) {}
|
||||
~CColorGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -418,6 +424,7 @@ class CPlaneBasisGradientWrapper : public CValueGradientClientT<NL3D::CPlaneBasi
|
|||
Q_OBJECT
|
||||
public:
|
||||
CPlaneBasisGradientWrapper(QObject *parent = 0): CValueGradientClientT<NL3D::CPlaneBasis>(parent) {}
|
||||
~CPlaneBasisGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<NL3D::CPlaneBasis> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -455,6 +462,8 @@ public:
|
|||
|
||||
CTextureGradientInterface(NL3D::CPSTexturedParticle *tp, CWorkspaceNode *ownerNode): Node(ownerNode), TP(tp) {}
|
||||
|
||||
~CTextureGradientInterface() {}
|
||||
|
||||
CWorkspaceNode *Node;
|
||||
NL3D::CPSTexturedParticle *TP;
|
||||
|
||||
|
|
|
@ -315,30 +315,30 @@ void CVegetableEditor::setVegetableWindPower(float w)
|
|||
{
|
||||
_VegetableWindPower= w;
|
||||
if(_VegetableLandscape)
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
}
|
||||
|
||||
void CVegetableEditor::setVegetableWindBendStart(float w)
|
||||
{
|
||||
_VegetableWindBendMin= w;
|
||||
if(_VegetableLandscape)
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
}
|
||||
|
||||
void CVegetableEditor::setVegetableWindFrequency(float w)
|
||||
{
|
||||
_VegetableWindFreq= w;
|
||||
if(_VegetableLandscape)
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||
_VegetableWindFreq,
|
||||
_VegetableWindPower,
|
||||
_VegetableWindBendMin);
|
||||
}
|
||||
|
||||
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace NLQT
|
|||
{
|
||||
|
||||
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
|
||||
: QGroupBox(parent),
|
||||
_emit(true)
|
||||
: QGroupBox(parent),
|
||||
_emit(true)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
|
||||
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
|
||||
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void noiseValueChanged(const NLMISC::CNoiseValue &value);
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@ TARGET_LINK_LIBRARIES(object_viewer_widget_qt
|
|||
${QT_LIBRARIES}
|
||||
${QT_QTOPENGL_LIBRARY})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(object_viewer_widget_qt ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
|
||||
ADD_DEFINITIONS(-DQT_PLUGIN)
|
||||
ADD_DEFINITIONS(-DQT_SHARED)
|
||||
|
|
|
@ -11,10 +11,6 @@ NL_TARGET_LIB(ryzom_gameshare ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameshare ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameshare nelmisc nelnet nelligo nelgeorges ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_gameshare "Ryzom, Library: Game Share")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameshare)
|
||||
|
|
|
@ -4,10 +4,6 @@ NL_TARGET_LIB(ryzom_adminmodules ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_adminmodules ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_adminmodules nelmisc nelnet)
|
||||
NL_DEFAULT_PROPS(ryzom_adminmodules "Ryzom, Library: Service Admin Modules")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_adminmodules)
|
||||
|
|
|
@ -4,10 +4,6 @@ NL_TARGET_LIB(ryzom_gameplaymodule ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameplaymodule ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameplaymodule nelmisc)
|
||||
NL_DEFAULT_PROPS(ryzom_gameplaymodule "Ryzom, Library: Gameplay Module")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameplaymodule)
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_export ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_export ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_export nelmisc nelligo nelgeorges nel3d nelpacs ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_export "Ryzom, Library, World: Export Tools")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_export)
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_landexport ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_landexport ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_landexport ryzom_export nelmisc nelligo nelgeorges nel3d nelpacs ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_landexport "Ryzom, Library, World: Land Export")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_landexport)
|
||||
|
|
Loading…
Reference in a new issue