MeshLib C++ Docs
Loading...
Searching...
No Matches
ImGuiMenu.h
Go to the documentation of this file.
1#pragma once
2#include "MRViewerPlugin.h"
5#include "MRSignalCombiners.h"
6#include "MRShowModal.h"
7#include "imgui.h"
10#include "MRMesh/MRBox.h"
11#include "MRMesh/MRColor.h"
12#include <optional>
13#include <unordered_map>
14
16struct ImGuiContext;
17struct ImGuiWindow;
18
19namespace MR
20{
23
24
25class ShortcutManager;
26class MeshModifier;
27struct UiRenderManager;
30
43
44class MRVIEWER_CLASS ImGuiMenu : public MR::ViewerPlugin,
45 public MultiListener<
53{
54 using ImGuiMenuMultiListener = MultiListener<
62protected:
65
69
71 float userScaling_ = 1.0f;
72
74 ImGuiContext * context_ = nullptr;
76 ImGuiWindow* prevFrameFocusPlugin_ = nullptr;
77
79 bool pollEventsInPreDraw = false;
80
81 bool showShortcuts_{ false };
82 bool showStatistics_{ false };
84 bool showRenameModal_{ false };
85 std::string renameBuffer_;
86 std::string popUpRenameBuffer_;
87 bool needModalBgChange_{ false };
88 bool showInfoModal_{ false };
91 std::shared_ptr<ShortcutManager> shortcutManager_;
92
97
98 MRVIEWER_API virtual void setupShortcuts_();
99
101
102 std::weak_ptr<Object> lastRenameObj_;
105 enum class CoordType : int
106 {
109 } coordType_{ CoordType::Local };
110
112 {
113 std::string lastLabel;
114 std::string labelBuffer;
115 std::shared_ptr<ObjectLabel> obj{ nullptr };
116 } oldLabelParams_;
117
118 bool allowRemoval_{ true };
119 bool uniformScale_{ true };
120 bool xfHistUpdated_{ false };
121 bool invertedRotation_{ false };
122
123 std::optional<std::pair<std::string, Vector4f>> storedColor_;
124 Vector4f getStoredColor_( const std::string& str, const Color& defaultColor ) const;
125
127
128 std::vector<std::shared_ptr<MR::MeshModifier>> modifiers_;
129
137
142
144 std::weak_ptr<Object> editedFeatureObject_;
147
150 {
151 std::string initName;
152 std::string name;
153 bool initHasFrontColor = false;
154 bool hasFrontColor = false;
157 };
160 bool showEditTag_ = false;
162 std::string tagNewName_;
163
164public:
165 MRVIEWER_API static const std::shared_ptr<ImGuiMenu>& instance();
166
167 MRVIEWER_API virtual void init(MR::Viewer *_viewer) override;
168
170 MRVIEWER_API virtual void initBackend();
171
173 MRVIEWER_API virtual void startFrame();
175 MRVIEWER_API virtual void finishFrame();
176
177 MRVIEWER_API virtual void loadFonts( int fontSize = 13 );
178 [[deprecated]] virtual void load_font( int fontSize = 13 ) { loadFonts( fontSize ); }
179
180 MRVIEWER_API virtual void reloadFonts( int fontSize = 13 );
181 [[deprecated]] virtual void reload_font( int fontSize = 13 ) { reloadFonts( fontSize ); }
182
183 MRVIEWER_API virtual void shutdown() override;
184
186 MRVIEWER_API virtual void draw_menu();
187
188 MRVIEWER_API void draw_helpers();
189
191 MRVIEWER_API virtual void drawViewerWindow();
192 [[deprecated]] virtual void draw_viewer_window() { drawViewerWindow(); }
193
195 virtual void drawViewerWindowContent() {}
196
198 virtual void drawAdditionalWindows() {}
199 [[deprecated]] virtual void draw_custom_window() { drawAdditionalWindows(); }
200
201 [[deprecated]] MRVIEWER_API void draw_text(
202 const Viewport& viewport,
203 const Vector3f& pos,
204 const Vector3f& normal,
205 const std::string& text,
206 const Color& color,
207 bool clipByViewport );
208
210 [[deprecated]] void draw_labels_window() { drawLabelsWindow(); }
211
213 MRVIEWER_API float pixelRatio();
214 [[deprecated]] float pixel_ratio() { return pixelRatio(); }
215
217 MRVIEWER_API float hidpiScaling();
218 [[deprecated]] float hidpi_scaling() { return hidpiScaling(); }
219
220 MRVIEWER_API void updateScaling();
221
222 MRVIEWER_API float menuScaling() const;
223 [[deprecated]] MRVIEWER_API float menu_scaling() const;
224
226 float getUserScaling() const { return userScaling_; }
228 MRVIEWER_API void setUserScaling( float scaling );
229
230 MRVIEWER_API ImGuiContext* getCurrentContext() const;
231
232 ImGuiWindow* getLastFocusedPlugin() const { return prevFrameFocusPlugin_; };
233
235 MRVIEWER_API virtual void showModalMessage( const std::string& msg, NotificationType msgType );
236
237 MRVIEWER_API virtual std::filesystem::path getMenuFontPath() const;
238
240 MRVIEWER_API void setDrawTimeMillisecThreshold( long long maxGoodTimeMillisec );
241
243 MRVIEWER_API void draw_scene_list();
245 MRVIEWER_API void draw_scene_list_content( const std::vector<std::shared_ptr<Object>>& selected, const std::vector<std::shared_ptr<Object>>& all );
246
249 MRVIEWER_API virtual void draw_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
252 MRVIEWER_API virtual void draw_selection_properties_content( const std::vector<std::shared_ptr<Object>>& selected );
254
256 MRVIEWER_API virtual bool drawCollapsingHeader_( const char* label, ImGuiTreeNodeFlags flags = 0);
258 MRVIEWER_API virtual bool drawCollapsingHeaderTransform_();
259
260 bool make_visualize_checkbox( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert = false );
261 template<typename ObjectT>
262 void make_color_selector( std::vector<std::shared_ptr<ObjectT>> selectedVisualObjs, const char* label,
263 std::function<Vector4f( const ObjectT* )> getter,
264 std::function<void( ObjectT*, const Vector4f& )> setter );
265 template<typename ObjType,typename ValueT>
266 void make_width( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
267 std::function<ValueT( const ObjType* )> getter,
268 std::function<void( ObjType*, const ValueT& )> setter );
269
270 void make_light_strength( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
271 std::function<float( const VisualObject* )> getter,
272 std::function<void( VisualObject*, const float& )> setter);
273
274 template <typename T, typename ObjectType>
275 void make_slider( std::vector<std::shared_ptr<ObjectType>> selectedVisualObjs, const char* label,
276 std::function<T( const ObjectType* )> getter,
277 std::function<void( ObjectType*, T )> setter, T min, T max );
278
279 void make_points_discretization( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs, const char* label,
280 std::function<int( const ObjectPointsHolder* )> getter,
281 std::function<void( ObjectPointsHolder*, const int& )> setter );
282
283 std::shared_ptr<ShortcutManager> getShortcutManager() { return shortcutManager_; };
284
285 MRVIEWER_API void add_modifier( std::shared_ptr<MR::MeshModifier> modifier );
286
287 MRVIEWER_API void allowSceneReorder( bool allow );
289
290 MRVIEWER_API void allowObjectsRemoval( bool allow );
291
292 MRVIEWER_API void tryRenameSelectedObject();
293
294 MRVIEWER_API void setObjectTreeState( const Object* obj, bool open );
295
297 MRVIEWER_API void expandObjectTreeAndScroll( const Object* obj );
298
300 MRVIEWER_API void setShowShortcuts( bool val );
302 MRVIEWER_API bool getShowShortcuts() const;
303
308
310 MRVIEWER_API virtual UiRenderManager& getUiRenderManager();
311
312 MRVIEWER_API const std::shared_ptr<SceneObjectsListDrawer>& getSceneObjectsList() { return sceneObjectsList_; };
313
321 using NameTagClickSignal = boost::signals2::signal<bool( Object& object, NameTagSelectionMode mode ), StopOnTrueCombiner>;
325 MRVIEWER_API bool simulateNameTagClick( Object& object, NameTagSelectionMode mode );
328
329 using DrawSceneUiSignal = boost::signals2::signal<void( ViewportId viewportId, UiRenderParams::UiTaskList& tasks )>;
332
334 MRVIEWER_API bool anyImGuiWindowIsHovered() const;
336 MRVIEWER_API bool anyUiObjectIsHovered() const;
337
340 MRVIEWER_API SelectedTypesMask calcSelectedTypesMask( const std::vector<std::shared_ptr<Object>>& selectedObjs );
341 MRVIEWER_API bool drawGeneralOptions( const std::vector<std::shared_ptr<Object>>& selectedObjs );
342 MRVIEWER_API bool drawAdvancedOptions( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
343 MRVIEWER_API bool drawRemoveButton( const std::vector<std::shared_ptr<Object>>& selectedObjs );
344 MRVIEWER_API bool drawDrawOptionsCheckboxes( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
345 MRVIEWER_API bool drawDrawOptionsColors( const std::vector<std::shared_ptr<VisualObject>>& selectedObjs );
346
363
364protected:
365 MRVIEWER_API virtual void drawModalMessage_();
366
367 bool capturedMouse_{ false };
369 MRVIEWER_API virtual bool onMouseDown_( MouseButton button, int modifier ) override;
370 MRVIEWER_API virtual bool onMouseUp_( MouseButton button, int modifier ) override;
371 MRVIEWER_API virtual bool onMouseMove_( int mouse_x, int mouse_y ) override;
372 MRVIEWER_API virtual bool onMouseScroll_( float delta_y ) override;
373 MRVIEWER_API virtual void cursorEntrance_( bool entered ) override;
375 MRVIEWER_API virtual bool onCharPressed_( unsigned key, int modifiers ) override;
376 MRVIEWER_API virtual bool onKeyDown_( int key, int modifiers ) override;
377 MRVIEWER_API virtual bool onKeyUp_( int key, int modifiers ) override;
378 MRVIEWER_API virtual bool onKeyRepeat_( int key, int modifiers ) override;
380 MRVIEWER_API virtual void postResize_( int width, int height ) override;
381 MRVIEWER_API virtual void postRescale_( float x, float y) override;
383 MRVIEWER_API virtual bool spaceMouseMove_( const Vector3f& translate, const Vector3f& rotate ) override;
384 MRVIEWER_API virtual bool spaceMouseDown_( int key ) override;
386 MRVIEWER_API virtual bool touchpadRotateGestureBegin_() override;
387 MRVIEWER_API virtual bool touchpadRotateGestureUpdate_( float angle ) override;
388 MRVIEWER_API virtual bool touchpadRotateGestureEnd_() override;
389 MRVIEWER_API virtual bool touchpadSwipeGestureBegin_() override;
390 MRVIEWER_API virtual bool touchpadSwipeGestureUpdate_( float deltaX, float deltaY, bool kinetic ) override;
391 MRVIEWER_API virtual bool touchpadSwipeGestureEnd_() override;
392 MRVIEWER_API virtual bool touchpadZoomGestureBegin_() override;
393 MRVIEWER_API virtual bool touchpadZoomGestureUpdate_( float scale, bool kinetic ) override;
394 MRVIEWER_API virtual bool touchpadZoomGestureEnd_() override;
396 MRVIEWER_API virtual void postFocus_( bool focused ) override;
397
400 MRVIEWER_API virtual void rescaleStyle_();
401
402 MRVIEWER_API float drawSelectionInformation_();
403 MRVIEWER_API void drawFeaturePropertiesEditor_( const std::shared_ptr<Object>& object );
404
406
408 MRVIEWER_API virtual void drawCustomSelectionInformation_( const std::vector<std::shared_ptr<Object>>& selected, const SelectionInformationStyle& style );
409
410 MRVIEWER_API virtual void draw_custom_selection_properties( const std::vector<std::shared_ptr<Object>>& selected );
411
412 MRVIEWER_API void drawTagInformation_( const std::vector<std::shared_ptr<Object>>& selected );
413
414 MRVIEWER_API float drawTransform_();
415
416 MRVIEWER_API virtual bool drawTransformContextMenu_( const std::shared_ptr<Object>& ) { return false; }
417
419 MRVIEWER_API virtual void drawShortcutsWindow_();
421 MRVIEWER_API float getSceneInfoItemWidth_( int itemCount = 1 );
422
424 {
425 public:
426 MRVIEWER_API void preRenderViewport( ViewportId viewport ) override;
427 MRVIEWER_API void postRenderViewport( ViewportId viewport ) override;
429 MRVIEWER_API void finishBackwardPass( ViewportId viewport, const BasicUiRenderTask::BackwardPassParams& params ) override;
430
433
436 MRVIEWER_API bool canConsumeEvent( BasicUiRenderTask::InteractionMask event ) const;
437 };
438
439 std::unique_ptr<UiRenderManagerImpl> uiRenderManager_;
440 std::shared_ptr<SceneObjectsListDrawer> sceneObjectsList_;
441};
442
443
445MRVIEWER_API void reserveKeyEvent( ImGuiKey key );
446
447
448}
#define MR_MAKE_FLAG_OPERATORS(T)
Generates operators for a enum (at namespace scope).
Definition MRFlagOperators.h:6
Definition MRVisualObject.h:53
Definition ImGuiMenu.h:424
Definition ImGuiMenu.h:53
Definition MRMeshModifier.h:14
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
class for drawing a list of scene objects (and handling interaction with it)
Definition MRSceneObjectsListDrawer.h:19
Definition MRShortcutManager.h:47
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:115
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::shared_ptr< ObjectLabel > obj
Definition ImGuiMenu.h:115
virtual bool touchpadSwipeGestureUpdate_(float deltaX, float deltaY, bool kinetic) override
bool showShortcuts_
be careful here with true, this can cause infinite recurse
Definition ImGuiMenu.h:81
std::string storedModalMessage_
Definition ImGuiMenu.h:89
virtual bool touchpadRotateGestureEnd_() override
SelectedTypesMask
Definition ImGuiMenu.h:32
bool showRenameModal_
Definition ImGuiMenu.h:84
virtual void setupShortcuts_()
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:353
bool simulateNameTagClickWithKeyboardModifiers(Object &object)
This version uses the currently held keyboard modifiers instead of a custom mode.
BasicUiRenderTask::BackwardPassParams beginBackwardPass(ViewportId viewport, UiRenderParams::UiTaskList &tasks) override
virtual void draw_custom_window()
Definition ImGuiMenu.h:199
void draw_labels_window()
Definition ImGuiMenu.h:210
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)
bool drawGeneralOptions(const std::vector< std::shared_ptr< Object > > &selectedObjs)
void expandObjectTreeAndScroll(const Object *obj)
expands all objs parents in tree and scroll scene tree window so selection becomes visible
boost::signals2::signal< bool(Object &object, NameTagSelectionMode mode), StopOnTrueCombiner > NameTagClickSignal
Definition ImGuiMenu.h:321
virtual void loadFonts(int fontSize=13)
MouseButton
Definition MRMouse.h:12
Color textColor
value text color
Definition ImGuiMenu.h:351
virtual bool spaceMouseMove_(const Vector3f &translate, const Vector3f &rotate) override
Spacemouse events.
ImVec2 sceneWindowSize_
Definition ImGuiMenu.h:94
virtual void postResize_(int width, int height) override
Scene events.
virtual void finishFrame()
call this to draw valid imgui context at the end of the frame
float drawSelectionInformation_()
float getUserScaling() const
returns UI scaling modifier specified by user
Definition ImGuiMenu.h:226
virtual void drawModalMessage_()
bool xfHistUpdated_
Definition ImGuiMenu.h:120
ImGuiContext * getCurrentContext() const
ViewportId selectedViewport_
menu will change objects' colors in this viewport
Definition ImGuiMenu.h:141
void add_modifier(std::shared_ptr< MR::MeshModifier > modifier)
float pixel_ratio()
Definition ImGuiMenu.h:214
CoordType
Definition ImGuiMenu.h:106
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)
void setShowShortcuts(bool val)
set show shortcuts state (enable / disable)
ViewportConfigurations
Definition ImGuiMenu.h:131
float menu_scaling() const
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)
ImVec2 mainWindowSize_
Definition ImGuiMenu.h:96
virtual void reloadFonts(int fontSize=13)
void preRenderViewport(ViewportId viewport) override
This is called before doing IRenderObject::renderUi() on even object in a viewport....
virtual bool onMouseScroll_(float delta_y) override
bool anyUiObjectIsHovered() const
Scene pick should be disabled because a renderUi() UI of some object is in the way.
virtual bool onKeyRepeat_(int key, int modifiers) override
virtual void postFocus_(bool focused) override
Other events.
bool isSavedDialogPositionsEnabled() const
returns true if enabled using of saved positions of plugin windows in the config file,...
Definition ImGuiMenu.h:307
NotificationType
Definition MRNotificationType.h:10
enum MR::ImGuiMenu::ViewportConfigurations Single
void setDrawTimeMillisecThreshold(long long maxGoodTimeMillisec)
setup maximum good time for frame rendering (if rendering is slower it will become red in statistics ...
std::optional< std::pair< std::string, Vector4f > > storedColor_
Definition ImGuiMenu.h:123
std::string popUpRenameBuffer_
Definition ImGuiMenu.h:86
void draw_scene_list()
Draw scene list window with content.
bool invertedRotation_
Definition ImGuiMenu.h:121
void tryRenameSelectedObject()
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)
const std::shared_ptr< SceneObjectsListDrawer > & getSceneObjectsList()
Definition ImGuiMenu.h:312
std::string searchPluginsString_
Definition ImGuiMenu.h:126
float hidpiScaling()
Computes scaling factor for hidpi devices.
bool needModalBgChange_
Definition ImGuiMenu.h:87
ImVec2 sceneWindowPos_
Definition ImGuiMenu.h:93
void draw_text(const Viewport &viewport, const Vector3f &pos, const Vector3f &normal, const std::string &text, const Color &color, bool clipByViewport)
ImGuiContext * context_
ImGui Context.
Definition ImGuiMenu.h:74
Box3f selectionLocalBox_
Definition ImGuiMenu.h:103
void updateScaling()
virtual void initBackend()
inits glfw and glsl backend
ImVec4 selectedColor
Definition ImGuiMenu.h:155
long long frameTimeMillisecThreshold_
Definition ImGuiMenu.h:83
void allowObjectsRemoval(bool allow)
virtual void postRescale_(float x, float y) override
std::shared_ptr< ShortcutManager > getShortcutManager()
Definition ImGuiMenu.h:283
std::string tagNewName_
buffer string for the tag name input widget
Definition ImGuiMenu.h:162
float itemWidth
value item width
Definition ImGuiMenu.h:357
void drawTagInformation_(const std::vector< std::shared_ptr< Object > > &selected)
virtual bool drawTransformContextMenu_(const std::shared_ptr< Object > &)
Definition ImGuiMenu.h:416
bool drawAdvancedOptions(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
bool savedDialogPositionEnabled_
Definition ImGuiMenu.h:100
AffineXf3f editedFeatureObjectOldXf_
When editing feature properties, this is the original xf of the target object, for history purposes.
Definition ImGuiMenu.h:146
virtual bool touchpadZoomGestureBegin_() override
virtual bool drawCollapsingHeaderTransform_()
override this to customize appearance of collapsing headers for transform block
bool capturedMouse_
Definition ImGuiMenu.h:367
virtual bool onCharPressed_(unsigned key, int modifiers) override
Keyboard IO.
Color selectedTextColor
selected value text color
Definition ImGuiMenu.h:355
bool drawDrawOptionsColors(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs)
std::shared_ptr< SceneObjectsListDrawer > sceneObjectsList_
Definition ImGuiMenu.h:440
std::vector< std::shared_ptr< BasicUiRenderTask > > UiTaskList
Definition MRIRenderObject.h:111
void setObjectTreeState(const Object *obj, bool open)
BasicUiRenderTask::InteractionMask consumedInteractions
Which things are blocked by our renderUi() calls.
Definition ImGuiMenu.h:432
float pixelRatio_
Definition ImGuiMenu.h:68
float item2Width
value item width for two-segment field
Definition ImGuiMenu.h:359
std::vector< std::shared_ptr< MR::MeshModifier > > modifiers_
Definition ImGuiMenu.h:128
virtual void drawAdditionalWindows()
override this instead using callback_draw_custom_window
Definition ImGuiMenu.h:198
void postRenderViewport(ViewportId viewport) override
This is called after doing IRenderObject::renderUi() on even object in a viewport....
virtual void startFrame()
call this to validate imgui context in the begining of the frame
bool checkPossibilityObjectRemoval()
Definition ImGuiMenu.h:288
virtual void drawViewerWindowContent()
override this instead using callback_draw_viewer_menu
Definition ImGuiMenu.h:195
void drawComparablePropertiesEditor_(ObjectComparableWithReference &object)
boost::signals2::signal< void(ViewportId viewportId, UiRenderParams::UiTaskList &tasks)> DrawSceneUiSignal
Definition ImGuiMenu.h:329
virtual bool touchpadSwipeGestureEnd_() override
Vector4f getStoredColor_(const std::string &str, const Color &defaultColor) const
std::weak_ptr< Object > editedFeatureObject_
When editing feature properties, this is the target object.
Definition ImGuiMenu.h:144
virtual UiRenderManager & getUiRenderManager()
This class helps the viewer to renderUi() from IRenderObjects.
enum MR::ImGuiMenu::CoordType Local
virtual std::filesystem::path getMenuFontPath() const
virtual bool onMouseDown_(MouseButton button, int modifier) override
Mouse IO.
virtual void drawShortcutsWindow_()
A virtual function for drawing of the dialog with shortcuts. It can be overriden in the inherited cla...
bool drawDrawOptionsCheckboxes(const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
virtual bool touchpadZoomGestureEnd_() override
std::string labelBuffer
Definition ImGuiMenu.h:114
virtual void draw_viewer_window()
Definition ImGuiMenu.h:192
bool showInfoModal_
Definition ImGuiMenu.h:88
virtual bool onKeyDown_(int key, int modifiers) override
void drawLabelsWindow()
virtual void showModalMessage(const std::string &msg, NotificationType msgType)
opens Error / Warning / Info modal window with message text
void enableSavedDialogPositions(bool on)
enables using of saved positions of plugin windows in the config file
Definition ImGuiMenu.h:305
virtual void draw_custom_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
virtual bool drawCollapsingHeader_(const char *label, ImGuiTreeNodeFlags flags=0)
override this to have custom UI in "Selection Properties" window (under "Draw Options")
bool canConsumeEvent(BasicUiRenderTask::InteractionMask event) const
ImGuiWindow * getLastFocusedPlugin() const
Definition ImGuiMenu.h:232
virtual bool onMouseMove_(int mouse_x, int mouse_y) override
virtual bool touchpadSwipeGestureBegin_() override
virtual void init(MR::Viewer *_viewer) override
This function is called when the viewer is initialized (no mesh will be loaded at this stage)
float userScaling_
user defined additional scaling modifier
Definition ImGuiMenu.h:71
void drawFeaturePropertiesEditor_(const std::shared_ptr< Object > &object)
bool drawRemoveButton(const std::vector< std::shared_ptr< Object > > &selectedObjs)
virtual void reload_font(int fontSize=13)
Definition ImGuiMenu.h:181
virtual void drawViewerWindow()
override this instead using callback_draw_viewer_window
void setUserScaling(float scaling)
sets UI scaling modifier specified by user
bool showStatistics_
Definition ImGuiMenu.h:82
virtual void shutdown() override
This function is called before shutdown.
float menuScaling() const
InteractionMask
Definition MRIRenderObject.h:77
virtual void drawCustomSelectionInformation_(const std::vector< std::shared_ptr< Object > > &selected, const SelectionInformationStyle &style)
draw additional selection information (e.g. for custom objects)
static const std::shared_ptr< ImGuiMenu > & instance()
bool getShowShortcuts() const
return show shortcuts state (enable / disable)
void draw_helpers()
virtual void draw_selection_properties_content(const std::vector< std::shared_ptr< Object > > &selected)
std::string initName
Definition ImGuiMenu.h:151
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.
float item3Width
value item width for three-segment field
Definition ImGuiMenu.h:361
std::unique_ptr< UiRenderManagerImpl > uiRenderManager_
This class helps the viewer to renderUi() from IRenderObjects.
Definition ImGuiMenu.h:439
std::string name
Definition ImGuiMenu.h:152
Box3f selectionWorldBox_
updated in drawSelectionInformation_
Definition ImGuiMenu.h:104
virtual bool touchpadRotateGestureUpdate_(float angle) override
virtual void load_font(int fontSize=13)
Definition ImGuiMenu.h:178
bool selectionChangedToSingleObj_
flag to correctly update scroll on transform window appearing
Definition ImGuiMenu.h:139
void allowSceneReorder(bool allow)
bool allowRemoval_
Definition ImGuiMenu.h:118
float drawTransform_()
SelectedTypesMask calcSelectedTypesMask(const std::vector< std::shared_ptr< Object > > &selectedObjs)
NameTagSelectionMode
Definition ImGuiMenu.h:315
ImVec2 mainWindowPos_
Definition ImGuiMenu.h:95
float pixelRatio()
Computes pixel ratio for hidpi devices.
bool anyImGuiWindowIsHovered() const
Scene pick should be disabled because an ImGui window is in the way.
virtual bool spaceMouseDown_(int key) override
NameTagClickSignal nameTagClickSignal
This is triggered whenever a name tag of an object is clicked.
Definition ImGuiMenu.h:323
bool pollEventsInPreDraw
if true, then pre_draw will start from polling glfw events
Definition ImGuiMenu.h:79
virtual bool onMouseUp_(MouseButton button, int modifier) override
float hidpi_scaling()
Definition ImGuiMenu.h:218
virtual bool onKeyUp_(int key, int modifiers) override
std::string lastLabel
Definition ImGuiMenu.h:113
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 void rescaleStyle_()
virtual bool touchpadRotateGestureBegin_() override
Touchpad gesture events.
bool simulateNameTagClick(Object &object, NameTagSelectionMode mode)
Behaves as if the user clicked the object name tag, by invoking nameTagClickSignal.
virtual void draw_selection_properties(const std::vector< std::shared_ptr< Object > > &selected)
DrawSceneUiSignal drawSceneUiSignal
This is called every frame for every viewport. Use this to draw UI bits on top of the scene.
Definition ImGuiMenu.h:331
std::weak_ptr< Object > lastRenameObj_
Definition ImGuiMenu.h:102
virtual bool touchpadZoomGestureUpdate_(float scale, bool kinetic) override
std::string renameBuffer_
Definition ImGuiMenu.h:85
float hidpiScale_
Hidpi scaling to be used for text rendering.
Definition ImGuiMenu.h:64
bool hasFrontColor
Definition ImGuiMenu.h:154
Vector3f normal(const MeshTopology &topology, const VertCoords &points, FaceId f)
computes triangular face normal from its vertices
Definition MRMeshMath.h:224
virtual void draw_menu()
Draw menu.
ImGuiWindow * prevFrameFocusPlugin_
last focused plugin window
Definition ImGuiMenu.h:76
virtual void cursorEntrance_(bool entered) override
bool showEditTag_
whether to open the Edit Tag modal dialog
Definition ImGuiMenu.h:160
std::shared_ptr< ShortcutManager > shortcutManager_
Definition ImGuiMenu.h:91
float getSceneInfoItemWidth_(int itemCount=1)
returns width of items in Scene Info window
void reserveKeyEvent(ImGuiKey key)
call if you want ImGui to take event if this key is pressed (to prevent scene reaction on key press)
ImVec4 unselectedColor
Definition ImGuiMenu.h:156
TagEditorState tagEditorState_
Definition ImGuiMenu.h:158
bool initHasFrontColor
Definition ImGuiMenu.h:153
bool uniformScale_
Definition ImGuiMenu.h:119
NotificationType modalMessageType_
Definition ImGuiMenu.h:90
@ ObjectMeasurementBit
Definition ImGuiMenu.h:40
@ ObjectMeshBit
Definition ImGuiMenu.h:38
@ ObjectLabelBit
Definition ImGuiMenu.h:37
@ ObjectMeshHolderBit
Definition ImGuiMenu.h:36
@ ObjectLinesHolderBit
Definition ImGuiMenu.h:35
@ ObjectFeatureBit
Definition ImGuiMenu.h:39
@ ObjectBit
Definition ImGuiMenu.h:33
@ ObjectPointsHolderBit
Definition ImGuiMenu.h:34
@ angle
Direction, normally Vector3f.
Definition MRFeatureObject.h:26
@ World
Definition ImGuiMenu.h:108
@ Vertical
left viewport, right viewport
Definition ImGuiMenu.h:134
@ Horizontal
Definition ImGuiMenu.h:133
@ Quad
lower viewport, upper viewport
Definition ImGuiMenu.h:135
@ Error
Definition MRNotificationType.h:11
@ toggle
Ctrl+Click, toggles the selection of one object.
Definition ImGuiMenu.h:319
@ selectOne
Click without modifiers, selects one object and unselects all others.
Definition ImGuiMenu.h:317
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:112
style constants used for the information panel
Definition ImGuiMenu.h:349
state for the Edit Tag modal dialog
Definition ImGuiMenu.h:150
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