Fixed performance issue in scripts editor when multiple attributes are applied onto script fields
This commit is contained in:
parent
349f4a875b
commit
a3fe98317d
|
@ -414,19 +414,10 @@ namespace SHADE
|
|||
generic<typename Attribute>
|
||||
Attribute Editor::hasAttribute(System::Reflection::FieldInfo^ field)
|
||||
{
|
||||
array<System::Object^>^ attributes = field->GetCustomAttributes(true);
|
||||
for each (System::Object^ attrib in attributes)
|
||||
array<System::Object^>^ attributes = field->GetCustomAttributes(Attribute::typeid, false);
|
||||
if (attributes->Length > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Attribute attribute = safe_cast<Attribute>(attrib);
|
||||
if (attribute != nullptr)
|
||||
return attribute;
|
||||
}
|
||||
catch (System::InvalidCastException^)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return safe_cast<Attribute>(attributes[0]);
|
||||
}
|
||||
// Failed to find
|
||||
return Attribute{};
|
||||
|
|
Loading…
Reference in New Issue