|
@@ -967,13 +967,14 @@ class LDrawLoader extends Loader {
|
|
|
mainEdgeColourCode: parentScope ? parentScope.mainEdgeColourCode : '24',
|
|
|
currentMatrix: new Matrix4(),
|
|
|
matrix: new Matrix4(),
|
|
|
+ type: 'Model',
|
|
|
|
|
|
// If false, it is a root material scope previous to parse
|
|
|
isFromParse: true,
|
|
|
|
|
|
- faces: null,
|
|
|
- lineSegments: null,
|
|
|
- conditionalSegments: null,
|
|
|
+ faces: [],
|
|
|
+ lineSegments: [],
|
|
|
+ conditionalSegments: [],
|
|
|
totalFaces: 0,
|
|
|
|
|
|
// If true, this object is the start of a construction step
|
|
@@ -1443,9 +1444,6 @@ class LDrawLoader extends Loader {
|
|
|
|
|
|
type = lp.getToken();
|
|
|
|
|
|
- currentParseScope.faces = [];
|
|
|
- currentParseScope.lineSegments = [];
|
|
|
- currentParseScope.conditionalSegments = [];
|
|
|
currentParseScope.type = type;
|
|
|
|
|
|
const isRoot = ! parentParseScope.isFromParse;
|
|
@@ -1856,6 +1854,13 @@ class LDrawLoader extends Loader {
|
|
|
|
|
|
finalizeObject( subobjectParseScope ) {
|
|
|
|
|
|
+ // fail gracefully if an object could not be loaded
|
|
|
+ if ( subobjectParseScope === null ) {
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
const parentParseScope = subobjectParseScope.parentScope;
|
|
|
|
|
|
// Smooth the normals if this is a part or if this is a case where the subpart
|
|
@@ -2045,6 +2050,7 @@ class LDrawLoader extends Loader {
|
|
|
} ).catch( function () {
|
|
|
|
|
|
console.warn( 'LDrawLoader: Subobject "' + subobject.fileName + '" could not be found.' );
|
|
|
+ return null;
|
|
|
|
|
|
} );
|
|
|
|