Add support for getter-only properties in blackboard selector access
This commit is contained in:
@@ -171,11 +171,13 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
tree.Select(typeNode);
|
tree.Select(typeNode);
|
||||||
if (addItems)
|
if (addItems)
|
||||||
{
|
{
|
||||||
var items = GenericEditor.GetItemsForType(type, type.IsClass, true);
|
var items = GenericEditor.GetItemsForType(type, type.IsClass, true, true);
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
if (typed && !typed.IsAssignableFrom(item.Info.ValueType))
|
if (typed && !typed.IsAssignableFrom(item.Info.ValueType))
|
||||||
continue;
|
continue;
|
||||||
|
if (item.Info.DeclaringType.Type == typeof(FlaxEngine.Object))
|
||||||
|
continue; // Skip engine internals
|
||||||
var itemPath = typePath + item.Info.Name;
|
var itemPath = typePath + item.Info.Name;
|
||||||
var node = new TreeNode
|
var node = new TreeNode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -247,8 +247,9 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="useProperties">True if use type properties.</param>
|
/// <param name="useProperties">True if use type properties.</param>
|
||||||
/// <param name="useFields">True if use type fields.</param>
|
/// <param name="useFields">True if use type fields.</param>
|
||||||
|
/// <param name="usePropertiesWithoutSetter">True if use type properties that have only getter method without setter method (aka read-only).</param>
|
||||||
/// <returns>The items.</returns>
|
/// <returns>The items.</returns>
|
||||||
public static List<ItemInfo> GetItemsForType(ScriptType type, bool useProperties, bool useFields)
|
public static List<ItemInfo> GetItemsForType(ScriptType type, bool useProperties, bool useFields, bool usePropertiesWithoutSetter = false)
|
||||||
{
|
{
|
||||||
var items = new List<ItemInfo>();
|
var items = new List<ItemInfo>();
|
||||||
|
|
||||||
@@ -264,7 +265,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
var showInEditor = attributes.Any(x => x is ShowInEditorAttribute);
|
var showInEditor = attributes.Any(x => x is ShowInEditorAttribute);
|
||||||
|
|
||||||
// Skip properties without getter or setter
|
// Skip properties without getter or setter
|
||||||
if (!p.HasGet || (!p.HasSet && !showInEditor))
|
if (!p.HasGet || (!p.HasSet && !showInEditor && !usePropertiesWithoutSetter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Skip hidden fields, handle special attributes
|
// Skip hidden fields, handle special attributes
|
||||||
|
|||||||
Reference in New Issue
Block a user