mirror of
https://github.com/Facepunch/sbox-public.git
synced 2025-12-23 22:48:07 -05:00
Menu-in-editor fixes 2 (#3395)
* Skip menu editor code outside of the menu project * Asset Browser: skip menu project assets in Everything and Recents
This commit is contained in:
@@ -21,7 +21,7 @@ public partial class Project
|
||||
int lastCompilerHash;
|
||||
|
||||
// anything that means we need to re-create the compiler and recompile should be here
|
||||
int CompilerHash => HashCode.Combine( Active, Json.SerializeAsObject( Config.GetCompileSettings() ).ToJsonString(), Config.IsStandaloneOnly, Config.Org, Config.Ident, Config.Type, string.Join( ";", PackageReferences() ) );
|
||||
int CompilerHash => HashCode.Combine( Active, Current == this, Json.SerializeAsObject( Config.GetCompileSettings() ).ToJsonString(), Config.IsStandaloneOnly, Config.Org, Config.Ident, Config.Type, string.Join( ";", PackageReferences() ) );
|
||||
|
||||
/// <summary>
|
||||
/// These package types should reference package.base
|
||||
@@ -173,6 +173,10 @@ public partial class Project
|
||||
if ( !Active )
|
||||
return;
|
||||
|
||||
// only want menu editor code if we're in the menu project
|
||||
if ( this != Current && Config.Ident == "menu" )
|
||||
return;
|
||||
|
||||
if ( !HasEditorPath() )
|
||||
return;
|
||||
|
||||
|
||||
@@ -18,16 +18,18 @@ public record EverythingLocation : LocalAssetBrowser.Location
|
||||
{
|
||||
string projectPath = Project.Current.GetAssetsPath().NormalizeFilename( false );
|
||||
|
||||
var menuProject = EditorUtility.Projects.GetAll().FirstOrDefault( x => x.Config.Ident == "menu" );
|
||||
string menuPath = menuProject?.GetAssetsPath().NormalizeFilename( false );
|
||||
|
||||
foreach ( var asset in AssetSystem.All.OrderBy( x => x.Name ) )
|
||||
{
|
||||
bool isCloud = asset.AbsolutePath.Contains( ".sbox/cloud/" );
|
||||
if ( isCloud ) continue;
|
||||
|
||||
|
||||
if ( asset.AbsolutePath.StartsWith( "mount:" ) )
|
||||
if ( menuPath is not null && menuProject != Project.Current )
|
||||
{
|
||||
yield return new FileInfo( asset.AbsolutePath );
|
||||
continue;
|
||||
bool isMenu = asset.AbsolutePath.StartsWith( menuPath );
|
||||
if ( isMenu ) continue;
|
||||
}
|
||||
|
||||
yield return new FileInfo( asset.AbsolutePath );
|
||||
|
||||
@@ -16,8 +16,17 @@ public record RecentsLocation : LocalAssetBrowser.Location
|
||||
|
||||
public override IEnumerable<FileInfo> GetFiles()
|
||||
{
|
||||
var menuProject = EditorUtility.Projects.GetAll().FirstOrDefault( x => x.Config.Ident == "menu" );
|
||||
string menuPath = menuProject?.GetAssetsPath().NormalizeFilename( false );
|
||||
|
||||
foreach ( var asset in AssetSystem.All.OrderByDescending( x => x.LastOpened ).Take( 50 ) )
|
||||
{
|
||||
if ( menuPath is not null && menuProject != Project.Current )
|
||||
{
|
||||
bool isMenu = asset.AbsolutePath.StartsWith( menuPath );
|
||||
if ( isMenu ) continue;
|
||||
}
|
||||
|
||||
yield return new FileInfo( asset.AbsolutePath );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user