Skip to content

Commit a07a3e9

Browse files
authored
Merge pull request #120 from arimger/develop
Develop - 0.13.2
2 parents 625cdcf + b45cb0f commit a07a3e9

File tree

56 files changed

+596
-203
lines changed

Some content is hidden

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

56 files changed

+596
-203
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,39 @@ on:
66

77
env:
88
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
9+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
10+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
911

1012
jobs:
11-
testRunner:
12-
name: Test all modes 📝
13+
testAllModes:
14+
name: Test in '${{ matrix.testMode }}' 📝
1315
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
testMode:
20+
- playmode
21+
- editmode
22+
- standalone
1423
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v2
17-
18-
- name: Create LFS file list
19-
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
20-
21-
- name: Restore LFS cache
22-
uses: actions/cache@v2
23-
id: lfs-cache
24+
- uses: actions/checkout@v4
2425
with:
25-
path: .git/lfs
26-
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
27-
28-
- name: Git LFS Pull
29-
run: |
30-
git lfs pull
31-
git add .
32-
git reset --hard
33-
34-
- name: Restore Library cache
35-
uses: actions/cache@v2
26+
lfs: true
27+
- uses: actions/cache@v3
3628
with:
3729
path: Library
3830
key: Library-test-project
3931
restore-keys: |
4032
Library-test-project-
4133
Library-
42-
43-
- uses: game-ci/unity-test-runner@v2
44-
id: testRunner
34+
- uses: game-ci/unity-test-runner@v4
35+
id: tests
4536
with:
46-
testMode: all
47-
48-
- uses: actions/upload-artifact@v2
37+
testMode: ${{ matrix.testMode }}
38+
artifactsPath: ${{ matrix.testMode }}-artifacts
39+
checkName: ${{ matrix.testMode }} Test Results
40+
- uses: actions/upload-artifact@v3
41+
if: always()
4942
with:
50-
name: Test results (all modes)
51-
path: ${{ steps.testRunner.outputs.artifactsPath }}
43+
name: Test results for ${{ matrix.testMode }}
44+
path: ${{ steps.tests.outputs.artifactsPath }}

Assets/Editor Toolbox/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 0.13.2 [29.11.2024]
2+
3+
### Added:
4+
- AnimationCurveSettingsAttribute
5+
6+
### Changed:
7+
- Possibility to use [EditorButton] and [DynamicHelp] in nested types
8+
- For now SerializeReference properties without children will always be folded
9+
- Fix exception while building labels for generic types without arguments
10+
- Fix drawing SerializedDictionary if value or key types cannot be serialized
11+
112
## 0.13.1 [30.08.2024]
213

314
### Changed:

Assets/Editor Toolbox/Editor/Drawers/Helpers/Extraction/ValueExtractionHelper.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
43
using UnityEditor;
54

65
namespace Toolbox.Editor.Drawers
@@ -68,14 +67,8 @@ public static bool TryGetValue(string source, SerializedProperty causer, out obj
6867

6968
public static bool TryGetValue(string source, SerializedProperty causer, out object value, out bool hasMixedValues, Func<object, object, bool> nextValuesComparer)
7069
{
71-
var targetObjects = causer.serializedObject.targetObjects;
72-
var parentObjects = new object[targetObjects.Length];
73-
for (var i = 0; i < targetObjects.Length; i++)
74-
{
75-
var targetObject = targetObjects[i];
76-
parentObjects[i] = causer.GetDeclaringObject(targetObject);
77-
}
78-
70+
//NOTE: consider using NonAlloc implementation
71+
var parentObjects = causer.GetDeclaringObjects();
7972
return TryGetValue(source, parentObjects, out value, out hasMixedValues, nextValuesComparer);
8073
}
8174
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Reflection;
3+
using UnityEditor;
4+
5+
namespace Toolbox.Editor.Drawers
6+
{
7+
public interface ISerializedPropertyContext
8+
{
9+
SerializedProperty Property { get; }
10+
FieldInfo FieldInfo { get; }
11+
Type Type { get; }
12+
}
13+
}

Assets/Editor Toolbox/Editor/ToolboxDrawerModule.cs.meta renamed to Assets/Editor Toolbox/Editor/Drawers/ISerializedPropertyContext.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace Toolbox.Editor.Drawers
5+
{
6+
[CustomPropertyDrawer(typeof(AnimationCurveSettingsAttribute))]
7+
public class AnimationCurveSettingsAttributeDrawer : PropertyDrawerBase
8+
{
9+
protected override void OnGUISafe(Rect position, SerializedProperty property, GUIContent label)
10+
{
11+
var attribute = Attribute;
12+
var curveRanges = new Rect(
13+
attribute.Min.x,
14+
attribute.Min.y,
15+
attribute.Max.x - attribute.Min.x,
16+
attribute.Max.y - attribute.Min.y);
17+
18+
var color = attribute.Color;
19+
20+
EditorGUI.BeginProperty(position, label, property);
21+
EditorGUI.CurveField(position, property, color, curveRanges, label);
22+
EditorGUI.EndProperty();
23+
}
24+
25+
public override bool IsPropertyValid(SerializedProperty property)
26+
{
27+
return base.IsPropertyValid(property) && property.propertyType == SerializedPropertyType.AnimationCurve;
28+
}
29+
30+
private AnimationCurveSettingsAttribute Attribute => attribute as AnimationCurveSettingsAttribute;
31+
}
32+
}

Assets/Editor Toolbox/Editor/Drawers/Regular/AnimationCurveSettingsAttributeDrawer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Editor Toolbox/Editor/Drawers/Regular/AssetPreviewAttributeDrawer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,13 @@ protected override void OnGUISafe(Rect position, SerializedProperty property, GU
9999
}
100100
}
101101

