Skip to content

Commit

Permalink
minor ui change, enable saving mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenyaoKe committed Sep 2, 2016
1 parent 12e1769 commit f829768
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
19 changes: 14 additions & 5 deletions forms/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,13 @@
<normaloff>:/icons/open.svg</normaloff>:/icons/open.svg</iconset>
</property>
<property name="text">
<string>Import</string>
<string>Import Model</string>
</property>
<property name="toolTip">
<string>Import a new obj file</string>
<string>Import an external model from an obj file</string>
</property>
<property name="statusTip">
<string>Import an external model from an obj file</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
Expand All @@ -748,7 +751,10 @@
<string>Export</string>
</property>
<property name="toolTip">
<string>Export data as</string>
<string>Export Unfolded Model as Graph</string>
</property>
<property name="statusTip">
<string>Export Unfolded Model as Graph</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
Expand Down Expand Up @@ -883,10 +889,13 @@
<normaloff>:/icons/save.svg</normaloff>:/icons/save.svg</iconset>
</property>
<property name="text">
<string>Save</string>
<string>Save Model</string>
</property>
<property name="toolTip">
<string>Save a file</string>
<string>Save current model to disk</string>
</property>
<property name="statusTip">
<string>Save current model to disk</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
Expand Down
5 changes: 4 additions & 1 deletion src/hds_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,10 @@ void HDS_Mesh::save(const string &filename)

// save the faces
for (int i = 0; i < faceMap.size(); ++i) {
auto corners = faceMap[i]->corners();
auto& curFace = faceMap[i];
if (curFace->isCutFace) continue;

auto corners = curFace->corners();
ss << "f ";
for (auto v : corners) {
ss << v->index + 1 << ' ';
Expand Down
4 changes: 3 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,10 @@ void MainWindow::closeFile() //later add this function
void MainWindow::saveFile()
{
QString filename = QFileDialog::getSaveFileName(this, "Input a file name","",tr("OBJ files(*.obj)"));
#if _DEBUG
cout << "saving file " << filename.toStdString() << endl;
MeshManager::getInstance()->saveMeshes();
#endif
MeshManager::getInstance()->saveMeshes(filename.toStdString());
}

void MainWindow::triggerExportSVG()
Expand Down
4 changes: 2 additions & 2 deletions src/meshmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,9 @@ bool MeshManager::smoothMesh()
}


bool MeshManager::saveMeshes()
bool MeshManager::saveMeshes(const string &filename)
{
// save only the cutted and unfolded
operationStack->getCurrentMesh()->save(filename);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/meshmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class MeshManager
bool createDFormMesh();
// Export as SVG files
bool exportSVGFile(const QString &filename, const confMap &conf);
bool saveMeshes();
bool saveMeshes(const string &filename);

void setCurrentOpFlag(OperationStack::Flag curFlag) { operationStack->setCurrentFlag(curFlag); }
public slots:
Expand Down

0 comments on commit f829768

Please sign in to comment.