summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MainWindow.h2
-rw-r--r--MainWindow.ui9
-rw-r--r--mainwin.cc14
3 files changed, 21 insertions, 4 deletions
diff --git a/MainWindow.h b/MainWindow.h
index bd83523..1aba9bd 100644
--- a/MainWindow.h
+++ b/MainWindow.h
@@ -10,7 +10,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindow
Q_OBJECT
public:
- static QPointer<MainWindow> current_win;
+ static QPointer<MainWindow> current_win;
static void requestOpenFile(const QString &filename);
QString fileName;
diff --git a/MainWindow.ui b/MainWindow.ui
index afdb61c..c67e940 100644
--- a/MainWindow.ui
+++ b/MainWindow.ui
@@ -83,6 +83,13 @@
<item>
<widget class="QLineEdit" name="e_fsteps"/>
</item>
+ <item>
+ <widget class="QCheckBox" name="e_dump">
+ <property name="text">
+ <string>Dump Pictures</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -98,7 +105,7 @@
<x>0</x>
<y>0</y>
<width>681</width>
- <height>22</height>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
diff --git a/mainwin.cc b/mainwin.cc
index bf6bdf7..f5488ad 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -485,7 +485,7 @@ void MainWindow::compile(bool procevents)
root_node = NULL;
enableOpenCSG = false;
- // Initialize special variables
+ // Initialize special variables
root_ctx.set_variable("$t", Value(e_tval->text().toDouble()));
Value vpt;
@@ -895,13 +895,23 @@ void MainWindow::actionCompile()
compile(!viewActionAnimate->isChecked());
- // Go to non-CGAL view mode
+ // Go to non-CGAL view mode
if (!viewActionOpenCSG->isChecked() && !viewActionThrownTogether->isChecked()) {
viewModeOpenCSG();
}
else {
screen->updateGL();
}
+
+ if (viewActionAnimate->isChecked() && e_dump->isChecked()) {
+ QImage img = screen->grabFrameBuffer();
+ QString filename;
+ double s = e_fsteps->text().toDouble();
+ double t = e_tval->text().toDouble();
+ filename.sprintf("frame%05d.png", int(round(s*t)));
+ img.save(filename, "PNG");
+ }
+
current_win = NULL;
}
contact: Jan Huwald // Impressum