public override void OnInspectorGUI() { drawer.Draw(); EditorGUILayout.BeginHorizontal(); EditorGUIUtil.ObjectField <Transform>(ref searchRoot, true); GUI.enabled = searchRoot != null; if (!Application.isPlaying && GUILayout.Button("Search")) { HashSet <GameObject> set = new HashSet <GameObject>(handler.buttons); foreach (UIButton b in searchRoot.GetComponentsInChildren <UIButton>()) { if (!set.Contains(b.gameObject)) { ArrayUtil.Add(ref handler.buttons, b.gameObject); } } InvalidateArray(); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; }
public override void OnInspectorGUI() { if (toggleInspector.Draw()) { InvalidateArray(); } EditorGUILayout.BeginHorizontal(); EditorGUIUtil.ObjectField <Transform>(ref searchRoot, true); GUI.enabled = searchRoot != null; if (GUILayout.Button("Search")) { HashSet <GameObject> set = new HashSet <GameObject>(handler.toggleObj); foreach (UIToggle t in searchRoot.GetComponentsInChildren <UIToggle>()) { if (!set.Contains(t.gameObject)) { ArrayUtil.Add(ref handler.toggleObj, t.gameObject); } } InvalidateArray(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { buttonInspector.Draw(); }
public void Test() { _inputData = new Vector2[(int)InputDataLength]; for (int i = 0; i < _inputData.Length; i++) { _inputData[i] = new Vector2(i); } var arrayDrawer = new ArrayDrawer(); var plotSize = arrayDrawer.MeasurePlotSize(PlotHeight, _inputData.Length); _testOutput = new Bitmap(plotSize.Width * 2, plotSize.Height * 4); var g = Graphics.FromImage(_testOutput); g.SmoothingMode = SmoothingMode.HighQuality; g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; g.FillRectangle(Brushes.White, 0, 0, _testOutput.Width, _testOutput.Height); var app = Singleton.Get <OpenClApplication>(); var computeBuffer1 = new ComputeBuffer <Vector2>(app.ComputeContext, ComputeMemoryFlags.None, _inputData); var computeBuffer2 = new ComputeBuffer <Vector2>(app.ComputeContext, ComputeMemoryFlags.None, _inputData.Length); int n = _inputData.Length; int m = Fourier.OddDenominator(n); int l = n / m; int t = Fourier.PowerOfTwo(l); app.Queue.WriteToBuffer(_inputData, computeBuffer1, true, null); app.ExecuteKernel("splitFftA", _inputData.Length, 1, computeBuffer1, computeBuffer2, n, m, l, t); var splittedArray = new Vector2[_inputData.Length]; app.Queue.ReadFromBuffer(computeBuffer2, ref splittedArray, true, null); var expectedSplitStepResult = TestCpuFourier.Split(_inputData.ToComplex()).ToVector2(); var expectedSplitAndFftResult = TestCpuFourier.SplitAndFft(_inputData.ToComplex()).ToVector2(); //app.Queue.WriteToBuffer(expectedSplitStepResult, computeBuffer2, true, null); Fft(computeBuffer2, l, m); var fftResultArray = new Vector2[_inputData.Length]; app.Queue.ReadFromBuffer(computeBuffer2, ref fftResultArray, true, null); app.ExecuteKernel("mergeFftStep1A", _inputData.Length, 1, computeBuffer2, computeBuffer1, n, m, l); var mergedArray = new Vector2[_inputData.Length]; app.Queue.ReadFromBuffer(computeBuffer1, ref mergedArray, true, null); var expectedBpfStep1Result = TestCpuFourier.BPF_Step1(_inputData.ToComplex()); var expectedBpfStep1ResultVec2 = expectedBpfStep1Result.ToVector2(); var expectedBpfStep2ResultVec2 = TestCpuFourier.BPF_Step2(expectedBpfStep1Result).ToVector2(); int y = arrayDrawer.Draw(_testOutput, splittedArray, "Split Result", PlotHeight, g: g).Y; arrayDrawer.Draw(_testOutput, expectedSplitStepResult, "Expected Split Result", PlotHeight, 0, _testOutput.Width / 2, g); arrayDrawer.Draw(_testOutput, expectedSplitAndFftResult, "Expected FFT Result", PlotHeight, y, _testOutput.Width / 2, g); y = arrayDrawer.Draw(_testOutput, fftResultArray, "FFT Result", PlotHeight, y, g: g).Y; arrayDrawer.Draw(_testOutput, expectedBpfStep1ResultVec2, "Expected Merge FFT Step 1", PlotHeight, y, _testOutput.Width / 2, g); y = arrayDrawer.Draw(_testOutput, mergedArray, "Merge FFT Step 1 (Merge Arrays)", PlotHeight, top: y, g: g).Y; // step2 test //app.Queue.WriteToBuffer(expectedBpfStep1ResultVec2, computeBuffer1, true, null); app.ExecuteKernel("mergeFftStep2A", n, 1, computeBuffer1, computeBuffer2, n, m, l); var step2Result = new Vector2[_inputData.Length]; app.Queue.ReadFromBuffer(computeBuffer2, ref step2Result, true, null); arrayDrawer.Draw(_testOutput, expectedBpfStep2ResultVec2, "Expected Merge FFT Step2 Result", PlotHeight, y, _testOutput.Width / 2, g); y = arrayDrawer.Draw(_testOutput, step2Result, "Actual Merge FFT Step2 Result", PlotHeight, top: y, g: g).Y; Output = ImageHandler.FromBitmap(_testOutput); Output.UploadToComputingDevice(); Update(); OnUpdated(); }
public bool OnInspectorGUI() { bool changed = tabArrInspector.OnInspectorGUI(); changed |= tabPrefabArrInspector.OnInspectorGUI(); if (tabPrefabArrInspector.Length > 0) { changed |= tabButtonArrInspector.Draw(); } if (GUILayout.Button("Reallocate")) { tabHandler.tabs = new UITab[0]; foreach (UITab t in tabHandler.GetComponentsInChildren <UITab>(true)) { tabHandler.tabs = tabHandler.tabs.Add(t); OnTabChanged(t, 0); } CompatibilityEditor.SetDirty(tabHandler); // for (int i=0; i<tabHandler.tabs.Length; ++i) { // UITab t = tabHandler.tabs[i]; // OnTabRemoved(t, 0); // OnTabChanged(t, 0); // } } EditorGUILayout.BeginHorizontal(); EditorGUIUtil.ObjectField <UIButton>(ref button, true); EditorGUILayout.EndHorizontal(); foreach (UITab t in tabHandler.tabs) { if (t != null) { if (t.tabButton == null) { EditorGUILayout.HelpBox(t.name + " Tab Button is null", MessageType.Error); } if (t.uiRoot == null) { EditorGUILayout.HelpBox(t.name + " Tab Root is null", MessageType.Error); } } } HashSet <GameObject> activeTabs = new HashSet <GameObject>(); foreach (UITab t in tabHandler.tabs) { if (t != null && t.IsVisible()) { activeTabs.Add(t.uiRoot); } } if (activeTabs.Count > 1) { EditorGUILayout.HelpBox("Multiple Tabs are activated", MessageType.Error); if (GUILayout.Button("Fix")) { tabHandler.Init(tabHandler); foreach (UITab t in tabHandler.tabs) { if (t != null) { CompatibilityEditor.SetDirty(t.uiRoot); } } } } return(changed); }