Merged in dfighter1985/ryzomcore/dfighter-tools (pull request #82)

See commit log

--HG--
branch : develop
This commit is contained in:
Laszlo Kis-Adam 2014-09-23 00:44:00 +02:00
commit 69e83da388
55 changed files with 952 additions and 478 deletions

View file

@ -233,6 +233,9 @@ namespace NLGUI
virtual void setActive (bool state); virtual void setActive (bool state);
void setXReal( sint32 x ){ _XReal = x; }
void setYReal( sint32 y ){ _YReal = y; }
void setX (sint32 x) { _X = x; } void setX (sint32 x) { _X = x; }
void setXAndInvalidateCoords (sint32 x) { _X = x; invalidateCoords(); } void setXAndInvalidateCoords (sint32 x) { _X = x; invalidateCoords(); }

View file

@ -79,6 +79,9 @@ namespace NLGUI
bool delElement (const std::string &id, bool noWarning=false); bool delElement (const std::string &id, bool noWarning=false);
bool delElement (CInterfaceElement *pIE, bool noWarning=false); bool delElement (CInterfaceElement *pIE, bool noWarning=false);
// Take the element from the group, but don't delete it!
CInterfaceElement* takeElement( CInterfaceElement *e );
uint getNumGroup() const { return (uint)_ChildrenGroups.size(); } uint getNumGroup() const { return (uint)_ChildrenGroups.size(); }
CInterfaceGroup *getGroup(uint index) const; CInterfaceGroup *getGroup(uint index) const;

View file

@ -333,6 +333,12 @@ namespace NLGUI
bool handleEvent( const CEventDescriptor &evnt ); bool handleEvent( const CEventDescriptor &evnt );
bool handleSystemEvent( const CEventDescriptor &evnt );
bool handleKeyboardEvent( const CEventDescriptor &evnt );
bool handleMouseEvent( const CEventDescriptor &evnt );
bool handleMouseMoveEvent( const CEventDescriptor &eventDesc ); bool handleMouseMoveEvent( const CEventDescriptor &eventDesc );
// Relative move of pointer // Relative move of pointer
@ -526,6 +532,11 @@ namespace NLGUI
NLMISC::CRefPtr< CViewBase > _CapturedView; NLMISC::CRefPtr< CViewBase > _CapturedView;
NLMISC::CRefPtr< CInterfaceElement > draggedElement;
bool startDragging();
void stopDragging();
// What is under pointer // What is under pointer
std::vector< CViewBase* > _ViewsUnderPointer; std::vector< CViewBase* > _ViewsUnderPointer;
std::vector< CCtrlBase* > _CtrlsUnderPointer; std::vector< CCtrlBase* > _CtrlsUnderPointer;

View file

@ -1638,6 +1638,32 @@ namespace NLGUI
return delView(static_cast<CViewBase*>(pIE)); return delView(static_cast<CViewBase*>(pIE));
} }
// ------------------------------------------------------------------------------------------------
CInterfaceElement* CInterfaceGroup::takeElement( CInterfaceElement *e )
{
bool ok = false;
if( e->isGroup() )
{
ok = delGroup( static_cast< CInterfaceGroup* >( e ), true );
}
else
if( e->isCtrl() )
{
ok = delCtrl( static_cast< CCtrlBase* >( e ), true );
}
else
if( e->isView() )
{
ok = delView( static_cast< CViewBase* >( e ), true );
}
if( ok )
return e;
else
return NULL;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool CInterfaceGroup::isWindowUnder (sint32 x, sint32 y) bool CInterfaceGroup::isWindowUnder (sint32 x, sint32 y)
{ {

View file

@ -2039,6 +2039,12 @@ namespace NLGUI
} }
} }
if( draggedElement != NULL )
{
CInterfaceElement *e = draggedElement;
static_cast< CViewBase* >( e )->draw();
}
if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty()) if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty())
{ {
driver->setMatrixMode2D11(); driver->setMatrixMode2D11();
@ -2096,7 +2102,30 @@ namespace NLGUI
if( activeAnims[i]->isDisableButtons() ) if( activeAnims[i]->isDisableButtons() )
return false; return false;
bool handled = false;
CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() );
if( evnt.getType() == CEventDescriptor::system ) if( evnt.getType() == CEventDescriptor::system )
{
handleSystemEvent( evnt );
}
else
if (evnt.getType() == CEventDescriptor::key)
{
handled = handleKeyboardEvent( evnt );
}
else if (evnt.getType() == CEventDescriptor::mouse )
{
handled = handleMouseEvent( evnt );
}
CDBManager::getInstance()->flushObserverCalls();
return handled;
}
bool CWidgetManager::handleSystemEvent( const CEventDescriptor &evnt )
{ {
const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt ); const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt );
if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus ) if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus )
@ -2119,22 +2148,23 @@ namespace NLGUI
_CapturedView = NULL; _CapturedView = NULL;
} }
} }
return true;
} }
bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt )
{
bool handled = false; bool handled = false;
CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() );
if (evnt.getType() == CEventDescriptor::key)
{
CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt; CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt;
//_LastEventKeyDesc = eventDesc; //_LastEventKeyDesc = eventDesc;
// Any Key event disable the ContextHelp // Any Key event disable the ContextHelp
disableContextHelp(); disableContextHelp();
// Hide menu if the key is pushed // Hide menu if the key is pushed
// if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift()) // if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift())
// Hide menu (or popup menu) is ESCAPE pressed // Hide menu (or popup menu) is ESCAPE pressed
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE ) if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE )
{ {
@ -2246,12 +2276,14 @@ namespace NLGUI
} }
lastKeyEvent = eventDesc; lastKeyEvent = eventDesc;
return handled;
} }
//////////////////////////////////////////////// Keyboard handling ends here //////////////////////////////////// bool CWidgetManager::handleMouseEvent( const CEventDescriptor &evnt )
else if (evnt.getType() == CEventDescriptor::mouse )
{ {
bool handled = false;
CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt; CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt;
if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown ) if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown )
@ -2411,10 +2443,10 @@ namespace NLGUI
// consider clicking on a control implies handling of the event. // consider clicking on a control implies handling of the event.
handled= true; handled= true;
// handle the capture
if( getCapturePointerLeft() != NULL ) if( getCapturePointerLeft() != NULL )
getCapturePointerLeft()->handleEvent(evnt); _CapturedView = getCapturePointerLeft();
else
// handle the capture
_CapturedView->handleEvent( evnt ); _CapturedView->handleEvent( evnt );
} }
} }
@ -2508,6 +2540,11 @@ namespace NLGUI
setCapturePointerLeft(NULL); setCapturePointerLeft(NULL);
handled = true; handled = true;
} }
_CapturedView = NULL;
if( CInterfaceElement::getEditorMode() )
stopDragging();
} }
@ -2538,14 +2575,10 @@ namespace NLGUI
// If the mouse is over a window, always consider the event is taken (avoid click behind) // If the mouse is over a window, always consider the event is taken (avoid click behind)
handled|= isMouseOverWindow(); handled|= isMouseOverWindow();
} }
}
CDBManager::getInstance()->flushObserverCalls();
return handled; return handled;
} }
bool CWidgetManager::handleMouseMoveEvent( const CEventDescriptor &eventDesc ) bool CWidgetManager::handleMouseMoveEvent( const CEventDescriptor &eventDesc )
{ {
if( getPointer() == NULL ) if( getPointer() == NULL )
@ -2580,9 +2613,53 @@ namespace NLGUI
ve.setY( getPointer()->getY() ); ve.setY( getPointer()->getY() );
} }
if( CInterfaceElement::getEditorMode() )
{
if( ( _CapturedView != NULL ) && ( draggedElement == NULL ) )
{
startDragging();
}
else
if( draggedElement != NULL )
{
draggedElement->setXReal( newX );
draggedElement->setYReal( newY );
draggedElement->invalidateCoords();
}
}
return true; return true;
} }
// ------------------------------------------------------------------------------------------------
bool CWidgetManager::startDragging()
{
CInterfaceElement *e = NULL;
CInterfaceGroup *g = _CapturedView->getParent();
if( g != NULL )
{
e = g->takeElement( _CapturedView );
if( e == NULL )
{
nlinfo( "Something went horribly wrong :(" );
return false;
}
}
else
e = _CapturedView;
e->setParent( NULL );
draggedElement = e;
return true;
}
void CWidgetManager::stopDragging()
{
draggedElement = NULL;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CWidgetManager::movePointer (sint32 dx, sint32 dy) void CWidgetManager::movePointer (sint32 dx, sint32 dy)
{ {

View file

@ -2738,8 +2738,17 @@ CPrimitiveContext::CPrimitiveContext():
} }
static bool LIGORegistered = false;
void Register () void Register ()
{ {
if( LIGORegistered )
{
nlinfo( "LIGO classes have already been registered." );
return;
}
NLMISC_REGISTER_CLASS(CPropertyString); NLMISC_REGISTER_CLASS(CPropertyString);
NLMISC_REGISTER_CLASS(CPropertyStringArray); NLMISC_REGISTER_CLASS(CPropertyStringArray);
NLMISC_REGISTER_CLASS(CPropertyColor); NLMISC_REGISTER_CLASS(CPropertyColor);
@ -2748,6 +2757,8 @@ void Register ()
NLMISC_REGISTER_CLASS(CPrimPath); NLMISC_REGISTER_CLASS(CPrimPath);
NLMISC_REGISTER_CLASS(CPrimZone); NLMISC_REGISTER_CLASS(CPrimZone);
NLMISC_REGISTER_CLASS(CPrimAlias); NLMISC_REGISTER_CLASS(CPrimAlias);
LIGORegistered = true;
} }
// *************************************************************************** // ***************************************************************************

View file

@ -14,7 +14,6 @@
// 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/>.
#include "nel3d_widget.h" #include "nel3d_widget.h"
#include "nel/3d/u_driver.h" #include "nel/3d/u_driver.h"
#include "nel/3d/text_context.h" #include "nel/3d/text_context.h"
@ -29,7 +28,7 @@
#include <QResizeEvent> #include <QResizeEvent>
Nel3DWidget::Nel3DWidget( QWidget *parent ) : Nel3DWidget::Nel3DWidget( QWidget *parent ) :
QWidget( parent ) NEL3DWIDGET( parent )
{ {
driver = NULL; driver = NULL;
textContext = NULL; textContext = NULL;

View file

@ -18,10 +18,22 @@
#ifndef NEL3D_WIDGET_H #ifndef NEL3D_WIDGET_H
#define NEL3D_WIDGET_H #define NEL3D_WIDGET_H
#include <QWidget>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include <string> #include <string>
#ifdef NEL3DWIDGET
#undef NEL3DWIDGET
#endif
#ifdef NL_OS_WINDOWS
#include <QWidget>
#define NEL3DWIDGET QWidget
#else
#include <QGLWidget>
#define NEL3DWIDGET QGLWidget
#endif
#include "../core_global.h" #include "../core_global.h"
namespace NL3D namespace NL3D
@ -31,7 +43,7 @@ namespace NL3D
} }
/// Nel 3D interface to Qt /// Nel 3D interface to Qt
class CORE_EXPORT Nel3DWidget : public QWidget class CORE_EXPORT Nel3DWidget : public NEL3DWIDGET
{ {
Q_OBJECT Q_OBJECT
public: public:

View file

@ -143,6 +143,8 @@ void ContextManager::currentTabChanged(int index)
if (index >= 0) if (index >= 0)
{ {
IContext *context = d->m_contexts.at(index); IContext *context = d->m_contexts.at(index);
context->onActivated();
Q_EMIT currentContextChanged(context); Q_EMIT currentContextChanged(context);
} }
} }

View file

@ -69,6 +69,8 @@ public:
virtual void newDocument(){} virtual void newDocument(){}
virtual void close(){} virtual void close(){}
virtual void onActivated(){}
}; };
} // namespace Core } // namespace Core

