private static GetAddRemoveButtonRect ( |
||
r | ||
리턴 |
private void DrawShaderEntry(int shaderIndex) { SerializedProperty arrayElementAtIndex = this.m_Shaders.GetArrayElementAtIndex(shaderIndex); Shader shader = (Shader)arrayElementAtIndex.FindPropertyRelative("first").objectReferenceValue; SerializedProperty serializedProperty = arrayElementAtIndex.FindPropertyRelative("second.variants"); using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.boldLabel); Rect addRemoveButtonRect = ShaderVariantCollectionInspector.GetAddRemoveButtonRect(rect); rect.xMax = addRemoveButtonRect.x; GUI.Label(rect, shader.name, EditorStyles.boldLabel); if (GUI.Button(addRemoveButtonRect, ShaderVariantCollectionInspector.Styles.iconRemove, ShaderVariantCollectionInspector.Styles.invisibleButton)) { this.m_Shaders.DeleteArrayElementAtIndex(shaderIndex); return; } } for (int i = 0; i < serializedProperty.arraySize; i++) { SerializedProperty arrayElementAtIndex2 = serializedProperty.GetArrayElementAtIndex(i); string text = arrayElementAtIndex2.FindPropertyRelative("keywords").stringValue; if (string.IsNullOrEmpty(text)) { text = "<no keywords>"; } PassType intValue = (PassType)arrayElementAtIndex2.FindPropertyRelative("passType").intValue; Rect rect2 = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); Rect addRemoveButtonRect2 = ShaderVariantCollectionInspector.GetAddRemoveButtonRect(rect2); rect2.xMax = addRemoveButtonRect2.x; GUI.Label(rect2, intValue + " " + text, EditorStyles.miniLabel); if (GUI.Button(addRemoveButtonRect2, ShaderVariantCollectionInspector.Styles.iconRemove, ShaderVariantCollectionInspector.Styles.invisibleButton)) { serializedProperty.DeleteArrayElementAtIndex(i); } } Rect rect3 = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); Rect addRemoveButtonRect3 = ShaderVariantCollectionInspector.GetAddRemoveButtonRect(rect3); if (GUI.Button(addRemoveButtonRect3, ShaderVariantCollectionInspector.Styles.iconAdd, ShaderVariantCollectionInspector.Styles.invisibleButton)) { this.DisplayAddVariantsWindow(shader, base.target as ShaderVariantCollection); } }
private void DrawShaderEntry(int shaderIndex) { SerializedProperty arrayElementAtIndex1 = this.m_Shaders.GetArrayElementAtIndex(shaderIndex); Shader objectReferenceValue = (Shader)arrayElementAtIndex1.FindPropertyRelative("first").objectReferenceValue; SerializedProperty propertyRelative = arrayElementAtIndex1.FindPropertyRelative("second.variants"); using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.boldLabel); Rect removeButtonRect = ShaderVariantCollectionInspector.GetAddRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, objectReferenceValue.name, EditorStyles.boldLabel); if (GUI.Button(removeButtonRect, ShaderVariantCollectionInspector.Styles.iconRemove, ShaderVariantCollectionInspector.Styles.invisibleButton)) { this.m_Shaders.DeleteArrayElementAtIndex(shaderIndex); return; } } for (int index = 0; index < propertyRelative.arraySize; ++index) { SerializedProperty arrayElementAtIndex2 = propertyRelative.GetArrayElementAtIndex(index); string str = arrayElementAtIndex2.FindPropertyRelative("keywords").stringValue; if (string.IsNullOrEmpty(str)) { str = "<no keywords>"; } PassType intValue = (PassType)arrayElementAtIndex2.FindPropertyRelative("passType").intValue; Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); Rect removeButtonRect = ShaderVariantCollectionInspector.GetAddRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, ((int)intValue).ToString() + " " + str, EditorStyles.miniLabel); if (GUI.Button(removeButtonRect, ShaderVariantCollectionInspector.Styles.iconRemove, ShaderVariantCollectionInspector.Styles.invisibleButton)) { propertyRelative.DeleteArrayElementAtIndex(index); } } if (!GUI.Button(ShaderVariantCollectionInspector.GetAddRemoveButtonRect(GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel)), ShaderVariantCollectionInspector.Styles.iconAdd, ShaderVariantCollectionInspector.Styles.invisibleButton)) { return; } this.DisplayAddVariantsWindow(objectReferenceValue, this.target as ShaderVariantCollection); }