Преглед изворни кода

Made id property immutable.
I'm seeing people modifying it :(

Mr.doob пре 10 година
родитељ
комит
d2cfb5ec37
5 измењених фајлова са 10 додато и 5 уклоњено
  1. 2 1
      src/core/BufferGeometry.js
  2. 2 1
      src/core/Geometry.js
  3. 2 1
      src/core/Object3D.js
  4. 2 1
      src/materials/Material.js
  5. 2 1
      src/textures/Texture.js

+ 2 - 1
src/core/BufferGeometry.js

@@ -5,7 +5,8 @@
 
 THREE.BufferGeometry = function () {
 
-	this.id = THREE.GeometryIdCount ++;
+	Object.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );
+
 	this.uuid = THREE.Math.generateUUID();
 
 	this.name = '';

+ 2 - 1
src/core/Geometry.js

@@ -9,7 +9,8 @@
 
 THREE.Geometry = function () {
 
-	this.id = THREE.GeometryIdCount ++;
+	Object.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );
+
 	this.uuid = THREE.Math.generateUUID();
 
 	this.name = '';

+ 2 - 1
src/core/Object3D.js

@@ -7,7 +7,8 @@
 
 THREE.Object3D = function () {
 
-	this.id = THREE.Object3DIdCount ++;
+	Object.defineProperty( this, 'id', { value: THREE.Object3DIdCount ++ } );
+
 	this.uuid = THREE.Math.generateUUID();
 
 	this.name = '';

+ 2 - 1
src/materials/Material.js

@@ -5,7 +5,8 @@
 
 THREE.Material = function () {
 
-	this.id = THREE.MaterialIdCount ++;
+	Object.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } );
+
 	this.uuid = THREE.Math.generateUUID();
 
 	this.name = '';

+ 2 - 1
src/textures/Texture.js

@@ -6,7 +6,8 @@
 
 THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
 
-	this.id = THREE.TextureIdCount ++;
+	Object.defineProperty( this, 'id', { value: THREE.TextureIdCount ++ } );
+
 	this.uuid = THREE.Math.generateUUID();
 
 	this.name = '';