浏览代码

added texturepath input type

Nicolas Cannasse 8 年之前
父节点
当前提交
6770fbbd2a
共有 2 个文件被更改,包括 17 次插入1 次删除
  1. 16 0
      hide/comp/PropsEditor.hx
  2. 1 1
      hide/view/Particles2D.hx

+ 16 - 0
hide/comp/PropsEditor.hx

@@ -145,6 +145,22 @@ class PropsField extends Component {
 				onChange(false);
 			}
 			return;
+		case "texturepath":
+			f.addClass("file");
+			tselect = new hide.comp.TextureSelect(f);
+			tselect.path = current;
+			tselect.onChange = function() {
+				props.undo.change(Field(context, fname, current), function() {
+					var f = resolveField();
+					f.current = Reflect.field(f.context, fname);
+					f.tselect.path = f.current;
+					f.onChange(true);
+				});
+				current = tselect.path;
+				Reflect.setProperty(context, fname, current);
+				onChange(false);
+			}
+			return;
 		case "model":
 			f.addClass("file");
 			fselect = new hide.comp.FileSelect(f, ["hmd", "fbx"]);

+ 1 - 1
hide/view/Particles2D.hx

@@ -225,7 +225,7 @@ class Particles2D extends FileView {
 		else {
 			if (props.backgroundPath != null) {
 				newBg.path = props.backgroundPath;
-				var tile = h2d.Tile.fromTexture(scene.loadTextureFile(state.path, props.backgroundPath));
+				var tile = h2d.Tile.fromTexture(scene.loadTexture(state.path, props.backgroundPath));
 				background = new h2d.Bitmap(tile);
 				scene.s2d.add(background, 0);
 				scene.s2d.addChild(parts);