@@ -35,6 +35,8 @@ public static class BezierUtils
35
35
private const string FOLLOWING_CONTROL_POINT_LABEL = " -->" ;
36
36
37
37
private const string SHOW_CONTROL_POINTS_PREF = "BezierSolution_ShowControlPoints" ;
38
+ private const string SHOW_CONTROL_POINT_DIRECTIONS_PREF = "BezierSolution_ShowControlPointDirs" ;
39
+ private const string SHOW_END_POINTS_LABELS_PREF = "BezierSolution_ShowEndPointLabels" ;
38
40
private const string SHOW_NORMALS_PREF = "BezierSolution_ShowNormals" ;
39
41
40
42
private static bool ? m_showControlPoints = null ;
@@ -54,6 +56,40 @@ public static bool ShowControlPoints
54
56
}
55
57
}
56
58
59
+ private static bool ? m_showControlPointDirections = null ;
60
+ public static bool ShowControlPointDirections
61
+ {
62
+ get
63
+ {
64
+ if ( m_showControlPointDirections == null )
65
+ m_showControlPointDirections = EditorPrefs . GetBool ( SHOW_CONTROL_POINT_DIRECTIONS_PREF , true ) ;
66
+
67
+ return m_showControlPointDirections . Value ;
68
+ }
69
+ set
70
+ {
71
+ m_showControlPointDirections = value ;
72
+ EditorPrefs . SetBool ( SHOW_CONTROL_POINT_DIRECTIONS_PREF , value ) ;
73
+ }
74
+ }
75
+
76
+ private static bool ? m_showEndPointLabels = null ;
77
+ public static bool ShowEndPointLabels
78
+ {
79
+ get
80
+ {
81
+ if ( m_showEndPointLabels == null )
82
+ m_showEndPointLabels = EditorPrefs . GetBool ( SHOW_END_POINTS_LABELS_PREF , true ) ;
83
+
84
+ return m_showEndPointLabels . Value ;
85
+ }
86
+ set
87
+ {
88
+ m_showEndPointLabels = value ;
89
+ EditorPrefs . SetBool ( SHOW_END_POINTS_LABELS_PREF , value ) ;
90
+ }
91
+ }
92
+
57
93
private static bool ? m_showNormals = null ;
58
94
public static bool ShowNormals
59
95
{
@@ -274,6 +310,27 @@ public static void DrawSplineInspectorGUI( BezierSpline[] splines )
274
310
SceneView . RepaintAll ( ) ;
275
311
}
276
312
313
+ if ( showControlPoints )
314
+ {
315
+ EditorGUI . indentLevel ++ ;
316
+ EditorGUI . BeginChangeCheck ( ) ;
317
+ bool showControlPointDirections = EditorGUILayout . Toggle ( "Show Directions" , ShowControlPointDirections ) ;
318
+ if ( EditorGUI . EndChangeCheck ( ) )
319
+ {
320
+ ShowControlPointDirections = showControlPointDirections ;
321
+ SceneView . RepaintAll ( ) ;
322
+ }
323
+ EditorGUI . indentLevel -- ;
324
+ }
325
+
326
+ EditorGUI . BeginChangeCheck ( ) ;
327
+ bool showEndPointLabels = EditorGUILayout . Toggle ( "Show Point Indices" , ShowEndPointLabels ) ;
328
+ if ( EditorGUI . EndChangeCheck ( ) )
329
+ {
330
+ ShowEndPointLabels = showEndPointLabels ;
331
+ SceneView . RepaintAll ( ) ;
332
+ }
333
+
277
334
EditorGUI . BeginChangeCheck ( ) ;
278
335
bool showNormals = EditorGUILayout . Toggle ( "Show Normals" , ShowNormals ) ;
279
336
if ( EditorGUI . EndChangeCheck ( ) )
@@ -437,9 +494,10 @@ public static void DrawBezierPoint( BezierPoint point, int pointIndex, bool isSe
437
494
Handles . color = c ;
438
495
}
439
496
440
- Handles . Label ( point . position , "Point" + pointIndex ) ;
497
+ if ( ShowEndPointLabels )
498
+ Handles . Label ( point . position , "Point" + pointIndex ) ;
441
499
442
- if ( ShowControlPoints )
500
+ if ( ShowControlPoints && ShowControlPointDirections )
443
501
{
444
502
Handles . Label ( point . precedingControlPointPosition , PRECEDING_CONTROL_POINT_LABEL ) ;
445
503
Handles . Label ( point . followingControlPointPosition , FOLLOWING_CONTROL_POINT_LABEL ) ;
0 commit comments