Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaimi committed Apr 16, 2021
1 parent e49328d commit addcd08
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static bool ConvertUMAMaterials(string From, string To)
}
}
}
if (umat.material.shader.name.ToLower().StartsWith("hair fade"))
if (umat.material.shader.name.ToLower().Contains("hair fade"))
{
umat.material.shader = Shader.Find("Universal Render Pipeline/Nature/SpeedTree8");
if (umat.material.name.ToLower().Contains("single"))
Expand All @@ -503,6 +503,7 @@ static bool ConvertUMAMaterials(string From, string To)
{
umat.material.SetInt("_TwoSided", 0);
}
matModified = true;
}
if (matModified)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class UMAExpressionPlayer : ExpressionPlayer
public float MinSaccadeDelay = 0.25f;
public float MaxSaccadeMagnitude = 15f;

public Animator animator;
private float[] LastValues;

public UMAExpressionEvent ExpressionChanged;
Expand Down Expand Up @@ -83,17 +84,20 @@ public void Initialize()
{
umaData = gameObject.GetComponentInParent<UMAData>();
}
if (umaData == null)
if (umaData != null)
{
//if (Debug.isDebugBuild)
// Debug.LogError("Couldn't locate UMAData component");
return;
umaData.CharacterBegun.AddListener(CharacterBegun);
umaData.CharacterUpdated.AddListener(UmaData_OnCharacterUpdated);
}
umaData.CharacterBegun.AddListener(CharacterBegun);
umaData.CharacterUpdated.AddListener(UmaData_OnCharacterUpdated);
}
}
//SetupBones();

if (umaData != null)
{
animator = gameObject.GetComponentInChildren<Animator>();
SetupBones();
}

processing = true;
initialized = true;
}
Expand All @@ -106,23 +110,23 @@ private void CharacterBegun(UMAData _umaData)

private void SetupBones()
{
if ((expressionSet != null) && (umaData != null) && (umaData.skeleton != null))
if ((expressionSet != null) /*&& (umaData != null) && (umaData.skeleton != null)*/)
{
Transform jaw = null;
Transform neck = null;
Transform head = null;

if (umaData.animator != null)
{
jaw = umaData.animator.GetBoneTransform(HumanBodyBones.Jaw);
jaw = animator.GetBoneTransform(HumanBodyBones.Jaw);
if (jaw != null)
jawHash = UMAUtils.StringToHash(jaw.name);

neck = umaData.animator.GetBoneTransform(HumanBodyBones.Neck);
neck = animator.GetBoneTransform(HumanBodyBones.Neck);
if (neck != null)
neckHash = UMAUtils.StringToHash(neck.name);

head = umaData.animator.GetBoneTransform(HumanBodyBones.Head);
head = animator.GetBoneTransform(HumanBodyBones.Head);
if (head != null)
headHash = UMAUtils.StringToHash(head.name);
}
Expand Down Expand Up @@ -157,6 +161,7 @@ private void UmaData_OnCharacterUpdated(UMAData obj)
{
umaData = obj;
SetupBones();
animator = umaData.animator;
processing = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class UMADynamicBoneJiggle : MonoBehaviour
{
[Header("General Settings")]
public string jiggleBoneName;
public string[] AdditionalBones;
public List<string> exceptions;
[Range(0,1)]
public float reduceEffect;
Expand All @@ -16,12 +17,26 @@ public class UMADynamicBoneJiggle : MonoBehaviour
public bool deleteBoneWithSlot;
public string slotToWatch;
private string linkedRecipe;


public void AddJiggle(UMAData umaData)
{
Transform rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);
{
UMABoneCleaner cleaner = umaData.gameObject.GetComponent<UMABoneCleaner>();
Transform rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);
AddBoneJiggle(umaData, rootBone, cleaner);
if (AdditionalBones != null)
{
foreach(string s in AdditionalBones)
{
if (!string.IsNullOrEmpty(s))
{
rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, s);
AddBoneJiggle(umaData, rootBone, cleaner);
}
}
}
}

public void AddBoneJiggle(UMAData umaData, Transform rootBone, UMABoneCleaner cleaner)
{
List<Transform> exclusionList = new List<Transform>();

if (rootBone != null)
Expand Down Expand Up @@ -76,7 +91,7 @@ public void AddJiggle(UMAData umaData)

listing.recipe = linkedRecipe;

listing.exceptions = exclusionList;
listing.exceptions.AddRange(exclusionList);
cleaner.RegisterJiggleBone(listing);
}
}
Expand Down
3 changes: 3 additions & 0 deletions UMAProject/Assets/UMA/Whats New in UMA.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Option to recalculate tangents in slot builder
Added save/load/clear buttons to the tags list on the slots in the recipe editor.
Experimental support for saving and restoring regular mounted items between builds. To use, add the "UMAIgnore" tag to the object
new menuitem in Global Library to apply selected races to selected wardrobe items.
When creating a prefab using the prefab maker, UMA will now correctly detect detail normal maps, and will also mark all normal maps as normal maps in the import settings.
Option to add "Standalone DNA" component to prefab, giving you the option to have DNA on the non-UMA prefabs. When using this option, UMA is required to be in the scene to be able to process the DNA.
Experimental - multiple bone chains in UMAJiggleBone


Whats new in 2.11.6
Expand Down

0 comments on commit addcd08

Please sign in to comment.