76 float userScaling_ = 1.0f;
79 ImGuiContext * context_ =
nullptr;
81 ImGuiWindow* prevFrameFocusPlugin_ =
nullptr;
84 bool pollEventsInPreDraw =
false;
86 bool showShortcuts_{
false };
87 bool showStatistics_{
false };
88 long long frameTimeMillisecThreshold_{ 25 };
89 bool showRenameModal_{
false };
90 std::string renameBuffer_;
91 std::string popUpRenameBuffer_;
92 bool needModalBgChange_{
false };
93 bool showInfoModal_{
false };
94 std::string storedModalMessage_;
95 NotificationType modalMessageType_{ NotificationType::Error };
96 std::shared_ptr<ShortcutManager> shortcutManager_;
98 ImVec2 sceneWindowPos_;
99 ImVec2 sceneWindowSize_;
100 ImVec2 mainWindowPos_;
101 ImVec2 mainWindowSize_;
103 MRVIEWER_API
virtual void setupShortcuts_();
105 bool savedDialogPositionEnabled_{
false };
107 std::weak_ptr<Object> lastRenameObj_;
108 Box3f selectionBbox_;
109 Box3f selectionWorldBox_;
113 std::string lastLabel;
114 std::string labelBuffer;
115 std::shared_ptr<ObjectLabel> obj{
nullptr };
118 bool allowRemoval_{
true };
119 bool uniformScale_{
true };
120 bool xfHistUpdated_{
false };
121 bool invertedRotation_{
false };
123 std::optional<std::pair<std::string, Vector4f>> storedColor_;
124 Vector4f getStoredColor_(
const std::string& str,
const Color& defaultColor )
const;
126 std::string searchPluginsString_;
128 std::vector<std::shared_ptr<MR::MeshModifier>> modifiers_;
130 enum ViewportConfigurations
136 } viewportConfig_{ Single };
139 bool selectionChangedToSingleObj_{
false };
141 ViewportId selectedViewport_ = {};
144 std::weak_ptr<Object> editedFeatureObject_;
146 AffineXf3f editedFeatureObjectOldXf_;
151 std::string initName;
153 bool initHasFrontColor =
false;
154 bool hasFrontColor =
false;
155 ImVec4 selectedColor;
156 ImVec4 unselectedColor;
160 bool showEditTag_ =
false;
162 std::string tagNewName_;
165 MRVIEWER_API
static const std::shared_ptr<ImGuiMenu>& instance();
167 MRVIEWER_API
virtual void init(
MR::Viewer *_viewer)
override;
170 MRVIEWER_API
virtual void initBackend();
173 MRVIEWER_API
virtual void startFrame();
175 MRVIEWER_API
virtual void finishFrame();
177 MRVIEWER_API
virtual void load_font(
int font_size = 13);
178 MRVIEWER_API
virtual void reload_font(
int font_size = 13);
180 MRVIEWER_API
virtual void shutdown()
override;
183 MRVIEWER_API
virtual void draw_menu();
185 MRVIEWER_API
void draw_helpers();
188 MRVIEWER_API
virtual void draw_viewer_window();
191 virtual void draw_custom_window() {}
194 std::function<void(
void)> callback_draw_viewer_window;
195 std::function<void(
void)> callback_draw_viewer_menu;
196 std::function<void(
void)> callback_draw_custom_window;
198 void draw_labels_window();
200 MRVIEWER_API
void draw_text(
204 const std::string& text,
206 bool clipByViewport );
208 MRVIEWER_API
float pixel_ratio();
210 MRVIEWER_API
float hidpi_scaling();
212 MRVIEWER_API
float menu_scaling()
const;
215 float getUserScaling()
const {
return userScaling_; }
217 MRVIEWER_API
void setUserScaling(
float scaling );
219 MRVIEWER_API ImGuiContext* getCurrentContext()
const;
221 ImGuiWindow* getLastFocusedPlugin()
const {
return prevFrameFocusPlugin_; };
224 MRVIEWER_API
virtual void showModalMessage(
const std::string& msg, NotificationType msgType );
226 MRVIEWER_API
virtual std::filesystem::path getMenuFontPath()
const;
229 MRVIEWER_API
void setDrawTimeMillisecThreshold(
long long maxGoodTimeMillisec );
232 MRVIEWER_API
void draw_scene_list();
234 MRVIEWER_API
void draw_scene_list_content(
const std::vector<std::shared_ptr<Object>>& selected,
const std::vector<std::shared_ptr<Object>>& all );
238 MRVIEWER_API
virtual void draw_selection_properties(
const std::vector<std::shared_ptr<Object>>& selected );
241 MRVIEWER_API
virtual void draw_selection_properties_content(
const std::vector<std::shared_ptr<Object>>& selected );
245 MRVIEWER_API
virtual bool drawCollapsingHeader_(
const char* label, ImGuiTreeNodeFlags flags = 0);
247 MRVIEWER_API
virtual bool drawCollapsingHeaderTransform_();
249 bool make_visualize_checkbox( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs,
const char* label, AnyVisualizeMaskEnum type,
MR::ViewportMask viewportid,
bool invert =
false );
250 template<
typename ObjectT>
251 void make_color_selector( std::vector<std::shared_ptr<ObjectT>> selectedVisualObjs,
const char* label,
252 std::function<Vector4f(
const ObjectT* )> getter,
253 std::function<
void( ObjectT*,
const Vector4f& )> setter );
254 template<
typename ObjType,
typename ValueT>
255 void make_width( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs,
const char* label,
256 std::function<ValueT(
const ObjType* )> getter,
257 std::function<
void( ObjType*,
const ValueT& )> setter );
259 void make_light_strength( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs,
const char* label,
260 std::function<
float(
const VisualObject* )> getter,
261 std::function<
void( VisualObject*,
const float& )> setter);
263 template <
typename T,
typename ObjectType>
264 void make_slider( std::vector<std::shared_ptr<ObjectType>> selectedVisualObjs,
const char* label,
265 std::function<T(
const ObjectType* )> getter,
266 std::function<
void( ObjectType*, T )> setter, T min, T max );
268 void make_points_discretization( std::vector<std::shared_ptr<VisualObject>> selectedVisualObjs,
const char* label,
269 std::function<
int(
const ObjectPointsHolder* )> getter,
270 std::function<
void( ObjectPointsHolder*,
const int& )> setter );
272 std::shared_ptr<ShortcutManager> getShortcutManager() {
return shortcutManager_; };
274 MRVIEWER_API
void add_modifier( std::shared_ptr<MR::MeshModifier> modifier );
276 MRVIEWER_API
void allowSceneReorder(
bool allow );
277 bool checkPossibilityObjectRemoval() {
return allowRemoval_; };
279 MRVIEWER_API
void allowObjectsRemoval(
bool allow );
281 MRVIEWER_API
void tryRenameSelectedObject();
283 MRVIEWER_API
void setObjectTreeState(
const Object* obj,
bool open );
289 MRVIEWER_API
void setShowShortcuts(
bool val );
291 MRVIEWER_API
bool getShowShortcuts()
const;
294 void enableSavedDialogPositions(
bool on ) { savedDialogPositionEnabled_ = on; }
296 bool isSavedDialogPositionsEnabled()
const {
return savedDialogPositionEnabled_; }
299 MRVIEWER_API
virtual UiRenderManager& getUiRenderManager();
301 MRVIEWER_API
const std::shared_ptr<SceneObjectsListDrawer>& getSceneObjectsList() {
return sceneObjectsList_; };
303 enum class NameTagSelectionMode
310 using NameTagClickSignal = boost::signals2::signal<bool( Object&
object, NameTagSelectionMode mode ), StopOnTrueCombiner>;
312 NameTagClickSignal nameTagClickSignal;
314 MRVIEWER_API
bool simulateNameTagClick( Object&
object, NameTagSelectionMode mode );
316 MRVIEWER_API
bool simulateNameTagClickWithKeyboardModifiers( Object&
object );
318 using DrawSceneUiSignal = boost::signals2::signal<void( ViewportId viewportId, UiRenderParams::UiTaskList& tasks )>;
320 DrawSceneUiSignal drawSceneUiSignal;
323 MRVIEWER_API
bool anyImGuiWindowIsHovered()
const;
325 MRVIEWER_API
bool anyUiObjectIsHovered()
const;
329 MRVIEWER_API SelectedTypesMask calcSelectedTypesMask(
const std::vector<std::shared_ptr<Object>>& selectedObjs );
330 MRVIEWER_API
bool drawGeneralOptions(
const std::vector<std::shared_ptr<Object>>& selectedObjs );
331 MRVIEWER_API
bool drawAdvancedOptions(
const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
332 MRVIEWER_API
bool drawRemoveButton(
const std::vector<std::shared_ptr<Object>>& selectedObjs );
333 MRVIEWER_API
bool drawDrawOptionsCheckboxes(
const std::vector<std::shared_ptr<VisualObject>>& selectedObjs, SelectedTypesMask selectedMask );
334 MRVIEWER_API
bool drawDrawOptionsColors(
const std::vector<std::shared_ptr<VisualObject>>& selectedObjs );
354 MRVIEWER_API
virtual void drawModalMessage_();
356 bool capturedMouse_{
false };
358 MRVIEWER_API
virtual bool onMouseDown_( MouseButton button,
int modifier )
override;
359 MRVIEWER_API
virtual bool onMouseUp_( MouseButton button,
int modifier )
override;
360 MRVIEWER_API
virtual bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
361 MRVIEWER_API
virtual bool onMouseScroll_(
float delta_y )
override;
362 MRVIEWER_API
virtual void cursorEntrance_(
bool entered )
override;
364 MRVIEWER_API
virtual bool onCharPressed_(
unsigned key,
int modifiers )
override;
365 MRVIEWER_API
virtual bool onKeyDown_(
int key,
int modifiers )
override;
366 MRVIEWER_API
virtual bool onKeyUp_(
int key,
int modifiers )
override;
367 MRVIEWER_API
virtual bool onKeyRepeat_(
int key,
int modifiers )
override;
369 MRVIEWER_API
virtual void postResize_(
int width,
int height )
override;
370 MRVIEWER_API
virtual void postRescale_(
float x,
float y)
override;
372 MRVIEWER_API
virtual bool spaceMouseMove_(
const Vector3f& translate,
const Vector3f& rotate )
override;
373 MRVIEWER_API
virtual bool spaceMouseDown_(
int key )
override;
375 MRVIEWER_API
virtual bool touchpadRotateGestureBegin_()
override;
376 MRVIEWER_API
virtual bool touchpadRotateGestureUpdate_(
float angle )
override;
377 MRVIEWER_API
virtual bool touchpadRotateGestureEnd_()
override;
378 MRVIEWER_API
virtual bool touchpadSwipeGestureBegin_()
override;
379 MRVIEWER_API
virtual bool touchpadSwipeGestureUpdate_(
float deltaX,
float deltaY,
bool kinetic )
override;
380 MRVIEWER_API
virtual bool touchpadSwipeGestureEnd_()
override;
381 MRVIEWER_API
virtual bool touchpadZoomGestureBegin_()
override;
382 MRVIEWER_API
virtual bool touchpadZoomGestureUpdate_(
float scale,
bool kinetic )
override;
383 MRVIEWER_API
virtual bool touchpadZoomGestureEnd_()
override;
385 MRVIEWER_API
virtual void postFocus_(
bool focused )
override;
389 MRVIEWER_API
virtual void rescaleStyle_();
391 MRVIEWER_API
float drawSelectionInformation_();
392 MRVIEWER_API
void drawFeaturePropertiesEditor_(
const std::shared_ptr<Object>&
object );
394 MRVIEWER_API
void drawComparablePropertiesEditor_( ObjectComparableWithReference&
object );
399 MRVIEWER_API
virtual void draw_custom_selection_properties(
const std::vector<std::shared_ptr<Object>>& selected );
401 MRVIEWER_API
void drawTagInformation_(
const std::vector<std::shared_ptr<Object>>& selected );
403 MRVIEWER_API
float drawTransform_();
405 MRVIEWER_API
virtual bool drawTransformContextMenu_(
const std::shared_ptr<Object>& ) {
return false; }
408 MRVIEWER_API
virtual void drawShortcutsWindow_();
410 MRVIEWER_API
float getSceneInfoItemWidth_(
int itemCount = 1 );
415 MRVIEWER_API
void preRenderViewport(
ViewportId viewport )
override;
416 MRVIEWER_API
void postRenderViewport(
ViewportId viewport )
override;
421 BasicUiRenderTask::InteractionMask consumedInteractions{};
425 MRVIEWER_API
bool canConsumeEvent( BasicUiRenderTask::InteractionMask event )
const;
428 std::unique_ptr<UiRenderManagerImpl> uiRenderManager_;
429 std::shared_ptr<SceneObjectsListDrawer> sceneObjectsList_;
class to subscribe on PostFocusSingal
Definition MRViewerEventsListener.h:397