From 64bb49fa4e3c8bd7e02fd6e5252e40f089d787de Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Jul 2021 20:17:34 +0200 Subject: Cleanup: Move reorganize asset files I'm trying to move away from general files with lots of things in them, and instead have many small & focused files. I find that easier to work with since everything has clear responsibilities, even if there is some minor overhead in managing all these files. I also try to differentiate more clearly between public and internal files. So source files and internal headers are in a `intern/` sub-directory, public functions are in a number of headers one level higher. For convenience and to make this compatible with our existing general headers in `editors/include`, I made the `ED_asset.h` there include all these public headers. This is of course a bit of an experiment, let's see how it works in practice. Also corrected the name of `ED_asset_can_make_single_from_context()`. --- source/blender/editors/asset/asset_edit.cc | 82 ------------------------------ 1 file changed, 82 deletions(-) delete mode 100644 source/blender/editors/asset/asset_edit.cc (limited to 'source/blender/editors/asset/asset_edit.cc') diff --git a/source/blender/editors/asset/asset_edit.cc b/source/blender/editors/asset/asset_edit.cc deleted file mode 100644 index c55e7a95120..00000000000 --- a/source/blender/editors/asset/asset_edit.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 -#include - -#include "BKE_asset.h" -#include "BKE_context.h" -#include "BKE_lib_id.h" - -#include "BLO_readfile.h" - -#include "DNA_ID.h" -#include "DNA_asset_types.h" -#include "DNA_space_types.h" - -#include "UI_interface_icons.h" - -#include "RNA_access.h" - -#include "ED_asset.h" - -using namespace blender; - -bool ED_asset_mark_id(const bContext *C, ID *id) -{ - if (id->asset_data) { - return false; - } - if (!BKE_id_can_be_asset(id)) { - return false; - } - - id_fake_user_set(id); - - id->asset_data = BKE_asset_metadata_create(); - - UI_icon_render_id(C, nullptr, id, ICON_SIZE_PREVIEW, true); - - /* Important for asset storage to update properly! */ - ED_assetlist_storage_tag_main_data_dirty(); - - return true; -} - -bool ED_asset_clear_id(ID *id) -{ - if (!id->asset_data) { - return false; - } - BKE_asset_metadata_free(&id->asset_data); - /* Don't clear fake user here, there's no guarantee that it was actually set by - * #ED_asset_mark_id(), it might have been something/someone else. */ - - /* Important for asset storage to update properly! */ - ED_assetlist_storage_tag_main_data_dirty(); - - return true; -} - -bool ED_asset_can_make_single_from_context(const bContext *C) -{ - /* Context needs a "id" pointer to be set for #ASSET_OT_mark()/#ASSET_OT_clear() to use. */ - return CTX_data_pointer_get_type_silent(C, "id", &RNA_ID).data != nullptr; -} -- cgit v1.2.3