diff options
Diffstat (limited to 'Assets/ActionTool/Editor')
-rw-r--r-- | Assets/ActionTool/Editor/ActionEventEditor.cs | 87 | ||||
-rw-r--r-- | Assets/ActionTool/Editor/ActionPreviewEditor.cs | 12 |
2 files changed, 77 insertions, 22 deletions
diff --git a/Assets/ActionTool/Editor/ActionEventEditor.cs b/Assets/ActionTool/Editor/ActionEventEditor.cs index 50b697e4..0fd9ea22 100644 --- a/Assets/ActionTool/Editor/ActionEventEditor.cs +++ b/Assets/ActionTool/Editor/ActionEventEditor.cs @@ -93,6 +93,7 @@ namespace ActionTool string name = field.Name + " (" + field.FieldType.Name + ")";
string tooltip = "";
bool skip = false;
+ bool isHDR = false;
foreach (var attr in field.GetCustomAttributes())
{
if(attr.GetType() == typeof(TooltipAttribute))
@@ -109,16 +110,27 @@ namespace ActionTool }
else if (attr.GetType() == typeof(WhenAttribute))
{
- WhenAttribute when = attr as WhenAttribute;
- string conditionName = when.conditionName;
- FieldInfo condition = type.GetField(conditionName);
- if ((int)condition.GetValue(animEvent) != when.value)
- {
- skip = true;
- break;
- }
- }
- else if (attr.GetType() == typeof(WhenNotAttribute))
+ WhenAttribute when = attr as WhenAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if (!when.IsSatisfied((int)condition.GetValue(animEvent)))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(AndWhenAttribute))
+ {
+ AndWhenAttribute when = attr as AndWhenAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if (!when.IsSatisfied((int)condition.GetValue(animEvent)))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(WhenNotAttribute))
{
WhenNotAttribute when = attr as WhenNotAttribute;
string conditionName = when.conditionName;
@@ -156,12 +168,16 @@ namespace ActionTool SpaceAttribute space = attr as SpaceAttribute;
GUILayout.Space(space.height);
}
- else if (attr.GetType() == typeof(CommentAttribute))
- {
- CommentAttribute comment = attr as CommentAttribute;
- EditorGUILayout.LabelField(comment.comment);
- }
- else if (attr.GetType() == typeof(WhenAttribute))
+ else if (attr.GetType() == typeof(CommentAttribute))
+ {
+ CommentAttribute comment = attr as CommentAttribute;
+ GUIStyle style = GUI.skin.GetStyle("Label");
+ TextAnchor preanchor = style.alignment;
+ style.alignment = comment.alignment;
+ GUI_Label(new GUIContent(comment.comment), style);
+ style.alignment = preanchor;
+ }
+ else if (attr.GetType() == typeof(WhenAttribute))
{
WhenAttribute when = attr as WhenAttribute;
string conditionName = when.conditionName;
@@ -205,6 +221,10 @@ namespace ActionTool break;
}
}
+ else if(attr.GetType() == typeof(HDRAttribute))
+ {
+ isHDR = true;
+ }
}
if (skip)
{
@@ -244,14 +264,31 @@ namespace ActionTool {
field.SetValue(animEvent, GUI_Int((int)field.GetValue(animEvent)));
}
- GUILayout.Space(5);
+ else if(field.FieldType == typeof(Color))
+ {
+ if(isHDR)
+ {
+ field.SetValue(animEvent, GUI_ColorHDR((Color)field.GetValue(animEvent)));
+ }
+ else
+ {
+ field.SetValue(animEvent, GUI_Color((Color)field.GetValue(animEvent)));
+ }
+ }
+ GUILayout.Space(5);
}
}
EditorGUILayout.EndScrollView();
}
- float GUI_Float(float value)
+ void GUI_Label(GUIContent label, GUIStyle style)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ EditorGUI.LabelField(rect, label, style);
+ }
+
+ float GUI_Float(float value)
{
Rect rect = EditorGUILayout.GetControlRect();
return EditorGUI.FloatField(rect, "", value);
@@ -299,5 +336,17 @@ namespace ActionTool return GUI.Toggle(rect, value, "Check");
}
- }
+ Color GUI_Color(Color col)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ return EditorGUI.ColorField(rect, col);
+ }
+
+ Color GUI_ColorHDR(Color col)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ return EditorGUI.ColorField(rect, new GUIContent(""), col, true, true, true);
+ }
+
+ }
}
\ No newline at end of file diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index 5bb2e435..73b01857 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -292,7 +292,10 @@ namespace ActionTool "Frame Count: " + rootMotion.frameCount
);
}
- }
+ if (GUI.Button(new Rect(xr + width + 10 + 60, y, 60, 15), "Override"))
+ {
+ }
+ }
else
{
GUI.Label(new Rect(xr, y, 100, 15), "None", styles.textMiddleBold);
@@ -388,8 +391,11 @@ namespace ActionTool {
ActionData action = ActionManager.actionData;
- float x = 5;
- action.applyRootMotion = GUI.Toggle(new Rect(x, y, 120, 15), action.applyRootMotion, "Apply RootMotion", styles.toggleSmallBold);
+ Rect bgRect = new Rect(3, y - 4, position.width - 6, 15 + 8);
+ EditorGUI.DrawRect(bgRect, new Color32(65, 65, 65, 255));
+
+ float x = 5;
+ action.applyRootMotion = GUI.Toggle(new Rect(x, y, 120, 15), action.applyRootMotion, "Apply RootMotion", styles.toggleSmallBold);
x += 130;
action.applyCurve = GUI.Toggle(new Rect(x, y, 120, 15), action.applyCurve, "Apply SpeedCurve", styles.toggleSmallBold);
x += 130;
|