MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRViewer/MRRibbonMenu.h>

Inheritance diagram for MR::RibbonMenu:

Classes

struct  DialogItemPtr
struct  DrawGroupConfig
 Configuration of ribbon group. More...

Public Types

using TabChangedSignal = boost::signals2::signal<void( int prevTabId, int newTabId )>
Public Types inherited from MR::ImGuiMenu
enum class  NameTagSelectionMode { NameTagSelectionMode::selectOne , NameTagSelectionMode::toggle }
using NameTagClickSignal = boost::signals2::signal<bool( Object& object, NameTagSelectionMode mode ), StopOnTrueCombiner>
using DrawSceneUiSignal = boost::signals2::signal<void( ViewportId viewportId, UiRenderParams::UiTaskList& tasks )>

Public Member Functions

 RibbonMenu ()
 ~RibbonMenu ()
void setCustomContextCheckbox (const std::string &name, CustomContextMenuCheckbox customContextMenuCheckbox)
virtual void init (MR::Viewer *_viewer) override
 This function is called when the viewer is initialized (no mesh will be loaded at this stage)
virtual void shutdown () override
 This function is called before shutdown.
virtual void drawViewerWindow () override
 override this instead using callback_draw_viewer_window
virtual void drawAdditionalWindows () override
 override this instead using callback_draw_custom_window
void openToolbarCustomize ()
 open Toolbar Customize modal popup
virtual void loadFonts (int font_size=13) override
virtual std::filesystem::path getMenuFontPath () const override
virtual void pinTopPanel (bool on)
 set top panel pinned and unpinned
bool isTopPannelPinned () const
int getTopPanelOpenedHeight () const
 this functions allow you to get top panel height (before scaling)
int getTopPanelHiddenHeight () const
int getTopPanelCurrentHeight () const
void setTopPanelMaxOpenedTimer (float sec)
virtual void setQuickAccessListVersion (int version)
 set quick access menu item list version
virtual void readQuickAccessList (const Json::Value &root)
 read quick access menu items list from json
void resetQuickAccessList ()
 reset quick access menu items list to default
Vector2i getSceneSize ()
 get Scene List window size
void setSceneSize (const Vector2i &size)
 set Scene List window size
bool hasActiveBlockingItem () const
 returns true if any blocking plugin is now active
bool hasAnyActiveItem () const
 returns true if any plugin is now active
void updateItemStatus (const std::string &itemName)
 updates status of item if it was changed outside of menu
int getActiveTabIndex () const
 returns index of active tab in RibbonSchemaHolder::schema().tabsOrder
RibbonFontManagergetFontManager ()
 get access to Ribbon font manager
RibbonButtonDrawergetRibbonButtonDrawer ()
 get access to Ribbon button drawer
ToolbargetToolbar ()
 get access to Ribbon Toolbar
RibbonNotifiergetRibbonNotifier ()
 get access to Ribbon notifier
void setActiveListPos (const ImVec2 &pos)
void showActiveList ()
 set active plugins list showed
virtual void pushNotification (const RibbonNotification &notification)
bool getAutoCloseBlockingPlugins () const
 returns flag defining if closing plugin on opening another one is enabled
void setAutoCloseBlockingPlugins (bool value)
 sets flag defining if closing plugin on opening another one is enabled or not
const RibbonMenuUIConfiggetMenuUIConfig () const
 returns current menu ui configuration (find more in RibbonMenuUIConfig comments)
virtual void setMenuUIConfig (const RibbonMenuUIConfig &newConfig)
bool drawGroupUngroupButton (const std::vector< std::shared_ptr< Object > > &selected)
 ======== selected objects options drawing
bool drawSelectSubtreeButton (const std::vector< std::shared_ptr< Object > > &selected)
bool drawCloneButton (const std::vector< std::shared_ptr< Object > > &selected)
bool drawCustomCheckBox (const std::vector< std::shared_ptr< Object > > &selected, SelectedTypesMask selectedMask)
bool drawCloneSelectionButton (const std::vector< std::shared_ptr< Object > > &selected)
bool drawMergeSubtreeButton (const std::vector< std::shared_ptr< Object > > &selected)
Public Member Functions inherited from MR::ImGuiMenu
virtual void initBackend ()
 inits glfw and glsl backend
