@@ -10,12 +10,6 @@ var Enums = require('./enums');
10
10
11
11
var version = require ( '../../package.json' ) . version ;
12
12
13
- var ThreeCache = {
14
- byId : { } ,
15
- byUuid : { } ,
16
- byName : { }
17
- } ;
18
-
19
13
20
14
var ThreeModel = widgets . WidgetModel . extend ( {
21
15
@@ -213,35 +207,13 @@ var ThreeModel = widgets.WidgetModel.extend({
213
207
obj . ipymodelId = this . model_id ; // brand that sucker
214
208
obj . ipymodel = this ;
215
209
216
- var cacheDescriptor = this . getCacheDescriptor ( ) ;
217
- if ( ! cacheDescriptor ) {
218
- console . error ( 'Model missing ID:' , this ) ;
219
- throw new Error ( 'Model missing ID!' ) ;
220
- }
221
-
222
- this . putThreeObjectIntoCache ( cacheDescriptor , obj ) ;
223
-
224
210
this . obj = obj ;
225
211
return obj ;
226
212
227
213
} ,
228
214
229
215
createThreeObjectAsync : function ( ) {
230
216
231
- // try cache first
232
- var cacheDescriptor = this . getCacheDescriptor ( ) ;
233
- if ( cacheDescriptor ) {
234
- var obj = this . getThreeObjectFromCache ( cacheDescriptor ) ;
235
- if ( obj ) {
236
- if ( obj . ipymodelId != this . model_id ) {
237
- throw new Error ( 'model id does not match three object: ' + obj . ipymodelId + ' -- ' + this . model_id ) ;
238
- }
239
-
240
- this . obj = obj ;
241
- return Promise . resolve ( obj ) ;
242
- }
243
- }
244
-
245
217
var objPromise ;
246
218
247
219
// call constructor method overridden by every class
@@ -262,39 +234,6 @@ var ThreeModel = widgets.WidgetModel.extend({
262
234
263
235
constructThreeObject : function ( ) { } ,
264
236
265
- //
266
- // Three.js object cache methods
267
- //
268
-
269
- getCacheDescriptor : function ( ) {
270
-
271
- var id = this . model_id ;
272
- if ( id != null ) {
273
- return { id : id } ;
274
- }
275
- return ;
276
-
277
- } ,
278
-
279
- getThreeObjectFromCache : function ( cacheDescriptor ) {
280
- if ( cacheDescriptor . id ) {
281
- return ThreeCache . byId [ cacheDescriptor . id ] ;
282
- } else if ( cacheDescriptor . uuid ) {
283
- return ThreeCache . byUuid [ cacheDescriptor . uuid ] ;
284
- } else if ( cacheDescriptor . name ) {
285
- return ThreeCache . byName [ cacheDescriptor . name ] ;
286
- }
287
- } ,
288
-
289
- putThreeObjectIntoCache : function ( cacheDescriptor , obj ) {
290
- if ( cacheDescriptor . id ) {
291
- ThreeCache . byId [ cacheDescriptor . id ] = obj ;
292
- } else if ( cacheDescriptor . uuid ) {
293
- ThreeCache . byUuid [ cacheDescriptor . uuid ] = obj ;
294
- } else if ( cacheDescriptor . name ) {
295
- ThreeCache . byName [ cacheDescriptor . name ] = obj ;
296
- }
297
- } ,
298
237
299
238
//
300
239
// Remote execution of three.js object methods
@@ -436,7 +375,7 @@ var ThreeModel = widgets.WidgetModel.extend({
436
375
// push data from three object to model
437
376
syncToModel : function ( syncAllProps ) {
438
377
439
- syncAllProps = syncAllProps == null ? false : syncAllProps ;
378
+ syncAllProps = syncAllProps === null ? false : syncAllProps ;
440
379
441
380
// Collect all the keys to set in one go
442
381
var toSet = { } ;
0 commit comments