Daniel 10 rokov pred
rodič
commit
3215b4bcd0

+ 1 - 0
editor/js/CmdToggleBoolean.js

@@ -46,6 +46,7 @@ CmdToggleBoolean.prototype = {
 		Cmd.prototype.fromJSON.call( this, json );
 
 		this.object = this.editor.objectByUuid( json.objectUuid );
+		this.objectUuid = json.objectUuid;
 		this.attributeName = json.attributeName;
 
 	}

+ 54 - 0
editor/js/CmdToggleBooleanMaterial.js

@@ -0,0 +1,54 @@
+/**
+ * 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;
+
+	}
+
+};