From 608f7371700b2dff74279ca53239d27f61fdb699 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 3 Jan 2017 19:58:26 +0100 Subject: [PATCH] use normals if available --- src/Mod/Inspection/Gui/ViewProviderInspection.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp index 9a6d0dd94..42f9c8003 100644 --- a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp +++ b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include "ViewProviderInspection.h" @@ -193,7 +194,7 @@ void ViewProviderInspection::updateData(const App::Property* prop) Base::Type propId = App::PropertyComplexGeoData::getClassTypeId(); std::vector points; - std::vector normals; + std::vector normals; std::vector faces; // set the Distance property to the correct size to sync size of material node with number @@ -222,8 +223,13 @@ void ViewProviderInspection::updateData(const App::Property* prop) App::Property* prop = object->getPropertyByName("Points"); if (prop && prop->getTypeId().isDerivedFrom(propId)) { const Data::ComplexGeoData* data = static_cast(prop)->getComplexData(); + std::vector normals; data->getPoints(points, normals, accuracy); } + App::Property* propN = object->getPropertyByName("Normal"); + if (propN && propN->getTypeId().isDerivedFrom(Points::PropertyNormalList::getClassTypeId())) { + normals = static_cast(propN)->getValues(); + } } this->pcLinkRoot->removeAllChildren(); @@ -258,10 +264,8 @@ void ViewProviderInspection::updateData(const App::Property* prop) SbVec3f* norm = normalNode->vector.startEditing(); std::size_t i=0; - for (std::vector::const_iterator it = normals.begin(); it != normals.end(); ++it) { - norm[i++].setValue(static_cast(it->x), - static_cast(it->y), - static_cast(it->z)); + for (std::vector::const_iterator it = normals.begin(); it != normals.end(); ++it) { + norm[i++].setValue(it->x, it->y, it->z); } normalNode->vector.finishEditing();