virtual void startFrame ()
 call this to validate imgui context in the begining of the frame
virtual void finishFrame ()
 call this to draw valid imgui context at the end of the frame
virtual void load_font (int fontSize=13)
virtual void reloadFonts (int fontSize=13)
virtual void reload_font (int fontSize=13)
virtual void draw_menu ()
 Draw menu.
void draw_helpers ()
virtual void draw_viewer_window ()
virtual void drawViewerWindowContent ()
 override this instead using callback_draw_viewer_menu
virtual void draw_custom_window ()
void draw_text (const Viewport &viewport, const Vector3f &pos, const Vector3f &normal, const std::string &text, const Color &color, bool clipByViewport)
void drawLabelsWindow ()
void draw_labels_window ()
float pixelRatio ()
 Computes pixel ratio for hidpi devices.
float pixel_ratio ()
float hidpiScaling ()
 Computes scaling factor for hidpi devices.
float hidpi_scaling ()
void updateScaling ()
float menuScaling () const
float menu_scaling () const
float getUserScaling () const
 returns UI scaling modifier specified by user
void setUserScaling (float scaling)
 sets UI scaling modifier specified by user
ImGuiContext * getCurrentContext () const
ImGuiWindow * getLastFocusedPlugin () const
virtual void showModalMessage (const std::string &msg, NotificationType msgType)
 opens Error / Warning / Info modal window with message text
void setDrawTimeMillisecThreshold (long long maxGoodTimeMillisec)
 setup maximum good time for frame rendering (if rendering is slower it will become red in statistics window)
void draw_scene_list ()
 Draw scene list window with content.
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.
virtual void draw_selection_properties (const std::vector< std::shared_ptr< Object > > &selected)
virtual void draw_selection_properties_content (const std::vector< std::shared_ptr< Object > > &selected)
bool make_visualize_checkbox (std::vector< std::shared_ptr< VisualObject > > selectedVisualObjs, const char *label, AnyVisualizeMaskEnum type, MR::ViewportMask viewportid, bool invert=false)
template<typename ObjectT>
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)
template<typename ObjType, typename ValueT>
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)
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)
template<typename T, typename ObjectType>
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)
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)
std::shared_ptr< ShortcutManagergetShortcutManager ()
void add_modifier (std::shared_ptr< MR::MeshModifier > modifier)
void allowSceneReorder (bool allow)
bool checkPossibilityObjectRemoval ()
void allowObjectsRemoval (bool allow)
void tryRenameSelectedObject ()
void setObjectTreeState (const Object *obj, bool open)
void expandObjectTreeAndScroll (const Object *obj)
 expands all objs parents in tree and scroll scene tree window so selection becomes visible
void setShowShortcuts (bool val)
 set show shortcuts state (enable / disable)
bool getShowShortcuts () const
 return show shortcuts state (enable / disable)
void enableSavedDialogPositions (bool on)
 enables using of saved positions of plugin windows in the config file
bool isSavedDialogPositionsEnabled () const
 returns true if enabled using of saved positions of plugin windows in the config file, false otherwise
virtual UiRenderManagergetUiRenderManager ()
 This class helps the viewer to renderUi() from IRenderObjects.
const std::shared_ptr< SceneObjectsListDrawer > & getSceneObjectsList ()
bool simulateNameTagClick (Object &object, NameTagSelectionMode mode)
 Behaves as if the user clicked the object name tag, by invoking nameTagClickSignal.
bool simulateNameTagClickWithKeyboardModifiers (Object &object)
 This version uses the currently held keyboard modifiers instead of a custom mode.
bool anyImGuiWindowIsHovered () const
 Scene pick should be disabled because an ImGui window is in the way.
bool anyUiObjectIsHovered () const
 Scene pick should be disabled because a renderUi() UI of some object is in the way.
