Skip to content

Commit

Permalink
temp revert for preview4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Oct 1, 2018
1 parent aa6e8d4 commit dbca873
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 32 deletions.
10 changes: 2 additions & 8 deletions hxd/fmt/fbx/BaseLibrary.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ import haxe.io.Bytes;
using hxd.fmt.fbx.Data;
import h3d.col.Point;

#if (haxe_ver < 4)
import haxe.xml.Fast in Access;
#else
import haxe.xml.Access;
#end

class TmpObject {
public var index : Int;
public var model : FbxNode;
Expand Down Expand Up @@ -186,12 +180,12 @@ class BaseLibrary {
switch( pname ) {
case "UV" if( pval != "" ):
var xml = try Xml.parse(pval) catch( e : Dynamic ) throw "Invalid UV data in " + m.getName();
var frames = [for( f in new Access(xml.firstElement()).elements ) { var f = f.innerData.split(" "); { t : Std.parseFloat(f[0]) * 9622116.25, u : Std.parseFloat(f[1]), v : Std.parseFloat(f[2]) }} ];
var frames = [for( f in new haxe.xml.Fast(xml.firstElement()).elements ) { var f = f.innerData.split(" "); { t : Std.parseFloat(f[0]) * 9622116.25, u : Std.parseFloat(f[1]), v : Std.parseFloat(f[2]) }} ];
if( uvAnims == null ) uvAnims = new Map();
uvAnims.set(m.getName(), frames);
case "Events":
var xml = try Xml.parse(pval) catch( e : Dynamic ) throw "Invalid Events data in " + m.getName();
animationEvents = [for( f in new Access(xml.firstElement()).elements ) { var f = f.innerData.split(" "); { frame : Std.parseInt(f.shift()), data : StringTools.trim(f.join(" ")) }} ];
animationEvents = [for( f in new haxe.xml.Fast(xml.firstElement()).elements ) { var f = f.innerData.split(" "); { frame : Std.parseInt(f.shift()), data : StringTools.trim(f.join(" ")) }} ];
default:
}
}
Expand Down
9 changes: 2 additions & 7 deletions hxd/res/BitmapFont.hx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
package hxd.res;
#if (haxe_ver < 4)
import haxe.xml.Fast in Access;
#else
import haxe.xml.Access;
#end

class BitmapFont extends Resource {

Expand All @@ -27,7 +22,7 @@ class BitmapFont extends Resource {
var xml = Xml.parse(entry.getBytes().toString());
// support only the FontBuilder/Divo format
// export with FontBuilder https://github.com/andryblack/fontbuilder/downloads
var xml = new Access(xml.firstElement());
var xml = new haxe.xml.Fast(xml.firstElement());
size = Std.parseInt(xml.att.size);
lineHeight = Std.parseInt(xml.att.height);
name = xml.att.family;
Expand All @@ -49,7 +44,7 @@ class BitmapFont extends Resource {
// support for Littera XML format (starts with <font>)
// http://kvazars.com/littera/
var xml = Xml.parse(entry.getBytes().toString());
var xml = new Access(xml.firstElement());
var xml = new haxe.xml.Fast(xml.firstElement());
size = Std.parseInt(xml.node.info.att.size);
lineHeight = Std.parseInt(xml.node.common.att.lineHeight);
name = xml.node.info.att.face;
Expand Down
17 changes: 6 additions & 11 deletions hxd/res/DynamicText.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ package hxd.res;
import haxe.macro.Context;
import haxe.macro.Expr;
#end
#if (haxe_ver < 4)
import haxe.xml.Fast in Access;
#else
import haxe.xml.Access;
#end

abstract NoArg({}) {
}
Expand All @@ -24,15 +19,15 @@ abstract Key<T>(String) {
class DynamicText {

public static function parse( data : String ) : Dynamic {
var x = new Access(Xml.parse(data).firstElement());
var x = new haxe.xml.Fast(Xml.parse(data).firstElement());
var obj = {};
for( e in x.elements )
Reflect.setField(obj, e.att.id, parseXmlData(e));
return obj;
}

public static function apply( obj : Dynamic, data : String, ?onMissing ) {
var x = new Access(Xml.parse(data).firstElement());
var x = new haxe.xml.Fast(Xml.parse(data).firstElement());
applyRec([], obj, x, onMissing);
}

Expand Down Expand Up @@ -70,7 +65,7 @@ class DynamicText {
return parseText(str);
}

public static function applyRec( path : Array<String>, obj : Dynamic, data : Access, onMissing ) {
public static function applyRec( path : Array<String>, obj : Dynamic, data : haxe.xml.Fast, onMissing ) {
var fields = new Map();
for( f in Reflect.fields(obj) ) fields.set(f, true);
if( data != null )
Expand Down Expand Up @@ -123,7 +118,7 @@ class DynamicText {
}
}

static function parseXmlData( x : Access ) : Dynamic {
static function parseXmlData( x : haxe.xml.Fast ) : Dynamic {
switch( x.name ) {
case "g":
var first = x.elements.hasNext() ? x.elements.next() : null;
Expand Down Expand Up @@ -183,7 +178,7 @@ class DynamicText {
return Context.makePosition({ min : index, max : index + str.length, file : pos.file });
}

static function typeFromXml( x : Access, pos : { file : String, content : String, pos : Position } ) {
static function typeFromXml( x : haxe.xml.Fast, pos : { file : String, content : String, pos : Position } ) {
switch( x.name ) {
case "g":
var first = x.elements.next();
Expand Down Expand Up @@ -262,7 +257,7 @@ class DynamicText {
var fields = Context.getBuildFields();
var pos = Context.currentPos();
var fpos = { file : fullPath, content : content.toLowerCase(), pos : pos };
for( x in new Access(x.firstElement()).elements ) {
for( x in new haxe.xml.Fast(x.firstElement()).elements ) {
var id = x.att.id;
var t = typeFromXml(x, fpos);
fields.push( {
Expand Down
7 changes: 1 addition & 6 deletions hxd/res/TiledMap.hx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
package hxd.res;
#if (haxe_ver < 4)
import haxe.xml.Fast in Access;
#else
import haxe.xml.Access;
#end

typedef TiledMapLayer = {
var data : Array<Int>;
Expand All @@ -23,7 +18,7 @@ class TiledMap extends Resource {
public function toMap() : TiledMapData {
var data = entry.getBytes().toString();
var base = new haxe.crypto.BaseCode(haxe.io.Bytes.ofString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"));
var x = new Access(Xml.parse(data).firstElement());
var x = new haxe.xml.Fast(Xml.parse(data).firstElement());
var layers = [];
for( l in x.nodes.layer ) {
var data = StringTools.trim(l.node.data.innerData);
Expand Down

0 comments on commit dbca873

Please sign in to comment.