Commit b2b2721e authored by Jan Möbius's avatar Jan Möbius

Use last material for new groups

parent 1a25e609
......@@ -646,6 +646,7 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
std::vector<VertexHandle> vhandles;
std::vector<int> face_texcoords;
QString matname;
QString lastMaterial;
#if defined (ENABLE_BSPLINECURVE_SUPPORT) || defined (ENABLE_BSPLINESURFACE_SUPPORT)
std::vector< int > cpIndices;
......@@ -739,10 +740,11 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
if ( mat.has_Texture() ){
//add object if not already there
_importer.useMaterial( matname.toStdString() );
_importer.useMaterial( matname.toStdString() );
}
lastMaterial = matname;
}
}
else if (mode == NONE && keyWrd == QLatin1String("v"))
......@@ -830,6 +832,10 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
inGroup = true;
faceCount = 0;
if (lastMaterial != "" ) {
_importer.useMaterial(lastMaterial.toStdString());
}
}
// face
......
......@@ -92,7 +92,7 @@ class Material
}
bool is_valid(void) const
{ return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_; }
{ return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_ || map_Kd_is_set_; }
/// Does material have a diffuse color?
bool has_Kd(void) { return Kd_is_set_; }
......
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