Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
4fc42e5
Update dependencies
Proton-V Aug 30, 2022
6d7ea14
Add base SearchInspector classes
Proton-V Aug 31, 2022
4bfc451
Add demo scene && scripts
Proton-V Aug 31, 2022
eb42db5
Add SearchCacheObj data struct
Proton-V Aug 31, 2022
b79d118
Add settings object && update namespaces
Proton-V Sep 4, 2022
bf1db07
Update SearchInspectorCache logic
Proton-V Sep 4, 2022
9f061df
Add package manifest
Proton-V Sep 4, 2022
f4b6d98
Merge pull request #1 from Proton-V/feature/base-logic
Proton-V Sep 4, 2022
f8db889
Update package manifest
Proton-V Sep 4, 2022
858ea6c
Move "Demo" folder to assets
Proton-V Sep 4, 2022
c6017a6
Merge pull request #2 from Proton-V/hotfix/update-package-manifest
Proton-V Sep 4, 2022
a00a3c0
Update "Demo" folder name
Proton-V Sep 4, 2022
e0e284a
Merge pull request #3 from Proton-V/hotfix/demo-folder-name
Proton-V Sep 4, 2022
fada08a
Move files && update gitignore
Proton-V Sep 4, 2022
a4c7866
Merge pull request #4 from Proton-V/hotfix/update-gitignore
Proton-V Sep 4, 2022
98bea4b
Update logic && add global .gitignore
Proton-V Sep 4, 2022
3903c1a
Update gitignore
Proton-V Sep 4, 2022
c8e7ed0
Update FieldSearchSettings
Proton-V Sep 4, 2022
fca8dc0
Merge pull request #5 from Proton-V/feature/add-global-gitignore
Proton-V Sep 4, 2022
8bf73b8
Move gitignore file
Proton-V Sep 4, 2022
b4ba35f
Merge pull request #6 from Proton-V/hotfix/gitignore-path
Proton-V Sep 4, 2022
5d1ecdb
Delete applicationhost.config
Proton-V Sep 4, 2022
65e0b4c
Merge pull request #7 from Proton-V/hotfix/remove-unused-vs-config
Proton-V Sep 4, 2022
f97f927
Update README.md
Proton-V Sep 5, 2022
8eb04a2
Update HasResult method in ByObjName criterion
Proton-V Sep 5, 2022
24e01f4
Merge pull request #8 from Proton-V/hotfix/error-processing-ByObjName…
Proton-V Sep 5, 2022
15341a2
Merge pull request #9 from Proton-V/develop
Proton-V Sep 5, 2022
063425d
Update README.md
Proton-V Sep 5, 2022
17a7402
Update SearchInspector base
Proton-V Sep 29, 2022
3e512e5
Update project settings
Proton-V Sep 29, 2022
3179de7
Update Dictionary to ConcurrentDictionary for cache class
Proton-V Sep 29, 2022
768b535
Add ShowSettings menu item && validate func
Proton-V Sep 29, 2022
c2edd47
Add TypeRefDropdown attribute && drawer
Proton-V Sep 29, 2022
a88510c
Fix ShowSettings menu item
Proton-V Sep 29, 2022
0bff43b
Update search criteria
Proton-V Sep 29, 2022
a9e64c4
Merge pull request #10 from Proton-V/feature/update-base-searchInspector
Proton-V Sep 29, 2022
e42399d
Add base class for SampleSearchableMonoBehaviour
Proton-V Sep 29, 2022
217d684
Update demo scene
Proton-V Sep 29, 2022
4a88a54
Merge pull request #11 from Proton-V/feature/update-demo-folder
Proton-V Sep 29, 2022
7a363c0
Remove ref flags for criteria
Proton-V Oct 3, 2022
123570c
Merge pull request #13 from Proton-V/feature/remove-ref-flags
Proton-V Oct 3, 2022
510984b
Add new abstract FieldSearchGlobalEditor
Proton-V Oct 5, 2022
0c9160b
Add base CodeGeneration classes
Proton-V Oct 6, 2022
54a0f9e
Separate Attributes assembly
Proton-V Oct 6, 2022
a1d5daf
Separate GlobalEditor assembly
Proton-V Oct 6, 2022
b2ae36c
Add base EditorScriptGenerator classes
Proton-V Oct 6, 2022
4b708c9
Add CodeGeneratorType to Settings
Proton-V Oct 7, 2022
b039ad9
Add BaseFieldSearchSettings
Proton-V Oct 7, 2022
e48725b
Add EditorScriptGeneratorWindow
Proton-V Oct 7, 2022
5cff052
Update ForceReserializeAssets call in EditorScriptGeneration
Proton-V Oct 7, 2022
053b32f
Update TypeRefDropdown Attribute
Proton-V Oct 7, 2022
49bd61b
Update global gitignore
Proton-V Oct 7, 2022
f3473b5
Update EditorScriptGeneratorWindow
Proton-V Oct 10, 2022
c34d180
Update gitignore.global
Proton-V Oct 10, 2022
51d5b64
Update "Add default settings" Func
Proton-V Oct 10, 2022
4f5b40a
Update missing default properties for new settings
Proton-V Oct 10, 2022
0cc403d
Update EditorScriptGeneratorWindow exit logic
Proton-V Oct 11, 2022
213e42c
Add GetAttributeFieldByName method
Proton-V Oct 11, 2022
93276af
Update DefaultEditorScriptTemplate
Proton-V Oct 11, 2022
ae002e1
Merge pull request #14 from Proton-V/feature/code-generation
Proton-V Oct 11, 2022
5566f6c
Update README.md
Proton-V Oct 11, 2022
a5cd7dc
Update package version to 1.0.2
Proton-V Oct 11, 2022
3e18f89
Merge pull request #15 from Proton-V/develop
Proton-V Oct 11, 2022
ae53abf
Update README.md
Proton-V Oct 11, 2022
3eebc0a
Add GeneratedSearchLayerInspector
Proton-V Oct 13, 2022
1483fc7
Add GeneratedFieldSearchGlobalEditor
Proton-V Oct 13, 2022
22005e5
Update TypeRef Attribute
Proton-V Oct 13, 2022
313f31b
Remove unused lines
Proton-V Oct 13, 2022
6be0e76
Update package version to 1.0.3
Proton-V Oct 13, 2022
7c4bc65
Merge pull request #16 from Proton-V/hotfix/fix-generated-scripts-ins…
Proton-V Oct 13, 2022
bbe2718
Update README.md
Proton-V Oct 13, 2022
f57ad99
Merge pull request #17 from Proton-V/develop
Proton-V Oct 13, 2022
4931cdb
Update summaries for all classes
Proton-V Nov 8, 2022
08614a0
Add docs generated by Doxygen
Proton-V Nov 8, 2022
3332827
Update README.md
Proton-V Nov 8, 2022
5be7d6d
Merge pull request #18 from Proton-V/feature/add-docs
Proton-V Nov 8, 2022
7acc461
Delete docs folder
Proton-V Nov 9, 2022
e9098bc
Merge pull request #20 from Proton-V/hotfix/delete-docs-folder
Proton-V Nov 9, 2022
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
34 changes: 19 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
*/[Ll]ibrary/
*/[Tt]emp/
*/[Oo]bj/
*/[Bb]uild/
*/[Bb]uilds/
*/[Ll]ogs/
*/[Uu]ser[Ss]ettings/

