// Render color property. public bool RenderColorGroupProperty(ProfileGroupDefinition def) { EditorGUILayout.BeginHorizontal(); ColorKeyframeGroup group = m_Profile.GetGroup <ColorKeyframeGroup>(def.propertyKey); EditorGUILayout.PrefixLabel(new GUIContent(group.name, def.tooltip)); bool valueChanged = false; if (m_Profile.IsManagedByTimeline(def.propertyKey)) { RenderManagedOnTimlineMessage(); } else { ColorKeyframe frame = group.GetKeyframe(0); EditorGUI.BeginChangeCheck(); Color selectedColor = EditorGUILayout.ColorField(frame.color); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_Profile, "Changed color keyframe value"); frame.color = selectedColor; valueChanged = true; } } EditorGUILayout.EndHorizontal(); return(valueChanged); }
public static void ShowAddTimelinePropertyMenu(SkyProfile profile, List <ProfileGroupDefinition> groups) { s_Profile = profile; GenericMenu menu = new GenericMenu(); foreach (ProfileGroupSection sectionInfo in s_Profile.GetProfileDefinitions()) { foreach (ProfileGroupDefinition groupInfo in sectionInfo.groups) { if (s_Profile.IsManagedByTimeline(groupInfo.propertyKey) == false && s_Profile.CanGroupBeOnTimeline(groupInfo)) { string itemName = sectionInfo.sectionTitle + "/" + groupInfo.groupName; menu.AddItem(new GUIContent(itemName), false, DidSelectAddTimelineProperty, groupInfo.propertyKey); } } } menu.ShowAsContext(); }
private float CalculateWindowContentHeight(SkyProfile profile) { if (profile == null) { return(0); } int colorRowCount = 0; int numericRowCount = 0; int spherePointRowCount = 0; foreach (ProfileGroupDefinition groupInfo in m_TimelineDefinitions) { if (profile.IsManagedByTimeline(groupInfo.propertyKey) == false) { continue; } if (groupInfo.type == ProfileGroupDefinition.GroupType.Number) { numericRowCount += 1; } else if (groupInfo.type == ProfileGroupDefinition.GroupType.Color) { colorRowCount += 1; } else if (groupInfo.type == ProfileGroupDefinition.GroupType.SpherePoint) { spherePointRowCount += 1; } } float colorsHeight = colorRowCount * (COLOR_ROW_HEIGHT + ROW_PADDING); float numbersHeight = numericRowCount * (NUMBER_ROW_HEIGHT + ROW_PADDING); float spherePointHeight = spherePointRowCount * (SPHERE_POINT_ROW_HEIGHT + ROW_PADDING); float contentHeight = colorsHeight + numbersHeight + spherePointHeight + TIME_HEADER_HEIGHT; return(contentHeight); }
private void RenderAllRows(Rect rect, SkyProfile profile) { Rect rowRect = new Rect(rect.x, rect.y + ROW_PADDING / 2.0f, rect.width, COLOR_ROW_HEIGHT); // Render all rows that are managed by the timeline. foreach (ProfileGroupDefinition groupInfo in m_TimelineDefinitions) { if (profile.IsManagedByTimeline(groupInfo.propertyKey) == false) { continue; } if (groupInfo.type == ProfileGroupDefinition.GroupType.Number) { RenderNumericRowAndAdvance( ref rowRect, profile, profile.GetGroup <NumberKeyframeGroup>(groupInfo.propertyKey), groupInfo); } else if (groupInfo.type == ProfileGroupDefinition.GroupType.Color) { RenderGradientRowAndAdvance( ref rowRect, profile, profile.GetGroup <ColorKeyframeGroup>(groupInfo.propertyKey), groupInfo); } else if (groupInfo.type == ProfileGroupDefinition.GroupType.SpherePoint) { RenderSpherePointRowAndAdvance( ref rowRect, profile, profile.GetGroup <SpherePointKeyframeGroup>(groupInfo.propertyKey), groupInfo); } } }