From f92f341bb8dfa17c8d9fd1951414033af4136ffd Mon Sep 17 00:00:00 2001 From: clifford Date: Fri, 15 Jan 2010 14:01:56 +0000 Subject: Clifford Wolf: Added dumping of animation frames Some indenting fixes git-svn-id: http://svn.clifford.at/openscad/trunk@314 b57f626f-c46c-0410-a088-ec61d464b74c 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 current_win; + static QPointer 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 @@ + + + + Dump Pictures + + + @@ -98,7 +105,7 @@ 0 0 681 - 22 + 25 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; } -- cgit v0.10.1