private void ShowPathPointUi(PE_Path _path) { if (_path.PathPoints.Count == 0) { return; } EditoolsLayout.Foldout(ref _path.ShowPoint, $"Show/Hide points {_path.Id}", true); if (_path.ShowPoint) { for (int i = 0; i < _path.PathPoints.Count; i++) { EditoolsLayout.Horizontal(true); _path.PathPoints[i] = EditoolsField.Vector3Field($"Path Point [{i + 1}]", _path.PathPoints[i]); EditoolsButton.ButtonWithConfirm("-", Color.magenta, _path.RemovePoint, i, $"Suppress Point {i + 1} at {_path.PathPoints[i]} ? ", "Are your sure ?"); EditoolsLayout.Horizontal(false); } } EditoolsLayout.Space(1); if (_path.PathPoints.Count > 0) { EditoolsButton.ButtonWithConfirm("Remove All Points", Color.red, _path.ClearPoints, $"Suppress All Points ? ", "Are your sure ?"); } }
void ShowAllPathUI() { for (int i = 0; i < eTarget.Paths.Count; i++) { PE_Path path = eTarget.Paths[i]; if (!path.IsEditable) { continue; } EditoolsHandle.SetColor(path.PathColor); for (int j = 0; j < path.PathPoints.Count; j++) { path.PathPoints[j] = EditoolsHandle.PositionHandle(path.PathPoints[j], Quaternion.identity); EditoolsHandle.Label(path.PathPoints[j] + Vector3.up * 5, $"Point {j + 1}"); EditoolsHandle.SetColor(Color.white); EditoolsHandle.DrawDottedLine(path.PathPoints[j] + Vector3.up * 5, path.PathPoints[j], .5f); EditoolsHandle.SetColor(path.PathColor); EditoolsHandle.DrawSolidDisc(path.PathPoints[j], Vector3.up, 0.1f); if (j < path.PathPoints.Count - 1) { EditoolsHandle.DrawLine(path.PathPoints[j], path.PathPoints[j + 1]); } } } }
void ShowAllPathsUI() { for (int i = 0; i < eTarget.NbPaths; i++) { PE_Path _p = eTarget.AllPaths[i]; if (!_p.IsEdit) { continue; } Handles.color = _p.pathColor; for (int j = 0; j < _p.NbPoints; j++) { _p.PathPoints[j] = Handles.DoPositionHandle(_p.PathPoints[j], Quaternion.identity); Handles.Label(_p.PathPoints[j] + Vector3.up * 2, $"Point {j+1}"); Handles.DrawDottedLine(_p.PathPoints[j] + Vector3.up * 2, _p.PathPoints[j], 0.5f); Handles.DrawSolidDisc(_p.PathPoints[j], Vector3.up, 1); if (j < _p.NbPoints - 1) { Handles.DrawLine(_p.PathPoints[j], _p.PathPoints[j + 1]); } } Handles.color = Color.white; } }
void SetActiveEdition(PE_Path _p) { for (int i = 0; i < eTarget.NbPaths; i++) { eTarget.AllPaths[i].IsEdit = false; } _p.IsEdit = true; }
void SetActiveEdition(PE_Path _path) { for (int i = 0; i < eTarget.Paths.Count; i++) { eTarget.Paths[i].IsEditable = false; } _path.IsEditable = true; }
void ShowPathPointsUi(PE_Path _path) { _path.ShowPoints = EditorGUILayout.Foldout(_path.ShowPoints, $"Show/Hide points"); for (int i = 0; i < _path.NbPoints; i++) { if (_path.ShowPoints) { ToggleHorizontal(true); Vector3 _v = _path.PathPoints[i]; _path.PathPoints[i] = EditorGUILayout.Vector3Field($"Path point {i + 1} :", _v); GUI.color = Color.red; if (GUILayout.Button("X")) { bool _confirm = EditorUtility.DisplayDialog($"{i + 1} at {_v} ?", "Are you sure ?", "Yes", "No"); if (_confirm) { _path.RemovePoint(i); } } GUI.color = Color.white; ToggleHorizontal(false); } } _path.pathColor = EditorGUILayout.ColorField(_path.pathColor); AddSpace(); GUI.color = _path.IsEdit ? Color.green : Color.grey; if (GUILayout.Button("Edit path")) { SetActiveEdition(_path); } GUI.color = Color.white; AddSpace(); GUI.color = Color.red; if (GUILayout.Button("Remove all points")) { bool _confirm = EditorUtility.DisplayDialog("Suppress all points ?", "Are you sure ?", "Yes", "No"); if (_confirm) { _path.Clear(); } } GUI.color = Color.white; }
void AllPathUi() { if (!eTarget) { return; } for (int i = 0; i < eTarget.NbPaths; i++) { PE_Path _p = eTarget.AllPaths[i]; _p.ShowPaths = EditorGUILayout.Foldout(_p.ShowPaths, $"Show/Hide path"); if (_p.ShowPaths) { ToggleHorizontal(true); EditorGUILayout.LabelField($"{i + 1} : { _p.Id} -> {_p.PathPoints.Count} waypoints"); GUI.color = Color.green; if (GUILayout.Button("+")) { _p.AddPoint(); } GUI.color = Color.white; GUI.color = Color.red; if (GUILayout.Button("Remove path")) { bool _confirm = EditorUtility.DisplayDialog($"Suppress path {i + 1} ?", "Are you sure ?", "Yes", "No"); if (_confirm) { eTarget.RemovePath(i); } } GUI.color = Color.white; ToggleHorizontal(false); _p.Id = EditorGUILayout.TextField(_p.Id); ShowPathPointsUi(_p); } } }
private void AllPathUI() { if (!eTarget) { return; } for (int i = 0; i < eTarget.Paths.Count; i++) { PE_Path _p = eTarget.Paths[i]; EditoolsLayout.Foldout(ref _p.ShowPath, $"Show/Hide {_p.Id}", true); if (!_p.ShowPath) { continue; } EditoolsBox.HelpBox($"[{i}] {_p.Id} -> {_p.PathPoints.Count} total points"); EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("Remove This Path", Color.red, eTarget.RemovePath, i, $"Suppress Path {i + 1} ? ", "Are your sure ?"); EditoolsButton.Button("+", Color.green, _p.AddPoint); EditoolsButton.Button("Editable", _p.IsEditable ? Color.green : Color.grey, SetActiveEdition, _p); EditoolsLayout.Horizontal(false); // New Line EditoolsLayout.Horizontal(true); EditoolsField.TextField(_p.Id, ref _p.Id); EditoolsField.ColorField(_p.PathColor, ref _p.PathColor); EditoolsLayout.Horizontal(false); ShowPathPointUi(_p); EditoolsLayout.Space(5); } }