Add name restrictions based on proxy.

This commit is contained in:
Jean-Baptiste Perrier
2021-05-13 17:54:52 +02:00
parent 2065b949b0
commit 41905f9810

View File

@@ -118,11 +118,22 @@ namespace FlaxEditor.Modules
return false;
}
// Scripts cannot start with digit.
if (Char.IsDigit(shortName[0]))
if (item is NewItem ni)
{
hint = "Name cannot start with a digit.";
return false;
if (!ni.Proxy.IsFileNameValid(shortName))
{
hint = "Name does not follow " + ni.Proxy.Name + " name restrictions !";
return false;
}
}
else
{
var proxy = Editor.ContentDatabase.GetProxy(item);
if (proxy != null && !proxy.IsFileNameValid(shortName))
{
hint = "Name does not follow " + proxy.Name + " name restrictions !";
return false;
}
}
// Cache data