diff --git a/src/meshlabplugins/meshsplitter/meshsplitterfilter.cpp b/src/meshlabplugins/meshsplitter/meshsplitterfilter.cpp deleted file mode 100644 index 493d4b8fe..000000000 --- a/src/meshlabplugins/meshsplitter/meshsplitterfilter.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -* MeshLab o o * -* A versatile mesh processing toolbox o o * -* _ O _ * -* Copyright(C) 2005 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include "meshsplitterfilter.h" - -// Constructor usually performs only two simple tasks of filling the two lists -// - typeList: with all the possible id of the filtering actions -// - actionList with the corresponding actions. If you want to add icons to your filtering actions you can do here by construction the QActions accordingly - -MeshSplitterFilterPlugin::MeshSplitterFilterPlugin() -{ - typeList << FP_SPLITSELECT; - - foreach(FilterIDType tt , types()) - actionList << new QAction(filterName(tt), this); -} - -// ST() must return the very short string describing each filtering action -// (this string is used also to define the menu entry) -const QString MeshSplitterFilterPlugin::filterName(FilterIDType filterId) -{ - switch(filterId) { - case FP_SPLITSELECT : return QString("Move selection on another layer"); - default : assert(0); - } -} - -// Info() must return the longer string describing each filtering action -// (this string is used in the About plugin dialog) -const QString MeshSplitterFilterPlugin::filterInfo(FilterIDType filterId) -{ - switch(filterId) { - case FP_SPLITSELECT : return QString("Selected faces are moved (or duplicated) in a new layer"); - default : assert(0); - } -} - -const PluginInfo &MeshSplitterFilterPlugin::pluginInfo() -{ - static PluginInfo ai; - ai.Date=tr(__DATE__); - ai.Version = tr("1.0"); - ai.Author = ("Marco Callieri"); - return ai; - } - -// This function define the needed parameters for each filter. Return true if the filter has some parameters -// it is called every time, so you can set the default value of parameters according to the mesh -// For each parmeter you need to define, -// - the name of the parameter, -// - the string shown in the dialog -// - the default value -// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void MeshSplitterFilterPlugin::initParameterSet(QAction *action,MeshDocument & /*m*/, FilterParameterSet & parlst) -//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst) -{ - switch(ID(action)) { - case FP_SPLITSELECT : - parlst.addBool ("DeleteOriginal", - true, - "Delete original selection", - "Deletes the origianl selected faces, thus splitting the mesh among layers. \n\n" - "if false, the selected faces are duplicated in the new layer"); - break; - - default : assert(0); - } -} - -// The Real Core Function doing the actual mesh processing. -// Move Vertex of a random quantity -bool MeshSplitterFilterPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb) -{ - CMeshO::FaceIterator fi; - int numFacesSel,numVertSel; - - // creating the new layer - // that is the back one - MeshModel *mm= new MeshModel(); - md.meshList.push_back(mm); - - MeshModel *destMesh = md.meshList.back(); // destination = last - MeshModel *currentMesh = md.mm(); // source = current - - // select all points involved - tri::UpdateSelection::ClearVertex(currentMesh->cm); - tri::UpdateSelection::VertexFromFaceLoose(currentMesh->cm); - - tri::Append::Mesh(destMesh->cm, currentMesh->cm, true); - - numFacesSel = tri::UpdateSelection::CountFace(currentMesh->cm); - numVertSel = tri::UpdateSelection::CountVertex(currentMesh->cm); - - if(par.getBool("DeleteOriginal")) // delete original faces - { - CMeshO::VertexIterator vi; - CMeshO::FaceIterator fi; - tri::UpdateSelection::ClearVertex(currentMesh->cm); - tri::UpdateSelection::VertexFromFaceStrict(currentMesh->cm); - for(fi=currentMesh->cm.face.begin();fi!=currentMesh->cm.face.end();++fi) - if(!(*fi).IsD() && (*fi).IsS() ) - tri::Allocator::DeleteFace(currentMesh->cm,*fi); - for(vi=currentMesh->cm.vert.begin();vi!=currentMesh->cm.vert.end();++vi) - if(!(*vi).IsD() && (*vi).IsS() ) - tri::Allocator::DeleteVertex(currentMesh->cm,*vi); - - tri::UpdateSelection::ClearVertex(currentMesh->cm); - tri::UpdateSelection::ClearFace(currentMesh->cm); - - currentMesh->clearDataMask(MeshModel::MM_FACETOPO | MeshModel::MM_BORDERFLAG); - - Log(0,"Moved %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); - } - else // keep original faces - { - Log(0,"Moved %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); - } - - // init new layer - destMesh->fileName = "newlayer.ply"; // mesh name - tri::UpdateBounding::Box(destMesh->cm); // updates bounding box - for(fi=destMesh->cm.face.begin();fi!=destMesh->cm.face.end();++fi) // face normals - face::ComputeNormalizedNormal(*fi); - tri::UpdateNormals::PerVertex(destMesh->cm); // vertex normals - destMesh->cm.Tr = currentMesh->cm.Tr; // copy transformation - destMesh->busy=false; // ready to be used - - return true; -} - -Q_EXPORT_PLUGIN(MeshSplitterFilterPlugin) diff --git a/src/meshlabplugins/meshsplitter/meshsplitterfilter.h b/src/meshlabplugins/meshsplitter/meshsplitterfilter.h deleted file mode 100644 index da6f06775..000000000 --- a/src/meshlabplugins/meshsplitter/meshsplitterfilter.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -* MeshLab o o * -* A versatile mesh processing toolbox o o * -* _ O _ * -* Copyright(C) 2005 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * -****************************************************************************/ - -#ifndef MESHSPLITTERFILTER_H -#define MESHSPLITTERFILTER_H - -#include - -#include -#include - -class MeshSplitterFilterPlugin : public QObject, public MeshFilterInterface -{ - Q_OBJECT - Q_INTERFACES(MeshFilterInterface) - -public: - enum { FP_SPLITSELECT } ; - - MeshSplitterFilterPlugin(); - - virtual const QString filterName(FilterIDType filter); - virtual const QString filterInfo(FilterIDType filter); - virtual const PluginInfo &pluginInfo(); - virtual bool autoDialog(QAction *) {return true;} - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, FilterParameterSet & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ; - virtual bool applyFilter(QAction *filter, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) { assert(0); return false;} ; -}; - -#endif \ No newline at end of file diff --git a/src/meshlabplugins/meshsplitter/meshsplitterfilter.pro b/src/meshlabplugins/meshsplitter/meshsplitterfilter.pro deleted file mode 100644 index 02eedd223..000000000 --- a/src/meshlabplugins/meshsplitter/meshsplitterfilter.pro +++ /dev/null @@ -1,30 +0,0 @@ -TEMPLATE = lib -QT += opengl -CONFIG += plugin -INCLUDEPATH += ../.. ../../../../sf ../../../../code/lib/glew/include -HEADERS = meshsplitterfilter.h - -SOURCES = meshsplitterfilter.cpp \ - ../../meshlab/filterparameter.cpp \ - ../../../../code/lib/glew/src/glew.c - -TARGET = meshsplitterfilter - -DESTDIR = ../../meshlab/plugins - -# the following line is needed to avoid mismatch between -# the awful min/max macros of windows and the limits max -win32:DEFINES += NOMINMAX -# mac:CONFIG += x86 ppc - -DEFINES += GLEW_STATIC - -contains(TEMPLATE,lib) { - CONFIG(debug, debug|release) { - unix:TARGET = $$member(TARGET, 0)_debug - else:TARGET = $$member(TARGET, 0)d - } -} - - -