Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/asset/intern/asset_type.cc')
-rw-r--r--source/blender/editors/asset/intern/asset_type.cc62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/blender/editors/asset/intern/asset_type.cc b/source/blender/editors/asset/intern/asset_type.cc
new file mode 100644
index 00000000000..1b8e56974bf
--- /dev/null
+++ b/source/blender/editors/asset/intern/asset_type.cc
@@ -0,0 +1,62 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup edasset
+ */
+
+#include "BLI_utildefines.h"
+
+#include "DNA_userdef_types.h"
+
+#include "BKE_lib_id.h"
+
+#include "ED_asset_type.h"
+
+bool ED_asset_type_id_is_non_experimental(const ID *id)
+{
+ /* Remember to update #ED_ASSET_TYPE_IDS_NON_EXPERIMENTAL_UI_STRING and
+ * #asset_type_ids_non_experimental_as_filter_flags() with this! */
+ return ELEM(GS(id->name), ID_AC);
+}
+static int64_t asset_type_ids_non_experimental_as_filter_flags()
+{
+ return FILTER_ID_AC;
+}
+
+bool ED_asset_type_is_supported(const ID *id)
+{
+ if (!BKE_id_can_be_asset(id)) {
+ return false;
+ }
+
+ if (U.experimental.use_extended_asset_browser) {
+ /* The "Extended Asset Browser" experimental feature flag enables all asset types that can
+ * technically be assets. */
+ return true;
+ }
+
+ return ED_asset_type_id_is_non_experimental(id);
+}
+
+int64_t ED_asset_types_supported_as_filter_flags()
+{
+ if (U.experimental.use_extended_asset_browser) {
+ return FILTER_ID_ALL;
+ }
+
+ return asset_type_ids_non_experimental_as_filter_flags();
+}