소스 검색

Editor: Fixed script editor title out-of-sync (#28413)

* sync script editor title

* no dispatching editScript, setValue is enough
ycw 1 년 전
부모
커밋
a379e9a3b3
2개의 변경된 파일22개의 추가작업 그리고 2개의 파일을 삭제
  1. 20 0
      editor/js/Script.js
  2. 2 2
      editor/js/commands/SetScriptValueCommand.js

+ 20 - 0
editor/js/Script.js

@@ -429,6 +429,26 @@ function Script( editor ) {
 
 
 	} );
 	} );
 
 
+	signals.objectChanged.add( function ( object ) {
+
+		if ( object === currentObject ) {
+
+			title.setValue( currentObject.name + ' / ' + currentScript.name );
+
+		}
+
+	} );
+
+	signals.scriptChanged.add( function ( script ) {
+
+		if ( script === currentScript ) {
+
+			title.setValue( currentObject.name + ' / ' + currentScript.name );
+
+		}
+
+	} );
+
 	return container;
 	return container;
 
 
 }
 }

+ 2 - 2
editor/js/commands/SetScriptValueCommand.js

@@ -31,7 +31,7 @@ class SetScriptValueCommand extends Command {
 
 
 		this.script[ this.attributeName ] = this.newValue;
 		this.script[ this.attributeName ] = this.newValue;
 
 
-		this.editor.signals.scriptChanged.dispatch();
+		this.editor.signals.scriptChanged.dispatch( this.script );
 
 
 	}
 	}
 
 
@@ -39,7 +39,7 @@ class SetScriptValueCommand extends Command {
 
 
 		this.script[ this.attributeName ] = this.oldValue;
 		this.script[ this.attributeName ] = this.oldValue;
 
 
-		this.editor.signals.scriptChanged.dispatch();
+		this.editor.signals.scriptChanged.dispatch( this.script );
 
 
 	}
 	}