shared_ptr styles all over #4833

This commit is contained in:
Thomas Krijnen
2024-06-10 20:11:24 +02:00
parent f2074d95fd
commit c01263d721
13 changed files with 97 additions and 93 deletions
+4 -3
View File
@@ -40,8 +40,6 @@
}
}
%template(material_vector) std::vector<ifcopenshell::geometry::taxonomy::style>;
// SWIG does not support bool references in a meaningful way, so the
// ifcopenshell::geometry::Settings functions degrade to return a read only value
%typemap(out) double& {
@@ -198,6 +196,8 @@ std::string taxonomy_item_repr(ifcopenshell::geometry::taxonomy::item::ptr i) {
%include "../serializers/XmlSerializer.h"
%include "../serializers/GltfSerializer.h"
%template(material_vector) std::vector<ifcopenshell::geometry::taxonomy::style::ptr>;
%extend ifcopenshell::geometry::taxonomy::style {
size_t instance_id() const {
// @todo for some reason we have the IfcStyledItem/IfcMaterial here, but
@@ -529,7 +529,8 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
PyObject* colors_buffer() const {
std::vector<double> clrs;
clrs.reserve(self->materials().size() * 4);
for (auto& m : self->materials()) {
for (auto& mptr : self->materials()) {
auto& m = *mptr;
if (m.diffuse) {
clrs.push_back(m.diffuse.ccomponents()[0]);
clrs.push_back(m.diffuse.ccomponents()[1]);