private bool RenderFeatureSection() { RenderSectionTitle("Features", "FeatureSectionIcon"); bool didChangeProfile = false; string[] rebuildSkyKeywords = new string[] { ShaderKeywords.StarLayer1, ShaderKeywords.StarLayer2, ShaderKeywords.StarLayer3 }; if (m_Sections.ContainsKey(ProfileSectionKeys.FeaturesSectionKey) == false) { Debug.LogError("Shader definition is missing a features dictionary"); return(didChangeProfile); } ProfileFeatureSection section = m_Sections[ProfileSectionKeys.FeaturesSectionKey]; foreach (ProfileFeatureDefinition def in section.featureDefinitions) { if (def.dependsOnFeature != null) { if (m_Profile.IsFeatureEnabled(def.dependsOnFeature) != def.dependsOnValue) { m_Profile.SetFeatureEnabled(def.featureKey, false); didChangeProfile = true; continue; } } bool valueChanged; RenderFeatureCheckbox( def, m_Profile.IsFeatureEnabled(def.featureKey), out valueChanged); if (valueChanged && rebuildSkyKeywords.Contains(def.shaderKeyword)) { RebuildSkySystem(); } if (valueChanged) { didChangeProfile = true; } } return(didChangeProfile); }
// Render all properties for a section. public bool RenderSection(string sectionKey, params string[] ignoreGroups) { ProfileGroupSection sectionInfo = m_Profile.GetSectionInfo(sectionKey); RenderSectionTitle(sectionInfo.sectionTitle, sectionInfo.sectionIcon); bool didChangeProfile = false; // Render all the feature checkboxes for the section. if (m_Sections.ContainsKey(sectionKey)) { ProfileFeatureSection keywordSection = m_Sections[sectionKey]; foreach (ProfileFeatureDefinition def in keywordSection.featureDefinitions) { // Check for keyword dependencies. if (def.dependsOnFeature != null) { if (m_Profile.IsFeatureEnabled(def.dependsOnFeature) != def.dependsOnValue) { continue; } } // Render the feature UI. bool valueChanged = false; if (def.featureType == ProfileFeatureDefinition.FeatureType.BooleanValue || def.featureType == ProfileFeatureDefinition.FeatureType.ShaderKeyword) { RenderFeatureCheckbox( def, m_Profile.IsFeatureEnabled(def.featureKey), out valueChanged); } else if (def.featureType == ProfileFeatureDefinition.FeatureType.ShaderKeywordDropdown) { RenderDropdownShaderFeature( def, out valueChanged); } if (valueChanged) { didChangeProfile = true; } } } // Render all the property groups for this section. foreach (ProfileGroupDefinition groupInfo in sectionInfo.groups) { bool shouldIgnore = false; foreach (string ignoreName in ignoreGroups) { if (groupInfo.groupName.Contains(ignoreName)) { shouldIgnore = true; break; } } if (shouldIgnore) { continue; } bool valueChanged = RenderProfileGroup(groupInfo); if (valueChanged) { didChangeProfile = true; } } // Render any section specific non-timeline properties. if (sectionKey == ProfileSectionKeys.LightningSectionKey) { EditorGUILayout.ObjectField(serializedObject.FindProperty("lightningArtSet")); } else if (sectionKey == ProfileSectionKeys.RainSplashSectionKey) { EditorGUILayout.ObjectField(serializedObject.FindProperty("rainSplashArtSet")); } return(didChangeProfile); }