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