Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.0 #160

Merged
merged 34 commits into from
Jul 26, 2021
Merged

1.2.0 #160

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a89c84e
delegate registry
quabug Mar 4, 2021
f776fe2
tests of delegate registry.
quabug Mar 4, 2021
a878358
hide tests out from essential package.
quabug Mar 4, 2021
3816975
add packages lock file
quabug Mar 4, 2021
fb197a6
able to ignore certain behavior node for testing purpose.
quabug Mar 5, 2021
95f881e
use `DelegateRegistry` replace `VariantRegistry`
quabug Mar 5, 2021
1b17445
declare variant interfaces to be covariant.
quabug Mar 5, 2021
a95f836
preserve delegate classes and methods.
quabug Mar 5, 2021
ab042b6
remove preserve from registered delegate method.
quabug Mar 5, 2021
dd95439
Merge branch 'master' into expression-variant
quabug Mar 21, 2021
15a388a
fix `SaveToLocalVariant`
quabug Mar 21, 2021
5ccfeb4
ignore tests
quabug Jul 18, 2021
cc2d673
ignore tests
quabug Jul 18, 2021
c07e885
integrate expression-evaluation by using DynamicExpresso
quabug Jul 22, 2021
70b54b0
fix building
quabug Jul 23, 2021
2e0bb51
SerializedVariant and its drawer
quabug Jul 25, 2021
2c5b8af
code generator of variant classes
quabug Jul 25, 2021
91eda8a
fix codegen of math types.
quabug Jul 25, 2021
8901e35
add missing dll files of DynamicExpresso
quabug Jul 25, 2021
1d33f0f
simplify component builder.
quabug Jul 25, 2021
58fbb1e
fix samples
quabug Jul 25, 2021
1875b8b
fix sample of variant
quabug Jul 26, 2021
897df7b
fix sample of character control
quabug Jul 26, 2021
1e6b87e
generate Assembly-CSharp.dll for samples.
quabug Jul 26, 2021
2601ea2
move samples and tests into sample package.
quabug Jul 26, 2021
ea98c1e
upgrade version of packages
quabug Jul 26, 2021
6cfc54f
update packages-locks
quabug Jul 26, 2021
7ee8819
make `Reset` optional.
quabug Jul 26, 2021
de3dbc9
fix samples
quabug Jul 26, 2021
c650b48
get object value from array of serialized property.
quabug Jul 26, 2021
7aeffba
add search bar for drawer of SerializeReference
quabug Jul 26, 2021
c17eb03
use behavior tree id as part of expression lambda id
quabug Jul 26, 2021
1b28496
update serialized behavior tree of sample.
quabug Jul 26, 2021
3f5c07a
fix unit test.
quabug Jul 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
get object value from array of serialized property.
  • Loading branch information
quabug committed Jul 26, 2021
commit c650b4890932c75ade469582786ad78af55eec23
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
var labelPosition = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
EditorGUI.LabelField(labelPosition, label);

IEnumerable<Func<Type, bool>> typeRestrictions = null;
try
{
typeRestrictions = GetAllBuiltInTypeRestrictions(property.GetPropertyField().fieldInfo);
}
catch
{
// ignored
}
var typeRestrictions = GetAllBuiltInTypeRestrictions(property.GetPropertyField().fieldInfo);

DrawSelectionButtonForManagedReference(property, position, typeRestrictions);

Expand Down
21 changes: 17 additions & 4 deletions Packages/essential/Dependencies/Attributes/Editor/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -34,12 +35,24 @@ public static bool IsReferencedArrayElement(this SerializedProperty property)
public static IEnumerable<(object field, FieldInfo fi)> GetFieldsByPath(this SerializedProperty property)
{
var obj = (object)property.serializedObject.targetObject;
yield return (obj, null);
FieldInfo fi = null;
yield return (obj, fi);
foreach (var fieldName in property.propertyPath.Split('.'))
{
var t = Field(obj, fieldName);
obj = t.field;
yield return t;
if (obj.GetType().IsArray)
{
if (fieldName == "Array") continue;
var itemIndex = int.Parse(fieldName.Substring(5 /*"data["*/, fieldName.Length - 6 /*"data[]"*/));
obj = ((Array) obj).GetValue(itemIndex);
yield return (obj, fi);
}
else
{
var t = Field(obj, fieldName);
obj = t.field;
fi = t.fi;
yield return t;
}
}

(object field, FieldInfo fi) Field(object @object, string fieldName)
Expand Down