Skip to content

Commit 764d3c0

Browse files
committed
Object3D: Setting parent to null by default. See mrdoob#6987.
1 parent f8a1eec commit 764d3c0

18 files changed

Lines changed: 27 additions & 27 deletions

editor/js/Editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Editor.prototype = {
189189

190190
removeObject: function ( object ) {
191191

192-
if ( object.parent === undefined ) return; // avoid deleting the camera or scene
192+
if ( object.parent === null ) return; // avoid deleting the camera or scene
193193

194194
var scope = this;
195195

editor/js/Menubar.Edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Menubar.Edit = function ( editor ) {
5353

5454
var object = editor.selected;
5555

56-
if ( object.parent === undefined ) return; // avoid cloning the camera or scene
56+
if ( object.parent === null ) return; // avoid cloning the camera or scene
5757

5858
object = object.clone();
5959

editor/js/Sidebar.Object3D.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Sidebar.Object3D = function ( editor ) {
342342

343343
if ( object !== null ) {
344344

345-
if ( object.parent !== undefined ) {
345+
if ( object.parent !== null ) {
346346

347347
var newParentId = parseInt( objectParent.getValue() );
348348

@@ -535,7 +535,7 @@ Sidebar.Object3D = function ( editor ) {
535535
objectUUID.setValue( object.uuid );
536536
objectName.setValue( object.name );
537537

538-
if ( object.parent !== undefined ) {
538+
if ( object.parent !== null ) {
539539

540540
objectParent.setValue( object.parent.id );
541541

editor/js/libs/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ var APP = {
101101

102102
if ( vr === true ) {
103103

104-
if ( camera.parent === undefined ) {
104+
if ( camera.parent === null ) {
105105

106106
// camera needs to be in the scene so camera2 matrix updates
107107

examples/js/Gyroscope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THREE.Gyroscope.prototype.updateMatrixWorld = ( function () {
2929

3030
if ( this.matrixWorldNeedsUpdate || force ) {
3131

32-
if ( this.parent ) {
32+
if ( this.parent !== null ) {
3333

3434
this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
3535

examples/js/Mirror.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ THREE.ShaderLib[ 'mirror' ] = {
3737
"float blendOverlay(float base, float blend) {",
3838
"return( base < 0.5 ? ( 2.0 * base * blend ) : (1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );",
3939
"}",
40-
40+
4141
"void main() {",
4242

4343
"vec4 color = texture2DProj(mirrorSampler, mirrorCoord);",
@@ -76,7 +76,7 @@ THREE.Mirror = function ( renderer, camera, options ) {
7676
this.rotationMatrix = new THREE.Matrix4();
7777
this.lookAtPosition = new THREE.Vector3( 0, 0, - 1 );
7878
this.clipPlane = new THREE.Vector4();
79-
79+
8080
// For debug only, show the normal and plane of the mirror
8181
var debugMode = options.debugMode !== undefined ? options.debugMode : false;
8282

@@ -257,7 +257,7 @@ THREE.Mirror.prototype.render = function () {
257257
// Render the mirrored view of the current scene into the target texture
258258
var scene = this;
259259

260-
while ( scene.parent !== undefined ) {
260+
while ( scene.parent !== null ) {
261261

262262
scene = scene.parent;
263263

@@ -286,7 +286,7 @@ THREE.Mirror.prototype.renderTemp = function () {
286286
// Render the mirrored view of the current scene into the target texture
287287
var scene = this;
288288

289-
while ( scene.parent !== undefined ) {
289+
while ( scene.parent !== null ) {
290290

291291
scene = scene.parent;
292292

examples/js/effects/AnaglyphEffect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
105105

106106
scene.updateMatrixWorld();
107107

108-
if ( camera.parent === undefined ) camera.updateMatrixWorld();
108+
if ( camera.parent === null ) camera.updateMatrixWorld();
109109

110110
var hasCameraChanged = ( _aspect !== camera.aspect ) || ( _near !== camera.near ) || ( _far !== camera.far ) || ( _fov !== camera.fov );
111111

examples/js/effects/ParallaxBarrierEffect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ THREE.ParallaxBarrierEffect = function ( renderer ) {
104104

105105
scene.updateMatrixWorld();
106106

107-
if ( camera.parent === undefined ) camera.updateMatrixWorld();
107+
if ( camera.parent === null ) camera.updateMatrixWorld();
108108

109109
var hasCameraChanged = ( _aspect !== camera.aspect ) || ( _near !== camera.near ) || ( _far !== camera.far ) || ( _fov !== camera.fov );
110110

examples/js/effects/StereoEffect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ THREE.StereoEffect = function ( renderer ) {
7878

7979
scene.updateMatrixWorld();
8080

81-
if ( camera.parent === undefined ) camera.updateMatrixWorld();
82-
81+
if ( camera.parent === null ) camera.updateMatrixWorld();
82+
8383
camera.matrixWorld.decompose( _position, _quaternion, _scale );
8484

8585
// Effective fov of the camera

examples/js/effects/VREffect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ THREE.VREffect = function ( renderer, onError ) {
133133
renderer.enableScissorTest( true );
134134
renderer.clear();
135135

136-
if ( camera.parent === undefined ) camera.updateMatrixWorld();
136+
if ( camera.parent === null ) camera.updateMatrixWorld();
137137

138138
cameraL.projectionMatrix = fovToProjection( eyeFOVL, true, camera.near, camera.far );
139139
cameraR.projectionMatrix = fovToProjection( eyeFOVR, true, camera.near, camera.far );

0 commit comments

Comments
 (0)