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