@@ -75,42 +75,27 @@ void OnRemoveElement(ReorderableList reorderableList)
75
75
void OnDrawElement ( Rect rect , int index , bool isActive , bool isFocused )
76
76
{
77
77
rect . y += 2 ;
78
- Rect indexRect = new Rect ( rect . x , rect . y , 14 , EditorGUIUtility . singleLineHeight ) ;
78
+ var indexRect = new Rect ( rect . x , rect . y , 14 , EditorGUIUtility . singleLineHeight ) ;
79
79
EditorGUI . LabelField ( indexRect , index . ToString ( ) ) ;
80
- Rect objRect = new Rect ( rect . x + indexRect . width , rect . y , rect . width - 134 , EditorGUIUtility . singleLineHeight ) ;
81
80
82
- EditorGUI . BeginChangeCheck ( ) ;
83
- EditorGUI . ObjectField ( objRect , m_RendererDataProp . GetArrayElementAtIndex ( index ) , GUIContent . none ) ;
84
- if ( EditorGUI . EndChangeCheck ( ) )
85
- EditorUtility . SetDirty ( target ) ;
86
-
87
- Rect defaultButton = new Rect ( rect . width - 75 , rect . y , 86 , EditorGUIUtility . singleLineHeight ) ;
88
- var defaultRenderer = m_DefaultRendererProp . intValue ;
89
- GUI . enabled = index != defaultRenderer ;
90
- if ( GUI . Button ( defaultButton , ! GUI . enabled ? Styles . rendererDefaultText : Styles . rendererSetDefaultText ) )
81
+ using ( var changeCheck = new EditorGUI . ChangeCheckScope ( ) )
91
82
{
92
- m_DefaultRendererProp . intValue = index ;
93
- EditorUtility . SetDirty ( target ) ;
83
+ var objectFieldWidth = rect . width - 110 ;
84
+ var objRect = new Rect ( rect . x + indexRect . width , rect . y , objectFieldWidth , EditorGUIUtility . singleLineHeight ) ;
85
+ EditorGUI . ObjectField ( objRect , m_RendererDataProp . GetArrayElementAtIndex ( index ) , GUIContent . none ) ;
86
+ if ( changeCheck . changed )
87
+ EditorUtility . SetDirty ( target ) ;
94
88
}
95
- GUI . enabled = true ;
96
-
97
- Rect selectRect = new Rect ( rect . x + rect . width - 24 , rect . y , 24 , EditorGUIUtility . singleLineHeight ) ;
98
89
99
- UniversalRenderPipelineAsset asset = target as UniversalRenderPipelineAsset ;
100
-
101
- if ( asset . ValidateRendererData ( index ) )
102
- {
103
- if ( GUI . Button ( selectRect , Styles . rendererSettingsText ) )
104
- {
105
- Selection . SetActiveObjectWithContext ( m_RendererDataProp . GetArrayElementAtIndex ( index ) . objectReferenceValue ,
106
- null ) ;
107
- }
108
- }
109
- else // Missing ScriptableRendererData
90
+ var isDefaultRenderer = index == m_DefaultRendererProp . intValue ;
91
+ using ( new EditorGUI . DisabledScope ( isDefaultRenderer ) )
110
92
{
111
- if ( GUI . Button ( selectRect , index == defaultRenderer ? Styles . rendererDefaultMissingText : Styles . rendererMissingText ) )
93
+ var defaultButtonX = rect . width - 51 ;
94
+ var defaultButtonRect = new Rect ( defaultButtonX , rect . y , 86 , EditorGUIUtility . singleLineHeight ) ;
95
+ if ( GUI . Button ( defaultButtonRect , ! GUI . enabled ? Styles . rendererDefaultText : Styles . rendererSetDefaultText ) )
112
96
{
113
- EditorGUIUtility . ShowObjectPicker < ScriptableRendererData > ( null , false , null , index ) ;
97
+ m_DefaultRendererProp . intValue = index ;
98
+ EditorUtility . SetDirty ( target ) ;
114
99
}
115
100
}
116
101
0 commit comments