private void UpdateTabs() { var SRPType = GetSRPType(); if (m_CurrentLightingExplorerExtension == null || m_CurrentSRPType != SRPType) { m_CurrentSRPType = SRPType; if (m_CurrentLightingExplorerExtension != null) { m_CurrentLightingExplorerExtension.OnDisable(); } m_CurrentLightingExplorerExtension = GetLightExplorerExtension(SRPType); m_CurrentLightingExplorerExtension.OnEnable(); m_SelectedTab = EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D ? /* 2D Lights */ 1 : /* Lights */ 0; if (m_CurrentLightingExplorerExtension.GetContentTabs() == null || m_CurrentLightingExplorerExtension.GetContentTabs().Length == 0) { throw new ArgumentException("There must be atleast 1 content tab defined for the Lighting Explorer."); } m_TableTabs = m_CurrentLightingExplorerExtension.GetContentTabs(); m_TabTitles = m_TableTabs != null?m_TableTabs.Select(item => item.title).ToArray() : null; } }
private ILightingExplorerExtension GetDefaultLightingExplorerExtension() { if (s_DefaultLightingExplorerExtension == null) { s_DefaultLightingExplorerExtension = new DefaultLightingExplorerExtension(); } return(s_DefaultLightingExplorerExtension); }
private ILightingExplorerExtension GetLightExplorerExtension(System.Type currentSRPType) { if (currentSRPType == null) { return(GetDefaultLightingExplorerExtension()); } Type extensionType = RenderPipelineEditorUtility.FetchFirstCompatibleTypeUsingScriptableRenderPipelineExtension <ILightingExplorerExtension>(); if (extensionType != null) { ILightingExplorerExtension extension = (ILightingExplorerExtension)System.Activator.CreateInstance(extensionType); return(extension); } // no light explorer extension found for current srp, return the default one return(GetDefaultLightingExplorerExtension()); }
private ILightingExplorerExtension GetLightExplorerExtension(System.Type currentSRPType) { if (currentSRPType == null) { return(GetDefaultLightingExplorerExtension()); } var extensionTypes = TypeCache.GetTypesDerivedFrom <ILightingExplorerExtension>(); foreach (System.Type extensionType in extensionTypes) { LightingExplorerExtensionAttribute attribute = System.Attribute.GetCustomAttribute(extensionType, typeof(LightingExplorerExtensionAttribute)) as LightingExplorerExtensionAttribute; if (attribute != null && attribute.renderPipelineType == currentSRPType) { ILightingExplorerExtension extension = (ILightingExplorerExtension)System.Activator.CreateInstance(extensionType); return(extension); } } // no light explorer extension found for current srp, return the default one return(GetDefaultLightingExplorerExtension()); }