# FieldSearchConfigs
**/[Ff]ield[Ss]earch[Cc]onfigs/
[Ff]ield[Ss]earch[Cc]onfigs.meta

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
*/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/
*/[Rr]ecordings/

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
*/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/
*/.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
*/ExportedObj/
.consulo/
*.csproj
*.unityproj
Expand Down Expand Up @@ -61,8 +65,8 @@ sysinfo.txt
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
*/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
*/[Aa]ssets/[Ss]treamingAssets/aa.meta
*/[Aa]ssets/[Ss]treamingAssets/aa/*
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions FieldSearch/Assembly-CSharp.csproj.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Scenes.meta → FieldSearch/Assets.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FieldSearch/Assets/FieldSearch.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FieldSearch/Assets/FieldSearch/Attributes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FieldSearch/Assets/FieldSearch/Attributes/Drawers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace FieldSearch.Attributes.Drawers
{
/// <summary>
/// Drawer for <see cref="TypeRefDropdownAttribute"/>
/// </summary>
[CustomPropertyDrawer(typeof(TypeRefDropdownAttribute))]
public class TypeRefDropdownAttributeDrawer : PropertyDrawer
{
TypeRefDropdownAttribute target;

int currentTypeIndex;
GUIContent[] displayedOptions;

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (target == null)
{
Init(property);
return;
}

EditorGUI.BeginProperty(position, label, property);
ShowDropDownTypeList(position, property, label);
EditorGUI.EndProperty();
}

private void ShowDropDownTypeList(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginChangeCheck();
currentTypeIndex = EditorGUI.Popup(position, label, currentTypeIndex, displayedOptions);
if (EditorGUI.EndChangeCheck())
{
property.stringValue = target.InheritedTypeNameArray[currentTypeIndex];
property.serializedObject.ApplyModifiedProperties();
property.serializedObject.Update();
}
}

/// <summary>
/// First Init call
/// </summary>
/// <param name="property"></param>
private void Init(SerializedProperty property)
{
target = attribute as TypeRefDropdownAttribute;
currentTypeIndex = Array.IndexOf(target.InheritedTypeNameArray, property.stringValue);

if (currentTypeIndex < 0)
{
Debug.LogWarning($"Type Index can't found for {property.displayName}");
currentTypeIndex = 0;
}

displayedOptions = target.ShortInheritedTypeNameArray.Select(x => new GUIContent(x)).ToArray();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "FieldSearch.Attributes",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions FieldSearch/Assets/FieldSearch/Attributes/TypeComparer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;

namespace FieldSearch.Attributes
{
/// <summary>
/// Type comparer.
/// Used in <see cref="TypeRefDropdownAttribute"/>
/// </summary>
public class TypeComparer : IComparer<Type>
{
public int Compare(Type x, Type y)
{
return x.Name.CompareTo(y.Name);
}
}
}
11 changes: 11 additions & 0 deletions FieldSearch/Assets/FieldSearch/Attributes/TypeComparer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;

namespace FieldSearch.Attributes
{
/// <summary>
/// Dropdown list attribute for type, inherited from BaseType
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class TypeRefDropdownAttribute : PropertyAttribute
{
public TypeRefDropdownAttribute(Type baseType, params string[] ignoredNamespaces)
{
BaseType = baseType;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
var types = GetInheritedTypes(BaseType, assemblies)
.Where(x => !x.IsAbstract
&& !ignoredNamespaces.Contains(x.Namespace));

InheritedTypeNameArray = types.Select(x => x.AssemblyQualifiedName).ToArray();
ShortInheritedTypeNameArray = types.Select(x => x.Name).ToArray();
}

/// <summary>
/// Base type
/// </summary>
public Type BaseType { get; private set; }

/// <summary>
/// Array with Type.AssemblyQualifiedName
/// </summary>
public string[] InheritedTypeNameArray { get; private set; }

/// <summary>
/// Array with Type.Name
/// </summary>
public string[] ShortInheritedTypeNameArray { get; private set; }

/// <summary>
/// Get all Inherited from <paramref name="baseType"/> Types
/// </summary>
/// <param name="baseType"></param>
/// <param name="assemblies"></param>
/// <returns></returns>
public static List<Type> GetInheritedTypes(Type baseType, params Assembly[] assemblies)
{
List<Type> types = new List<Type>();
foreach (Type type in
assemblies.SelectMany(x => x.GetTypes())
.Where(x => x.IsSubclassOf(baseType)
&& x.IsClass))
{
types.Add(type);
}
types.Sort(new TypeComparer());

return types;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FieldSearch/Assets/FieldSearch/CodeGeneration.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions FieldSearch/Assets/FieldSearch/CodeGeneration/Base.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using UnityEngine;

namespace CodeGeneration.Base
{
/// <summary>
/// Base class for custom CodeGenerator
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class BaseCodeGenerator<T> where T : BaseScriptTemplate
{
protected BaseCodeGenerator(BaseCodeGeneratorSettings<T> settings)
{
_settings = settings;
}

[SerializeField]
protected BaseCodeGeneratorSettings<T> _settings;

/// <summary>
/// Create scripts using <paramref name="scriptTemplate"/>
/// </summary>
/// <param name="scriptTemplate"></param>
/// <param name="refresh"></param>
/// <param name="inputTypes"></param>
public abstract void CreateScripts(T scriptTemplate, bool refresh = true, params Type[] inputTypes);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading