MeshLib C++ Docs
Loading...
Searching...
No Matches
ImGuiMenu.h
Go to the documentation of this file.
1#pragma once
9
10#include "MRViewerPlugin.h"
12#include "MRNotificationType.h"
13#include "MRSignalCombiners.h"
14#include "MRShowModal.h"
15#include "imgui.h"
18#include "MRMesh/MRBox.h"
19#include "MRMesh/MRColor.h"
20#include <optional>
21#include <unordered_map>
22
24struct ImGuiContext;
25struct ImGuiWindow;
26
27namespace MR
28{
31
32
33class ShortcutManager;
34class MeshModifier;
35struct UiRenderManager;
36class SceneObjectsListDrawer;
37class ObjectComparableWithReference;
38
40{
41 ObjectBit = 1 << 0,
42 ObjectPointsHolderBit = 1 << 1,
43 ObjectLinesHolderBit = 1 << 2,
44 ObjectMeshHolderBit = 1 << 3,
45 ObjectLabelBit = 1 << 4,
46 ObjectMeshBit = 1 << 5,
47 ObjectFeatureBit = 1 << 6,
48 ObjectMeasurementBit = 1 << 7,
49};
51
52class MRVIEWER_CLASS ImGuiMenu : public MR::ViewerPlugin,
53 public MultiListener<
61{
70protected:
73
77
79 float userScaling_ = 1.0f;
80
82 ImGuiContext * context_ = nullptr;
84 ImGuiWindow* prevFrameFocusPlugin_ = nullptr;
85
87 bool pollEventsInPreDraw = false;
88
89 bool showShortcuts_{ false };
90 bool showStatistics_{ false };
91 long long frameTimeMillisecThreshold_{ 25 };
92 bool showRenameModal_{ false };
93 std::string renameBuffer_;
94 std::string popUpRenameBuffer_;
95 bool needModalBgChange_{ false };
96 bool showInfoModal_{ false };
99 std::shared_ptr<ShortcutManager> shortcutManager_;
100
105
106 MRVIEWER_API virtual void setupShortcuts_();
107
108 bool savedDialogPositionEnabled_{ false };
109
110 std::weak_ptr<Object> lastRenameObj_;
113 enum class CoordType : int
114 {
115 Local,
116 World,
117 } coordType_{ CoordType::Local };
118
120 {
121 std::string lastLabel;
122 std::string labelBuffer;
123 std::shared_ptr<ObjectLabel> obj{ nullptr };
124 } oldLabelParams_;
125
126 bool allowRemoval_{ true };
127 bool uniformScale_{ true };
128 bool xfHistUpdated_{ false };
129 bool invertedRotation_{ false };
130
131 std::optional<std::pair<std::string, Vector4f>> storedColor_;
132 Vector4f getStoredColor_( const std::string& str, const Color& defaultColor ) const;
133
135
136 std::vector<std::shared_ptr<MR::MeshModifier>> modifiers_;
137
139 {
143 Quad
144 } viewportConfig_{ Single };
145
147 bool selectionChangedToSingleObj_{ false };
149 ViewportId selectedViewport_ = {};
150
152 std::weak_ptr<Object> editedFeatureObject_;
155
158 {
159 std::string initName;
160 std::string name;
161 bool initHasFrontColor = false;
162 bool hasFrontColor = false;
165 };
168 bool showEditTag_ = false;
170 std::string tagNewName_;
171
172public:
173 MRVIEWER_API static const std::shared_ptr<ImGuiMenu>& instance();
174
175 MRVIEWER_API virtual void init(MR::Viewer *_viewer) override;
176
178 MRVIEWER_API virtual void initBackend();
179
181 MRVIEWER_API virtual void startFrame();
183 MRVIEWER_API virtual void finishFrame();
184
185 MRVIEWER_API virtual void load_font(int font_size = 13);
186 MRVIEWER_API virtual void reload_font(int font_size = 13);
187
188 MRVIEWER_API virtual void shutdown() override;
189
191 MRVIEWER_API virtual void draw_menu();
192
193 MRVIEWER_API void draw_helpers();
194
196 MRVIEWER_API virtual void draw_viewer_window();
197
199 virtual void draw_custom_window() {}
200
202 std::function<void(void)> callback_draw_viewer_window;
203 std::function<void(void)> callback_draw_viewer_menu;
204 std::function<void(void)> callback_draw_custom_window;
205
207
208 MRVIEWER_API void draw_text(
209 const Viewport& viewport,
210 const Vector3f& pos,
211 const Vector3f& normal,
212 const std::string& text,
213 const Color& color,
214 bool clipByViewport );
215
216 MRVIEWER_API float pixel_ratio();
217
218 MRVIEWER_API float hidpi_scaling();
219
220 MRVIEWER_API float menu_scaling() const;
221
223 float getUserScaling() const { return userScaling_; }
225 MRVIEWER_API void setUserScaling( float scaling );
226
227 MRVIEWER_API ImGuiContext* getCurrentContext() const;
228
229 ImGuiWindow* getLastFocusedPlugin() const { return prevFrameFocusPlugin_; };
230
232 MRVIEWER_API virtual void showModalMessage( const std::string& msg, NotificationType msgType );
233
234 MRVIEWER_API virtual std::filesystem::path getMenuFontPath() const;
235
237 MRVIEWER_API void setDrawTimeMillisecThreshold( long long maxGoodTimeMillisec );
238
240 MRVIEWER_API void draw_scene_list();
242 MRVIEWER_API void draw_scene_list_content( const std::vector<std::shared_ptr<Object>>& selected, const std::vector<std::shared_ptr<Object>>& all );
243
246 MRVIEWER_API virtual void draw_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
249 MRVIEWER_API virtual void draw_selection_properties_content( const std::vector<std::shared_ptr<Object>>& selected );
251
253 MRVIEWER_API virtual bool drawCollapsingHeader_( const char* label, ImGuiTreeNodeFlags flags = 0);
255 MRVIEWER_API virtual bool drawCollapsingHeaderTransform_();
256
257 bool make_visualize_checkbox( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert = false );
258 template<typename ObjectT>
259 void make_color_selector( std::vector<std::shared_ptr<ObjectT>> selectedVisualObjs, const char* label,
260 std::function<Vector4f( const ObjectT* )> getter,
261 std::function<void( ObjectT*, const Vector4f& )> setter );
262 template<typename ObjType,typename ValueT>
263 void make_width( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
264 std::function<ValueT( const ObjType* )> getter,
265 std::function<void( ObjType*, const ValueT& )> setter );
266
267 void make_light_strength( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
268 std::function<float( const VisualObject* )> getter,
269 std::function<void( VisualObject*, const float& )> setter);
270
271 template <typename T, typename ObjectType>
272 void make_slider( std::vector<std::shared_ptr<ObjectType>> selectedVisualObjs, const char* label,
273 std::function<T( const ObjectType* )> getter,
274 std::function<void( ObjectType*, T )> setter, T min, T max );
275
276 void make_points_discretization( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
277 std::function<int( const ObjectPointsHolder* )> getter,
278 std::function<void( ObjectPointsHolder*, const int& )> setter );
279
280 std::shared_ptr<ShortcutManager> getShortcutManager() { return shortcutManager_; };
281
282 MRVIEWER_API void add_modifier( std::shared_ptr<MR::MeshModifier> modifier );
283
284 MRVIEWER_API void allowSceneReorder( bool allow );
285 bool checkPossibilityObjectRemoval() { return allowRemoval_; };
286
287 MRVIEWER_API void allowObjectsRemoval( bool allow );
288
289 MRVIEWER_API void tryRenameSelectedObject();
290
291 MRVIEWER_API void setObjectTreeState( const Object* obj, bool open );
292
294 MRVIEWER_API void expandObjectTreeAndScroll( const Object* obj );
295
297 MRVIEWER_API void setShowShortcuts( bool val );
299 MRVIEWER_API bool getShowShortcuts() const;
300
302 void enableSavedDialogPositions( bool on ) { savedDialogPositionEnabled_ = on; }
304 bool isSavedDialogPositionsEnabled() const { return savedDialogPositionEnabled_; }
305
307 MRVIEWER_API virtual UiRenderManager& getUiRenderManager();
308
309 MRVIEWER_API const std::shared_ptr<SceneObjectsListDrawer>& getSceneObjectsList() { return sceneObjectsList_; };
310
312 {
314 selectOne,
316 toggle,
317 };
318 using NameTagClickSignal = boost::signals2::signal<bool( Object& object, NameTagSelectionMode mode ), StopOnTrueCombiner>;
322 MRVIEWER_API bool simulateNameTagClick( Object& object, NameTagSelectionMode mode );
325
326 using DrawSceneUiSignal = boost::signals2::signal<void( ViewportId viewportId, UiRenderParams::UiTaskList& tasks )>;
329
331 MRVIEWER_API bool anyImGuiWindowIsHovered() const;
333 MRVIEWER_API bool anyUiObjectIsHovered() const;
334
337 MRVIEWER_API SelectedTypesMask calcSelectedTypesMask( const std::vector<std::shared_ptr<Object>>& selectedObjs );
338 MRVIEWER_API bool drawGeneralOptions( const std::vector<std::shared_ptr<Object>>& selectedObjs );
339 MRVIEWER_API bool drawAdvancedOptions( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
340 MRVIEWER_API bool drawRemoveButton( const std::vector<std::shared_ptr<Object>>& selectedObjs );
341 MRVIEWER_API bool drawDrawOptionsCheckboxes( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
342 MRVIEWER_API bool drawDrawOptionsColors( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs );
343
346 {
354 float itemWidth {};
356 float item2Width {};
358 float item3Width {};
359 };
360
361protected:
362 MRVIEWER_API virtual void drawModalMessage_();
363
364 bool capturedMouse_{ false };
366 MRVIEWER_API virtual bool onMouseDown_( MouseButton button, int modifier ) override;
367 MRVIEWER_API virtual bool onMouseUp_( MouseButton button, int modifier ) override;
368 MRVIEWER_API virtual bool onMouseMove_( int mouse_x, int mouse_y ) override;
369 MRVIEWER_API virtual bool onMouseScroll_( float delta_y ) override;
370 MRVIEWER_API virtual void cursorEntrance_( bool entered ) override;
372 MRVIEWER_API virtual bool onCharPressed_( unsigned key, int modifiers ) override;
373 MRVIEWER_API virtual bool onKeyDown_( int key, int modifiers ) override;
374 MRVIEWER_API virtual bool onKeyUp_( int key, int modifiers ) override;
375 MRVIEWER_API virtual bool onKeyRepeat_( int key, int modifiers ) override;
377 MRVIEWER_API virtual void postResize_( int width, int height ) override;
378 MRVIEWER_API virtual void postRescale_( float x, float y) override;
380 MRVIEWER_API virtual bool spaceMouseMove_( const Vector3f& translate, const Vector3f& rotate ) override;
381 MRVIEWER_API virtual bool spaceMouseDown_( int key ) override;
383 MRVIEWER_API virtual bool touchpadRotateGestureBegin_() override;
384 MRVIEWER_API virtual bool touchpadRotateGestureUpdate_( float angle ) override;
385 MRVIEWER_API virtual bool touchpadRotateGestureEnd_() override;
386 MRVIEWER_API virtual bool touchpadSwipeGestureBegin_() override;
387 MRVIEWER_API virtual bool touchpadSwipeGestureUpdate_( float deltaX, float deltaY, bool kinetic ) override;
388 MRVIEWER_API virtual bool touchpadSwipeGestureEnd_() override;
389 MRVIEWER_API virtual bool touchpadZoomGestureBegin_() override;
390 MRVIEWER_API virtual bool touchpadZoomGestureUpdate_( float scale, bool kinetic ) override;
391 MRVIEWER_API virtual bool touchpadZoomGestureEnd_() override;
393 MRVIEWER_API virtual void postFocus_( bool focused ) override;
394
397 MRVIEWER_API virtual void rescaleStyle_();
398
399 MRVIEWER_API float drawSelectionInformation_();
400 MRVIEWER_API void drawFeaturePropertiesEditor_( const std::shared_ptr<Object>& object );
401
403
405 MRVIEWER_API virtual void drawCustomSelectionInformation_( const std::vector<std::shared_ptr<Object>>& selected, const SelectionInformationStyle& style );
406
407 MRVIEWER_API virtual void draw_custom_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
408
409 MRVIEWER_API void drawTagInformation_( const std::vector<std::shared_ptr<Object>>& selected );
410
411 MRVIEWER_API float drawTransform_();
412
413 MRVIEWER_API virtual bool drawTransformContextMenu_( const std::shared_ptr<Object>& ) { return false; }
414
416 MRVIEWER_API virtual void drawShortcutsWindow_();
418 MRVIEWER_API float getSceneInfoItemWidth_( int itemCount = 1 );
419
421 {
422 public:
423 MRVIEWER_API void preRenderViewport( ViewportId viewport ) override;
424 MRVIEWER_API void postRenderViewport( ViewportId viewport ) override;
426 MRVIEWER_API void finishBackwardPass( ViewportId viewport, const BasicUiRenderTask::BackwardPassParams& params ) override;
427
430
433 MRVIEWER_API bool canConsumeEvent( BasicUiRenderTask::InteractionMask event ) const;
434 };
436 std::unique_ptr<UiRenderManagerImpl> uiRenderManager_;
437 std::shared_ptr<SceneObjectsListDrawer> sceneObjectsList_;
438};
439
440
442MRVIEWER_API void reserveKeyEvent( ImGuiKey key );
443
444
445}
#define MR_MAKE_FLAG_OPERATORS(T)
Generates operators for a enum (at namespace scope).
Definition MRFlagOperators.h:6
Definition MRVisualObject.h:54
Definition ImGuiMenu.h:421
Definition ImGuiMenu.h:61
A base class for a data-model object that is a feature/measurement that can be compared between two m...
Definition MRObjectComparableWithReference.h:17
Definition MRObjectPointsHolder.h:24
named object in the data model
Definition MRObject.h:62
Definition MRViewerPlugin.h:30
GLFW-based mesh viewer.
Definition MRViewer.h:69
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:42
Definition MRViewport.h:49
Visual Object.
Definition MRVisualObject.h:116
auto width(const Box< V > &box)
returns size along x axis
Definition MRBox.h:354
auto height(const Box< V > &box)
returns size along y axis
Definition MRBox.h:361
std::string storedModalMessage_
Definition ImGuiMenu.h:97
MRVIEWER_API void draw_helpers()
SelectedTypesMask
Definition ImGuiMenu.h:40
void make_slider(std::vector< std::shared_ptr< ObjectType > > selectedVisualObjs, const char *label, std::function< T(const ObjectType *)> getter, std::function< void(ObjectType *, T)> setter, T min, T max)
Color labelColor
property label color
Definition ImGuiMenu.h:350
MRVIEWER_API const std::shared_ptr< SceneObjectsListDrawer > & getSceneObjectsList()
Definition ImGuiMenu.h:309
virtual void draw_custom_window()
Can be overwritten by callback_draw_custom_window
Definition ImGuiMenu.h:199
MRVIEWER_API void drawTagInformation_(const std::vector< std::shared_ptr< Object > > &selected)
void draw_labels_window()
virtual MRVIEWER_API void draw_menu()
Draw menu.
void make_color_selector(std::vector< std::shared_ptr< ObjectT > > selectedVisualObjs, const char *label, std::function< Vector4f(const ObjectT *)> getter, std::function< void(ObjectT *, const Vector4f &)> setter)
virtual MRVIEWER_API bool onKeyDown_(int key, int modifiers) override
virtual MRVIEWER_API bool touchpadZoomGestureBegin_() override
boost::signals2::signal< bool(Object &object, NameTagSelectionMode mode), StopOnTrueCombiner > NameTagClickSignal
Definition ImGuiMenu.h:318
virtual MRVIEWER_API UiRenderManager & getUiRenderManager()
This class helps the viewer to renderUi() from IRenderObjects.
virtual MRVIEWER_API void setupShortcuts_()
MouseButton
Definition MRMouse.h:12
Color textColor
value text color
Definition ImGuiMenu.h:348
virtual MRVIEWER_API void postResize_(int width, int height) override
Scene events.
virtual MRVIEWER_API bool touchpadSwipeGestureBegin_() override
ImVec2 sceneWindowSize_
Definition ImGuiMenu.h:102
MRVIEWER_API void draw_scene_list_content(const std::vector< std::shared_ptr< Object > > &selected, const std::vector< std::shared_ptr< Object > > &all)
Draw scene list content only.
virtual MRVIEWER_API void drawShortcutsWindow_()
A virtual function for drawing of the dialog with shortcuts. It can be overriden in the inherited cla...
MRVIEWER_API BasicUiRenderTask::BackwardPassParams beginBackwardPass(ViewportId viewport, UiRenderParams::UiTaskList &tasks) override
float getUserScaling() const
returns UI scaling modifier specified by user
Definition ImGuiMenu.h:223
MRVIEWER_API bool drawAdvancedOptions(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
virtual MRVIEWER_API bool onMouseScroll_(float delta_y) override
virtual MRVIEWER_API void showModalMessage(const std::string &msg, NotificationType msgType)
opens Error / Warning / Info modal window with message text
CoordType
Definition ImGuiMenu.h:114
void make_width(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, std::function< ValueT(const ObjType *)> getter, std::function< void(ObjType *, const ValueT &)> setter)
bool make_visualize_checkbox(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert=false)
ViewportConfigurations
Definition ImGuiMenu.h:139
MRVIEWER_API float drawTransform_()
virtual MRVIEWER_API void initBackend()
inits glfw and glsl backend
void make_points_discretization(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, std::function< int(const ObjectPointsHolder *)> getter, std::function< void(ObjectPointsHolder *, const int &)> setter)
virtual MRVIEWER_API bool touchpadSwipeGestureUpdate_(float deltaX, float deltaY, bool kinetic) override
ImVec2 mainWindowSize_
Definition ImGuiMenu.h:104
bool isSavedDialogPositionsEnabled() const
returns true if enabled using of saved positions of plugin windows in the config file,...
Definition ImGuiMenu.h:304
virtual MRVIEWER_API bool onKeyRepeat_(int key, int modifiers) override
NotificationType
Definition MRNotificationType.h:10
virtual MRVIEWER_API bool spaceMouseDown_(int key) override
MRVIEWER_API void postRenderViewport(ViewportId viewport) override
This is called after doing IRenderObject::renderUi() on even object in a viewport....
virtual MRVIEWER_API void load_font(int font_size=13)
std::optional< std::pair< std::string, Vector4f > > storedColor_
Definition ImGuiMenu.h:131
MRVIEWER_API void allowSceneReorder(bool allow)
std::string popUpRenameBuffer_
Definition ImGuiMenu.h:94
virtual MRVIEWER_API bool onMouseUp_(MouseButton button, int modifier) override
void make_light_strength(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, std::function< float(const VisualObject *)> getter, std::function< void(VisualObject *, const float &)> setter)
std::function< void(void)> callback_draw_viewer_window
Easy-to-customize callbacks.
Definition ImGuiMenu.h:202
std::string searchPluginsString_
Definition ImGuiMenu.h:134
virtual MRVIEWER_API bool drawCollapsingHeaderTransform_()
override this to customize appearance of collapsing headers for transform block
ImVec2 sceneWindowPos_
Definition ImGuiMenu.h:101
MRVIEWER_API bool canConsumeEvent(BasicUiRenderTask::InteractionMask event) const
MRVIEWER_API void draw_scene_list()
Draw scene list window with content.
Box3f selectionLocalBox_
Definition ImGuiMenu.h:111
MRVIEWER_API bool drawGeneralOptions(const std::vector< std::shared_ptr< Object > > &selectedObjs)
virtual MRVIEWER_API void postFocus_(bool focused) override
Other events.
float hidpi_scaling_
Hidpi scaling to be used for text rendering.
Definition ImGuiMenu.h:72
std::function< void(void)> callback_draw_viewer_menu
Definition ImGuiMenu.h:203
virtual MRVIEWER_API bool onMouseDown_(MouseButton button, int modifier) override
Mouse IO.
ImVec4 selectedColor
Definition ImGuiMenu.h:163
virtual MRVIEWER_API void drawCustomSelectionInformation_(const std::vector< std::shared_ptr< Object > > &selected, const SelectionInformationStyle &style)
draw additional selection information (e.g. for custom objects)
MRVIEWER_API void add_modifier(std::shared_ptr< MR::MeshModifier > modifier)
std::shared_ptr< ShortcutManager > getShortcutManager()
Definition ImGuiMenu.h:280
std::string tagNewName_
buffer string for the tag name input widget
Definition ImGuiMenu.h:170
MRVIEWER_API void drawFeaturePropertiesEditor_(const std::shared_ptr< Object > &object)
MRVIEWER_API void tryRenameSelectedObject()
virtual MRVIEWER_API void cursorEntrance_(bool entered) override
MRVIEWER_API float pixel_ratio()
MRVIEWER_API float getSceneInfoItemWidth_(int itemCount=1)
returns width of items in Scene Info window
virtual MRVIEWER_API void drawModalMessage_()
AffineXf3f editedFeatureObjectOldXf_
When editing feature properties, this is the original xf of the target object, for history purposes.
Definition ImGuiMenu.h:154
MRVIEWER_API float menu_scaling() const
virtual MRVIEWER_API bool touchpadZoomGestureUpdate_(float scale, bool kinetic) override
MRVIEWER_API void setDrawTimeMillisecThreshold(long long maxGoodTimeMillisec)
setup maximum good time for frame rendering (if rendering is slower it will become red in statistics ...
MRVIEWER_API void finishBackwardPass(ViewportId viewport, const BasicUiRenderTask::BackwardPassParams &params) override
After the backward pass is performed, the parameters should be passed back into this function.
virtual MRVIEWER_API bool onMouseMove_(int mouse_x, int mouse_y) override
MRVIEWER_API bool getShowShortcuts() const
return show shortcuts state (enable / disable)
MRVIEWER_API void preRenderViewport(ViewportId viewport) override
This is called before doing IRenderObject::renderUi() on even object in a viewport....
virtual MRVIEWER_API bool onKeyUp_(int key, int modifiers) override
Color selectedTextColor
selected value text color
Definition ImGuiMenu.h:352
MRVIEWER_API void setObjectTreeState(const Object *obj, bool open)
virtual MRVIEWER_API void rescaleStyle_()
virtual MRVIEWER_API bool touchpadZoomGestureEnd_() override
virtual MRVIEWER_API bool onCharPressed_(unsigned key, int modifiers) override
Keyboard IO.
MRVIEWER_API void allowObjectsRemoval(bool allow)
std::shared_ptr< SceneObjectsListDrawer > sceneObjectsList_
Definition ImGuiMenu.h:437
virtual MRVIEWER_API void draw_custom_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
std::vector< std::shared_ptr< BasicUiRenderTask > > UiTaskList
Definition MRIRenderObject.h:111
MRVIEWER_API bool drawRemoveButton(const std::vector< std::shared_ptr< Object > > &selectedObjs)
float pixel_ratio_
Definition ImGuiMenu.h:76
MRVIEWER_API void setShowShortcuts(bool val)
set show shortcuts state (enable / disable)
std::vector< std::shared_ptr< MR::MeshModifier > > modifiers_
Definition ImGuiMenu.h:136
MRVIEWER_API void draw_text(const Viewport &viewport, const Vector3f &pos, const Vector3f &normal, const std::string &text, const Color &color, bool clipByViewport)
bool checkPossibilityObjectRemoval()
Definition ImGuiMenu.h:285
MRVIEWER_API void expandObjectTreeAndScroll(const Object *obj)
expands all objs parents in tree and scroll scene tree window so selection becomes visible
virtual MRVIEWER_API void startFrame()
call this to validate imgui context in the begining of the frame
static MRVIEWER_API const std::shared_ptr< ImGuiMenu > & instance()
boost::signals2::signal< void(ViewportId viewportId, UiRenderParams::UiTaskList &tasks)> DrawSceneUiSignal
Definition ImGuiMenu.h:326
Vector4f getStoredColor_(const std::string &str, const Color &defaultColor) const
MRVIEWER_API bool simulateNameTagClick(Object &object, NameTagSelectionMode mode)
Behaves as if the user clicked the object name tag, by invoking nameTagClickSignal.
std::weak_ptr< Object > editedFeatureObject_
When editing feature properties, this is the target object.
Definition ImGuiMenu.h:152
virtual MRVIEWER_API void reload_font(int font_size=13)
MRVIEWER_API float drawSelectionInformation_()
MRVIEWER_API bool drawDrawOptionsCheckboxes(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
std::string labelBuffer
Definition ImGuiMenu.h:122
MRVIEWER_API void reserveKeyEvent(ImGuiKey key)
call if you want ImGui to take event if this key is pressed (to prevent scene reaction on key press)
MRVIEWER_API SelectedTypesMask calcSelectedTypesMask(const std::vector< std::shared_ptr< Object > > &selectedObjs)
void enableSavedDialogPositions(bool on)
enables using of saved positions of plugin windows in the config file
Definition ImGuiMenu.h:302
MRVIEWER_API bool simulateNameTagClickWithKeyboardModifiers(Object &object)
This version uses the currently held keyboard modifiers instead of a custom mode.
ImGuiWindow * getLastFocusedPlugin() const
Definition ImGuiMenu.h:229
virtual MRVIEWER_API bool touchpadRotateGestureEnd_() override
InteractionMask
Definition MRIRenderObject.h:77
MRVIEWER_API bool anyImGuiWindowIsHovered() const
Scene pick should be disabled because an ImGui window is in the way.
std::string initName
Definition ImGuiMenu.h:159
MRVIEWER_API float hidpi_scaling()
virtual MRVIEWER_API bool drawTransformContextMenu_(const std::shared_ptr< Object > &)
Definition ImGuiMenu.h:413
std::unique_ptr< UiRenderManagerImpl > uiRenderManager_
This class helps the viewer to renderUi() from IRenderObjects.
Definition ImGuiMenu.h:436
std::string name
Definition ImGuiMenu.h:160
Box3f selectionWorldBox_
updated in drawSelectionInformation_
Definition ImGuiMenu.h:112
virtual MRVIEWER_API std::filesystem::path getMenuFontPath() const
virtual MRVIEWER_API void finishFrame()
call this to draw valid imgui context at the end of the frame
NameTagSelectionMode
Definition ImGuiMenu.h:312
virtual MRVIEWER_API void init(MR::Viewer *_viewer) override
This function is called when the viewer is initialized (no mesh will be loaded at this stage)
ImVec2 mainWindowPos_
Definition ImGuiMenu.h:103
virtual MRVIEWER_API bool spaceMouseMove_(const Vector3f &translate, const Vector3f &rotate) override
Spacemouse events.
MRVIEWER_API bool anyUiObjectIsHovered() const
Scene pick should be disabled because a renderUi() UI of some object is in the way.
virtual MRVIEWER_API bool touchpadRotateGestureUpdate_(float angle) override
NameTagClickSignal nameTagClickSignal
This is triggered whenever a name tag of an object is clicked.
Definition ImGuiMenu.h:320
virtual MRVIEWER_API bool drawCollapsingHeader_(const char *label, ImGuiTreeNodeFlags flags=0)
override this to have custom UI in "Selection Properties" window (under "Draw Options")
virtual MRVIEWER_API void draw_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
std::string lastLabel
Definition ImGuiMenu.h:121
virtual MRVIEWER_API bool touchpadRotateGestureBegin_() override
Touchpad gesture events.
MRVIEWER_API void setUserScaling(float scaling)
sets UI scaling modifier specified by user
MRVIEWER_API bool drawDrawOptionsColors(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs)
MRVIEWER_API ImGuiContext * getCurrentContext() const
DrawSceneUiSignal drawSceneUiSignal
This is called every frame for every viewport. Use this to draw UI bits on top of the scene.
Definition ImGuiMenu.h:328
std::weak_ptr< Object > lastRenameObj_
Definition ImGuiMenu.h:110
virtual MRVIEWER_API void shutdown() override
This function is called before shutdown.
std::string renameBuffer_
Definition ImGuiMenu.h:93
std::shared_ptr< ShortcutManager > shortcutManager_
Definition ImGuiMenu.h:99
virtual MRVIEWER_API void draw_selection_properties_content(const std::vector< std::shared_ptr< Object > > &selected)
std::function< void(void)> callback_draw_custom_window
Definition ImGuiMenu.h:204
MRVIEWER_API void drawComparablePropertiesEditor_(ObjectComparableWithReference &object)
ImVec4 unselectedColor
Definition ImGuiMenu.h:164
TagEditorState tagEditorState_
Definition ImGuiMenu.h:166
virtual MRVIEWER_API void draw_viewer_window()
Can be overwritten by callback_draw_viewer_window
virtual MRVIEWER_API bool touchpadSwipeGestureEnd_() override
virtual MRVIEWER_API void postRescale_(float x, float y) override
@ angle
Direction, normally Vector3f.
@ Single
Definition ImGuiMenu.h:140
@ Vertical
left viewport, right viewport
Definition ImGuiMenu.h:142
@ Horizontal
Definition ImGuiMenu.h:141
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRIRenderObject.h:84
Definition MRViewerEventsListener.h:126
Definition MRColor.h:12
class to subscribe on CursorEntranceSingal
Definition MRViewerEventsListener.h:410
Definition ImGuiMenu.h:120
style constants used for the information panel
Definition ImGuiMenu.h:346
state for the Edit Tag modal dialog
Definition ImGuiMenu.h:158
Definition MRViewerEventsListener.h:144
Definition MRViewerEventsListener.h:153
Definition MRViewerEventsListener.h:135
Definition MRViewerEventsListener.h:54
Definition MRViewerEventsListener.h:72
Definition MRViewerEventsListener.h:81
Definition MRViewerEventsListener.h:63
Definition MRViewerEventsListener.h:32
class to subscribe on PostFocusSingal
Definition MRViewerEventsListener.h:400
Definition MRViewerEventsListener.h:243
Definition MRViewerEventsListener.h:225
class to subscribe on SpaceMouseDownSgnal
Definition MRViewerEventsListener.h:290
class to subscribe on SpaceMouseMoveSignal
Definition MRViewerEventsListener.h:280
Pass this as a second template argument to boost::signals2::signal<...> to stop the execution of hand...
Definition MRSignalCombiners.h:11
class to subscribe on TouchpadRotateGestureBeginEvent
Definition MRViewerEventsListener.h:310
class to subscribe on TouchpadRotateGestureEndEvent
Definition MRViewerEventsListener.h:330
class to subscribe on TouchpadRotateGestureUpdateEvent
Definition MRViewerEventsListener.h:320
class to subscribe on TouchpadSwipeGestureBeginEvent
Definition MRViewerEventsListener.h:340
class to subscribe on TouchpadSwipeGestureEndEvent
Definition MRViewerEventsListener.h:360
class to subscribe on TouchpadSwipeGestureUpdateEvent
Definition MRViewerEventsListener.h:350
class to subscribe on TouchpadZoomGestureBeginEvent
Definition MRViewerEventsListener.h:370
class to subscribe on TouchpadZoomGestureEndEvent
Definition MRViewerEventsListener.h:390
class to subscribe on TouchpadZoomGestureUpdateEvent
Definition MRViewerEventsListener.h:380
Definition MRIRenderObject.h:118