internal static void BeginProperty(MaterialSerializedProperty prop, Object[] targets) { // Get the current Y coordinate before drawing the property // We define a new empty rect in order to grab the current height even if there was nothing drawn in the block // (GetLastRect cause issue if it was first element of block) MaterialProperty.BeginProperty(Rect.zero, null, prop, targets, GUILayoutUtility.GetRect(0, 0).yMax); }
static bool IsRegistered(MaterialProperty prop, MaterialSerializedProperty serializedProp) { // [PerRendererData] material properties are read-only as they are meant to be set in code on a per-renderer basis. // Don't show override UI for them if (prop != null && (prop.flags & PropFlags.PerRendererData) != 0) { return(true); } for (int i = 0; i < s_PropertyStack.Count; i++) { if (s_PropertyStack[i].property == prop && s_PropertyStack[i].serializedProperty == serializedProp) { return(true); } } return(false); }
internal static void BeginProperty(Rect totalRect, MaterialProperty prop, MaterialSerializedProperty serializedProp, Object[] targets, float startY = -1) { if (targets == null || IsRegistered(prop, serializedProp)) { s_PropertyStack.Add(new PropertyData() { targets = null }); return; } PropertyData data = new PropertyData() { property = prop, serializedProperty = serializedProp, targets = targets, startY = startY, position = totalRect, wasBoldDefaultFont = EditorGUIUtility.GetBoldDefaultFont() }; data.Init(); s_PropertyStack.Add(data); if (data.isOverriden) { EditorGUIUtility.SetBoldDefaultFont(true); } if (data.isLockedByAncestor) { EditorGUI.BeginDisabledGroup(true); } EditorGUI.showMixedValue = data.hasMixedValue; }