Pārlūkot izejas kodu

Props: more support for enums

trethaller 7 gadi atpakaļ
vecāks
revīzija
5bd3652c63
3 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 2 0
      hide/comp/PropsEditor.hx
  2. 1 0
      hide/prefab/Props.hx
  3. 2 0
      hide/tools/TypesCache.hx

+ 2 - 0
hide/comp/PropsEditor.hx

@@ -71,6 +71,8 @@ class PropsEditor extends Component {
 			var e = new Element('<select field="${p.name}" type="number"></select>').appendTo(parent);
 			var e = new Element('<select field="${p.name}" type="number"></select>').appendTo(parent);
 			for(c in choices)
 			for(c in choices)
 				new hide.Element('<option>').attr("value", choices.indexOf(c)).text(upperCase(c)).appendTo(e);
 				new hide.Element('<option>').attr("value", choices.indexOf(c)).text(upperCase(c)).appendTo(e);
+		case PEnum(en):
+			var e = new Element('<select field="${p.name}"></select>').appendTo(parent);
 		case PFile(exts):
 		case PFile(exts):
 			new Element('<input type="texturepath" extensions="${exts.join(" ")}" field="${p.name}">').appendTo(parent);
 			new Element('<input type="texturepath" extensions="${exts.join(" ")}" field="${p.name}">').appendTo(parent);
 		}
 		}

+ 1 - 0
hide/prefab/Props.hx

@@ -8,6 +8,7 @@ enum PropType {
 	PTexture;
 	PTexture;
 	PChoice( choices : Array<String> );
 	PChoice( choices : Array<String> );
 	PFile( exts : Array<String> );
 	PFile( exts : Array<String> );
+	PEnum( e : Enum<Dynamic>);
 	PUnsupported( debug : String );
 	PUnsupported( debug : String );
 }
 }
 
 

+ 2 - 0
hide/tools/TypesCache.hx

@@ -234,6 +234,8 @@ class TypesCache {
 			return null;
 			return null;
 		case PChoice(c):
 		case PChoice(c):
 			return c != null && c.length > 0 ? c[0] : null;
 			return c != null && c.length > 0 ? c[0] : null;
+		case PEnum(e):
+			return e.getConstructors()[0];
 		case PFile(_):
 		case PFile(_):
 			return null;
 			return null;
 		}
 		}