// <summary> // Construct a new hierarchy visitor providing the delegate you want called during each visit. // </summary> internal HierarchyVisitor(HierarchyHandler handler) { if (handler == null) { throw new ArgumentNullException("handler"); } _handler = handler; }
private void removeFK_Click(object sender, RoutedEventArgs e) { int idx = listViewHierarchies.SelectedItem.ToString().LastIndexOf('|'); string tableToDel = listViewHierarchies.SelectedItem.ToString().Substring(idx + 1); string constrName = listViewHierarchies.SelectedItem.ToString().Substring(0, idx); HierarchyHandler.dropConstraint(tableToDel, constrName); populateHierarchies(); }
private void AddHierarchyHandler(IVsHierarchy pHierarchy) { var handler = new HierarchyHandler(pHierarchy); uint handlerCode; pHierarchy.AdviseHierarchyEvents(handler, out handlerCode); handler.SetCode(handlerCode); _hierarchyHandlers.Add(handler); }
public void populateHierarchies() { DataSet hierarchies = HierarchyHandler.getConstraints(Application.Current.Resources["ProjectPrefix"].ToString(), "FACT"); List <string> listItems = new List <string>(); foreach (DataRow row in hierarchies.Tables["result"].Rows) { listItems.Add(row[1].ToString() + "|" + row[3].ToString()); } listViewHierarchies.ItemsSource = listItems; }
/* private void button_Click(object sender, RoutedEventArgs e) * { * HierarchyHandler.addForeignKey(listViewTables1.SelectedItem.ToString(), listViewColumns1.SelectedItem.ToString(), listViewTables2.SelectedItem.ToString(), listViewColumns2.SelectedItem.ToString()); * } */ private void createFK_Click(object sender, RoutedEventArgs e) { // HierarchyHandler.addForeignKey(listViewTables1.SelectedItem.ToString(), listViewColumns1.SelectedItem.ToString(), listViewTables2.SelectedItem.ToString(), listViewColumns2.SelectedItem.ToString()); Result wynik = new Result(); wynik = HierarchyHandler.addForeignKey2(listViewTables1.SelectedItem.ToString(), listViewTables2.SelectedItem.ToString(), listViewColumns2.SelectedItem.ToString()); if (wynik.errormsg != "OK") { textBlockError.Text = wynik.errormsg; } else { Switcher.Switch(new ProjectPage(3)); } }
public static void HandlePreferencesGUI() { if (!preferencesLoaded) { Load(); } EditorGUI.BeginChangeCheck(); showHierarchyIcons = EditorGUILayout.Toggle(new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."), showHierarchyIcons); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, showHierarchyIcons); #if NEWPLAYMODECALLBACKS HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode); #else HierarchyHandler.IconsOnPlaymodeStateChanged(); #endif } BoolPrefsField(ref autoReloadSceneSkeletons, AUTO_RELOAD_SCENESKELETONS_KEY, new GUIContent("Auto-reload scene components", "Reloads Skeleton components in the scene whenever their SkeletonDataAsset is modified. This makes it so changes in the SkeletonDataAsset inspector are immediately reflected. This may be slow when your scenes have large numbers of SkeletonRenderers or SkeletonGraphic.")); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Auto-Import Settings", EditorStyles.boldLabel); { SpineEditorUtilities.FloatPrefsField(ref defaultMix, DEFAULT_MIX_KEY, new GUIContent("Default Mix", "The Default Mix Duration for newly imported SkeletonDataAssets."), min: 0); SpineEditorUtilities.FloatPrefsField(ref defaultScale, DEFAULT_SCALE_KEY, new GUIContent("Default SkeletonData Scale", "The Default skeleton import scale for newly imported SkeletonDataAssets."), min: 0.0000001f); EditorGUI.BeginChangeCheck(); var shader = (EditorGUILayout.ObjectField("Default Shader", Shader.Find(defaultShader), typeof(Shader), false) as Shader); defaultShader = shader != null ? shader.name : SpinePreferences.DEFAULT_DEFAULT_SHADER; if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader); } SpineEditorUtilities.BoolPrefsField(ref setTextureImporterSettings, SET_TEXTUREIMPORTER_SETTINGS_KEY, new GUIContent("Apply Atlas Texture Settings", "Apply the recommended settings for Texture Importers.")); SpineEditorUtilities.Texture2DPrefsField(ref textureSettingsReference, TEXTURE_SETTINGS_REFERENCE_KEY, new GUIContent("Atlas Texture Reference Settings", "Apply the selected reference texture import settings at newly imported atlas textures. When exporting atlas textures from Spine with \"Premultiply alpha\" enabled (the default), you can leave it at \"PMAPresetTemplate\". If you have disabled \"Premultiply alpha\", set it to \"StraightAlphaPresetTemplate\". You can also create your own reference texture asset and assign it here.")); if (string.IsNullOrEmpty(textureSettingsReference)) { var pmaTextureSettingsReferenceGUIDS = AssetDatabase.FindAssets("PMAPresetTemplate"); if (pmaTextureSettingsReferenceGUIDS.Length > 0) { textureSettingsReference = AssetDatabase.GUIDToAssetPath(pmaTextureSettingsReferenceGUIDS[0]); EditorPrefs.SetString(TEXTURE_SETTINGS_REFERENCE_KEY, textureSettingsReference); } } SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, new GUIContent("Additive Material", "Additive blend mode Material template.")); if (string.IsNullOrEmpty(blendModeMaterialAdditive)) { var blendModeMaterialAdditiveGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL); if (blendModeMaterialAdditiveGUIDS.Length > 0) { blendModeMaterialAdditive = AssetDatabase.GUIDToAssetPath(blendModeMaterialAdditiveGUIDS[0]); } } SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, new GUIContent("Multiply Material", "Multiply blend mode Material template.")); if (string.IsNullOrEmpty(blendModeMaterialMultiply)) { var blendModeMaterialMultiplyGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL); if (blendModeMaterialMultiplyGUIDS.Length > 0) { blendModeMaterialMultiply = AssetDatabase.GUIDToAssetPath(blendModeMaterialMultiplyGUIDS[0]); } } SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialScreen, BLEND_MODE_MATERIAL_SCREEN_KEY, new GUIContent("Screen Material", "Screen blend mode Material template.")); if (string.IsNullOrEmpty(blendModeMaterialScreen)) { var blendModeMaterialScreenGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_SCREEN_MATERIAL); if (blendModeMaterialScreenGUIDS.Length > 0) { blendModeMaterialScreen = AssetDatabase.GUIDToAssetPath(blendModeMaterialScreenGUIDS[0]); } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Warnings", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref atlasTxtImportWarning, ATLASTXT_WARNING_KEY, new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found.")); SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts.")); SpineEditorUtilities.BoolPrefsField(ref componentMaterialWarning, COMPONENTMATERIAL_WARNING_KEY, new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel); { EditorGUI.BeginChangeCheck(); defaultZSpacing = EditorGUILayout.Slider("Default Slot Z-Spacing", defaultZSpacing, -0.1f, 0f); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetFloat(DEFAULT_ZSPACING_KEY, defaultZSpacing); } SpineEditorUtilities.BoolPrefsField(ref defaultInstantiateLoop, DEFAULT_INSTANTIATE_LOOP_KEY, new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Mecanim Bake Settings", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref mecanimEventIncludeFolderName, MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, new GUIContent("Include Folder Name in Event", "When enabled, Mecanim events will call methods named 'FolderNameEventName', when disabled it will call 'EventName'.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel); { EditorGUI.BeginChangeCheck(); handleScale = EditorGUILayout.Slider("Editor Bone Scale", handleScale, 0.01f, 2f); handleScale = Mathf.Max(0.01f, handleScale); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, handleScale); SceneView.RepaintAll(); } } #if SPINE_TK2D_DEFINE bool isTK2DDefineSet = true; #else bool isTK2DDefineSet = false; #endif bool isTK2DAllowed = SpineTK2DEditorUtility.IsTK2DAllowed; if (SpineTK2DEditorUtility.IsTK2DInstalled() || isTK2DDefineSet) { GUILayout.Space(20); EditorGUILayout.LabelField("3rd Party Settings", EditorStyles.boldLabel); using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Define TK2D"); if (isTK2DAllowed && GUILayout.Button("Enable", GUILayout.Width(64))) { SpineTK2DEditorUtility.EnableTK2D(); } if (GUILayout.Button("Disable", GUILayout.Width(64))) { SpineTK2DEditorUtility.DisableTK2D(); } } #if !SPINE_TK2D_DEFINE if (!isTK2DAllowed) { EditorGUILayout.LabelField("To allow TK2D support, please modify line 67 in", EditorStyles.boldLabel); EditorGUILayout.LabelField("Spine/Editor/spine-unity/Editor/Util./BuildSettings.cs", EditorStyles.boldLabel); } #endif } GUILayout.Space(20); EditorGUILayout.LabelField("Timeline Extension", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref timelineUseBlendDuration, TIMELINE_USE_BLEND_DURATION_KEY, new GUIContent("Use Blend Duration", "When enabled, MixDuration will be synced with timeline clip transition duration 'Ease In Duration'.")); } }
static void Initialize() { if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } #if !NEW_PREFERENCES_SETTINGS_PROVIDER Preferences.Load(); #else SpinePreferences.Load(); #endif string[] assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities"); string assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); editorPath = Path.GetDirectoryName(assetPath).Replace("\\", "/"); assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer"); if (assets.Length > 0) { assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); editorGUIPath = Path.GetDirectoryName(assetPath).Replace("\\", "/"); } else { editorGUIPath = editorPath.Replace("/Utility", "/GUI"); } Icons.Initialize(); // Drag and Drop #if UNITY_2019_1_OR_NEWER SceneView.duringSceneGui -= DragAndDropInstantiation.SceneViewDragAndDrop; SceneView.duringSceneGui += DragAndDropInstantiation.SceneViewDragAndDrop; #else SceneView.onSceneGUIDelegate -= DragAndDropInstantiation.SceneViewDragAndDrop; SceneView.onSceneGUIDelegate += DragAndDropInstantiation.SceneViewDragAndDrop; #endif EditorApplication.hierarchyWindowItemOnGUI -= HierarchyHandler.HandleDragAndDrop; EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop; // Hierarchy Icons #if NEWPLAYMODECALLBACKS EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged; EditorApplication.playModeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged; HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode); #else EditorApplication.playmodeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged; EditorApplication.playmodeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged; HierarchyHandler.IconsOnPlaymodeStateChanged(); #endif // Data Refresh Edit Mode. // This prevents deserialized SkeletonData from persisting from play mode to edit mode. #if NEWPLAYMODECALLBACKS EditorApplication.playModeStateChanged -= DataReloadHandler.OnPlaymodeStateChanged; EditorApplication.playModeStateChanged += DataReloadHandler.OnPlaymodeStateChanged; DataReloadHandler.OnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode); #else EditorApplication.playmodeStateChanged -= DataReloadHandler.OnPlaymodeStateChanged; EditorApplication.playmodeStateChanged += DataReloadHandler.OnPlaymodeStateChanged; DataReloadHandler.OnPlaymodeStateChanged(); #endif if (SpineEditorUtilities.Preferences.textureImporterWarning) { IssueWarningsForUnrecommendedTextureSettings(); } initialized = true; }
private void VisitHierarchyItems(IVsHierarchy hierarchy, uint id, Url baseUrl, HierarchyHandler handler, bool isRootItem) { // Note: some root items (e.g. for a C# .NET Fwk project as of VS2019) say they are not searchable but they are if (!isRootItem && !IsSearchable(hierarchy, id)) { return; } object pvar; var hr = hierarchy.GetProperty(id, (int)__VSHPROPID.VSHPROPID_SaveName, out pvar); var path = pvar as string; if (VSErrorHandler.Succeeded(hr) && path != null) { // Dev10 Bug 653879: Retrieving project item absolute URL is expensive so retrieve when we actually need it. handler(hierarchy, id, new VsProjectItemPath(baseUrl, path)); } hr = hierarchy.GetProperty(id, (int)__VSHPROPID.VSHPROPID_FirstChild, out pvar); if (VSErrorHandler.Succeeded(hr)) { var childId = GetItemId(pvar); while (childId != VSConstants.VSITEMID_NIL) { VisitHierarchyItems(hierarchy, childId, baseUrl, handler, false); hr = hierarchy.GetProperty(childId, (int)__VSHPROPID.VSHPROPID_NextSibling, out pvar); if (VSErrorHandler.Succeeded(hr)) { childId = GetItemId(pvar); } else { break; } } } }
public static void HandlePreferencesGUI() { if (!preferencesLoaded) { Load(); } EditorGUI.BeginChangeCheck(); showHierarchyIcons = EditorGUILayout.Toggle(new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."), showHierarchyIcons); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, showHierarchyIcons); #if NEWPLAYMODECALLBACKS HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode); #else HierarchyHandler.IconsOnPlaymodeStateChanged(); #endif } BoolPrefsField(ref autoReloadSceneSkeletons, AUTO_RELOAD_SCENESKELETONS_KEY, new GUIContent("Auto-reload scene components", "Reloads Skeleton components in the scene whenever their SkeletonDataAsset is modified. This makes it so changes in the SkeletonDataAsset inspector are immediately reflected. This may be slow when your scenes have large numbers of SkeletonRenderers or SkeletonGraphic.")); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Auto-Import Settings", EditorStyles.boldLabel); { SpineEditorUtilities.FloatPrefsField(ref defaultMix, DEFAULT_MIX_KEY, new GUIContent("Default Mix", "The Default Mix Duration for newly imported SkeletonDataAssets."), min: 0); SpineEditorUtilities.FloatPrefsField(ref defaultScale, DEFAULT_SCALE_KEY, new GUIContent("Default SkeletonData Scale", "The Default skeleton import scale for newly imported SkeletonDataAssets."), min: 0.0000001f); EditorGUI.BeginChangeCheck(); var shader = (EditorGUILayout.ObjectField("Default Shader", Shader.Find(defaultShader), typeof(Shader), false) as Shader); defaultShader = shader != null ? shader.name : SpinePreferences.DEFAULT_DEFAULT_SHADER; if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader); } SpineEditorUtilities.BoolPrefsField(ref setTextureImporterSettings, SET_TEXTUREIMPORTER_SETTINGS_KEY, new GUIContent("Apply Atlas Texture Settings", "Apply the recommended settings for Texture Importers.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Warnings", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref atlasTxtImportWarning, ATLASTXT_WARNING_KEY, new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found.")); SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel); { EditorGUI.BeginChangeCheck(); defaultZSpacing = EditorGUILayout.Slider("Default Slot Z-Spacing", defaultZSpacing, -0.1f, 0f); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetFloat(DEFAULT_ZSPACING_KEY, defaultZSpacing); } SpineEditorUtilities.BoolPrefsField(ref defaultInstantiateLoop, DEFAULT_INSTANTIATE_LOOP_KEY, new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Mecanim Bake Settings", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref mecanimEventIncludeFolderName, MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, new GUIContent("Include Folder Name in Event", "When enabled, Mecanim events will call methods named 'FolderNameEventName', when disabled it will call 'EventName'.")); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel); { EditorGUI.BeginChangeCheck(); handleScale = EditorGUILayout.Slider("Editor Bone Scale", handleScale, 0.01f, 2f); handleScale = Mathf.Max(0.01f, handleScale); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, handleScale); SceneView.RepaintAll(); } } GUILayout.Space(20); EditorGUILayout.LabelField("3rd Party Settings", EditorStyles.boldLabel); using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Define TK2D"); if (GUILayout.Button("Enable", GUILayout.Width(64))) { SpineTK2DEditorUtility.EnableTK2D(); } if (GUILayout.Button("Disable", GUILayout.Width(64))) { SpineTK2DEditorUtility.DisableTK2D(); } } GUILayout.Space(20); EditorGUILayout.LabelField("Timeline Extension", EditorStyles.boldLabel); { SpineEditorUtilities.BoolPrefsField(ref timelineUseBlendDuration, TIMELINE_USE_BLEND_DURATION_KEY, new GUIContent("Use Blend Duration", "When enabled, MixDuration will be synced with timeline clip transition duration 'Ease In Duration'.")); } }
public Hierarchy() { _record = new HierarchyRecord(); _pattern = new HierarchyRecord(); _handler = new HierarchyHandler(); }
private void VisitHierarchyItems(IVsHierarchy hierarchy, uint id, Url baseUrl, HierarchyHandler handler) { if (!IsSearchable(hierarchy, id)) { return; } object pvar; var hr = hierarchy.GetProperty(id, (int)__VSHPROPID.VSHPROPID_SaveName, out pvar); var path = pvar as string; if (VSErrorHandler.Succeeded(hr) && path != null) { // Dev10 Bug 653879: Retrieving project item absolute URL is expensive so retrieve when we actually need it. handler(hierarchy, id, new VsProjectItemPath(baseUrl, path)); } hr = hierarchy.GetProperty(id, (int)__VSHPROPID.VSHPROPID_FirstChild, out pvar); if (VSErrorHandler.Succeeded(hr)) { var childId = GetItemId(pvar); while (childId != VSConstants.VSITEMID_NIL) { VisitHierarchyItems(hierarchy, childId, baseUrl, handler); hr = hierarchy.GetProperty(childId, (int)__VSHPROPID.VSHPROPID_NextSibling, out pvar); if (VSErrorHandler.Succeeded(hr)) { childId = GetItemId(pvar); } else { break; } } } }