Browse Source

root scope clarity

Garrett Johnson 6 years ago
parent
commit
1295797108
1 changed files with 4 additions and 3 deletions
  1. 4 3
      examples/js/loaders/LDrawLoader.js

+ 4 - 3
examples/js/loaders/LDrawLoader.js

@@ -338,9 +338,9 @@ THREE.LDrawLoader = ( function () {
 
 				function finalizeObject() {
 
-
 					// TODO: Handle smoothing
-					if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || ! parentParseScope.isFromParse ) {
+					var isRoot = ! parentParseScope.isFromParse;
+					if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
 
 						const objGroup = parseScope.groupObject;
 						if ( parseScope.triangles.length > 0 ) {
@@ -1125,7 +1125,8 @@ THREE.LDrawLoader = ( function () {
 										currentParseScope.optionalSegments = [];
 										currentParseScope.type = type;
 
-										if ( parentParseScope.isFromParse === false || scope.separateObjects && isPrimitiveType( type ) === false ) {
+										var isRoot = ! parentParseScope.isFromParse;
+										if ( isRoot || scope.separateObjects && ! isPrimitiveType( type ) ) {
 
 											currentParseScope.groupObject = new THREE.Group();