소스 검색

Load 3D gizmo from Hide path

trethaller 7 년 전
부모
커밋
9d2709bff9
5개의 변경된 파일17개의 추가작업 그리고 361개의 파일을 삭제
  1. 12 0
      hide/ui/Ide.hx
  2. 1 3
      hide/ui/Props.hx
  3. 4 4
      hide/view/Level3D.hx
  4. 0 354
      res/gizmo.FBX
  5. BIN
      res/gizmo.hmd

+ 12 - 0
hide/ui/Ide.hx

@@ -6,6 +6,7 @@ class Ide {
 	public var projectDir(get,never) : String;
 	public var resourceDir(get,never) : String;
 	public var initializing(default,null) : Bool;
+	public var appPath(get, never): String;
 
 	public var mouseX : Int = 0;
 	public var mouseY : Int = 0;
@@ -218,6 +219,17 @@ class Ide {
 
 	function get_ideProps() return props.global.source.hide;
 	function get_currentProps() return props.user;
+	function get_appPath() {
+		var path = js.Node.process.argv[0].split("\\").join("/").split("/");
+		path.pop();
+		var hidePath = path.join("/");
+		if( !sys.FileSystem.exists(hidePath + "/package.json") ) {
+			var prevPath = new haxe.io.Path(hidePath).dir;
+			if( sys.FileSystem.exists(prevPath + "/hide.js") )
+				hidePath = prevPath;
+		}
+		return hidePath;
+	}
 
 	public function setClipboard( text : String ) {
 		nw.Clipboard.get().set(text, Text);

+ 1 - 3
hide/ui/Props.hx

@@ -84,9 +84,7 @@ class Props {
 	}
 
 	public static function loadForProject( projectPath : String, resourcePath : String ) {
-		var path = js.Node.process.argv[0].split("\\").join("/").split("/");
-		path.pop();
-		var hidePath = path.join("/");
+		var hidePath = Ide.inst.appPath;
 
 		// in dev mode
 		if( !sys.FileSystem.exists(hidePath + "/package.json") ) {

+ 4 - 4
hide/view/Level3D.hx

@@ -81,7 +81,10 @@ class Gizmo3D extends h3d.scene.Object {
 	public function new(scene: hide.comp.Scene) {
 		super(scene.s3d);
 		this.scene = scene;
-		gizmo = hxd.Res.gizmo.toHmd().makeObject();
+		var path = hide.ui.Ide.inst.appPath + "/../res/gizmo.hmd";
+		var data = sys.io.File.getBytes(path);
+		var hmd = hxd.res.Any.fromBytes(path, data).toModel().toHmd();
+		gizmo = hmd.makeObject();
 		addChild(gizmo);
 		debug = new h3d.scene.Graphics(scene.s3d);
 
@@ -680,9 +683,6 @@ class Level3D extends FileView {
 				}
 			}
 			gizmo.update(dt);
-			// var model = scene.s3d.getObjectByName("model0");
-			// model.setPos(gizmo.x, gizmo.y, gizmo.z);
-			// model.setRotationQuat(gizmo.getRotationQuat());
 		}
 		if( autoSync && (currentVersion != undo.currentID || lastSyncChange != properties.lastChange) ) {
 			save();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 354
res/gizmo.FBX


BIN
res/gizmo.hmd


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.