瀏覽代碼

[hide] Add support for directory path in scene.listAnims

Clément Espeute 8 月之前
父節點
當前提交
6d4579fc65
共有 1 個文件被更改,包括 12 次插入6 次删除
  1. 12 6
      hide/comp/Scene.hx

+ 12 - 6
hide/comp/Scene.hx

@@ -341,6 +341,7 @@ class Scene extends hide.comp.Component implements h3d.IDrawable {
 	}
 
 	public function listAnims( path : String ) {
+		var isDir = sys.FileSystem.isDirectory(ide.getPath(path));
 
 		var config = hide.Config.loadForFile(ide, path);
 
@@ -348,15 +349,20 @@ class Scene extends hide.comp.Component implements h3d.IDrawable {
 		if( dirs == null ) dirs = [];
 		dirs = [for( d in dirs ) ide.resourceDir + d];
 
-		var parts = path.split("/");
-		parts.pop();
-		dirs.unshift(ide.getPath(parts.join("/")));
 
+		var parts = path.split("/");
 		var anims = [];
 
-		var lib = loadHMD(path, false);
-		if( lib.header.animations.length > 0 )
-			anims.push(ide.getPath(path));
+		if (!isDir) {
+			parts.pop();
+			dirs.unshift(ide.getPath(parts.join("/")));
+
+			var lib = loadHMD(path, false);
+			if( lib.header.animations.length > 0 )
+				anims.push(ide.getPath(path));
+		} else {
+			dirs.unshift(path);
+		}
 
 		for( dir in dirs ) {
 			var dir = dir;