@@ -20,9 +20,14 @@ namespace Prowl.Editor.Panels;
2020[ EditorWindow ( "General/Project" ) ]
2121public class ProjectPanel : DockPanel
2222{
23+ public static ProjectPanel Instance ;
2324 public override string Title => "Project" ;
2425 public override string Icon => EditorIcons . Folder ;
2526
27+ // Handled Virtual (Placeholder) content to be displayed with normal objects
28+ public List < ContentItem > VirtualContentItems = new ( ) ;
29+
30+ public string CurrentFolder => _currentFolder ;
2631 private string _currentFolder = "" ; // Relative to Assets/, empty = Assets root
2732 private string _searchText = "" ;
2833 private float _thumbnailSize = 64f ;
@@ -56,6 +61,9 @@ public override void OnGUI(Paper paper, float width, float height)
5661 var font = EditorTheme . DefaultFont ;
5762 if ( font == null || Project . Current == null ) return ;
5863
64+ // Sets itself as instance on start
65+ Instance ??= this ;
66+
5967 // Detect new ping and navigate to the pinged asset's folder
6068 if ( Selection . PingedGuid != Guid . Empty && Selection . PingedGuid != _lastPingedGuid )
6169 {
@@ -1009,6 +1017,7 @@ private void StartRename(ContentItem item, bool inTree = false)
10091017 } ) ;
10101018 }
10111019
1020+
10121021 private static void OpenWithSystem ( ContentItem item )
10131022 {
10141023 string absPath = Path . Combine ( Project . Current ! . AssetsPath , item . RelativePath ) ;
@@ -1033,6 +1042,8 @@ private void DrawGridView(Paper paper, Prowl.Scribe.FontFile font, List<ContentI
10331042 {
10341043 float cellSize = _thumbnailSize + 8f ;
10351044 float labelH = 18f ;
1045+
1046+
10361047 float totalCellH = cellSize + labelH ;
10371048 float gap = 6f ;
10381049 // Available width minus padding (12 = 6 left margin + 6 right margin from parent)
@@ -1056,7 +1067,17 @@ private void DrawGridView(Paper paper, Prowl.Scribe.FontFile font, List<ContentI
10561067 var item = entries [ idx ] ;
10571068 bool isSelected = Selection . IsSelected ( item ) ;
10581069
1059- DrawGridItem ( paper , font , $ "proj_gc_{ idx } ", item , idx , itemObjects , cellSize , labelH , totalCellH ) ;
1070+
1071+ var size = paper . MeasureText ( item . Name , EditorTheme . FontSize - 3 , font ) ;
1072+
1073+ if ( size . X > cellSize )
1074+ {
1075+ size *= 2 ;
1076+ }
1077+
1078+ //Runtime.Debug.Log($"Size: ({item.Name}) {labelH} - {sizeY} - {sizeYo} ({(EditorTheme.FontSize - 5)/paper.Canvas.Scale})");
1079+
1080+ DrawGridItem ( paper , font , $ "proj_gc_{ idx } ", item , idx , itemObjects , cellSize , size . Y , totalCellH ) ;
10601081 }
10611082 }
10621083 row ++ ;
@@ -1185,16 +1206,19 @@ private void DrawGridItem(Paper paper, Prowl.Scribe.FontFile font, string id, Co
11851206 // Label
11861207 if ( RenameOverlay . IsRenaming ( $ "proj_asset_{ item . RelativePath } ") )
11871208 {
1188- RenameOverlay . Draw ( paper , $ "{ id } _rename") ;
1209+ RenameOverlay . Draw ( paper , $ "{ id } _rename", RenameOverlay . Position . Bottom ) ;
11891210 }
11901211 else
11911212 {
11921213 paper . Box ( $ "{ id } _l")
1214+ . PositionType ( PositionType . SelfDirected )
1215+ . Position ( 0 , UnitValue . Stretch ( ) )
11931216 . Width ( cellSize ) . Height ( labelH )
11941217 . Clip ( )
11951218 . Text ( item . Name , font )
1219+ . Wrap ( Scribe . TextWrapMode . Wrap )
11961220 . TextColor ( isSubAsset ? EditorTheme . Purple300 : EditorTheme . Ink500 )
1197- . FontSize ( EditorTheme . FontSize - 2 ) . Alignment ( TextAlignment . MiddleCenter ) ;
1221+ . FontSize ( EditorTheme . FontSize - 3 ) . Alignment ( TextAlignment . MiddleCenter ) ;
11981222 }
11991223
12001224 BuildItemContextMenu ( paper , $ "{ id } _ctx", item ) ;
@@ -1249,6 +1273,8 @@ private List<ContentItem> GetContentEntries(EditorAssetDatabase db)
12491273 }
12501274 catch { }
12511275
1276+ items . AddRange ( VirtualContentItems ) ;
1277+
12521278 // Files
12531279 try
12541280 {
0 commit comments