View file

@ -108,8 +108,14 @@ void MainWindow::extensionsInitialized()
readSettings(); readSettings();
connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext *)), connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext *)),
this, SLOT(updateContext(Core::IContext *))); this, SLOT(updateContext(Core::IContext *)));
if (m_contextManager->currentContext() != NULL)
updateContext(m_contextManager->currentContext()); Core::IContext *context = m_contextManager->currentContext();
if (context != NULL)
{
updateContext(context);
context->onActivated();
}
show(); show();
} }

View file

@ -176,6 +176,9 @@ void ExpressionEditor::onDeleteSelection()
} }
} }
if( item == m_pvt->m_root )
m_pvt->m_root = NULL;
m_scene->removeItem( item ); m_scene->removeItem( item );
delete item; delete item;
} }

View file

@ -297,9 +297,16 @@ QString ExpressionNode::build() const
QStringList l = m_name.split( ' ' ); QStringList l = m_name.split( ' ' );
result = l[ 0 ]; result = l[ 0 ];
result += "( ";
int c = m_links.count(); int c = m_links.count();
if( c == 1 )
{
result += "()";
return result;
}
result += "( ";
for( int i = 1; i < c; i++ ) for( int i = 1; i < c; i++ )
{ {
ExpressionLink *link = m_links[ i ]; ExpressionLink *link = m_links[ i ];

View file

@ -0,0 +1,8 @@
<expression>
<category>Mathematical</category>
<name>abs</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>band</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Bits</category>
<name>bnot</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>bor</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>bxor</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Database</category>
<name>dbcount</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Logical</category>
<name>depends</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Bits</category>
<name>extSign11To64</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Bits</category>
<name>extSign8To64</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Color</category>
<name>getAlpha</name>
<variable>false</variable>
<slots>
<slot>Color</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Color</category>
<name>getBlue</name>
<variable>false</variable>
<slots>
<slot>Color</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Color</category>
<name>getGreen</name>
<variable>false</variable>
<slots>
<slot>Color</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Color</category>
<name>getRed</name>
<variable>false</variable>
<slots>
<slot>Color</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>getbit</name>
<variable>false</variable>
<slots>
<slot>Integer</slot>
<slot>Bit</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Database</category>
<name>getprop</name>
<variable>false</variable>
<slots>
<slot>property</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Mathematical</category>
<name>identity</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,10 @@
<expression>
<category>Mathematical</category>
<name>ilinear</name>
<variable>false</variable>
<slots>
<slot>Interpolant</slot>
<slot>Start</slot>
<slot>End</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Mathematical</category>
<name>int</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Color</category>
<name>intToColor</name>
<variable>false</variable>
<slots>
<slot>Integer</slot>
</slots>
</expression>

View file

@ -0,0 +1,5 @@
<expression>
<category>Nel</category>
<name>isFinalVersion</name>
<variable>false</variable>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Localization</category>
<name>localize</name>
<variable>false</variable>
<slots>
<slot>String</slot>
</slots>
</expression>

View file

@ -0,0 +1,11 @@
<expression>
<category>Color</category>
<name>makeRGB</name>
<variable>false</variable>
<slots>
<slot>R</slot>
<slot>G</slot>
<slot>B</slot>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Mathematical</category>
<name>max</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Mathematical</category>
<name>min</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Mathematical</category>
<name>mod</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Database</category>
<name>oldvalue</name>
<variable>false</variable>
<slots>
<slot>property</slot>
</slots>
</expression>

View file

@ -0,0 +1,5 @@
<expression>
<category>Mathematical</category>
<name>rand</name>
<variable>false</variable>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>sal</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>sar</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Time</category>
<name>secondsToTimeString</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,8 @@
<expression>
<category>Time</category>
<name>secondsToTimeStringShort</name>
<variable>false</variable>
<slots>
<slot>A</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>shl</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>Bits</category>
<name>shr</name>
<variable>false</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,9 @@
<expression>
<category>String</category>
<name>str</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
</slots>
</expression>

View file

@ -0,0 +1,10 @@
<expression>
<category>Logical</category>
<name>switch</name>
<variable>true</variable>
<slots>
<slot>A</slot>
<slot>B</slot>
<slot>C</slot>
</slots>
</expression>

View file

@ -484,6 +484,11 @@ void MissionCompilerMainWindow::saveConfig() {
settings->sync(); settings->sync();
} }
void MissionCompilerMainWindow::onActivated()
{
NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig;
}
void MissionCompilerMainWindow::handleChangedSettings() void MissionCompilerMainWindow::handleChangedSettings()
{ {
QStringList servers; QStringList servers;

View file

@ -31,6 +31,8 @@ public:
void saveConfig(); void saveConfig();
QUndoStack *getUndoStack() { return m_undoStack; } QUndoStack *getUndoStack() { return m_undoStack; }
void onActivated();
typedef std::map<std::string, CMission> TMissionContainer; typedef std::map<std::string, CMission> TMissionContainer;
public Q_SLOTS: public Q_SLOTS:

View file

@ -83,6 +83,12 @@ public:
virtual void open() {} virtual void open() {}
void onActivated()
{
m_missionCompilerMainWindow->onActivated();
}
MissionCompilerMainWindow *m_missionCompilerMainWindow; MissionCompilerMainWindow *m_missionCompilerMainWindow;
}; };

View file

@ -120,7 +120,7 @@ void CObjectViewer::init( NL3D::UDriver *driver )
NL3D::CBloomEffect::instance().setDriver(_Driver); NL3D::CBloomEffect::instance().setDriver(_Driver);
NL3D::CBloomEffect::instance().setScene(_Scene); NL3D::CBloomEffect::instance().setScene(_Scene);
NL3D::CBloomEffect::instance().init(!_Direct3D); NL3D::CBloomEffect::instance().init();
NL3D::CBloomEffect::instance().setDensityBloom(uint8(_BloomDensity)); NL3D::CBloomEffect::instance().setDensityBloom(uint8(_BloomDensity));
NL3D::CBloomEffect::instance().setSquareBloom(_BloomSquare); NL3D::CBloomEffect::instance().setSquareBloom(_BloomSquare);
@ -172,7 +172,7 @@ void CObjectViewer::renderDriver()
// Render the scene. // Render the scene.
if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect)) if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect))
{ {
NL3D::CBloomEffect::instance().initBloom(); NL3D::CBloomEffect::instance().init();
} }
_Driver->clearBuffers(_BackgroundColor); _Driver->clearBuffers(_BackgroundColor);
} }
@ -184,8 +184,7 @@ void CObjectViewer::renderScene()
if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect)) if((NL3D::CBloomEffect::instance().getDriver() != 0) && (_BloomEffect))
{ {
NL3D::CBloomEffect::instance().endBloom(); NL3D::CBloomEffect::instance().applyBloom();
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
} }
} }

