Skip to content

Commit

Permalink
Merge pull request #446 from umasteeringgroup/Feature-13
Browse files Browse the repository at this point in the history
Feature 13
  • Loading branch information
Jaimi authored Jun 16, 2024
2 parents efc89d3 + 68aa1ba commit 9f698b9
Show file tree
Hide file tree
Showing 5 changed files with 359 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace UMA.Editors
[CanEditMultipleObjects]
public class SlotDataAssetInspector : Editor
{
static string[] RegularSlotFields = new string[] { "slotName", "CharacterBegun", "SlotAtlassed", "SlotProcessed", "SlotBeginProcessing", "DNAApplied", "CharacterCompleted", "_slotDNALegacy","tags","isWildCardSlot","Races","smooshOffset", "smooshExpand", "Welds"};

static string[] RegularSlotFields = new string[] { "slotName", "CharacterBegun", "SlotAtlassed", "SlotProcessed", "SlotBeginProcessing", "DNAApplied", "CharacterCompleted", "_slotDNALegacy","tags","isWildCardSlot","Races","smooshOffset", "smooshExpand", "Welds"};
static string[] WildcardSlotFields = new string[] { "slotName", "CharacterBegun", "SlotAtlassed", "SlotProcessed", "SlotBeginProcessing", "DNAApplied", "CharacterCompleted", "_slotDNALegacy", "tags", "isWildCardSlot", "Races", "_rendererAsset", "maxLOD", "useAtlasOverlay", "overlayScale", "animatedBoneNames", "_slotDNA", "meshData", "subMeshIndex","Welds" };
SerializedProperty slotName;
SerializedProperty CharacterBegun;
Expand All @@ -28,7 +29,8 @@ public class SlotDataAssetInspector : Editor

bool CopyNormals;
bool CopyBoneWeights;
bool AverageNormals;
UMA.SlotDataAsset.BlendshapeCopyMode blendshapeCopyMode;
bool AverageNormals;
float weldDistance = 0.0001f;

private int selectedRaceIndex = -1;
Expand Down Expand Up @@ -128,7 +130,7 @@ private void UpdateSourceAsset(SlotDataAsset sda)
{
if (sda != null)
{
lastWeld = slot.CalculateWelds(sda, CopyNormals, CopyBoneWeights, AverageNormals, Vector3.kEpsilon);
lastWeld = slot.CalculateWelds(sda, CopyNormals, CopyBoneWeights, AverageNormals, Vector3.kEpsilon, SlotDataAsset.BlendshapeCopyMode.None);
}
}

Expand Down Expand Up @@ -305,6 +307,7 @@ public override void OnInspectorGUI()
CopyBoneWeights = EditorGUILayout.Toggle("Copy Boneweights", CopyBoneWeights);
CopyNormals = EditorGUILayout.Toggle("Copy Normals", CopyNormals);
AverageNormals = EditorGUILayout.Toggle("Average Normals", AverageNormals);
blendshapeCopyMode = (UMA.SlotDataAsset.BlendshapeCopyMode)EditorGUILayout.EnumPopup("Blendshape Copy Mode", blendshapeCopyMode);
GUILayout.Box("Warning! averaging normals will update both slots!", GUILayout.ExpandWidth(true));

if (WeldToSlot == null)
Expand All @@ -313,7 +316,7 @@ public override void OnInspectorGUI()
}
if (GUILayout.Button("Perform Weld"))
{
lastWeld = slot.CalculateWelds(WeldToSlot, CopyNormals, CopyBoneWeights, AverageNormals, weldDistance);
lastWeld = slot.CalculateWelds(WeldToSlot, CopyNormals, CopyBoneWeights, AverageNormals, weldDistance, blendshapeCopyMode);
forceUpdate = true;
}
if (WeldToSlot == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.SceneManagement;

#if UMA_ADDRESSABLES
public class UMAAddressablesBuildWindow : EditorWindow
Expand Down Expand Up @@ -37,7 +38,21 @@ private UMAAddressablesBuildWindow Init()

private void OnGUI()
{
string errorMessage = "";
EditorGUILayout.LabelField("UMA Addressables Build Sample");
for(int i=0; i< SceneManager.sceneCount; i++)
{
Scene s = SceneManager.GetSceneAt(i);
if (s.isDirty)
{
errorMessage += $"Scene {s.name} is dirty\n";
}
}
if (!string.IsNullOrEmpty(errorMessage))
{
errorMessage = "Please save all scenes before building to avoid a mid-build dialog!\n" + errorMessage;
EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
}
EditorGUILayout.Space(20);
dev = EditorGUILayout.Toggle("Development Build", dev);
AppName = EditorGUILayout.TextField("App Name", AppName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ public override void OnInspectorGUI()
}
else
{
int channelCount = serializedObject.FindProperty("channels").arraySize;
if (channelCount != (target as UMAMaterial).channels.Length)
{
serializedObject.ApplyModifiedProperties();
}
DrawChannelList(serializedObject.FindProperty("channels"), (UMAMaterial.MaterialType)materialTypeProperty.intValue);
}

Expand Down Expand Up @@ -221,6 +226,10 @@ public override void OnInspectorGUI()
public bool IsChannelValid(int channel)
{
UMAMaterial source = target as UMAMaterial;
if (channel >= source.channels.Length)
{
return false;
}
var matchan = source.channels[channel];

if (!string.IsNullOrEmpty(matchan.materialPropertyName) && source.material != null)
Expand Down
Loading

0 comments on commit 9f698b9

Please sign in to comment.