Skip to content

Commit

Permalink
Merge pull request #99 from soupday/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
soupday authored Dec 16, 2024
2 parents 604abff + a2ea38a commit d634382
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
25 changes: 14 additions & 11 deletions Editor/CharacterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,22 +741,25 @@ public bool AnyJsonMaterialPathExists(string path)
{
QuickJSON objectsJson = ObjectsJsonData;

foreach (MultiValue mvMesh in objectsJson.values)
if (objectsJson != null)
{
if (mvMesh.Type == MultiType.Object)
foreach (MultiValue mvMesh in objectsJson.values)
{
QuickJSON objJson = mvMesh.ObjectValue;
string objName = mvMesh.Key;
string materialsPath = ObjectsMaterialsJsonPath(objName);
QuickJSON materialsJson = objectsJson.GetObjectAtPath(materialsPath);
if (materialsJson != null)
if (mvMesh.Type == MultiType.Object)
{
foreach (MultiValue mvMat in materialsJson.values)
QuickJSON objJson = mvMesh.ObjectValue;
string objName = mvMesh.Key;
string materialsPath = ObjectsMaterialsJsonPath(objName);
QuickJSON materialsJson = objectsJson.GetObjectAtPath(materialsPath);
if (materialsJson != null)
{
if (mvMat.Type == MultiType.Object)
foreach (MultiValue mvMat in materialsJson.values)
{
QuickJSON matjson = mvMat.ObjectValue;
if (matjson.PathExists(path)) return true;
if (mvMat.Type == MultiType.Object)
{
QuickJSON matjson = mvMat.ObjectValue;
if (matjson.PathExists(path)) return true;
}
}
}
}
Expand Down
22 changes: 14 additions & 8 deletions Editor/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,9 @@ private void ConnectDefaultHairMaterial(GameObject obj, string sourceName, Mater
private void ConnectHQSkinMaterial(GameObject obj, string sourceName, Material sharedMat, Material mat,
MaterialType materialType, QuickJSON matJson)
{
bool hasWrinkle = false;
if (matJson != null) hasWrinkle = matJson.PathExists("Wrinkle");

ConnectTextureTo(sourceName, mat, "_DiffuseMap", "Diffuse",
matJson, "Textures/Base Color",
FLAG_SRGB);
Expand Down Expand Up @@ -1534,7 +1537,7 @@ private void ConnectHQSkinMaterial(GameObject obj, string sourceName, Material s
matJson, "Custom Shader/Image/NormalMap Blend",
FLAG_NORMAL);

if (characterInfo.FeatureUseWrinkleMaps && matJson.PathExists("Wrinkle"))
if (characterInfo.FeatureUseWrinkleMaps && hasWrinkle)
{
ConnectTextureTo(sourceName, mat, "_WrinkleDiffuseBlend1", "Wrinkle_Diffuse1",
matJson, "Wrinkle/Textures/Diffuse_1",
Expand Down Expand Up @@ -2525,15 +2528,18 @@ private Dictionary<string, WrinkleProp> BuildWrinkleProps(QuickJSON matJson)

private void AddWrinkleManager(GameObject obj, SkinnedMeshRenderer smr, Material mat, QuickJSON matJson)
{
WrinkleManager wm = obj.AddComponent<WrinkleManager>();
wm.headMaterial = mat;
wm.skinnedMeshRenderer = smr;
float overallWeight = 1;
if (matJson.PathExists("Wrinkle/WrinkleOverallWeight"))
if (matJson != null)
{
overallWeight = matJson.GetFloatValue("Wrinkle/WrinkleOverallWeight");
WrinkleManager wm = obj.AddComponent<WrinkleManager>();
wm.headMaterial = mat;
wm.skinnedMeshRenderer = smr;
float overallWeight = 1;
if (matJson.PathExists("Wrinkle/WrinkleOverallWeight"))
{
overallWeight = matJson.GetFloatValue("Wrinkle/WrinkleOverallWeight");
}
wm.BuildConfig(BuildWrinkleProps(matJson), overallWeight);
}
wm.BuildConfig(BuildWrinkleProps(matJson), overallWeight);
}

private void CopyWrinkleMasks(string folder)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CC/iC Unity Tools HDRP

## Important
*Development of the CC/iC Unity Tools has moved to a single version for all pipelines*: [CCiC-Unity-Tools](https://github.com/soupday/CCiC-Unity-Tools)

*This repository will **not** be updated any further.*

Read Me
=======

Expand Down

0 comments on commit d634382

Please sign in to comment.