private void UseProfile(BuildProfile pro) { _profile = pro; UpdateParameters(pro); DialogResult = DialogResult.OK; Close(); }
internal static void Init() { Profile = new BuildProfile(); s_editorPane = new BuildEditorPane(); s_resultsPane = new BuildResultsPane(); }
private BuildProfile SaveAsProfile(string name) { var prof = new BuildProfile { ID = _build.Profiles.Any() ? _build.Profiles.Max(x => x.ID) + 1 : 1, BuildID = _build.ID, Name = name, RunCsg = RunCsgCheckbox.Checked, RunBsp = RunBspCheckbox.Checked, RunVis = RunVisCheckbox.Checked, RunRad = RunRadCheckbox.Checked, GeneratedCsgParameters = CsgParameters.GeneratedCommands, GeneratedBspParameters = BspParameters.GeneratedCommands, GeneratedVisParameters = VisParameters.GeneratedCommands, GeneratedRadParameters = RadParameters.GeneratedCommands, GeneratedSharedParameters = SharedParameters.GeneratedCommands, AdditionalCsgParameters = CsgParameters.AdditionalCommands, AdditionalBspParameters = BspParameters.AdditionalCommands, AdditionalVisParameters = VisParameters.AdditionalCommands, AdditionalRadParameters = RadParameters.AdditionalCommands, AdditionalSharedParameters = SharedParameters.AdditionalCommands }; _build.Profiles.Add(prof); SettingsManager.Write(); return(prof); }
private void SetArgumentsFromInterface(BuildProfile profile) { var args = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); foreach (var panel in ToolTabs.TabPages.OfType <TabPage>().SelectMany(x => x.Controls.OfType <BuildParametersPanel>())) { args.Add(panel.Tool.Name, panel.Arguments); } var shouldRun = new List <string> { "Shared" }; foreach (var step in pnlSteps.Controls.OfType <CheckBox>()) { if (step.Checked && step.Tag is CompileTool t) { shouldRun.Add(t.Name); } } profile.Arguments.Clear(); foreach (var kv in args) { if (shouldRun.Contains(kv.Key)) { profile.Arguments[kv.Key] = kv.Value; } } }
private BuildProfile CreateProfile(string name) { var prof = new BuildProfile { ID = _build.Profiles.Any() ? _build.Profiles.Max(x => x.ID) + 1 : 1, BuildID = _build.ID, Name = name, RunCsg = _specification.GetDefaultRun("csg"), RunBsp = _specification.GetDefaultRun("bsp"), RunVis = _specification.GetDefaultRun("vis"), RunRad = _specification.GetDefaultRun("rad"), GeneratedCsgParameters = _specification.GetDefaultParameters("csg"), GeneratedBspParameters = _specification.GetDefaultParameters("bsp"), GeneratedVisParameters = _specification.GetDefaultParameters("vis"), GeneratedRadParameters = _specification.GetDefaultParameters("rad"), GeneratedSharedParameters = _specification.GetDefaultParameters("shared"), AdditionalCsgParameters = "", AdditionalBspParameters = "", AdditionalVisParameters = "", AdditionalRadParameters = "", AdditionalSharedParameters = "" }; _build.Profiles.Add(prof); SettingsManager.Write(); return(prof); }
public static BuildProfile CreateAssetAtPath(string path) { BuildProfile asset = ScriptableObject.CreateInstance <BuildProfile>(); asset.name = Path.GetFileName(path); AssetDatabase.CreateAsset(asset, path); return(asset); }
private void ProfileSelected(object sender, EventArgs e) { _profile = ProfileSelect.SelectedItem as BuildProfile; if (_profile == null) { return; } UpdateParameters(_profile); }
BuildProfile GetDefaultProfile() { BuildProfile profile = null; if (m_Profiles.Count > 0) { profile = m_Profiles[0]; } return(profile); }
// Allows passing in the profile directly for internal methods, makes the profile window's code a bit cleaner // Can't be public since BuildProfile is an internal class internal bool RenameProfile(BuildProfile profile, string newName) { if (profile == null) { Addressables.LogError("Profile rename failed because profile passed in is null"); return(false); } if (profile == GetDefaultProfile()) { Addressables.LogError("Profile rename failed because default profile cannot be renamed."); return(false); } if (profile.profileName == newName) { return(false); } // new name cannot only contain spaces if (newName.Trim().Length == 0) { Addressables.LogError("Profile rename failed because new profile name must not be only spaces."); return(false); } bool profileExistsInSettingsList = false; for (int i = 0; i < m_Profiles.Count; i++) { // return false if there already exists a profile with the new name, no duplicates are allowed if (m_Profiles[i].profileName == newName) { Addressables.LogError("Profile rename failed because new profile name is not unique."); return(false); } if (m_Profiles[i].id == profile.id) { profileExistsInSettingsList = true; } } // Rename the profile profile.profileName = newName; if (profileExistsInSettingsList) { SetDirty(AddressableAssetSettings.ModificationEvent.ProfileModified, profile, true); } ProfileWindow.MarkForReload(); return(true); }
void MenuSetProfile(object o) { CurrentProfile = (BuildProfile)o; if (CurrentTemplate != null && !CurrentTemplate.name.EndsWith("*")) { CurrentTemplate = Instantiate <BuildTemplate>(CurrentTemplate) as BuildTemplate; CurrentTemplate.name += "*"; } CurrentTemplate.Profile = CurrentProfile; }
private void UpdateParameters(BuildProfile prof) { RunCsgCheckbox.Checked = prof.RunCsg; RunBspCheckbox.Checked = prof.RunBsp; RunVisCheckbox.Checked = prof.RunVis; RunRadCheckbox.Checked = prof.RunRad; CsgParameters.SetCommands(prof.GeneratedCsgParameters ?? "", prof.AdditionalCsgParameters ?? ""); BspParameters.SetCommands(prof.GeneratedBspParameters ?? "", prof.AdditionalBspParameters ?? ""); VisParameters.SetCommands(prof.GeneratedVisParameters ?? "", prof.AdditionalVisParameters ?? ""); RadParameters.SetCommands(prof.GeneratedRadParameters ?? "", prof.AdditionalRadParameters ?? ""); SharedParameters.SetCommands(prof.GeneratedSharedParameters ?? "", prof.AdditionalSharedParameters ?? ""); }
/// <summary> /// Occurs when the user has clicked the OK button. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An <see cref="EventArgs"/> that contain the event data.</param> private void OnOKClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.tbFileName.Text)) { MessageBox.Show(this, "The name must not be empty", this.Text); return; } if (this.profile == null) { this.profile = new BuildProfile(); } this.profile.Name = this.tbFileName.Text; this.Close(DialogResult.OK); }
internal BuildProfile(string name, BuildProfile copyFrom, AddressableAssetProfileSettings ps) { m_InheritedParent = null; id = GUID.Generate().ToString(); profileName = name; values.Clear(); m_ProfileParent = ps; if (copyFrom != null) { foreach (var v in copyFrom.values) { values.Add(new ProfileEntry(v)); } m_InheritedParent = copyFrom.m_InheritedParent; } }
void PopulateAssets() { var buildTemplates = AssetDatabase.FindAssets("t:BuildTemplate"); var buildProfiles = AssetDatabase.FindAssets("t:BuildProfile"); var sceneLists = AssetDatabase.FindAssets("t:SceneList"); m_BuildTemplates = new Dictionary <string, List <BuildTemplate> >(); m_BuildProfiles = new List <BuildProfile>(); m_SceneLists = new List <SceneList>(); TemplateMenu = new GenericMenu(); foreach (var templateGUID in buildTemplates) { string templatePath = AssetDatabase.GUIDToAssetPath(templateGUID); BuildTemplate template = (BuildTemplate)AssetDatabase.LoadAssetAtPath(templatePath, typeof(BuildTemplate)); if (!m_BuildTemplates.ContainsKey(template.Category)) { m_BuildTemplates.Add(template.Category, new List <BuildTemplate>()); } m_BuildTemplates[template.Category].Add(template); TemplateMenu.AddItem(new GUIContent(template.MenuEntry), false, MenuSetTemplate, template); } ProfileMenu = new GenericMenu(); foreach (var profileGUID in buildProfiles) { string profilePath = AssetDatabase.GUIDToAssetPath(profileGUID); BuildProfile profile = (BuildProfile)AssetDatabase.LoadAssetAtPath(profilePath, typeof(BuildProfile)); m_BuildProfiles.Add(profile); ProfileMenu.AddItem(new GUIContent(profile.MenuEntry), false, MenuSetProfile, profile); } SceneListMenu = new GenericMenu(); foreach (var sceneListGUID in sceneLists) { string sceneListPath = AssetDatabase.GUIDToAssetPath(sceneListGUID); SceneList sceneList = (SceneList)AssetDatabase.LoadAssetAtPath(sceneListPath, typeof(SceneList)); m_SceneLists.Add(sceneList); SceneListMenu.AddItem(new GUIContent(sceneList.MenuEntry), false, MenuSetSceneList, sceneList); } }
private void SaveProfileAsButtonClicked(object sender, EventArgs e) { using (var qf = new QuickForm("Save Build Profile As...").TextBox("Name").OkCancel()) { if (qf.ShowDialog() == DialogResult.OK) { var name = qf.String("Name"); if (_build.Profiles.Any(x => String.Equals(name, x.Name, StringComparison.InvariantCultureIgnoreCase))) { MessageBox.Show("There is already a profile with that name, please type a unique name.", "Cannot create profile"); name = null; } if (!String.IsNullOrWhiteSpace(name)) { _profile = SaveAsProfile(name); UpdateProfiles(); } } } }
/// <summary> /// Adds a new profile. /// </summary> /// <param name="name">The name of the new profile.</param> /// <param name="copyFromId">The id of the profile to copy values from.</param> /// <returns>The id of the created profile.</returns> public string AddProfile(string name, string copyFromId) { var existingProfile = GetProfileByName(name); if (existingProfile != null) { return(existingProfile.id); } var copyRoot = GetProfile(copyFromId); if (copyRoot == null && m_Profiles.Count > 0) { copyRoot = GetDefaultProfile(); } var prof = new BuildProfile(name, copyRoot, this); m_Profiles.Add(prof); SetDirty(AddressableAssetSettings.ModificationEvent.ProfileAdded, prof, true); return(prof.id); }
private void SaveProfileAsButtonClicked(object sender, EventArgs e) { var name = PromptName(""); if (String.IsNullOrEmpty(name)) { return; } var profile = new BuildProfile { Name = name, SpecificationName = _specification.Name }; SetArgumentsFromInterface(profile); _buildProfileRegister.Add(profile); PopulateProfiles(); cmbProfile.SelectedIndex = cmbProfile.Items.OfType <ProfileWrapper>().ToList().FindIndex(x => x.Profile == profile); }
/// <summary> /// Creates a new profile, with the specified parent. /// </summary> /// <param name="parent">The parent for the new profile to be created. If null, the created profile won't have a parent.</param> private void CreateNewProfile(BuildProfile parent) { try { using (var f = new AddBuildProfileForm()) { if (f.ShowDialog(this) == DialogResult.OK) { f.Value.Parent = parent; this.Project.Profiles.Add(f.Value); this.cbProfile.Items.Add(f.Value); this.cbInheritsFrom.Items.Add(f.Value); this.cbProfile.SelectedItem = f.Value; } } } catch (Exception x) { MessageBox.Show(this, x.Message); } }
public Batch(Document document, Build build, BuildProfile profile) { Document = document; Game = document.Game; Build = build; Profile = profile; var workingDir = Path.GetDirectoryName(document.MapFile); if (build.WorkingDirectory == CompileWorkingDirectory.SubDirectory && workingDir != null) { workingDir = Path.Combine(workingDir, Path.GetFileNameWithoutExtension(document.MapFileName)); } else if (build.WorkingDirectory == CompileWorkingDirectory.TemporaryDirectory || workingDir == null) { workingDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); } if (!Directory.Exists(workingDir)) { Directory.CreateDirectory(workingDir); } TargetFile = SaveWorkingMap(document, workingDir); OriginalFile = document.MapFile; var fileFlag = '"' + TargetFile + '"'; Steps = new List <BatchCompileStep>(); if (profile.RunCsg) { Steps.Add(new BatchCompileStep { Operation = Path.Combine(build.Path, build.Csg), Flags = (profile.FullCsgParameters + ' ' + fileFlag).Trim() }); } if (profile.RunBsp) { Steps.Add(new BatchCompileStep { Operation = Path.Combine(build.Path, build.Bsp), Flags = (profile.FullBspParameters + ' ' + fileFlag).Trim() }); } if (profile.RunVis) { Steps.Add(new BatchCompileStep { Operation = Path.Combine(build.Path, build.Vis), Flags = (profile.FullVisParameters + ' ' + fileFlag).Trim() }); } if (profile.RunRad) { Steps.Add(new BatchCompileStep { Operation = Path.Combine(build.Path, build.Rad), Flags = (profile.FullRadParameters + ' ' + fileFlag).Trim() }); } }
public override void Action(int instanceId, string pathName, string resourceFile) { BuildProfile asset = BuildProfileAssetFactory.CreateAssetAtPath(pathName); ProjectWindowUtil.ShowCreatedAsset(asset); }
/// <summary> /// Occurs when the user has changed the selected profile. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A <see cref="EventArgs"/> with event data.</param> private void ProfileComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.SelectedProfile = this.cbProfile.SelectedItem as BuildProfile; }
private void UseProfile(BuildProfile profile) { _profile = profile; DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Get the value of a property. /// </summary> /// <param name="profileId">The profile id.</param> /// <param name="varId">The property id.</param> /// <returns></returns> public string GetValueById(string profileId, string varId) { BuildProfile profile = GetProfile(profileId); return(profile == null ? varId : profile.GetValueById(varId)); }
private void UpdateProfiles() { if (!_build.Profiles.Any()) { _profile = CreateProfile("Default"); } var profs = _build.Profiles; var idx = profs.IndexOf(_profile); if (idx < 0) { idx = ProfileSelect.SelectedIndex; } ProfileSelect.Items.Clear(); PresetTable.Controls.Clear(); PresetTable.RowStyles.Clear(); if (_specification.Presets.Any()) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Choose a preset to use for the compile:", Dock = DockStyle.Top }); foreach (var preset in _specification.Presets) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new HeadingButton { HeadingText = preset.Name, Text = preset.Description, Dock = DockStyle.Top }; var pre = preset; btn.Click += (s, e) => UsePreset(pre); PresetTable.Controls.Add(btn); } PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Or select from a custom profile:", Dock = DockStyle.Top }); } else { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Select a profile to use for the compile:", Dock = DockStyle.Top }); } foreach (var profile in profs) { ProfileSelect.Items.Add(profile); PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new Button { Text = profile.Name, Height = 30, Dock = DockStyle.Top }; var pro = profile; btn.Click += (s, e) => UseProfile(pro); PresetTable.Controls.Add(btn); } if (idx < 0 || idx >= profs.Count) { idx = 0; } if (ProfileSelect.SelectedIndex != idx) { ProfileSelect.SelectedIndex = idx; } }
void MenuSetTemplate(object o) { CurrentTemplate = (BuildTemplate)o; CurrentProfile = CurrentTemplate.Profile; CurrentSceneList = CurrentTemplate.SceneList; }
public ProfileWrapper(BuildProfile profile) { Profile = profile; }