2#include "MRViewerFwd.h"
4#include "MRMesh/MRMeshFwd.h"
22 public MultiListener<MouseDownListener, MouseMoveListener, MouseUpListener,
53 float relaxForce = 0.2f;
54 float editForce = 1.f;
55 float sharpness = 50.f;
56 float relaxForceAfterEdit = 0.25f;
61 MRVIEWER_API
void init(
const std::shared_ptr<ObjectMesh>& objectMesh );
113 MRVIEWER_API
virtual bool checkModifiers_(
int modifiers )
const {
return modifiers == 0; }
152 std::shared_ptr<ObjectMesh>
obj_;
154 float minRadius_ = 1.f;
169 bool firstInit_ =
true;
170 bool badRegion_ =
false;
172 bool mousePressed_ =
false;
174 std::chrono::time_point<std::chrono::high_resolution_clock>
timePoint_;
176 bool ownMeshChangedSignal_ =
false;
178 bool connectionsInitialized_ =
false;
187 class SmartChangeMeshPointsAction;
191 bool appendHistoryAction_ =
false;
194 bool enableDeviationTexture_ =
false;
196 bool sameValidVerticesAsInOriginMesh_ =
true;
199 bool ignoreOcclusion_ =
false;
200 bool editOnlyCodirectedSurface_ =
true;
Definition MRLaplacian.h:24
Class to hold one dimension texture with value to UV mapping.
Definition MRPalette.h:30
Vector2i storedDown_
initial position of fixed vertex
Definition MRSurfaceManipulationWidget.h:183
DeviationCalculationMethod
Method for calculating mesh changes.
Definition MRSurfaceManipulationWidget.h:41
MRVIEWER_API void setSettings(const Settings &settings)
set widget settings (mesh change settings)
MouseButton
Definition MRMouse.h:12
Settings settings_
Definition MRSurfaceManipulationWidget.h:150
void setEditOnlyCodirectedSurface(bool edit)
restricts editable area to vertices whose normals look into the same half-space as normal under curso...
Definition MRSurfaceManipulationWidget.h:98
boost::signals2::scoped_connection meshChangedConnection_
Definition MRSurfaceManipulationWidget.h:175
void createLastStableObjMesh_()
MRVIEWER_API bool sameValidVerticesAsInOriginMesh() const
checks for a one-to-one correspondence between the vertices of the original grid and the modified one
Definition MRSurfaceManipulationWidget.h:89
void laplacianMoveVert_(const Vector2f &mousePos)
VertBitSet singleEditingRegion_
current (under the cursor) region of tool application
Definition MRSurfaceManipulationWidget.h:157
MRVIEWER_API bool onMouseDown_(MouseButton button, int modifiers) override
start modifying mesh surface
VertScalars pointsShift_
Definition MRSurfaceManipulationWidget.h:160
std::shared_ptr< Palette > palette_
Definition MRSurfaceManipulationWidget.h:193
MRVIEWER_API void init(const std::shared_ptr< ObjectMesh > &objectMesh)
initialize widget according ObjectMesh
VertId touchVertId_
Laplacian.
Definition MRSurfaceManipulationWidget.h:181
void invalidateMetricsCache_()
VertScalars valueChanges_
Definition MRSurfaceManipulationWidget.h:164
std::unique_ptr< Laplacian > laplacian_
Definition MRSurfaceManipulationWidget.h:184
VertScalars lastStableValueChanges_
Definition MRSurfaceManipulationWidget.h:165
void updateRegionUVs_(const VertBitSet ®ion)
std::chrono::time_point< std::chrono::high_resolution_clock > timePoint_
Definition MRSurfaceManipulationWidget.h:174
VertBitSet visualizationRegion_
vertices of triangles partially or fully highlighted with red
Definition MRSurfaceManipulationWidget.h:158
MRVIEWER_API bool onMouseUp_(MouseButton button, int modifiers) override
stop modifying mesh surface, generate history action
EdgeWeights
determines the weight of each edge in applications like Laplacian
Definition MREnums.h:44
MRVIEWER_API void reset()
reset widget state
MRVIEWER_API SurfaceManipulationWidget()
std::shared_ptr< SmartChangeMeshPointsAction > historyAction_
Definition MRSurfaceManipulationWidget.h:188
void reallocData_(size_t size)
virtual MRVIEWER_API bool checkModifiers_(int modifiers) const
Definition MRSurfaceManipulationWidget.h:113
void updateDistancesAndRegion_(const Mesh &mesh, const VertBitSet &start, VertScalars &distances, VertBitSet ®ion, const VertBitSet *untouchable)
MRVIEWER_API const Settings & getSettings()
get widget settings
Definition MRSurfaceManipulationWidget.h:71
std::shared_ptr< ObjectMesh > obj_
Definition MRSurfaceManipulationWidget.h:152
void removeLastStableObjMesh_()
void updateValueChanges_(const VertBitSet ®ion)
Vector3f touchVertIniPos_
we fix this vertex in Laplacian and move it manually
Definition MRSurfaceManipulationWidget.h:182
MRVIEWER_API void setFixedRegion(const FaceBitSet ®ion)
MRVIEWER_API void postDraw_() override
need to visualize bad region (draw grey circle)
VertBitSet activePickedVertices_
vertices that are considered under mouse in curernt frame (could be many in case of fast mouse mouvem...
Definition MRSurfaceManipulationWidget.h:156
VertBitSet unchangeableVerts_
Definition MRSurfaceManipulationWidget.h:153
MRVIEWER_API DeviationCalculationMethod deviationCalculationMethod() const
get method for calculating mesh changes
Definition MRSurfaceManipulationWidget.h:87
std::shared_ptr< ObjectMesh > lastStableObjMesh_
Definition MRSurfaceManipulationWidget.h:168
void updateValueChangesExactDistance_(const VertBitSet ®ion)
WorkMode
widget work modes
Definition MRSurfaceManipulationWidget.h:31
MRVIEWER_API bool onMouseMove_(int mouse_x, int mouse_y) override
update
void updateRegion_(const Vector2f &mousePos)
Palette & palette()
get palette used for visualization point shifts
Definition MRSurfaceManipulationWidget.h:77
MRVIEWER_API Vector2f getMinMax()
get min / max point shifts for (usefull for setup palette)
std::shared_ptr< Mesh > originalMesh_
original input mesh
Definition MRSurfaceManipulationWidget.h:166
VertBitSet unknownSign_
cached data to avoid reallocating memory
Definition MRSurfaceManipulationWidget.h:167
MRVIEWER_API void updateUVs()
update texture uv coords used for colorize surface (use after change ranges in palette)
VertBitSet generalEditingRegion_
united region of tool application since the last mouse down
Definition MRSurfaceManipulationWidget.h:159
VertBitSet changedRegion_
Definition MRSurfaceManipulationWidget.h:163
virtual MRVIEWER_API void appendMeshDataChangeHistory_(ObjectMeshData &&newMeshData, const FaceBitSet &newFaces)
MRVIEWER_API bool ignoreOcclusion() const
Definition MRSurfaceManipulationWidget.h:95
void compressChangePointsAction_()
MRVIEWER_API float getMinRadius()
mimum radius of editing area.
Definition MRSurfaceManipulationWidget.h:74
bool isEditOnlyCodirectedSurface() const
get state of an editable region restriction
Definition MRSurfaceManipulationWidget.h:100
void laplacianPickVert_(const PointOnFace &pick)
Laplacian.
void updateValueChangesPointToPoint_(const VertBitSet ®ion)
MRVIEWER_API void enableDeviationVisualization(bool enable)
enable visualization of mesh deviations
virtual MRVIEWER_API ~SurfaceManipulationWidget()
void updateUVmap_(bool set, bool wholeMesh=false)
MRVIEWER_API void updateTexture()
update texture used for colorize surface (use after change colorMap in palette)
MRVIEWER_API void setDeviationCalculationMethod(DeviationCalculationMethod method)
set method for calculating mesh changes
VertScalars editingDistanceMap_
Definition MRSurfaceManipulationWidget.h:161
VertScalars visualizationDistanceMap_
Definition MRSurfaceManipulationWidget.h:162
void updateValueChangesPointToPlane_(const VertBitSet ®ion)
Vector2f mousePos_
mouse position of last updateRegion_
Definition MRSurfaceManipulationWidget.h:155
void updateVizualizeSelection_()
MRVIEWER_API void setIgnoreOcclusion(bool ignore)
allow the user to edit parts of object that are hidden in the current view by other objects
Definition MRSurfaceManipulationWidget.h:94
@ Remove
Default: separate nested meshes and remove them, just like union operation should do,...
@ PointToPoint
it is the safest approach but can converge slowly
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRViewerEventsListener.h:32
mesh and its per-element attributes for ObjectMeshHolder
Definition MRObjectMeshData.h:17
a point located on some mesh's face
Definition MRPointOnFace.h:16