Base: set values in constructor of NormalItem
This commit is contained in:
@@ -658,9 +658,9 @@ void IndexedFaceSetItem::write(InventorOutput &out) const
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void NormalItem::setVector(const std::vector<Base::Vector3f>& vec)
|
||||
NormalItem::NormalItem(const std::vector<Base::Vector3f>& vec)
|
||||
: vector(vec)
|
||||
{
|
||||
vector = vec;
|
||||
}
|
||||
|
||||
void NormalItem::write(InventorOutput& out) const
|
||||
|
||||
@@ -423,8 +423,7 @@ private:
|
||||
class BaseExport NormalItem : public NodeItem
|
||||
{
|
||||
public:
|
||||
explicit NormalItem() = default;
|
||||
void setVector(const std::vector<Base::Vector3f>& vec);
|
||||
explicit NormalItem(const std::vector<Base::Vector3f>& vec);
|
||||
void write(InventorOutput& out) const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -2713,14 +2713,13 @@ bool MeshOutput::SaveInventor (std::ostream &rstrOut) const
|
||||
seq.next(true); // allow to cancel
|
||||
}
|
||||
|
||||
Base::NormalItem normal;
|
||||
normal.setVector(normals);
|
||||
builder.addNode(normal);
|
||||
// coordinates of the vertices
|
||||
builder.addNode(Base::NormalItem{normals});
|
||||
|
||||
Base::NormalBindingItem binding;
|
||||
binding.setValue(Base::BindingElement::Binding::PerFace);
|
||||
builder.addNode(binding);
|
||||
|
||||
// coordinates of the vertices
|
||||
std::vector<Base::Vector3f> coords;
|
||||
coords.reserve(_rclMesh.CountPoints());
|
||||
|
||||
@@ -2738,7 +2737,7 @@ bool MeshOutput::SaveInventor (std::ostream &rstrOut) const
|
||||
// and finally the facets with their point indices
|
||||
const MeshFacetArray& faces = _rclMesh.GetFacets();
|
||||
std::vector<int> indices;
|
||||
indices.reserve(4*faces.size());
|
||||
indices.reserve(4 * faces.size());
|
||||
for (MeshFacetArray::_TConstIterator it = faces.begin(); it != faces.end(); ++it) {
|
||||
indices.push_back(static_cast<int>(it->_aulPoints[0]));
|
||||
indices.push_back(static_cast<int>(it->_aulPoints[1]));
|
||||
|
||||
@@ -380,9 +380,7 @@ R"(Normal {
|
||||
QFETCH(Base::Vector3f, input);
|
||||
QFETCH(QString, result);
|
||||
|
||||
Base::NormalItem item;
|
||||
item.setVector({input});
|
||||
builder.addNode(item);
|
||||
builder.addNode(Base::NormalItem{{input}});
|
||||
QString string = QString::fromStdString(output.str());
|
||||
|
||||
QCOMPARE(string, result);
|
||||
|
||||
Reference in New Issue
Block a user