Skip to content

Commit f2bb301

Browse files
committed
Fix initialized three types
1 parent a488efd commit f2bb301

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

js/scripts/three-class-config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ module.exports = {
465465
shadow: new Types.InitializedThreeType('LightShadow', {nullable: false}),
466466
},
467467
constructorArgs: [ 'color', 'intensity' ],
468-
propsDefinedByThree: [ 'target', 'shadow' ]
469468
},
470469
DirectionalLightShadow: {
471470
relativePath: './lights/DirectionalLightShadow',
@@ -497,7 +496,6 @@ module.exports = {
497496
radius: new Types.Float(1)
498497
},
499498
constructorArgs: [ 'camera' ],
500-
propsDefinedByThree: [ 'camera' ],
501499
},
502500
PointLight: {
503501
relativePath: './lights/PointLight',
@@ -509,7 +507,6 @@ module.exports = {
509507
shadow: new Types.InitializedThreeType('LightShadow', {nullable: false}),
510508
},
511509
constructorArgs: [ 'color', 'intensity', 'distance', 'decay' ],
512-
propsDefinedByThree: [ 'shadow' ],
513510
},
514511
RectAreaLight: {
515512
relativePath: './lights/RectAreaLight',
@@ -527,7 +524,6 @@ module.exports = {
527524
shadow: new Types.InitializedThreeType('LightShadow', {nullable: false}),
528525
},
529526
constructorArgs: [ 'color', 'intensity', 'distance', 'angle', 'penumbra', 'decay' ],
530-
propsDefinedByThree: [ 'target', 'shadow' ]
531527
},
532528
SpotLightShadow: {
533529
relativePath: './lights/SpotLightShadow',

js/src/_base/Three.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ var ThreeModel = widgets.WidgetModel.extend({
124124
this.property_converters = {};
125125
this.property_assigners = {};
126126
this.property_mappers = {};
127+
128+
this.initialized_from_three = {};
127129
},
128130

129131
setupListeners: function() {
@@ -183,6 +185,7 @@ var ThreeModel = widgets.WidgetModel.extend({
183185

184186
// Return promise for their creation
185187
return Promise.all(_.map(uninit, function(propName) {
188+
this.initialized_from_three[propName] = true;
186189
var obj = this.obj[propName];
187190
// First, we need to figure out which model constructor to use
188191
var ctorName = obj.constructor.name + 'Model';
@@ -369,7 +372,11 @@ var ThreeModel = widgets.WidgetModel.extend({
369372

370373
_.each(this.property_converters, function(converterName, propName) {
371374
if (!syncAllProps && !(propName in this.props_created_by_three)) {
372-
return;
375+
if (this.initialized_from_three[propName]) {
376+
delete this.initialized_from_three[propName];
377+
} else {
378+
return;
379+
}
373380
}
374381

375382
if (!converterName) {

0 commit comments

Comments
 (0)