SelectedTypesMask calcSelectedTypesMask (const std::vector< std::shared_ptr< Object > > &selectedObjs)
bool drawGeneralOptions (const std::vector< std::shared_ptr< Object > > &selectedObjs)
bool drawAdvancedOptions (const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
bool drawRemoveButton (const std::vector< std::shared_ptr< Object > > &selectedObjs)
bool drawDrawOptionsCheckboxes (const std::vector< std::shared_ptr< VisualObject > > &selectedObjs, SelectedTypesMask selectedMask)
bool drawDrawOptionsColors (const std::vector< std::shared_ptr< VisualObject > > &selectedObjs)
Public Member Functions inherited from MR::ViewerPlugin
virtual ~ViewerPlugin ()
Public Member Functions inherited from MR::MultiListener< MouseDownListener, MouseMoveListener, MouseUpListener, MouseScrollListener, CursorEntranceListener, CharPressedListener, KeyDownListener, KeyUpListener, KeyRepeatListener, SpaceMouseMoveListener, SpaceMouseDownListener, TouchpadRotateGestureBeginListener, TouchpadRotateGestureUpdateListener, TouchpadRotateGestureEndListener, TouchpadSwipeGestureBeginListener, TouchpadSwipeGestureUpdateListener, TouchpadSwipeGestureEndListener, TouchpadZoomGestureBeginListener, TouchpadZoomGestureUpdateListener, TouchpadZoomGestureEndListener, PostResizeListener, PostRescaleListener, PostFocusListener >
virtual ~MultiListener ()=default
virtual void connect (Viewer *viewer, int group=0, boost::signals2::connect_position pos=boost::signals2::connect_position::at_back)
virtual void disconnect ()

Static Public Member Functions

static std::shared_ptr< RibbonMenuinstance ()
 returns RibonMenu from ViewerInstance()
static void cloneTree (const std::vector< std::shared_ptr< Object > > &selectedObjects)
 clones given objects with sub-objects (except for ancillary and unrecognized children) and undo
static void cloneSelectedPart (const std::shared_ptr< Object > &object)
 clones selected part of given object as separate object (faces, points)
Static Public Member Functions inherited from MR::ImGuiMenu
static const std::shared_ptr< ImGuiMenu > & instance ()

Public Attributes

TabChangedSignal tabChangedSignal
 this signal is called when active tab changes
Public Attributes inherited from MR::ImGuiMenu
NameTagClickSignal nameTagClickSignal
 This is triggered whenever a name tag of an object is clicked.
DrawSceneUiSignal drawSceneUiSignal
 This is called every frame for every viewport. Use this to draw UI bits on top of the scene.

Protected Types

using DrawTabConfig = std::vector<DrawGroupConfig>
Protected Types inherited from MR::ImGuiMenu
enum class  CoordType : int { CoordType::Local , CoordType::World }
enum  ViewportConfigurations { Single , Horizontal , Vertical , Quad }

Protected Member Functions

virtual void drawBigButtonItem_ (const MenuItemInfo &item)
 draw single item
virtual void drawSmallButtonsSet_ (const std::vector< std::string > &group, int setFrontIndex, int setLength, bool withText)
 draw set of small text buttons
virtual DrawTabConfig setupItemsGroupConfig_ (const std::vector< std::string > &groupsInTab, const std::string &tabName, bool centerItems)
 draw group of items
virtual void setupItemsGroup_ (const std::vector< std::string > &groupsInTab, const std::string &tabName, bool centerItems)
virtual void drawItemsGroup_ (const std::string &tabName, const std::string &groupName, DrawGroupConfig config)
virtual bool itemPressed_ (const std::shared_ptr< RibbonMenuItem > &item, const std::string &requiremetnsHint={})
virtual std::string getRequirements_ (const std::shared_ptr< RibbonMenuItem > &item) const
 returns requirements line for given tool, empty line means that tool is available
virtual void drawActiveBlockingDialog_ ()
virtual void drawActiveNonBlockingDialogs_ ()
virtual void postResize_ (int width, int height) override
 Scene events.
virtual void postRescale_ (float x, float y) override
virtual void drawItemDialog_ (DialogItemPtr &itemPtr)
virtual void drawTopPanel_ (bool drawTabs=true, bool centerItems=false)
 Draw ribbon top panel.
virtual void drawRibbonSceneList_ ()
 Draw scene list window with content.
virtual Vector2f drawRibbonSceneResizeLine_ ()
virtual void drawRibbonViewportsLabels_ ()
 Draw viewport id and projection type for all viewporrts.
virtual void drawRibbonSceneInformation_ (const std::vector< std::shared_ptr< Object > > &selected)
virtual bool drawCollapsingHeaderTransform_ () override
 override this to customize appearance of collapsing headers for transform block
virtual bool drawTransformContextMenu_ (const std::shared_ptr< Object > &selected) override
virtual void addRibbonItemShortcut_ (const std::string &itemName, const ShortcutKey &key, ShortcutCategory category)
virtual void setupShortcuts_ () override
virtual void drawShortcutsWindow_ () override
 A virtual function for drawing of the dialog with shortcuts. It can be overriden in the inherited classes.
virtual void readMenuItemsStructure_ ()
 reads files with panel description
virtual bool drawCollapsingHeader_ (const char *label, ImGuiTreeNodeFlags flags=0) override
 override this to have custom UI in "Selection Properties" window (under "Draw Options")
virtual void highlightBlocking_ ()
virtual void drawSceneListButtons_ ()
 draw scene list buttons
virtual void fixViewportsSize_ (int w, int h)
 updates viewport sizes with respect to ribbon top and left panels
void drawActiveList_ ()
 need to be called if you override windows pipeline and use ActiveListPlugin
virtual void drawNotifications_ ()
 call this to draw RibbonNotifier with respect of scene size and ribbon top panel
virtual void updateTopPanelSize_ (bool drawTabs)
 this function changes internal sizes of topPanel when it is enabled or disabled
virtual void drawHeaderQuickAccess_ ()
 draw quick access bar at header level
virtual float drawHeaderHelpers_ (float requiredTabSize)
virtual void drawActiveListButton_ (float btnSize)
 helper list of active tools
virtual void drawSearchButton_ ()
 header helper search bar at panel
virtual void drawCollapseButton_ ()
 header helper button to pin/unpin ribbon
virtual void drawHelpButton_ (const std::string &url)
 header helper button link to help page
Protected Member Functions inherited from MR::ImGuiMenu
Vector4f getStoredColor_ (const std::string &str, const Color &defaultColor) const
virtual void drawModalMessage_ ()
virtual bool onMouseDown_ (MouseButton button, int modifier) override
 Mouse IO.
virtual bool onMouseUp_ (MouseButton button, int modifier) override
virtual bool onMouseMove_ (int mouse_x, int mouse_y) override
virtual bool onMouseScroll_ (float delta_y) override
virtual void cursorEntrance_ (bool entered) override
virtual bool onCharPressed_ (unsigned key, int modifiers) override
 Keyboard IO.
virtual bool onKeyDown_ (int key, int modifiers) override
virtual bool onKeyUp_ (int key, int modifiers) override
virtual bool onKeyRepeat_ (int key, int modifiers) override
virtual bool spaceMouseMove_ (const Vector3f &translate, const Vector3f &rotate) override
 Spacemouse events.
virtual bool spaceMouseDown_ (int key) override
virtual bool touchpadRotateGestureBegin_ () override
 Touchpad gesture events.
virtual bool touchpadRotateGestureUpdate_ (float angle) override
virtual bool touchpadRotateGestureEnd_ () override
virtual bool touchpadSwipeGestureBegin_ () override
virtual bool touchpadSwipeGestureUpdate_ (float deltaX, float deltaY, bool kinetic) override
virtual bool touchpadSwipeGestureEnd_ () override
virtual bool touchpadZoomGestureBegin_ () override
virtual bool touchpadZoomGestureUpdate_ (float scale, bool kinetic) override
virtual bool touchpadZoomGestureEnd_ () override
virtual void postFocus_ (bool focused) override
 Other events.
virtual void rescaleStyle_ ()
float drawSelectionInformation_ ()
void drawFeaturePropertiesEditor_ (const std::shared_ptr< Object > &object)
void drawComparablePropertiesEditor_ (ObjectComparableWithReference &object)
virtual void drawCustomSelectionInformation_ (const std::vector< std::shared_ptr< Object > > &selected, const SelectionInformationStyle &style)
 draw additional selection information (e.g. for custom objects)
virtual void draw_custom_selection_properties (const std::vector< std::shared_ptr< Object > > &selected)
void drawTagInformation_ (const std::vector< std::shared_ptr< Object > > &selected)
float drawTransform_ ()
float getSceneInfoItemWidth_ (int itemCount=1)
 returns width of items in Scene Info window

Protected Attributes

DialogItemPtr activeBlockingItem_
std::vector< DialogItemPtractiveNonBlockingItems_
std::vector< std::shared_ptr< const Object > > prevFrameSelectedObjectsCache_
RibbonMenuSearch searcher_
Protected Attributes inherited from MR::ImGuiMenu
float hidpiScale_
 Hidpi scaling to be used for text rendering.
float pixelRatio_
float userScaling_ = 1.0f
 user defined additional scaling modifier
ImGuiContext * context_ = nullptr
 ImGui Context.
ImGuiWindow * prevFrameFocusPlugin_ = nullptr
 last focused plugin window
bool pollEventsInPreDraw = false
 if true, then pre_draw will start from polling glfw events
bool showShortcuts_ { false }
 be careful here with true, this can cause infinite recurse
bool showStatistics_ { false }
long long frameTimeMillisecThreshold_ { 25 }
bool showRenameModal_ { false }
std::string renameBuffer_
std::string popUpRenameBuffer_
bool needModalBgChange_ { false }
bool showInfoModal_ { false }
std::string storedModalMessage_
NotificationType modalMessageType_ { NotificationType::Error }
std::shared_ptr< ShortcutManagershortcutManager_
ImVec2 sceneWindowPos_
ImVec2 sceneWindowSize_
ImVec2 mainWindowPos_
ImVec2 mainWindowSize_
bool savedDialogPositionEnabled_ { false }
std::weak_ptr< ObjectlastRenameObj_
Box3f selectionLocalBox_
Box3f selectionWorldBox_
 updated in drawSelectionInformation_
enum MR::ImGuiMenu::CoordType Local
struct MR::ImGuiMenu::LabelParams oldLabelParams_
bool allowRemoval_ { true }
bool uniformScale_ { true }
bool xfHistUpdated_ { false }
bool invertedRotation_ { false }
std::optional< std::pair< std::string, Vector4f > > storedColor_
std::string searchPluginsString_
std::vector< std::shared_ptr< MR::MeshModifier > > modifiers_
enum MR::ImGuiMenu::ViewportConfigurations Single
bool selectionChangedToSingleObj_ { false }
 flag to correctly update scroll on transform window appearing
ViewportId selectedViewport_ = {}
 menu will change objects' colors in this viewport
std::weak_ptr< ObjecteditedFeatureObject_
 When editing feature properties, this is the target object.
AffineXf3f editedFeatureObjectOldXf_
 When editing feature properties, this is the original xf of the target object, for history purposes.
TagEditorState tagEditorState_
bool showEditTag_ = false
 whether to open the Edit Tag modal dialog
std::string tagNewName_
 buffer string for the tag name input widget
bool capturedMouse_ { false }
std::unique_ptr< UiRenderManagerImpluiRenderManager_
 This class helps the viewer to renderUi() from IRenderObjects.
std::shared_ptr< SceneObjectsListDrawersceneObjectsList_
Protected Attributes inherited from MR::ViewerPlugin
Viewerviewer = &getViewerInstance()
 Pointer to the main Viewer class.

Detailed Description

Class to control and render ribbon-style menu stores menu items, menu structure is provided by menuItemsStructure.json file (parsed on init)


The documentation for this class was generated from the following file: