1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
6 #include "RulerPoint.h"
7 #include "RulerPathAgent.h"
9 #include <EditorFramework/Preferences.h>
10 #include <CrySerialization/yasli/decorators/Range.h>
13 struct SRulerPreferences
: public SPreferencePage
16 : SPreferencePage("Ruler", "Viewport/Gizmo")
17 , rulerSphereScale(0.5f
)
18 , rulerSphereTrans(0.5f
)
22 virtual bool Serialize(yasli::Archive
& ar
) override
24 ar
.openBlock("Ruler", "Ruler");
25 ar(yasli::Range(rulerSphereScale
, 0.01f
, 100.f
), "rulerSphereScale", "Ruler Sphere Scale");
26 ar(yasli::Range(rulerSphereTrans
, 0.01f
, 100.f
), "rulerSphereTrans", "Ruler Sphere Transparency");
32 // Scale size and transparency for debug spheres when using Ruler tool
33 float rulerSphereScale
;
34 float rulerSphereTrans
;
37 //! The Ruler utility helps to determine distances between user-specified points.
44 //! Returns if ruler has queued paths in the path agent
45 bool HasQueuedPaths() const;
47 //! Activate the ruler
48 void SetActive(bool bActive
);
49 bool IsActive() const { return m_bActive
; }
54 //! Mouse callback handling from viewport
55 bool MouseCallback(CViewport
* pView
, EMouseEvent event
, CPoint
& point
, int flags
);
58 //! Mouse callback helpers
59 void OnMouseMove(CViewport
* pView
, CPoint
& point
, int flags
);
60 void OnLButtonUp(CViewport
* pView
, CPoint
& point
, int flags
);
61 void OnMButtonUp(CViewport
* pView
, CPoint
& point
, int flags
);
62 void OnRButtonUp(CViewport
* pView
, CPoint
& point
, int flags
);
64 //! Returns world point based on mouse point
65 void UpdateRulerPoint(CViewport
* pView
, const CPoint
& point
, CRulerPoint
& rulerPoint
, bool bRequestPath
);
67 //! Request a path using the path agent
70 bool IsObjectSelectMode() const;
74 CryGUID m_MouseOverObject
;
77 CRulerPoint m_startPoint
;
78 CRulerPoint m_endPoint
;
81 CRulerPathAgent
* m_pPathAgents
;