ncannasse пре 7 година
родитељ
комит
96cf299c18
6 измењених фајлова са 15 додато и 10 уклоњено
  1. 1 0
      hide/Ide.hx
  2. 6 2
      hide/comp/Scene.hx
  3. 2 2
      hide/comp/SceneEditor.hx
  4. 1 1
      hide/view/Image.hx
  5. 2 2
      hide/view/Particles2D.hx
  6. 3 3
      hide/view/Particles3D.hx

+ 1 - 0
hide/Ide.hx

@@ -348,6 +348,7 @@ class Ide {
 	}
 
 	public function getPath( relPath : String ) {
+		relPath = relPath.split("${HIDE}").join(appPath);
 		if( haxe.io.Path.isAbsolute(relPath) )
 			return relPath;
 		return resourceDir+"/"+relPath;

+ 6 - 2
hide/comp/Scene.hx

@@ -61,6 +61,7 @@ class Scene extends Component implements h3d.IDrawable {
 	var texCache = new Map<String, h3d.mat.Texture>();
 	var cleanup = new Array<Void->Void>();
 	var defaultCamera : h3d.Camera;
+	public var props : hide.ui.Props;
 	public var engine : h3d.Engine;
 	public var width(get, never) : Int;
 	public var height(get, never) : Int;
@@ -70,8 +71,9 @@ class Scene extends Component implements h3d.IDrawable {
 	public var speed : Float = 1.0;
 	public var visible(default, null) : Bool = true;
 
-	public function new(?parent,?el) {
+	public function new(props : hide.ui.Props, parent, el) {
 		super(parent,el);
+		this.props = props;
 		element.addClass("hide-scene-container");
 		canvas = cast new Element("<canvas class='hide-scene' style='width:100%;height:100%'/>").appendTo(element)[0];
 		canvas.addEventListener("mousemove",function(_) canvas.focus());
@@ -137,7 +139,7 @@ class Scene extends Component implements h3d.IDrawable {
 		return engine.height;
 	}
 
-	public function init( props : hide.ui.Props, ?root : h3d.scene.Object ) {
+	public function init( ?root : h3d.scene.Object ) {
 		var autoHide : Array<String> = props.get("scene.autoHide");
 		function initRec( obj : h3d.scene.Object ) {
 			if( autoHide.indexOf(obj.name) >= 0 )
@@ -198,6 +200,7 @@ class Scene extends Component implements h3d.IDrawable {
 			}
 			untyped bmp.ctx = { getImageData : function(_) return bmp, canvas : { width : 0, height : 0 } };
 			engine.driver.uploadTextureBitmap(t, cast bmp, 0, 0);
+			t.flags.unset(Loading);
 			if( onReady != null ) {
 				onReady(t);
 				onReady = null;
@@ -348,6 +351,7 @@ class Scene extends Component implements h3d.IDrawable {
 		var size = hxd.res.Any.fromBytes(path, bytes).toImage().getSize();
 		t = new h3d.mat.Texture(size.width,size.height);
 		t.clear(0x102030);
+		t.flags.set(Loading);
 		t.name = ide.makeRelative(path);
 		texCache.set(path, t);
 		if( onReady == null ) onReady = function(_) {};

+ 2 - 2
hide/comp/SceneEditor.hx

@@ -111,7 +111,7 @@ class SceneEditor {
 		tree.autoOpenNodes = false;
 
 		var sceneEl = new Element('<div class="scene"></div>');
-		scene = new hide.comp.Scene(null, sceneEl);
+		scene = new hide.comp.Scene(view.props, null, sceneEl);
 		scene.onReady = onSceneReady;
 
 		view.keys.register("copy", onCopy);
@@ -289,7 +289,7 @@ class SceneEditor {
 		sh.cleanups = [];
 		context.init();
 		sceneData.makeInstance(context);
-		scene.init(view.props);
+		scene.init();
 		refreshInteractives();
 		tree.refresh(function() {
 			for(elt in sh.contexts.keys()) {

+ 1 - 1
hide/view/Image.hx

@@ -6,7 +6,7 @@ class Image extends FileView {
 	var scene : hide.comp.Scene;
 
 	override function onDisplay() {
-		scene = new hide.comp.Scene(element);
+		scene = new hide.comp.Scene(null, null, element);
 		scene.onReady = function() {
 			scene.loadTexture(state.path, state.path, function(t) {
 				bmp = new h2d.Bitmap(h2d.Tile.fromTexture(t), scene.s2d);

+ 2 - 2
hide/view/Particles2D.hx

@@ -28,7 +28,7 @@ class Particles2D extends FileView {
 		');
 		properties = new hide.comp.PropsEditor(undo, null, element.find(".props"));
 		properties.saveDisplayKey = "particles2D";
-		scene = new hide.comp.Scene(null,element.find(".scene"));
+		scene = new hide.comp.Scene(props, null,element.find(".scene"));
 		scene.onReady = init;
 	}
 
@@ -43,7 +43,7 @@ class Particles2D extends FileView {
 		uiProps = { showBounds: false };
 
 		initProperties();
-		scene.init(props);
+		scene.init();
 		scene.onUpdate = update;
 		scene.onResize = onResize;
 	}

+ 3 - 3
hide/view/Particles3D.hx

@@ -24,7 +24,7 @@ class Particles3D extends FileView {
 		');
 		properties = new hide.comp.PropsEditor(undo, null, element.find(".props"));
 		properties.saveDisplayKey = "particles3D";
-		scene = new hide.comp.Scene(null,element.find(".scene"));
+		scene = new hide.comp.Scene(props, null,element.find(".scene"));
 		scene.onReady = init;
 		scene.onUpdate = update;
 	}
@@ -170,7 +170,7 @@ class Particles3D extends FileView {
 			scene.resetCamera(2);
 		}, 0);
 		new h3d.scene.CameraController(scene.s3d).loadFromCamera();
-		scene.init(props);
+		scene.init();
 
 		tf = new h2d.Text(hxd.res.DefaultFont.get(), scene.s2d);
 		tf.alpha = 0.2;
@@ -254,7 +254,7 @@ class Particles3D extends FileView {
 				}
 				if( model != null ) {
 					scene.s3d.addChild(model);
-					scene.init(this.props, model);
+					scene.init(model);
 
 					var prev = attach.val();
 					attach.empty();