102-
103102
public override bool IsPropertyValid(SerializedProperty property)
104103
{
105104
return property.propertyType == SerializedPropertyType.ObjectReference;
106105
}
107106

108-
109107
private AssetPreviewAttribute Attribute => attribute as AssetPreviewAttribute;
110108

111-
112109
private static class Style
113110
{
114111
internal static readonly float offset = 6.0f;

Assets/Editor Toolbox/Editor/Drawers/Regular/PropertyDrawerBase.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ protected virtual void OnGUISafe(Rect position, SerializedProperty property, GUI
2626
EditorGUI.PropertyField(position, property, label);
2727
}
2828

29-
3029
/// <summary>
3130
/// Native call to return the expected height.
3231
/// </summary>
33-
public override sealed float GetPropertyHeight(SerializedProperty property, GUIContent label)
32+
public sealed override float GetPropertyHeight(SerializedProperty property, GUIContent label)
3433
{
3534
return IsPropertyValid(property)
3635
? GetPropertyHeightSafe(property, label)
@@ -40,22 +39,20 @@ public override sealed float GetPropertyHeight(SerializedProperty property, GUIC
4039
/// <summary>
4140
/// Native call to draw the provided property.
4241
/// </summary>
43-
public override sealed void OnGUI(Rect position, SerializedProperty property, GUIContent label)
42+
public sealed override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
4443
{
4544
if (IsPropertyValid(property))
4645
{
4746
OnGUISafe(position, property, label);
4847
return;
4948
}
5049

51-
var warningContent = new GUIContent(property.displayName + " has invalid property drawer");
52-
//create additional warning log to the console window
5350
ToolboxEditorLog.WrongAttributeUsageWarning(attribute, property);
5451
//create additional warning label based on the property name
52+
var warningContent = new GUIContent(property.displayName + " has invalid property drawer");
5553
ToolboxEditorGui.DrawEmptyProperty(position, property, warningContent);
5654
}
5755

58-
5956
/// <summary>
6057
/// Checks if provided property can be properly handled by this drawer.
6158
/// </summary>

Assets/Editor Toolbox/Editor/Drawers/Toolbox/Decorator/DynamicHelpAttributeDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class DynamicHelpAttributeDrawer : ToolboxDecoratorDrawer<DynamicHelpAttr
88
protected override void OnGuiBeginSafe(DynamicHelpAttribute attribute)
99
{
1010
var sourceHandle = attribute.SourceHandle;
11-
var targetObjects = ToolboxEditorHandler.CurrentTargetObjects;
11+
var targetObjects = GetDeclaringObjects();
1212
if (ValueExtractionHelper.TryGetValue(sourceHandle, targetObjects, out var value, out var hasMixedValues))
1313
{
1414
var messageText = hasMixedValues ? "-" : value?.ToString();

0 commit comments

Comments
 (0)