This repository was archived by the owner on Dec 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,8 +110,6 @@ return class EntityCache extends EventTarget {
110110 if ( valid && ! entitiesAdded . has ( entity . uuid ) ) {
111111 addEntity ( entity ) ;
112112 }
113-
114- return true ;
115113 } , {
116114 recursive : true ,
117115 } ) ;
@@ -175,6 +173,12 @@ return class EntityCache extends EventTarget {
175173 } ,
176174 }
177175
176+ // Register all dependencies, as they may not have
177+ // been patched with a custom toJSON yet.
178+ utils . forEachDependency ( entity , dep => {
179+ this . _registerEntity ( dep ) ;
180+ } ) ;
181+
178182 let entitiesAdded = new Set ( ) ;
179183 let serializedEntity = this . _serializeEntity ( entity , meta ) ;
180184
Original file line number Diff line number Diff line change @@ -39,11 +39,9 @@ const utils = {
3939 * @param {Object } options
4040 * @param {Function } options.recursive [false] whether or not an object should recursively iterate over
4141 * Object3D children and their dependencies.
42- * @param {Function } options.filter a function that receives an entity, and returns
43- * a boolean indicating whether or not this object should continue descent.
4442 */
4543 forEachDependency ( entity , fn , options = { } ) {
46- const shouldDescend = fn ( entity ) ;
44+ fn ( entity ) ;
4745
4846 if ( entity . isObject3D ) {
4947 if ( entity . material && entity . material . isMaterial ) {
@@ -56,7 +54,7 @@ const utils = {
5654 utils . forEachDependency ( entity . background , fn , options ) ;
5755 }
5856
59- if ( shouldDescend && entity . children && entity . children . length > 0 ) {
57+ if ( options . recursive && entity . children && entity . children . length > 0 ) {
6058 for ( let child of entity . children ) {
6159 utils . forEachDependency ( child , fn , options ) ;
6260 }
You can’t perform that action at this time.
0 commit comments