public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_searchFilter == null) { return; } EditorGUILayout.HelpBox("Load By Search Filter: Load assets match given search filter condition.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); bool bRespondAP = EditorGUILayout.ToggleLeft("Respond To Asset Change", m_respondToAssetChange); if (bRespondAP != m_respondToAssetChange) { using (new RecordUndoScope("Remove Target Load Path Settings", node, true)) { m_respondToAssetChange = bRespondAP; } } GUILayout.Space(4f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_searchFilter.ContainsValueOf(editor.CurrentEditingGroup), (bool b) => { using (new RecordUndoScope("Remove Target Search Filter Settings", node, true)) { if (b) { m_searchFilter[editor.CurrentEditingGroup] = m_searchFilter.DefaultValue; } else { m_searchFilter.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var condition = m_searchFilter[editor.CurrentEditingGroup]; EditorGUILayout.LabelField("Search Filter"); string newCondition = null; using (new EditorGUILayout.HorizontalScope()) { newCondition = EditorGUILayout.TextField(condition); } if (newCondition != condition) { using (new RecordUndoScope("Modify Search Filter", node, true)){ m_searchFilter[editor.CurrentEditingGroup] = newCondition; onValueChanged(); } } } } }
private void CheckAndCorrectPath(BuildTarget target) { var loadPath = GetLoadPath(target); var pathFromGuid = AssetDatabase.GUIDToAssetPath(m_loadPathGuid[target]); // fix load path from guid (adopting folder rename) if (!AssetDatabase.IsValidFolder(loadPath)) { if (!string.IsNullOrEmpty(pathFromGuid)) { if (m_loadPath.ContainsValueOf(target)) { m_loadPath [target] = NormalizeLoadPath(pathFromGuid); } else { m_loadPath.DefaultValue = NormalizeLoadPath(pathFromGuid); } } } // if folder is valid and guid is invalid, reflect folder to guid else { if (string.IsNullOrEmpty(pathFromGuid)) { if (m_loadPath.ContainsValueOf(target)) { m_loadPathGuid [target] = AssetDatabase.AssetPathToGUID(loadPath); } else { m_loadPathGuid.DefaultValue = AssetDatabase.AssetPathToGUID(loadPath); } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { EditorGUILayout.HelpBox("Group By File: Create group per individual asset.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(4f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_groupNameFormat.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Grouping Settings", node, true)) { if (enabled) { m_groupNameFormat [editor.CurrentEditingGroup] = m_groupNameFormat.DefaultValue; } else { m_groupNameFormat.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var newGroupNameFormat = EditorGUILayout.TextField("Group Name Format", m_groupNameFormat [editor.CurrentEditingGroup]); EditorGUILayout.HelpBox( "You can customize group name. You can use variable {OldGroup} for old group name and {NewGroup} for current matching name.You can also use {FileName} and {FileExtension}.", MessageType.Info); if (newGroupNameFormat != m_groupNameFormat [editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Group Name", node, true)) { m_groupNameFormat [editor.CurrentEditingGroup] = newGroupNameFormat; onValueChanged(); } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_bundleNameTemplate == null) { return; } EditorGUILayout.HelpBox("Configure Bundle From Group: Create asset bundle settings from incoming group of assets.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var newUseGroupAsVariantValue = GUILayout.Toggle(m_useGroupAsVariants, "Use input group as variants"); if (newUseGroupAsVariantValue != m_useGroupAsVariants) { using (new RecordUndoScope("Change Bundle Config", node, true)){ m_useGroupAsVariants = newUseGroupAsVariantValue; List <Variant> rv = new List <Variant>(m_variants); foreach (var v in rv) { NodeGUIUtility.NodeEventHandler( new NodeEvent(NodeEvent.EventType.EVENT_CONNECTIONPOINT_DELETED, node, Vector2.zero, GetConnectionPoint(node.Data, v))); RemoveVariant(node.Data, v); } onValueChanged(); } } using (new EditorGUI.DisabledScope(newUseGroupAsVariantValue)) { GUILayout.Label("Variants:"); var variantNames = m_variants.Select(v => v.Name).ToList(); Variant removing = null; foreach (var v in m_variants) { using (new GUILayout.HorizontalScope()) { if (GUILayout.Button("-", GUILayout.Width(30))) { removing = v; } else { GUIStyle s = new GUIStyle((GUIStyle)"TextFieldDropDownText"); Action makeStyleBold = () => { s.fontStyle = FontStyle.Bold; s.fontSize = 12; }; ValidateVariantName(v.Name, variantNames, makeStyleBold, makeStyleBold, makeStyleBold); var variantName = EditorGUILayout.TextField(v.Name, s); if (variantName != v.Name) { using (new RecordUndoScope("Change Variant Name", node, true)){ v.Name = variantName; UpdateVariant(node.Data, v); onValueChanged(); } } } } } if (GUILayout.Button("+")) { using (new RecordUndoScope("Add Variant", node, true)){ if (m_variants.Count == 0) { NodeGUIUtility.NodeEventHandler(new NodeEvent(NodeEvent.EventType.EVENT_DELETE_ALL_CONNECTIONS_TO_POINT, node, Vector2.zero, node.Data.InputPoints[0])); } AddVariant(node.Data, Model.Settings.BUNDLECONFIG_VARIANTNAME_DEFAULT); onValueChanged(); } } if (removing != null) { using (new RecordUndoScope("Remove Variant", node, true)){ // event must raise to remove connection associated with point NodeGUIUtility.NodeEventHandler(new NodeEvent(NodeEvent.EventType.EVENT_CONNECTIONPOINT_DELETED, node, Vector2.zero, GetConnectionPoint(node.Data, removing))); RemoveVariant(node.Data, removing); onValueChanged(); } } } } //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_bundleNameTemplate.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Bundle Name Template Setting", node, true)){ if (enabled) { m_bundleNameTemplate[editor.CurrentEditingGroup] = m_bundleNameTemplate.DefaultValue; } else { m_bundleNameTemplate.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var bundleNameTemplate = EditorGUILayout.TextField("Bundle Name Template", m_bundleNameTemplate[editor.CurrentEditingGroup]).ToLower(); if (bundleNameTemplate != m_bundleNameTemplate[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Bundle Name Template", node, true)){ m_bundleNameTemplate[editor.CurrentEditingGroup] = bundleNameTemplate; onValueChanged(); } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_destinationPath == null) { return; } var currentEditingGroup = editor.CurrentEditingGroup; EditorGUILayout.HelpBox("File Operation: Copy or Move Files.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); var newOp = (FileOperationType)EditorGUILayout.EnumPopup("Operation", m_operationType); if (newOp != m_operationType) { using (new RecordUndoScope("Change Copy/Move Operation", node, true)) { m_operationType = newOp; onValueChanged(); } } var newDepth = EditorGUILayout.IntField("Removing Directory Depth", m_removingDirectoryDepth); if (newDepth != m_removingDirectoryDepth) { using (new RecordUndoScope("Change Directory Depth", node, true)) { m_removingDirectoryDepth = newDepth; onValueChanged(); } } GUILayout.Space(8f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_destinationPath.ContainsValueOf(currentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Directory Settings", node, true)){ if (enabled) { m_destinationPath[currentEditingGroup] = m_destinationPath.DefaultValue; m_destinationOption[currentEditingGroup] = m_destinationOption.DefaultValue; } else { m_destinationPath.Remove(currentEditingGroup); m_destinationOption.Remove(currentEditingGroup); } onValueChanged(); } }); using (disabledScope) { DestinationDirectoryOption opt = (DestinationDirectoryOption)m_destinationOption[currentEditingGroup]; var newOption = (DestinationDirectoryOption)EditorGUILayout.EnumPopup("Directory Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Directory Option", node, true)){ m_destinationOption[currentEditingGroup] = (int)newOption; onValueChanged(); } } EditorGUILayout.LabelField("Destination Path:"); string newDstPath = null; newDstPath = editor.DrawFolderSelector("", "Select Destination Folder", m_destinationPath[currentEditingGroup], GetDestinationPath(m_destinationPath[currentEditingGroup]), (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newDstPath != m_destinationPath[currentEditingGroup]) { using (new RecordUndoScope("Change Destination Path", node, true)){ m_destinationPath[currentEditingGroup] = newDstPath; onValueChanged(); } } var exporterNodePath = GetDestinationPath(newDstPath); if (ValidateExportPath( newDstPath, exporterNodePath, () => { }, () => { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(exporterNodePath + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(exporterNodePath); } onValueChanged(); } EditorGUILayout.Space(); string parentDir = Path.GetDirectoryName(exporterNodePath); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); string[] dirs = Directory.GetDirectories(parentDir); foreach (string s in dirs) { EditorGUILayout.LabelField(s); } } } )) { GUILayout.Space(10f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button(GUIHelper.RevealInFinderLabel)) { EditorUtility.RevealInFinder(exporterNodePath); } } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_exportPath == null) { return; } var currentEditingGroup = editor.CurrentEditingGroup; EditorGUILayout.HelpBox("Export To Directory: Export given files to output directory.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_exportPath.ContainsValueOf(currentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Export Settings", node, true)){ if (enabled) { m_exportPath[currentEditingGroup] = m_exportPath.DefaultValue; m_exportOption[currentEditingGroup] = m_exportOption.DefaultValue; m_flattenDir[currentEditingGroup] = m_flattenDir.DefaultValue; } else { m_exportPath.Remove(currentEditingGroup); m_exportOption.Remove(currentEditingGroup); m_flattenDir.Remove(currentEditingGroup); } onValueChanged(); } }); using (disabledScope) { ExportOption opt = (ExportOption)m_exportOption[currentEditingGroup]; var newOption = (ExportOption)EditorGUILayout.EnumPopup("Export Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Export Option", node, true)){ m_exportOption[currentEditingGroup] = (int)newOption; onValueChanged(); } } EditorGUILayout.LabelField("Export Path:"); string newExportPath = null; newExportPath = editor.DrawFolderSelector("", "Select Export Folder", m_exportPath[currentEditingGroup], GetExportPath(m_exportPath[currentEditingGroup]), (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newExportPath != m_exportPath[currentEditingGroup]) { using (new RecordUndoScope("Change Export Path", node, true)){ m_exportPath[currentEditingGroup] = newExportPath; onValueChanged(); } } int flat = m_flattenDir[currentEditingGroup]; var newFlat = EditorGUILayout.ToggleLeft("Flatten Directory", flat == 1) ? 1:0; if (newFlat != flat) { using (new RecordUndoScope("Change Flatten Directory", node, true)){ m_flattenDir[currentEditingGroup] = newFlat; onValueChanged(); } } var exporterNodePath = GetExportPath(newExportPath); if (ValidateExportPath( newExportPath, exporterNodePath, () => { }, () => { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(exporterNodePath + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(exporterNodePath); } onValueChanged(); } EditorGUILayout.Space(); string parentDir = Path.GetDirectoryName(exporterNodePath); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); string[] dirs = Directory.GetDirectories(parentDir); foreach (string s in dirs) { EditorGUILayout.LabelField(s); } } } )) { GUILayout.Space(10f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); #if UNITY_EDITOR_OSX string buttonName = "Reveal in Finder"; #else string buttonName = "Show in Explorer"; #endif if (GUILayout.Button(buttonName)) { EditorUtility.RevealInFinder(exporterNodePath); } } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_groupingKeyword == null) { return; } EditorGUILayout.HelpBox("Group By File Path: Create group of assets from asset's file path.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); var newSlash = EditorGUILayout.ToggleLeft("Allow directory separator ('/') in group name", m_allowSlash); if (newSlash != m_allowSlash) { using (new RecordUndoScope("Change Allow Slash Setting", node, true)) { m_allowSlash = newSlash; onValueChanged(); } } if (m_allowSlash) { EditorGUILayout.HelpBox( "Allowing directory separator for group name may create incompatible group name with other nodes. Please use this option carefully.", MessageType.Info); } GUILayout.Space(4f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_groupingKeyword.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Grouping Keyword Settings", node, true)) { if (enabled) { m_groupingKeyword[editor.CurrentEditingGroup] = m_groupingKeyword.DefaultValue; m_patternType[editor.CurrentEditingGroup] = m_patternType.DefaultValue; m_groupNameFormat[editor.CurrentEditingGroup] = m_groupNameFormat.DefaultValue; } else { m_groupingKeyword.Remove(editor.CurrentEditingGroup); m_patternType.Remove(editor.CurrentEditingGroup); m_groupNameFormat.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var newType = (GroupingPatternType)EditorGUILayout.EnumPopup("Pattern Type", (GroupingPatternType)m_patternType[editor.CurrentEditingGroup]); if (newType != (GroupingPatternType)m_patternType[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Grouping Pattern Type", node, true)) { m_patternType[editor.CurrentEditingGroup] = (int)newType; onValueChanged(); } } var newGroupingKeyword = EditorGUILayout.TextField("Grouping Keyword", m_groupingKeyword[editor.CurrentEditingGroup]); string helpText = null; switch ((GroupingPatternType)m_patternType[editor.CurrentEditingGroup]) { case GroupingPatternType.WildCard: helpText = "Grouping Keyword requires \"*\" in itself. It assumes there is a pattern such as \"ID_0\" in incoming paths when configured as \"ID_*\" "; break; case GroupingPatternType.RegularExpression: helpText = "Grouping Keyword requires pattern definition with \"()\" in Regular Expression manner."; break; } EditorGUILayout.HelpBox(helpText, MessageType.Info); if (newGroupingKeyword != m_groupingKeyword[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Grouping Keywords", node, true)) { m_groupingKeyword[editor.CurrentEditingGroup] = newGroupingKeyword; onValueChanged(); } } var newGroupNameFormat = EditorGUILayout.TextField("Group Name Format", m_groupNameFormat[editor.CurrentEditingGroup]); EditorGUILayout.HelpBox( "You can customize group name. You can use variable {OldGroup} for old group name and {NewGroup} for current matching name.", MessageType.Info); if (newGroupNameFormat != m_groupNameFormat[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Group Name", node, true)) { m_groupNameFormat[editor.CurrentEditingGroup] = newGroupNameFormat; onValueChanged(); } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { EditorGUILayout.HelpBox("Assert Unwanted Assets In Bundle: Checks if unwanted assets are included in bundle configurations.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); var newValue = (AssertionStyle)EditorGUILayout.EnumPopup("Assertion Style", m_style); if (newValue != m_style) { using (new RecordUndoScope("Change Assertion Style", node, true)) { m_style = newValue; onValueChanged(); } } GUILayout.Space(4f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_path.ContainsValueOf(editor.CurrentEditingGroup), (bool b) => { using (new RecordUndoScope("Remove Target Load Path Settings", node, true)) { if (b) { m_path[editor.CurrentEditingGroup] = m_path.DefaultValue; } else { m_path.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var path = m_path[editor.CurrentEditingGroup]; EditorGUILayout.LabelField("Assertion Path:"); string newLoadPath = null; newLoadPath = editor.DrawFolderSelector(Model.Settings.Path.ASSETS_PATH, "Select Asset Folder", path, FileUtility.PathCombine(Model.Settings.Path.ASSETS_PATH, path), (string folderSelected) => { var dataPath = Application.dataPath; if (dataPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(dataPath); if (index >= 0) { folderSelected = folderSelected.Substring(dataPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newLoadPath != path) { using (new RecordUndoScope("Path Change", node, true)){ m_path[editor.CurrentEditingGroup] = newLoadPath; onValueChanged(); } } var dirPath = Path.Combine(Model.Settings.Path.ASSETS_PATH, newLoadPath); bool dirExists = Directory.Exists(dirPath); GUILayout.Space(10f); using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(newLoadPath) || !dirExists)) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f))) { // trailing is "/" not good for LoadMainAssetAtPath if (dirPath[dirPath.Length - 1] == '/') { dirPath = dirPath.Substring(0, dirPath.Length - 1); } var obj = AssetDatabase.LoadMainAssetAtPath(dirPath); EditorGUIUtility.PingObject(obj); } } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_importDirectoryPath == null) { return; } var currentEditingGroup = editor.CurrentEditingGroup; EditorGUILayout.HelpBox("Import Unity Packages: Import Unity Packages.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_importDirectoryPath.ContainsValueOf(currentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Export Settings", node, true)){ if (enabled) { m_importDirectoryPath[currentEditingGroup] = m_importDirectoryPath.DefaultValue; m_isInteractive[currentEditingGroup] = m_isInteractive.DefaultValue; m_isRecursive[currentEditingGroup] = m_isRecursive.DefaultValue; } else { m_importDirectoryPath.Remove(currentEditingGroup); m_isInteractive.Remove(currentEditingGroup); m_isRecursive.Remove(currentEditingGroup); } onValueChanged(); } }); using (disabledScope) { EditorGUILayout.LabelField("Import Path:"); string newImportDir = null; newImportDir = editor.DrawFolderSelector("", "Select Import Folder", m_importDirectoryPath[currentEditingGroup], GetImportDirectoryPath(m_importDirectoryPath[currentEditingGroup]), (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newImportDir != m_importDirectoryPath[currentEditingGroup]) { using (new RecordUndoScope("Change Import Path", node, true)){ m_importDirectoryPath[currentEditingGroup] = newImportDir; onValueChanged(); } } int isInteractive = m_isInteractive[currentEditingGroup]; var newIsInteractive = EditorGUILayout.ToggleLeft("Interactive", isInteractive == 1) ? 1:0; if (newIsInteractive != isInteractive) { using (new RecordUndoScope("Change Interactive", node, true)){ m_isInteractive[currentEditingGroup] = newIsInteractive; onValueChanged(); } } int isRecursive = m_isRecursive[currentEditingGroup]; var newIsRecursive = EditorGUILayout.ToggleLeft("Import packages in subfolders", isRecursive == 1) ? 1:0; if (newIsRecursive != isRecursive) { using (new RecordUndoScope("Change Recursive", node, true)){ m_isRecursive[currentEditingGroup] = newIsRecursive; onValueChanged(); } } var importDirectoryPath = GetImportDirectoryPath(newImportDir); if (!Directory.Exists(importDirectoryPath)) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(importDirectoryPath + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(importDirectoryPath); } onValueChanged(); } EditorGUILayout.Space(); var parentDir = Path.GetDirectoryName(importDirectoryPath); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); var dirs = Directory.GetDirectories(parentDir); foreach (var s in dirs) { EditorGUILayout.LabelField(s); } } } else { GUILayout.Space(10f); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button(GUIHelper.RevealInFinderLabel)) { EditorUtility.RevealInFinder(importDirectoryPath); } } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { var currentEditingGroup = editor.CurrentEditingGroup; EditorGUILayout.HelpBox("Export As UnityPackage: Export given files as UnityPackage.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_packageName.ContainsValueOf(currentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Export Settings", node, true)){ if (enabled) { m_packageName[currentEditingGroup] = m_packageName.DefaultValue; m_exportPackageOptions[currentEditingGroup] = m_exportPackageOptions.DefaultValue; } else { m_packageName.Remove(currentEditingGroup); m_exportPackageOptions.Remove(currentEditingGroup); } onValueChanged(); } }); using (disabledScope) { var name = m_packageName[currentEditingGroup]; var newName = EditorGUILayout.TextField("Package Name", name); if (newName != name) { using (new RecordUndoScope("Change Package Name", node, true)){ m_packageName[currentEditingGroup] = newName; onValueChanged(); } } EditorGUILayout.HelpBox("You can use {Platform} and {GroupName} for package name variable.", MessageType.Info); GUILayout.Space(8f); var exportOptions = m_exportPackageOptions[currentEditingGroup]; foreach (var option in Model.Settings.ExportPackageOptions) { // contains keyword == enabled. if not, disabled. var isEnabled = (exportOptions & (int)option.option) != 0; var result = EditorGUILayout.ToggleLeft(option.description, isEnabled); if (result != isEnabled) { using (new RecordUndoScope("Change Bundle Options", node, true)){ exportOptions = (result) ? ((int)option.option | exportOptions) : (((~(int)option.option)) & exportOptions); m_exportPackageOptions[editor.CurrentEditingGroup] = exportOptions; onValueChanged(); } } } } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_srcPath == null) { return; } var currentEditingGroup = editor.CurrentEditingGroup; EditorGUILayout.HelpBox("Mirror Directory: Mirror source directory to destination. This node does not use assets passed by.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(10f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_srcPath.ContainsValueOf(currentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Mirror Directory Settings", node, true)){ if (enabled) { m_srcPath[currentEditingGroup] = m_srcPath.DefaultValue; m_dstPath[currentEditingGroup] = m_dstPath.DefaultValue; m_mirrorOption[currentEditingGroup] = m_mirrorOption.DefaultValue; } else { m_srcPath.Remove(currentEditingGroup); m_dstPath.Remove(currentEditingGroup); m_mirrorOption[currentEditingGroup] = m_mirrorOption.DefaultValue; } onValueChanged(); } }); using (disabledScope) { MirrorOption opt = (MirrorOption)m_mirrorOption[currentEditingGroup]; var newOption = (MirrorOption)EditorGUILayout.EnumPopup("Mirror Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Mirror Option", node, true)){ m_mirrorOption[currentEditingGroup] = (int)newOption; onValueChanged(); } } EditorGUILayout.LabelField("Source Directory Path:"); string newSrcPath = null; string newDstPath = null; newSrcPath = editor.DrawFolderSelector("", "Select Source Folder", m_srcPath[currentEditingGroup], Directory.GetParent(Application.dataPath).ToString(), (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newSrcPath != m_srcPath[currentEditingGroup]) { using (new RecordUndoScope("Change Source Folder", node, true)){ m_srcPath[currentEditingGroup] = newSrcPath; onValueChanged(); } } DrawDirectorySuggestion(GetNormalizedPath(m_srcPath[currentEditingGroup]), currentEditingGroup, onValueChanged); GUILayout.Space(10f); EditorGUILayout.LabelField("Destination Directory Path:"); newDstPath = editor.DrawFolderSelector("", "Select Destination Folder", m_dstPath[currentEditingGroup], Directory.GetParent(Application.dataPath).ToString(), (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newDstPath != m_dstPath[currentEditingGroup]) { using (new RecordUndoScope("Change Destination Folder", node, true)){ m_dstPath[currentEditingGroup] = newDstPath; onValueChanged(); } } DrawDirectorySuggestion(GetNormalizedPath(m_dstPath[currentEditingGroup]), currentEditingGroup, onValueChanged); } } }