暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

PostProcessEffectSettingsConverter.cs 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #if PPV2_EXISTS
  2. using System;
  3. using UnityEditor;
  4. using UnityEngine;
  5. using UnityEngine.Rendering;
  6. using BIRPRendering = UnityEngine.Rendering.PostProcessing;
  7. using URPRendering = UnityEngine.Rendering.Universal;
  8. namespace UnityEditor.Rendering.Universal
  9. {
  10. public abstract class PostProcessEffectSettingsConverter : ScriptableObject
  11. {
  12. protected abstract Type OldSettingsType { get; }
  13. public void AddConvertedProfileSettingsToProfile(
  14. BIRPRendering.PostProcessEffectSettings oldSettings,
  15. VolumeProfile targetProfile)
  16. {
  17. if (oldSettings == null || oldSettings.GetType() != OldSettingsType) return;
  18. if (targetProfile == null || targetProfile.Has(OldSettingsType)) return;
  19. ConvertToTarget(oldSettings, targetProfile);
  20. }
  21. protected abstract void ConvertToTarget(BIRPRendering.PostProcessEffectSettings oldBloom,
  22. VolumeProfile targetProfile);
  23. protected T AddVolumeComponentToAsset<T>(VolumeProfile targetProfileAsset) where T : VolumeComponent
  24. {
  25. if (!targetProfileAsset) return null;
  26. var profilePath = AssetDatabase.GetAssetPath(targetProfileAsset);
  27. if (string.IsNullOrEmpty(profilePath)) return null;
  28. var newVolumeComponent = targetProfileAsset.Add<T>();
  29. AssetDatabase.AddObjectToAsset(newVolumeComponent, targetProfileAsset);
  30. return newVolumeComponent;
  31. }
  32. }
  33. }
  34. #endif