Pārlūkot izejas kodu

Apply checkstyle

Lubos Lenco 4 gadi atpakaļ
vecāks
revīzija
ea6e84a93b

+ 17 - 14
Sources/arm/format/BlendParser.hx

@@ -76,7 +76,7 @@ class BlendParser {
 	}
 
 	public static function getTypeIndex(dna: Dna, type: String): Int {
-		for (i in 0...dna.types.length) if (type == dna.types[i]) { return i; }
+		for (i in 0...dna.types.length) if (type == dna.types[i]) return i;
 		return -1;
 	}
 
@@ -353,7 +353,10 @@ class Handle {
 				// Cast void* to type
 				if (asType != null) {
 					for (i in 0...dna.types.length) {
-						if (dna.types[i] == asType) { typeIndex = i; break; }
+						if (dna.types[i] == asType) {
+							typeIndex = i;
+							break;
+						}
 					}
 				}
 				// Raw type
@@ -363,18 +366,18 @@ class Handle {
 					var isArray = dnaName.charAt(dnaName.length - 1) == "]";
 					var len = isArray ? (arrayLen > 0 ? arrayLen : getArrayLen(dnaName)) : 1;
 					switch (type) {
-					case "int": return isArray ? blend.read32array(len) : blend.read32();
-					case "char": return isArray ? blend.readString() : blend.read8();
-					case "uchar": return isArray ? blend.read8array(len) : blend.read8();
-					case "short": return isArray ? blend.read16array(len) : blend.read16();
-					case "ushort": return isArray ? blend.read16array(len) : blend.read16();
-					case "float": return isArray ? blend.readf32array(len) : blend.readf32();
-					case "double": return 0; //blend.readf64();
-					case "long": return isArray ? blend.read32array(len) : blend.read32();
-					case "ulong": return isArray ? blend.read32array(len) : blend.read32();
-					case "int64_t": return blend.read64();
-					case "uint64_t": return blend.read64();
-					case "void": return 0;
+						case "int": return isArray ? blend.read32array(len) : blend.read32();
+						case "char": return isArray ? blend.readString() : blend.read8();
+						case "uchar": return isArray ? blend.read8array(len) : blend.read8();
+						case "short": return isArray ? blend.read16array(len) : blend.read16();
+						case "ushort": return isArray ? blend.read16array(len) : blend.read16();
+						case "float": return isArray ? blend.readf32array(len) : blend.readf32();
+						case "double": return 0; //blend.readf64();
+						case "long": return isArray ? blend.read32array(len) : blend.read32();
+						case "ulong": return isArray ? blend.read32array(len) : blend.read32();
+						case "int64_t": return blend.read64();
+						case "uint64_t": return blend.read64();
+						case "void": return 0;
 					}
 				}
 				// Structure

+ 1 - 1
Sources/arm/format/ExrWriter.hx

@@ -284,7 +284,7 @@ class ExrWriter {
 		function writeBGR(off: Int) {
 			writeLine(pos + byteSize * 2);
 			writeLine(pos + byteSize);
-			writeLine(pos    );
+			writeLine(pos);
 		}
 
 		function writeSingle(off: Int) {

+ 33 - 33
Sources/arm/format/FbxBinaryParser.hx

@@ -20,9 +20,9 @@ class FbxBinaryParser {
 		var version = read32();
 		is64 = version >= 7500;
 		root = {
-			name : "Root",
-			props : [PInt(0), PString("Root"), PString("Root")],
-			childs : parseNodes()
+			name: "Root",
+			props: [PInt(0), PString("Root"), PString("Root")],
+			childs: parseNodes()
 		};
 	}
 
@@ -64,36 +64,36 @@ class FbxBinaryParser {
 
 	function parseProp(): FbxProp {
 		switch (readChar()) {
-		case "C":
-			return PString(readChar());
-		case "Y":
-			return PInt(read16());
-		case "I":
-			return PInt(read32());
-		case "L":
-			return PInt(read64());
-		case "F":
-			return PFloat(readf32());
-		case "D":
-			return PFloat(readf64());
-		case "f":
-			return parseArray(readf32, true);
-		case "d":
-			return parseArray(readf64, true);
-		case "l":
-			return parseArray(read64);
-		case "i":
-			return parseArray(read32);
-		case "b":
-			return parseArray(readBool);
-		case "S":
-			var len = read32();
-			return PString(readChars(len));
-		case "R":
-			var b = readBytes(read32());
-			return null;
-		default:
-			return null;
+			case "C":
+				return PString(readChar());
+			case "Y":
+				return PInt(read16());
+			case "I":
+				return PInt(read32());
+			case "L":
+				return PInt(read64());
+			case "F":
+				return PFloat(readf32());
+			case "D":
+				return PFloat(readf64());
+			case "f":
+				return parseArray(readf32, true);
+			case "d":
+				return parseArray(readf64, true);
+			case "l":
+				return parseArray(read64);
+			case "i":
+				return parseArray(read32);
+			case "b":
+				return parseArray(readBool);
+			case "S":
+				var len = read32();
+				return PString(readChars(len));
+			case "R":
+				var b = readBytes(read32());
+				return null;
+			default:
+				return null;
 		}
 	}
 

+ 352 - 342
Sources/arm/format/FbxLibrary.hx

@@ -23,170 +23,163 @@
 package arm.format;
 
 enum FbxProp {
-	PInt( v : Int );
-	PFloat( v : Float );
-	PString( v : String );
-	PIdent( i : String );
-	PInts( v : Array<Int> );
-	PFloats( v : Array<Float> );
+	PInt(v: Int);
+	PFloat(v: Float);
+	PString(v: String);
+	PIdent(i: String);
+	PInts(v: Array<Int>);
+	PFloats(v: Array<Float>);
 }
 
 typedef FbxNode = {
-	var name : String;
-	var props : Array<FbxProp>;
-	var childs : Array<FbxNode>;
+	var name: String;
+	var props: Array<FbxProp>;
+	var childs: Array<FbxNode>;
 }
 
 class FbxTools {
 
-	public static function get( n : FbxNode, path : String, opt = false ) {
+	public static function get(n: FbxNode, path: String, opt = false) {
 		var parts = path.split(".");
 		var cur = n;
-		for( p in parts ) {
+		for (p in parts) {
 			var found = false;
-			for( c in cur.childs )
-				if( c.name == p ) {
+			for (c in cur.childs) {
+				if (c.name == p) {
 					cur = c;
 					found = true;
 					break;
 				}
-			if( !found ) {
-				if( opt )
-					return null;
+			}
+			if (!found) {
+				if (opt) return null;
 				throw n.name + " does not have " + path+" ("+p+" not found)";
 			}
 		}
 		return cur;
 	}
 
-	public static function getAll( n : FbxNode, path : String ) {
+	public static function getAll(n: FbxNode, path: String) {
 		var parts = path.split(".");
 		var cur = [n];
-		for( p in parts ) {
+		for (p in parts) {
 			var out = [];
-			for( n in cur )
-				for( c in n.childs )
-					if( c.name == p )
+			for (n in cur) {
+				for (c in n.childs) {
+					if (c.name == p) {
 						out.push(c);
+					}
+				}
+			}
 			cur = out;
-			if( cur.length == 0 )
-				return cur;
+			if (cur.length == 0) return cur;
 		}
 		return cur;
 	}
 
-	public static function getInts( n : FbxNode ) {
-		if( n.props.length != 1 )
-			throw n.name + " has " + n.props + " props";
-		switch( n.props[0] ) {
-		case PInts(v):
-			return v;
-		default:
+	public static function getInts(n: FbxNode) {
+		if (n.props.length != 1) {
 			throw n.name + " has " + n.props + " props";
 		}
+		switch (n.props[0]) {
+			case PInts(v):
+				return v;
+			default:
+				throw n.name + " has " + n.props + " props";
+		}
 	}
 
-	public static function getFloats( n : FbxNode ) {
-		if( n.props.length != 1 )
-			throw n.name + " has " + n.props + " props";
-		switch( n.props[0] ) {
-		case PFloats(v):
-			return v;
-		case PInts(i):
-			var fl = new Array<Float>();
-			for( x in i )
-				fl.push(x);
-			n.props[0] = PFloats(fl); // keep data synchronized
-			// this is necessary for merging geometries since we are pushing directly into the
-			// float buffer
-			return fl;
-		default:
+	public static function getFloats(n: FbxNode) {
+		if (n.props.length != 1) {
 			throw n.name + " has " + n.props + " props";
 		}
+		switch(n.props[0]) {
+			case PFloats(v):
+				return v;
+			case PInts(i):
+				var fl = new Array<Float>();
+				for(x in i) fl.push(x);
+				n.props[0] = PFloats(fl); // keep data synchronized
+				// this is necessary for merging geometries since we are pushing directly into the
+				// float buffer
+				return fl;
+			default:
+				throw n.name + " has " + n.props + " props";
+		}
 	}
 
-	public static function hasProp( n : FbxNode, p : FbxProp ) {
-		for( p2 in n.props )
-			if( Type.enumEq(p, p2) )
+	public static function hasProp(n: FbxNode, p: FbxProp) {
+		for (p2 in n.props) {
+			if (Type.enumEq(p, p2)) {
 				return true;
+			}
+		}
 		return false;
 	}
 
-	static inline function idToInt( f : Float ) {
-		#if (neko || hl)
-		// ids are unsigned
-		f %= 4294967296.;
-		if( f >= 2147483648. )
-			f -= 4294967296.;
-		else if( f < -2147483648. )
-			f += 4294967296.;
-		#end
+	static inline function idToInt(f: Float) {
 		return Std.int(f);
 	}
 
-	public static function toInt( n : FbxProp ) {
-		if( n == null ) throw "null prop";
-		return switch( n ) {
-		case PInt(v): v;
-		case PFloat(f): idToInt(f);
-		default: throw "Invalid prop " + n;
+	public static function toInt(n: FbxProp) {
+		if (n == null) throw "null prop";
+		return switch(n) {
+			case PInt(v): v;
+			case PFloat(f): idToInt(f);
+			default: throw "Invalid prop " + n;
 		}
 	}
 
-	public static function toFloat( n : FbxProp ) {
-		if( n == null ) throw "null prop";
-		return switch( n ) {
-		case PInt(v): v * 1.0;
-		case PFloat(v): v;
-		default: throw "Invalid prop " + n;
+	public static function toFloat(n: FbxProp) {
+		if (n == null) throw "null prop";
+		return switch(n) {
+			case PInt(v): v * 1.0;
+			case PFloat(v): v;
+			default: throw "Invalid prop " + n;
 		}
 	}
 
-	public static function toString( n : FbxProp ) {
-		if( n == null ) throw "null prop";
-		return switch( n ) {
-		case PString(v): v;
-		default: throw "Invalid prop " + n;
+	public static function toString(n: FbxProp) {
+		if (n == null) throw "null prop";
+		return switch(n) {
+			case PString(v): v;
+			default: throw "Invalid prop " + n;
 		}
 	}
 
-	public static function getId( n : FbxNode ) {
-		if( n.props.length != 3 )
-			throw n.name + " is not an object";
-		return switch( n.props[0] ) {
-		case PInt(id): id;
-		case PFloat(id) : idToInt(id);
-		default: throw n.name + " is not an object " + n.props;
+	public static function getId(n: FbxNode) {
+		if (n.props.length != 3) throw n.name + " is not an object";
+		return switch(n.props[0]) {
+			case PInt(id): id;
+			case PFloat(id): idToInt(id);
+			default: throw n.name + " is not an object " + n.props;
 		}
 	}
 
-	public static function getName( n : FbxNode ) {
-		if( n.props.length != 3 )
-			throw n.name + " is not an object";
-		return switch( n.props[1] ) {
-		case PString(n): n.split("::").pop();
-		default: throw n.name + " is not an object";
+	public static function getName(n: FbxNode) {
+		if (n.props.length != 3) throw n.name + " is not an object";
+		return switch(n.props[1]) {
+			case PString(n): n.split("::").pop();
+			default: throw n.name + " is not an object";
 		}
 	}
 
-	public static function getType( n : FbxNode ) {
-		if( n.props.length != 3 )
-			throw n.name + " is not an object";
-		return switch( n.props[2] ) {
-		case PString(n): n;
-		default: throw n.name + " is not an object";
+	public static function getType(n: FbxNode) {
+		if(n.props.length != 3) throw n.name + " is not an object";
+		return switch(n.props[2]) {
+			case PString(n): n;
+			default: throw n.name + " is not an object";
 		}
 	}
-
 }
 
 private enum Token {
-	TIdent( s : String );
-	TNode( s : String );
-	TInt( s : String );
-	TFloat( s : String );
-	TString( s : String );
-	TLength( v : Int );
+	TIdent(s: String);
+	TNode(s: String);
+	TInt(s: String);
+	TFloat(s: String);
+	TString(s: String);
+	TLength(v: Int);
 	TBraceOpen;
 	TBraceClose;
 	TColon;
@@ -195,155 +188,160 @@ private enum Token {
 
 class Parser {
 
-	var line : Int;
-	var buf : String;
-	var pos : Int;
-	var token : Null<Token>;
+	var line: Int;
+	var buf: String;
+	var pos: Int;
+	var token: Null<Token>;
 
-	function new() {
-	}
+	function new() {}
 
-	function parseText( str ) : FbxNode {
+	function parseText(str): FbxNode {
 		this.buf = str;
 		this.pos = 0;
 		this.line = 1;
 		token = null;
 		return {
-			name : "Root",
-			props : [PInt(0),PString("Root"),PString("Root")],
-			childs : parseNodes(),
+			name: "Root",
+			props: [PInt(0),PString("Root"),PString("Root")],
+			childs: parseNodes(),
 		};
 	}
 
 	function parseNodes() {
 		var nodes = [];
-		while( true ) {
-			switch( peek() ) {
-			case TEof, TBraceClose:
-				return nodes;
-			default:
+		while (true) {
+			switch(peek()) {
+				case TEof, TBraceClose:
+					return nodes;
+				default:
 			}
 			nodes.push(parseNode());
 		}
 		return nodes;
 	}
 
-	function parseNode() : FbxNode {
+	function parseNode(): FbxNode {
 		var t = next();
-		var name = switch( t ) {
-		case TNode(n): n;
-		default: unexpected(t);
+		var name = switch(t) {
+			case TNode(n): n;
+			default: unexpected(t);
 		};
 		var props = [], childs = null;
-		while( true ) {
+		while (true) {
 			t = next();
-			switch( t ) {
-			case TFloat(s):
-				props.push(PFloat(Std.parseFloat(s)));
-			case TInt(s):
-				props.push(PInt(Std.parseInt(s)));
-			case TString(s):
-				props.push(PString(s));
-			case TIdent(s):
-				props.push(PIdent(s));
-			case TBraceOpen, TBraceClose, TNode(_):
-				token = t;
-			case TLength(v):
-				except(TBraceOpen);
-				except(TNode("a"));
-				var ints : Array<Int> = [];
-				var floats : Array<Float> = null;
-				var i = 0;
-				while( i < v ) {
-					t = next();
-					switch( t ) {
-					case TColon:
-						continue;
-					case TInt(s):
-						i++;
-						if( floats == null )
-							ints.push(Std.parseInt(s));
-						else
-							floats.push(Std.parseInt(s));
-					case TFloat(s):
-						i++;
-						if( floats == null ) {
-							floats = [];
-							for( i in ints )
-								floats.push(i);
-							ints = null;
+			switch(t) {
+				case TFloat(s):
+					props.push(PFloat(Std.parseFloat(s)));
+				case TInt(s):
+					props.push(PInt(Std.parseInt(s)));
+				case TString(s):
+					props.push(PString(s));
+				case TIdent(s):
+					props.push(PIdent(s));
+				case TBraceOpen, TBraceClose, TNode(_):
+					token = t;
+				case TLength(v):
+					except(TBraceOpen);
+					except(TNode("a"));
+					var ints: Array<Int> = [];
+					var floats: Array<Float> = null;
+					var i = 0;
+					while (i < v) {
+						t = next();
+						switch(t) {
+							case TColon:
+								continue;
+							case TInt(s):
+								i++;
+								if (floats == null) {
+									ints.push(Std.parseInt(s));
+								}
+								else {
+									floats.push(Std.parseInt(s));
+								}
+							case TFloat(s):
+								i++;
+								if (floats == null) {
+									floats = [];
+									for(i in ints) {
+										floats.push(i);
+									}
+									ints = null;
+								}
+								floats.push(Std.parseFloat(s));
+							default:
+								unexpected(t);
 						}
-						floats.push(Std.parseFloat(s));
-					default:
-						unexpected(t);
 					}
-				}
-				props.push(floats == null ? PInts(ints) : PFloats(floats));
-				except(TBraceClose);
-				break;
-			default:
-				unexpected(t);
+					props.push(floats == null ? PInts(ints) : PFloats(floats));
+					except(TBraceClose);
+					break;
+				default:
+					unexpected(t);
 			}
 			t = next();
-			switch( t ) {
-			case TNode(_), TBraceClose:
-				token = t; // next
-				break;
-			case TColon:
-				// next prop
-			case TBraceOpen:
-				childs = parseNodes();
-				except(TBraceClose);
-				break;
-			default:
-				unexpected(t);
+			switch(t) {
+				case TNode(_), TBraceClose:
+					token = t; // next
+					break;
+				case TColon:
+					// next prop
+				case TBraceOpen:
+					childs = parseNodes();
+					except(TBraceClose);
+					break;
+				default:
+					unexpected(t);
 			}
 		}
-		if( childs == null ) childs = [];
-		return { name : name, props : props, childs : childs };
+		if (childs == null) childs = [];
+		return { name: name, props: props, childs: childs };
 	}
 
-	function except( except : Token ) {
+	function except(except: Token) {
 		var t = next();
-		if( !Type.enumEq(t, except) )
+		if (!Type.enumEq(t, except)) {
 			error("Unexpected '" + tokenStr(t) + "' (" + tokenStr(except) + " expected)");
+		}
 	}
 
 	function peek() {
-		if( token == null )
+		if (token == null) {
 			token = nextToken();
+		}
 		return token;
 	}
 
 	function next() {
-		if( token == null )
+		if (token == null) {
 			return nextToken();
+		}
 		var tmp = token;
 		token = null;
 		return tmp;
 	}
 
-	function error( msg : String ) : Dynamic {
+	function error(msg: String): Dynamic {
 		throw msg + " (line " + line + ")";
 		return null;
 	}
 
-	function unexpected( t : Token ) : Dynamic {
-		return error("Unexpected "+tokenStr(t));
+	function unexpected(t: Token): Dynamic {
+		return error("Unexpected " + tokenStr(t));
 	}
 
-	function tokenStr( t : Token ) {
-		return switch( t ) {
-		case TEof: "<eof>";
-		case TBraceOpen: '{';
-		case TBraceClose: '}';
-		case TIdent(i): i;
-		case TNode(i): i+":";
-		case TFloat(f): f;
-		case TInt(i): i;
-		case TString(s): '"' + s + '"';
-		case TColon: ',';
-		case TLength(l): '*' + l;
+	function tokenStr(t: Token) {
+		return switch(t) {
+			case TEof: "<eof>";
+			case TBraceOpen: '{';
+			case TBraceClose: '}';
+			case TIdent(i): i;
+			case TNode(i): i+":";
+			case TFloat(f): f;
+			case TInt(i): i;
+			case TString(s): '"' + s + '"';
+			case TColon: ',';
+			case TLength(l): '*' + l;
 		};
 	}
 
@@ -351,7 +349,7 @@ class Parser {
 		return StringTools.fastCodeAt(buf, pos++);
 	}
 
-	inline function getBuf( pos : Int, len : Int ) {
+	inline function getBuf(pos: Int, len: Int) {
 		return buf.substr(pos, len);
 	}
 
@@ -362,111 +360,114 @@ class Parser {
 	@:noDebug
 	function nextToken() {
 		var start = pos;
-		while( true ) {
+		while (true) {
 			var c = nextChar();
-			switch( c ) {
-			case ' '.code, '\r'.code, '\t'.code:
-				start++;
-			case '\n'.code:
-				line++;
-				start++;
-			case ';'.code:
-				while( true ) {
-					var c = nextChar();
-					if( StringTools.isEof(c) || c == '\n'.code ) {
-						pos--;
-						break;
+			switch(c) {
+				case ' '.code, '\r'.code, '\t'.code:
+					start++;
+				case '\n'.code:
+					line++;
+					start++;
+				case ';'.code:
+					while (true) {
+						var c = nextChar();
+						if (StringTools.isEof(c) || c == '\n'.code) {
+							pos--;
+							break;
+						}
 					}
-				}
-				start = pos;
-			case ','.code:
-				return TColon;
-			case '{'.code:
-				return TBraceOpen;
-			case '}'.code:
-				return TBraceClose;
-			case '"'.code:
-				start = pos;
-				while( true ) {
-					c = nextChar();
-					if( c == '"'.code )
-						break;
-					if( StringTools.isEof(c) || c == '\n'.code )
-						error("Unclosed string");
-				}
-				return TString(getBuf(start, pos - start - 1));
-			case '*'.code:
-				start = pos;
-				do {
-					c = nextChar();
-				} while( c >= '0'.code && c <= '9'.code );
-				pos--;
-				return TLength(Std.parseInt(getBuf(start, pos - start)));
-			default:
-				if( (c >= 'a'.code && c <= 'z'.code) || (c >= 'A'.code && c <= 'Z'.code) || c == '_'.code ) {
-					do {
+					start = pos;
+				case ','.code:
+					return TColon;
+				case '{'.code:
+					return TBraceOpen;
+				case '}'.code:
+					return TBraceClose;
+				case '"'.code:
+					start = pos;
+					while (true) {
 						c = nextChar();
-					} while( isIdentChar(c) );
-					if( c == ':'.code )
-						return TNode(getBuf(start, pos - start - 1));
-					pos--;
-					return TIdent(getBuf(start, pos - start));
-				}
-				if( (c >= '0'.code && c <= '9'.code) || c == '-'.code ) {
+						if (c == '"'.code) {
+							break;
+						}
+						if (StringTools.isEof(c) || c == '\n'.code) {
+							error("Unclosed string");
+						}
+					}
+					return TString(getBuf(start, pos - start - 1));
+				case '*'.code:
+					start = pos;
 					do {
 						c = nextChar();
-					} while( c >= '0'.code && c <= '9'.code );
-					if( c != '.'.code && c != 'E'.code && c != 'e'.code && pos - start < 10 ) {
+					} while (c >= '0'.code && c <= '9'.code);
+					pos--;
+					return TLength(Std.parseInt(getBuf(start, pos - start)));
+				default:
+					if((c >= 'a'.code && c <= 'z'.code) || (c >= 'A'.code && c <= 'Z'.code) || c == '_'.code) {
+						do {
+							c = nextChar();
+						} while (isIdentChar(c));
+						if (c == ':'.code) {
+							return TNode(getBuf(start, pos - start - 1));
+						}
 						pos--;
-						return TInt(getBuf(start, pos - start));
+						return TIdent(getBuf(start, pos - start));
 					}
-					if( c == '.'.code ) {
+					if ((c >= '0'.code && c <= '9'.code) || c == '-'.code) {
 						do {
 							c = nextChar();
-						} while( c >= '0'.code && c <= '9'.code );
-					}
-					if( c == 'e'.code || c == 'E'.code ) {
-						c = nextChar();
-						if( c != '-'.code && c != '+'.code )
+						} while (c >= '0'.code && c <= '9'.code);
+						if (c != '.'.code && c != 'E'.code && c != 'e'.code && pos - start < 10) {
 							pos--;
-						do {
+							return TInt(getBuf(start, pos - start));
+						}
+						if (c == '.'.code) {
+							do {
+								c = nextChar();
+							} while (c >= '0'.code && c <= '9'.code);
+						}
+						if (c == 'e'.code || c == 'E'.code) {
 							c = nextChar();
-						} while( c >= '0'.code && c <= '9'.code );
+							if (c != '-'.code && c != '+'.code)
+								pos--;
+							do {
+								c = nextChar();
+							} while (c >= '0'.code && c <= '9'.code);
+						}
+						pos--;
+						return TFloat(getBuf(start, pos - start));
 					}
-					pos--;
-					return TFloat(getBuf(start, pos - start));
-				}
-				if( StringTools.isEof(c) ) {
-					pos--;
-					return TEof;
-				}
-				error("Unexpected char '" + String.fromCharCode(c) + "'");
+					if (StringTools.isEof(c)) {
+						pos--;
+						return TEof;
+					}
+					error("Unexpected char '" + String.fromCharCode(c) + "'");
 			}
 		}
 	}
 
-	public static function parse( text : String ) {
+	public static function parse(text: String) {
 		return new Parser().parseText(text);
 	}
 }
 
 class FbxLibrary {
 
-	var root : FbxNode;
-	var ids : Map<Int,FbxNode>;
-	var connect : Map<Int,Array<Int>>;
-	var namedConnect : Map<Int,Map<String,Int>>;
-	var invConnect : Map<Int,Array<Int>>;
-	// var uvAnims : Map<String, Array<{ t : Float, u : Float, v : Float }>>;
-	// var animationEvents : Array<{ frame : Int, data : String }>;
+	var root: FbxNode;
+	var ids: Map<Int,FbxNode>;
+	var connect: Map<Int,Array<Int>>;
+	var namedConnect: Map<Int,Map<String,Int>>;
+	var invConnect: Map<Int,Array<Int>>;
+	// var uvAnims: Map<String, Array<{ t : Float, u : Float, v : Float }>>;
+	// var animationEvents: Array<{ frame : Int, data : String }>;
 
 	/**
 		The FBX version that was decoded
 	**/
-	public var version : Float = 0.;
+	public var version: Float = 0.;
 
 	public function new() {
-		root = { name : "Root", props : [], childs : [] };
+		root = { name: "Root", props: [], childs: [] };
 		reset();
 	}
 
@@ -477,16 +478,18 @@ class FbxLibrary {
 		invConnect = new Map();
 	}
 
-	public function load( root : FbxNode ) {
+	public function load(root: FbxNode) {
 		reset();
 		this.root = root;
 
 		version = FbxTools.toInt(FbxTools.get(root, "FBXHeaderExtension.FBXVersion").props[0]) / 1000;
-		if( Std.int(version) != 7 )
+		if (Std.int(version) != 7) {
 			throw "FBX Version 7.x required : use FBX 2010 export";
+		}
 
-		for( c in root.childs )
+		for (c in root.childs) {
 			init(c);
+		}
 
 		// init properties
 		// for( m in FbxTools.getAll(this.root, "Objects.Model") ) {
@@ -515,65 +518,70 @@ class FbxLibrary {
 		// }
 	}
 
-	function init( n : FbxNode ) {
-		switch( n.name ) {
-		case "Connections":
-			for( c in n.childs ) {
-				if( c.name != "C" )
-					continue;
-				var child = FbxTools.toInt(c.props[1]);
-				var parent = FbxTools.toInt(c.props[2]);
+	function init(n: FbxNode) {
+		switch (n.name) {
+			case "Connections":
+				for (c in n.childs) {
+					if (c.name != "C") {
+						continue;
+					}
+					var child = FbxTools.toInt(c.props[1]);
+					var parent = FbxTools.toInt(c.props[2]);
 
-				// Maya exports invalid references
-				if( ids.get(child) == null || ids.get(parent) == null ) continue;
+					// Maya exports invalid references
+					if (ids.get(child) == null || ids.get(parent) == null) continue;
 
-				var name = c.props[3];
+					var name = c.props[3];
 
-				if( name != null ) {
-					var name = FbxTools.toString(name);
-					var nc = namedConnect.get(parent);
-					if( nc == null ) {
-						nc = new Map();
-						namedConnect.set(parent, nc);
+					if (name != null) {
+						var name = FbxTools.toString(name);
+						var nc = namedConnect.get(parent);
+						if (nc == null) {
+							nc = new Map();
+							namedConnect.set(parent, nc);
+						}
+						nc.set(name, child);
+						// don't register as a parent, since the target can also be the child of something else
+						if (name == "LookAtProperty") continue;
 					}
-					nc.set(name, child);
-					// don't register as a parent, since the target can also be the child of something else
-					if( name == "LookAtProperty" ) continue;
-				}
 
-				var c = connect.get(parent);
-				if( c == null ) {
-					c = [];
-					connect.set(parent, c);
-				}
-				c.push(child);
+					var c = connect.get(parent);
+					if (c == null) {
+						c = [];
+						connect.set(parent, c);
+					}
+					c.push(child);
 
-				if( parent == 0 )
-					continue;
+					if (parent == 0) {
+						continue;
+					}
 
-				var c = invConnect.get(child);
-				if( c == null ) {
-					c = [];
-					invConnect.set(child, c);
+					var c = invConnect.get(child);
+					if (c == null) {
+						c = [];
+						invConnect.set(child, c);
+					}
+					c.push(parent);
 				}
-				c.push(parent);
-			}
-		case "Objects":
-			for( c in n.childs )
-				ids.set(FbxTools.getId(c), c);
-		default:
+			case "Objects":
+				for (c in n.childs) {
+					ids.set(FbxTools.getId(c), c);
+				}
+			default:
 		}
 	}
 
-	public function getGeometry( name : String = "" ) {
+	public function getGeometry(name: String = "") {
 		var geom = null;
-		for( g in FbxTools.getAll(root, "Objects.Geometry") )
-			if( FbxTools.hasProp(g, PString("Geometry::" + name)) ) {
+		for (g in FbxTools.getAll(root, "Objects.Geometry")) {
+			if (FbxTools.hasProp(g, PString("Geometry::" + name))) {
 				geom = g;
 				break;
 			}
-		if( geom == null )
+		}
+		if (geom == null) {
 			throw "Geometry " + name + " not found";
+		}
 		return new Geometry(this, geom);
 	}
 
@@ -584,7 +592,7 @@ class FbxLibrary {
 
 	public function getAllGeometries() {
 		var geoms = FbxTools.getAll(root, "Objects.Geometry");
-		var res:Array<Geometry> = [];
+		var res: Array<Geometry> = [];
 		for (g in geoms) res.push(new Geometry(this, g));
 		return res;
 	}
@@ -592,8 +600,8 @@ class FbxLibrary {
 
 class Geometry {
 
-	var lib : FbxLibrary;
-	var root : FbxNode;
+	var lib: FbxLibrary;
+	var root: FbxNode;
 
 	public function new(l, root) {
 		this.lib = l;
@@ -620,14 +628,15 @@ class Geometry {
 		var count = 0, pos = 0;
 		var index = getPolygons();
 		var vout = [], iout = [];
-		for( i in index ) {
+		for (i in index) {
 			count++;
-			if( i < 0 ) {
+			if (i < 0) {
 				index[pos] = -i - 1;
 				var start = pos - count + 1;
-				for( n in 0...count )
+				for (n in 0...count) {
 					vout.push(index[n + start]);
-				for( n in 0...count - 2 ) {
+				}
+				for (n in 0...count - 2) {
 					iout.push(start + n);
 					iout.push(start + count - 1);
 					iout.push(start + n + 1);
@@ -637,28 +646,28 @@ class Geometry {
 			}
 			pos++;
 		}
-		return { vidx : vout, idx : iout };
+		return { vidx: vout, idx: iout };
 	}
 
 	public function getNormals() {
 		return processVectors("LayerElementNormal", "Normals");
 	}
 
-	public function getTangents( opt = false ) {
+	public function getTangents(opt = false) {
 		return processVectors("LayerElementTangent", "Tangents", opt);
 	}
 
-	function processVectors( layer, name, opt = false ) {
+	function processVectors(layer, name, opt = false) {
 		var vect = FbxTools.get(root, layer + "." + name, opt);
-		if( vect == null ) return null;
+		if (vect == null) return null;
 		var nrm = FbxTools.getFloats(vect);
 		// if by-vertice (Maya in some cases, unless maybe "Split per-Vertex Normals" is checked)
 		// let's reindex based on polygon indexes
-		if( FbxTools.toString(FbxTools.get(root, layer+".MappingInformationType").props[0]) == "ByVertice" ) {
+		if (FbxTools.toString(FbxTools.get(root, layer+".MappingInformationType").props[0]) == "ByVertice") {
 			var nout = [];
-			for( i in getPolygons() ) {
+			for (i in getPolygons()) {
 				var vid = i;
-				if( vid < 0 ) vid = -vid - 1;
+				if (vid < 0) vid = -vid - 1;
 				nout.push(nrm[vid * 3]);
 				nout.push(nrm[vid * 3 + 1]);
 				nout.push(nrm[vid * 3 + 2]);
@@ -670,24 +679,25 @@ class Geometry {
 
 	public function getColors() {
 		var color = FbxTools.get(root, "LayerElementColor",true);
-		return color == null ? null : { values : FbxTools.getFloats(FbxTools.get(color, "Colors")), index : FbxTools.getInts(FbxTools.get(color, "ColorIndex")) };
+		return color == null ? null : { values: FbxTools.getFloats(FbxTools.get(color, "Colors")), index: FbxTools.getInts(FbxTools.get(color, "ColorIndex")) };
 	}
 
 	public function getUVs() {
 		var uvs = [];
-		for( v in FbxTools.getAll(root, "LayerElementUV") ) {
+		for (v in FbxTools.getAll(root, "LayerElementUV")) {
 			var index = FbxTools.get(v, "UVIndex", true);
 			var values = FbxTools.getFloats(FbxTools.get(v, "UV"));
-			var index = if( index == null ) {
+			var index = if (index == null) {
 				// ByVertice/Direct (Maya sometimes...)
-				[for( i in getPolygons() ) if( i < 0 ) -i - 1 else i];
-			} else FbxTools.getInts(index);
-			uvs.push({ values : values, index : index });
+				[for (i in getPolygons()) if (i < 0) -i - 1 else i];
+			}
+			else FbxTools.getInts(index);
+			uvs.push({ values: values, index: index });
 		}
 		return uvs;
 	}
 
-	public function getBuffers(binary:Bool, p:FbxParser) {
+	public function getBuffers(binary: Bool, p: FbxParser) {
 		// triangulize indexes :
 		// format is  A,B,...,-X : negative values mark the end of the polygon
 		var pbuf = getVertices();

+ 6 - 2
Sources/arm/format/FbxParser.hx

@@ -41,8 +41,12 @@ class FbxParser {
 
 		var fbx = binary ? FbxBinaryParser.parse(blob) : Parser.parse(blob.toString());
 		var lib = new FbxLibrary();
-		try { lib.load(fbx); }
-		catch (e: Dynamic) { trace(e); }
+		try {
+			lib.load(fbx);
+		}
+		catch (e: Dynamic) {
+			trace(e);
+		}
 
 		geoms = lib.getAllGeometries();
 		next();

+ 106 - 99
Sources/arm/format/JpgWriter.hx

@@ -63,10 +63,10 @@ class JpgWriter {
 			72, 92, 95, 98,112,100,103, 99
 		];
 		for (i in 0...64) {
-			var t: Int = Math.floor( (YQT[i] * sf + 50) / 100 );
-			if( t < 1 ) t = 1;
-			else if( t > 255 ) t = 255;
-			YTable[ ZigZag[i] ] = t;
+			var t: Int = Math.floor((YQT[i] * sf + 50) / 100);
+			if (t < 1) t = 1;
+			else if (t > 255) t = 255;
+			YTable[ZigZag[i]] = t;
 		}
 		var UVQT: Array<Int> = [
 			17, 18, 24, 47, 99, 99, 99, 99,
@@ -78,19 +78,19 @@ class JpgWriter {
 			99, 99, 99, 99, 99, 99, 99, 99,
 			99, 99, 99, 99, 99, 99, 99, 99
 		];
-		for( j in 0...64 ) {
-			var u: Int = Math.floor( (UVQT[j] * sf + 50) / 100 );
-			if( u < 1 ) u = 1;
-			else if( u > 255 ) u = 255;
-			UVTable[ ZigZag[j] ] = u;
+		for (j in 0...64) {
+			var u: Int = Math.floor((UVQT[j] * sf + 50) / 100);
+			if (u < 1) u = 1;
+			else if (u > 255) u = 255;
+			UVTable[ZigZag[j]] = u;
 		}
 		var aasf: Array<Float> = [
 			1.0, 1.387039845, 1.306562965, 1.175875602,
 			1.0, 0.785694958, 0.541196100, 0.275899379
 		];
 		var k = 0;
-		for( row in 0...8 ) {
-			for( col in 0...8 ) {
+		for (row in 0...8) {
+			for (col in 0...8) {
 				fdtbl_Y[k]  = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0));
 				fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0));
 				k++;
@@ -105,7 +105,7 @@ class JpgWriter {
 
 	function initLuminance() {
 		std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0];
-		std_dc_luminance_values = strIntsToBytes( '0,1,2,3,4,5,6,7,8,9,10,11' );
+		std_dc_luminance_values = strIntsToBytes('0,1,2,3,4,5,6,7,8,9,10,11');
 		std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d];
 		std_ac_luminance_values = strIntsToBytes(
 			'0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,' +
@@ -132,21 +132,21 @@ class JpgWriter {
 		);
 	}
 
-	function strIntsToBytes( s: String ) {
+	function strIntsToBytes(s: String) {
 		var len = s.length;
 		var b = new haxe.io.BytesBuffer();
 		var val = 0;
 		var i = 0;
-		for( j in 0...len ) {
-			if( s.charAt( j ) == ',' ) {
-				val = Std.parseInt( s.substr(i, j - i) );
-				b.addByte( val );
+		for (j in 0...len) {
+			if (s.charAt(j) == ',') {
+				val = Std.parseInt(s.substr(i, j - i));
+				b.addByte(val);
 				i = j + 1;
 			}
 		}
-		if( i < len ) {
-			val = Std.parseInt( s.substr(i) );
-			b.addByte( val );
+		if (i < len) {
+			val = Std.parseInt(s.substr(i));
+			b.addByte(val);
 		}
 		return b.getBytes();
 	}
@@ -158,7 +158,7 @@ class JpgWriter {
 
 	function initChrominance() {
 		std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0];
-		std_dc_chrominance_values = strIntsToBytes( '0,1,2,3,4,5,6,7,8,9,10,11' );
+		std_dc_chrominance_values = strIntsToBytes('0,1,2,3,4,5,6,7,8,9,10,11');
 		std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77];
 		std_ac_chrominance_values = strIntsToBytes(
 			'0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,' +
@@ -201,11 +201,11 @@ class JpgWriter {
 		var codevalue = 0;
 		var pos_in_table = 0;
 		var HT: Map<Int,BitString> = new Map();
-		for( k in 1...17 ) {
+		for (k in 1...17) {
 			var end = nrcodes[k];
-			for( j in 0...end ) {
-				var idx: Int = std_table.get( pos_in_table );
-				HT.set( idx, new BitString( k, codevalue ) );
+			for (j in 0...end) {
+				var idx: Int = std_table.get(pos_in_table);
+				HT.set(idx, new BitString(k, codevalue));
 				pos_in_table++;
 				codevalue++;
 			}
@@ -223,17 +223,17 @@ class JpgWriter {
 		var idx: Int;
 		for (cat in 1...16) {
 			//Positive numbers
-			for( nr in nrlower...nrupper ) {
+			for (nr in nrlower...nrupper) {
 				idx = 32767 + nr;
-				category.set( idx, cat );
-				bitcode.set( idx, new BitString( cat, nr ) );
+				category.set(idx, cat);
+				bitcode.set(idx, new BitString(cat, nr));
 			}
 			//Negative numbers
 			var nrneg: Int = -(nrupper - 1);
-			while( nrneg <= -nrlower ) {
+			while (nrneg <= -nrlower) {
 				idx = 32767 + nrneg;
-				category.set( idx, cat );
-				bitcode.set( idx, new BitString( cat, nrupper - 1 + nrneg ) );
+				category.set(idx, cat);
+				bitcode.set(idx, new BitString(cat, nrupper - 1 + nrneg));
 				nrneg++;
 			}
 			nrlower <<= 1;
@@ -249,16 +249,16 @@ class JpgWriter {
 	function writeBits(bs: BitString) {
 		var value: Int = bs.val;
 		var posval: Int = bs.len - 1;
-		while( posval >= 0 ) {
-			//if (value & uint(1 << posval) ) {
-			if( (value & (1 << posval)) != 0 ) {  //<- CORRECT ?
+		while (posval >= 0) {
+			//if (value & uint(1 << posval)) {
+			if ((value & (1 << posval)) != 0) {  //<- CORRECT ?
 				//bytenew |= uint(1 << bytepos);
 				bytenew |= (1 << bytepos);
 			}
 			posval--;
 			bytepos--;
-			if( bytepos < 0 ) {
-				if( bytenew == 0xFF ) {
+			if (bytepos < 0) {
+				if (bytenew == 0xFF) {
 					b(0xFF);
 					b(0);
 				}
@@ -271,9 +271,9 @@ class JpgWriter {
 		}
 	}
 
-	function writeWord( val: Int ) {
-		b( (val >> 8) & 0xFF );
-		b( val & 0xFF );
+	function writeWord(val: Int) {
+		b((val >> 8) & 0xFF);
+		b(val & 0xFF);
 	}
 
 	// DCT & quantization core
@@ -407,20 +407,22 @@ class JpgWriter {
 		b(0xFF); b(0xDB);  //<- marker 0xFFDB
 		b(0); b(132);   //<- length
 		b(0);
-		for( j in 0...64 )
+		for(j in 0...64) {
 			b(YTable[j]);
+		}
 		b(1);
-		for( j in 0...64 )
+		for(j in 0...64) {
 			b(UVTable[j]);
+		}
 	}
 	function writeSOF0(width: Int, height: Int) {
 		b(0xFF); b(0xC0);  //<- marker 0xFFC0
 		b(0);  b(17);    //<- length, truecolor YUV JPG
 		b(8);  // precision
-		b( (height>>8) & 0xFF );
-		b(  height & 0xFF );
-		b(  (width>>8) & 0xFF );
-		b(  width & 0xFF );
+		b((height>>8) & 0xFF);
+		b(height & 0xFF);
+		b((width>>8) & 0xFF);
+		b(width & 0xFF);
 		b(3);     // nrofcomponents
 		b(1);     // IdY
 		b(0x11);  // HVY
@@ -437,23 +439,27 @@ class JpgWriter {
 		b(0xFF); b(0xC4);  //<- marker 0xFFC4
 		b(0x01); b(0xA2);   //<- length
 		b(0);  // HTYDCinfo
-		for( j in 1...17 )
+		for (j in 1...17) {
 			b(std_dc_luminance_nrcodes[j]);
+		}
 		byteout.write(std_dc_luminance_values);
 
 		b(0x10);  // HTYACinfo
-		for( j in 1...17 )
+		for (j in 1...17) {
 			b(std_ac_luminance_nrcodes[j]);
+		}
 		byteout.write(std_ac_luminance_values);
 
 		b(1);  // HTUDCinfo
-		for( j in 1...17 )
+		for (j in 1...17) {
 			b(std_dc_chrominance_nrcodes[j]);
+		}
 		byteout.write(std_dc_chrominance_values);
 
 		b(0x11);  // HTUACinfo
-		for( j in 1...17 )
+		for (j in 1...17) {
 			b(std_ac_chrominance_nrcodes[j]);
+		}
 		byteout.write(std_ac_chrominance_values);
 	}
 
@@ -476,54 +482,55 @@ class JpgWriter {
 	var DU: Array<Float>;  //<- initialized in function new JPEGEncoder()
 
 	function processDU(CDU: Array<Float>, fdtbl: Array<Float>, DC: Float, HTDC: Map<Int,BitString>, HTAC: Map<Int,BitString>): Float {
-		var EOB: BitString = HTAC.get( 0x00 );
-		var M16zeroes: BitString = HTAC.get( 0xF0 );
+		var EOB: BitString = HTAC.get(0x00);
+		var M16zeroes: BitString = HTAC.get(0xF0);
 
 		var DU_DCT: Array<Float> = fDCTQuant(CDU, fdtbl);
 		//ZigZag reorder
 		for (i in 0...64) {
-			DU[ ZigZag[i] ] = DU_DCT[i];
+			DU[ZigZag[i]] = DU_DCT[i];
 		}
 		var idx: Int;
-		var Diff = Std.int( DU[0] - DC );
+		var Diff = Std.int(DU[0] - DC);
 		DC = DU[0];
 		//Encode DC
-		if( Diff == 0 ) {
-			writeBits( HTDC.get(0) ); // Diff might be 0
-		} else {
+		if (Diff == 0) {
+			writeBits(HTDC.get(0)); // Diff might be 0
+		}
+		else {
 			idx = 32767 + Diff;
-			writeBits(HTDC.get( category.get( idx ) ));
-			writeBits( bitcode.get( idx ) );
+			writeBits(HTDC.get(category.get(idx)));
+			writeBits(bitcode.get(idx));
 		}
 
 		//Encode ACs
 		var end0pos = 63;
 		//for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {  };
-		while( (end0pos > 0) && ( DU[end0pos] == 0.0 ) ) end0pos--;
+		while ((end0pos > 0) && (DU[end0pos] == 0.0)) end0pos--;
 
 		//end0pos = first element in reverse order !=0
-		if ( end0pos == 0 ) {
+		if (end0pos == 0) {
 			writeBits(EOB);
 			return DC;
 		}
 		var i = 1;
-		while ( i <= end0pos ) {
+		while (i <= end0pos) {
 			var startpos = i;
 			//for (; (DU[i]==0) && (i<=end0pos); i++) {  };  <- it's a 'while' loop
-			while( ( DU[i] == 0.0 ) && ( i <= end0pos ) ) i++;
+			while ((DU[i] == 0.0) && (i <= end0pos)) i++;
 
 			var nrzeroes: Int = i - startpos;
-			if ( nrzeroes >= 16 ) {
+			if (nrzeroes >= 16) {
 				//for (var nrmarker: Int=1; nrmarker <= nrzeroes/16; nrmarker++) {
-				for( nrmarker in 0...(nrzeroes >> 4) ) writeBits(M16zeroes);
+				for (nrmarker in 0...(nrzeroes >> 4)) writeBits(M16zeroes);
 				nrzeroes &= 0xF;
 			}
-			idx = 32767 + Std.int( DU[i] );  //<- line added
-			writeBits( HTAC.get( nrzeroes * 16 + category.get( idx ) ) );
-			writeBits( bitcode.get( idx ) );
+			idx = 32767 + Std.int(DU[i]);  //<- line added
+			writeBits(HTAC.get(nrzeroes * 16 + category.get(idx)));
+			writeBits(bitcode.get(idx));
 			i++;
 		}
-		if( end0pos != 63 ) writeBits(EOB);
+		if (end0pos != 63) writeBits(EOB);
 		return DC;
 	}
 
@@ -531,11 +538,11 @@ class JpgWriter {
 	var UDU: Array<Float>;
 	var VDU: Array<Float>;
 
-	function ARGB2YUV(img: haxe.io.Bytes, width : Int, xpos: Int, ypos: Int) {
+	function ARGB2YUV(img: haxe.io.Bytes, width: Int, xpos: Int, ypos: Int) {
 		var pos = 0;
-		for( y in 0...8 ) {
+		for (y in 0...8) {
 			var offset = ((y + ypos) * width + xpos) << 2;
-			for( x in 0...8 ) {
+			for (x in 0...8) {
 				offset++; // skip alpha
 				var R = img.get(offset++);
 				var G = img.get(offset++);
@@ -548,7 +555,7 @@ class JpgWriter {
 		}
 	}
 
-	public function new( out : haxe.io.Output ) {
+	public function new(out: haxe.io.Output) {
 	//begin : lines added to initialize variables
 		YTable = new Array<Int>();
 		UVTable = new Array<Int>();
@@ -580,21 +587,21 @@ class JpgWriter {
 		initZigZag();
 		initLuminance();
 		initChrominance();
-	//end : lines added to initialize variables
+		//end : lines added to initialize variables
 
 		// Create tables
 		initHuffmanTbl();
 		initCategoryNumber();
 	}
 
-	public function write( image : JpgData, type = 0, off = 0, swapRG = false ) {
+	public function write(image: JpgData, type = 0, off = 0, swapRG = false) {
 		// init quality table
 		var quality = image.quality;
-		if( quality <= 0 ) quality = 1;
-		if( quality > 100 ) quality = 100;
+		if (quality <= 0) quality = 1;
+		if (quality > 100) quality = 100;
 		var sf =
-			if( quality < 50 ) Std.int( 5000 / quality )
-			else Std.int( 200 - quality * 2 );
+			if (quality < 50) Std.int(5000 / quality)
+			else Std.int(200 - quality * 2);
 		initQuantTables(sf);
 
 		// Initialize bit writer
@@ -607,7 +614,7 @@ class JpgWriter {
 		writeWord(0xFFD8); // SOI
 		writeAPP0();
 		writeDQT();
-		writeSOF0( width, height );
+		writeSOF0(width, height);
 		writeDHT();
 		writeSOS();
 
@@ -619,9 +626,9 @@ class JpgWriter {
 		bytepos = 7;
 		var ypos = 0;
 		if (type == 0) {
-			while( ypos < height ) {
+			while (ypos < height) {
 				var xpos = 0;
-				while( xpos < width ) {
+				while (xpos < width) {
 					ARGB2YUV(image.pixels, width, xpos, ypos);
 					DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
 					DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
@@ -632,9 +639,9 @@ class JpgWriter {
 			}
 		}
 		else if (type == 1 && !swapRG) {
-			while( ypos < height ) {
+			while (ypos < height) {
 				var xpos = 0;
-				while( xpos < width ) {
+				while(xpos < width) {
 					RGBA2YUV(image.pixels, width, xpos, ypos);
 					DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
 					DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
@@ -645,9 +652,9 @@ class JpgWriter {
 			}
 		}
 		else if (type == 1 && swapRG) {
-			while( ypos < height ) {
+			while (ypos < height) {
 				var xpos = 0;
-				while( xpos < width ) {
+				while (xpos < width) {
 					BGRA2YUV(image.pixels, width, xpos, ypos);
 					DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
 					DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
@@ -658,9 +665,9 @@ class JpgWriter {
 			}
 		}
 		else if (type == 2) {
-			while( ypos < height ) {
+			while (ypos < height) {
 				var xpos = 0;
-				while( xpos < width ) {
+				while (xpos < width) {
 					RRR2YUV(image.pixels, width, xpos, ypos, off);
 					DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
 					DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
@@ -672,8 +679,8 @@ class JpgWriter {
 		}
 
 		// Do the bit alignment of the EOI marker
-		if( bytepos >= 0 ) {
-			var fillbits = new BitString( bytepos + 1, ( 1 << (bytepos + 1) ) - 1 );
+		if (bytepos >= 0) {
+			var fillbits = new BitString(bytepos + 1, (1 << (bytepos + 1)) - 1);
 			writeBits(fillbits);
 		}
 
@@ -681,11 +688,11 @@ class JpgWriter {
 	}
 
 	// armory
-	function RGBA2YUV(img: haxe.io.Bytes, width : Int, xpos: Int, ypos: Int) {
+	function RGBA2YUV(img: haxe.io.Bytes, width: Int, xpos: Int, ypos: Int) {
 		var pos = 0;
-		for( y in 0...8 ) {
+		for (y in 0...8) {
 			var offset = ((y + ypos) * width + xpos) << 2;
-			for( x in 0...8 ) {
+			for (x in 0...8) {
 				var R = img.get(offset++);
 				var G = img.get(offset++);
 				var B = img.get(offset++);
@@ -697,11 +704,11 @@ class JpgWriter {
 			}
 		}
 	}
-	function BGRA2YUV(img: haxe.io.Bytes, width : Int, xpos: Int, ypos: Int) {
+	function BGRA2YUV(img: haxe.io.Bytes, width: Int, xpos: Int, ypos: Int) {
 		var pos = 0;
-		for( y in 0...8 ) {
+		for (y in 0...8) {
 			var offset = ((y + ypos) * width + xpos) << 2;
-			for( x in 0...8 ) {
+			for (x in 0...8) {
 				var B = img.get(offset++);
 				var G = img.get(offset++);
 				var R = img.get(offset++);
@@ -713,13 +720,13 @@ class JpgWriter {
 			}
 		}
 	}
-	function RRR2YUV(img: haxe.io.Bytes, width : Int, xpos: Int, ypos: Int, off: Int) {
+	function RRR2YUV(img: haxe.io.Bytes, width: Int, xpos: Int, ypos: Int, off: Int) {
 		var pos = 0;
-		for( y in 0...8 ) {
+		for (y in 0...8) {
 			var offset = ((y + ypos) * width + xpos) << 2;
-			for( x in 0...8 ) {
+			for (x in 0...8) {
 				var R = img.get(offset + off);
-				offset+=4;
+				offset += 4;
 				YDU[pos] = ((( 0.29900) * R + ( 0.58700) * R + ( 0.11400) * R)) -128;
 				UDU[pos] = (((-0.16874) * R + (-0.33126) * R + ( 0.50000) * R));
 				VDU[pos] = ((( 0.50000) * R + (-0.41869) * R + (-0.08131) * R));

+ 1 - 2
Sources/arm/format/ObjParser.hx

@@ -487,8 +487,7 @@ class ObjParser {
 			if (c == "\n".code || c == "\r".code || c == " ".code) break;
 			pos++;
 		}
-		
-		return bytes.getString(begin,pos-begin);
+		return bytes.getString(begin, pos - begin);
 	}
 
 	function nextLine() {

+ 75 - 74
Sources/arm/format/PngTools.hx

@@ -32,17 +32,18 @@ class PngTools {
 	/**
 		Creates PNG data from bytes that contains one bytes (grey values) for each pixel.
 	**/
-	public static function buildGrey( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function buildGrey(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgb = haxe.io.Bytes.alloc(width * height + height);
 		// translate RGB to BGR and add filter byte
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgb.set(w++,0); // no filter for this scanline
-			for( x in 0...width )
-				rgb.set(w++,data.get(r++));
+		for (y in 0...height) {
+			rgb.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgb.set(w++, data.get(r++));
+			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColGrey(false), interlaced : false }));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColGrey(false), interlaced: false }));
 		l.add(CData(deflate(rgb,level)));
 		l.add(CEnd);
 		return l;
@@ -51,22 +52,22 @@ class PngTools {
 	/**
 		Creates PNG data from bytes that contains three bytes (R,G and B values) for each pixel.
 	**/
-	public static function buildRGB( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function buildRGB(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgb = haxe.io.Bytes.alloc(width * height * 3 + height);
 		// translate RGB to BGR and add filter byte
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgb.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgb.set(w++,data.get(r+2));
-				rgb.set(w++,data.get(r+1));
-				rgb.set(w++,data.get(r));
+		for (y in 0...height) {
+			rgb.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgb.set(w++, data.get(r + 2));
+				rgb.set(w++, data.get(r + 1));
+				rgb.set(w++, data.get(r));
 				r += 3;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(false), interlaced : false }));
-		l.add(CData(deflate(rgb,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(false), interlaced: false }));
+		l.add(CData(deflate(rgb, level)));
 		l.add(CEnd);
 		return l;
 	}
@@ -74,23 +75,23 @@ class PngTools {
 	/**
 		Creates PNG data from bytes that contains four bytes in ARGB format for each pixel.
 	**/
-	public static function build32ARGB( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function build32ARGB(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		// translate ARGB to RGBA and add filter byte
 		var w = 0, r = 0;
-		for( y in 0...height ) {
+		for (y in 0...height) {
 			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r+1)); // r
-				rgba.set(w++,data.get(r+2)); // g
-				rgba.set(w++,data.get(r+3)); // b
-				rgba.set(w++,data.get(r)); // a
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r + 1)); // r
+				rgba.set(w++, data.get(r + 2)); // g
+				rgba.set(w++, data.get(r + 3)); // b
+				rgba.set(w++, data.get(r)); // a
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
@@ -98,109 +99,109 @@ class PngTools {
 	/**
 		Creates PNG data from bytes that contains four bytes in BGRA format for each pixel.
 	**/
-	public static function build32BGRA( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function build32BGRA(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		// translate ARGB to RGBA and add filter byte
 		var w = 0, r = 0;
-		for( y in 0...height ) {
+		for (y in 0...height) {
 			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r+2)); // r
-				rgba.set(w++,data.get(r+1)); // g
-				rgba.set(w++,data.get(r)); // b
-				rgba.set(w++,data.get(r+3)); // a
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r + 2)); // r
+				rgba.set(w++, data.get(r + 1)); // g
+				rgba.set(w++, data.get(r)); // b
+				rgba.set(w++, data.get(r + 3)); // a
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
 
-	public static function build32RGBA( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function build32RGBA(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r)); // r
-				rgba.set(w++,data.get(r+1)); // g
-				rgba.set(w++,data.get(r+2)); // b
-				rgba.set(w++,data.get(r+3)); // a
+		for (y in 0...height) {
+			rgba.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r)); // r
+				rgba.set(w++, data.get(r + 1)); // g
+				rgba.set(w++, data.get(r + 2)); // b
+				rgba.set(w++, data.get(r + 3)); // a
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
 
 	// armory
-	public static function build32BGR1( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function build32BGR1(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r+2)); // r
-				rgba.set(w++,data.get(r+1)); // g
-				rgba.set(w++,data.get(r)); // b
-				rgba.set(w++,255); // 1
+		for (y in 0...height) {
+			rgba.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r + 2)); // r
+				rgba.set(w++, data.get(r + 1)); // g
+				rgba.set(w++, data.get(r)); // b
+				rgba.set(w++, 255); // 1
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
 
-	public static function build32RGB1( width : Int, height : Int, data : haxe.io.Bytes, ?level = 9 ) : PngData {
+	public static function build32RGB1(width: Int, height: Int, data: haxe.io.Bytes, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r)); // r
-				rgba.set(w++,data.get(r+1)); // g
-				rgba.set(w++,data.get(r+2)); // b
-				rgba.set(w++,255); // 1
+		for (y in 0...height) {
+			rgba.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r)); // r
+				rgba.set(w++, data.get(r + 1)); // g
+				rgba.set(w++, data.get(r + 2)); // b
+				rgba.set(w++, 255); // 1
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
 
-	public static function build32RRR1( width : Int, height : Int, data : haxe.io.Bytes, off : Int, ?level = 9 ) : PngData {
+	public static function build32RRR1(width: Int, height: Int, data: haxe.io.Bytes, off: Int, ?level = 9): PngData {
 		var rgba = haxe.io.Bytes.alloc(width * height * 4 + height);
 		var w = 0, r = 0;
-		for( y in 0...height ) {
-			rgba.set(w++,0); // no filter for this scanline
-			for( x in 0...width ) {
-				rgba.set(w++,data.get(r+off)); // r
-				rgba.set(w++,data.get(r+off)); // r
-				rgba.set(w++,data.get(r+off)); // r
-				rgba.set(w++,255); // 1
+		for (y in 0...height) {
+			rgba.set(w++, 0); // no filter for this scanline
+			for (x in 0...width) {
+				rgba.set(w++, data.get(r + off)); // r
+				rgba.set(w++, data.get(r + off)); // r
+				rgba.set(w++, data.get(r + off)); // r
+				rgba.set(w++, 255); // 1
 				r += 4;
 			}
 		}
 		var l = new List();
-		l.add(CHeader({ width : width, height : height, colbits : 8, color : ColTrue(true), interlaced : false }));
-		l.add(CData(deflate(rgba,level)));
+		l.add(CHeader({ width: width, height: height, colbits: 8, color: ColTrue(true), interlaced: false }));
+		l.add(CData(deflate(rgba, level)));
 		l.add(CEnd);
 		return l;
 	}
 
-	public static function deflate(b:haxe.io.Bytes, ?level = 9):haxe.io.Bytes {
+	public static function deflate(b: haxe.io.Bytes, ?level = 9): haxe.io.Bytes {
 		return haxe.io.Bytes.ofData(Krom.deflate(b.getData(), false));
 	}
 }

+ 33 - 31
Sources/arm/format/PngWriter.hx

@@ -29,54 +29,56 @@ import arm.format.PngData;
 
 class PngWriter {
 
-	var o : haxe.io.Output;
+	var o: haxe.io.Output;
 
 	public function new(o) {
 		this.o = o;
 		o.bigEndian = true;
 	}
 
-	public function write( png : PngData ) {
-		for( b in [137,80,78,71,13,10,26,10] )
+	public function write(png: PngData) {
+		for (b in [137,80,78,71,13,10,26,10]) {
 			o.writeByte(b);
-		for( c in png )
-			switch( c ) {
-			case CHeader(h):
-				var b = new haxe.io.BytesOutput();
-				b.bigEndian = true;
-				b.writeInt32(h.width);
-				b.writeInt32(h.height);
-				b.writeByte(h.colbits);
-				b.writeByte(switch( h.color ) {
-					case ColGrey(alpha): alpha ? 4 : 0;
-					case ColTrue(alpha): alpha ? 6 : 2;
-					case ColIndexed: 3;
-				});
-				b.writeByte(0);
-				b.writeByte(0);
-				b.writeByte(h.interlaced ? 1 : 0);
-				writeChunk("IHDR",b.getBytes());
-			case CEnd:
-				writeChunk("IEND",haxe.io.Bytes.alloc(0));
-			case CData(d):
-				writeChunk("IDAT",d);
-			case CPalette(b):
-				writeChunk("PLTE",b);
-			case CUnknown(id,data):
-				writeChunk(id,data);
+		}
+		for (c in png) {
+			switch (c) {
+				case CHeader(h):
+					var b = new haxe.io.BytesOutput();
+					b.bigEndian = true;
+					b.writeInt32(h.width);
+					b.writeInt32(h.height);
+					b.writeByte(h.colbits);
+					b.writeByte(switch(h.color) {
+						case ColGrey(alpha): alpha ? 4 : 0;
+						case ColTrue(alpha): alpha ? 6 : 2;
+						case ColIndexed: 3;
+					});
+					b.writeByte(0);
+					b.writeByte(0);
+					b.writeByte(h.interlaced ? 1 : 0);
+					writeChunk("IHDR", b.getBytes());
+				case CEnd:
+					writeChunk("IEND", haxe.io.Bytes.alloc(0));
+				case CData(d):
+					writeChunk("IDAT", d);
+				case CPalette(b):
+					writeChunk("PLTE", b);
+				case CUnknown(id, data):
+					writeChunk(id, data);
 			}
+		}
 	}
 
-	function writeChunk( id : String, data : haxe.io.Bytes ) {
+	function writeChunk(id: String, data: haxe.io.Bytes) {
 		o.writeInt32(data.length);
 		o.writeString(id);
 		o.write(data);
 		// compute CRC
 		var crc = new haxe.crypto.Crc32();
-		for( i in 0...4 )
+		for (i in 0...4) {
 			crc.byte(id.charCodeAt(i));
+		}
 		crc.update(data, 0, data.length);
 		o.writeInt32(crc.get());
 	}
-
 }

+ 8 - 3
Sources/arm/shader/MaterialParser.hx

@@ -154,8 +154,13 @@ class MaterialParser {
 		var vert = con.vert;
 		var frag = con.frag;
 
-		if (frag.dotNV) { frag.vVec = true; frag.n = true; }
-		if (frag.vVec) vert.wposition = true;
+		if (frag.dotNV) {
+			frag.vVec = true;
+			frag.n = true;
+		}
+		if (frag.vVec) {
+			vert.wposition = true;
+		}
 
 		if (frag.bposition) {
 			if (triplanar) {
@@ -1270,7 +1275,7 @@ class MaterialParser {
 			var tex_name = node_name(node);
 			var tex = make_texture(node, tex_name);
 			if (tex != null) {
-				var color_space = node.buttons[1].default_value; 
+				var color_space = node.buttons[1].default_value;
 				var invert_color = node.buttons[2].default_value == true;
 				var texstore = texture_store(node, tex, tex_name, color_space, invert_color);
 				return '$texstore.a';

+ 14 - 7
Sources/arm/shader/NodeShader.hx

@@ -209,8 +209,9 @@ class NodeShader {
 		var in_ext = '';
 		var out_ext = '';
 
-		for (a in includes)
+		for (a in includes) {
 			s += '#include "' + a + '"\n';
+		}
 
 		// Input structure
 		var index = 0;
@@ -602,18 +603,24 @@ class NodeShader {
 		var in_ext = '';
 		var out_ext = '';
 
-		for (a in includes)
+		for (a in includes) {
 			s += '#include "' + a + '"\n';
-		for (a in ins)
+		}
+		for (a in ins) {
 			s += 'in $a$in_ext;\n';
-		for (a in outs)
+		}
+		for (a in outs) {
 			s += 'out $a$out_ext;\n';
-		for (a in uniforms)
+		}
+		for (a in uniforms) {
 			s += 'uniform ' + a + ';\n';
-		for (a in sharedSamplers)
+		}
+		for (a in sharedSamplers) {
 			s += 'uniform ' + a + ';\n';
-		for (f in functions)
+		}
+		for (f in functions) {
 			s += f + '\n';
+		}
 		s += 'void main() {\n';
 		s += main_attribs;
 		s += main_textures;

+ 19 - 10
Sources/arm/shader/NodeShaderContext.hx

@@ -36,14 +36,18 @@ class NodeShaderContext {
 			depth_attachment: props.depth_attachment
 		};
 
-		if (props.color_writes_red != null)
+		if (props.color_writes_red != null) {
 			data.color_writes_red = props.color_writes_red;
-		if (props.color_writes_green != null)
+		}
+		if (props.color_writes_green != null) {
 			data.color_writes_green = props.color_writes_green;
-		if (props.color_writes_blue != null)
+		}
+		if (props.color_writes_blue != null) {
 			data.color_writes_blue = props.color_writes_blue;
-		if (props.color_writes_alpha != null)
+		}
+		if (props.color_writes_alpha != null) {
 			data.color_writes_alpha = props.color_writes_alpha;
+		}
 
 		tunits = data.texture_units = [];
 		constants = data.constants = [];
@@ -58,9 +62,11 @@ class NodeShaderContext {
 	}
 
 	public function is_elem(name: String): Bool {
-		for (elem in data.vertex_elements)
-			if (elem.name == name)
+		for (elem in data.vertex_elements) {
+			if (elem.name == name) {
 				return true;
+			}
+		}
 		return false;
 	}
 
@@ -78,13 +84,16 @@ class NodeShaderContext {
 	}
 
 	public function add_constant(ctype: String, name: String, link: String = null) {
-		for (c in constants)
-			if (c.name == name)
+		for (c in constants) {
+			if (c.name == name) {
 				return;
+			}
+		}
 
-		var c:TShaderConstant = { name: name, type: ctype };
-		if (link != null)
+		var c: TShaderConstant = { name: name, type: ctype };
+		if (link != null) {
 			c.link = link;
+		}
 		constants.push(c);
 	}
 

+ 21 - 5
Sources/arm/shader/NodesMaterial.hx

@@ -9,7 +9,9 @@ import arm.Project;
 class NodesMaterial {
 
 	// Mark strings as localizable
-	public static inline function _tr(s: String) { return s; }
+	public static inline function _tr(s: String) {
+		return s;
+	}
 
 	public static var categories = [_tr("Input"), _tr("Texture"), _tr("Color"), _tr("Vector"), _tr("Converter"), _tr("Group")];
 
@@ -2678,7 +2680,7 @@ class NodesMaterial {
 			val.push(f32);
 		}
 		if (ui.button("-")) {
-			if (val.length > 2) { val.pop(); }
+			if (val.length > 2) val.pop();
 		}
 		var i = Std.int(ui.slider(nhandle.nest(0).nest(2).nest(axis, {position: 0}), "Index", 0, num - 1, false, 1, true, Left));
 		ui.row([1 / 2, 1 / 2]);
@@ -2711,7 +2713,11 @@ class NodesMaterial {
 		if (ui.button("+")) {
 			var last = vals[vals.length - 1];
 			var f32 = new kha.arrays.Float32Array(5);
-			f32[0] = last[0]; f32[1] = last[1]; f32[2] = last[2]; f32[3] = last[3]; f32[4] = 1.0;
+			f32[0] = last[0];
+			f32[1] = last[1];
+			f32[2] = last[2];
+			f32[3] = last[3];
+			f32[4] = 1.0;
 			vals.push(f32);
 			ihandle.value += 1;
 		}
@@ -2744,7 +2750,12 @@ class NodesMaterial {
 			for (i in 1...999) {
 				node.name = tr("Group") + " " + i;
 				var found = false;
-				for (g in Project.materialGroups) if (g.canvas.name == node.name) { found = true; break; }
+				for (g in Project.materialGroups) {
+					if (g.canvas.name == node.name) {
+						found = true;
+						break;
+					}
+				}
 				if (!found) break;
 			}
 			var canvas: TNodeCanvas = {
@@ -2791,7 +2802,12 @@ class NodesMaterial {
 		}
 
 		var group: TNodeGroup = null;
-		for (g in Project.materialGroups) if (g.canvas.name == node.name) { group = g; break; }
+		for (g in Project.materialGroups) {
+			if (g.canvas.name == node.name) {
+				group = g;
+				break;
+			}
+		}
 
 		if (ui.button(tr("Nodes"))) {
 			arm.ui.UINodes.inst.groupStack.push(group);