浏览代码

[gizmo] gizmo.hmd is now loaded via the Embeded file system for maximum compatibility

Clement Espeute 1 年之前
父节点
当前提交
691ee31326
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      hrt/tools/Gizmo.hx
  2. 0 0
      hrt/tools/res/gizmo.hmd

+ 7 - 7
hrt/tools/Gizmo.hx

@@ -169,13 +169,13 @@ class Gizmo extends h3d.scene.Object {
 	}
 
 	public function loadGizmoModel() : h3d.scene.Object {
-		#if editor
-		var path = hide.Ide.inst.appPath + "/res/gizmo.hmd";
-		#else
-		var path = "./res/Editor/gizmo.hmd";
-		#end
-		var data = sys.io.File.getBytes(path);
-		return hxd.res.Any.fromBytes(path, data).toModel().toHmd().makeObject();
+		var engine = h3d.Engine.getCurrent();
+		@:privateAccess var model : hxd.fmt.hmd.Library = engine.resCache.get(Gizmo);
+		if (model == null) {
+			model = hxd.res.Embed.getResource("hrt/tools/res/gizmo.hmd").toModel().toHmd();
+			@:privateAccess engine.resCache.set(Gizmo, model);
+		}
+		return model.makeObject();
 	}
 
 	public dynamic function onChangeMode(mode : EditMode) {}

+ 0 - 0
bin/res/gizmo.hmd → hrt/tools/res/gizmo.hmd