Parcourir la source

Removed CmdToggleBoolean and CmdToggleBooleanMaterial

Daniel il y a 10 ans
Parent
commit
3d7b7b31ec

+ 0 - 54
editor/js/CmdToggleBoolean.js

@@ -1,54 +0,0 @@
-/**
- * Created by Daniel on 21.07.15.
- */
-
-CmdToggleBoolean = function ( object, attributeName ) {
-
-	Cmd.call( this );
-
-	this.type = 'CmdToggleBoolean';
-
-	this.object = object;
-	this.attributeName = attributeName;
-	this.objectUuid = object !== undefined ? object.uuid : undefined;
-
-};
-
-CmdToggleBoolean.prototype = {
-
-	execute: function () {
-
-		this.object[ this.attributeName ] = !this.object[ this.attributeName ];
-		this.editor.signals.objectChanged.dispatch( this.object );
-
-	},
-
-	undo: function () {
-
-		this.object[ this.attributeName ] = !this.object[ this.attributeName ];
-		this.editor.signals.objectChanged.dispatch( this.object );
-
-	},
-
-	toJSON: function () {
-
-		var output = Cmd.prototype.toJSON.call( this );
-
-		output.objectUuid = this.objectUuid;
-		output.attributeName = this.attributeName;
-
-		return output;
-
-	},
-
-	fromJSON: function ( json ) {
-
-		Cmd.prototype.fromJSON.call( this, json );
-
-		this.object = this.editor.objectByUuid( json.objectUuid );
-		this.objectUuid = json.objectUuid;
-		this.attributeName = json.attributeName;
-
-	}
-
-};

+ 0 - 54
editor/js/CmdToggleBooleanMaterial.js

@@ -1,54 +0,0 @@
-/**
- * Created by Daniel on 21.07.15.
- */
-
-CmdToggleBooleanMaterial = function ( object, attributeName ) {
-
-	Cmd.call( this );
-
-	this.type = 'CmdToggleBooleanMaterial';
-
-	this.object = object;
-	this.attributeName = attributeName;
-	this.objectUuid = object !== undefined ? object.uuid : undefined;
-
-};
-
-CmdToggleBooleanMaterial.prototype = {
-
-	execute: function () {
-
-		this.object.material[ this.attributeName ] = !this.object.material[ this.attributeName ];
-		this.editor.signals.materialChanged.dispatch( this.object.material );
-
-	},
-
-	undo: function () {
-
-		this.object.material[ this.attributeName ] = !this.object.material[ this.attributeName ];
-		this.editor.signals.materialChanged.dispatch( this.object.material );
-
-	},
-
-	toJSON: function () {
-
-		var output = Cmd.prototype.toJSON.call( this );
-
-		output.objectUuid = this.objectUuid;
-		output.attributeName = this.attributeName;
-
-		return output;
-
-	},
-
-	fromJSON: function ( json ) {
-
-		Cmd.prototype.fromJSON.call( this, json );
-
-		this.object = this.editor.objectByUuid( json.objectUuid );
-		this.objectUuid = json.objectUuid;
-		this.attributeName = json.attributeName;
-
-	}
-
-};

+ 0 - 40
test/unit/editor/TestCmdToggleBoolean.js

@@ -1,40 +0,0 @@
-module( "CmdToggleBoolean" );
-
-test( "Test CmdToggleBoolean (Undo and Redo)", function(){
-
-	var editor = new Editor();
-
-	var box   = aBox( 'A Box' );
-	var light = aPointlight( 'A PointLight' );
-	var cam   = aPerspectiveCamera( 'A PerspectiveCamera' );
-
-	[ box, light, cam ].map( function( object ) {
-
-		editor.execute( new CmdAddObject( object) );
-		ok( 0 == 0, "Testing object of type '" + object.type + "'" );
-
-		[ 'visible' ].map( function( item ) {
-
-			if( object[ item ] !== undefined ) {
-
-				var beforeState =  object[ item ];
-				var afterState  = !object[ item ];
-				ok( 0 == 0, " Initial state of '" + item  + "' is '" + object[ item ] + "'" );
-
-				var cmd = new CmdToggleBoolean( object, item );
-				cmd.updatable = false;
-				editor.execute( cmd );
-				ok( object[ item ] == afterState , " OK, toggling boolean of '" + item + "' has been executed (expected: '" + afterState + "', actual: '" + object[ item ] + "')" );
-
-				editor.undo();
-				ok( object[ item ] == beforeState, " OK, toggling boolean of '" + item + "' has been undone (expected: '" + beforeState + "', actual: '" + object[ item ] + "')" );
-
-				editor.redo();
-				ok( object[ item ] == afterState , " OK, toggling boolean of '" + item + "' has been redone (expected: '" + afterState + "', actual: '" + object[ item ] + "')" );
-
-			}
-
-		});
-	});
-
-});

+ 0 - 2
test/unit/unittests_editor.html

@@ -89,7 +89,6 @@
 <script src="../../editor/js/CmdSetScriptValue.js"></script>
 <script src="../../editor/js/CmdSetUuid.js"></script>
 <script src="../../editor/js/CmdSetValue.js"></script>
-<script src="../../editor/js/CmdToggleBoolean.js"></script>
 
 
 <!-- add class-based unit tests below -->
@@ -115,7 +114,6 @@
 <script src="editor/TestCmdSetScriptValue.js"></script>
 <script src="editor/TestCmdSetUuid.js"></script>
 <script src="editor/TestCmdSetValue.js"></script>
-<script src="editor/TestCmdToggleBoolean.js"></script>
 <script src="editor/TestNestedDoUndoRedo.js"></script>
 
 </body>