mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
- Adds entry to RMB menu in Asset Browser to restore an asset to a backup copy taken from autosaves - Adds reparent out-of-bounds objects button to SceneGroup inspector - Adds ability to have SubScene have a different loading bounds from the actual subscene bounds, allowing load triggering to happen ahead of the bounds of the subscene itself - Fixes asset importer handling of animFPS field to be the correct type - Adds onInspect handling to GameBase allowing better handling for any game class type with editor integration - Add getAssetLooseFileCount and getAssetLooseFile to AssetManager to be able to iterate over all loose files associated to an asset - Add standard/default preload function def to forestItem - Fixes handling of text placement on GuiIconButtonCtrl when text is set to the right - Adds setGlobalCenter utility function - Adds ability to set guiInputCtrl active state - Matched util functions for tracking if left and right mouse buttons are down to EditTSCtrl alongside the existing middle mouse - Add empty element sanity check to appMesh loader - Add callback for GameBase when game is created - Add default graphics options config for steamdeck - Fix typo in assetImportConfig default - Filters SceneGroup utility buttons in inspector to only show for relevent class types
223 lines
7.8 KiB
C++
223 lines
7.8 KiB
C++
//-----------------------------------------------------------------------------
|
|
// Copyright (c) 2012 GarageGames, LLC
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to
|
|
// deal in the Software without restriction, including without limitation the
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
// IN THE SOFTWARE.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef _EDITTSCTRL_H_
|
|
#define _EDITTSCTRL_H_
|
|
|
|
#ifndef _GUITSCONTROL_H_
|
|
#include "gui/3d/guiTSControl.h"
|
|
#endif
|
|
#ifndef _GIZMO_H_
|
|
#include "gizmo.h"
|
|
#endif
|
|
|
|
class TerrainBlock;
|
|
class MissionArea;
|
|
class Gizmo;
|
|
class EditManager;
|
|
struct ObjectRenderInst;
|
|
class SceneRenderState;
|
|
class BaseMatInstance;
|
|
|
|
|
|
class EditTSCtrl : public GuiTSCtrl
|
|
{
|
|
typedef GuiTSCtrl Parent;
|
|
|
|
protected:
|
|
|
|
void make3DMouseEvent(Gui3DMouseEvent & gui3Devent, const GuiEvent &event);
|
|
|
|
// GuiControl
|
|
void getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent) override;
|
|
void onMouseUp(const GuiEvent & event) override;
|
|
void onMouseDown(const GuiEvent & event) override;
|
|
void onMouseMove(const GuiEvent & event) override;
|
|
void onMouseDragged(const GuiEvent & event) override;
|
|
void onMouseEnter(const GuiEvent & event) override;
|
|
void onMouseLeave(const GuiEvent & event) override;
|
|
void onRightMouseDown(const GuiEvent & event) override;
|
|
void onRightMouseUp(const GuiEvent & event) override;
|
|
void onRightMouseDragged(const GuiEvent & event) override;
|
|
void onMiddleMouseDown(const GuiEvent & event) override;
|
|
void onMiddleMouseUp(const GuiEvent & event) override;
|
|
void onMiddleMouseDragged(const GuiEvent & event) override;
|
|
bool onInputEvent(const InputEventInfo & event) override;
|
|
bool onMouseWheelUp(const GuiEvent &event) override;
|
|
bool onMouseWheelDown(const GuiEvent &event) override;
|
|
|
|
|
|
virtual void updateGuiInfo() {};
|
|
virtual void renderScene(const RectI &){};
|
|
void renderMissionArea();
|
|
virtual void renderCameraAxis();
|
|
virtual void renderGrid();
|
|
|
|
// GuiTSCtrl
|
|
void renderWorld(const RectI & updateRect) override;
|
|
|
|
void _renderScene(ObjectRenderInst*, SceneRenderState *state, BaseMatInstance*);
|
|
|
|
/// Zoom in/out in ortho views by "steps".
|
|
void orthoZoom( F32 steps );
|
|
|
|
protected:
|
|
enum DisplayType
|
|
{
|
|
DisplayTypeTop,
|
|
DisplayTypeBottom,
|
|
DisplayTypeFront,
|
|
DisplayTypeBack,
|
|
DisplayTypeLeft,
|
|
DisplayTypeRight,
|
|
DisplayTypePerspective,
|
|
DisplayTypeIsometric,
|
|
};
|
|
|
|
S32 mDisplayType;
|
|
F32 mOrthoFOV;
|
|
Point3F mOrthoCamTrans;
|
|
EulerF mIsoCamRot;
|
|
Point3F mIsoCamRotCenter;
|
|
F32 mIsoCamAngle;
|
|
Point3F mRawCamPos;
|
|
Point2I mLastMousePos;
|
|
bool mLastMouseClamping;
|
|
|
|
bool mAllowBorderMove;
|
|
S32 mMouseMoveBorder;
|
|
F32 mMouseMoveSpeed;
|
|
U32 mLastBorderMoveTime;
|
|
|
|
Gui3DMouseEvent mLastEvent;
|
|
bool mLeftMouseDown;
|
|
bool mRightMouseDown;
|
|
bool mMiddleMouseDown;
|
|
bool mMiddleMouseTriggered;
|
|
bool mMouseLeft;
|
|
|
|
SimObjectPtr<Gizmo> mGizmo;
|
|
GizmoProfile *mGizmoProfile;
|
|
|
|
public:
|
|
|
|
EditTSCtrl();
|
|
~EditTSCtrl();
|
|
|
|
// SimObject
|
|
bool onAdd() override;
|
|
void onRemove() override;
|
|
|
|
//
|
|
bool mRenderMissionArea;
|
|
ColorI mMissionAreaFillColor;
|
|
ColorI mMissionAreaFrameColor;
|
|
F32 mMissionAreaHeightAdjust;
|
|
|
|
//
|
|
ColorI mConsoleFrameColor;
|
|
ColorI mConsoleFillColor;
|
|
S32 mConsoleSphereLevel;
|
|
S32 mConsoleCircleSegments;
|
|
S32 mConsoleLineWidth;
|
|
|
|
static void initPersistFields();
|
|
static void consoleInit();
|
|
|
|
//
|
|
bool mConsoleRendering;
|
|
bool mRightMousePassThru;
|
|
bool mMiddleMousePassThru;
|
|
|
|
// all editors will share a camera
|
|
static Point3F smCamPos;
|
|
static MatrixF smCamMatrix;
|
|
static bool smCamOrtho;
|
|
static F32 smCamNearPlane;
|
|
static F32 smCamFOV;
|
|
static F32 smVisibleDistanceScale;
|
|
|
|
static U32 smSceneBoundsMask;
|
|
static Point3F smMinSceneBounds;
|
|
|
|
bool mRenderGridPlane;
|
|
ColorI mGridPlaneColor;
|
|
F32 mGridPlaneSize;
|
|
F32 mGridPlaneSizePixelBias;
|
|
S32 mGridPlaneMinorTicks;
|
|
ColorI mGridPlaneMinorTickColor;
|
|
ColorI mGridPlaneOriginColor;
|
|
|
|
GFXStateBlockRef mBlendSB;
|
|
|
|
// GuiTSCtrl
|
|
virtual bool getCameraTransform(MatrixF* cameraMatrix);
|
|
virtual void computeSceneBounds(Box3F& bounds);
|
|
bool processCameraQuery(CameraQuery * query) override;
|
|
|
|
// guiControl
|
|
void onRender(Point2I offset, const RectI &updateRect) override;
|
|
virtual void on3DMouseUp(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseDown(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseMove(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseDragged(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseEnter(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseLeave(const Gui3DMouseEvent &){};
|
|
virtual void on3DRightMouseDown(const Gui3DMouseEvent &){};
|
|
virtual void on3DRightMouseUp(const Gui3DMouseEvent &){};
|
|
virtual void on3DRightMouseDragged(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseWheelUp(const Gui3DMouseEvent &){};
|
|
virtual void on3DMouseWheelDown(const Gui3DMouseEvent &){};
|
|
virtual void get3DCursor(GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &);
|
|
|
|
virtual bool isLeftMouseDown() { return mLeftMouseDown; }
|
|
virtual bool isMiddleMouseDown() {return mMiddleMouseDown;}
|
|
virtual bool isRightMouseDown() { return mLeftMouseDown; }
|
|
|
|
bool resize(const Point2I& newPosition, const Point2I& newExtent) override;
|
|
|
|
S32 getDisplayType() const {return mDisplayType;}
|
|
virtual void setDisplayType(S32 type);
|
|
|
|
/// Return true if the current view is an ortho projection along one of the world axes.
|
|
bool isOrthoDisplayType() const { return ( mDisplayType != DisplayTypePerspective && mDisplayType != DisplayTypeIsometric ); }
|
|
|
|
F32 getOrthoFOV() const { return mOrthoFOV; }
|
|
void setOrthoFOV( F32 fov ) { mOrthoFOV = fov; }
|
|
|
|
virtual TerrainBlock* getActiveTerrain();
|
|
|
|
virtual void calcOrthoCamOffset(F32 mousex, F32 mousey, U8 modifier=0);
|
|
|
|
Gizmo* getGizmo() { return mGizmo; }
|
|
|
|
/// Set flags or other Gizmo state appropriate for the current situation.
|
|
/// For example derived classes may override this to disable certain
|
|
/// axes of modes of manipulation.
|
|
virtual void updateGizmo();
|
|
|
|
DECLARE_CONOBJECT(EditTSCtrl);
|
|
DECLARE_CATEGORY( "Gui Editor" );
|
|
};
|
|
|
|
#endif // _EDITTSCTRL_H_
|