View file

@ -54,36 +54,6 @@ bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage
WorldEditorSettingsPage *weSettings = new WorldEditorSettingsPage(this); WorldEditorSettingsPage *weSettings = new WorldEditorSettingsPage(this);
addAutoReleasedObject(weSettings); addAutoReleasedObject(weSettings);
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat();
m_ligoConfig.Snap = settings->value(Constants::WORLD_EDITOR_SNAP, "1").toFloat();
m_ligoConfig.ZoneSnapShotRes = settings->value(Constants::ZONE_SNAPSHOT_RES, "128").toUInt();
QString fileName = settings->value(Constants::PRIMITIVE_CLASS_FILENAME, "world_editor_classes.xml").toString();
settings->endGroup();
try
{
// Search path of file world_editor_classes.xml
std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData());
// Init LIGO
m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true);
NLLIGO::Register();
NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig;
}
catch (NLMISC::Exception &e)
{
*errorString = tr("(%1)").arg(e.what());
return false;
}
// Reset
m_ligoConfig.resetPrimitiveConfiguration ();
// TODO: get file names! from settings
m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true);
addAutoReleasedObject(new WorldEditorContext(this)); addAutoReleasedObject(new WorldEditorContext(this));
return true; return true;
} }
@ -116,6 +86,33 @@ WorldEditorContext::WorldEditorContext(QObject *parent)
: IContext(parent), : IContext(parent),
m_worldEditorWindow(0) m_worldEditorWindow(0)
{ {
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat();
m_ligoConfig.Snap = settings->value(Constants::WORLD_EDITOR_SNAP, "1").toFloat();
m_ligoConfig.ZoneSnapShotRes = settings->value(Constants::ZONE_SNAPSHOT_RES, "128").toUInt();
QString fileName = settings->value(Constants::PRIMITIVE_CLASS_FILENAME, "world_editor_classes.xml").toString();
settings->endGroup();
try
{
// Search path of file world_editor_classes.xml
std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData());
// Init LIGO
m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true);
NLLIGO::Register();
NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig;
}
catch (NLMISC::Exception &e)
{
nlinfo( "Error starting LIGO." );
}
// Reset
m_ligoConfig.resetPrimitiveConfiguration ();
// TODO: get file names! from settings
m_ligoConfig.readPrimitiveClass("world_editor_primitive_configuration.xml", true);
m_worldEditorWindow = new WorldEditorWindow(); m_worldEditorWindow = new WorldEditorWindow();
} }
@ -124,6 +121,11 @@ QUndoStack *WorldEditorContext::undoStack()
return m_worldEditorWindow->undoStack(); return m_worldEditorWindow->undoStack();
} }
void WorldEditorContext::onActivated()
{
NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig;
}
void WorldEditorContext::open() void WorldEditorContext::open()
{ {
m_worldEditorWindow->open(); m_worldEditorWindow->open();

View file

@ -59,7 +59,6 @@ protected:
NLMISC::CLibraryContext *m_libContext; NLMISC::CLibraryContext *m_libContext;
private: private:
NLLIGO::CLigoConfig m_ligoConfig;
ExtensionSystem::IPluginManager *m_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects; QList<QObject *> m_autoReleaseObjects;
}; };
@ -88,9 +87,14 @@ public:
virtual QUndoStack *undoStack(); virtual QUndoStack *undoStack();
void onActivated();
virtual QWidget *widget(); virtual QWidget *widget();
WorldEditorWindow *m_worldEditorWindow; WorldEditorWindow *m_worldEditorWindow;
private:
NLLIGO::CLigoConfig m_ligoConfig;
}; };
} // namespace WorldEditor } // namespace WorldEditor

View file

@ -46,6 +46,7 @@ public:
~WorldEditorWindow(); ~WorldEditorWindow();
QUndoStack *undoStack() const; QUndoStack *undoStack() const;
void onActivated();
void maybeSave(); void maybeSave();
Q_SIGNALS: Q_SIGNALS: