MeshLib
 
Loading...
Searching...
No Matches
ImGuiMenu.h
Go to the documentation of this file.
1#pragma once
2// This file is part of libigl, a simple c++ geometry processing library.
3//
4// Copyright (C) 2018 Jérémie Dumas <jeremie.dumas@ens-lyon.org>
5//
6// This Source Code Form is subject to the terms of the Mozilla Public License
7// v. 2.0. If a copy of the MPL was not distributed with this file, You can
8// obtain one at http://mozilla.org/MPL/2.0/.
9
11#include "MRViewerPlugin.h"
13#include "MRStatePlugin.h"
14#include "MRNotificationType.h"
15#include <unordered_map>
16#include "MRMesh/MRIRenderObject.h" //only for BasicUiRenderTask::BackwardPassParams
17#include "MRMesh/MRBox.h"
19
20// Forward declarations
21struct ImGuiContext;
22struct ImGuiWindow;
23
24namespace MR
25{
26
27class ShortcutManager;
28class MeshModifier;
29struct UiRenderManager;
30class SceneObjectsListDrawer;
31
33{
34 ObjectBit = 1 << 0,
35 ObjectPointsHolderBit = 1 << 1,
36 ObjectLinesHolderBit = 1 << 2,
37 ObjectMeshHolderBit = 1 << 3,
38 ObjectLabelBit = 1 << 4,
39 ObjectMeshBit = 1 << 5,
40 ObjectFeatureBit = 1 << 6,
41 ObjectMeasurementBit = 1 << 7,
42};
44
45class MRVIEWER_CLASS ImGuiMenu : public MR::ViewerPlugin,
46 public MultiListener<
54{
63protected:
64 // Hidpi scaling to be used for text rendering.
66
67 // Ratio between the framebuffer size and the window size.
68 // May be different from the hipdi scaling!
70
71 // ImGui Context
72 ImGuiContext * context_ = nullptr;
73 // last focused plugin window
74 ImGuiWindow* prevFrameFocusPlugin_ = nullptr;
75
76 // if true, then pre_draw will start from polling glfw events
77 bool pollEventsInPreDraw = false; // be careful here with true, this can cause infinite recurse
78
79 bool showShortcuts_{ false };
80 bool showStatistics_{ false };
81 long long frameTimeMillisecThreshold_{ 25 };
82 bool showRenameModal_{ false };
83 std::string renameBuffer_;
84 std::string popUpRenameBuffer_;
85 bool needModalBgChange_{ false };
86 bool showInfoModal_{ false };
89 std::shared_ptr<ShortcutManager> shortcutManager_;
90
95
96 MRVIEWER_API virtual void setupShortcuts_();
97
98 bool savedDialogPositionEnabled_{ false };
99
100 std::weak_ptr<Object> lastRenameObj_;
101 Box3f selectionBbox_; // updated in drawSelectionInformation_
103
105 {
106 std::string lastLabel;
107 std::string labelBuffer;
108 std::shared_ptr<ObjectLabel> obj{ nullptr };
109 } oldLabelParams_;
110
111 bool allowRemoval_{ true };
112 bool uniformScale_{ true };
113 bool xfHistUpdated_{ false };
114 bool invertedRotation_{ false };
115
116 std::optional<std::pair<std::string, Vector4f>> storedColor_;
117 Vector4f getStoredColor_( const std::string& str, const Color& defaultColor ) const;
118
119 mutable struct PluginsCache
120 {
121 // if cache is valid do nothing, otherwise accumulate all custom plugins in tab sections and sort them by special string
122 void validate( const std::vector<ViewerPlugin*>& viewerPlugins );
123 // finds enabled custom plugin, nullptr if none is
125 const std::vector<StateBasePlugin*>& getTabPlugins( StatePluginTabs tab ) const;
126 private:
127 std::array<std::vector<StateBasePlugin*>, size_t( StatePluginTabs::Count )> sortedCustomPlufins_;
128 std::vector<ViewerPlugin*> allPlugins_; // to validate
129 } pluginsCache_;
130
132
133 std::vector<std::shared_ptr<MR::MeshModifier>> modifiers_;
134
136 {
138 Horizontal, // left viewport, right viewport
139 Vertical, // lower viewport, upper viewport
140 Quad // left lower vp, left upper vp, right lower vp, right upper vp
141 } viewportConfig_{ Single };
142
143 // flag to correctly update scroll on transform window appearing
144 bool selectionChangedToSingleObj_{ false };
145 // menu will change objects' colors in this viewport
146 ViewportId selectedViewport_ = {};
147
148 // When editing feature properties, this is the target object.
149 std::weak_ptr<Object> editedFeatureObject_;
150 // When editing feature properties, this is the original xf of the target object, for history purposes.
152
153public:
154 MRVIEWER_API static const std::shared_ptr<ImGuiMenu>& instance();
155
156 MRVIEWER_API virtual void init(MR::Viewer *_viewer) override;
157
158 // inits glfw and glsl backend
159 MRVIEWER_API virtual void initBackend();
160
161 // call this to validate imgui context in the begining of the frame
162 MRVIEWER_API virtual void startFrame();
163 // call this to draw valid imgui context at the end of the frame
164 MRVIEWER_API virtual void finishFrame();
165
166 MRVIEWER_API virtual void load_font(int font_size = 13);
167 MRVIEWER_API virtual void reload_font(int font_size = 13);
168
169 MRVIEWER_API virtual void shutdown() override;
170
171 // Draw menu
172 MRVIEWER_API virtual void draw_menu();
173
174 MRVIEWER_API void draw_helpers();
175
176 // Can be overwritten by `callback_draw_viewer_window`
177 MRVIEWER_API virtual void draw_viewer_window();
178
179 MRVIEWER_API void draw_mr_menu();
180
181 // Can be overwritten by `callback_draw_viewer_menu`
182 //virtual void draw_viewer_menu();
183
184 // Can be overwritten by `callback_draw_custom_window`
185 virtual void draw_custom_window() {}
186
187 // Easy-to-customize callbacks
188 std::function<void(void)> callback_draw_viewer_window;
189 std::function<void(void)> callback_draw_viewer_menu;
190 std::function<void(void)> callback_draw_custom_window;
191
193
194 void draw_labels( const VisualObject& obj );
195
196 MRVIEWER_API void draw_text(
197 const Viewport& viewport,
198 const Vector3f& pos,
199 const Vector3f& normal,
200 const std::string& text,
201 const Color& color,
202 bool clipByViewport );
203
204 MRVIEWER_API float pixel_ratio();
205
206 MRVIEWER_API float hidpi_scaling();
207
208 MRVIEWER_API float menu_scaling() const;
209
210 MRVIEWER_API ImGuiContext* getCurrentContext() const;
211
212 ImGuiWindow* getLastFocusedPlugin() const { return prevFrameFocusPlugin_; };
213
214 // opens Error / Warning / Info modal window with message text
215 MRVIEWER_API void showModalMessage( const std::string& msg, NotificationType msgType );
216
217 MRVIEWER_API virtual std::filesystem::path getMenuFontPath() const;
218
219 // setup maximum good time for frame rendering (if rendering is slower it will become red in statistics window)
220 MRVIEWER_API void setDrawTimeMillisecThreshold( long long maxGoodTimeMillisec );
221
222 // Draw scene list window with content
223 MRVIEWER_API void draw_scene_list();
224 // Draw scene list content only
225 MRVIEWER_API void draw_scene_list_content( const std::vector<std::shared_ptr<Object>>& selected, const std::vector<std::shared_ptr<Object>>& all );
226
227 // override this to have custom "Selection Properties" window
228 // draw window with content
229 MRVIEWER_API virtual void draw_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
230 // override this to have custom "Selection Properties" content
231 // draw content only
232 MRVIEWER_API virtual void draw_selection_properties_content( const std::vector<std::shared_ptr<Object>>& selected );
233 // override this to have custom UI in "Selection Properties" window (under "Draw Options")
234
235 // override this to customize appearance of collapsing headers
236 MRVIEWER_API virtual bool drawCollapsingHeader_( const char* label, ImGuiTreeNodeFlags flags = 0);
237 // override this to customize appearance of collapsing headers for transform block
238 MRVIEWER_API virtual bool drawCollapsingHeaderTransform_();
239
240 bool make_visualize_checkbox( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert = false );
241 template<typename ObjectT>
242 void make_color_selector( std::vector<std::shared_ptr<ObjectT>> selectedVisualObjs, const char* label,
243 std::function<Vector4f( const ObjectT* )> getter,
244 std::function<void( ObjectT*, const Vector4f& )> setter );
245 template<typename ObjType>
246 void make_width( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
247 std::function<float( const ObjType* )> getter,
248 std::function<void( ObjType*, const float& )> setter );
249
250 void make_light_strength( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
251 std::function<float( const VisualObject* )> getter,
252 std::function<void( VisualObject*, const float& )> setter);
253
254 template <typename T, typename ObjectType>
255 void make_slider( std::vector<std::shared_ptr<ObjectType>> selectedVisualObjs, const char* label,
256 std::function<T( const ObjectType* )> getter,
257 std::function<void( ObjectType*, T )> setter, T min, T max );
258
259 void make_points_discretization( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
260 std::function<int( const ObjectPointsHolder* )> getter,
261 std::function<void( ObjectPointsHolder*, const int& )> setter );
262
263 MRVIEWER_API void draw_custom_plugins();
264
265 std::shared_ptr<ShortcutManager> getShortcutManager() { return shortcutManager_; };
266
267 MRVIEWER_API void add_modifier( std::shared_ptr<MR::MeshModifier> modifier );
268
269 MRVIEWER_API void allowSceneReorder( bool allow );
270 bool checkPossibilityObjectRemoval() { return allowRemoval_; };
271
272 MRVIEWER_API void allowObjectsRemoval( bool allow );
273
274 MRVIEWER_API void tryRenameSelectedObject();
275
276 MRVIEWER_API void setObjectTreeState( const Object* obj, bool open );
277
278 //set show shortcuts state (enable / disable)
279 MRVIEWER_API void setShowShortcuts( bool val );
280 //return show shortcuts state (enable / disable)
281 MRVIEWER_API bool getShowShortcuts() const;
282
283 // enables using of saved positions of plugin windows in the config file
284 void enableSavedDialogPositions( bool on ) { savedDialogPositionEnabled_ = on; }
285 // returns true if enabled using of saved positions of plugin windows in the config file, false otherwise
286 bool isSavedDialogPositionsEnabled() const { return savedDialogPositionEnabled_; }
287
288 // This class helps the viewer to `renderUi()` from `IRenderObject`s.
289 MRVIEWER_API virtual UiRenderManager& getUiRenderManager();
290
291 MRVIEWER_API const std::shared_ptr<SceneObjectsListDrawer>& getSceneObjectsList() { return sceneObjectsList_; };
292
294 {
295 // Click without modifiers, selects one object and unselects all others.
296 selectOne,
297 // Ctrl+Click, toggles the selection of one object.
298 toggle,
299 };
300 using NameTagClickSignal = boost::signals2::signal<bool( Object& object, NameTagSelectionMode mode ), StopOnTrueCombiner>;
301 // This is triggered whenever a name tag of an object is clicked.
303 // Behaves as if the user clicked the object name tag, by invoking `nameTagClickSignal`.
304 MRVIEWER_API bool simulateNameTagClick( Object& object, NameTagSelectionMode mode );
305
306 using DrawSceneUiSignal = boost::signals2::signal<void( float menuScaling, ViewportId viewportId, UiRenderParams::UiTaskList& tasks )>;
307 // This is called every frame for every viewport. Use this to draw UI bits on top of the scene.
309
310 // Scene pick should be disabled because an ImGui window is in the way.
311 MRVIEWER_API bool anyImGuiWindowIsHovered() const;
312 // Scene pick should be disabled because a `renderUi()` UI of some object is in the way.
313 MRVIEWER_API bool anyUiObjectIsHovered() const;
314
315 // ======== selected objects options drawing
316 // getting the mask of the list of selected objects
317 MRVIEWER_API SelectedTypesMask calcSelectedTypesMask( const std::vector<std::shared_ptr<Object>>& selectedObjs );
318 MRVIEWER_API bool drawGeneralOptions( const std::vector<std::shared_ptr<Object>>& selectedObjs );
319 MRVIEWER_API bool drawAdvancedOptions( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
320 MRVIEWER_API bool drawRemoveButton( const std::vector<std::shared_ptr<Object>>& selectedObjs );
321 MRVIEWER_API bool drawDrawOptionsCheckboxes( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
322 MRVIEWER_API bool drawDrawOptionsColors( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs );
323protected:
324 MRVIEWER_API virtual void drawModalMessage_();
325
326 bool capturedMouse_{ false };
327 // Mouse IO
328 MRVIEWER_API virtual bool onMouseDown_( MouseButton button, int modifier ) override;
329 MRVIEWER_API virtual bool onMouseUp_( MouseButton button, int modifier ) override;
330 MRVIEWER_API virtual bool onMouseMove_( int mouse_x, int mouse_y ) override;
331 MRVIEWER_API virtual bool onMouseScroll_( float delta_y ) override;
332 MRVIEWER_API virtual void cursorEntrance_( bool entered ) override;
333 // Keyboard IO
334 MRVIEWER_API virtual bool onCharPressed_( unsigned key, int modifiers ) override;
335 MRVIEWER_API virtual bool onKeyDown_( int key, int modifiers ) override;
336 MRVIEWER_API virtual bool onKeyUp_( int key, int modifiers ) override;
337 MRVIEWER_API virtual bool onKeyRepeat_( int key, int modifiers ) override;
338 // Scene events
339 MRVIEWER_API virtual void postResize_( int width, int height ) override;
340 MRVIEWER_API virtual void postRescale_( float x, float y) override;
341 // Spacemouse events
342 MRVIEWER_API virtual bool spaceMouseMove_( const Vector3f& translate, const Vector3f& rotate ) override;
343 MRVIEWER_API virtual bool spaceMouseDown_( int key ) override;
344 // Touchpad gesture events
345 MRVIEWER_API virtual bool touchpadRotateGestureBegin_() override;
346 MRVIEWER_API virtual bool touchpadRotateGestureUpdate_( float angle ) override;
347 MRVIEWER_API virtual bool touchpadRotateGestureEnd_() override;
348 MRVIEWER_API virtual bool touchpadSwipeGestureBegin_() override;
349 MRVIEWER_API virtual bool touchpadSwipeGestureUpdate_( float deltaX, float deltaY, bool kinetic ) override;
350 MRVIEWER_API virtual bool touchpadSwipeGestureEnd_() override;
351 MRVIEWER_API virtual bool touchpadZoomGestureBegin_() override;
352 MRVIEWER_API virtual bool touchpadZoomGestureUpdate_( float scale, bool kinetic ) override;
353 MRVIEWER_API virtual bool touchpadZoomGestureEnd_() override;
354
355 // This function reset ImGui style to current theme and scale it by menu_scaling
356 // called in ImGuiMenu::postRescale_()
357 MRVIEWER_API virtual void rescaleStyle_();
358
359 MRVIEWER_API virtual void addMenuFontRanges_( ImFontGlyphRangesBuilder& builder ) const;
360
361 MRVIEWER_API float drawSelectionInformation_();
362 MRVIEWER_API void drawFeaturePropertiesEditor_( const std::shared_ptr<Object>& object );
363
364
365 MRVIEWER_API virtual void draw_custom_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
366
367 MRVIEWER_API float drawTransform_();
368
369 MRVIEWER_API virtual bool drawTransformContextMenu_( const std::shared_ptr<Object>& /*selected*/ ) { return false; }
370
372
374
375 // A virtual function for drawing of the dialog with shortcuts. It can be overriden in the inherited classes
376 MRVIEWER_API virtual void drawShortcutsWindow_();
377 // returns width of items in Scene Info window
378 MRVIEWER_API float getSceneInfoItemWidth_( int itemCount = 1 );
379
381 {
382 public:
383 MRVIEWER_API void preRenderViewport( ViewportId viewport ) override;
384 MRVIEWER_API void postRenderViewport( ViewportId viewport ) override;
386 MRVIEWER_API void finishBackwardPass( const BasicUiRenderTask::BackwardPassParams& params ) override;
387
388 // Which things are blocked by our `renderUi()` calls.
390
391 // If this returns false, the event should be allowed to pass through to other plugins, even if ImGui wants to consume it.
392 // Pass at most one bit at a time.
393 MRVIEWER_API bool canConsumeEvent( BasicUiRenderTask::InteractionMask event ) const;
394 };
395 // This class helps the viewer to `renderUi()` from `IRenderObject`s.
396 std::unique_ptr<UiRenderManagerImpl> uiRenderManager_;
397 std::shared_ptr<SceneObjectsListDrawer> sceneObjectsList_;
398};
399
400
401// Check if menu is available and if it is, shows modal window
402MRVIEWER_API void showModal( const std::string& error, NotificationType type );
403inline void showError( const std::string& error )
404{
406}
407
408// call if you want ImGui to take event if this key is pressed (to prevent scene reaction on key press)
409MRVIEWER_API void reserveKeyEvent( ImGuiKey key );
410
411
412} // end namespace
#define MR_MAKE_FLAG_OPERATORS(T)
Definition MRFlagOperators.h:6
Definition MRVisualObject.h:67
Definition ImGuiMenu.h:381
MRVIEWER_API BasicUiRenderTask::BackwardPassParams beginBackwardPass(ViewportId viewport, UiRenderParams::UiTaskList &tasks) override
MRVIEWER_API void postRenderViewport(ViewportId viewport) override
MRVIEWER_API bool canConsumeEvent(BasicUiRenderTask::InteractionMask event) const
MRVIEWER_API void preRenderViewport(ViewportId viewport) override
MRVIEWER_API void finishBackwardPass(const BasicUiRenderTask::BackwardPassParams &params) override
Definition ImGuiMenu.h:54
std::string storedModalMessage_
Definition ImGuiMenu.h:87
MRVIEWER_API void draw_helpers()
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)
MRVIEWER_API const std::shared_ptr< SceneObjectsListDrawer > & getSceneObjectsList()
Definition ImGuiMenu.h:291
virtual void draw_custom_window()
Definition ImGuiMenu.h:185
void draw_labels_window()
virtual MRVIEWER_API void 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:300
virtual MRVIEWER_API UiRenderManager & getUiRenderManager()
virtual MRVIEWER_API void setupShortcuts_()
virtual MRVIEWER_API void postResize_(int width, int height) override
virtual MRVIEWER_API bool touchpadSwipeGestureBegin_() override
ImVec2 sceneWindowSize_
Definition ImGuiMenu.h:92
MRVIEWER_API void draw_scene_list_content(const std::vector< std::shared_ptr< Object > > &selected, const std::vector< std::shared_ptr< Object > > &all)
virtual MRVIEWER_API void drawShortcutsWindow_()
MRVIEWER_API bool drawAdvancedOptions(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
virtual MRVIEWER_API bool onMouseScroll_(float delta_y) override
bool make_visualize_checkbox(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert=false)
void draw_labels(const VisualObject &obj)
boost::signals2::signal< void(float menuScaling, ViewportId viewportId, UiRenderParams::UiTaskList &tasks)> DrawSceneUiSignal
Definition ImGuiMenu.h:306
ViewportConfigurations
Definition ImGuiMenu.h:136
@ Single
Definition ImGuiMenu.h:137
@ Vertical
Definition ImGuiMenu.h:139
@ Horizontal
Definition ImGuiMenu.h:138
MRVIEWER_API float drawTransform_()
virtual MRVIEWER_API void initBackend()
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:94
bool isSavedDialogPositionsEnabled() const
Definition ImGuiMenu.h:286
virtual MRVIEWER_API bool onKeyRepeat_(int key, int modifiers) override
virtual MRVIEWER_API bool spaceMouseDown_(int key) override
virtual MRVIEWER_API void load_font(int font_size=13)
std::optional< std::pair< std::string, Vector4f > > storedColor_
Definition ImGuiMenu.h:116
MRVIEWER_API void allowSceneReorder(bool allow)
std::string popUpRenameBuffer_
Definition ImGuiMenu.h:84
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
Definition ImGuiMenu.h:188
std::string searchPluginsString_
Definition ImGuiMenu.h:131
virtual MRVIEWER_API bool drawCollapsingHeaderTransform_()
ImVec2 sceneWindowPos_
Definition ImGuiMenu.h:91
MRVIEWER_API void draw_scene_list()
MRVIEWER_API bool drawGeneralOptions(const std::vector< std::shared_ptr< Object > > &selectedObjs)
float hidpi_scaling_
Definition ImGuiMenu.h:65
MRVIEWER_API void draw_mr_menu()
std::function< void(void)> callback_draw_viewer_menu
Definition ImGuiMenu.h:189
virtual MRVIEWER_API bool onMouseDown_(MouseButton button, int modifier) override
MRVIEWER_API void add_modifier(std::shared_ptr< MR::MeshModifier > modifier)
std::shared_ptr< ShortcutManager > getShortcutManager()
Definition ImGuiMenu.h:265
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)
virtual MRVIEWER_API void drawModalMessage_()
AffineXf3f editedFeatureObjectOldXf_
Definition ImGuiMenu.h:151
MRVIEWER_API float menu_scaling() const
virtual MRVIEWER_API bool touchpadZoomGestureUpdate_(float scale, bool kinetic) override
MRVIEWER_API void setDrawTimeMillisecThreshold(long long maxGoodTimeMillisec)
virtual MRVIEWER_API bool onMouseMove_(int mouse_x, int mouse_y) override
virtual MRVIEWER_API void addMenuFontRanges_(ImFontGlyphRangesBuilder &builder) const
MRVIEWER_API bool getShowShortcuts() const
virtual MRVIEWER_API bool onKeyUp_(int key, int modifiers) override
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
MRVIEWER_API void allowObjectsRemoval(bool allow)
std::shared_ptr< SceneObjectsListDrawer > sceneObjectsList_
Definition ImGuiMenu.h:397
virtual MRVIEWER_API void draw_custom_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
MRVIEWER_API bool drawRemoveButton(const std::vector< std::shared_ptr< Object > > &selectedObjs)
float pixel_ratio_
Definition ImGuiMenu.h:69
MRVIEWER_API void setShowShortcuts(bool val)
std::vector< std::shared_ptr< MR::MeshModifier > > modifiers_
Definition ImGuiMenu.h:133
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:270
virtual MRVIEWER_API void startFrame()
static MRVIEWER_API const std::shared_ptr< ImGuiMenu > & instance()
Vector4f getStoredColor_(const std::string &str, const Color &defaultColor) const
MRVIEWER_API bool simulateNameTagClick(Object &object, NameTagSelectionMode mode)
std::weak_ptr< Object > editedFeatureObject_
Definition ImGuiMenu.h:149
virtual MRVIEWER_API void reload_font(int font_size=13)
void make_width(std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, std::function< float(const ObjType *)> getter, std::function< void(ObjType *, const float &)> setter)
void draw_history_block_()
MRVIEWER_API float drawSelectionInformation_()
MRVIEWER_API bool drawDrawOptionsCheckboxes(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
MRVIEWER_API SelectedTypesMask calcSelectedTypesMask(const std::vector< std::shared_ptr< Object > > &selectedObjs)
void enableSavedDialogPositions(bool on)
Definition ImGuiMenu.h:284
ImGuiWindow * getLastFocusedPlugin() const
Definition ImGuiMenu.h:212
virtual MRVIEWER_API bool touchpadRotateGestureEnd_() override
MRVIEWER_API bool anyImGuiWindowIsHovered() const
void draw_open_recent_button_()
MRVIEWER_API float hidpi_scaling()
virtual MRVIEWER_API bool drawTransformContextMenu_(const std::shared_ptr< Object > &)
Definition ImGuiMenu.h:369
std::unique_ptr< UiRenderManagerImpl > uiRenderManager_
Definition ImGuiMenu.h:396
Box3f selectionWorldBox_
Definition ImGuiMenu.h:102
virtual MRVIEWER_API std::filesystem::path getMenuFontPath() const
virtual MRVIEWER_API void finishFrame()
NameTagSelectionMode
Definition ImGuiMenu.h:294
virtual MRVIEWER_API void init(MR::Viewer *_viewer) override
ImVec2 mainWindowPos_
Definition ImGuiMenu.h:93
virtual MRVIEWER_API bool spaceMouseMove_(const Vector3f &translate, const Vector3f &rotate) override
MRVIEWER_API bool anyUiObjectIsHovered() const
virtual MRVIEWER_API bool touchpadRotateGestureUpdate_(float angle) override
NameTagClickSignal nameTagClickSignal
Definition ImGuiMenu.h:302
virtual MRVIEWER_API bool drawCollapsingHeader_(const char *label, ImGuiTreeNodeFlags flags=0)
virtual MRVIEWER_API void draw_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
Box3f selectionBbox_
Definition ImGuiMenu.h:101
virtual MRVIEWER_API bool touchpadRotateGestureBegin_() override
MRVIEWER_API bool drawDrawOptionsColors(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs)
MRVIEWER_API void showModalMessage(const std::string &msg, NotificationType msgType)
MRVIEWER_API ImGuiContext * getCurrentContext() const
MRVIEWER_API void draw_custom_plugins()
DrawSceneUiSignal drawSceneUiSignal
Definition ImGuiMenu.h:308
std::weak_ptr< Object > lastRenameObj_
Definition ImGuiMenu.h:100
virtual MRVIEWER_API void shutdown() override
std::string renameBuffer_
Definition ImGuiMenu.h:83
std::shared_ptr< ShortcutManager > shortcutManager_
Definition ImGuiMenu.h:89
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:190
virtual MRVIEWER_API void draw_viewer_window()
virtual MRVIEWER_API bool touchpadSwipeGestureEnd_() override
virtual MRVIEWER_API void postRescale_(float x, float y) override
Definition MRObjectPointsHolder.h:18
named object in the data model
Definition MRObject.h:60
Definition MRStatePlugin.h:78
Definition MRViewerPlugin.h:27
Definition MRViewer.h:80
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:38
Definition MRViewport.h:49
Visual Object.
Definition MRVisualObject.h:131
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
auto width(const Box< V > &box)
returns size along x axis
Definition MRMesh/MRBox.h:230
auto height(const Box< V > &box)
returns size along y axis
Definition MRMesh/MRBox.h:237
Definition MRCameraOrientationPlugin.h:7
MRVIEWER_API void showModal(const std::string &error, NotificationType type)
SelectedTypesMask
Definition ImGuiMenu.h:33
MouseButton
Definition MRMouse.h:9
NotificationType
Definition MRNotificationType.h:7
void showError(const std::string &error)
Definition ImGuiMenu.h:403
StatePluginTabs
Definition MRStatePlugin.h:58
MRVIEWER_API void reserveKeyEvent(ImGuiKey key)
Definition MRIRenderObject.h:80
InteractionMask
Definition MRIRenderObject.h:73
Definition MRViewerEventsListener.h:123
Definition MRColor.h:9
class to subscribe on CursorEntranceSingal
Definition MRViewerEventsListener.h:380
Definition ImGuiMenu.h:105
std::string labelBuffer
Definition ImGuiMenu.h:107
std::string lastLabel
Definition ImGuiMenu.h:106
Definition ImGuiMenu.h:120
void validate(const std::vector< ViewerPlugin * > &viewerPlugins)
const std::vector< StateBasePlugin * > & getTabPlugins(StatePluginTabs tab) const
StateBasePlugin * findEnabled() const
Definition MRViewerEventsListener.h:141
Definition MRViewerEventsListener.h:150
Definition MRViewerEventsListener.h:132
Definition MRViewerEventsListener.h:51
Definition MRViewerEventsListener.h:69
Definition MRViewerEventsListener.h:78
Definition MRViewerEventsListener.h:60
Definition MRViewerEventsListener.h:29
Definition MRViewerEventsListener.h:213
Definition MRViewerEventsListener.h:195
class to subscribe on SpaceMouseDownSgnal
Definition MRViewerEventsListener.h:260
class to subscribe on SpaceMouseMoveSignal
Definition MRViewerEventsListener.h:250
Definition MRSignalCombiners.h:8
class to subscribe on TouchpadRotateGestureBeginEvent
Definition MRViewerEventsListener.h:280
class to subscribe on TouchpadRotateGestureEndEvent
Definition MRViewerEventsListener.h:300
class to subscribe on TouchpadRotateGestureUpdateEvent
Definition MRViewerEventsListener.h:290
class to subscribe on TouchpadSwipeGestureBeginEvent
Definition MRViewerEventsListener.h:310
class to subscribe on TouchpadSwipeGestureEndEvent
Definition MRViewerEventsListener.h:330
class to subscribe on TouchpadSwipeGestureUpdateEvent
Definition MRViewerEventsListener.h:320
class to subscribe on TouchpadZoomGestureBeginEvent
Definition MRViewerEventsListener.h:340
class to subscribe on TouchpadZoomGestureEndEvent
Definition MRViewerEventsListener.h:360
class to subscribe on TouchpadZoomGestureUpdateEvent
Definition MRViewerEventsListener.h:350
Definition MRIRenderObject.h:117
std::vector< std::shared_ptr< BasicUiRenderTask > > UiTaskList
Definition MRIRenderObject.h:110