184 if (_needsTriangleRecount) |
184 if (_needsTriangleRecount) |
185 { |
185 { |
186 _triangleCount = 0; |
186 _triangleCount = 0; |
187 |
187 |
188 for (LDObject* object : objects()) |
188 for (LDObject* object : objects()) |
189 _triangleCount += object->triangleCount(); |
189 _triangleCount += object->triangleCount(documentManager()); |
190 |
190 |
191 _needsTriangleRecount = false; |
191 _needsTriangleRecount = false; |
192 } |
192 } |
193 |
193 |
194 return _triangleCount; |
194 return _triangleCount; |
437 case 1: |
437 case 1: |
438 { |
438 { |
439 // Subfile |
439 // Subfile |
440 CheckTokenCount (tokens, 15); |
440 CheckTokenCount (tokens, 15); |
441 CheckTokenNumbers (tokens, 1, 13); |
441 CheckTokenNumbers (tokens, 1, 13); |
442 LDDocument* document = _manager->getDocumentByName(tokens[14]); |
|
443 |
|
444 // If we cannot open the file, mark it an error. Note we cannot use LDParseError |
|
445 // here because the error object needs the document reference. |
|
446 if (not document) |
|
447 { |
|
448 LDError* obj = emplaceAt<LDError>(position, line, format ("Could not open %1", tokens[14])); |
|
449 obj->setFileReferenced (tokens[14]); |
|
450 return obj; |
|
451 } |
|
452 |
442 |
453 Vertex referncePosition = ParseVertex (tokens, 2); // 2 - 4 |
443 Vertex referncePosition = ParseVertex (tokens, 2); // 2 - 4 |
454 Matrix transform; |
444 Matrix transform; |
455 |
445 |
456 for (int i = 0; i < 9; ++i) |
446 for (int i = 0; i < 9; ++i) |
457 transform.value(i) = tokens[i + 5].toDouble(); // 5 - 13 |
447 transform.value(i) = tokens[i + 5].toDouble(); // 5 - 13 |
458 |
448 |
459 LDSubfileReference* obj = emplaceAt<LDSubfileReference>(position, document, transform, referncePosition); |
449 LDSubfileReference* obj = emplaceAt<LDSubfileReference>(position, tokens[14], transform, referncePosition); |
460 obj->setColor (StringToNumber (tokens[1])); |
450 obj->setColor (StringToNumber (tokens[1])); |
461 return obj; |
451 return obj; |
462 } |
452 } |
463 |
453 |
464 case 2: |
454 case 2: |