Use shorter, relative path for displaying Asset Tooltips.
This commit is contained in:
@@ -82,7 +82,7 @@ namespace FlaxEditor.Content
|
||||
{
|
||||
sb.Append("Type: ").Append(TypeName).AppendLine();
|
||||
sb.Append("Size: ").Append(Utilities.Utils.FormatBytesCount((int)new FileInfo(Path).Length)).AppendLine();
|
||||
sb.Append("Path: ").Append(Path).AppendLine();
|
||||
sb.Append("Path: ").Append(FlaxEditor.Utilities.Utils.GetAssetNamePathWithExt(Path)).AppendLine();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -357,6 +357,8 @@ namespace FlaxEditor.Content
|
||||
/// </summary>
|
||||
public virtual void UpdateTooltipText()
|
||||
{
|
||||
Editor.Log(FlaxEditor.Utilities.Utils.GetAssetNamePath(Path));
|
||||
|
||||
TooltipText = "Path: " + Path;
|
||||
}
|
||||
|
||||
|
||||
@@ -1018,15 +1018,28 @@ namespace FlaxEditor.Utilities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset name relative to the project root folder (without asset file extension)
|
||||
/// Gets the asset name relative to the project root folder (with asset file extension)
|
||||
/// </summary>
|
||||
/// <param name="path">The asset path.</param>
|
||||
/// <returns>The processed name path.</returns>
|
||||
public static string GetAssetNamePath(string path)
|
||||
///
|
||||
public static string GetAssetNamePathWithExt(string path)
|
||||
{
|
||||
var projectFolder = Globals.ProjectFolder;
|
||||
if (path.StartsWith(projectFolder))
|
||||
path = path.Substring(projectFolder.Length + 1);
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the asset name relative to the project root folder (without asset file extension)
|
||||
/// </summary>
|
||||
/// <param name="path">The asset path.</param>
|
||||
/// <returns>The processed name path.</returns>
|
||||
///
|
||||
public static string GetAssetNamePath(string path)
|
||||
{
|
||||
path = GetAssetNamePathWithExt(path);
|
||||
return StringUtils.GetPathWithoutExtension(path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user