internal static void Launch(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { SketchUpImportDlg windowDontShow = EditorWindow.GetWindowDontShow <SketchUpImportDlg>(); windowDontShow.Init(nodes, suModelEditor); windowDontShow.ShowAuxWindow(); }
void OnGUI() { Rect rect = new Rect(0, 0, position.width, position.height); int keyboardControl = GUIUtility.GetControlID(FocusType.Keyboard, rect); // Header Rect headerRect = new Rect(0, 0, position.width, kHeaderHeight); GUI.Label(headerRect, string.Empty, Styles.styles.headerStyle); GUI.Label(new Rect(10, 2, position.width, kHeaderHeight), Styles.styles.nodesLabel); Rect bottomRect = new Rect(rect.x, rect.yMax - kBottomHeight, rect.width, kBottomHeight); // Footer GUILayout.BeginArea(bottomRect); GUILayout.BeginHorizontal(Styles.styles.footerStyle); GUILayout.FlexibleSpace(); bool closeWindow = false; if (isModal) { if (GUILayout.Button(Styles.styles.okButton)) { closeWindow = true; } } else { if (GUILayout.Button(Styles.styles.cancelButton)) { closeWindow = true; } else if (GUILayout.Button(Styles.styles.okButton)) { closeWindow = true; if (m_ModelEditor.IsAlive) { SketchUpImporterModelEditor modelEditor = m_ModelEditor.Target as SketchUpImporterModelEditor; modelEditor.SetSelectedNodes(m_DataSource.FetchEnableNodes()); } } } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.EndArea(); // TreeView rect.y = kHeaderHeight; rect.height -= headerRect.height + bottomRect.height; m_TreeView.OnEvent(); m_TreeView.OnGUI(rect, keyboardControl); HandleKeyboardEvents(); if (closeWindow) { Close(); } }
private void OnGUI() { Rect rect = new Rect(0f, 0f, base.position.width, base.position.height); int controlID = GUIUtility.GetControlID(FocusType.Keyboard, rect); Rect position = new Rect(0f, 0f, base.position.width, 25f); GUI.Label(position, string.Empty, SketchUpImportDlg.Styles.styles.headerStyle); GUI.Label(new Rect(10f, 2f, base.position.width, 25f), SketchUpImportDlg.Styles.styles.nodesLabel); Rect screenRect = new Rect(rect.x, rect.yMax - 30f, rect.width, 30f); GUILayout.BeginArea(screenRect); GUILayout.Box(string.Empty, SketchUpImportDlg.Styles.styles.boxBackground, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(2f); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool flag = false; if (this.isModal) { if (GUILayout.Button(SketchUpImportDlg.Styles.styles.okButton, new GUILayoutOption[0])) { flag = true; } } else if (GUILayout.Button(SketchUpImportDlg.Styles.styles.cancelButton, new GUILayoutOption[0])) { flag = true; } else if (GUILayout.Button(SketchUpImportDlg.Styles.styles.okButton, new GUILayoutOption[0])) { flag = true; if (this.m_ModelEditor.IsAlive) { SketchUpImporterModelEditor sketchUpImporterModelEditor = this.m_ModelEditor.Target as SketchUpImporterModelEditor; sketchUpImporterModelEditor.SetSelectedNodes(this.m_DataSource.FetchEnableNodes()); } } GUILayout.Space(10f); GUILayout.EndHorizontal(); GUILayout.EndArea(); rect.y = 18f; rect.height -= position.height + screenRect.height - 7f; this.m_TreeView.OnEvent(); this.m_TreeView.OnGUI(rect, controlID); this.HandleKeyboardEvents(); if (flag) { base.Close(); } }
public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { this.titleContent = SketchUpImportDlg.Styles.styles.windowTitle; this.minSize = this.m_WindowMinSize; this.position = new Rect(this.position.x, this.position.y, this.minSize.x, this.minSize.y); this.m_TreeViewState = new TreeViewState(); this.m_TreeView = new TreeView((EditorWindow)this, this.m_TreeViewState); this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView); this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes); this.m_TreeView.Init(this.position, (ITreeViewDataSource)this.m_DataSource, (ITreeViewGUI)this.m_ImportGUI, (ITreeViewDragging)null); this.m_TreeView.selectionChangedCallback += new System.Action <int[]>(this.OnTreeSelectionChanged); this.m_ModelEditor = new WeakReference((object)suModelEditor); this.isModal = false; }
public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { base.titleContent = Styles.styles.windowTitle; base.minSize = this.m_WindowMinSize; base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); this.m_TreeViewState = new TreeViewState(); this.m_TreeView = new TreeView(this, this.m_TreeViewState); this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView); this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes); this.m_TreeView.Init(base.position, this.m_DataSource, this.m_ImportGUI, null); this.m_TreeView.selectionChangedCallback = (Action <int[]>)Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action <int[]>(this.OnTreeSelectionChanged)); this.m_ModelEditor = new WeakReference(suModelEditor); this.isModal = false; }
public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { base.titleContent = Styles.styles.windowTitle; base.minSize = this.m_WindowMinSize; base.position = new Rect(base.position.x, base.position.y, base.minSize.x, base.minSize.y); this.m_TreeViewState = new TreeViewState(); this.m_TreeView = new TreeView(this, this.m_TreeViewState); this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView); this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes); this.m_TreeView.Init(base.position, this.m_DataSource, this.m_ImportGUI, null); this.m_TreeView.selectionChangedCallback = (Action<int[]>) Delegate.Combine(this.m_TreeView.selectionChangedCallback, new Action<int[]>(this.OnTreeSelectionChanged)); this.m_ModelEditor = new WeakReference(suModelEditor); this.isModal = false; }
public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { this.titleContent = SketchUpImportDlg.Styles.styles.windowTitle; this.minSize = this.m_WindowMinSize; this.position = new Rect(this.position.x, this.position.y, this.minSize.x, this.minSize.y); this.m_TreeViewState = new TreeViewState(); this.m_TreeView = new TreeView((EditorWindow) this, this.m_TreeViewState); this.m_ImportGUI = new SketchUpTreeViewGUI(this.m_TreeView); this.m_DataSource = new SketchUpDataSource(this.m_TreeView, nodes); this.m_TreeView.Init(this.position, (ITreeViewDataSource) this.m_DataSource, (ITreeViewGUI) this.m_ImportGUI, (ITreeViewDragging) null); this.m_TreeView.selectionChangedCallback += new System.Action<int[]>(this.OnTreeSelectionChanged); this.m_ModelEditor = new WeakReference((object) suModelEditor); this.isModal = false; }
private static float ConvertGlobalScaleToUnit(SketchUpImporterModelEditor.EFileUnit measurement, float globalScale) { switch (measurement) { case SketchUpImporterModelEditor.EFileUnit.Meters: return globalScale / 0.0254f; case SketchUpImporterModelEditor.EFileUnit.Centimeters: return globalScale / 0.000254f; case SketchUpImporterModelEditor.EFileUnit.Millimeters: return globalScale / 2.54E-05f; case SketchUpImporterModelEditor.EFileUnit.Feet: return globalScale / 0.00774192f; case SketchUpImporterModelEditor.EFileUnit.Inches: return globalScale; default: Debug.LogError((object) "File Unit value is invalid"); return 1f; } }
private static float CovertUnitToGlobalScale(SketchUpImporterModelEditor.EFileUnit measurement, float unit) { switch (measurement) { case SketchUpImporterModelEditor.EFileUnit.Meters: return 0.0254f * unit; case SketchUpImporterModelEditor.EFileUnit.Centimeters: return 0.000254f * unit; case SketchUpImporterModelEditor.EFileUnit.Millimeters: return unit * 2.54E-05f; case SketchUpImporterModelEditor.EFileUnit.Feet: return unit * 0.00774192f; case SketchUpImporterModelEditor.EFileUnit.Inches: return unit; default: Debug.LogError((object) "File Unit value is invalid"); return 1f; } }
public void Init(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { titleContent = Styles.styles.windowTitle; minSize = m_WindowMinSize; position = new Rect(position.x, position.y, minSize.x, minSize.y); m_TreeViewState = new TreeViewState(); m_TreeView = new TreeViewController(this, m_TreeViewState); m_ImportGUI = new SketchUpTreeViewGUI(m_TreeView); m_DataSource = new SketchUpDataSource(m_TreeView, nodes); m_TreeView.Init(position, m_DataSource, m_ImportGUI, null); m_TreeView.selectionChangedCallback += OnTreeSelectionChanged; m_ModelEditor = new WeakReference(suModelEditor); isModal = false; }
public override void OnInspectorGUI() { GUILayout.Label(SketchUpImporterModelEditor.Styles.sketchUpLabel, EditorStyles.boldLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_GenerateBackFace, SketchUpImporterModelEditor.Styles.generateBackFaceLabel, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_MergeCoplanarFaces, SketchUpImporterModelEditor.Styles.mergeCoplanarFaces, new GUILayoutOption[0]); EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label(SketchUpImporterModelEditor.Styles.fileUnitLabel, new GUILayoutOption[] { GUILayout.MinWidth(EditorGUIUtility.labelWidth) }); GUILayout.Label("1", new GUILayoutOption[0]); EditorGUILayout.Popup(this.m_FileUnit, SketchUpImporterModelEditor.Styles.measurementOptions, GUIContent.Temp(string.Empty), new GUILayoutOption[] { GUILayout.MaxWidth(100f) }); this.lengthToUnit = SketchUpImporterModelEditor.ConvertGlobalScaleToUnit((SketchUpImporterModelEditor.EFileUnit) this.m_FileUnit.intValue, this.m_GlobalScale.floatValue); GUILayout.Label("=", new GUILayoutOption[0]); this.lengthToUnit = EditorGUILayout.FloatField(this.lengthToUnit, new GUILayoutOption[0]); this.m_GlobalScale.floatValue = SketchUpImporterModelEditor.CovertUnitToGlobalScale((SketchUpImporterModelEditor.EFileUnit) this.m_FileUnit.intValue, this.lengthToUnit); EditorGUILayout.EndHorizontal(); using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.FloatField(SketchUpImporterModelEditor.Styles.longitudeLabel, this.m_Longitude.floatValue, new GUILayoutOption[0]); EditorGUILayout.FloatField(SketchUpImporterModelEditor.Styles.latitudeLabel, this.m_Latitude.floatValue, new GUILayoutOption[0]); EditorGUILayout.FloatField(SketchUpImporterModelEditor.Styles.northCorrectionLabel, this.m_NorthCorrection.floatValue, new GUILayoutOption[0]); } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (GUILayout.Button(SketchUpImporterModelEditor.Styles.selectNodeButton, new GUILayoutOption[0])) { SketchUpNodeInfo[] nodes = this.m_Target.GetNodes(); SketchUpImportDlg.Launch(nodes, this); GUIUtility.ExitGUI(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); base.OnInspectorGUI(); }
internal static void Launch(SketchUpNodeInfo[] nodes, SketchUpImporterModelEditor suModelEditor) { SketchUpImportDlg windowDontShow = EditorWindow.GetWindowDontShow<SketchUpImportDlg>(); windowDontShow.Init(nodes, suModelEditor); windowDontShow.ShowAuxWindow(); }