Browse Source

Added description to every command-type with valid input types

Daniel 9 years ago
parent
commit
2645c32169

+ 7 - 1
editor/js/Cmd.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param editorRef pointer to main editor object used to initialize
+ *        each command object with a reference to the editor
+ * @constructor
  */
 
 Cmd = function ( editorRef ) {

+ 6 - 1
editor/js/CmdAddObject.js

@@ -1,5 +1,10 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @constructor
  */
 
 CmdAddObject = function ( object ) {

+ 7 - 1
editor/js/CmdAddScript.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param script javascript object
+ * @constructor
  */
 
 CmdAddScript = function ( object, script ) {

+ 8 - 1
editor/js/CmdMoveObject.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param newParent THREE.Object3D
+ * @param newBefore THREE.Object3D
+ * @constructor
  */
 
 CmdMoveObject = function ( object, newParent, newBefore ) {

+ 6 - 1
editor/js/CmdMultiCmds.js

@@ -1,5 +1,10 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param cmdArray array containing command objects
+ * @constructor
  */
 
 CmdMultiCmds = function ( cmdArray ) {

+ 6 - 1
editor/js/CmdRemoveObject.js

@@ -1,5 +1,10 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @constructor
  */
 
 CmdRemoveObject = function ( object ) {

+ 7 - 1
editor/js/CmdRemoveScript.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param script javascript object
+ * @constructor
  */
 
 CmdRemoveScript = function ( object, script ) {

+ 8 - 1
editor/js/CmdSetColor.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param attributeName string
+ * @param newValue integer representing a hex color value
+ * @constructor
  */
 
 CmdSetColor = function ( object, attributeName, newValue ) {

+ 7 - 1
editor/js/CmdSetGeometry.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param newGeometry THREE.Geometry
+ * @constructor
  */
 
 CmdSetGeometry = function ( object, newGeometry ) {

+ 8 - 1
editor/js/CmdSetGeometryValue.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param attributeName string
+ * @param newValue number, string, boolean or object
+ * @constructor
  */
 
 CmdSetGeometryValue = function ( object, attributeName, newValue ) {

+ 7 - 1
editor/js/CmdSetMaterial.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param newMaterial THREE.Material
+ * @constructor
  */
 
 CmdSetMaterial = function ( object, newMaterial ) {

+ 8 - 1
editor/js/CmdSetMaterialColor.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param attributeName string
+ * @param newValue integer representing a hex color value
+ * @constructor
  */
 
 CmdSetMaterialColor = function ( object, attributeName, newValue ) {

+ 8 - 1
editor/js/CmdSetMaterialMap.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param mapName string
+ * @param newMap THREE.Texture
+ * @constructor
  */
 
 CmdSetMaterialMap = function ( object, mapName, newMap ) {

+ 8 - 1
editor/js/CmdSetMaterialValue.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param attributeName string
+ * @param newValue number, string, boolean or object
+ * @constructor
  */
 
 CmdSetMaterialValue = function ( object, attributeName, newValue ) {

+ 13 - 6
editor/js/CmdSetPosition.js

@@ -1,8 +1,15 @@
 /**
- * Created by Daniel on 23.07.15.
+ * @author dforrer / https://github.com/dforrer
  */
 
-CmdSetPosition = function ( object, newPositionVector, oldPositionVector ) {
+/**
+ * @param object THREE.Object3D
+ * @param newPosition THREE.Vector3
+ * @param optionalOldPosition THREE.Vector3
+ * @constructor
+ */
+
+CmdSetPosition = function ( object, newPosition, optionalOldPosition ) {
 
 	Cmd.call( this );
 
@@ -12,16 +19,16 @@ CmdSetPosition = function ( object, newPositionVector, oldPositionVector ) {
 
 	this.object = object;
 
-	if ( object !== undefined && newPositionVector !== undefined ) {
+	if ( object !== undefined && newPosition !== undefined ) {
 
 		this.oldPosition = object.position.clone();
-		this.newPosition = newPositionVector.clone();
+		this.newPosition = newPosition.clone();
 
 	}
 
-	if ( oldPositionVector !== undefined ) {
+	if ( optionalOldPosition !== undefined ) {
 
-		this.oldPosition = oldPositionVector.clone();
+		this.oldPosition = optionalOldPosition.clone();
 
 	}
 

+ 13 - 6
editor/js/CmdSetRotation.js

@@ -1,8 +1,15 @@
 /**
- * Created by Daniel on 23.07.15.
+ * @author dforrer / https://github.com/dforrer
  */
 
-CmdSetRotation = function ( object, newRotationEuler, oldRotationEuler ) {
+/**
+ * @param object THREE.Object3D
+ * @param newRotation THREE.Euler
+ * @param optionalOldRotation THREE.Euler
+ * @constructor
+ */
+
+CmdSetRotation = function ( object, newRotation, optionalOldRotation ) {
 
 	Cmd.call( this );
 
@@ -12,16 +19,16 @@ CmdSetRotation = function ( object, newRotationEuler, oldRotationEuler ) {
 
 	this.object = object;
 
-	if ( object !== undefined && newRotationEuler !== undefined) {
+	if ( object !== undefined && newRotation !== undefined) {
 
 		this.oldRotation = object.rotation.clone();
-		this.newRotation = newRotationEuler.clone();
+		this.newRotation = newRotation.clone();
 
 	}
 
-	if ( oldRotationEuler !== undefined ) {
+	if ( optionalOldRotation !== undefined ) {
 
-		this.oldRotation = oldRotationEuler.clone();
+		this.oldRotation = optionalOldRotation.clone();
 
 	}
 

+ 14 - 6
editor/js/CmdSetScale.js

@@ -1,8 +1,15 @@
 /**
- * Created by Daniel on 23.07.15.
+ * @author dforrer / https://github.com/dforrer
  */
 
-CmdSetScale = function ( object, newScaleVector, oldScaleVector ) {
+/**
+ * @param object THREE.Object3D
+ * @param newScale THREE.Vector3
+ * @param optionalOldScale THREE.Vector3
+ * @constructor
+ */
+
+CmdSetScale = function ( object, newScale, optionalOldScale ) {
 
 	Cmd.call( this );
 
@@ -12,18 +19,19 @@ CmdSetScale = function ( object, newScaleVector, oldScaleVector ) {
 
 	this.object = object;
 
-	if ( object !== undefined && newScaleVector !== undefined ) {
+	if ( object !== undefined && newScale !== undefined ) {
 
 		this.oldScale = object.scale.clone();
-		this.newScale = newScaleVector.clone();
+		this.newScale = newScale.clone();
 
 	}
 
-	if ( oldScaleVector !== undefined ) {
+	if ( optionalOldScale !== undefined ) {
 
-		this.oldScale = oldScaleVector.clone();
+		this.oldScale = optionalOldScale.clone();
 
 	}
+
 };
 
 CmdSetScale.prototype = {

+ 13 - 8
editor/js/CmdSetScene.js

@@ -1,8 +1,13 @@
 /**
- * Created by Daniel on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
  */
 
-CmdSetScene = function ( newScene ) {
+/**
+ * @param scene containing children to import
+ * @constructor
+ */
+
+CmdSetScene = function ( scene ) {
 
 	Cmd.call( this );
 
@@ -11,15 +16,15 @@ CmdSetScene = function ( newScene ) {
 
 	this.cmdArray = [];
 
-	if ( newScene !== undefined ) {
+	if ( scene !== undefined ) {
 
-		this.cmdArray.push( new CmdSetUuid( this.editor.scene, newScene.uuid ) );
-		this.cmdArray.push( new CmdSetValue( this.editor.scene, 'name', newScene.name ) );
-		this.cmdArray.push( new CmdSetValue( this.editor.scene, 'userData', JSON.parse( JSON.stringify( newScene.userData ) ) ) );
+		this.cmdArray.push( new CmdSetUuid( this.editor.scene, scene.uuid ) );
+		this.cmdArray.push( new CmdSetValue( this.editor.scene, 'name', scene.name ) );
+		this.cmdArray.push( new CmdSetValue( this.editor.scene, 'userData', JSON.parse( JSON.stringify( scene.userData ) ) ) );
 
-		while ( newScene.children.length > 0 ) {
+		while ( scene.children.length > 0 ) {
 
-			var child = newScene.children.pop();
+			var child = scene.children.pop();
 			this.cmdArray.push( new CmdAddObject( child ) );
 
 		}

+ 11 - 2
editor/js/CmdSetScriptValue.js

@@ -1,5 +1,14 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param script javascript object
+ * @param attributeName string
+ * @param newValue string, object
+ * @param cursorPosition javascript object with format {line: 2, ch: 3}
+ * @constructor
  */
 
 CmdSetScriptValue = function ( object, script, attributeName, newValue, cursorPosition ) {
@@ -16,7 +25,7 @@ CmdSetScriptValue = function ( object, script, attributeName, newValue, cursorPo
 	this.attributeName = attributeName;
 	this.oldValue = ( script !== undefined ) ? script[ this.attributeName ] : undefined;
 	this.newValue = newValue;
-	this.cursorPosition = cursorPosition; // Format {line: 2, ch: 3}
+	this.cursorPosition = cursorPosition;
 
 };
 

+ 7 - 1
editor/js/CmdSetUuid.js

@@ -1,5 +1,11 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param newUuid string
+ * @constructor
  */
 
 CmdSetUuid = function ( object, newUuid ) {

+ 8 - 1
editor/js/CmdSetValue.js

@@ -1,5 +1,12 @@
 /**
- * Created by Daniel on 21.07.15.
+ * @author dforrer / https://github.com/dforrer
+ */
+
+/**
+ * @param object THREE.Object3D
+ * @param attributeName string
+ * @param newValue number, string, boolean or object
+ * @constructor
  */
 
 CmdSetValue = function ( object, attributeName, newValue ) {

+ 1 - 1
editor/js/History.js

@@ -1,6 +1,6 @@
 /**
  * @author mrdoob / http://mrdoob.com/
- * edited by dforrer on 20.07.15.
+ * @author dforrer / https://github.com/dforrer
  */
 
 History = function ( editor ) {