浏览代码

fixed export animation

ncannasse 7 年之前
父节点
当前提交
bb5e243241
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      hide/view/Model.hx

+ 6 - 3
hide/view/Model.hx

@@ -17,6 +17,7 @@ class Model extends FileView {
 	var apause : { function toggle( v : Bool ) : Void; var element : Element; };
 	var apause : { function toggle( v : Bool ) : Void; var element : Element; };
 	var timeline : h2d.Graphics;
 	var timeline : h2d.Graphics;
 	var timecursor : h2d.Bitmap;
 	var timecursor : h2d.Bitmap;
+	var currentAnimation : String;
 
 
 	override function onDisplay() {
 	override function onDisplay() {
 		root.html('
 		root.html('
@@ -283,9 +284,9 @@ class Model extends FileView {
 					sys.io.File.saveContent(ide.getPath(file), new hxd.fmt.hmd.Dump().dump(hmd));
 					sys.io.File.saveContent(ide.getPath(file), new hxd.fmt.hmd.Dump().dump(hmd));
 				});
 				});
 			} },
 			} },
-			{ label : "Export Animation", enabled : this.extension != "hsd" && obj.currentAnimation != null, click : function() {
-				ide.chooseFileSave(this.getPath().substr(0,-4)+"_"+obj.currentAnimation."_dump.txt", function(file) {
-					var lib = @:privateAccess scene.loadHMD(this.getPath(),false);
+			{ label : "Export Animation", enabled : this.extension != "hsd" && currentAnimation != null, click : function() {
+				ide.chooseFileSave(this.getPath().substr(0,-4)+"_"+obj.currentAnimation.name+"_dump.txt", function(file) {
+					var lib = @:privateAccess scene.loadHMD(ide.getPath(currentAnimation),true);
 					var hmd = lib.header;
 					var hmd = lib.header;
 					hmd.data = lib.getData();
 					hmd.data = lib.getData();
 					sys.io.File.saveContent(ide.getPath(file), new hxd.fmt.hmd.Dump().dump(hmd));
 					sys.io.File.saveContent(ide.getPath(file), new hxd.fmt.hmd.Dump().dump(hmd));
@@ -308,9 +309,11 @@ class Model extends FileView {
 		apause.element.toggle(file != null);
 		apause.element.toggle(file != null);
 		if( file == null ) {
 		if( file == null ) {
 			obj.stopAnimation();
 			obj.stopAnimation();
+			currentAnimation = null;
 			return;
 			return;
 		}
 		}
 		var anim = scene.loadAnimation(file);
 		var anim = scene.loadAnimation(file);
+		currentAnimation = file;
 		obj.playAnimation(anim);
 		obj.playAnimation(anim);
 		buildTimeline();
 		buildTimeline();
 	}
 	}