Commit a6f19930 authored by Ellen Dekkers's avatar Ellen Dekkers

OpenFlipper/Core: ParseObj: Distinguish between bspline curve and surface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5006 383ad7c9-94d9-4d36-a494-682f7c89f535
parent da4ebdce
...@@ -208,11 +208,28 @@ void Core::preprocessObjFile(QString _filename) ...@@ -208,11 +208,28 @@ void Core::preprocessObjFile(QString _filename)
// curve/surface type // curve/surface type
else if (token == "cstype") else if (token == "cstype")
{ {
bool nextLine = false;
in >> tmp; in >> tmp;
if (tmp == "bspline") if (tmp == "bspline")
{ {
dataType = DATA_BSPLINE_CURVE; // find out if it is a curve or a surface
typeFound = true; while((!nextLine) && (!in.eof()))
{
in >> tmp;
if (tmp == "curv")
{
nextLine = true;
dataType = DATA_BSPLINE_CURVE;
typeFound = true;
}
else if (tmp == "surf")
{
nextLine = true;
dataType = DATA_BSPLINE_SURFACE;
typeFound = true;
}
}
} }
} }
...@@ -231,6 +248,8 @@ void Core::preprocessObjFile(QString _filename) ...@@ -231,6 +248,8 @@ void Core::preprocessObjFile(QString _filename)
std::cout << _filename.toStdString() << " is of type DATA_TRIANGLE_MESH" << std::endl; std::cout << _filename.toStdString() << " is of type DATA_TRIANGLE_MESH" << std::endl;
else if (dataType == DATA_BSPLINE_CURVE) else if (dataType == DATA_BSPLINE_CURVE)
std::cout << _filename.toStdString() << " is of type DATA_BSPLINE_CURVE" << std::endl; std::cout << _filename.toStdString() << " is of type DATA_BSPLINE_CURVE" << std::endl;
else if (dataType == DATA_BSPLINE_SURFACE)
std::cout << _filename.toStdString() << " is of type DATA_BSPLINE_SURFACE" << std::endl;
else else
std::cout << "no data type found " << std::endl; std::cout << "no data type found " << std::endl;
...@@ -269,7 +288,7 @@ void Core::writeObjFile(QString _filename, bool _relativePaths, bool _targetOnly ...@@ -269,7 +288,7 @@ void Core::writeObjFile(QString _filename, bool _relativePaths, bool _targetOnly
PluginFunctions::IteratorRestriction restriction; PluginFunctions::IteratorRestriction restriction;
if ( _targetOnly ) if ( _targetOnly )
restriction = PluginFunctions::TARGET_OBJECTS; restriction = PluginFunctions::TARGET_OBJECTS;
else else
restriction = PluginFunctions::ALL_OBJECTS; restriction = PluginFunctions::ALL_OBJECTS;
// write all objects to a separate obj file and save external references in the global obj file // write all objects to a separate obj file and save external references in the global obj file
......
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