-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Int parameter editor * Int transitions: Runtime * Very basic int transition test * Generalize Parameter setting * Create StateMachineParameterRef * Write a bunch of tests for int transitions * Write bool transition tests * Delete redundant code on AnimationStateMachineSmartBlobberSysetm * Minor change to AnimationParameterPropertyDrawer * Enum Parameter * Fix enum selector position * Fix bug with state Index in UpdateStateMachineJob.CreateState * Fix StateMachineSystem not running during AnimationState transitions * Fix broken tests * Update samples * Bump to version v0.3.3 * AnimationParameterAsset Hash Fixes #18 * Update changelog
- Loading branch information
1 parent
c316d1e
commit a3a4264
Showing
132 changed files
with
7,152 additions
and
686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using UnityEngine; | ||
using System; | ||
using UnityEditor; | ||
|
||
namespace DMotion.Editor | ||
{ | ||
public static class EditorGUIUtils | ||
{ | ||
public static int GenericEnumPopup(Rect r, Type enumType, int current) | ||
{ | ||
if (enumType is { IsEnum: true }) | ||
{ | ||
var enumValue = (Enum) Enum.GetValues(enumType).GetValue(current); | ||
return (int) (object)EditorGUI.EnumPopup(r, enumValue); | ||
} | ||
else | ||
{ | ||
EditorGUI.LabelField(r, "Invalid type"); | ||
return -1; | ||
} | ||
} | ||
|
||
// ScriptAttributeUtility.GetFieldInfoFromProperty(property, out type); | ||
// if (type != (System.Type) null && type.IsEnum) | ||
// { | ||
// EditorGUI.BeginChangeCheck(); | ||
// int num = EditorGUI.EnumNamesCache.IsEnumTypeUsingFlagsAttribute(type) ? EditorGUI.EnumFlagsField(position, label, property.intValue, type, false, EditorStyles.popup) : EditorGUI.EnumPopupInternal(position, label, property.intValue, type, (Func<Enum, bool>) null, false, EditorStyles.popup); | ||
// if (!EditorGUI.EndChangeCheck()) | ||
// return; | ||
// System.Type enumUnderlyingType = type.GetEnumUnderlyingType(); | ||
// if (num < 0 && (enumUnderlyingType == typeof (uint) || enumUnderlyingType == typeof (ushort) || enumUnderlyingType == typeof (byte))) | ||
// property.longValue = (long) (uint) num; | ||
// else | ||
// property.intValue = num; | ||
// } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace DMotion.Editor | ||
{ | ||
public static class EditorLayoutUtils | ||
{ | ||
public static IEnumerable<Rect> HorizontalLayout(this Rect r, params float[] widths) | ||
{ | ||
if (widths.Length == 0) | ||
{ | ||
yield return r; | ||
} | ||
|
||
//normalize widths | ||
var sumWidths = widths.Sum(); | ||
for (var i = 0; i < widths.Length; i++) | ||
{ | ||
widths[i] /= sumWidths; | ||
} | ||
|
||
var spacing = EditorGUIUtility.standardVerticalSpacing; | ||
var current = r; | ||
current.width = r.width * widths[0]; | ||
yield return current; | ||
for (var i = 1; i < widths.Length; i++) | ||
{ | ||
var w = r.width* widths[i]; | ||
var prevW = r.width * widths[i - 1]; | ||
current.x += prevW + spacing; | ||
current.width = w - spacing; | ||
yield return current; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using UnityEditor; | ||
|
||
namespace DMotion.Editor | ||
{ | ||
public static class EditorSerializationUtils | ||
{ | ||
private const BindingFlags AllBindingFlags = (BindingFlags)(-1); | ||
|
||
public static TAttribute GetAttribute<TAttribute>(this SerializedProperty serializedProperty, | ||
bool inherit = true) | ||
where TAttribute : Attribute | ||
{ | ||
if (serializedProperty == null) | ||
{ | ||
throw new ArgumentNullException(nameof(serializedProperty)); | ||
} | ||
|
||
var targetObjectType = serializedProperty.serializedObject.targetObject.GetType(); | ||
|
||
if (targetObjectType == null) | ||
{ | ||
throw new ArgumentException($"Could not find the {nameof(targetObjectType)} of {nameof(serializedProperty)}"); | ||
} | ||
|
||
foreach (var pathSegment in serializedProperty.propertyPath.Split('.')) | ||
{ | ||
var fieldInfo = targetObjectType.GetField(pathSegment, AllBindingFlags); | ||
if (fieldInfo != null) | ||
{ | ||
return fieldInfo.GetCustomAttribute<TAttribute>(inherit); | ||
} | ||
|
||
var propertyInfo = targetObjectType.GetProperty(pathSegment, AllBindingFlags); | ||
if (propertyInfo != null) | ||
{ | ||
return propertyInfo.GetCustomAttribute<TAttribute>(inherit); | ||
} | ||
} | ||
|
||
throw new ArgumentException($"Could not find the field or property of {nameof(serializedProperty)}"); | ||
} | ||
public static IEnumerable<TAttribute> GetAttributes<TAttribute>(this SerializedProperty serializedProperty, bool inherit = true) | ||
where TAttribute : Attribute | ||
{ | ||
if (serializedProperty == null) | ||
{ | ||
throw new ArgumentNullException(nameof(serializedProperty)); | ||
} | ||
|
||
var targetObjectType = serializedProperty.serializedObject.targetObject.GetType(); | ||
|
||
if (targetObjectType == null) | ||
{ | ||
throw new ArgumentException($"Could not find the {nameof(targetObjectType)} of {nameof(serializedProperty)}"); | ||
} | ||
|
||
foreach (var pathSegment in serializedProperty.propertyPath.Split('.')) | ||
{ | ||
var fieldInfo = targetObjectType.GetField(pathSegment, AllBindingFlags); | ||
if (fieldInfo != null) | ||
{ | ||
return fieldInfo.GetCustomAttributes<TAttribute>(inherit); | ||
} | ||
|
||
var propertyInfo = targetObjectType.GetProperty(pathSegment, AllBindingFlags); | ||
if (propertyInfo != null) | ||
{ | ||
return propertyInfo.GetCustomAttributes<TAttribute>(inherit); | ||
} | ||
} | ||
|
||
throw new ArgumentException($"Could not find the field or property of {nameof(serializedProperty)}"); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.