Skip to content

Commit bb5a539

Browse files
committed
add RenderPipeline Column & settings for it, #139
1 parent 30872fa commit bb5a539

File tree

8 files changed

+85
-20
lines changed

8 files changed

+85
-20
lines changed

Diff for: UnityLauncherPro/Data/Project.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Project : IValueConverter
1616
public string TargetPlatform { set; get; } // TODO rename to Platform
1717
public string[] TargetPlatforms { set; get; }
1818
public bool folderExists { set; get; }
19+
public string SRP { set; get; } // Scriptable Render Pipeline, TODO add version info?
1920

2021
// WPF keeps calling this method from AppendFormatHelper, GetNameCore..? not sure if need to return something else or default would be faster?
2122
public override string ToString()

Diff for: UnityLauncherPro/Data/UnityInstallation.cs

-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ public class UnityInstallation : IValueConverter
99
public long VersionCode { set; get; } // version as number, cached for sorting
1010
public string Path { set; get; } // exe path
1111
public DateTime? Installed { set; get; }
12-
1312
public string PlatformsCombined { set; get; }
1413
public string[] Platforms { set; get; }
1514
public int ProjectCount { set; get; }
16-
1715
public bool IsPreferred { set; get; }
18-
1916
public string ReleaseType { set; get; } // Alpha, Beta, LTS.. TODO could be enum
2017

2118
// https://stackoverflow.com/a/5551986/5452781

Diff for: UnityLauncherPro/GetProjects.cs

+7-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class GetProjects
1515
// convert target platform name into valid buildtarget platform name, NOTE this depends on unity version, now only 2019 and later are supported
1616
public static Dictionary<string, string> remapPlatformNames = new Dictionary<string, string> { { "StandaloneWindows64", "Win64" }, { "StandaloneWindows", "Win" }, { "Android", "Android" }, { "WebGL", "WebGL" } };
1717

18-
public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranch = false, bool getArguments = false, bool showMissingFolders = false, bool showTargetPlatform = false, StringCollection AllProjectPaths = null, bool searchGitbranchRecursivly = false)
18+
public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranch = false, bool getArguments = false, bool showMissingFolders = false, bool showTargetPlatform = false, StringCollection AllProjectPaths = null, bool searchGitbranchRecursivly = false, bool showSRP = false)
1919
{
2020
List<Project> projectsFound = new List<Project>();
2121

@@ -53,7 +53,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
5353
projectPath = (string)key.GetValue(valueName);
5454
}
5555

56-
var p = GetProjectInfo(projectPath, getGitBranch, getPlasticBranch, getArguments, showMissingFolders, showTargetPlatform, searchGitbranchRecursivly);
56+
var p = GetProjectInfo(projectPath, getGitBranch, getPlasticBranch, getArguments, showMissingFolders, showTargetPlatform, searchGitbranchRecursivly, showSRP);
5757
//Console.WriteLine(projectPath+" "+p.TargetPlatform);
5858

5959
// if want to hide project and folder path for screenshot
@@ -94,7 +94,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
9494
// if not found from registry, add to recent projects list
9595
if (found == false)
9696
{
97-
var p = GetProjectInfo(projectPath, getGitBranch, getPlasticBranch, getArguments, showMissingFolders, showTargetPlatform, searchGitbranchRecursivly);
97+
var p = GetProjectInfo(projectPath, getGitBranch, getPlasticBranch, getArguments, showMissingFolders, showTargetPlatform, searchGitbranchRecursivly, showSRP);
9898
if (p != null) projectsFound.Add(p);
9999
}
100100
}
@@ -121,7 +121,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
121121
return projectsFound;
122122
} // Scan()
123123

