Commit e84b8eb6 authored by Sylvain Thery's avatar Sylvain Thery

schnapps_py_record: save frame_manip of maps

parent b5bd8dca
......@@ -353,7 +353,19 @@ public slots:
* @param sz scaling z factor
*/
void setScaling(float sx, float sy, float sz);
/**
* @brief [PYTHON] Save the frame into a string
* @return the storage string
*/
QString frameToString();
/**
* @brief [PYTHON] restore frame from string storage
* @param frame the string with frame info
*/
void frameFromString(QString frame);
/*********************************************************
* SIGNALS
......
......@@ -433,6 +433,29 @@ void MapHandlerGen::setScaling(float sx, float sy, float sz)
QString MapHandlerGen::frameToString()
{
QString res;
QTextStream str(&res);
const GLdouble* mat = m_frame->matrix();
for (int i = 0; i < 16; ++i)
str << mat[i] << " ";
return res;
}
void MapHandlerGen::frameFromString(QString frame)
{
QTextStream str(&frame);
GLdouble mat[16];
for (int i = 0; i < 16; ++i)
str >> mat[i];
m_frame->setFromMatrix(mat);
frameModified();
}
......
......@@ -1111,6 +1111,12 @@ void SCHNApps::pyRecording()
out << "schnapps.getCamera(\"" << cam->getName() << "\").fromString(\"" << cam->toString() << "\")" << endl;
}
// save frames of maps
foreach(MapHandlerGen* mhg, m_maps)
{
out << mhg->getName() << ".frameFromString(\"" << mhg->frameToString() << "\")" << endl;
}
//windows
out << "schnapps.setWindowSize(" << this->width() << ", "<< this->height() << ")" << endl;
......@@ -1184,6 +1190,13 @@ void SCHNApps::appendPyRecording()
out << "schnapps.getCamera(\"" << cam->getName() << "\").fromString(\"" << cam->toString() << "\")" << endl;
}
// save frames of maps
foreach(MapHandlerGen* mhg, m_maps)
{
out << mhg->getName() << ".frameFromString(\"" << mhg->frameToString() << "\")" << endl;
}
//windows
out << "schnapps.setWindowSize(" << this->width() << ", " << this->height() << ")" << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment