void OnGUI_Fade() { ShowTitle("Fade设置"); GUILayout.BeginHorizontal(); GUILayout.Label("AnimateCrossFading", GUILayout.Width(columnWidth + 30)); animateCrossFading = GUILayout.Toggle(animateCrossFading, "", GUILayout.Width(columnWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("LODFadeMode", GUILayout.Width(columnWidth + 30)); lodFadeMode = (LODFadeMode)EditorGUILayout.EnumPopup((LODFadeMode)lodFadeMode, GUILayout.Width(columnWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); // if (GUILayout.Button ("设置全部",GUILayout.Width(buttonWidth))) { // var groups = Object.FindObjectsOfType<LODGroup> (); // foreach (var group in groups) { // group.fadeMode = lodFadeMode; // group.animateCrossFading = animateCrossFading; // } // } if (GUILayout.Button("设置所选", GUILayout.Width(buttonWidth))) { var groups = Selection.GetFiltered <LODGroup> (SelectionMode.DeepAssets); foreach (var group in groups) { group.fadeMode = lodFadeMode; group.animateCrossFading = animateCrossFading; } } GUILayout.EndHorizontal(); }
void OnEnable() { lodGroupSetup = (LODGroupSetup)target; LODGroup lodGroup = lodGroupSetup.lodGroup; oldLods = lodGroup.GetLODs(); animateCrossFadingOld = lodGroup.animateCrossFading; fadeModeOld = lodGroup.fadeMode; UnityEditor.EditorApplication.update += MyUpdate; }
private void Reset() { fadeMode = LODFadeMode.None; animateCrossFading = false; autoCollectRenderers = true; simplificationOptions = SimplificationOptions.Default; levels = new LODLevel[] { new LODLevel(0.5f, 1f) { CombineMeshes = false, CombineSubMeshes = false, SkinQuality = SkinQuality.Auto, ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ReceiveShadows = true, SkinnedMotionVectors = true, LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes, ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.BlendProbes, }, new LODLevel(0.17f, 0.65f) { CombineMeshes = true, CombineSubMeshes = false, SkinQuality = SkinQuality.Auto, ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ReceiveShadows = true, SkinnedMotionVectors = true, LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.BlendProbes, ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Simple }, new LODLevel(0.02f, 0.4225f) { CombineMeshes = true, CombineSubMeshes = true, SkinQuality = SkinQuality.Bone2, ShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off, ReceiveShadows = false, SkinnedMotionVectors = false, LightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off, ReflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off } }; }
void DrawLODHelperProperty() { myFadeMode = (LODFadeMode)EditorGUILayout.EnumPopup(fadeModeContent, myFadeMode); if (myFadeMode != 0) { myAnimateCrossFading = EditorGUILayout.Toggle(animateCrossFadingContent, myAnimateCrossFading); } myAutoCollectRenderers = EditorGUILayout.Toggle(autoCollectRenderersContent, myAutoCollectRenderers); mySimplificationOptions = EditorGUILayout.Foldout(mySimplificationOptions, simplificationOptionsContent); if (mySimplificationOptions) { ++EditorGUI.indentLevel; myPreserveBorderEdges = EditorGUILayout.Toggle(PreserveBorderEdgesContent, myPreserveBorderEdges); myPreserveUVSeamEdges = EditorGUILayout.Toggle(PreserveUVSeamEdgesContent, myPreserveUVSeamEdges); myPreserveUVFoldoverEdges = EditorGUILayout.Toggle(PreserveUVFoldoverEdgesContent, myPreserveUVFoldoverEdges); myEnableSmartLink = EditorGUILayout.Toggle(EnableSmartLinkContent, myEnableSmartLink); myVertexLinkDistance = EditorGUILayout.DoubleField(VertexLinkDistanceContent, myVertexLinkDistance); myMaxIterationCount = EditorGUILayout.IntField(MaxIterationCountContent, myMaxIterationCount); myAgressiveness = EditorGUILayout.DoubleField(AgressivenessContent, myAgressiveness); --EditorGUI.indentLevel; } myOverrideSaveAssetPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, myOverrideSaveAssetPath); if (myOverrideSaveAssetPath) { mySaveAssetsPath = EditorGUILayout.TextField(saveAssetsPathContent, mySaveAssetsPath); } else { mySaveAssetsPath = string.Empty; } for (int index = 0; index < myQualities.Count; index++) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); GUILayout.Label(string.Format("Level {0}", index + 1), EditorStyles.boldLabel); var previousBackgroundColor = GUI.backgroundColor; GUI.backgroundColor = removeColor; if (GUILayout.Button(deleteLevelButtonContent, GUILayout.Width(RemoveLevelButtonSize))) { myScreenRelativeTransitionHeights.RemoveAt(index); myQualities.RemoveAt(index); break; } GUI.backgroundColor = previousBackgroundColor; EditorGUILayout.EndHorizontal(); ++EditorGUI.indentLevel; myScreenRelativeTransitionHeights[index] = EditorGUILayout.Slider(screenRelativeTransitionHeightContent, myScreenRelativeTransitionHeights[index], 0, 1f); myQualities[index] = EditorGUILayout.Slider(qualityContent, myQualities[index], 0, 1f); mySettings = EditorGUILayout.Foldout(mySettings, settingsContent); if (mySettings) { ++EditorGUI.indentLevel; myCombineMeshes[index] = EditorGUILayout.Toggle(combineMeshesContent, myCombineMeshes[index]); mySkinQualities[index] = (SkinQuality)EditorGUILayout.EnumPopup(skinQualityContent, mySkinQualities[index]); myShadowCastingModes[index] = (ShadowCastingMode)EditorGUILayout.EnumPopup(shadowCastingModeContent, myShadowCastingModes[index]); myReceiveShadows[index] = EditorGUILayout.Toggle(receiveShadowsContent, myReceiveShadows[index]); myMotionVectorGenerationModes[index] = (MotionVectorGenerationMode)EditorGUILayout.EnumPopup(motionVectorGenerationModeContent, myMotionVectorGenerationModes[index]); mySkinnedMotionVectors[index] = EditorGUILayout.Toggle(skinnedMotionVectorsContent, mySkinnedMotionVectors[index]); myLightProbeUsages[index] = (LightProbeUsage)EditorGUILayout.EnumPopup(lightProbeUsageContent, myLightProbeUsages[index]); myReflectionProbeUsages[index] = (ReflectionProbeUsage)EditorGUILayout.EnumPopup(reflectionProbeUsageContent, myReflectionProbeUsages[index]); --EditorGUI.indentLevel; } --EditorGUI.indentLevel; EditorGUILayout.EndVertical(); } if (GUILayout.Button("Create Level")) { myScreenRelativeTransitionHeights.Add(myScreenRelativeTransitionHeights[myScreenRelativeTransitionHeights.Count - 1] * 0.5f); myQualities.Add(myQualities[myQualities.Count - 1] * 0.65f); } }