124-
static Project GetProjectInfo(string projectPath, bool getGitBranch = false, bool getPlasticBranch = false, bool getArguments = false, bool showMissingFolders = false, bool showTargetPlatform = false, bool searchGitbranchRecursivly = false)
124+
static Project GetProjectInfo(string projectPath, bool getGitBranch = false, bool getPlasticBranch = false, bool getArguments = false, bool showMissingFolders = false, bool showTargetPlatform = false, bool searchGitbranchRecursivly = false, bool showSRP = false)
125125
{
126126
bool folderExists = Directory.Exists(projectPath);
127127

@@ -209,6 +209,9 @@ static Project GetProjectInfo(string projectPath, bool getGitBranch = false, boo
209209
// bubblegum(TM) solution, fill available platforms for this unity version, for this project
210210
p.TargetPlatforms = Tools.GetPlatformsForUnityVersion(projectVersion);
211211
p.folderExists = folderExists;
212+
213+
if (showSRP == true) p.SRP = Tools.GetSRP(projectPath);
214+
212215
return p;
213216
}
214217

Diff for: UnityLauncherPro/MainWindow.xaml

+8
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@
183183
</DataGridTemplateColumn.CellTemplate>
184184
</DataGridTemplateColumn>
185185

186+
<DataGridTextColumn Header="Branch" x:Name="txtColumnRenderPipeline" Binding="{Binding SRP}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" IsReadOnly="True" Width="60">
187+
<DataGridTextColumn.HeaderTemplate>
188+
<DataTemplate>
189+
<TextBlock Text="SRP" IsHitTestVisible="False" />
190+
</DataTemplate>
191+
</DataGridTextColumn.HeaderTemplate>
192+
</DataGridTextColumn>
186193
</DataGrid.Columns>
187194

188195
<!-- right click context menu -->
@@ -739,6 +746,7 @@
739746
<CheckBox x:Name="chkCheckPlasticBranch" Content="Check Plastic branch" ToolTip="Checks for plastic branch, if .git doesnt exists" HorizontalAlignment="Left" Margin="14,0,0,3" Checked="ChkCheckPlasticBranch_Checked" Unchecked="ChkCheckPlasticBranch_Checked"/>
740747
</StackPanel>
741748
<CheckBox x:Name="chkAskNameForQuickProject" Content="Ask name for New Project" Checked="ChkAskNameForQuickProject_Checked" Unchecked="ChkAskNameForQuickProject_Checked" ToolTip="If disabled, uses automatic quick project naming (Should be enabled, unless you want instant project creation)" HorizontalAlignment="Left"/>
749+
<CheckBox x:Name="chkCheckSRP" Content="Show SRP column" ToolTip="If disabled, uses automatic quick project naming (Should be enabled, unless you want instant project creation)" HorizontalAlignment="Left" Checked="chkCheckSRP_Checked" Unchecked="chkCheckSRP_Checked"/>
742750
<CheckBox x:Name="chkShowMissingFolderProjects" Content="Show projects that don't exist on disk" Checked="ChkShowMissingFolderProjects_CheckedChanged" Unchecked="ChkShowMissingFolderProjects_CheckedChanged" ToolTip="List in recent projects, even if the project folder is missing" HorizontalAlignment="Left"/>
743751
<CheckBox x:Name="chkShowLauncherArgumentsColumn" Content="Show commandline arguments column" Unchecked="ChkShowLauncherArgumentsColumn_CheckedChanged" Checked="ChkShowLauncherArgumentsColumn_CheckedChanged" ToolTip="Shows column for custom project commandline params" HorizontalAlignment="Left"/>
744752
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">

Diff for: UnityLauncherPro/MainWindow.xaml.cs

+26-13
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void Start()
148148
//Properties.Settings.Default.projectPaths = null;
149149
//Properties.Settings.Default.Save();
150150

151-
projectsSource = GetProjects.Scan(getGitBranch: (bool)chkShowGitBranchColumn.IsChecked, getPlasticBranch: (bool)chkCheckPlasticBranch.IsChecked, getArguments: (bool)chkShowLauncherArgumentsColumn.IsChecked, showMissingFolders: (bool)chkShowMissingFolderProjects.IsChecked, showTargetPlatform: (bool)chkShowPlatform.IsChecked, AllProjectPaths: Properties.Settings.Default.projectPaths, searchGitbranchRecursivly: (bool)chkGetGitBranchRecursively.IsChecked);
151+
projectsSource = GetProjects.Scan(getGitBranch: (bool)chkShowGitBranchColumn.IsChecked, getPlasticBranch: (bool)chkCheckPlasticBranch.IsChecked, getArguments: (bool)chkShowLauncherArgumentsColumn.IsChecked, showMissingFolders: (bool)chkShowMissingFolderProjects.IsChecked, showTargetPlatform: (bool)chkShowPlatform.IsChecked, AllProjectPaths: Properties.Settings.Default.projectPaths, searchGitbranchRecursivly: (bool)chkGetGitBranchRecursively.IsChecked, showSRP: (bool)chkCheckSRP.IsChecked);
152152

153153
//Console.WriteLine("projectsSource.Count: " + projectsSource.Count);
154154

@@ -453,6 +453,7 @@ void LoadSettings()
453453
chkEnableProjectRename.IsChecked = Settings.Default.enableProjectRename;
454454
chkStreamerMode.IsChecked = Settings.Default.streamerMode;
455455
chkShowPlatform.IsChecked = Settings.Default.showTargetPlatform;
456+
chkCheckSRP.IsChecked = Settings.Default.checkSRP;
456457
chkUseCustomTheme.IsChecked = Settings.Default.useCustomTheme;
457458
txtRootFolderForNewProjects.Text = Settings.Default.newProjectsRoot;
458459
txtWebglRelativePath.Text = Settings.Default.webglBuildPath;
@@ -467,6 +468,7 @@ void LoadSettings()
467468
gridRecent.Columns[4].Visibility = (bool)chkShowLauncherArgumentsColumn.IsChecked ? Visibility.Visible : Visibility.Collapsed;
468469
gridRecent.Columns[5].Visibility = (bool)chkShowGitBranchColumn.IsChecked ? Visibility.Visible : Visibility.Collapsed;
469470
gridRecent.Columns[6].Visibility = (bool)chkShowPlatform.IsChecked ? Visibility.Visible : Visibility.Collapsed;
471+
gridRecent.Columns[7].Visibility = (bool)chkCheckSRP.IsChecked ? Visibility.Visible : Visibility.Collapsed;
470472

471473
// update installations folder listbox
472474
lstRootFolders.Items.Clear();
@@ -654,9 +656,9 @@ private void SaveSettingsOnExit()
654656
List<int> gridWidths;
655657

656658
// if we dont have any settings yet
657-
if (Properties.Settings.Default.gridColumnWidths != null)
659+
if (Settings.Default.gridColumnWidths != null)
658660
{
659-
gridWidths = new List<int>(Properties.Settings.Default.gridColumnWidths);
661+
gridWidths = new List<int>(Settings.Default.gridColumnWidths);
660662
}
661663
else
662664
{
@@ -667,7 +669,7 @@ private void SaveSettingsOnExit()
667669
var column = gridRecent.Columns[0];
668670
for (int i = 0; i < gridRecent.Columns.Count; ++i)
669671
{
670-
if (Properties.Settings.Default.gridColumnWidths != null && Properties.Settings.Default.gridColumnWidths.Length > i)
672+
if (Settings.Default.gridColumnWidths != null && Settings.Default.gridColumnWidths.Length > i)
671673
{
672674
gridWidths[i] = (int)gridRecent.Columns[i].Width.Value;
673675
}
@@ -676,17 +678,17 @@ private void SaveSettingsOnExit()
676678
gridWidths.Add((int)gridRecent.Columns[i].Width.Value);
677679
}
678680
}
679-
Properties.Settings.Default.gridColumnWidths = gridWidths.ToArray();
680-
Properties.Settings.Default.Save();
681+
Settings.Default.gridColumnWidths = gridWidths.ToArray();
682+
Settings.Default.Save();
681683

682684

683685
// save buildrepot column widths
684686
gridWidths.Clear();
685687

686688
// if we dont have any settings yet
687-
if (Properties.Settings.Default.gridColumnWidthsBuildReport != null)
689+
if (Settings.Default.gridColumnWidthsBuildReport != null)
688690
{
689-
gridWidths = new List<int>(Properties.Settings.Default.gridColumnWidthsBuildReport);
691+
gridWidths = new List<int>(Settings.Default.gridColumnWidthsBuildReport);
690692
}
691693
else
692694
{
@@ -697,7 +699,7 @@ private void SaveSettingsOnExit()
697699
column = gridBuildReport.Columns[0];
698700
for (int i = 0; i < gridBuildReport.Columns.Count; ++i)
699701
{
700-
if (Properties.Settings.Default.gridColumnWidthsBuildReport != null && Properties.Settings.Default.gridColumnWidthsBuildReport.Length > i)
702+
if (Settings.Default.gridColumnWidthsBuildReport != null && Settings.Default.gridColumnWidthsBuildReport.Length > i)
701703
{
702704
gridWidths[i] = (int)gridBuildReport.Columns[i].Width.Value;
703705
}
@@ -706,9 +708,9 @@ private void SaveSettingsOnExit()
706708
gridWidths.Add((int)gridBuildReport.Columns[i].Width.Value);
707709
}
708710
}
709-
Properties.Settings.Default.gridColumnWidthsBuildReport = gridWidths.ToArray();
710-
Properties.Settings.Default.projectName = projectNameSetting;
711-
Properties.Settings.Default.Save();
711+
Settings.Default.gridColumnWidthsBuildReport = gridWidths.ToArray();
712+
Settings.Default.projectName = projectNameSetting;
713+
Settings.Default.Save();
712714

713715
// make backup
714716
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
@@ -813,7 +815,7 @@ public void RefreshRecentProjects()
813815
// take currently selected project row
814816
lastSelectedProjectIndex = gridRecent.SelectedIndex;
815817
// rescan recent projects
816-
projectsSource = GetProjects.Scan(getGitBranch: (bool)chkShowGitBranchColumn.IsChecked, getPlasticBranch: (bool)chkCheckPlasticBranch.IsChecked, getArguments: (bool)chkShowLauncherArgumentsColumn.IsChecked, showMissingFolders: (bool)chkShowMissingFolderProjects.IsChecked, showTargetPlatform: (bool)chkShowPlatform.IsChecked, AllProjectPaths: Settings.Default.projectPaths, searchGitbranchRecursivly: (bool)chkGetGitBranchRecursively.IsChecked);
818+
projectsSource = GetProjects.Scan(getGitBranch: (bool)chkShowGitBranchColumn.IsChecked, getPlasticBranch: (bool)chkCheckPlasticBranch.IsChecked, getArguments: (bool)chkShowLauncherArgumentsColumn.IsChecked, showMissingFolders: (bool)chkShowMissingFolderProjects.IsChecked, showTargetPlatform: (bool)chkShowPlatform.IsChecked, AllProjectPaths: Settings.Default.projectPaths, searchGitbranchRecursivly: (bool)chkGetGitBranchRecursively.IsChecked, showSRP: (bool)chkCheckSRP.IsChecked);
817819
gridRecent.ItemsSource = projectsSource;
818820

819821
// fix sorting on refresh
@@ -3798,6 +3800,17 @@ private void CheckCustomIcon()
37983800
//Debug.WriteLine("Custom icon not found. Using default.");
37993801
}
38003802
}
3803+
3804+
private void chkCheckSRP_Checked(object sender, RoutedEventArgs e)
3805+
{
3806+
if (this.IsActive == false) return; // dont run code on window init
3807+
3808+
gridRecent.Columns[7].Visibility = (bool)chkCheckSRP.IsChecked ? Visibility.Visible : Visibility.Collapsed;
3809+
3810+
Settings.Default.checkSRP = (bool)chkCheckSRP.IsChecked;
3811+
Settings.Default.Save();
3812+
RefreshRecentProjects();
3813+
}
38013814
//private void menuProjectProperties_Click(object sender, RoutedEventArgs e)
38023815
//{
38033816
// var proj = GetSelectedProject();

