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); } } }
private void ApplyDefaultSettings(SkyProfile profile) { // Lightning art. if (profile.lightningArtSet == null) { profile.lightningArtSet = GetDefaultArtStyleWithName <LightningArtSet>("DefaultLightningArtSet"); } // Splash art. if (profile.rainSplashArtSet == null) { profile.rainSplashArtSet = GetDefaultArtStyleWithName <RainSplashArtSet>("DefaultRainSplashArtSet"); } // Rain near texture. TextureKeyframeGroup group = profile.GetGroup <TextureKeyframeGroup>(ProfilePropertyKeys.RainNearTextureKey); if (group.keyframes.Count == 1 && group.keyframes[0].texture == null) { group.keyframes[0].texture = SkyEditorUtility.LoadEditorResourceTexture("RainDownfall-1"); if (group.keyframes[0].texture == null) { Debug.LogWarning("Failed to locate default near rain texture"); } } // Rain far texture. group = profile.GetGroup <TextureKeyframeGroup>(ProfilePropertyKeys.RainFarTextureKey); if (group.keyframes.Count == 1 && group.keyframes[0].texture == null) { group.keyframes[0].texture = SkyEditorUtility.LoadEditorResourceTexture("RainDownfall-3"); if (group.keyframes[0].texture == null) { Debug.LogWarning("Failed to locate default far rain texture"); } } }
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); }