ソースを参照

make cdb prefab editor current-file aware

Nicolas Cannasse 4 年 前
コミット
e99217546e
2 ファイル変更10 行追加2 行削除
  1. 5 1
      hide/comp/SceneEditor.hx
  2. 5 1
      hide/comp/cdb/ObjEditor.hx

+ 5 - 1
hide/comp/SceneEditor.hx

@@ -1469,7 +1469,11 @@ class SceneEditor {
 
 
 		if(curType != null) {
 		if(curType != null) {
 			var props = new hide.Element('<div></div>').appendTo(group.find(".content"));
 			var props = new hide.Element('<div></div>').appendTo(group.find(".content"));
-			var editor = new hide.comp.cdb.ObjEditor(curType, view.config, e.props, props);
+			var fileRef = view.state.path;
+			var ctx = context.shared.getContexts(e)[0];
+			if( ctx != null )
+				fileRef = ctx.shared.currentPath;
+			var editor = new hide.comp.cdb.ObjEditor(curType, view.config, e.props, fileRef, props);
 			editor.undo = properties.undo;
 			editor.undo = properties.undo;
 			editor.fileView = view;
 			editor.fileView = view;
 			editor.onChange = function(pname) {
 			editor.onChange = function(pname) {

+ 5 - 1
hide/comp/cdb/ObjEditor.hx

@@ -6,10 +6,12 @@ class ObjEditor extends Editor {
 
 
 	var obj : {};
 	var obj : {};
 	var structureWasChanged = false;
 	var structureWasChanged = false;
+	var fileReference : String;
 
 
-	public function new( sheet : cdb.Sheet, props, obj : {}, ?parent : Element ) {
+	public function new( sheet : cdb.Sheet, props, obj : {}, fileReference, ?parent : Element ) {
 		this.displayMode = AllProperties;
 		this.displayMode = AllProperties;
 		this.obj = obj;
 		this.obj = obj;
+		this.fileReference = fileReference;
 
 
 		// track changes in columns and props (structure changes made within local editor)
 		// track changes in columns and props (structure changes made within local editor)
 		function makeStructSign() {
 		function makeStructSign() {
@@ -88,6 +90,8 @@ class ObjEditor extends Editor {
 		var sheetData = Reflect.copy(@:privateAccess sheet.sheet);
 		var sheetData = Reflect.copy(@:privateAccess sheet.sheet);
 		sheetData.linesData = null;
 		sheetData.linesData = null;
 		sheetData.lines = [for( i in 0...sheetData.columns.length ) obj];
 		sheetData.lines = [for( i in 0...sheetData.columns.length ) obj];
+		sheetData.separators = [0];
+		sheetData.props = { separatorTitles: [fileReference] };
 		var s = new cdb.Sheet(sheet.base, sheetData);
 		var s = new cdb.Sheet(sheet.base, sheetData);
 		s.realSheet = sheet;
 		s.realSheet = sheet;
 		return s;
 		return s;