@@ -21,7 +21,8 @@ public static void Open()
2121 GetWindow < AssetQuickAccessWindow > ( ) ;
2222 }
2323
24- public static void AddItems ( IList < UObject > objects , IList < string > paths , IList < ( string url , string title ) > urlInfos )
24+ public static void AddItems ( IList < UObject > objects , IList < string > paths ,
25+ IList < ( string url , string title ) > urlInfos , IList < ( string menuPath , string title ) > menuItemInfos )
2526 {
2627 HashSet < UObject > objectHashSet = new HashSet < UObject > ( ) ;
2728 if ( objects != null )
@@ -80,6 +81,21 @@ public static void AddItems(IList<UObject> objects, IList<string> paths, IList<(
8081 added |= AssetQuickAccessLocalCache . instance . AddUrls ( urlDict . Values , ref errorsBuilder , false ) ;
8182 }
8283
84+ if ( menuItemInfos != null )
85+ {
86+ Dictionary < string , ( string menuPath , string title ) > menuDict = new Dictionary < string , ( string menuPath , string title ) > ( ) ;
87+ for ( int i = 0 ; i < menuItemInfos . Count ; i ++ )
88+ {
89+ string menuPath = menuItemInfos [ i ] . menuPath ;
90+ if ( ! menuDict . ContainsKey ( menuPath ) )
91+ {
92+ menuDict . Add ( menuPath , menuItemInfos [ i ] ) ;
93+ }
94+ }
95+
96+ added |= AssetQuickAccessLocalCache . instance . AddMenuItems ( menuDict . Values , ref errorsBuilder , false ) ;
97+ }
98+
8399 if ( _instance )
84100 {
85101 if ( added )
@@ -100,7 +116,7 @@ public static void AddItems(IList<UObject> objects, IList<string> paths, IList<(
100116#endif
101117 public static void AddSelectedObjects ( )
102118 {
103- AddItems ( Selection . objects , null , null ) ;
119+ AddItems ( Selection . objects , null , null , null ) ;
104120 }
105121
106122 [ MenuItem ( "Assets/Bamboo/Add to Asset Quick Access" , validate = true ) ]
@@ -113,7 +129,7 @@ public static void AddContextObject(MenuCommand command)
113129 {
114130 if ( command . context )
115131 {
116- AddItems ( new UObject [ ] { command . context } , null , null ) ;
132+ AddItems ( new UObject [ ] { command . context } , null , null , null ) ;
117133 }
118134 }
119135#endif
@@ -274,14 +290,31 @@ private void AddUrlEditor()
274290 UrlEditWindow . Open ( center , AddUrl ) ;
275291 }
276292
293+ private void AddMenuItemEditor ( )
294+ {
295+ Vector2 upperCenter = position . center ;
296+ upperCenter . y = position . yMin + 50 ;
297+ MenuItemSelectWindow . Open ( upperCenter , AddMenuItem ) ;
298+ }
299+
277300 private void AddUrl ( string url , string title )
278301 {
279302 if ( string . IsNullOrWhiteSpace ( url ) )
280303 {
281304 return ;
282305 }
283306
284- AddItems ( null , null , new ( string url , string title ) [ ] { ( url , title ) } ) ;
307+ AddItems ( null , null , new ( string url , string title ) [ ] { ( url , title ) } , null ) ;
308+ }
309+
310+ private void AddMenuItem ( string menuPath , string title )
311+ {
312+ if ( string . IsNullOrWhiteSpace ( menuPath ) )
313+ {
314+ return ;
315+ }
316+
317+ AddItems ( null , null , null , new ( string menuPath , string title ) [ ] { ( menuPath , title ) } ) ;
285318 }
286319
287320 #endregion
0 commit comments