Changed: Merge
This commit is contained in:
commit
0c61d64592
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}")
|
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
IF(WITH_STLPORT)
|
IF(WITH_STLPORT)
|
||||||
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES})
|
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
ENDIF(WITH_STLPORT)
|
ENDIF(WITH_STLPORT)
|
||||||
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
|
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
||||||
ELSE(WIN32 AND MFC_FOUND)
|
ELSE(WIN32 AND MFC_FOUND)
|
||||||
OPTION(WITH_MFC "With MFC Support" OFF)
|
OPTION(WITH_MFC "With MFC Support" OFF)
|
||||||
ENDIF(WIN32 AND MFC_FOUND)
|
ENDIF(WIN32 AND MFC_FOUND)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Optional support
|
# Optional support
|
||||||
###
|
###
|
||||||
|
@ -191,7 +191,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
OPTION(WITH_STLPORT "With STLport support." OFF)
|
OPTION(WITH_STLPORT "With STLport support." OFF)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
|
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
|
||||||
|
|
||||||
OPTION(WITH_NEL "Build NeL (nearly always required)." ON )
|
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_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
|
||||||
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
|
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
|
||||||
|
|
||||||
## Debug
|
## Debug
|
||||||
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
|
||||||
SET(CMAKE_CXX_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.")
|
SET(NL_DRIVER_PREFIX "${CMAKE_INSTALL_PREFIX}/lib/nel" CACHE PATH "Installation path for drivers.")
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
ENDIF(NOT NL_DRIVER_PREFIX)
|
ENDIF(NOT NL_DRIVER_PREFIX)
|
||||||
|
|
||||||
ENDMACRO(NL_SETUP_PREFIX_PATHS)
|
ENDMACRO(NL_SETUP_PREFIX_PATHS)
|
||||||
|
|
||||||
MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||||
|
|
|
@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp)
|
||||||
|
|
||||||
ADD_EXECUTABLE(nl_sample_command ${SRC})
|
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)
|
TARGET_LINK_LIBRARIES(nl_sample_command nelmisc)
|
||||||
NL_DEFAULT_PROPS(nl_sample_command "NeL, Samples, Misc: Commands")
|
NL_DEFAULT_PROPS(nl_sample_command "NeL, Samples, Misc: Commands")
|
||||||
NL_ADD_RUNTIME_FLAGS(nl_sample_command)
|
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})
|
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})
|
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY})
|
||||||
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
|
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
|
||||||
|
|
|
@ -16,10 +16,6 @@ NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
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})
|
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
|
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
|
||||||
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
||||||
|
|
|
@ -7,10 +7,6 @@ NL_TARGET_LIB(nelgeorges ${HEADERS} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(nelgeorges ${LIBXML2_LIBRARIES} nelmisc)
|
||||||
SET_TARGET_PROPERTIES(nelgeorges PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelgeorges PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelgeorges "NeL, Library: NeL Georges")
|
NL_DEFAULT_PROPS(nelgeorges "NeL, Library: NeL Georges")
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelligo ${HEADERS} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(nelligo ${LIBXML2_LIBRARIES} nelmisc)
|
||||||
SET_TARGET_PROPERTIES(nelligo PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelligo PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelligo "NeL, Library: NeL Ligo")
|
NL_DEFAULT_PROPS(nelligo "NeL, Library: NeL Ligo")
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nellogic ${HEADERS} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(nellogic ${LIBXML2_LIBRARIES} nelmisc nelnet)
|
||||||
SET_TARGET_PROPERTIES(nellogic PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nellogic PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nellogic "NeL, Library: NeL Logic")
|
NL_DEFAULT_PROPS(nellogic "NeL, Library: NeL Logic")
|
||||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_GTK)
|
||||||
ENDIF(GTK2_FOUND)
|
ENDIF(GTK2_FOUND)
|
||||||
ENDIF(WITH_GTK)
|
ENDIF(WITH_GTK)
|
||||||
|
|
||||||
IF(WITH_STLPORT)
|
|
||||||
TARGET_LINK_LIBRARIES(nelnet ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
ENDIF(WITH_STLPORT)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(nelnet nelmisc)
|
TARGET_LINK_LIBRARIES(nelnet nelmisc)
|
||||||
SET_TARGET_PROPERTIES(nelnet PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelnet PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")
|
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelpacs ${HEADERS} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||||
|
|
||||||
IF(WITH_STLPORT)
|
|
||||||
TARGET_LINK_LIBRARIES(nelpacs ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
ENDIF(WITH_STLPORT)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(nelpacs nelmisc)
|
TARGET_LINK_LIBRARIES(nelpacs nelmisc)
|
||||||
SET_TARGET_PROPERTIES(nelpacs PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelpacs PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelpacs "NeL, Library: NeL PACS")
|
NL_DEFAULT_PROPS(nelpacs "NeL, Library: NeL PACS")
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelsound ${HEADERS} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(nelsound ${LIBXML2_LIBRARIES} nelmisc nelligo nelgeorges nel3d nelsnd_lowlevel)
|
||||||
SET_TARGET_PROPERTIES(nelsound PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelsound PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelsound "NeL, Library: NeL Sound")
|
NL_DEFAULT_PROPS(nelsound "NeL, Library: NeL Sound")
|
||||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_STATIC)
|
||||||
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${OGG_LIBRARY})
|
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${OGG_LIBRARY})
|
||||||
ENDIF(WITH_STATIC)
|
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 "")
|
SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelsnd_lowlevel "NeL, Library: Sound Lowlevel")
|
NL_DEFAULT_PROPS(nelsnd_lowlevel "NeL, Library: Sound Lowlevel")
|
||||||
NL_ADD_RUNTIME_FLAGS(nelsnd_lowlevel)
|
NL_ADD_RUNTIME_FLAGS(nelsnd_lowlevel)
|
||||||
|
|
|
@ -28,10 +28,6 @@ NL_TARGET_DRIVER(${NLDRV_AL_LIB} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${OPENAL_LIBRARY} nelmisc nelsnd_lowlevel)
|
||||||
NL_DEFAULT_PROPS(${NLDRV_AL_LIB} "NeL, Driver, Sound: OpenAL")
|
NL_DEFAULT_PROPS(${NLDRV_AL_LIB} "NeL, Driver, Sound: OpenAL")
|
||||||
NL_ADD_RUNTIME_FLAGS(${NLDRV_AL_LIB})
|
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_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_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
||||||
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_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)
|
extension_system/iplugin_manager.h extension_system/plugin_manager.h)
|
||||||
|
|
||||||
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||||
|
|
|
@ -45,12 +45,12 @@ namespace NLQT
|
||||||
|
|
||||||
CAttribWidget::CAttribWidget(QWidget *parent)
|
CAttribWidget::CAttribWidget(QWidget *parent)
|
||||||
: QGroupBox(parent),
|
: QGroupBox(parent),
|
||||||
_SrcInputEnabled(true),
|
_SrcInputEnabled(true),
|
||||||
_EnableConstantValue(true),
|
_EnableConstantValue(true),
|
||||||
_DisableMemoryScheme(false),
|
_DisableMemoryScheme(false),
|
||||||
_NbCycleEnabled(true),
|
_NbCycleEnabled(true),
|
||||||
_Node(NULL),
|
_Node(NULL),
|
||||||
_SchemeWidget(NULL)
|
_SchemeWidget(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
_ui.constRangeUIntWidget->hide();
|
_ui.constRangeUIntWidget->hide();
|
||||||
|
|
|
@ -32,9 +32,9 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
|
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_Node(ownerNode),
|
_Node(ownerNode),
|
||||||
_PS(ps)
|
_PS(ps)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setDegradationExponent(int value);
|
void setDegradationExponent(int value);
|
||||||
void setSkipParticles(bool state);
|
void setSkipParticles(bool state);
|
||||||
|
|
||||||
void setDistRatio(float value);
|
void setDistRatio(float value);
|
||||||
void setMaxDistLODBias(float value);
|
void setMaxDistLODBias(float value);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateGraphics();
|
void updateGraphics();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
bool eventFilter(QObject *object, QEvent *event);
|
||||||
|
|
||||||
// wrapper to the datas
|
// wrapper to the datas
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CBinOpDialog : public QDialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
||||||
~CBinOpDialog();
|
virtual ~CBinOpDialog();
|
||||||
|
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ public:
|
||||||
_SchemeWrapper[k].Index = k ;
|
_SchemeWrapper[k].Index = k ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
uint k ;
|
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() >= 3)
|
||||||
{
|
{
|
||||||
if (var.size() > 4)
|
if (var.size() > 4)
|
||||||
nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
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);
|
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)
|
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_scale(1.0),
|
_scale(1.0),
|
||||||
_pos(0.0),
|
_pos(0.0),
|
||||||
_Node(ownerNode),
|
_Node(ownerNode),
|
||||||
_Curve(curve)
|
_Curve(curve)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
||||||
float _pos;
|
float _pos;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
/// the scheme being edited
|
/// the scheme being edited
|
||||||
NL3D::CPSFloatCurveFunctor *_Curve;
|
NL3D::CPSFloatCurveFunctor *_Curve;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace NLQT
|
||||||
const int max_range = 9999;
|
const int max_range = 9999;
|
||||||
|
|
||||||
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
_Wrapper(NULL),
|
_Wrapper(NULL),
|
||||||
_emit(true)
|
_emit(true)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -44,18 +44,18 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CSlotInfo::CSlotInfo()
|
CSlotInfo::CSlotInfo()
|
||||||
: Animation("empty"),
|
: Animation("empty"),
|
||||||
Skeleton("empty"),
|
Skeleton("empty"),
|
||||||
Offset(0),
|
Offset(0),
|
||||||
StartTime(0),
|
StartTime(0),
|
||||||
EndTime(0),
|
EndTime(0),
|
||||||
StartBlend(1),
|
StartBlend(1),
|
||||||
EndBlend (1),
|
EndBlend (1),
|
||||||
Smoothness(1),
|
Smoothness(1),
|
||||||
SpeedFactor(1),
|
SpeedFactor(1),
|
||||||
ClampMode(0),
|
ClampMode(0),
|
||||||
SkeletonInverted(false),
|
SkeletonInverted(false),
|
||||||
Enable(true)
|
Enable(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,15 +80,15 @@ CSlotInfo &CSlotInfo::operator=(const CSlotInfo &slotInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity::CEntity(void)
|
CEntity::CEntity(void)
|
||||||
: _Name("<Unknown>"),
|
: _Name("<Unknown>"),
|
||||||
_FileNameShape(""),
|
_FileNameShape(""),
|
||||||
_FileNameSkeleton(""),
|
_FileNameSkeleton(""),
|
||||||
_inPlace(false),
|
_inPlace(false),
|
||||||
_incPos(false),
|
_incPos(false),
|
||||||
_Instance(NULL),
|
_Instance(NULL),
|
||||||
_Skeleton(NULL),
|
_Skeleton(NULL),
|
||||||
_PlayList(NULL),
|
_PlayList(NULL),
|
||||||
_AnimationSet(NULL)
|
_AnimationSet(NULL)
|
||||||
{
|
{
|
||||||
_CharacterScalePos = 1;
|
_CharacterScalePos = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,8 @@ public:
|
||||||
|
|
||||||
SAnimationStatus()
|
SAnimationStatus()
|
||||||
: LoopAnim(false), PlayAnim(false),
|
: LoopAnim(false), PlayAnim(false),
|
||||||
CurrentTimeAnim(0), StartAnim(0),
|
CurrentTimeAnim(0), StartAnim(0),
|
||||||
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
|
@ -227,7 +227,7 @@ public:
|
||||||
{
|
{
|
||||||
return _SWTList;
|
return _SWTList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get game interface for manipulating Skeleton.
|
/// Get game interface for manipulating Skeleton.
|
||||||
NL3D::UInstance getInstance() const
|
NL3D::UInstance getInstance() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,20 +25,20 @@
|
||||||
|
|
||||||
#include "iplugin_manager.h"
|
#include "iplugin_manager.h"
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class INelContext;
|
class INelContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPlugin
|
@interface IPlugin
|
||||||
@brief Base class for all plugins.
|
@brief Base class for all plugins.
|
||||||
@details The IPlugin class is an abstract class that must be implemented
|
@details The IPlugin class is an abstract class that must be implemented
|
||||||
once for each plugin. The IPlugin implementation must be exported and
|
once for each plugin. The IPlugin implementation must be exported and
|
||||||
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro,
|
||||||
see the Qt documentation for details on that.
|
see the Qt documentation for details on that.
|
||||||
*/
|
*/
|
||||||
class IPlugin
|
class IPlugin
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
virtual void extensionsInitialized() = 0;
|
virtual void extensionsInitialized() = 0;
|
||||||
virtual void shutdown() { }
|
virtual void shutdown() { }
|
||||||
|
|
||||||
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
virtual void setNelContext(NLMISC::INelContext *nelContext) = 0;
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
virtual QString version() const = 0;
|
virtual QString version() const = 0;
|
||||||
|
|
|
@ -23,16 +23,17 @@
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPluginManager
|
@interface IPluginManager
|
||||||
@brief Interface for plugin system that manages the plugins, their life cycle and their registered objects.
|
@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:
|
@details The plugin manager is used for the following tasks:
|
||||||
- Manage plugins and their state
|
- Manage plugins and their state
|
||||||
- Manipulate a 'common object pool'
|
- Manipulate a 'common object pool'
|
||||||
*/
|
*/
|
||||||
class IPluginManager: public QObject
|
class IPluginManager: public QObject
|
||||||
|
@ -54,6 +55,10 @@ public:
|
||||||
virtual void setPluginPaths(const QStringList &paths) = 0;
|
virtual void setPluginPaths(const QStringList &paths) = 0;
|
||||||
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
|
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
virtual void setSettings(QSettings *settings) = 0;
|
||||||
|
virtual QSettings *settings() const = 0;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void objectAdded(QObject *obj);
|
void objectAdded(QObject *obj);
|
||||||
void aboutToRemoveObject(QObject *obj);
|
void aboutToRemoveObject(QObject *obj);
|
||||||
|
|
|
@ -26,10 +26,10 @@ namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPlugin;
|
class IPlugin;
|
||||||
class IPluginManager;
|
class IPluginManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@struct State
|
@struct State
|
||||||
@details The plugin goes through several steps while being loaded.
|
@details The plugin goes through several steps while being loaded.
|
||||||
The state gives a hint on what went wrong in case of an error.
|
The state gives a hint on what went wrong in case of an error.
|
||||||
*/
|
*/
|
||||||
struct State
|
struct State
|
||||||
|
@ -47,11 +47,11 @@ struct State
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@interface IPluginSpec
|
@interface IPluginSpec
|
||||||
@brief Interface for plugin spec contains the information of the plugins and
|
@brief Interface for plugin spec contains the information of the plugins and
|
||||||
information about the plugin's current state.
|
information about the plugin's current state.
|
||||||
@details The plugin spec is also filled with more information as the plugin
|
@details The plugin spec is also filled with more information as the plugin
|
||||||
goes through its loading process (see State).
|
goes through its loading process (see State).
|
||||||
If an error occurs, the plugin spec is the place to look for the error details.
|
If an error occurs, the plugin spec is the place to look for the error details.
|
||||||
*/
|
*/
|
||||||
class IPluginSpec
|
class IPluginSpec
|
||||||
|
|
|
@ -28,14 +28,16 @@
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
|
|
||||||
CPluginManager::CPluginManager(QObject *parent):
|
CPluginManager::CPluginManager(QObject *parent)
|
||||||
IPluginManager(parent)
|
:IPluginManager(parent),
|
||||||
|
_settings(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CPluginManager::~CPluginManager()
|
CPluginManager::~CPluginManager()
|
||||||
{
|
{
|
||||||
stopAll();
|
stopAll();
|
||||||
|
deleteAll();
|
||||||
qDeleteAll(_pluginSpecs);
|
qDeleteAll(_pluginSpecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +94,10 @@ void CPluginManager::loadPlugins()
|
||||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||||
setPluginState(spec, State::Initialized);
|
setPluginState(spec, State::Initialized);
|
||||||
|
|
||||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||||
setPluginState(spec, State::Running);
|
it.toBack();
|
||||||
|
while (it.hasPrevious())
|
||||||
|
setPluginState(it.previous(), State::Running);
|
||||||
|
|
||||||
Q_EMIT pluginsChanged();
|
Q_EMIT pluginsChanged();
|
||||||
}
|
}
|
||||||
|
@ -114,6 +118,24 @@ QList<IPluginSpec *> CPluginManager::plugins() const
|
||||||
return _ipluginSpecs;
|
return _ipluginSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPluginManager::setSettings(QSettings *settings)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings *CPluginManager::settings() const
|
||||||
|
{
|
||||||
|
return _settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPluginManager::readSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPluginManager::writeSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CPluginManager::readPluginPaths()
|
void CPluginManager::readPluginPaths()
|
||||||
{
|
{
|
||||||
qDeleteAll(_pluginSpecs);
|
qDeleteAll(_pluginSpecs);
|
||||||
|
@ -176,9 +198,16 @@ void CPluginManager::stopAll()
|
||||||
{
|
{
|
||||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||||
setPluginState(spec, State::Stopped);
|
setPluginState(spec, State::Stopped);
|
||||||
|
}
|
||||||
|
|
||||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
void CPluginManager::deleteAll()
|
||||||
setPluginState(spec, State::Deleted);
|
{
|
||||||
|
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||||
|
it.toBack();
|
||||||
|
while (it.hasPrevious())
|
||||||
|
{
|
||||||
|
setPluginState(it.previous(), State::Deleted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace NLQT
|
}; // namespace NLQT
|
|
@ -51,13 +51,21 @@ public:
|
||||||
virtual void setPluginPaths(const QStringList &paths);
|
virtual void setPluginPaths(const QStringList &paths);
|
||||||
virtual QList<IPluginSpec *> plugins() const;
|
virtual QList<IPluginSpec *> plugins() const;
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
virtual void setSettings(QSettings *settings);
|
||||||
|
virtual QSettings *settings() const;
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setPluginState(CPluginSpec *spec, int destState);
|
void setPluginState(CPluginSpec *spec, int destState);
|
||||||
void readPluginPaths();
|
void readPluginPaths();
|
||||||
void stopAll();
|
void stopAll();
|
||||||
|
void deleteAll();
|
||||||
|
|
||||||
mutable QReadWriteLock _lock;
|
mutable QReadWriteLock _lock;
|
||||||
|
|
||||||
|
QSettings *_settings;
|
||||||
QList<CPluginSpec *> _pluginSpecs;
|
QList<CPluginSpec *> _pluginSpecs;
|
||||||
QList<IPluginSpec *> _ipluginSpecs;
|
QList<IPluginSpec *> _ipluginSpecs;
|
||||||
QStringList _pluginPaths;
|
QStringList _pluginPaths;
|
||||||
|
|
|
@ -30,9 +30,9 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
|
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_FollowPath(pbfs),
|
_FollowPath(pbfs),
|
||||||
_Node(ownerNode)
|
_Node(ownerNode)
|
||||||
{
|
{
|
||||||
resize(270, 90);
|
resize(270, 90);
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
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
|
// Qt includes
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QSplashScreen>
|
#include <QtGui/QSplashScreen>
|
||||||
|
@ -112,11 +113,14 @@ sint main(int argc, char **argv)
|
||||||
|
|
||||||
#if defined(NL_OS_MAC)
|
#if defined(NL_OS_MAC)
|
||||||
QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources"));
|
QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources"));
|
||||||
CLibrary::addLibPath(
|
CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
||||||
(qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Modules::init();
|
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
|
// load and set remap extensions from config
|
||||||
Modules::config().configRemapExtensions();
|
Modules::config().configRemapExtensions();
|
||||||
|
@ -129,21 +133,20 @@ sint main(int argc, char **argv)
|
||||||
#if !defined(NL_OS_MAC)
|
#if !defined(NL_OS_MAC)
|
||||||
Modules::plugMan().setPluginPaths(QStringList() << QString("./plugins"));
|
Modules::plugMan().setPluginPaths(QStringList() << QString("./plugins"));
|
||||||
#else
|
#else
|
||||||
Modules::plugMan().setPluginPaths(QStringList() <<
|
Modules::plugMan().setPluginPaths(QStringList() <<
|
||||||
qApp->applicationDirPath() + QString("/../PlugIns/ovqt"));
|
qApp->applicationDirPath() + QString("/../PlugIns/ovqt"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Modules::plugMan().loadPlugins();
|
Modules::plugMan().loadPlugins();
|
||||||
|
|
||||||
QStringList errors;
|
QStringList errors;
|
||||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, Modules::plugMan().plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, Modules::plugMan().plugins())
|
||||||
if (spec->hasError())
|
if (spec->hasError())
|
||||||
errors.append(spec->fileName() + " : " + spec->errorString());
|
errors.append(spec->fileName() + " : " + spec->errorString());
|
||||||
|
|
||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
QMessageBox::warning(0,
|
QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
||||||
QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
errors.join(QString::fromLatin1("\n\n")));
|
||||||
errors.join(QString::fromLatin1("\n\n")));
|
|
||||||
|
|
||||||
splash->finish(&Modules::mainWin());
|
splash->finish(&Modules::mainWin());
|
||||||
int result = app.exec();
|
int result = app.exec();
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "sun_color_dialog.h"
|
#include "sun_color_dialog.h"
|
||||||
#include "tune_mrm_dialog.h"
|
#include "tune_mrm_dialog.h"
|
||||||
#include "tune_timer_dialog.h"
|
#include "tune_timer_dialog.h"
|
||||||
|
#include "camera_control.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
@ -58,13 +59,13 @@ namespace NLQT
|
||||||
|
|
||||||
CMainWindow::CMainWindow(QWidget *parent)
|
CMainWindow::CMainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
_isGraphicsInitialized(false),
|
_isGraphicsInitialized(false),
|
||||||
_isGraphicsEnabled(false),
|
_isGraphicsEnabled(false),
|
||||||
_isSoundInitialized(false),
|
_isSoundInitialized(false),
|
||||||
_isSoundEnabled(false),
|
_isSoundEnabled(false),
|
||||||
_GraphicsViewport(NULL),
|
_GraphicsViewport(NULL),
|
||||||
_lastDir("."),
|
_lastDir("."),
|
||||||
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
||||||
{
|
{
|
||||||
nldebug("CMainWindow::CMainWindow:");
|
nldebug("CMainWindow::CMainWindow:");
|
||||||
setObjectName("CMainWindow");
|
setObjectName("CMainWindow");
|
||||||
|
@ -83,7 +84,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||||
|
|
||||||
_GraphicsViewport->init();
|
_GraphicsViewport->init();
|
||||||
_isGraphicsInitialized = true;
|
_isGraphicsInitialized = true;
|
||||||
|
|
||||||
if (_isSoundEnabled)
|
if (_isSoundEnabled)
|
||||||
{
|
{
|
||||||
Modules::sound().init();
|
Modules::sound().init();
|
||||||
|
@ -144,7 +145,8 @@ CMainWindow::~CMainWindow()
|
||||||
delete _TuneTimerDialog;
|
delete _TuneTimerDialog;
|
||||||
delete _ParticleControlDialog;
|
delete _ParticleControlDialog;
|
||||||
delete _ParticleWorkspaceDialog;
|
delete _ParticleWorkspaceDialog;
|
||||||
|
delete _cameraControl;
|
||||||
|
|
||||||
if (_isSoundInitialized)
|
if (_isSoundInitialized)
|
||||||
Modules::sound().releaseGraphics();
|
Modules::sound().releaseGraphics();
|
||||||
|
|
||||||
|
@ -162,7 +164,7 @@ void CMainWindow::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
QMainWindow::setVisible(true);
|
QMainWindow::setVisible(true);
|
||||||
if (_isSoundInitialized)
|
if (_isSoundInitialized)
|
||||||
Modules::sound().initGraphics();
|
Modules::sound().initGraphics();
|
||||||
_mainTimer->start();
|
_mainTimer->start();
|
||||||
_statusBarTimer->start(1000);
|
_statusBarTimer->start(1000);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +204,7 @@ void CMainWindow::open()
|
||||||
tr("NeL skeleton file (*.skel)"));
|
tr("NeL skeleton file (*.skel)"));
|
||||||
|
|
||||||
Q_FOREACH(QString fileName, list)
|
Q_FOREACH(QString fileName, list)
|
||||||
loadFile(fileName, skelFileName);
|
loadFile(fileName, skelFileName);
|
||||||
|
|
||||||
_AnimationSetDialog->updateListObject();
|
_AnimationSetDialog->updateListObject();
|
||||||
_AnimationSetDialog->updateListAnim();
|
_AnimationSetDialog->updateListAnim();
|
||||||
|
@ -220,43 +222,6 @@ void CMainWindow::resetScene()
|
||||||
_SkeletonTreeModel->resetTreeModel();
|
_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()
|
void CMainWindow::reloadTextures()
|
||||||
{
|
{
|
||||||
Modules::objView().reloadTextures();
|
Modules::objView().reloadTextures();
|
||||||
|
@ -286,10 +251,10 @@ void CMainWindow::updateStatusBar()
|
||||||
if (_isGraphicsInitialized)
|
if (_isGraphicsInitialized)
|
||||||
{
|
{
|
||||||
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
|
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
|
||||||
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
||||||
_numTri).arg(
|
_numTri).arg(
|
||||||
_texMem, 0,'f',4).arg(
|
_texMem, 0,'f',4).arg(
|
||||||
_fps, 0,'f',2));
|
_fps, 0,'f',2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,18 +279,11 @@ void CMainWindow::createActions()
|
||||||
_resetCameraAction = new QAction(tr("Reset camera"), this);
|
_resetCameraAction = new QAction(tr("Reset camera"), this);
|
||||||
_resetCameraAction->setShortcut(tr("Ctrl+R"));
|
_resetCameraAction->setShortcut(tr("Ctrl+R"));
|
||||||
_resetCameraAction->setStatusTip(tr("Reset current camera"));
|
_resetCameraAction->setStatusTip(tr("Reset current camera"));
|
||||||
connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
|
||||||
|
|
||||||
_renderModeAction = new QAction("Change render mode", this);
|
_renderModeAction = new QAction("Change render mode", this);
|
||||||
_renderModeAction->setIcon(QIcon(":/images/polymode.png"));
|
_renderModeAction->setIcon(QIcon(":/images/polymode.png"));
|
||||||
_renderModeAction->setShortcut(tr("Ctrl+M"));
|
_renderModeAction->setShortcut(tr("Ctrl+M"));
|
||||||
_renderModeAction->setStatusTip(tr("Change render mode (Line, Point, Filled)"));
|
_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 = new QAction(tr("&Reset scene"), this);
|
||||||
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
||||||
|
@ -366,7 +324,6 @@ void CMainWindow::createMenus()
|
||||||
_viewMenu->addAction(_setBackColorAction);
|
_viewMenu->addAction(_setBackColorAction);
|
||||||
_viewMenu->addAction(_resetCameraAction);
|
_viewMenu->addAction(_resetCameraAction);
|
||||||
_viewMenu->addAction(_renderModeAction);
|
_viewMenu->addAction(_renderModeAction);
|
||||||
_viewMenu->addAction(_cameraModeAction);
|
|
||||||
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
||||||
|
|
||||||
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
||||||
|
@ -457,6 +414,12 @@ void CMainWindow::createToolBars()
|
||||||
_toolsBar->addAction(_TuneTimerDialog->toggleViewAction());
|
_toolsBar->addAction(_TuneTimerDialog->toggleViewAction());
|
||||||
_toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction());
|
_toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction());
|
||||||
_toolsBar->addAction(_TuneMRMDialog->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()
|
void CMainWindow::createStatusBar()
|
||||||
|
@ -555,7 +518,7 @@ bool CMainWindow::loadFile(const QString &fileName, const QString &skelName)
|
||||||
bool loaded;
|
bool loaded;
|
||||||
if (fileInfo.suffix() == "ig")
|
if (fileInfo.suffix() == "ig")
|
||||||
loaded = Modules::objView().loadInstanceGroup(fileName.toStdString());
|
loaded = Modules::objView().loadInstanceGroup(fileName.toStdString());
|
||||||
else
|
else
|
||||||
loaded = Modules::objView().loadMesh(fileName.toStdString(), skelName.toStdString());
|
loaded = Modules::objView().loadMesh(fileName.toStdString(), skelName.toStdString());
|
||||||
|
|
||||||
if (!loaded)
|
if (!loaded)
|
||||||
|
@ -646,17 +609,17 @@ void CMainWindow::updateRender()
|
||||||
|
|
||||||
// 14. Update Debug (stuff for dev)
|
// 14. Update Debug (stuff for dev)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 15. Calc FPS
|
// 15. Calc FPS
|
||||||
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
|
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
|
||||||
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
|
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
|
||||||
_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
|
_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
|
||||||
lastTime = newTime;
|
lastTime = newTime;
|
||||||
|
|
||||||
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
||||||
{
|
{
|
||||||
// 01. Render Driver (background color)
|
// 01. Render Driver (background color)
|
||||||
//Modules::objView().getDriver()->activate();
|
//Modules::objView().getDriver()->activate();
|
||||||
Modules::objView().renderDriver(); // clear all buffers
|
Modules::objView().renderDriver(); // clear all buffers
|
||||||
|
|
||||||
// 02. Render Sky (sky scene)
|
// 02. Render Sky (sky scene)
|
||||||
|
@ -681,7 +644,7 @@ void CMainWindow::updateRender()
|
||||||
Modules::objView().renderDebug2D();
|
Modules::objView().renderDebug2D();
|
||||||
|
|
||||||
// 10. Get profile information
|
// 10. Get profile information
|
||||||
NL3D::CPrimitiveProfile in, out;
|
NL3D::CPrimitiveProfile in, out;
|
||||||
Modules::objView().getDriver()->profileRenderedPrimitives (in, out);
|
Modules::objView().getDriver()->profileRenderedPrimitives (in, out);
|
||||||
|
|
||||||
_numTri = in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips;
|
_numTri = in.NLines+in.NPoints+in.NQuads*2+in.NTriangles+in.NTriangleStrips;
|
||||||
|
|
|
@ -56,6 +56,8 @@ class CSunColorDialog;
|
||||||
class CTuneMRMDialog;
|
class CTuneMRMDialog;
|
||||||
class CTuneTimerDialog;
|
class CTuneTimerDialog;
|
||||||
|
|
||||||
|
class CCameraControl;
|
||||||
|
|
||||||
class CMainWindow : public QMainWindow
|
class CMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -79,9 +81,6 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
void resetScene();
|
void resetScene();
|
||||||
void changeRenderMode();
|
|
||||||
void resetCamera();
|
|
||||||
void changeCameraMode();
|
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
void settings();
|
void settings();
|
||||||
void about();
|
void about();
|
||||||
|
@ -122,6 +121,8 @@ private:
|
||||||
CSkeletonTreeModel *_SkeletonTreeModel;
|
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||||
CTuneTimerDialog *_TuneTimerDialog;
|
CTuneTimerDialog *_TuneTimerDialog;
|
||||||
|
|
||||||
|
CCameraControl *_cameraControl;
|
||||||
|
|
||||||
QPalette _originalPalette;
|
QPalette _originalPalette;
|
||||||
QString _lastDir;
|
QString _lastDir;
|
||||||
|
|
||||||
|
@ -143,7 +144,6 @@ private:
|
||||||
QAction *_frameDelayAction;
|
QAction *_frameDelayAction;
|
||||||
QAction *_lightGroupAction;
|
QAction *_lightGroupAction;
|
||||||
QAction *_reloadTexturesAction;
|
QAction *_reloadTexturesAction;
|
||||||
QAction *_cameraModeAction;
|
|
||||||
QAction *_resetCameraAction;
|
QAction *_resetCameraAction;
|
||||||
QAction *_resetSceneAction;
|
QAction *_resetSceneAction;
|
||||||
QAction *_saveScreenshotAction;
|
QAction *_saveScreenshotAction;
|
||||||
|
|
|
@ -26,7 +26,7 @@ NLQT::CMainWindow *Modules::_mainWindow = NULL;
|
||||||
NLQT::CParticleEditor *Modules::_particleEditor = NULL;
|
NLQT::CParticleEditor *Modules::_particleEditor = NULL;
|
||||||
NLQT::CSoundSystem *Modules::_soundSystem = NULL;
|
NLQT::CSoundSystem *Modules::_soundSystem = NULL;
|
||||||
NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL;
|
NLQT::CVegetableEditor *Modules::_vegetableEditor = NULL;
|
||||||
ExtensionSystem::CPluginManager *Modules::_pluginManager = NULL;
|
ExtensionSystem::CPluginManager *Modules::_pluginManager = NULL;
|
||||||
|
|
||||||
void Modules::init()
|
void Modules::init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,9 +62,9 @@ public:
|
||||||
{
|
{
|
||||||
return *_vegetableEditor;
|
return *_vegetableEditor;
|
||||||
}
|
}
|
||||||
static ExtensionSystem::CPluginManager &plugMan()
|
static ExtensionSystem::CPluginManager &plugMan()
|
||||||
{
|
{
|
||||||
return *_pluginManager;
|
return *_pluginManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -74,7 +74,7 @@ private:
|
||||||
static NLQT::CParticleEditor *_particleEditor;
|
static NLQT::CParticleEditor *_particleEditor;
|
||||||
static NLQT::CSoundSystem *_soundSystem;
|
static NLQT::CSoundSystem *_soundSystem;
|
||||||
static NLQT::CVegetableEditor *_vegetableEditor;
|
static NLQT::CVegetableEditor *_vegetableEditor;
|
||||||
static ExtensionSystem::CPluginManager *_pluginManager;
|
static ExtensionSystem::CPluginManager *_pluginManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULES_H
|
#endif // MODULES_H
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
|
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_Node(ownerNode),
|
_Node(ownerNode),
|
||||||
_CM(cm)
|
_CM(cm)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
|
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_Node(ownerNode),
|
_Node(ownerNode),
|
||||||
_MTP(mtp)
|
_MTP(mtp)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
// STL includes
|
// STL includes
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/common.h>
|
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
#include <nel/misc/file.h>
|
#include <nel/misc/file.h>
|
||||||
#include <nel/misc/bitmap.h>
|
#include <nel/misc/bitmap.h>
|
||||||
|
@ -59,13 +58,13 @@ namespace NLQT
|
||||||
|
|
||||||
CObjectViewer::CObjectViewer()
|
CObjectViewer::CObjectViewer()
|
||||||
: _IDriver(0),
|
: _IDriver(0),
|
||||||
_CScene(0),
|
_CScene(0),
|
||||||
_Driver(0),
|
_Driver(0),
|
||||||
_Scene(0),
|
_Scene(0),
|
||||||
_TextContext(0),
|
_TextContext(0),
|
||||||
_CameraFocal(75),
|
_CameraFocal(75),
|
||||||
_CurrentInstance(""),
|
_CurrentInstance(""),
|
||||||
_BloomEffect(false)
|
_BloomEffect(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,19 +114,11 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
||||||
|
|
||||||
_Scene->enableLightingSystem(true);
|
_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);
|
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
||||||
|
|
||||||
_MouseListener = _Driver->create3dMouseListener();
|
_MouseListener = _Driver->create3dMouseListener();
|
||||||
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
||||||
|
|
||||||
resetCamera();
|
|
||||||
|
|
||||||
// set the cache size for the font manager(in bytes)
|
// set the cache size for the font manager(in bytes)
|
||||||
_Driver->setFontManagerMaxMemory(2097152);
|
_Driver->setFontManagerMaxMemory(2097152);
|
||||||
|
|
||||||
|
@ -184,7 +175,7 @@ void CObjectViewer::release()
|
||||||
void CObjectViewer::updateInput()
|
void CObjectViewer::updateInput()
|
||||||
{
|
{
|
||||||
_Driver->EventServer.pump();
|
_Driver->EventServer.pump();
|
||||||
|
|
||||||
// New matrix from camera
|
// New matrix from camera
|
||||||
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
||||||
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
||||||
|
@ -218,53 +209,38 @@ void CObjectViewer::renderDebug2D()
|
||||||
|
|
||||||
void CObjectViewer::reloadTextures()
|
void CObjectViewer::reloadTextures()
|
||||||
{
|
{
|
||||||
// For each instances
|
// For each instances
|
||||||
std::vector<std::string> listObjects;
|
std::vector<std::string> listObjects;
|
||||||
getListObjects(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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CObjectViewer::resetCamera()
|
for (size_t i = 0; i < listObjects.size(); ++i)
|
||||||
{
|
{
|
||||||
CVector hotSpot = CVector (0,0,0);
|
// Get the shape
|
||||||
float radius=10.f;
|
NL3D::UInstance instance = getEntity(listObjects[i]).getInstance();
|
||||||
|
|
||||||
// Setup camera
|
// For each material
|
||||||
_Scene->getCam().lookAt(hotSpot + CVector(0.57735f, 0.57735f, 0.57735f) * radius, hotSpot);
|
if (!instance.empty())
|
||||||
|
{
|
||||||
// Setup mouse listener
|
uint numMaterial = instance.getNumMaterials();
|
||||||
_MouseListener->setMatrix (_Scene->getCam().getMatrix());
|
uint mat;
|
||||||
_MouseListener->setFrustrum (_Scene->getCam().getFrustum());
|
for (mat = 0; mat < numMaterial; mat++)
|
||||||
_MouseListener->setViewport (CViewport());
|
{
|
||||||
_MouseListener->setHotSpot (hotSpot);
|
// 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)
|
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 we can't create entity, skip it
|
||||||
if (Entity.empty()) return false;
|
if (Entity.empty()) return false;
|
||||||
|
|
||||||
CAABBox bbox;
|
CAABBox bbox;
|
||||||
Entity.getShapeAABBox(bbox);
|
Entity.getShapeAABBox(bbox);
|
||||||
setCamera(bbox , Entity, true);
|
setCamera(bbox , Entity, true);
|
||||||
|
|
||||||
_MouseListener->setMatrix(_Scene->getCam().getMatrix());
|
_MouseListener->setMatrix(_Scene->getCam().getMatrix());
|
||||||
|
|
||||||
USkeleton Skeleton = _Scene->createSkeleton(skelFileName);
|
USkeleton Skeleton = _Scene->createSkeleton(skelFileName);
|
||||||
|
@ -348,57 +324,57 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igName)
|
||||||
{
|
{
|
||||||
CPath::addSearchPath (CFile::getPath(igName));
|
CPath::addSearchPath (CFile::getPath(igName));
|
||||||
UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(igName);
|
UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(igName);
|
||||||
if (ig == 0)
|
if (ig == 0)
|
||||||
return false;
|
return false;
|
||||||
ig->addToScene(*_Scene, _Driver);
|
ig->addToScene(*_Scene, _Driver);
|
||||||
ig->unfreezeHRC();
|
ig->unfreezeHRC();
|
||||||
_ListIG.push_back(ig);
|
_ListIG.push_back(ig);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObjectViewer::setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z)
|
void CObjectViewer::setCamera(NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z)
|
||||||
{
|
{
|
||||||
CVector pos(0.f, 0.f, 0.f);
|
CVector pos(0.f, 0.f, 0.f);
|
||||||
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
CQuat quat(0.f, 0.f, 0.f, 0.f);
|
||||||
NL3D::UInstance inst;
|
NL3D::UInstance inst;
|
||||||
inst.cast(entity);
|
inst.cast(entity);
|
||||||
if (!inst.empty())
|
if (!inst.empty())
|
||||||
{
|
{
|
||||||
inst.getDefaultPos(pos);
|
inst.getDefaultPos(pos);
|
||||||
inst.getDefaultRotQuat(quat);
|
inst.getDefaultRotQuat(quat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix scale (some shapes have a different value)
|
// fix scale (some shapes have a different value)
|
||||||
entity.setScale(1.f, 1.f, 1.f);
|
entity.setScale(1.f, 1.f, 1.f);
|
||||||
UCamera Camera = _Scene->getCam();
|
UCamera Camera = _Scene->getCam();
|
||||||
CVector max_radius = bbox.getHalfSize();
|
CVector max_radius = bbox.getHalfSize();
|
||||||
CVector center = bbox.getCenter();
|
CVector center = bbox.getCenter();
|
||||||
entity.setPivot(center);
|
entity.setPivot(center);
|
||||||
center += pos;
|
center += pos;
|
||||||
float fov = float(_CameraFocal * (float)Pi/180.0);
|
float fov = float(_CameraFocal * (float)Pi/180.0);
|
||||||
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
float radius = max(max(max_radius.x, max_radius.y), max_radius.z);
|
||||||
if (radius == 0.f) radius = 1.f;
|
if (radius == 0.f) radius = 1.f;
|
||||||
float left, right, bottom, top, znear, zfar;
|
float left, right, bottom, top, znear, zfar;
|
||||||
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
Camera.getFrustum(left, right, bottom, top, znear, zfar);
|
||||||
float dist = radius / (tan(fov/2));
|
float dist = radius / (tan(fov/2));
|
||||||
CVector eye(center);
|
CVector eye(center);
|
||||||
|
|
||||||
CVector ax(quat.getAxis());
|
CVector ax(quat.getAxis());
|
||||||
|
|
||||||
if (ax.isNull() || ax == CVector::I)
|
if (ax.isNull() || ax == CVector::I)
|
||||||
{
|
{
|
||||||
ax = CVector::J;
|
ax = CVector::J;
|
||||||
}
|
}
|
||||||
else if (ax == -CVector::K)
|
else if (ax == -CVector::K)
|
||||||
{
|
{
|
||||||
ax = -CVector::J;
|
ax = -CVector::J;
|
||||||
}
|
}
|
||||||
|
|
||||||
eye -= ax * (dist+radius);
|
eye -= ax * (dist+radius);
|
||||||
if (high_z)
|
if (high_z)
|
||||||
eye.z += max_radius.z/1.0f;
|
eye.z += max_radius.z/1.0f;
|
||||||
get3dMouseListener()->setHotSpot(center);
|
get3dMouseListener()->setHotSpot(center);
|
||||||
Camera.lookAt(eye, center);
|
Camera.lookAt(eye, center);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObjectViewer::resetScene()
|
void CObjectViewer::resetScene()
|
||||||
|
|
|
@ -100,8 +100,6 @@ public:
|
||||||
|
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|
||||||
void resetCamera();
|
|
||||||
|
|
||||||
/// Make a screenshot of the current scene and save.
|
/// Make a screenshot of the current scene and save.
|
||||||
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
|
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
|
||||||
|
|
||||||
|
@ -188,19 +186,19 @@ public:
|
||||||
{
|
{
|
||||||
return _Driver;
|
return _Driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
NL3D::IDriver *getIDriver() const
|
NL3D::IDriver *getIDriver() const
|
||||||
{
|
{
|
||||||
return _IDriver;
|
return _IDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a game interface for scene.
|
/// Get a game interface for scene.
|
||||||
/// @return pointer to the scene.
|
/// @return pointer to the scene.
|
||||||
inline NL3D::UScene *getScene() const
|
inline NL3D::UScene *getScene() const
|
||||||
{
|
{
|
||||||
return _Scene;
|
return _Scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
NL3D::CScene *getCScene() const
|
NL3D::CScene *getCScene() const
|
||||||
{
|
{
|
||||||
return _CScene;
|
return _CScene;
|
||||||
|
|
|
@ -36,8 +36,13 @@
|
||||||
<file>images/save-as.png</file>
|
<file>images/save-as.png</file>
|
||||||
<file>images/save.png</file>
|
<file>images/save.png</file>
|
||||||
<file>images/insert-horizontal.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/Emitter.bmp</file>
|
||||||
<file>images/Force.bmp</file>
|
<file>images/Force.bmp</file>
|
||||||
|
|
||||||
|
|
|
@ -35,18 +35,18 @@ namespace NLQT
|
||||||
|
|
||||||
CParticleEditor::CParticleEditor(void)
|
CParticleEditor::CParticleEditor(void)
|
||||||
: _ActiveNode(NULL),
|
: _ActiveNode(NULL),
|
||||||
_State(State::Stopped),
|
_State(State::Stopped),
|
||||||
_Speed(1.0f),
|
_Speed(1.0f),
|
||||||
_AutoRepeat(false),
|
_AutoRepeat(false),
|
||||||
_DisplayBBox(false),
|
_DisplayBBox(false),
|
||||||
_DisplayHelpers(false),
|
_DisplayHelpers(false),
|
||||||
_AutoUpdateBBox(false),
|
_AutoUpdateBBox(false),
|
||||||
_EmptyBBox(true),
|
_EmptyBBox(true),
|
||||||
_PW(NULL),
|
_PW(NULL),
|
||||||
_Driver(NULL),
|
_Driver(NULL),
|
||||||
_Scene(NULL),
|
_Scene(NULL),
|
||||||
_FontManager(NULL),
|
_FontManager(NULL),
|
||||||
_FontGen(NULL)
|
_FontGen(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ void CWorkspaceNode::memorizeState()
|
||||||
void CWorkspaceNode::restoreState()
|
void CWorkspaceNode::restoreState()
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
if (!_PS)
|
if (!_PS)
|
||||||
return;
|
return;
|
||||||
_InitialPos.restoreSystem();
|
_InitialPos.restoreSystem();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
||||||
const std::string &parentBoneName)
|
const std::string &parentBoneName)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
if (!_PSM)
|
if (!_PSM)
|
||||||
return;
|
return;
|
||||||
unstickPSFromSkeleton();
|
unstickPSFromSkeleton();
|
||||||
_ParentSkelName = parentSkelName;
|
_ParentSkelName = parentSkelName;
|
||||||
|
@ -293,7 +293,7 @@ bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
|
||||||
if (oldSB)
|
if (oldSB)
|
||||||
{
|
{
|
||||||
Modules::psEdit().getScene()->setShapeBank(oldSB);
|
Modules::psEdit().getScene()->setShapeBank(oldSB);
|
||||||
}
|
}
|
||||||
setup(*psm);
|
setup(*psm);
|
||||||
unload();
|
unload();
|
||||||
// commit new values
|
// commit new values
|
||||||
|
|
|
@ -126,7 +126,7 @@ bool CParticleTreeItem::replace(const QList<QVariant> &data)
|
||||||
|
|
||||||
bool CParticleTreeItem::deleteChild(int row)
|
bool CParticleTreeItem::deleteChild(int row)
|
||||||
{
|
{
|
||||||
_childItems.removeAt(row);
|
delete _childItems.takeAt(row);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ static std::map<std::string, uint> _PSElementIdentifiers;
|
||||||
|
|
||||||
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
: QDockWidget(parent),
|
: QDockWidget(parent),
|
||||||
_currentItem(NULL)
|
_currentItem(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace NLQT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CWorkspacePage
|
@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)
|
create/insert/remove all particles system to workspace)
|
||||||
*/
|
*/
|
||||||
class CWorkspacePage: public QWidget
|
class CWorkspacePage: public QWidget
|
||||||
|
|
|
@ -12,7 +12,6 @@ SET(OVQT_CORE_PLUGIN_HDR
|
||||||
core_plugin.h
|
core_plugin.h
|
||||||
main_window.h
|
main_window.h
|
||||||
settings_dialog.h
|
settings_dialog.h
|
||||||
qnel_widget.h
|
|
||||||
search_paths_settings_page.h
|
search_paths_settings_page.h
|
||||||
plugin_view_dialog.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})
|
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})
|
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc ${QT_LIBRARIES})
|
||||||
|
|
||||||
IF(WITH_STLPORT)
|
|
||||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
ENDIF(WITH_STLPORT)
|
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core")
|
NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core")
|
||||||
NL_ADD_RUNTIME_FLAGS(ovqt_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
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
#include "core_plugin.h"
|
#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 <QtCore/QObject>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
|
@ -24,55 +34,70 @@
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QMenuBar>
|
#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;
|
using namespace Core;
|
||||||
|
|
||||||
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
// for old ovqt
|
oldOVQT = false;
|
||||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
|
||||||
if (!wnd)
|
|
||||||
{
|
|
||||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//_mainWindow = new CMainWindow(_plugMan);
|
_plugMan->addObject(new CSearchPathsSettingsPage(this));
|
||||||
//_mainWindow->show();
|
|
||||||
_plugMan->addObject(new CSearchPathsSettingsPage(wnd));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CorePlugin::extensionsInitialized()
|
void CorePlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
// for old ovqt
|
|
||||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||||
|
|
||||||
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
// for old ovqt
|
||||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||||
nlassert(toolsMenu);
|
if (wnd)
|
||||||
nlassert(helpMenu);
|
{
|
||||||
|
_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 *newAction = toolsMenu->addAction(tr("New settings"));
|
||||||
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
QAction *newAction2 = helpMenu->addAction(tr("About plugins"));
|
||||||
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
newAction->setIcon(QIcon(Constants::ICON_SETTINGS));
|
||||||
|
|
||||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||||
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
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()
|
void CorePlugin::shutdown()
|
||||||
{
|
{
|
||||||
//delete _mainWindow;
|
if (!oldOVQT)
|
||||||
delete _pluginView;
|
{
|
||||||
|
delete _mainWindow;
|
||||||
|
delete _pluginView;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CorePlugin::execSettings()
|
void CorePlugin::execSettings()
|
||||||
|
|
|
@ -58,6 +58,24 @@ public:
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
QObject *objectByName(const QString &name) const;
|
||||||
ExtensionSystem::IPluginSpec *pluginByName(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:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
@ -69,6 +87,8 @@ private:
|
||||||
ExtensionSystem::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *_plugMan;
|
||||||
ExtensionSystem::CPluginView *_pluginView;
|
ExtensionSystem::CPluginView *_pluginView;
|
||||||
CMainWindow *_mainWindow;
|
CMainWindow *_mainWindow;
|
||||||
|
|
||||||
|
bool oldOVQT;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // 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
|
@details You need to subclass this interface and put an instance of your subclass
|
||||||
into the plugin manager object pool.
|
into the plugin manager object pool.
|
||||||
*/
|
*/
|
||||||
class IOptionsPage
|
class IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IOptionsPage() {}
|
virtual ~IOptionsPage() {}
|
||||||
|
@ -63,4 +63,4 @@ public:
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(Core::IOptionsPage, "dev.ryzom.com.IOptionsPage/1.0")
|
Q_DECLARE_INTERFACE(Core::IOptionsPage, "dev.ryzom.com.IOptionsPage/1.0")
|
||||||
|
|
||||||
#endif // IOPTIONSPAGE_H
|
#endif // IOPTIONS_PAGE_H
|
||||||
|
|
|
@ -17,43 +17,40 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "main_window.h"
|
#include "main_window.h"
|
||||||
|
#include "core_plugin.h"
|
||||||
|
#include "iapp_page.h"
|
||||||
|
#include "icore_listener.h"
|
||||||
#include "core_constants.h"
|
#include "core_constants.h"
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
|
||||||
CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent)
|
CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
_lastDir(".")
|
_lastDir(".")
|
||||||
{
|
{
|
||||||
_pluginManager = pluginManager;
|
_corePlugin = corePlugin;
|
||||||
|
_pluginManager = _corePlugin->pluginManager();
|
||||||
|
_settings = _pluginManager->settings();
|
||||||
|
|
||||||
setObjectName(Constants::MAIN_WINDOW);
|
setObjectName(Constants::MAIN_WINDOW);
|
||||||
|
|
||||||
_tabWidget = new QTabWidget(this);
|
_tabWidget = new QTabWidget(this);
|
||||||
|
_tabWidget->setTabPosition(QTabWidget::South);
|
||||||
setCentralWidget(_tabWidget);
|
setCentralWidget(_tabWidget);
|
||||||
|
|
||||||
QWidget *qwidg1 = new QWidget(_tabWidget);
|
QList<IAppPage *> listAppPages = _corePlugin->getObjects<IAppPage>();
|
||||||
QWidget *qwidg2 = new QWidget(_tabWidget);
|
|
||||||
|
|
||||||
_tabWidget->addTab(qwidg1, "tab1");
|
Q_FOREACH(IAppPage *appPage, listAppPages)
|
||||||
_tabWidget->addTab(qwidg2, "tab2");
|
{
|
||||||
|
addAppPage(appPage);
|
||||||
|
}
|
||||||
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);
|
|
||||||
|
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
@ -64,8 +61,12 @@ CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget
|
||||||
createMenus();
|
createMenus();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
|
||||||
|
readSettings();
|
||||||
|
|
||||||
setWindowIcon(QIcon(Constants::ICON_NEL));
|
setWindowIcon(QIcon(Constants::ICON_NEL));
|
||||||
setWindowTitle(tr("Object Viewer Qt"));
|
setWindowTitle(tr("Object Viewer Qt"));
|
||||||
|
|
||||||
|
connect(_pluginManager, SIGNAL(objectAdded(QObject *)), this, SLOT(checkObject(QObject *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainWindow::~CMainWindow()
|
CMainWindow::~CMainWindow()
|
||||||
|
@ -73,6 +74,13 @@ CMainWindow::~CMainWindow()
|
||||||
delete _pluginView;
|
delete _pluginView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainWindow::checkObject(QObject *obj)
|
||||||
|
{
|
||||||
|
IAppPage *appPage = qobject_cast<IAppPage *>(obj);
|
||||||
|
if (appPage)
|
||||||
|
addAppPage(appPage);
|
||||||
|
}
|
||||||
|
|
||||||
bool CMainWindow::showOptionsDialog(const QString &group,
|
bool CMainWindow::showOptionsDialog(const QString &group,
|
||||||
const QString &page,
|
const QString &page,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
|
@ -91,6 +99,33 @@ void CMainWindow::about()
|
||||||
"<p> Author: dnk-88 <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
"<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()
|
void CMainWindow::createActions()
|
||||||
{
|
{
|
||||||
_openAction = new QAction(tr("&Open..."), this);
|
_openAction = new QAction(tr("&Open..."), this);
|
||||||
|
@ -150,12 +185,6 @@ void CMainWindow::createMenus()
|
||||||
_helpMenu->addAction(_aboutAction);
|
_helpMenu->addAction(_aboutAction);
|
||||||
_helpMenu->addAction(_aboutQtAction);
|
_helpMenu->addAction(_aboutQtAction);
|
||||||
_helpMenu->addAction(_pluginViewAction);
|
_helpMenu->addAction(_pluginViewAction);
|
||||||
|
|
||||||
_pluginManager->addObject(_fileMenu);
|
|
||||||
_pluginManager->addObject(_editMenu);
|
|
||||||
_pluginManager->addObject(_viewMenu);
|
|
||||||
_pluginManager->addObject(_toolsMenu);
|
|
||||||
_pluginManager->addObject(_helpMenu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::createStatusBar()
|
void CMainWindow::createStatusBar()
|
||||||
|
@ -168,6 +197,22 @@ void CMainWindow::createDialogs()
|
||||||
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
_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 */
|
} /* namespace Core */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|
|
@ -18,48 +18,53 @@
|
||||||
#ifndef MAIN_WINDOW_H
|
#ifndef MAIN_WINDOW_H
|
||||||
#define MAIN_WINDOW_H
|
#define MAIN_WINDOW_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "plugin_view_dialog.h"
|
||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "qnel_widget.h"
|
|
||||||
#include "../../extension_system/iplugin.h"
|
|
||||||
#include "plugin_view_dialog.h"
|
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
class CSettingsDialog;
|
class CSettingsDialog;
|
||||||
|
class CorePlugin;
|
||||||
|
class IAppPage;
|
||||||
|
|
||||||
class CMainWindow : public QMainWindow
|
class CMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0);
|
CMainWindow(CorePlugin *corePlugin, QWidget *parent = 0);
|
||||||
~CMainWindow();
|
~CMainWindow();
|
||||||
|
|
||||||
inline QSettings *settings() const
|
|
||||||
{
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void checkObject(QObject *obj);
|
||||||
bool showOptionsDialog(const QString &group = QString(),
|
bool showOptionsDialog(const QString &group = QString(),
|
||||||
const QString &page = QString(),
|
const QString &page = QString(),
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
void about();
|
void about();
|
||||||
|
protected:
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addAppPage(IAppPage *appPage);
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createDialogs();
|
void createDialogs();
|
||||||
|
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
ExtensionSystem::IPluginManager *_pluginManager;
|
ExtensionSystem::IPluginManager *_pluginManager;
|
||||||
ExtensionSystem::CPluginView *_pluginView;
|
ExtensionSystem::CPluginView *_pluginView;
|
||||||
|
CorePlugin *_corePlugin;
|
||||||
|
|
||||||
QPalette _originalPalette;
|
QPalette _originalPalette;
|
||||||
QString _lastDir;
|
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
|
||||||
*/
|
*/
|
||||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(Core::IOptionsPage)
|
Q_INTERFACES(Core::IOptionsPage)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>9</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="searchPathsGroupBox">
|
<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)
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||||
|
|
||||||
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h
|
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h
|
||||||
|
qnel_widget.h
|
||||||
|
simple_viewer.h
|
||||||
example_settings_page.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)
|
${CMAKE_CURRENT_SOURCE_DIR}/../core/ioptions_page.h)
|
||||||
|
|
||||||
SET(OVQT_PLUG_EXAMPLE_UIS example_settings_page.ui)
|
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})
|
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})
|
TARGET_LINK_LIBRARIES(ovqt_plugin_example nelmisc nel3d ${QT_LIBRARIES})
|
||||||
|
|
||||||
IF(WITH_STLPORT)
|
|
||||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
ENDIF(WITH_STLPORT)
|
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ovqt_plugin_example "NeL, Tools, 3D: Object Viewer Qt Plugin: Example")
|
NL_DEFAULT_PROPS(ovqt_plugin_example "NeL, Tools, 3D: Object Viewer Qt Plugin: Example")
|
||||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_example)
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_example)
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
|
@ -1,59 +1,37 @@
|
||||||
#include "plugin1.h"
|
// Project includes
|
||||||
|
#include "plugin1.h"
|
||||||
#include <QtCore/QObject>
|
#include "example_settings_page.h"
|
||||||
#include <QtGui/QMessageBox>
|
#include "simple_viewer.h"
|
||||||
#include <QtGui/QMainWindow>
|
#include "../core/iapp_page.h"
|
||||||
#include <QtGui/QMenu>
|
#include "../../extension_system/iplugin_spec.h"
|
||||||
#include <QtGui/QAction>
|
|
||||||
#include <QtGui/QMenuBar>
|
// NeL includes
|
||||||
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
#include "../../extension_system/iplugin_spec.h"
|
// Qt includes
|
||||||
#include "example_settings_page.h"
|
#include <QtCore/QObject>
|
||||||
#include "nel/misc/debug.h"
|
#include <QtGui/QMessageBox>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
using namespace Plugin;
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QMenuBar>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
_plugMan = pluginManager;
|
||||||
|
|
||||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
_plugMan->addObject(new CExampleSettingsPage(this));
|
||||||
_plugMan->addObject(new CExampleSettingsPage(wnd));
|
_plugMan->addObject(new CExampleAppPage(this));
|
||||||
if (!wnd)
|
_plugMan->addObject(new CCoreListener(this));
|
||||||
{
|
|
||||||
*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;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPlugin::extensionsInitialized()
|
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)
|
void MyPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
|
@ -81,30 +59,32 @@ QString MyPlugin::vendor() const
|
||||||
return "dnk-88";
|
return "dnk-88";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MyPlugin::description() const
|
QString MyPlugin::description() const
|
||||||
{
|
{
|
||||||
return "Example ovqt plugin.";
|
return "Example ovqt plugin.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> MyPlugin::dependencies() const
|
QList<QString> MyPlugin::dependencies() const
|
||||||
{
|
{
|
||||||
return QList<QString>();
|
return QList<QString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* MyPlugin::objectByName(const QString &name) const
|
QObject* MyPlugin::objectByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
||||||
if (qobj->objectName() == name)
|
if (qobj->objectName() == name)
|
||||||
return qobj;
|
return qobj;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||||
if (spec->name() == name)
|
if (spec->name() == name)
|
||||||
return spec;
|
return spec;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(MyPlugin)
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN(Plugin::MyPlugin)
|
|
@ -1,11 +1,17 @@
|
||||||
#ifndef PLUGIN1_H
|
#ifndef PLUGIN1_H
|
||||||
#define PLUGIN1_H
|
#define PLUGIN1_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
#include "../../extension_system/iplugin.h"
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "simple_viewer.h"
|
||||||
|
#include "../core/iapp_page.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
#include "nel/misc/app_context.h"
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
|
@ -17,7 +23,7 @@ namespace ExtensionSystem
|
||||||
class IPluginSpec;
|
class IPluginSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
class MyPlugin : public QObject, public ExtensionSystem::IPlugin
|
class MyPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
|
@ -31,26 +37,49 @@ public:
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString version() const;
|
QString version() const;
|
||||||
QString vendor() const;
|
QString vendor() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
QList<QString> dependencies() const;
|
QList<QString> dependencies() const;
|
||||||
|
|
||||||
QObject *objectByName(const QString &name) const;
|
QObject *objectByName(const QString &name) const;
|
||||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
protected:
|
||||||
void execMessageBox();
|
NLMISC::CLibraryContext *_LibContext;
|
||||||
|
|
||||||
protected:
|
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExtensionSystem::IPluginManager *_plugMan;
|
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
|
} // namespace Plugin
|
||||||
|
|
||||||
#endif // PLUGIN1_H
|
#endif // PLUGIN1_H
|
||||||
|
|
|
@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent)
|
||||||
_initialized(false),
|
_initialized(false),
|
||||||
_interval(25)
|
_interval(25)
|
||||||
{
|
{
|
||||||
|
setMouseTracking(true);
|
||||||
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
_mainTimer = new QTimer(this);
|
_mainTimer = new QTimer(this);
|
||||||
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
||||||
|
@ -55,8 +58,7 @@ void QNLWidget::init()
|
||||||
nlassert(_driver);
|
nlassert(_driver);
|
||||||
|
|
||||||
// initialize the nel 3d viewport
|
// initialize the nel 3d viewport
|
||||||
_driver->setDisplay((nlWindow)winId(),
|
_driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
|
||||||
NL3D::UDriver::CMode(width(), height(), 32));
|
|
||||||
|
|
||||||
// set the cache size for the font manager(in bytes)
|
// set the cache size for the font manager(in bytes)
|
||||||
_driver->setFontManagerMaxMemory(2097152);
|
_driver->setFontManagerMaxMemory(2097152);
|
||||||
|
@ -111,39 +113,6 @@ void QNLWidget::showEvent(QShowEvent *showEvent)
|
||||||
_mainTimer->stop();
|
_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)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
@ -65,10 +65,6 @@ private Q_SLOTS:
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *showEvent);
|
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)
|
#if defined(NL_OS_WINDOWS)
|
||||||
virtual bool winEvent(MSG *message, long *result);
|
virtual bool winEvent(MSG *message, long *result);
|
||||||
#elif defined(NL_OS_MAC)
|
#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})
|
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_DEFAULT_PROPS(ovqt_plugin_log "NeL, Tools, 3D: Object Viewer Qt Plugin: Log")
|
||||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_log)
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_log)
|
||||||
NL_ADD_LIB_SUFFIX(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})
|
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_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_RUNTIME_FLAGS(ovqt_plugin_sheet_builder)
|
||||||
NL_ADD_LIB_SUFFIX(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.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
||||||
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
||||||
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
||||||
|
|
||||||
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
||||||
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
||||||
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
||||||
|
@ -341,9 +341,9 @@ void CSettingsDialog::saveGraphicsSettings()
|
||||||
|
|
||||||
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
|
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
|
||||||
|
|
||||||
if (ui.paletteCheckBox->isChecked())
|
if (ui.paletteCheckBox->isChecked())
|
||||||
QApplication::setPalette(QApplication::style()->standardPalette());
|
QApplication::setPalette(QApplication::style()->standardPalette());
|
||||||
else
|
else
|
||||||
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
|
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ void CSettingsDialog::saveVegetableSettings()
|
||||||
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
|
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
|
||||||
list.push_back(str);
|
list.push_back(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
|
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
|
||||||
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
|
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace NLQT
|
||||||
|
|
||||||
CSlotGroupBox::CSlotGroupBox(QWidget *parent)
|
CSlotGroupBox::CSlotGroupBox(QWidget *parent)
|
||||||
: QGroupBox(parent),
|
: QGroupBox(parent),
|
||||||
_animName("empty"),
|
_animName("empty"),
|
||||||
_skelName("empty"),
|
_skelName("empty"),
|
||||||
_numSlot(0)
|
_numSlot(0)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ namespace NLQT
|
||||||
|
|
||||||
CSoundSystem::CSoundSystem()
|
CSoundSystem::CSoundSystem()
|
||||||
:_AudioMixer(NULL),
|
:_AudioMixer(NULL),
|
||||||
_AnimManager(NULL),
|
_AnimManager(NULL),
|
||||||
_Zero(NLMISC::CVector::Null)
|
_Zero(NLMISC::CVector::Null)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace NLQT
|
||||||
|
|
||||||
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
|
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
_Node(ownerNode),
|
_Node(ownerNode),
|
||||||
_BasicSpinner(sf)
|
_BasicSpinner(sf)
|
||||||
{
|
{
|
||||||
nlassert(_BasicSpinner);
|
nlassert(_BasicSpinner);
|
||||||
|
|
||||||
|
|
|
@ -126,15 +126,15 @@ void CTailParticleWidget::setRibbonOrientation(int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
bool CTailParticleWidget::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
if( event->type() == QEvent::Paint )
|
if( event->type() == QEvent::Paint )
|
||||||
{
|
{
|
||||||
QPainter painter(_ui.graphicsWidget);
|
QPainter painter(_ui.graphicsWidget);
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setBrush(QBrush(Qt::white));
|
painter.setBrush(QBrush(Qt::white));
|
||||||
painter.setPen(QPen(Qt::black, 2, Qt::SolidLine));
|
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.setPen(QPen(Qt::red, 2, Qt::SolidLine));
|
||||||
painter.scale(0.86, 0.86);
|
painter.scale(0.86, 0.86);
|
||||||
painter.translate(6, 6);
|
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->height() / 2.0) * (1 - verts[0].y)),
|
||||||
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
|
int((_ui.graphicsWidget->width() / 2.0) * (1 + verts[verts.size() - 1].x)),
|
||||||
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
|
int((_ui.graphicsWidget->height() / 2.0) * (1 - verts[verts.size() - 1].y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QWidget::eventFilter(object, event);
|
return QWidget::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <nel/3d/u_scene.h>
|
#include <nel/3d/u_scene.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
const int sliderStepSize = 5000;
|
const int sliderStepSize = 5000;
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ CTuneMRMDialog::~CTuneMRMDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTuneMRMDialog::setMaxValue(int value)
|
void CTuneMRMDialog::setMaxValue(int value)
|
||||||
{
|
{
|
||||||
int actualMaxValue = value * sliderStepSize;
|
int actualMaxValue = value * sliderStepSize;
|
||||||
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
|
int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum();
|
||||||
|
|
||||||
_ui.currentValueSlider->setMaximum(actualMaxValue);
|
_ui.currentValueSlider->setMaximum(actualMaxValue);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CTuneTimerDialog: public QDockWidget
|
||||||
public:
|
public:
|
||||||
CTuneTimerDialog(QWidget *parent = 0);
|
CTuneTimerDialog(QWidget *parent = 0);
|
||||||
~CTuneTimerDialog();
|
~CTuneTimerDialog();
|
||||||
|
|
||||||
void setInterval(int value);
|
void setInterval(int value);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QSlider" name="horizontalSlider">
|
<widget class="QSlider" name="horizontalSlider">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>1000</number>
|
<number>500</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<enum>QSlider::TicksAbove</enum>
|
<enum>QSlider::TicksAbove</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="tickInterval">
|
<property name="tickInterval">
|
||||||
<number>100</number>
|
<number>50</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -96,6 +96,8 @@ template <typename T>
|
||||||
class CValueBlenderDialogClientT : public IValueBlenderDialogClient
|
class CValueBlenderDialogClientT : public IValueBlenderDialogClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~CValueBlenderDialogClientT() {}
|
||||||
|
|
||||||
// the scheme being used. Must be set by the user
|
// the scheme being used. Must be set by the user
|
||||||
NL3D::CPSValueBlendFuncBase<T> *SchemeFunc;
|
NL3D::CPSValueBlendFuncBase<T> *SchemeFunc;
|
||||||
|
|
||||||
|
@ -143,6 +145,8 @@ protected:
|
||||||
class CFloatBlenderDialogClient : public CValueBlenderDialogClientT<float>
|
class CFloatBlenderDialogClient : public CValueBlenderDialogClientT<float>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~CFloatBlenderDialogClient() {}
|
||||||
|
|
||||||
QWidget *newDialog(IPSWrapper<float> *wrapper, QWidget *parent)
|
QWidget *newDialog(IPSWrapper<float> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
CEditRangeFloatWidget *erf = new CEditRangeFloatWidget(parent);
|
CEditRangeFloatWidget *erf = new CEditRangeFloatWidget(parent);
|
||||||
|
@ -158,6 +162,8 @@ public:
|
||||||
class CUIntBlenderDialogClient : public CValueBlenderDialogClientT<uint32>
|
class CUIntBlenderDialogClient : public CValueBlenderDialogClientT<uint32>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~CUIntBlenderDialogClient() {}
|
||||||
|
|
||||||
QWidget *newDialog(IPSWrapper<uint32> *wrapper, QWidget *parent)
|
QWidget *newDialog(IPSWrapper<uint32> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
CEditRangeUIntWidget *erf = new CEditRangeUIntWidget(parent);
|
CEditRangeUIntWidget *erf = new CEditRangeUIntWidget(parent);
|
||||||
|
@ -173,6 +179,8 @@ public:
|
||||||
class CIntBlenderDialogClient : public CValueBlenderDialogClientT<sint32>
|
class CIntBlenderDialogClient : public CValueBlenderDialogClientT<sint32>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~CIntBlenderDialogClient() {}
|
||||||
|
|
||||||
QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
CEditRangeIntWidget *erf = new CEditRangeIntWidget(parent);
|
CEditRangeIntWidget *erf = new CEditRangeIntWidget(parent);
|
||||||
|
@ -188,6 +196,8 @@ public:
|
||||||
class CRGBABlenderDialogClient : public CValueBlenderDialogClientT<NLMISC::CRGBA>
|
class CRGBABlenderDialogClient : public CValueBlenderDialogClientT<NLMISC::CRGBA>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~CRGBABlenderDialogClient() {}
|
||||||
|
|
||||||
QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
CColorEditWidget *ce = new CColorEditWidget(parent);
|
CColorEditWidget *ce = new CColorEditWidget(parent);
|
||||||
|
|
|
@ -59,6 +59,7 @@ class IValueGradientClient: public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IValueGradientClient(QObject *parent = 0): QObject(parent) {}
|
IValueGradientClient(QObject *parent = 0): QObject(parent) {}
|
||||||
|
virtual ~IValueGradientClient() {}
|
||||||
|
|
||||||
virtual QWidget *createDialog(QWidget *parent) = 0;
|
virtual QWidget *createDialog(QWidget *parent) = 0;
|
||||||
|
|
||||||
|
@ -168,6 +169,7 @@ class CValueGradientClientT : public IValueGradientClient, public IPSWrapper<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CValueGradientClientT(QObject *parent = 0): IValueGradientClient(parent) {}
|
CValueGradientClientT(QObject *parent = 0): IValueGradientClient(parent) {}
|
||||||
|
virtual ~CValueGradientClientT() {}
|
||||||
|
|
||||||
/// the gradient being edited, must be filled by the instancier
|
/// the gradient being edited, must be filled by the instancier
|
||||||
NL3D::CPSValueGradientFunc<T> *Scheme;
|
NL3D::CPSValueGradientFunc<T> *Scheme;
|
||||||
|
@ -268,6 +270,7 @@ class CFloatGradientWrapper : public CValueGradientClientT<float>
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CFloatGradientWrapper(QObject *parent = 0): CValueGradientClientT<float>(parent) {}
|
CFloatGradientWrapper(QObject *parent = 0): CValueGradientClientT<float>(parent) {}
|
||||||
|
~CFloatGradientWrapper() {}
|
||||||
|
|
||||||
virtual QWidget *newDialog(IPSWrapperFloat *wrapper, QWidget *parent)
|
virtual QWidget *newDialog(IPSWrapperFloat *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
|
@ -304,6 +307,7 @@ class CUIntGradientWrapper : public CValueGradientClientT<uint32>
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CUIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<uint32>(parent) {}
|
CUIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<uint32>(parent) {}
|
||||||
|
~CUIntGradientWrapper() {}
|
||||||
|
|
||||||
virtual QWidget *newDialog(IPSWrapperUInt *wrapper, QWidget *parent)
|
virtual QWidget *newDialog(IPSWrapperUInt *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +344,7 @@ class CIntGradientWrapper : public CValueGradientClientT<sint32>
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<sint32>(parent) {}
|
CIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<sint32>(parent) {}
|
||||||
|
~CIntGradientWrapper() {}
|
||||||
|
|
||||||
virtual QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
virtual QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
|
@ -376,6 +381,7 @@ class CColorGradientWrapper : public CValueGradientClientT<NLMISC::CRGBA>
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CColorGradientWrapper(QObject *parent = 0): CValueGradientClientT<NLMISC::CRGBA>(parent) {}
|
CColorGradientWrapper(QObject *parent = 0): CValueGradientClientT<NLMISC::CRGBA>(parent) {}
|
||||||
|
~CColorGradientWrapper() {}
|
||||||
|
|
||||||
virtual QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
virtual QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||||
{
|
{
|
||||||
|
@ -418,6 +424,7 @@ class CPlaneBasisGradientWrapper : public CValueGradientClientT<NL3D::CPlaneBasi
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CPlaneBasisGradientWrapper(QObject *parent = 0): CValueGradientClientT<NL3D::CPlaneBasis>(parent) {}
|
CPlaneBasisGradientWrapper(QObject *parent = 0): CValueGradientClientT<NL3D::CPlaneBasis>(parent) {}
|
||||||
|
~CPlaneBasisGradientWrapper() {}
|
||||||
|
|
||||||
virtual QWidget *newDialog(IPSWrapper<NL3D::CPlaneBasis> *wrapper, QWidget *parent)
|
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(NL3D::CPSTexturedParticle *tp, CWorkspaceNode *ownerNode): Node(ownerNode), TP(tp) {}
|
||||||
|
|
||||||
|
~CTextureGradientInterface() {}
|
||||||
|
|
||||||
CWorkspaceNode *Node;
|
CWorkspaceNode *Node;
|
||||||
NL3D::CPSTexturedParticle *TP;
|
NL3D::CPSTexturedParticle *TP;
|
||||||
|
|
||||||
|
|
|
@ -315,30 +315,30 @@ void CVegetableEditor::setVegetableWindPower(float w)
|
||||||
{
|
{
|
||||||
_VegetableWindPower= w;
|
_VegetableWindPower= w;
|
||||||
if(_VegetableLandscape)
|
if(_VegetableLandscape)
|
||||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||||
_VegetableWindFreq,
|
_VegetableWindFreq,
|
||||||
_VegetableWindPower,
|
_VegetableWindPower,
|
||||||
_VegetableWindBendMin);
|
_VegetableWindBendMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVegetableEditor::setVegetableWindBendStart(float w)
|
void CVegetableEditor::setVegetableWindBendStart(float w)
|
||||||
{
|
{
|
||||||
_VegetableWindBendMin= w;
|
_VegetableWindBendMin= w;
|
||||||
if(_VegetableLandscape)
|
if(_VegetableLandscape)
|
||||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||||
_VegetableWindFreq,
|
_VegetableWindFreq,
|
||||||
_VegetableWindPower,
|
_VegetableWindPower,
|
||||||
_VegetableWindBendMin);
|
_VegetableWindBendMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVegetableEditor::setVegetableWindFrequency(float w)
|
void CVegetableEditor::setVegetableWindFrequency(float w)
|
||||||
{
|
{
|
||||||
_VegetableWindFreq= w;
|
_VegetableWindFreq= w;
|
||||||
if(_VegetableLandscape)
|
if(_VegetableLandscape)
|
||||||
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
|
||||||
_VegetableWindFreq,
|
_VegetableWindFreq,
|
||||||
_VegetableWindPower,
|
_VegetableWindPower,
|
||||||
_VegetableWindBendMin);
|
_VegetableWindBendMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)
|
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
|
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
|
||||||
: QGroupBox(parent),
|
: QGroupBox(parent),
|
||||||
_emit(true)
|
_emit(true)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
|
void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
|
||||||
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
|
void setDefaultRangeRand(float defRangeMin, float defRangeMax);
|
||||||
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
|
void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void noiseValueChanged(const NLMISC::CNoiseValue &value);
|
void noiseValueChanged(const NLMISC::CNoiseValue &value);
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,6 @@ TARGET_LINK_LIBRARIES(object_viewer_widget_qt
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${QT_QTOPENGL_LIBRARY})
|
${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_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
|
||||||
ADD_DEFINITIONS(-DQT_PLUGIN)
|
ADD_DEFINITIONS(-DQT_PLUGIN)
|
||||||
ADD_DEFINITIONS(-DQT_SHARED)
|
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})
|
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})
|
TARGET_LINK_LIBRARIES(ryzom_gameshare nelmisc nelnet nelligo nelgeorges ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||||
NL_DEFAULT_PROPS(ryzom_gameshare "Ryzom, Library: Game Share")
|
NL_DEFAULT_PROPS(ryzom_gameshare "Ryzom, Library: Game Share")
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameshare)
|
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})
|
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)
|
TARGET_LINK_LIBRARIES(ryzom_adminmodules nelmisc nelnet)
|
||||||
NL_DEFAULT_PROPS(ryzom_adminmodules "Ryzom, Library: Service Admin Modules")
|
NL_DEFAULT_PROPS(ryzom_adminmodules "Ryzom, Library: Service Admin Modules")
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_adminmodules)
|
NL_ADD_RUNTIME_FLAGS(ryzom_adminmodules)
|
||||||
|
|
|
@ -4,10 +4,6 @@ NL_TARGET_LIB(ryzom_gameplaymodule ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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)
|
TARGET_LINK_LIBRARIES(ryzom_gameplaymodule nelmisc)
|
||||||
NL_DEFAULT_PROPS(ryzom_gameplaymodule "Ryzom, Library: Gameplay Module")
|
NL_DEFAULT_PROPS(ryzom_gameplaymodule "Ryzom, Library: Gameplay Module")
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameplaymodule)
|
NL_ADD_RUNTIME_FLAGS(ryzom_gameplaymodule)
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_export ${PRIV_H} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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})
|
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_DEFAULT_PROPS(ryzom_export "Ryzom, Library, World: Export Tools")
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_export)
|
NL_ADD_RUNTIME_FLAGS(ryzom_export)
|
||||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_landexport ${PRIV_H} ${SRC})
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
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})
|
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_DEFAULT_PROPS(ryzom_landexport "Ryzom, Library, World: Land Export")
|
||||||
NL_ADD_RUNTIME_FLAGS(ryzom_landexport)
|
NL_ADD_RUNTIME_FLAGS(ryzom_landexport)
|
||||||
|
|
Loading…
Reference in a new issue