Blender
V3.3
|
#include "BKE_asset_library.hh"
#include "BKE_bpath.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_preferences.h"
#include "BKE_report.h"
#include "BLI_fileops.h"
#include "BLI_fnmatch.h"
#include "BLI_path_util.h"
#include "BLI_set.hh"
#include "ED_asset.h"
#include "ED_asset_catalog.hh"
#include "ED_screen.h"
#include "ED_util.h"
#include "ED_fileselect.h"
#include "BLT_translation.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "WM_api.h"
#include "DNA_space_types.h"
#include "BLO_writefile.h"
Go to the source code of this file.
Classes | |
struct | IDVecStats |
class | AssetMarkHelper |
class | AssetClearHelper |
struct | FileCheckCallbackInfo |
Typedefs | |
using | PointerRNAVec = blender::Vector< PointerRNA > |
using PointerRNAVec = blender::Vector<PointerRNA> |
Definition at line 44 of file asset_ops.cc.
|
static |
Definition at line 722 of file asset_ops.cc.
References BKE_report(), BKE_reportf(), BLI_assert_msg, BLI_path_basename(), C, CTX_data_main(), FILE_MAX, Main::filepath, get_catalog_service(), has_external_files(), is_contained_in_selected_asset_library(), len, lib, OPERATOR_CANCELLED, OPERATOR_FINISHED, PATH_MAX, blender::bke::AssetCatalogService::prepare_to_merge_on_write(), wmOperator::ptr, wmOperator::reports, RNA_string_get(), RPT_ERROR, RPT_INFO, selected_asset_library(), blender::bke::AssetCatalogService::undo(), blender::bke::AssetCatalogService::undo_push(), WM_cursor_wait(), WM_OP_EXEC_DEFAULT, and WM_operator_name_call().
Referenced by ASSET_OT_bundle_install().
|
static |
Definition at line 703 of file asset_ops.cc.
References C, CTX_data_main(), has_external_files(), OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, wmOperator::reports, set_filepath_for_asset_lib(), and WM_event_add_fileselect().
Referenced by ASSET_OT_bundle_install().
Definition at line 677 of file asset_ops.cc.
References BKE_preferences_asset_library_containing_path(), C, could_be_asset_bundle(), CTX_data_main(), CTX_wm_space_file(), ED_fileselect_is_local_asset_library(), and Main::filepath.
Referenced by ASSET_OT_bundle_install().
|
static |
Definition at line 482 of file asset_ops.cc.
References BLI_uuid_parse_string(), C, CTX_wm_manager(), CTX_wm_space_file(), CTX_wm_window(), ED_asset_catalog_remove(), ED_fileselect_active_asset_library_get(), MEM_freeN, NC_ASSET, ND_ASSET_CATALOGS, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_string_get_alloc(), and WM_event_add_notifier_ex().
Referenced by ASSET_OT_catalog_delete().
|
static |
Definition at line 442 of file asset_ops.cc.
References C, blender::bke::AssetCatalog::catalog_id, CTX_wm_manager(), CTX_wm_space_file(), CTX_wm_window(), ED_asset_catalog_add(), ED_fileselect_activate_asset_catalog(), ED_fileselect_active_asset_library_get(), MEM_freeN, NC_ASSET, ND_ASSET_CATALOGS, OPERATOR_FINISHED, wmOperator::ptr, RNA_string_get_alloc(), and WM_event_add_notifier_ex().
Referenced by ASSET_OT_catalog_new().
Definition at line 436 of file asset_ops.cc.
References C, CTX_wm_space_file(), and ED_fileselect_active_asset_library_get().
Referenced by asset_catalogs_save_poll(), ASSET_OT_catalog_delete(), and ASSET_OT_catalog_new().
|
static |
Definition at line 559 of file asset_ops.cc.
References C, get_catalog_service(), NC_SPACE, ND_SPACE_ASSET_PARAMS, OPERATOR_CANCELLED, OPERATOR_FINISHED, blender::bke::AssetCatalogService::redo(), and WM_event_add_notifier().
Referenced by ASSET_OT_catalog_redo().
Definition at line 571 of file asset_ops.cc.
References C, get_catalog_service(), and blender::bke::AssetCatalogService::is_redo_possbile().
Referenced by ASSET_OT_catalog_redo().
|
static |
Definition at line 529 of file asset_ops.cc.
References C, get_catalog_service(), NC_SPACE, ND_SPACE_ASSET_PARAMS, OPERATOR_CANCELLED, OPERATOR_FINISHED, blender::bke::AssetCatalogService::undo(), and WM_event_add_notifier().
Referenced by ASSET_OT_catalog_undo().
Definition at line 541 of file asset_ops.cc.
References C, get_catalog_service(), and blender::bke::AssetCatalogService::is_undo_possbile().
Referenced by ASSET_OT_catalog_undo().
|
static |
Definition at line 589 of file asset_ops.cc.
References C, get_catalog_service(), OPERATOR_CANCELLED, OPERATOR_FINISHED, and blender::bke::AssetCatalogService::undo_push().
Referenced by ASSET_OT_catalog_undo_push().
Definition at line 600 of file asset_ops.cc.
References C, and get_catalog_service().
Referenced by ASSET_OT_catalog_undo_push().
|
static |
Definition at line 642 of file asset_ops.cc.
References C, CTX_data_main(), CTX_wm_manager(), CTX_wm_space_file(), CTX_wm_window(), ED_asset_catalogs_save_from_main_path(), ED_fileselect_active_asset_library_get(), NC_ASSET, ND_ASSET_CATALOGS, OPERATOR_FINISHED, and WM_event_add_notifier_ex().
Referenced by ASSET_OT_catalogs_save().
Definition at line 622 of file asset_ops.cc.
References asset_catalog_operator_poll(), BKE_asset_library_has_any_unsaved_catalogs(), C, CTX_data_main(), CTX_wm_operator_poll_msg_set(), and Main::filepath.
Referenced by ASSET_OT_catalogs_save().
|
static |
Definition at line 310 of file asset_ops.cc.
References asset_operation_get_ids_from_context(), C, NA_EDITED, NA_REMOVED, NC_ASSET, NC_ID, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, AssetClearHelper::reportResults(), wmOperator::reports, RNA_boolean_get(), AssetClearHelper::wasSuccessful(), and WM_main_add_notifier().
Referenced by ASSET_OT_clear().
|
static |
Definition at line 347 of file asset_ops.cc.
References BLI_strdup(), RNA_boolean_get(), and TIP_.
Referenced by ASSET_OT_clear().
Definition at line 329 of file asset_ops.cc.
References asset_operation_get_id_vec_stats_from_context(), asset_operation_unsupported_type_msg(), C, CTX_wm_operator_poll_msg_set(), IDVecStats::has_asset, IDVecStats::has_supported_type, IDVecStats::is_single, and TIP_.
Referenced by ASSET_OT_clear().
|
static |
Definition at line 400 of file asset_ops.cc.
References C, CTX_wm_asset_library_ref(), CTX_wm_manager(), CTX_wm_space_file(), ED_assetlist_clear(), ED_fileselect_clear(), ED_operator_asset_browsing_active(), library, NC_SPACE, ND_SPACE_FILE_LIST, OPERATOR_FINISHED, and WM_event_add_notifier().
Referenced by ASSET_OT_library_refresh().
Definition at line 384 of file asset_ops.cc.
References C, CTX_wm_asset_library_ref(), ED_assetlist_storage_has_list_for_library(), ED_operator_asset_browsing_active(), and library.
Referenced by ASSET_OT_library_refresh().
|
static |
Definition at line 187 of file asset_ops.cc.
References asset_operation_get_ids_from_context(), C, NA_ADDED, NA_EDITED, NC_ASSET, NC_ID, OPERATOR_CANCELLED, OPERATOR_FINISHED, AssetMarkHelper::reportResults(), wmOperator::reports, AssetMarkHelper::wasSuccessful(), and WM_main_add_notifier().
Referenced by ASSET_OT_mark().
Definition at line 205 of file asset_ops.cc.
References asset_operation_get_id_vec_stats_from_context(), asset_operation_unsupported_type_msg(), C, CTX_wm_operator_poll_msg_set(), IDVecStats::has_supported_type, and IDVecStats::is_single.
Referenced by ASSET_OT_mark().
|
static |
Helper to report stats about the IDs in context. Operator polls use this, also to report a helpful disabled hint to the user.
Definition at line 85 of file asset_ops.cc.
References asset_operation_get_ids_from_context(), BLI_assert, C, PointerRNA::data, ED_asset_type_is_supported(), IDVecStats::has_asset, IDVecStats::has_supported_type, ID_IS_ASSET, IDVecStats::is_single, ptr, RNA_struct_is_ID(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and PointerRNA::type.
Referenced by asset_clear_poll(), and asset_mark_poll().
|
static |
Return the IDs to operate on as PointerRNA vector. Either a single one ("id" context member) or multiple ones ("selected_ids" context member).
Definition at line 50 of file asset_ops.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_freelistN(), C, CTX_data_pointer_get_type(), CTX_data_selected_ids(), PointerRNA::data, and LISTBASE_FOREACH.
Referenced by asset_clear_exec(), asset_mark_exec(), and asset_operation_get_id_vec_stats_from_context().
|
static |
Definition at line 107 of file asset_ops.cc.
References ED_ASSET_TYPE_IDS_NON_EXPERIMENTAL_UI_STRING.
Referenced by asset_clear_poll(), and asset_mark_poll().
|
static |
Definition at line 790 of file asset_ops.cc.
References asset_bundle_install_exec(), asset_bundle_install_invoke(), asset_bundle_install_poll(), wmOperatorType::description, wmOperatorType::exec, FILE_BLENDER, FILE_DEFAULTDISPLAY, FILE_SAVE, FILE_SORT_DEFAULT, FILE_TYPE_BLENDER, FILE_TYPE_FOLDER, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, ot, wmOperatorType::poll, wmOperatorType::prop, PROP_ENUM, PROP_HIDDEN, PROP_NONE, rna_asset_library_reference_itemf(), RNA_def_enum_funcs(), RNA_def_property(), RNA_def_property_flag(), wmOperatorType::srna, WM_FILESEL_FILEPATH, and WM_operator_properties_filesel().
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 502 of file asset_ops.cc.
References asset_catalog_delete_exec(), asset_catalog_operator_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_string(), and wmOperatorType::srna.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 463 of file asset_ops.cc.
References asset_catalog_new_exec(), asset_catalog_operator_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, wmOperatorType::poll, RNA_def_string(), and wmOperatorType::srna.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 577 of file asset_ops.cc.
References asset_catalog_redo_exec(), asset_catalog_redo_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 547 of file asset_ops.cc.
References asset_catalog_undo_exec(), asset_catalog_undo_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 605 of file asset_ops.cc.
References asset_catalog_undo_push_exec(), asset_catalog_undo_push_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_INTERNAL, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 655 of file asset_ops.cc.
References asset_catalogs_save_exec(), asset_catalogs_save_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 361 of file asset_ops.cc.
References asset_clear_exec(), asset_clear_get_description(), asset_clear_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::get_description, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_asset().
|
static |
This operator currently covers both cases, the File/Asset Browser file list and the asset list used for the asset-view template. Once the asset list design is used by the Asset Browser, this can be simplified to just that case.
Definition at line 422 of file asset_ops.cc.
References asset_library_refresh_exec(), asset_library_refresh_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
|
static |
Definition at line 217 of file asset_ops.cc.
References asset_mark_exec(), asset_mark_poll(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_asset().
Definition at line 820 of file asset_ops.cc.
References Main::filepath.
Referenced by asset_bundle_install_poll().
Definition at line 938 of file asset_ops.cc.
References ASSET_OT_bundle_install(), ASSET_OT_catalog_delete(), ASSET_OT_catalog_new(), ASSET_OT_catalog_redo(), ASSET_OT_catalog_undo(), ASSET_OT_catalog_undo_push(), ASSET_OT_catalogs_save(), ASSET_OT_clear(), ASSET_OT_library_refresh(), ASSET_OT_mark(), and WM_operatortype_append().
Referenced by ED_spacetypes_init().
|
static |
Definition at line 873 of file asset_ops.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), FileCheckCallbackInfo::external_files, and BPathForeachPathData::user_data.
Referenced by has_external_files().
|
static |
Definition at line 518 of file asset_ops.cc.
References BKE_asset_library_get_catalog_service(), C, CTX_wm_space_file(), and ED_fileselect_active_asset_library_get().
Referenced by asset_bundle_install_exec(), asset_catalog_redo_exec(), asset_catalog_redo_poll(), asset_catalog_undo_exec(), asset_catalog_undo_poll(), asset_catalog_undo_push_exec(), and asset_catalog_undo_push_poll().
|
static |
Do a check on any external files (.blend, textures, etc.) being used. The ASSET_OT_bundle_install operator only works on standalone .blend files (catalog definition files are fine, though).
Definition at line 890 of file asset_ops.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::begin(), BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE, BKE_BPATH_FOREACH_PATH_SKIP_PACKED, BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, BKE_reportf(), external_file_check_callback(), FileCheckCallbackInfo::external_files, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::is_empty(), FileCheckCallbackInfo::reports, RPT_ERROR, and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().
Referenced by asset_bundle_install_exec(), and asset_bundle_install_invoke().
|
static |
Definition at line 834 of file asset_ops.cc.
References BLI_path_contains(), lib, and selected_asset_library().
Referenced by asset_bundle_install_exec().
|
static |
Definition at line 776 of file asset_ops.cc.
References ED_asset_library_reference_to_rna_enum_itemf().
Referenced by ASSET_OT_bundle_install().
|
static |
Definition at line 825 of file asset_ops.cc.
References BKE_preferences_asset_library_find_from_index(), AssetLibraryReference::custom_library_index, ED_asset_library_reference_from_enum_value(), lib, wmOperator::ptr, and RNA_enum_get().
Referenced by asset_bundle_install_exec(), is_contained_in_selected_asset_library(), and set_filepath_for_asset_lib().
|
static |
Set the "filepath" RNA property based on selected "asset_library_ref".
Definition at line 847 of file asset_ops.cc.
References BLI_join_dirfile(), BLI_path_basename(), Main::filepath, lib, PATH_MAX, wmOperator::ptr, RNA_string_set(), and selected_asset_library().
Referenced by asset_bundle_install_invoke().