goat3d

diff goatview/src/goatview.cc @ 74:ab66cdabf6f2

loading scene files (no vis yet)
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 May 2014 13:26:52 +0300
parents 9862541fdcf5
children 76dea247f75c
line diff
     1.1 --- a/goatview/src/goatview.cc	Tue May 06 03:57:11 2014 +0300
     1.2 +++ b/goatview/src/goatview.cc	Tue May 06 13:26:52 2014 +0300
     1.3 @@ -1,4 +1,7 @@
     1.4  #include "goatview.h"
     1.5 +#include "goat3d.h"
     1.6 +
     1.7 +goat3d *scene;
     1.8  
     1.9  GoatView::GoatView()
    1.10  {
    1.11 @@ -77,7 +80,21 @@
    1.12  
    1.13  void GoatView::open_scene()
    1.14  {
    1.15 -	statusBar()->showMessage("opening scene...");
    1.16 +	std::string fname = QFileDialog::getOpenFileName(this, "Open scene file", "",
    1.17 +		"Goat3D Scene (*.goatsce);;All Files (*)").toStdString();
    1.18 +	if(fname.empty()) {
    1.19 +		statusBar()->showMessage("Abort: No file selected!");
    1.20 +		return;
    1.21 +	}
    1.22 +
    1.23 +	if(scene) {
    1.24 +		goat3d_free(scene);
    1.25 +	}
    1.26 +
    1.27 +	statusBar()->showMessage("opening scene file");
    1.28 +	if(!(scene = goat3d_create()) || goat3d_load(scene, fname.c_str()) == -1) {
    1.29 +		statusBar()->showMessage("failed to load scene file");
    1.30 +	}
    1.31  }
    1.32  
    1.33  void GoatView::open_anim()