mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
mapping binding - never overwrite already set item->instance
1) this way code should be more straightforward 2) this allows us not to reimplement mapping.get_surface_style logic in IfcGeomWrapper as it will be already handled in map_impl(const IfcSchema::IfcStyledItem* inst) and the resulting item->instance is not overridden by IfcStyledItem.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
try { \
|
||||
item = map_impl(inst->as<IfcSchema::T>()); \
|
||||
if (item != nullptr) { \
|
||||
if (!(item->instance && inst->as<IfcSchema::IfcMaterial>())) { \
|
||||
if (item->instance == nullptr) { \
|
||||
item->instance = inst; \
|
||||
} \
|
||||
try { \
|
||||
|
||||
@@ -200,8 +200,6 @@ std::string taxonomy_item_repr(ifcopenshell::geometry::taxonomy::item::ptr i) {
|
||||
|
||||
%extend ifcopenshell::geometry::taxonomy::style {
|
||||
size_t instance_id() const {
|
||||
// @todo for some reason we have the IfcStyledItem/IfcMaterial here, but
|
||||
// BlenderBIM expects IfcSurfaceStyle/IfcMaterial
|
||||
if (self->instance == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
@@ -209,23 +207,6 @@ std::string taxonomy_item_repr(ifcopenshell::geometry::taxonomy::item::ptr i) {
|
||||
if ((ent = self->instance->as<IfcUtil::IfcBaseEntity>()) == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (ent->declaration().name() == "IfcStyledItem") {
|
||||
aggregate_of_instance::ptr styles = *ent->get("Styles");
|
||||
if (styles->size() == 1) {
|
||||
ent = (*styles->begin())->as<IfcUtil::IfcBaseEntity>();
|
||||
// < IFC4X3.
|
||||
if (ent->declaration().name() == "IfcPresentationStyleAssignment") {
|
||||
aggregate_of_instance::ptr styles = *ent->get("Styles");
|
||||
if (styles->size() == 1) {
|
||||
ent = (*styles->begin())->as<IfcUtil::IfcBaseEntity>();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return ent->data().id();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user