{"id":290,"date":"2025-07-13T22:33:00","date_gmt":"2025-07-13T22:33:00","guid":{"rendered":"https:\/\/www.thegames.dev\/?p=290"},"modified":"2025-07-13T22:33:00","modified_gmt":"2025-07-13T22:33:00","slug":"custom-asset-filtering-getassetfilter","status":"publish","type":"post","link":"https:\/\/www.thegames.dev\/?p=290","title":{"rendered":"Custom Asset Filtering (GetAssetFilter)"},"content":{"rendered":"\n<p>As of UE 5.5, there is GetAssetFilter, this is great to enforce custom filtering of assets you can&#8217;t really do via the UPROPERTY line. <br>One use case i saw recently is for a DataTable filters to allow child row types, which is not possible with the default meta.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\n  UPROPERTY(EditAnywhere, Category=&quot;Data&quot;, meta=(GetAssetFilter=&quot;MyTableRowsFilter&quot;))\n    TObjectPtr&lt;UDataTable&gt; MyDataTable;\n\n    UFUNCTION()\n    bool MyTableRowsFilter(const FAssetData&amp; AssetData);\n<\/pre><\/div>\n\n\n<p>The GetAssetFilter will go through all UObjects towards the outer object to find the matching function for example MyTableRowsFilters. Once found it will call this for filtering.<br><br>Heres an example filter i made<br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\nbool UMyObject::MyTableRowsFilter(const FAssetData&amp; AssetData)\n{\n    FString Parent = FParentDataTableRow::StaticStruct()-&gt;GetPathName();\n    static const FName RowStructureTagName(&quot;RowStructure&quot;);\n    FString RowStructure;\n    if (AssetData.GetTagValue&lt;FString&gt;(RowStructureTagName, RowStructure))\n    {\n        if (RowStructure == Parent)\n        {\n            return false;\n        }\n\n        \/\/ This is slow, but at the moment we don&#039;t have an alternative to the short struct name search\n        UScriptStruct* RowStruct = UClass::TryFindTypeSlow&lt;UScriptStruct&gt;(RowStructure);\n        if (RowStruct &amp;&amp; RowStruct-&gt;IsChildOf(FParentDataTableRow::StaticStruct()))\n        {\n            return false;\n        }\n    }\n    return true;\n}\n<\/pre><\/div>\n\n\n<p>This allows the picking of DataTables that are or inherits from FParentDataTableRow. Struct example below<br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: Relevant Code:; notranslate\" title=\"Relevant Code:\">\nUSTRUCT(BlueprintType)\nstruct FParentDataTableRow : public FTableRowBase\n{\n    GENERATED_BODY();\n\n    \n};\nUSTRUCT(BlueprintType)\nstruct FChildParentRow : public FParentDataTableRow\n{\n    GENERATED_BODY();\n\n};\n<\/pre><\/div>\n\n\n<p>This is not possible any other way than this. But this is not required for FDataTableRowHandle as it does handle child structs!!!!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As of UE 5.5, there is GetAssetFilter, this is great to enforce custom filtering of assets you can&#8217;t really do via the UPROPERTY line. One use case i saw recently is for a DataTable filters to allow child row types, which is not possible with the default meta. The GetAssetFilter will go through all UObjects <a href=\"https:\/\/www.thegames.dev\/?p=290\" class=\"more-link\">&#8230;<span class=\"screen-reader-text\">  Custom Asset Filtering (GetAssetFilter)<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-290","post","type-post","status-publish","format-standard","hentry","category-random-bits"],"rise-blocks_total_comments":0,"rise-blocks_categories":[{"term_id":20,"name":"Random Bits","slug":"random-bits","term_group":0,"term_taxonomy_id":20,"taxonomy":"category","description":"Random bits of useful stuff.","parent":0,"count":2,"filter":"raw","cat_ID":20,"category_count":2,"category_description":"Random bits of useful stuff.","cat_name":"Random Bits","category_nicename":"random-bits","category_parent":0}],"rise-blocks_excerpt":"As of UE 5.5, there is GetAssetFilter, this is great to enforce custom filtering of assets you can&#8217;t really do via the UPROPERTY line. One use case i saw recently is for a DataTable filters to allow child row types, which is not possible with the default meta. The GetAssetFilter will go through all UObjects towards the outer object to..","_links":{"self":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=290"}],"version-history":[{"count":1,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/290\/revisions"}],"predecessor-version":[{"id":291,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=\/wp\/v2\/posts\/290\/revisions\/291"}],"wp:attachment":[{"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thegames.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}