updated hole and align edit tool to the last gla changes.

This commit is contained in:
Paolo Cignoni cignoni 2011-02-07 13:16:50 +00:00
parent 8cf5442e2c
commit 9cabb7b056
6 changed files with 33 additions and 31 deletions

View File

@ -80,10 +80,12 @@ void EditHolePlugin::mouseMoveEvent(QMouseEvent * /*e*/, MeshModel &/*m*/, GLAre
{
}
bool EditHolePlugin::StartEdit(MeshModel &m, GLArea *gla )
bool EditHolePlugin::StartEdit(MeshDocument &_md, GLArea *gla )
{
m.updateDataMask(MeshModel::MM_FACEFACETOPO);
if ( tri::Clean<CMeshO>::CountNonManifoldEdgeFF(m.cm) >0)
this->md = &_md;
md->mm()->updateDataMask(MeshModel::MM_FACEFACETOPO);
if ( tri::Clean<CMeshO>::CountNonManifoldEdgeFF(md->mm()->cm) >0)
{
QMessageBox::critical(0, tr("Manifoldness Failure"), QString("Hole's managing requires manifoldness."));
return false; // can't continue, mesh can't be processed
@ -96,9 +98,9 @@ bool EditHolePlugin::StartEdit(MeshModel &m, GLArea *gla )
return false;
// if plugin restart with another mesh, recomputing of hole is forced
if(mesh != &m)
if(mesh != this->md->mm())
{
this->mesh = &m;
this->mesh = this->md->mm();
this->gla = gla;
mesh->clearDataMask(MeshModel::MM_FACEMARK);
@ -130,7 +132,7 @@ bool EditHolePlugin::StartEdit(MeshModel &m, GLArea *gla )
delete holeSorter;
delete holesModel;
}
holesModel = new HoleListModel(&m);
holesModel = new HoleListModel(mesh);
holesModel->holesManager.autoBridgeCB = new EditHoleAutoBridgingCB(dialogFiller->ui.infoLbl, 800);
@ -150,8 +152,7 @@ bool EditHolePlugin::StartEdit(MeshModel &m, GLArea *gla )
}
else
{
Decorate(m, gla);
//Decorate(m, gla);
Decorate(*mesh, gla);
upGlA();
}
return true;
@ -190,9 +191,9 @@ void EditHolePlugin::Decorate(MeshModel &m, GLArea * gla)
break;
case HoleListModel::ManualBridging:
oldAbutmentPresence = holesModel->PickedAbutment();
gla->meshDoc->setBusy(true);
md->setBusy(true);
holesModel->addBridgeFace(pickedFace, cur.x(), inverseY);
gla->meshDoc->setBusy(false);
md->setBusy(false);
if(holesModel->PickedAbutment() != oldAbutmentPresence)
{
if(oldAbutmentPresence == true)
@ -265,7 +266,7 @@ void EditHolePlugin::updateDWeight(int val)
void EditHolePlugin::fill()
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
if(holesModel->getState() == HoleListModel::Filled)
holesModel->acceptFilling(false);
@ -275,7 +276,7 @@ void EditHolePlugin::fill()
holesModel->fill( FgtHole<CMeshO>::MinimumWeight);
else
holesModel->fill( FgtHole<CMeshO>::SelfIntersection);
gla->meshDoc->setBusy(false);
md->setBusy(false);
upGlA();
}
@ -283,19 +284,19 @@ void EditHolePlugin::acceptFill()
{
if(holesModel->getState() == HoleListModel::Filled)
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
holesModel->acceptFilling(true);
gla->meshDoc->setBusy(false);
md->setBusy(false);
gla->setWindowModified(true);
}
}
void EditHolePlugin::cancelFill()
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
if(holesModel->getState() == HoleListModel::Filled)
holesModel->acceptFilling(false);
gla->meshDoc->setBusy(false);
md->setBusy(false);
}
void EditHolePlugin::updateBridgeSldValue(int val)
@ -322,18 +323,18 @@ void EditHolePlugin::manualBridge()
void EditHolePlugin::autoBridge()
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
bool singleHole = dialogFiller->ui.selfHoleChkB->isChecked();
holesModel->autoBridge(singleHole, bridgeOptSldVal*0.0017);
gla->meshDoc->setBusy(false);
md->setBusy(false);
upGlA();
}
void EditHolePlugin::closeNMHoles()
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
holesModel->closeNonManifolds();
gla->meshDoc->setBusy(false);
md->setBusy(false);
upGlA();
}
@ -351,9 +352,9 @@ void EditHolePlugin::acceptBridges()
void EditHolePlugin::clearBridge()
{
gla->meshDoc->setBusy(true);
md->setBusy(true);
holesModel->removeBridges();
gla->meshDoc->setBusy(false);
md->setBusy(false);
upGlA();
}

View File

@ -59,7 +59,7 @@ public:
EditHolePlugin();
virtual ~EditHolePlugin();
static const QString Info();
virtual bool StartEdit(MeshModel &/*m*/, GLArea * /*parent*/);
virtual bool StartEdit(MeshDocument &/*m*/, GLArea * /*parent*/);
virtual void EndEdit(MeshModel &/*m*/, GLArea * /*parent*/);
virtual void Decorate(MeshModel &/*m*/, GLArea * /*parent*/);
virtual void mousePressEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea * );
@ -74,6 +74,7 @@ private:
HoleSorterFilter *holeSorter;
GLArea *gla;
MeshModel *mesh;
MeshDocument *md;
FillerDialog *dialogFiller;
bool toDraw;

View File

@ -5,13 +5,13 @@ HEADERS = edit_hole_factory.h \
fillerDialog.h \
holeListModel.h \
fgtHole.h \
fgtBridge.h \
fgtBridge.h \
holeSetManager.h
SOURCES = edit_hole_factory.cpp \
edit_hole.cpp \
edit_hole.cpp \
fillerDialog.cpp\
holeListModel.cpp
holeListModel.cpp
TARGET = edit_hole

View File

@ -265,7 +265,7 @@ void AlignDialog::onClickItem(QTreeWidgetItem * item, int column )
else mItem->setIcon(1,QIcon(":/layer_eye_close.png"));
}
else {
gla->meshDoc->setCurrentMesh(nn->id);
this->edit->md->setCurrentMesh(nn->id);
updateCurrentNodeBackground();
}
} else {

View File

@ -87,9 +87,9 @@ void EditAlignPlugin::Decorate(MeshModel &m, GLArea * gla)
}
}
bool EditAlignPlugin::StartEdit(MeshModel &/*_mm*/, GLArea *_gla )
bool EditAlignPlugin::StartEdit(MeshDocument &_md, GLArea *_gla )
{
md=_gla->meshDoc;
this->md=&_md;
gla=_gla;
int id=0;

View File

@ -54,7 +54,7 @@ public:
static const QString Info();
virtual bool StartEdit(MeshModel &/*m*/, GLArea * /*parent*/);
virtual bool StartEdit(MeshDocument &/*m*/, GLArea * /*parent*/);
virtual void EndEdit(MeshModel &/*m*/, GLArea * /*parent*/);
virtual void Decorate(MeshModel &/*m*/, GLArea * /*parent*/);
virtual void mousePressEvent(QMouseEvent *, MeshModel &, GLArea * ) ;
@ -72,7 +72,7 @@ public:
MeshDocument *md;
MeshNode *currentNode() {return meshTree.find(md->mm());}
vcg::AlignPair::Result *currentArc() {return alignDialog->currentArc;};
vcg::AlignPair::Result *currentArc() {return alignDialog->currentArc;}
MeshTree meshTree;
GLArea * gla;