Upd: Fixed C# script resolution bug, fixed object lookup for interfaces, fixed serialization bug.
This commit is contained in:
@@ -717,6 +717,12 @@ DEFINE_INTERNAL_CALL(MString*) ObjectInternal_GetTypeName(ScriptingObject* obj)
|
||||
return MUtils::ToString(obj->GetType().Fullname);
|
||||
}
|
||||
|
||||
FORCE_INLINE bool ObjectInternal_MatchesType(ScriptingObject* obj, MClass* klass)
|
||||
{
|
||||
return !klass ||
|
||||
(klass->IsInterface() ? obj->GetClass()->HasInterface(klass) : obj->Is(klass));
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_FindObject(Guid* id, MTypeObject* type, bool skipLog = false)
|
||||
{
|
||||
if (!id->IsValid())
|
||||
@@ -732,7 +738,7 @@ DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_FindObject(Guid* id, MTypeObject*
|
||||
}
|
||||
if (obj)
|
||||
{
|
||||
if (klass && !obj->Is(klass))
|
||||
if (!ObjectInternal_MatchesType(obj, klass))
|
||||
{
|
||||
if (!skipLog)
|
||||
{
|
||||
@@ -762,7 +768,7 @@ DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_FindObject(Guid* id, MTypeObject*
|
||||
DEFINE_INTERNAL_CALL(MObject*) ObjectInternal_TryFindObject(Guid* id, MTypeObject* type)
|
||||
{
|
||||
ScriptingObject* obj = Scripting::TryFindObject(*id);
|
||||
if (obj && !obj->Is(MUtils::GetClass(type)))
|
||||
if (obj && !ObjectInternal_MatchesType(obj, MUtils::GetClass(type)))
|
||||
obj = nullptr;
|
||||
return obj ? obj->GetOrCreateManagedInstance() : nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user