Diff for: UnityLauncherPro/Properties/Settings.Designer.cs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: UnityLauncherPro/Properties/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,8 @@
145145
<Setting Name="useAlphaReleaseNotes" Type="System.Boolean" Scope="User">
146146
<Value Profile="(Default)">True</Value>
147147
</Setting>
148+
<Setting Name="checkSRP" Type="System.Boolean" Scope="User">
149+
<Value Profile="(Default)">False</Value>
150+
</Setting>
148151
</Settings>
149152
</SettingsFile>

Diff for: UnityLauncherPro/Tools.cs

+28
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,34 @@ private static async Task<bool> DownloadFileAsync(string fileUrl, string destina
22872287
}
22882288
return result;
22892289
}
2290+
2291+
internal static string GetSRP(string projectPath)
2292+
{
2293+
// read projectsettings/graphicsettings file, look for m_SRPDefaultSettings: value
2294+
var settingsFile = Path.Combine(projectPath, "ProjectSettings", "GraphicsSettings.asset");
2295+
if (File.Exists(settingsFile) == false) return null;
2296+
2297+
var allText = File.ReadAllText(settingsFile);
2298+
var srpIndex = allText.IndexOf("m_SRPDefaultSettings:");
2299+
if (srpIndex == -1) return null; // BIRP
2300+
2301+
// urp = UnityEngine.Rendering.Universal.UniversalRenderPipeline
2302+
// hdrp = UnityEngine.Rendering.HighDefinition.HDRenderPipeline
2303+
2304+
if (allText.IndexOf("UnityEngine.Rendering.Universal.UniversalRenderPipeline", srpIndex) > -1)
2305+
{
2306+
return "URP";
2307+
}
2308+
else if (allText.IndexOf("UnityEngine.Rendering.HighDefinition.HDRenderPipeline", srpIndex) > -1)
2309+
{
2310+
return "HDRP";
2311+
}
2312+
else
2313+
{
2314+
return null; // BIRP
2315+
}
2316+
2317+
}
22902318
} // class
22912319

22922320
} // namespace

0 commit comments

Comments
 (0)