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

widget for surface modifying More...

#include <MRViewer/MRSurfaceManipulationWidget.h>

Inheritance diagram for MR::SurfaceManipulationWidget:

Classes

struct  PickedVertData
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

 SurfaceManipulationWidget ()
virtual ~SurfaceManipulationWidget ()
void init (const std::shared_ptr< ObjectMesh > &objectMesh)
 initialize widget according ObjectMesh; if it was initialized with another object, reset() is called first
void reset ()
 reset widget state including the fixed region; does nothing if the widget is not initialized
void setFixedRegion (const FaceBitSet &region)
void setSettings (const Settings &settings)
 set widget settings (mesh change settings)
const Settings & getSettings () const
 get widget settings
float getMinRadius () const
 minimum radius of editing area.
Palette & palette ()
 get palette used for visualization point shifts, available before init()
void updateTexture ()
 update texture used for colorize surface (use after change colorMap in palette)
void updateUVs ()
 update texture uv coords used for colorize surface (use after change ranges in palette)
void enableDeviationVisualization (bool enable)
 enable visualization of mesh deviations; can be called before init()
void setDeviationCalculationMethod (DeviationCalculationMethod method)
DeviationCalculationMethod deviationCalculationMethod () const
 get method for calculating mesh changes, which is currently in use
bool sameOriginalMeshTopology () const
 returns true if the current object's mesh has the same topology as original input mesh (and vertices with same IDs can be compared)
Vector2f getMinMax () const
 get min / max point shifts for (useful for setup palette)
void setIgnoreOcclusion (bool ignore)
 allow the user to edit parts of object that are hidden in the current view by other objects
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

bool onMouseDown_ (MouseButton button, int modifiers) override
 start modifying mesh surface
bool onMouseUp_ (MouseButton button, int modifiers) override
 stop modifying mesh surface, generate history action
bool onMouseMove_ (int mouse_x, int mouse_y) override
 update
void postDraw_ () override
 need to visualize bad region (draw grey circle)
virtual bool checkModifiers_ (int modifiers) const
virtual 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 initLaplacian_ (RememberShape rs)
 Laplacian.
void laplacianPickVert_ (const PointOnFace &pick)
 for singleEditingRegion_
void laplacianMoveVert_ (const Vector2f &mousePos)
void updateVizualizeSelection_ ()
 when the mouse is not pressed, also sets singleEditingRegion_
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 subdivideAfterAddRemove_ ()
void markSelectedEdgesAsCreases_ ()
 selected edges having a face in generalEditingRegion_ become creases, undone together with the smoothing
void updateDistancesAndRegion_ (const Mesh &mesh, const std::vector< MeshTriPoint > &start, VertScalars &distances, VertBitSet &region, const VertBitSet *untouchable)

Protected Attributes

Settings settings_
std::shared_ptr< ObjectMesh > obj_
VertBitSet unchangeableVerts_
Vector2f mousePos_
 mouse position of last updateRegion_
std::vector< MeshTriPoint > pointsUnderMouse_
 mesh points under mouse in the current frame (could be many in case of fast mouse movement)
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_
VertScalars valueChanges_
std::shared_ptr< Mesh > originalMesh_
 original input mesh
VertBitSet unknownSign_
 cached data to avoid reallocating memory
std::shared_ptr< ObjectMesh > lastStableObjMesh_
bool firstInit_ = true
 need to save settings in re-initial
bool badRegion_ = false
 in selected region less than 3 points
bool mousePressed_ = false
boost::signals2::scoped_connection meshChangedConnection_
bool ownMeshChangedSignal_ = false
 true while the widget changes the mesh itself, to ignore meshChangedSignal
bool connectionsInitialized_ = false
VertId touchVertId_
 Laplacian.
Vector3f touchVertIniPos_
 initial position of fixed vertex
Vector2i storedDown_
std::unique_ptr< Laplacian > laplacian_
VertBitSet pickedVerts_
 these are all vertices, which will are attracted to be under mouse considering material width since last mouse down
HashMap< VertId, PickedVertData > pickedVertsToData_
 same vertices as in pickedVerts_ mapped to PickedVertData
std::shared_ptr< VersatileChangeMeshPointsAction > 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< CombinedHistoryAction > combinedHistoryAction_
std::shared_ptr< Palette > palette_
bool enableDeviationTexture_ = false
DeviationCalculationMethod deviationCalculationMethod_ = DeviationCalculationMethod::ExactDistance
DeviationCalculationMethod requestedDeviationCalculationMethod_ = DeviationCalculationMethod::ExactDistance
 last method passed to setDeviationCalculationMethod
bool sameOriginalMeshTopology_ = 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

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: