//GUI Window Stuff - NO COMMENTS private void OnGUI() { GUIStyle help = new GUIStyle(GUI.skin.label); help.fontSize = 12; help.fontStyle = FontStyle.Bold; EditorGUILayout.LabelField("How To Use", help); EditorGUILayout.HelpBox("1. Set the number of elements that exist on each data line. \n" + "2. Set the delimiter between each element. (Leave blank for white space) \n" + "3. Set the index of the XYZ elements on the data line. (First element = 1) \n" + "4. Select the range of the color data: \n" + " None: No Color Data \n" + " Normalized: 0.0 - 1.0 \n" + " RGB : 0 - 255 \n" + "5. Set the index of the RGB elements on the data line. (First element = 1) \n" + "6. Click \"Load Point Cloud File\"", MessageType.None); formatStandard = (FormatStandard)EditorGUILayout.EnumPopup(new GUIContent("Format", ""), formatStandard); if (formatStandard == FormatStandard.CUSTOM) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); elementsPerLine = EditorGUILayout.IntField(new GUIContent("Elements Per Data Line", "The Number of Elements in the data line"), elementsPerLine); dataDelimiter = EditorGUILayout.TextField(new GUIContent("Data Line Delimiter", "Leave blank for white space between elements"), dataDelimiter); xPOS = EditorGUILayout.IntField(new GUIContent("X Index", "Index of X in data line"), xPOS); yPOS = EditorGUILayout.IntField(new GUIContent("Y Index", "Index of Y in data line"), yPOS); zPOS = EditorGUILayout.IntField(new GUIContent("Z Index", "Index of Z in data line"), zPOS); colorRange = (ColorRange)EditorGUILayout.EnumPopup(new GUIContent("Color Range", "None(No Color), Normalized (0.0-1.0f), RGB(0-255)"), colorRange); if (colorRange == ColorRange.NORMALIZED || colorRange == ColorRange.RGB) { rPOS = EditorGUILayout.IntField(new GUIContent("Red Index", "Index of Red color in data line"), rPOS); gPOS = EditorGUILayout.IntField(new GUIContent("Green Index", "Index of Green color in data line"), gPOS); bPOS = EditorGUILayout.IntField(new GUIContent("Blue Index", "Index of Blue color in data line"), bPOS); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); } else if (formatStandard == FormatStandard.PTS) { elementsPerLine = 7; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.RGB; rPOS = 5; gPOS = 6; bPOS = 7; } else if (formatStandard == FormatStandard.XYZ) { elementsPerLine = 3; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.NONE; } else if (formatStandard == FormatStandard.XYZRGB) { elementsPerLine = 7; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.NORMALIZED; rPOS = 4; gPOS = 5; bPOS = 6; } EditorGUILayout.Space(); GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.fontSize = 12; buttonStyle.fontStyle = FontStyle.Bold; if (GUILayout.Button("Load Point Cloud File", buttonStyle, GUILayout.Height(50))) { LoadCloud(); } }
//GUI Window Stuff - NO COMMENTS private void OnGUI() { //创建一个提示信息 label GUIStyle help = new GUIStyle(GUI.skin.label); help.fontSize = 12; help.fontStyle = FontStyle.Bold; EditorGUILayout.LabelField("如何使用", help); EditorGUILayout.HelpBox("1. 设置每个数据行中存在的元素数量. \n" + "2. 在每个元素之间设置分隔符. (默认的为空格分割) \n" + "3. 在数据行上设置XYZ元素的索引。. (第一个索引=1) \n" + "4. 选择颜色数据的范围: \n" + " None: 没有颜色数据 \n" + " Normalized: 0.0 - 1.0 \n" + " RGB : 0 - 255 \n" + "5. 在数据线上设置RGB元素的索引. \n" + "6. Click \"Load Point Cloud File\"", MessageType.None); formatStandard = (FormatStandard)EditorGUILayout.EnumPopup(new GUIContent("Format", ""), formatStandard); //创建一个枚举选项 if (formatStandard == FormatStandard.CUSTOM) //默认自定义数据索引 { EditorGUILayout.BeginHorizontal(); //绘制一个水平布局 EditorGUILayout.BeginVertical(); //绘制一个垂直布局 elementsPerLine = 6; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.RGB; //颜色区间 rPOS = 4; gPOS = 5; bPOS = 6; elementsPerLine = EditorGUILayout.IntField(new GUIContent("Elements Per Data Line", "数据行中元素的数量\nThe Number of Elements in the data line"), elementsPerLine); dataDelimiter = EditorGUILayout.TextField(new GUIContent("Data Line Delimiter", "在元素之间留空空白"), dataDelimiter); xPOS = EditorGUILayout.IntField(new GUIContent("X Index", "X值的索引"), xPOS); yPOS = EditorGUILayout.IntField(new GUIContent("Y Index", "Y值的索引"), yPOS); zPOS = EditorGUILayout.IntField(new GUIContent("Z Index", "Z值的索引"), zPOS); colorRange = (ColorRange)EditorGUILayout.EnumPopup(new GUIContent("Color Range", "None(No Color), Normalized (0.0-1.0f), RGB(0-255)"), colorRange); if (colorRange == ColorRange.NORMALIZED || colorRange == ColorRange.RGB) { rPOS = EditorGUILayout.IntField(new GUIContent("Red Index", "R值的索引"), rPOS); gPOS = EditorGUILayout.IntField(new GUIContent("Green Index", "G值的索引"), gPOS); bPOS = EditorGUILayout.IntField(new GUIContent("Blue Index", "B值的索引"), bPOS); } EditorGUILayout.EndVertical(); //关闭绘制 EditorGUILayout.EndHorizontal(); //关闭绘制 } else if (formatStandard == FormatStandard.PTS) { //PTS 的数据 如果每行7个数 第四个数没用 前三个数是坐标 后三个是颜色 elementsPerLine = 7; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.RGB; rPOS = 5; gPOS = 6; bPOS = 7; } else if (formatStandard == FormatStandard.XYZ) //只加载点的坐标 { elementsPerLine = 3; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.NONE; //无颜色 } else if (formatStandard == FormatStandard.XYZRGB) { elementsPerLine = 6; dataDelimiter = ""; xPOS = 1; yPOS = 2; zPOS = 3; colorRange = ColorRange.NORMALIZED; rPOS = 4; gPOS = 5; bPOS = 6; } //空格隔出一点空间 EditorGUILayout.Space(); //创建一个按钮 GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.fontSize = 16; buttonStyle.fontStyle = FontStyle.Bold; if (GUILayout.Button("Load Point Cloud File", buttonStyle, GUILayout.Height(50))) { LoadCloud();//调用加载的方法 } }