You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fix crashes assigning invalid object types to Slate brushes. SPropertyEditorAsset now properly checks the custom classes filter before allowing an object to be set
[CL 2602073 by Matt Kuhlenschmidt in Main branch]
This commit is contained in:
committed by
matt.kuhlenschmidt@epicgames.com
parent
880db80d3d
commit
2f2100b2a4
+32
-6
@@ -516,12 +516,18 @@ FText SPropertyEditorAsset::OnGetToolTip() const
|
||||
void SPropertyEditorAsset::SetValue( const FAssetData& AssetData )
|
||||
{
|
||||
AssetComboButton->SetIsOpen(false);
|
||||
if(PropertyEditor.IsValid())
|
||||
{
|
||||
PropertyEditor->GetPropertyHandle()->SetValue(AssetData);
|
||||
}
|
||||
|
||||
OnSetObject.ExecuteIfBound(AssetData);
|
||||
bool bAllowedToSetBasedOnFilter = CanSetBasedOnCustomClasses( AssetData );
|
||||
|
||||
if( bAllowedToSetBasedOnFilter )
|
||||
{
|
||||
if(PropertyEditor.IsValid())
|
||||
{
|
||||
PropertyEditor->GetPropertyHandle()->SetValue(AssetData);
|
||||
}
|
||||
|
||||
OnSetObject.ExecuteIfBound(AssetData);
|
||||
}
|
||||
}
|
||||
|
||||
FPropertyAccess::Result SPropertyEditorAsset::GetValue( FObjectOrAssetData& OutValue ) const
|
||||
@@ -763,7 +769,7 @@ bool SPropertyEditorAsset::OnAssetDraggedOver( const UObject* InObject ) const
|
||||
if (!OnShouldFilterAsset.IsBound()
|
||||
|| !OnShouldFilterAsset.Execute(FAssetData(InObject)))
|
||||
{
|
||||
return true;
|
||||
return CanSetBasedOnCustomClasses( FAssetData(InObject) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,4 +856,24 @@ bool SPropertyEditorAsset::CanEdit() const
|
||||
return PropertyEditor.IsValid() ? !PropertyEditor->IsEditConst() : true;
|
||||
}
|
||||
|
||||
bool SPropertyEditorAsset::CanSetBasedOnCustomClasses( const FAssetData& InAssetData ) const
|
||||
{
|
||||
bool bAllowedToSetBasedOnFilter = true;
|
||||
if( CustomClassFilters.Num() > 0 )
|
||||
{
|
||||
bAllowedToSetBasedOnFilter = false;
|
||||
UClass* AssetClass = InAssetData.GetClass();
|
||||
for( const UClass* AllowedClass : CustomClassFilters )
|
||||
{
|
||||
if( AssetClass->IsChildOf( AllowedClass ) )
|
||||
{
|
||||
bAllowedToSetBasedOnFilter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bAllowedToSetBasedOnFilter;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
+3
@@ -242,6 +242,9 @@ private:
|
||||
|
||||
/** @return True if the property can be edited */
|
||||
bool CanEdit() const;
|
||||
|
||||
/** @return true if the passed in AssetData can be used to set the property based on the list of custom classes */
|
||||
bool CanSetBasedOnCustomClasses( const FAssetData& InAssetData ) const;
|
||||
private:
|
||||
|
||||
/** Main combobutton */
|
||||
|
||||
Reference in New Issue
Block a user