private void UpdateTimeControllerInScene() { TimeOfDayController timeController = FindObjectOfType <TimeOfDayController>() as TimeOfDayController; if (!timeController) { return; } timeController.UpdateSkyForCurrentTime(); }
private void BuilderCompletion(SkyBuilder builder, bool successful) { m_Builder.completionCallback -= BuilderCompletion; m_Builder = null; if (m_Profile) { EditorUtility.SetDirty(m_Profile); } TimeOfDayController tc = GameObject.FindObjectOfType <TimeOfDayController>(); if (tc != null) { tc.UpdateSkyForCurrentTime(); } }
public override void OnInspectorGUI() { serializedObject.Update(); m_Profile = (SkyProfile)target; // For new profiles we'll automatically build them. if (forceRebuildProfileId != -1 && forceRebuildProfileId == m_Profile.GetInstanceID()) { RebuildSkySystem(); forceRebuildProfileId = -1; } if (RenderSkyboxMaterial() == false) { serializedObject.ApplyModifiedProperties(); return; } if (m_Sections == null) { m_Sections = new Dictionary <string, ProfileFeatureSection>(); } foreach (ProfileFeatureSection section in m_Profile.featureDefinitions) { m_Sections[section.sectionKey] = section; } bool didChangeProfile = false; // Features. if (RenderFeatureSection()) { didChangeProfile = true; } // Timeline. if (RenderTimelineList()) { didChangeProfile = true; } // Properties. if (RenderProfileDefinitions()) { didChangeProfile = true; } TimeOfDayController tc = GameObject.FindObjectOfType <TimeOfDayController>(); if (tc != null) { tc.UpdateSkyForCurrentTime(); } serializedObject.ApplyModifiedProperties(); if (didChangeProfile) { EditorUtility.SetDirty(m_Profile); } }
private void OnGUI() { LoadStyles(); TimeOfDayController timeController = FindObjectOfType <TimeOfDayController>() as TimeOfDayController; // Render a setup helper UI. if (timeController == null) { RenderNeedsSkySetupLayout(); return; } // Render a profile help message UI. if (timeController.skyProfile == null) { RenderNeedsProfileLayout(); return; } m_ActiveTimeController = timeController; m_ActiveSkyProfile = timeController ? timeController.skyProfile : null; RebuildTimelineDefinitions(timeController.skyProfile); float contentHeight = CalculateWindowContentHeight(timeController.skyProfile); float scrollbarInset = 0; // Select the first colorGroup if one isn't selected. if (TimelineSelection.selectedGroupUUID == null && timeController.skyProfile.timelineManagedKeys.Count > 0) { IKeyframeGroup group = timeController.skyProfile.GetGroup(timeController.skyProfile.timelineManagedKeys[0]); if (group != null) { TimelineSelection.selectedGroupUUID = group.id; } } // Inset content on the right to make room for scroll bar. if (contentHeight > position.height) { scrollbarInset = CONTENT_INSET; } // Timeline rect. Rect contentRect = new Rect( 0, 0, position.width - scrollbarInset, position.height); // Check if mouse left the window, and cancel drag operations. if (Event.current.type == EventType.MouseLeaveWindow || contentRect.Contains(Event.current.mousePosition) == false) { SkyEditorUtility.CancelTimelineDrags(); } // Loads the list of timeline groups to render. RenderTimelineEditor(contentRect, timeController, contentHeight); // Save the edits to the profile object. if (timeController != null) { EditorUtility.SetDirty(timeController.skyProfile); // Keep the scene view rendering in sync for live editing. timeController.UpdateSkyForCurrentTime(); } }