MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::SurfaceManipulationWidget Class Reference

widget for surface modifying @detail available 3 modes: add (move surface region in direction of normal) remove (move surface region in opposite direction to normal) relax (relax surface region) More...

#include <MRSurfaceManipulationWidget.h>

+ Inheritance diagram for MR::SurfaceManipulationWidget:

Classes

struct  Settings
 Mesh change settings. More...
 

Public Types

enum class  WorkMode {
  WorkMode::Add , WorkMode::Remove , WorkMode::Relax , WorkMode::Laplacian ,
  WorkMode::Patch
}
 widget work modes More...
 
enum class  DeviationCalculationMethod { DeviationCalculationMethod::PointToPoint , DeviationCalculationMethod::PointToPlane , DeviationCalculationMethod::ExactDistance }
 Method for calculating mesh changes. More...
 

Public Member Functions

MRVIEWER_API SurfaceManipulationWidget ()
 
virtual MRVIEWER_API ~SurfaceManipulationWidget ()
 
MRVIEWER_API void init (const std::shared_ptr< ObjectMesh > &objectMesh)
 initialize widget according ObjectMesh
 
MRVIEWER_API void reset ()
 reset widget state
 
MRVIEWER_API void setFixedRegion (const FaceBitSet &region)
 
MRVIEWER_API void setSettings (const Settings &settings)
 set widget settings (mesh change settings)
 
MRVIEWER_API const SettingsgetSettings ()
 get widget settings
 
MRVIEWER_API float getMinRadius ()
 mimum radius of editing area.
 
Palettepalette ()
 get palette used for visualization point shifts
 
MRVIEWER_API void updateTexture ()
 update texture used for colorize surface (use after change colorMap in palette)
 
MRVIEWER_API void updateUVs ()
 update texture uv coords used for colorize surface (use after change ranges in palette)
 
MRVIEWER_API void enableDeviationVisualization (bool enable)
 enable visualization of mesh deviations
 
MRVIEWER_API void setDeviationCalculationMethod (DeviationCalculationMethod method)
 set method for calculating mesh changes
 
MRVIEWER_API DeviationCalculationMethod deviationCalculationMethod () const
 get method for calculating mesh changes
 
MRVIEWER_API bool sameValidVerticesAsInOriginMesh () const
 checks for a one-to-one correspondence between the vertices of the original grid and the modified one
 
MRVIEWER_API Vector2f getMinMax ()
 get min / max point shifts for (usefull for setup palette)
 
MRVIEWER_API void setIgnoreOcclusion (bool ignore)
 allow the user to edit parts of object that are hidden in the current view by other objects
 
MRVIEWER_API bool ignoreOcclusion () const
 
void setEditOnlyCodirectedSurface (bool edit)
 restricts editable area to vertices whose normals look into the same half-space as normal under cursor
 
bool isEditOnlyCodirectedSurface () const
 get state of an editable region restriction
 
- Public Member Functions inherited from MR::MultiListener< MouseDownListener, MouseMoveListener, MouseUpListener, PostDrawListener >
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 ()
 

Protected Member Functions

MRVIEWER_API bool onMouseDown_ (MouseButton button, int modifiers) override
 start modifying mesh surface
 
MRVIEWER_API bool onMouseUp_ (MouseButton button, int modifiers) override
 stop modifying mesh surface, generate history action
 
MRVIEWER_API bool onMouseMove_ (int mouse_x, int mouse_y) override
 update
 
MRVIEWER_API void postDraw_ () override
 need to visualize bad region (draw grey circle)
 
virtual MRVIEWER_API bool checkModifiers_ (int modifiers) const
 
virtual MRVIEWER_API void appendMeshDataChangeHistory_ (ObjectMeshData &&newMeshData, const FaceBitSet &newFaces)
 
void reallocData_ (size_t size)
 
void clearData_ ()
 
void initConnections_ ()
 
void resetConnections_ ()
 
void changeSurface_ ()
 
void updateUVmap_ (bool set, bool wholeMesh=false)
 
void updateRegion_ (const Vector2f &mousePos)
 
void invalidateMetricsCache_ ()
 
void abortEdit_ ()
 
void laplacianPickVert_ (const PointOnFace &pick)
 Laplacian.
 
void laplacianMoveVert_ (const Vector2f &mousePos)
 
void updateVizualizeSelection_ ()
 
void updateRegionUVs_ (const VertBitSet &region)
 
void updateValueChanges_ (const VertBitSet &region)
 
void updateValueChangesPointToPoint_ (const VertBitSet &region)
 
void updateValueChangesPointToPlane_ (const VertBitSet &region)
 
void updateValueChangesExactDistance_ (const VertBitSet &region)
 
void createLastStableObjMesh_ ()
 
void removeLastStableObjMesh_ ()
 
void compressChangePointsAction_ ()
 
void updateDistancesAndRegion_ (const Mesh &mesh, const VertBitSet &start, VertScalars &distances, VertBitSet &region, const VertBitSet *untouchable)
 

Protected Attributes

Settings settings_
 
std::shared_ptr< ObjectMeshobj_
 
VertBitSet unchangeableVerts_
 
float minRadius_ = 1.f
 
Vector2f mousePos_
 mouse position of last updateRegion_
 
VertBitSet activePickedVertices_
 vertices that are considered under mouse in curernt frame (could be many in case of fast mouse mouvement)
 
VertBitSet singleEditingRegion_
 current (under the cursor) region of tool application
 
VertBitSet visualizationRegion_
 vertices of triangles partially or fully highlighted with red
 
VertBitSet generalEditingRegion_
 united region of tool application since the last mouse down
 
VertScalars pointsShift_
 
VertScalars editingDistanceMap_
 
VertScalars visualizationDistanceMap_
 
VertBitSet changedRegion_
 
VertScalars valueChanges_
 
VertScalars lastStableValueChanges_
 
std::shared_ptr< MeshoriginalMesh_
 original input mesh
 
VertBitSet unknownSign_
 cached data to avoid reallocating memory
 
std::shared_ptr< ObjectMeshlastStableObjMesh_
 
bool firstInit_ = true
 
bool badRegion_ = false
 need to save settings in re-initial
 
bool mousePressed_ = false
 in selected region less than 3 points
 
std::chrono::time_point< std::chrono::high_resolution_clock > timePoint_
 
boost::signals2::scoped_connection meshChangedConnection_
 
bool ownMeshChangedSignal_ = false
 
bool connectionsInitialized_ = false
 
VertId touchVertId_
 Laplacian.
 
Vector3f touchVertIniPos_
 we fix this vertex in Laplacian and move it manually
 
Vector2i storedDown_
 initial position of fixed vertex
 
std::unique_ptr< Laplacianlaplacian_
 
std::shared_ptr< SmartChangeMeshPointsAction > historyAction_
 
bool appendHistoryAction_ = false
 true if historyAction_ is prepared but not yet appended to HistoryStore, which is done on first mouse move
 
std::shared_ptr< Palettepalette_
 
bool enableDeviationTexture_ = false
 
DeviationCalculationMethod deviationCalculationMethod_ = DeviationCalculationMethod::ExactDistance
 
bool sameValidVerticesAsInOriginMesh_ = true
 
bool ignoreOcclusion_ = false
 allow the user to edit parts of object that are hidden in the current view by other objects
 
bool editOnlyCodirectedSurface_ = true
 

Detailed Description

widget for surface modifying @detail available 3 modes: add (move surface region in direction of normal) remove (move surface region in opposite direction to normal) relax (relax surface region)


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