Merge branch 'PE-1.4' of https://github.com/plemsoft/FlaxEngine into plemsoft-PE-1.4

This commit is contained in:
Wojtek Figat
2022-10-29 11:15:36 +02:00
11 changed files with 149 additions and 11 deletions

View File

@@ -130,6 +130,10 @@ void AudioSource::Play()
{
// Request faster streaming update
Clip->RequestStreamingUpdate();
// PE: If we are looping and streaming also update streaming buffers.
if(_loop)
RequestStreamingBuffersUpdate();
}
}
else

View File

@@ -379,8 +379,27 @@ void AssetsCache::RegisterAssets(FlaxStorage* storage)
// Check if storage contains ID which has been already registered
if (FindAsset(e.ID, info))
{
#if PLATFORM_WINDOWS
//PE: Windows - if you start your project using a shortcut/VS commandline -project , and using a upper/lower drive letter, it could ruin your scene.
//PE: On windows case do not matter so...
if (storagePath.ToLower() != info.Path.ToLower())
{
LOG(Warning, "Founded duplicated asset \'{0}\'. Locations: \'{1}\' and \'{2}\'", e.ID, storagePath, info.Path);
duplicatedEntries.Add(i);
}
else
{
//PE: Remove from _registry so we can add it again later with the original ID, so we dont loose relations.
for (auto i = _registry.Begin(); i.IsNotEnd(); ++i)
{
if (i->Value.Info.Path.ToLower() == storagePath.ToLower())
_registry.Remove(i);
}
}
#else
LOG(Warning, "Founded duplicated asset \'{0}\'. Locations: \'{1}\' and \'{2}\'", e.ID, storagePath, info.Path);
duplicatedEntries.Add(i);
#endif
}
}

View File

@@ -215,7 +215,8 @@ bool String::IsANSI() const
bool result = true;
for (int32 i = 0; i < _length; i++)
{
if (_data[i] > 255)
//PE: Ansi is max 7 bit so...
if (_data[i] > 127)
{
result = false;
break;

View File

@@ -868,6 +868,23 @@ ScriptingObject* Scripting::TryFindObject(Guid id, MClass* type)
return result;
}
ScriptingObject* Scripting::TryFindObject(MClass* mclass)
{
if (mclass == nullptr)
return nullptr;
ScopeLock lock(_objectsLocker);
for (auto i = _objectsDictionary.Begin(); i.IsNotEnd(); ++i)
{
const auto obj = i->Value;
if(obj->GetClass() == mclass)
return obj;
}
return nullptr;
}
ScriptingObject* Scripting::FindObject(const MObject* managedInstance)
{
if (managedInstance == nullptr)

View File

@@ -144,6 +144,14 @@ public:
/// <returns>The found object or null if missing.</returns>
static ScriptingObject* FindObject(Guid id, MClass* type = nullptr);
/// <summary>
/// Tries to find the object by the given class.
/// </summary>
/// <returns>The found object or null if missing.</returns>
static ScriptingObject* TryFindObject(MClass* type = nullptr);
/// <summary>
/// Tries to find the object by the given identifier.
/// </summary>

View File

@@ -641,6 +641,7 @@ bool ModelTool::ImportDataAssimp(const char* path, ImportedModelData& data, Opti
aiProcess_JoinIdenticalVertices |
aiProcess_LimitBoneWeights |
aiProcess_Triangulate |
aiProcess_SortByPType | //PE: Added aiProcess_SortByPType so we can ignore meshes with non triangle faces.
aiProcess_GenUVCoords |
aiProcess_FindDegenerates |
aiProcess_FindInvalidData |

View File

@@ -1552,10 +1552,14 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options& op
int32 ModelTool::DetectLodIndex(const String& nodeName)
{
const int32 index = nodeName.FindLast(TEXT("LOD"));
int32 index = nodeName.FindLast(TEXT("LOD"));
if (index != -1)
{
int32 num;
//PE: Many models use LOD_0... to indentify LOD levels.
if (nodeName.Length() > 4 && nodeName[3] == '_')
index++;
if (!StringUtils::Parse(nodeName.Get() + index + 3, &num))
{
if (num >= 0 && num < MODEL_MAX_LODS)