|
@@ -49,6 +49,7 @@
|
|
#include "math/mEase.h"
|
|
#include "math/mEase.h"
|
|
#include "T3D/tsStatic.h"
|
|
#include "T3D/tsStatic.h"
|
|
|
|
|
|
|
|
+#include "tools/editorTool.h"
|
|
|
|
|
|
IMPLEMENT_CONOBJECT( WorldEditor );
|
|
IMPLEMENT_CONOBJECT( WorldEditor );
|
|
|
|
|
|
@@ -1823,6 +1824,8 @@ WorldEditor::WorldEditor()
|
|
mUseGroupCenter = true;
|
|
mUseGroupCenter = true;
|
|
mFadeIcons = true;
|
|
mFadeIcons = true;
|
|
mFadeIconsDist = 8.f;
|
|
mFadeIconsDist = 8.f;
|
|
|
|
+
|
|
|
|
+ mActiveEditorTool = nullptr;
|
|
}
|
|
}
|
|
|
|
|
|
WorldEditor::~WorldEditor()
|
|
WorldEditor::~WorldEditor()
|
|
@@ -1915,6 +1918,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
|
|
setCursor(PlatformCursorController::curArrow);
|
|
setCursor(PlatformCursorController::curArrow);
|
|
mHitObject = NULL;
|
|
mHitObject = NULL;
|
|
|
|
|
|
|
|
+ //If we have an active tool and it's intercepted our input, bail out
|
|
|
|
+ if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseMove(event))
|
|
|
|
+ return;
|
|
|
|
+
|
|
//
|
|
//
|
|
mUsingAxisGizmo = false;
|
|
mUsingAxisGizmo = false;
|
|
|
|
|
|
@@ -1943,6 +1950,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
|
|
|
|
|
|
void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
|
|
void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
|
|
{
|
|
{
|
|
|
|
+ //If we have an active tool and it's intercepted our input, bail out
|
|
|
|
+ if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDown(event))
|
|
|
|
+ return;
|
|
|
|
+
|
|
mMouseDown = true;
|
|
mMouseDown = true;
|
|
mMouseDragged = false;
|
|
mMouseDragged = false;
|
|
mPerformedDragCopy = false;
|
|
mPerformedDragCopy = false;
|
|
@@ -2010,6 +2021,10 @@ void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
|
|
|
|
|
|
void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event )
|
|
void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event )
|
|
{
|
|
{
|
|
|
|
+ //If we have an active tool and it's intercepted our input, bail out
|
|
|
|
+ if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseUp(event))
|
|
|
|
+ return;
|
|
|
|
+
|
|
const bool wasUsingAxisGizmo = mUsingAxisGizmo;
|
|
const bool wasUsingAxisGizmo = mUsingAxisGizmo;
|
|
|
|
|
|
mMouseDown = false;
|
|
mMouseDown = false;
|
|
@@ -2165,6 +2180,10 @@ void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event )
|
|
|
|
|
|
void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
|
|
void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
|
|
{
|
|
{
|
|
|
|
+ //If we have an active tool and it's intercepted our input, bail out
|
|
|
|
+ if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDragged(event))
|
|
|
|
+ return;
|
|
|
|
+
|
|
if ( !mMouseDown )
|
|
if ( !mMouseDown )
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -2400,6 +2419,9 @@ void WorldEditor::renderScene( const RectI &updateRect )
|
|
GFXDEBUGEVENT_SCOPE( Editor_renderScene, ColorI::RED );
|
|
GFXDEBUGEVENT_SCOPE( Editor_renderScene, ColorI::RED );
|
|
|
|
|
|
smRenderSceneSignal.trigger(this);
|
|
smRenderSceneSignal.trigger(this);
|
|
|
|
+
|
|
|
|
+ if (mActiveEditorTool != nullptr)
|
|
|
|
+ mActiveEditorTool->render();
|
|
|
|
|
|
// Grab this before anything here changes it.
|
|
// Grab this before anything here changes it.
|
|
Frustum frustum;
|
|
Frustum frustum;
|
|
@@ -3190,6 +3212,19 @@ void WorldEditor::resetSelectedScale()
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
+void WorldEditor::setEditorTool(EditorTool* newTool)
|
|
|
|
+{
|
|
|
|
+ if (mActiveEditorTool)
|
|
|
|
+ mActiveEditorTool->onDeactivated();
|
|
|
|
+
|
|
|
|
+ mActiveEditorTool = newTool;
|
|
|
|
+
|
|
|
|
+ if (mActiveEditorTool)
|
|
|
|
+ mActiveEditorTool->onActivated(this);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//------------------------------------------------------------------------------
|
|
|
|
+
|
|
ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
|
ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
|
{
|
|
{
|
|
object->ignoreObjClass(argc, argv);
|
|
object->ignoreObjClass(argc, argv);
|
|
@@ -4175,3 +4210,15 @@ DefineEngineMethod( WorldEditor, createConvexShapeFrom, ConvexShape*, ( SceneObj
|
|
|
|
|
|
return shape;
|
|
return shape;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+DefineEngineMethod(WorldEditor, setEditorTool, void, (EditorTool* newEditorTool), (nullAsType<EditorTool*>()),
|
|
|
|
+ "Sets the active Editor Tool for the world editor.")
|
|
|
|
+{
|
|
|
|
+ object->setEditorTool(newEditorTool);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DefineEngineMethod(WorldEditor, getActiveEditorTool, EditorTool*, (),,
|
|
|
|
+ "Gets the active Editor Tool for the world editor.")
|
|
|
|
+{
|
|
|
|
+ return object->getActiveEditorTool();
|
|
|
|
+}
|