Skip to content

Commit

Permalink
1.6.3
Browse files Browse the repository at this point in the history
Fix to just hair physics not generating colliders.
Fix HDRP diffusion profiles in HDRP17.
  • Loading branch information
soupday committed Jul 29, 2024
1 parent d87edec commit 5d95de1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Editor/Physics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ private void AddCollidersToPrefabContents()
var prefabRoot = editingScope.prefabContentsRoot;
PurgeAllPhysicsComponents(prefabRoot);

if (characterInfo.ShaderFlags.HasFlag(CharacterInfo.ShaderFeatureFlags.ClothPhysics) || characterInfo.ShaderFlags.HasFlag(CharacterInfo.ShaderFeatureFlags.ClothPhysics))
if (characterInfo.ShaderFlags.HasFlag(CharacterInfo.ShaderFeatureFlags.ClothPhysics) ||
characterInfo.ShaderFlags.HasFlag(CharacterInfo.ShaderFeatureFlags.HairPhysics))
{
AddCollidersToPrefabRoot(prefabRoot);
}
Expand Down
35 changes: 23 additions & 12 deletions Editor/Pipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Diagnostics;
#if HDRP_10_5_0_OR_NEWER
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
Expand Down Expand Up @@ -527,33 +528,40 @@ public static void ResetMaterial(Material mat)
#endif
}

public static void AddDiffusionProfilesHDRP()
public static bool AddDiffusionProfilesHDRP()
{
bool modified = false;

#if HDRP_10_5_0_OR_NEWER
#if HDRP_12_0_0_OR_NEWER
RenderPipelineGlobalSettings pipelineSettings = GraphicsSettings.GetSettingsForRenderPipeline<HDRenderPipeline>();
if (!pipelineSettings) return;
if (!pipelineSettings) return modified;
string assetPath = AssetDatabase.GetAssetPath(pipelineSettings);
#else
HDRenderPipelineAsset pipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
if (!pipelineAsset) return;
if (!pipelineAsset) return modified;
string assetPath = AssetDatabase.GetAssetPath(pipelineAsset);
#endif

SerializedObject hdrp = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(assetPath)[0]);
if (hdrp == null) return;

bool modified = false;
if (hdrp == null) return modified;

string[] profiles = new string[] { "RL_Skin_Profile", "RL_Teeth_Profile", "RL_Eye_Profile", "RL_SSS_Profile" };

#if HDRP_14_0_0_OR_NEWER
VolumeProfile defaultVolumeAsset = null;
List<DiffusionProfileSettings> dpsList = null;

SerializedProperty propDefaultVolumeProfile = hdrp.FindProperty("m_DefaultVolumeProfile");
if (propDefaultVolumeProfile == null) return;
VolumeProfile defaultVolumeAsset = (VolumeProfile)propDefaultVolumeProfile.objectReferenceValue;
if (defaultVolumeAsset == null) return;
if (propDefaultVolumeProfile == null)
defaultVolumeAsset = (VolumeProfile)Util.FindAsset("DefaultSettingsVolumeProfile");
else
defaultVolumeAsset = (VolumeProfile)propDefaultVolumeProfile.objectReferenceValue;

if (defaultVolumeAsset == null) return modified;

if (!defaultVolumeAsset.TryGet<DiffusionProfileList>(out DiffusionProfileList dpl)) return;
List<DiffusionProfileSettings> dpsList = new List<DiffusionProfileSettings>(dpl.diffusionProfiles.value);
if (!defaultVolumeAsset.TryGet<DiffusionProfileList>(out DiffusionProfileList dpl)) return modified;
dpsList = new List<DiffusionProfileSettings>(dpl.diffusionProfiles.value);

foreach (string profile in profiles)
{
Expand Down Expand Up @@ -590,12 +598,14 @@ public static void AddDiffusionProfilesHDRP()
{
dpl.diffusionProfiles.value = dpsList.ToArray();
EditorUtility.SetDirty(defaultVolumeAsset);
EditorUtility.SetDirty(pipelineSettings);
AssetDatabase.SaveAssetIfDirty(defaultVolumeAsset);
AssetDatabase.SaveAssetIfDirty(pipelineSettings);
}
#else
SerializedProperty list = hdrp.FindProperty("diffusionProfileSettingsList");

if (list == null) return;
if (list == null) return modified;

SerializedProperty item;

Expand Down Expand Up @@ -633,6 +643,7 @@ public static void AddDiffusionProfilesHDRP()
#endif //HDRP_14_0_0_OR_NEWER

#endif //HDRP_10_5_0_OR_NEWER
return modified;
}

public static Shader GetDefaultShader()
Expand Down

0 comments on commit 5d95de1

Please sign in to comment.