// These are the buttons next to the current time of day at the top. private void RenderGlobalTimelineButtons(Rect rect, TimeOfDayController tc) { GUILayout.BeginArea(rect); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); float buttonSize = 20.0f; Color originalContentColor = GUI.contentColor; GUI.contentColor = GUI.skin.label.normal.textColor; GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.padding = new RectOffset(2, 2, 2, 2); Texture2D addTexture = SkyEditorUtility.LoadEditorResourceTexture("AddIcon"); bool didClickAddButton = GUILayout.Button( new GUIContent(addTexture, "Add a sky property to the timeline."), buttonStyle, GUILayout.Width(buttonSize), GUILayout.Height(buttonSize)); GUILayout.Space(LEFT_INSET); if (didClickAddButton) { SkyGUITimelineMenu.ShowAddTimelinePropertyMenu(m_ActiveSkyProfile); } GUI.contentColor = originalContentColor; GUILayout.EndHorizontal(); GUILayout.EndArea(); }
private void RenderEmptyTimelineMessage() { bool didClickAddProperty = RenderCenteredTimelineMessage( "Animate sky properties by adding them to the timeline.", "Add to Timeline"); if (didClickAddProperty) { SkyGUITimelineMenu.ShowAddTimelinePropertyMenu(m_ActiveSkyProfile); } return; }
private bool RenderTimelineList() { bool didChangeProfile = false; RenderSectionTitle("Timeline Animated Properties", "TimelineSectionIcon"); EditorGUILayout.Space(); List <ProfileGroupDefinition> onTimeline = m_Profile.GetGroupDefinitionsManagedByTimeline(); List <ProfileGroupDefinition> offTimeline = m_Profile.GetGroupDefinitionsNotManagedByTimeline(); int deleteIndex = -1; bool didSwapRows = false; int swapIndex1 = -1; int swapIndex2 = -1; if (onTimeline.Count == 0) { // Show definition message if no items added yet. EditorGUILayout.HelpBox("You can animate properties by adding them to the timeline.", MessageType.None); } else { EditorGUI.BeginChangeCheck(); List <string> timelineTitles = GetTitlesForGroups(onTimeline); StringTableListGUI.RenderTableList( timelineTitles, out deleteIndex, out didSwapRows, out swapIndex1, out swapIndex2); // Check for table modification events (remove, reorder, etc.) if (EditorGUI.EndChangeCheck()) { didChangeProfile = true; if (deleteIndex != -1) { string deleteGroupKey = onTimeline[deleteIndex].propertyKey; IKeyframeGroup group = m_Profile.GetGroup(deleteGroupKey); if (SkyEditorUtility.IsGroupSelectedOnTimeline(group.id)) { TimelineSelection.Clear(); // If we deleted a sphere point group make sure to hide the debug dots. if (group is SpherePointKeyframeGroup && m_Profile.skyboxMaterial != null) { m_Profile.skyboxMaterial.DisableKeyword(ShaderKeywords.RenderDebugPoints); } } m_Profile.timelineManagedKeys.Remove(deleteGroupKey); m_Profile.TrimGroupToSingleKeyframe(deleteGroupKey); } else if (didSwapRows) { string tmp = m_Profile.timelineManagedKeys[swapIndex2]; m_Profile.timelineManagedKeys[swapIndex2] = m_Profile.timelineManagedKeys[swapIndex1]; m_Profile.timelineManagedKeys[swapIndex1] = tmp; } } } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Open Timeline"))) { SkyTimelineWindow.ShowWindow(); } if (GUILayout.Button(new GUIContent("Add to Timeline"))) { SkyGUITimelineMenu.ShowAddTimelinePropertyMenu(m_Profile, offTimeline); } EditorGUILayout.EndHorizontal(); return(didChangeProfile); }