5#include "MRMesh/MRMeshFwd.h"
38 visible_{ widget.directionObj_->visibilityMask() }
42 auto oldVisible = widget_.directionObj_->visibilityMask();
43 widget_.directionObj_->setVisibilityMask( visible_ );
44 visible_ = oldVisible;
46 virtual std::string
name()
const override
50 [[nodiscard]]
virtual size_t heapBytes()
const override
52 return name_.capacity();
57 std::string name_ =
"Change Visible";
61 std::shared_ptr<ObjectMesh> directionObj_;
64 bool blockedMouse_{
false };
65 bool mousePressed_ =
false;
67 Vector3f draggingViewportStartPoint_;
69 Vector3f draggingViewportStartPointOffset_;
71 OnDirectionChangedCallback onDirectionChanged_;
72 Color color_ = Color::red();
73 bool needToSaveHistory_ =
true;
130 const std::shared_ptr<ObjectMesh>&
obj()
const {
return directionObj_; }
176 MRVIEWER_API
virtual bool onMouseDown_(
MouseButton button,
int modifier )
override;
177 MRVIEWER_API
virtual bool onMouseUp_(
MouseButton button,
int modifier )
override;
178 MRVIEWER_API
virtual bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
Definition MRChangeXfAction.h:16
Definition MRHistoryAction.h:15
named object in the data model
Definition MRObject.h:62
stores mask of viewport unique identifiers
Definition MRViewportId.h:42
MRVIEWER_API float getLength() const
Returns the length of the arrow in world space.
MRVIEWER_API void updateBase(const Vector3f &base)
Updates the base of the arrow, in world space.
Vector3f dir
unit direction along arrow
Definition MRDirectionWidget.h:79
bool isMouseBlocked() const
Block or allow mouse editing (allowed by default)
Definition MRDirectionWidget.h:171
ChangeDirAction(DirectionWidget &widget, const std::string &name="Change Direction")
Definition MRDirectionWidget.h:27
MouseButton
Definition MRMouse.h:12
MRVIEWER_API const Color & getColor() const
Returns the color of the widget.
MRVIEWER_API void updateLocalArrow(const Arrow &arrow)
Updates the arrow in parent's space.
MRVIEWER_API void updateDirection(const Vector3f &dir)
Updates the direction of the arrow, in world space.
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRDirectionWidget.h:50
Vector3f base
the point from which the arrow starts
Definition MRDirectionWidget.h:80
MRVIEWER_API void setVisible(bool visible)
Sets the visibility of the widget.
MRVIEWER_API void setColor(const Color &color)
Sets the color of the widget.
MRVIEWER_API void updateLocalBase(const Vector3f &base)
Updates the base of the arrow in parent's space.
MRVIEWER_API Vector3f getDirection() const
Returns the direction of the widget, in world space.
MRVIEWER_API bool isVisible() const
MRVIEWER_API Object * getParentPtr() const
Returns pointer to parent object, always not-null after create() and before reset()
MRVIEWER_API Arrow getArrow() const
Returns the arrow's properties, in world space.
MRVIEWER_API void reset()
MRVIEWER_API void setOnDirectionChangedCallback(OnDirectionChangedCallback cb)
Manually set callback function.
MRVIEWER_API void create(const Vector3f &worldDir, const Vector3f &worldBase, float worldLength, OnDirectionChangedCallback onDirectionChanged, Object *parent=nullptr)
MRVIEWER_API Arrow getLocalArrow() const
Returns the arrow's properties in parent's space.
MRVIEWER_API void updateLocalDirection(const Vector3f &dir)
Updates the direction of the arrow in parent's space.
virtual std::string name() const override
Definition MRDirectionWidget.h:46
MRVIEWER_API void updateLocalLength(float length)
Updates the length of the arrow in parent's space.
MRVIEWER_API void updateLength(float length)
Updates the length of the arrow, in world space.
std::function< void(const Vector3f &, bool)> OnDirectionChangedCallback
This callback is invoked every time when the direction is changed by mouse.
Definition MRDirectionWidget.h:21
const std::shared_ptr< ObjectMesh > & obj() const
Returns internal data model object of this widget.
Definition MRDirectionWidget.h:130
MRVIEWER_API void create(Object *parent=nullptr)
void setMouseBlocked(bool blocked)
Definition MRDirectionWidget.h:173
MRVIEWER_API float getLocalLength() const
Returns the length of the arrow in parent's space.
Type
Definition MRHistoryAction.h:22
virtual void action(Type) override
This function is called on history action (undo, redo, etc.)
Definition MRDirectionWidget.h:40
ChangeVisibleAction(DirectionWidget &widget)
Definition MRDirectionWidget.h:36
MRVIEWER_API Vector3f getBase() const
Returns the base of the widget, in world space.
MRVIEWER_API void updateArrow(const Arrow &arrow)
Updates the arrow, in world space.
MRVIEWER_API Vector3f getLocalDirection() const
Returns the direction of the widget in parent's space.
length
Definition MRObjectDimensionsEnum.h:17
MRVIEWER_API Vector3f getLocalBase() const
Returns the base of the widget in parent's space.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRViewerEventsListener.h:32