filter layer postconditions

This commit is contained in:
Marco Callieri 2018-03-30 15:56:39 +02:00
parent ca695f6014
commit 3fea196cdb
2 changed files with 71 additions and 32 deletions

View File

@ -120,8 +120,8 @@ void FilterLayerPlugin::initParameterSet(QAction *action, MeshDocument &md, Rich
parlst.addParam(new RichBool ("DeleteOriginal",
true,
"Delete original selection",
"Deletes the original selected faces, thus splitting the mesh among layers. \n\n"
"if false, the selected faces are duplicated in the new layer"));
"Deletes the original selected faces/vertices, thus splitting the mesh among layers. \n\n"
"if false, the selected faces/vertices are duplicated in the new layer"));
}
break;
case FP_FLATTEN :
@ -228,7 +228,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParam
MeshModel* destModel = md.addNewMesh("","SelectedVerticesSubset",true);
destModel->updateDataMask(currentModel);
numVertSel = tri::UpdateSelection<CMeshO>::VertexCount(currentModel->cm);
numVertSel = (int)tri::UpdateSelection<CMeshO>::VertexCount(currentModel->cm);
tri::Append<CMeshO, CMeshO>::Mesh(destModel->cm, currentModel->cm, true);
@ -236,7 +236,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParam
{
CMeshO::VertexIterator vi;
int delfaces = tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(currentModel->cm);
int delfaces = (int)tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(currentModel->cm);
for (CMeshO::FaceIterator fi = currentModel->cm.face.begin(); fi != currentModel->cm.face.end(); ++fi)
if(!(*fi).IsD() && (*fi).IsS() )
tri::Allocator<CMeshO>::DeleteFace(currentModel->cm, *fi);
@ -270,8 +270,8 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParam
// select all points involved
tri::UpdateSelection<CMeshO>::VertexFromFaceLoose(currentModel->cm);
numFacesSel = tri::UpdateSelection<CMeshO>::FaceCount(currentModel->cm);
numVertSel = tri::UpdateSelection<CMeshO>::VertexCount(currentModel->cm);
numFacesSel = (int)tri::UpdateSelection<CMeshO>::FaceCount(currentModel->cm);
numVertSel = (int)tri::UpdateSelection<CMeshO>::VertexCount(currentModel->cm);
tri::Append<CMeshO, CMeshO>::Mesh(destModel->cm, currentModel->cm, true);
@ -704,8 +704,8 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParam
{
fx = fx / 100;
shots[id].Intrinsics.FocalMm = fx;
shots[id].Intrinsics.PixelSizeMm[0] = 0.01;
shots[id].Intrinsics.PixelSizeMm[1] = 0.01;
shots[id].Intrinsics.PixelSizeMm[0] = 0.01f;
shots[id].Intrinsics.PixelSizeMm[1] = 0.01f;
}
else
{
@ -812,30 +812,26 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParam
FilterLayerPlugin::FilterClass FilterLayerPlugin::getClass(QAction *a)
{
switch(ID(a))
{
case FP_RENAME_MESH :
case FP_SPLITSELECTEDFACES :
case FP_SPLITSELECTEDVERTICES:
case FP_DUPLICATE :
case FP_FLATTEN :
case FP_SELECTCURRENT :
case FP_MESH_VISIBILITY :
case FP_SPLITCONNECTED :
case FP_DELETE_MESH :
case FP_DELETE_NON_VISIBLE_MESH :
return MeshFilterInterface::Layer;
case FP_RENAME_RASTER :
case FP_DELETE_RASTER :
case FP_DELETE_NON_SELECTED_RASTER :
case FP_EXPORT_CAMERAS:
return MeshFilterInterface::RasterLayer;
case FP_IMPORT_CAMERAS:
return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::RasterLayer);
default : assert(0);
return MeshFilterInterface::Generic;
switch(ID(a))
{
case FP_RENAME_MESH :
case FP_SPLITSELECTEDFACES :
case FP_SPLITSELECTEDVERTICES:
case FP_DUPLICATE :
case FP_FLATTEN :
case FP_SELECTCURRENT :
case FP_MESH_VISIBILITY :
case FP_SPLITCONNECTED :
case FP_DELETE_MESH :
case FP_DELETE_NON_VISIBLE_MESH : return MeshFilterInterface::Layer;
case FP_RENAME_RASTER :
case FP_DELETE_RASTER :
case FP_DELETE_NON_SELECTED_RASTER :
case FP_EXPORT_CAMERAS: return MeshFilterInterface::RasterLayer;
case FP_IMPORT_CAMERAS: return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::RasterLayer);
default : assert(0);
}
return MeshFilterInterface::Generic;
}
MeshFilterInterface::FILTER_ARITY FilterLayerPlugin::filterArity( QAction* filter) const
@ -864,4 +860,30 @@ MeshFilterInterface::FILTER_ARITY FilterLayerPlugin::filterArity( QAction* filte
return MeshFilterInterface::NONE;
}
int FilterLayerPlugin::postCondition(QAction* filter) const
{
switch (ID(filter))
{
case FP_RENAME_MESH:
case FP_DUPLICATE:
case FP_SELECTCURRENT:
case FP_DELETE_MESH:
case FP_DELETE_NON_VISIBLE_MESH:
case FP_FLATTEN:
case FP_RENAME_RASTER:
case FP_DELETE_RASTER:
case FP_DELETE_NON_SELECTED_RASTER:
case FP_EXPORT_CAMERAS:
case FP_IMPORT_CAMERAS:
case FP_SPLITCONNECTED:
case FP_MESH_VISIBILITY: return MeshModel::MM_NONE;
case FP_SPLITSELECTEDFACES:
case FP_SPLITSELECTEDVERTICES: return MeshModel::MM_GEOMETRY_CHANGE;
default: assert(0);
}
return MeshFilterInterface::Generic;
}
MESHLAB_PLUGIN_NAME_EXPORTER(FilterLayerPlugin)

View File

@ -35,7 +35,23 @@ class FilterLayerPlugin : public QObject, public MeshFilterInterface
Q_INTERFACES(MeshFilterInterface)
public:
enum { FP_FLATTEN, FP_MESH_VISIBILITY, FP_SPLITSELECTEDFACES, FP_SPLITSELECTEDVERTICES, FP_SPLITCONNECTED, FP_DUPLICATE, FP_RENAME_MESH, FP_RENAME_RASTER, FP_DELETE_MESH, FP_DELETE_NON_VISIBLE_MESH,FP_DELETE_RASTER, FP_DELETE_NON_SELECTED_RASTER,FP_SELECTCURRENT, FP_EXPORT_CAMERAS, FP_IMPORT_CAMERAS};
enum {
FP_FLATTEN,
FP_MESH_VISIBILITY,
FP_SPLITSELECTEDFACES,
FP_SPLITSELECTEDVERTICES,
FP_SPLITCONNECTED,
FP_DUPLICATE,
FP_RENAME_MESH,
FP_RENAME_RASTER,
FP_DELETE_MESH,
FP_DELETE_NON_VISIBLE_MESH,
FP_DELETE_RASTER,
FP_DELETE_NON_SELECTED_RASTER,
FP_SELECTCURRENT,
FP_EXPORT_CAMERAS,
FP_IMPORT_CAMERAS
};
FilterLayerPlugin();
@ -44,6 +60,7 @@ public:
virtual FilterClass getClass(QAction *);
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
virtual bool applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
int postCondition(QAction *filter) const;
FILTER_ARITY filterArity(QAction*) const;
};