1 module unecht.core.components.editor.ui.referenceEditor; 2 3 version(UEIncludeEditor): 4 5 import unecht.core.object; 6 import unecht.core.component; 7 import unecht.core.components.internal.gui; 8 import unecht.core.assets.texture; 9 import unecht.core.entity; 10 import unecht.core.assetDatabase; 11 12 import derelict.imgui.imgui; 13 14 /// 15 final class UEReferenceEditor : UEComponent 16 { 17 mixin(UERegisterObject!()); 18 19 private static UEObject* object; 20 21 /// 22 public static void open(UEObject* _obj) 23 { 24 object = _obj; 25 } 26 27 //TODO: filter using string 28 //TODO: filter using target type 29 /// 30 void render() 31 { 32 if(object is null) 33 return; 34 35 igOpenPopup("ref"); 36 37 bool opened=true; 38 if(igBeginPopupModal("ref",&opened)) 39 { 40 scope(exit){igEndPopup();} 41 42 if(UEGui.Selectable("<null>",false)) 43 { 44 *object = null; 45 object = null; 46 } 47 48 foreach(asset; UEAssetDatabase.assets) 49 { 50 //import std.string; 51 //if(c.indexOf(filterString,CaseSensitive.no)==-1) 52 // continue; 53 54 if(UEGui.Selectable(asset.path,false)) 55 { 56 *object = asset.obj; 57 object = null; 58 //filterString.length=0; 59 } 60 } 61 } 62 63 if(!opened) 64 { 65 object = null; 66 igCloseCurrentPopup(); 67 } 68 } 69 }