Skip to content

Commit e7d4f76

Browse files
authored
Merge pull request #204 from umasteeringgroup/fix-CleanupExamples
cleanup examples
2 parents ad5ebac + 1115668 commit e7d4f76

File tree

67 files changed

+47
-3116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+47
-3116
lines changed

UMAProject/Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicDNAConverterBehaviour.cs

+2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ public DynamicDNAConverterController DoUpgrade()
380380
//The RaceDatas and SlotDataAssets will warn the user if they are using a legacy DynamicDNAConverterBehaviour
381381
var DCBFilename = System.IO.Path.GetFileName(DCBPath);
382382
string moveAssetResult = "";
383+
#pragma warning disable 0219
383384
string newDCBPath = DCBPath;
385+
#pragma warning restore
384386
if (DCBPath.IndexOf("LegacyDNA" + "/" + DCBFilename) == -1)
385387
{
386388
var DCBDir = System.IO.Path.GetDirectoryName(DCBPath);

UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/CustomAssetUtility.cs

+8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public static void CreatePrefab(string name, params System.Type[] types)
3535
{
3636
go.AddComponent(t);
3737
}
38+
#if UNITY_2018_3_OR_NEWER
39+
PrefabUtility.SaveAsPrefabAsset(go, assetPathAndName );
40+
#else
3841
PrefabUtility.CreatePrefab(assetPathAndName, go);
42+
#endif
3943
GameObject.DestroyImmediate(go,false);
4044
}
4145

@@ -55,7 +59,11 @@ public static GameObject ClonePrefab(GameObject other, string newName = "")
5559
string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/" + name + ".prefab");
5660

5761
GameObject go = GameObject.Instantiate(other);
62+
#if UNITY_2018_3_OR_NEWER
63+
var prefab = PrefabUtility.SaveAsPrefabAsset(go, assetPathAndName);
64+
#else
5865
var prefab = PrefabUtility.CreatePrefab(assetPathAndName, go);
66+
#endif
5967
GameObject.DestroyImmediate(go, false);
6068
return prefab;
6169
}

UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/DNARangeAsset.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace UMA
1919
[System.Serializable]
2020
public class DNARangeAsset : ScriptableObject, ISerializationCallbackReceiver
2121
{
22-
#pragma warning.disable 649
22+
#pragma warning disable 649
2323
//UMA 2.8 FixDNAPrefabs: this needs to use the new DNAConverterField
2424
//we need this so we can get the data out of it on deserialize
2525
/// <summary>

UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/Editor/GeometrySelectorWindow.cs

+24-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class GeometrySelectorWindow : Editor
1919
private Vector3 _occluderPosition = Vector3.zero;
2020
private Vector3 _occluderRotation = new Vector3(270.0f, 0.0f, 0.0f);
2121
private Vector3 _occluderScale = Vector3.one;
22+
private bool bothDirections = false;
2223

2324
private bool isMirroring = false;
2425
private bool doneEditing = false; //set to true to end editing this objects
@@ -217,6 +218,10 @@ public override void OnInspectorGUI()
217218
changed = true;
218219
}
219220

