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 MRHistoryAction.h:15
named object in the data model
Definition MRObject.h:62
stores mask of viewport unique identifiers
Definition MRViewportId.h:42
void setColor(const Color &color)
Sets the color of the widget.
Vector3f getLocalBase() const
Returns the base of the widget in parent's 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
float getLocalLength() const
Returns the length of the arrow in parent's space.
MouseButton
Definition MRMouse.h:12
void updateBase(const Vector3f &base)
Updates the base 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
void updateLength(float length)
Updates the length of the arrow, in world space.
Arrow getArrow() const
Returns the arrow's properties, in world space.
void create(const Vector3f &worldDir, const Vector3f &worldBase, float worldLength, OnDirectionChangedCallback onDirectionChanged, Object *parent=nullptr)
void updateLocalArrow(const Arrow &arrow)
Updates the arrow in parent's space.
void setOnDirectionChangedCallback(OnDirectionChangedCallback cb)
Manually set callback function.
float getLength() const
Returns the length of the arrow in world space.
virtual std::string name() const override
Definition MRChangeXfAction.h:36
virtual std::string name() const override
Definition MRDirectionWidget.h:46
Object * getParentPtr() const
Returns pointer to parent object, always not-null after create() and before reset()
std::function< void(const Vector3f &, bool)> OnDirectionChangedCallback
This callback is invoked every time when the direction is changed by mouse.
Definition MRDirectionWidget.h:21
Vector3f getLocalDirection() const
Returns the direction of the widget in parent's space.
const std::shared_ptr< ObjectMesh > & obj() const
Returns internal data model object of this widget.
Definition MRDirectionWidget.h:130
void setMouseBlocked(bool blocked)
Definition MRDirectionWidget.h:173
void create(Object *parent=nullptr)
Arrow getLocalArrow() const
Returns the arrow's properties in parent's space.
void updateLocalDirection(const Vector3f &dir)
Updates the direction of the arrow in parent's space.
Vector3f getBase() const
Returns the base of the widget, in world 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
void updateDirection(const Vector3f &dir)
Updates the direction of the arrow, in world space.
float length
the length of the arrow
Definition MRDirectionWidget.h:81
ChangeVisibleAction(DirectionWidget &widget)
Definition MRDirectionWidget.h:36
Vector3f getDirection() const
Returns the direction of the widget, in world space.
ChangeXfAction(const std::string &name, const std::shared_ptr< Object > &obj)
use this constructor to remember object's transformation before making any changes in it
Definition MRChangeXfAction.h:19
const Color & getColor() const
Returns the color of the widget.
void updateArrow(const Arrow &arrow)
Updates the arrow, in world space.
void updateLocalLength(float length)
Updates the length of the arrow in parent's space.
length
Definition MRObjectDimensionsEnum.h:17
void updateLocalBase(const Vector3f &base)
Updates the base of the arrow in parent's space.
void setVisible(bool visible)
Sets the visibility of the widget.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRViewerEventsListener.h:32