support to show color per face

This commit is contained in:
wmayer
2019-09-24 21:37:11 +02:00
parent 0403ba68fa
commit 89a624caf1
3 changed files with 69 additions and 3 deletions

View File

@@ -209,6 +209,20 @@ private:
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
}
else if (mat.binding == MeshCore::MeshIO::PER_FACE &&
mat.diffuseColor.size() == mesh.countFacets()) {
FeatureCustom *pcFeature = new FeatureCustom();
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->Mesh.swapMesh(mesh);
App::PropertyColorList* prop = static_cast<App::PropertyColorList*>
(pcFeature->addDynamicProperty("App::PropertyColorList", "FaceColors"));
if (prop) {
prop->setValues(mat.diffuseColor);
}
pcFeature->purgeTouched();
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
}
else {
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", file.fileNamePure().c_str()));
@@ -274,6 +288,20 @@ private:
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
}
else if (mat.binding == MeshCore::MeshIO::PER_FACE &&
mat.diffuseColor.size() == mesh.countFacets()) {
FeatureCustom *pcFeature = new FeatureCustom();
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->Mesh.swapMesh(mesh);
App::PropertyColorList* prop = static_cast<App::PropertyColorList*>
(pcFeature->addDynamicProperty("App::PropertyColorList", "FaceColors"));
if (prop) {
prop->setValues(mat.diffuseColor);
}
pcFeature->purgeTouched();
pcDoc->addObject(pcFeature, file.fileNamePure().c_str());
}
else {
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", file.fileNamePure().c_str()));