src/linetypes/subfilereference.cpp

changeset 193
b4beff48bb7a
parent 186
922662adb72a
--- a/src/linetypes/subfilereference.cpp	Wed May 25 17:25:24 2022 +0300
+++ b/src/linetypes/subfilereference.cpp	Wed May 25 17:42:02 2022 +0300
@@ -43,19 +43,22 @@
 ) const
 {
 	Model* dependency = this->resolve(context->modelId, context->documents);
-	PolygonCache* referencedModelPolygonBuilder = nullptr;
+	PolygonCache* cache = nullptr;
 	if (dependency != nullptr)
 	{
 		const auto dependencyModelId = context->documents->findIdForModel(dependency);
 		if (dependencyModelId.has_value())
 		{
-			referencedModelPolygonBuilder = context->documents->getPolygonCacheForModel(dependencyModelId.value());
+			cache = context->documents->getPolygonCacheForModel(dependencyModelId.value());
 		}
 	}
-	if (referencedModelPolygonBuilder != nullptr)
+	if (cache != nullptr)
 	{
 		const bool needInverting = glm::determinant(this->transformation) < 0;
-		const std::vector<gl::Polygon> modelPolygons = referencedModelPolygonBuilder->getPolygons(context->documents);
+		const std::vector<gl::Polygon> modelPolygons = getCachedPolygons(
+			cache,
+			dependency,
+			context->documents);
 		polygons.reserve(polygons.size() + modelPolygons.size());
 		for (gl::Polygon polygon : modelPolygons)
 		{

mercurial