221+
bothDirections = EditorGUILayout.Toggle( new GUIContent("RayCast Both Directions",
222+
"Determines whether to raycast only outward along the normal from the source mesh or in both directions. Both directions can be helpful if the occlusion slot is close to the surface of the source mesh or even slightly under it."),
223+
bothDirections);
224+
220225
if (changed)
221226
{
222227
if(_OccluderSlotData)
@@ -227,7 +232,7 @@ public override void OnInspectorGUI()
227232

228233
if (GUILayout.Button(new GUIContent("Raycast Hidden Faces", "Warning! This will clear the current selection.")))
229234
{
230-
RaycastHide();
235+
RaycastHide(bothDirections);
231236
}
232237
EditorGUI.EndDisabledGroup();
233238

@@ -700,7 +705,7 @@ public static bool RayTriIntersect(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3,
700705
return false;
701706
}
702707

703-
private void RaycastHide()
708+
private void RaycastHide(bool bothDirections = false)
704709
{
705710
if (_Source == null)
706711
return;
@@ -738,6 +743,7 @@ private void RaycastHide()
738743
EditorUtility.DisplayProgressBar("Progress", "calculating...", ((float)i / (float)targetVerts.Length));
739744

740745
Ray testRay = new Ray(targetVerts[i], targetNorms[i] );
746+
Ray oppositeTestRay = new Ray(targetVerts[i], -targetNorms[i]);
741747
for (int j = 0; j < occlusionTriangles.Count; j++)
742748
{
743749
int[] triVerts = occlusionTriangles[j];
@@ -756,6 +762,22 @@ private void RaycastHide()
756762
break;
757763
}
758764
}
765+
766+
if(bothDirections)
767+
{
768+
if (RayTriIntersect(oppositeTestRay,
769+
occlusionVerts[triVerts[k + 0]],
770+
occlusionVerts[triVerts[k + 1]],
771+
occlusionVerts[triVerts[k + 2]],
772+
out dist))
773+
{
774+
if (dist <= _Source.normalsLength)
775+
{
776+
vertexOccluded[i] = true;
777+
break;
778+
}
779+
}
780+
}
759781
}
760782

761783
if (vertexOccluded[i])

UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/Editor/UMADNAToBonePoseWindow.cs

+4
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ protected void CreateBonePoseCallback(UMAData umaData)
220220
morphSet.objectReferenceValue = AssetDatabase.LoadAssetAtPath<MorphSetDnaAsset>(assetPath);
221221

222222
serializedConverter.ApplyModifiedPropertiesWithoutUndo();
223+
#if UNITY_2018_3_OR_NEWER
224+
PrefabUtility.SaveAsPrefabAsset(tempConverterPrefab, prefabPath);
225+
#else
223226
PrefabUtility.CreatePrefab(prefabPath, tempConverterPrefab);
227+
#endif
224228
DestroyImmediate(tempConverterPrefab, false);
225229
}
226230
}

UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/Editor/UMASlotProcessingUtil.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ public static void UpdateSlotData( SlotDataAsset slot, SkinnedMeshRenderer mesh,
8686
}
8787
resultingSkinnedMesh.sharedMesh = resultingMesh;
8888
}
89-
89+
#if UNITY_2018_3_OR_NEWER
90+
var skinnedResult = PrefabUtility.SaveAsPrefabAsset(newObject, path + '/' + assetName + "_Skinned.prefab");
91+
#else
9092
var skinnedResult = UnityEditor.PrefabUtility.CreatePrefab(path + '/' + assetName + "_Skinned.prefab", newObject);
93+
#endif
9194
GameObject.DestroyImmediate(newObject);
9295

9396
var meshgo = skinnedResult.transform.Find(mesh.name);
@@ -186,7 +189,11 @@ public static SlotDataAsset CreateSlotData(string slotFolder, string assetFolder
186189
resultingSkinnedMesh.sharedMesh = resultingMesh;
187190
}
188191

192+
#if UNITY_2018_3_OR_NEWER
193+
var skinnedResult = PrefabUtility.SaveAsPrefabAsset(newObject, slotFolder + '/' + assetName + '/' + assetName + "_Skinned.prefab");
194+
#else
189195
var skinnedResult = UnityEditor.PrefabUtility.CreatePrefab(slotFolder + '/' + assetName + '/' + assetName + "_Skinned.prefab", newObject);
196+
#endif
190197
GameObject.DestroyImmediate(newObject);
191198

192199
var meshgo = skinnedResult.transform.Find(mesh.name);

UMAProject/Assets/UMA/Examples/Blendshape Examples/Scenes.meta

-9
This file was deleted.

0 commit comments

Comments
 (0)