Skip to content

Commit 2be2af8

Browse files
committed
Rename asset path preview flag
1 parent fad14bc commit 2be2af8

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

Source/PropertyAttributes/AssetPathAttribute.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public class AssetPathAttribute : PropertyAttribute
2424
public bool ResourcesRelative { get; private set; }
2525

2626
/// <summary>
27-
/// Show full path in the PropertyDrawer, not just the ObjectField.
27+
/// Show asset path preview in the PropertyDrawer, not just the ObjectField.
2828
/// </summary>
29-
public bool ShowFullPath { get; private set; }
29+
public bool ShowPathPreview { get; private set; }
3030

3131
/// <summary>
3232
/// Flags a field to be inspected as an object picker where only the
@@ -42,7 +42,7 @@ public AssetPathAttribute(Type assetType, bool resourcesRelative)
4242
{
4343
AssetType = assetType;
4444
ResourcesRelative = resourcesRelative;
45-
ShowFullPath = false;
45+
ShowPathPreview = false;
4646
}
4747

4848
/// <summary>
@@ -55,14 +55,14 @@ public AssetPathAttribute(Type assetType, bool resourcesRelative)
5555
/// path will automatically be made relative to the resources directory
5656
/// and the extension will be removed.
5757
/// </param>
58-
/// <param name="showFullPath">
59-
/// Show full path in the PropertyDrawer, not just the ObjectField.
58+
/// <param name="showPathPreview">
59+
/// Show asset path preview in the PropertyDrawer, not just the ObjectField.
6060
/// </param>
61-
public AssetPathAttribute(Type assetType, bool resourcesRelative, bool showFullPath)
61+
public AssetPathAttribute(Type assetType, bool resourcesRelative, bool showPathPreview)
6262
{
6363
AssetType = assetType;
6464
ResourcesRelative = resourcesRelative;
65-
ShowFullPath = showFullPath;
65+
ShowPathPreview = showPathPreview;
6666
}
6767
}
6868
}

Source/PropertyDrawers/Editor/Drawers/AssetPathDrawer.cs

+7-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ namespace UnityForge.Editor
99
public class AssetPathDrawer : PropertyDrawer
1010
{
1111
private const string ResourcesFolderPath = "/Resources/";
12-
private const int ShownPathHeight = 16;
12+
private const int PathPreviewHeight = 16;
1313

1414
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
1515
{
1616
var assetPathAttribute = (AssetPathAttribute)attribute;
17-
if (assetPathAttribute.ShowFullPath)
17+
if (assetPathAttribute.ShowPathPreview)
1818
{
19-
position.height -= ShownPathHeight;
19+
position.height -= PathPreviewHeight;
2020
}
2121

2222
if (!IsPropertyTypeValid(property))
@@ -68,20 +68,19 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
6868
}
6969
}
7070

71-
if (assetPathAttribute.ShowFullPath)
71+
if (assetPathAttribute.ShowPathPreview)
7272
{
73-
position.y += ShownPathHeight;
73+
position.y += PathPreviewHeight;
7474
position = EditorGUI.PrefixLabel(position, new GUIContent(" Asset Path Preview"));
75-
7675
EditorGUI.LabelField(position, String.Format("\"{0}\"", assetPath));
7776
}
7877
}
7978

8079
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
8180
{
82-
if (IsPropertyTypeValid(property) && ((AssetPathAttribute)attribute).ShowFullPath)
81+
if (IsPropertyTypeValid(property) && ((AssetPathAttribute)attribute).ShowPathPreview)
8382
{
84-
return base.GetPropertyHeight(property, label) + ShownPathHeight;
83+
return base.GetPropertyHeight(property, label) + PathPreviewHeight;
8584
}
8685
else
8786
{

0 commit comments

Comments
 (0)