13#include <unordered_map>
109 } coordType_{ CoordType::Local };
115 std::shared_ptr<ObjectLabel>
obj{
nullptr };
136 } viewportConfig_{ Single };
165 MRVIEWER_API
static const std::shared_ptr<ImGuiMenu>&
instance();
177 MRVIEWER_API
virtual void loadFonts(
int fontSize = 13 );
205 const std::string& text,
207 bool clipByViewport );
245 MRVIEWER_API
void draw_scene_list_content(
const std::vector<std::shared_ptr<Object>>& selected,
const std::vector<std::shared_ptr<Object>>& all );
261 template<
typename ObjectT>
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 );
270 void make_light_strength( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs,
const char* label,
272 std::function<
void(
VisualObject*,
const float& )> setter);
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 );
285 MRVIEWER_API
void add_modifier( std::shared_ptr<MR::MeshModifier> modifier );
343 MRVIEWER_API
bool drawRemoveButton(
const std::vector<std::shared_ptr<Object>>& selectedObjs );
371 MRVIEWER_API
virtual bool onMouseMove_(
int mouse_x,
int mouse_y )
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;
383 MRVIEWER_API
virtual bool spaceMouseMove_(
const Vector3f& translate,
const Vector3f& rotate )
override;
396 MRVIEWER_API
virtual void postFocus_(
bool focused )
override;
#define MR_MAKE_FLAG_OPERATORS(T)
Generates operators for a enum (at namespace scope).
Definition MRFlagOperators.h:6
Definition MRVisualObject.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
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
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)
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
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 ¶ms) 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
class to subscribe on CursorEntranceSingal
Definition MRViewerEventsListener.h:410
Definition MRViewerEventsListener.h:144
Definition MRViewerEventsListener.h:153
Definition MRViewerEventsListener.h:135
Definition MRViewerEventsListener.h:54
Definition MRViewerEventsListener.h:72
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