Blender  V3.3
Classes | Typedefs | Functions
asset_ops.cc File Reference
#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 >
 

Functions

static PointerRNAVec asset_operation_get_ids_from_context (const bContext *C)
 
static IDVecStats asset_operation_get_id_vec_stats_from_context (const bContext *C)
 
static const char * asset_operation_unsupported_type_msg (const bool is_single)
 
static int asset_mark_exec (bContext *C, wmOperator *op)
 
static bool asset_mark_poll (bContext *C)
 
static void ASSET_OT_mark (wmOperatorType *ot)
 
static int asset_clear_exec (bContext *C, wmOperator *op)
 
static bool asset_clear_poll (bContext *C)
 
static char * asset_clear_get_description (struct bContext *UNUSED(C), struct wmOperatorType *UNUSED(op), struct PointerRNA *values)
 
static void ASSET_OT_clear (wmOperatorType *ot)
 
static bool asset_library_refresh_poll (bContext *C)
 
static int asset_library_refresh_exec (bContext *C, wmOperator *UNUSED(unused))
 
static void ASSET_OT_library_refresh (struct wmOperatorType *ot)
 
static bool asset_catalog_operator_poll (bContext *C)
 
static int asset_catalog_new_exec (bContext *C, wmOperator *op)
 
static void ASSET_OT_catalog_new (struct wmOperatorType *ot)
 
static int asset_catalog_delete_exec (bContext *C, wmOperator *op)
 
static void ASSET_OT_catalog_delete (struct wmOperatorType *ot)
 
static bke::AssetCatalogServiceget_catalog_service (bContext *C)
 
static int asset_catalog_undo_exec (bContext *C, wmOperator *)
 
static bool asset_catalog_undo_poll (bContext *C)
 
static void ASSET_OT_catalog_undo (struct wmOperatorType *ot)
 
static int asset_catalog_redo_exec (bContext *C, wmOperator *)
 
static bool asset_catalog_redo_poll (bContext *C)
 
static void ASSET_OT_catalog_redo (struct wmOperatorType *ot)
 
static int asset_catalog_undo_push_exec (bContext *C, wmOperator *)
 
static bool asset_catalog_undo_push_poll (bContext *C)
 
static void ASSET_OT_catalog_undo_push (struct wmOperatorType *ot)
 
static bool asset_catalogs_save_poll (bContext *C)
 
static int asset_catalogs_save_exec (bContext *C, wmOperator *)
 
static void ASSET_OT_catalogs_save (struct wmOperatorType *ot)
 
static bool could_be_asset_bundle (const Main *bmain)
 
static const bUserAssetLibraryselected_asset_library (struct wmOperator *op)
 
static bool is_contained_in_selected_asset_library (struct wmOperator *op, const char *filepath)
 
static bool set_filepath_for_asset_lib (const Main *bmain, struct wmOperator *op)
 
static bool has_external_files (Main *bmain, struct ReportList *reports)
 
static bool asset_bundle_install_poll (bContext *C)
 
static int asset_bundle_install_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *)
 
static int asset_bundle_install_exec (bContext *C, wmOperator *op)
 
static const EnumPropertyItemrna_asset_library_reference_itemf (bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
static void ASSET_OT_bundle_install (struct wmOperatorType *ot)
 
static bool external_file_check_callback (BPathForeachPathData *bpath_data, char *, const char *path_src)
 
void ED_operatortypes_asset ()
 

Typedef Documentation

◆ PointerRNAVec

Definition at line 44 of file asset_ops.cc.

Function Documentation

◆ asset_bundle_install_exec()

static int asset_bundle_install_exec ( bContext C,
wmOperator op 
)
static

◆ asset_bundle_install_invoke()

static int asset_bundle_install_invoke ( struct bContext C,
struct wmOperator op,
const struct wmEvent  
)
static

◆ asset_bundle_install_poll()

static bool asset_bundle_install_poll ( bContext C)
static

◆ asset_catalog_delete_exec()

static int asset_catalog_delete_exec ( bContext C,
wmOperator op 
)
static

◆ asset_catalog_new_exec()

static int asset_catalog_new_exec ( bContext C,
wmOperator op 
)
static

◆ asset_catalog_operator_poll()

static bool asset_catalog_operator_poll ( bContext C)
static

◆ asset_catalog_redo_exec()

static int asset_catalog_redo_exec ( bContext C,
wmOperator  
)
static

◆ asset_catalog_redo_poll()

static bool asset_catalog_redo_poll ( bContext C)
static

◆ asset_catalog_undo_exec()

static int asset_catalog_undo_exec ( bContext C,
wmOperator  
)
static

◆ asset_catalog_undo_poll()

static bool asset_catalog_undo_poll ( bContext C)
static

◆ asset_catalog_undo_push_exec()

static int asset_catalog_undo_push_exec ( bContext C,
wmOperator  
)
static

◆ asset_catalog_undo_push_poll()

static bool asset_catalog_undo_push_poll ( bContext C)
static

Definition at line 600 of file asset_ops.cc.

References C, and get_catalog_service().

Referenced by ASSET_OT_catalog_undo_push().

◆ asset_catalogs_save_exec()

static int asset_catalogs_save_exec ( bContext C,
wmOperator  
)
static

◆ asset_catalogs_save_poll()

static bool asset_catalogs_save_poll ( bContext C)
static

◆ asset_clear_exec()

static int asset_clear_exec ( bContext C,
wmOperator op 
)
static

◆ asset_clear_get_description()

static char* asset_clear_get_description ( struct bContext UNUSEDC,
struct wmOperatorType UNUSEDop,
struct PointerRNA values 
)
static

Definition at line 347 of file asset_ops.cc.

References BLI_strdup(), RNA_boolean_get(), and TIP_.

Referenced by ASSET_OT_clear().

◆ asset_clear_poll()

static bool asset_clear_poll ( bContext C)
static

◆ asset_library_refresh_exec()

static int asset_library_refresh_exec ( bContext C,
wmOperator UNUSEDunused 
)
static

◆ asset_library_refresh_poll()

static bool asset_library_refresh_poll ( bContext C)
static

◆ asset_mark_exec()

static int asset_mark_exec ( bContext C,
wmOperator op 
)
static

◆ asset_mark_poll()

static bool asset_mark_poll ( bContext C)
static

◆ asset_operation_get_id_vec_stats_from_context()

static IDVecStats asset_operation_get_id_vec_stats_from_context ( const bContext C)
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().

◆ asset_operation_get_ids_from_context()

static PointerRNAVec asset_operation_get_ids_from_context ( const bContext C)
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().

◆ asset_operation_unsupported_type_msg()

static const char* asset_operation_unsupported_type_msg ( const bool  is_single)
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().

◆ ASSET_OT_bundle_install()

static void ASSET_OT_bundle_install ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalog_delete()

static void ASSET_OT_catalog_delete ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalog_new()

static void ASSET_OT_catalog_new ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalog_redo()

static void ASSET_OT_catalog_redo ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalog_undo()

static void ASSET_OT_catalog_undo ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalog_undo_push()

static void ASSET_OT_catalog_undo_push ( struct wmOperatorType ot)
static

◆ ASSET_OT_catalogs_save()

static void ASSET_OT_catalogs_save ( struct wmOperatorType ot)
static

◆ ASSET_OT_clear()

static void ASSET_OT_clear ( wmOperatorType ot)
static

◆ ASSET_OT_library_refresh()

static void ASSET_OT_library_refresh ( struct wmOperatorType ot)
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().

◆ ASSET_OT_mark()

static void ASSET_OT_mark ( wmOperatorType ot)
static

◆ could_be_asset_bundle()

static bool could_be_asset_bundle ( const Main bmain)
static

Definition at line 820 of file asset_ops.cc.

References Main::filepath.

Referenced by asset_bundle_install_poll().

◆ ED_operatortypes_asset()

void ED_operatortypes_asset ( void  )

◆ external_file_check_callback()

static bool external_file_check_callback ( BPathForeachPathData bpath_data,
char *  ,
const char *  path_src 
)
static

◆ get_catalog_service()

static bke::AssetCatalogService* get_catalog_service ( bContext C)
static

◆ has_external_files()

static bool has_external_files ( Main bmain,
struct ReportList reports 
)
static

◆ is_contained_in_selected_asset_library()

static bool is_contained_in_selected_asset_library ( struct wmOperator op,
const char *  filepath 
)
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().

◆ rna_asset_library_reference_itemf()

static const EnumPropertyItem* rna_asset_library_reference_itemf ( bContext UNUSEDC,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
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().

◆ selected_asset_library()

static const bUserAssetLibrary * selected_asset_library ( struct wmOperator op)
static

◆ set_filepath_for_asset_lib()

static bool set_filepath_for_asset_lib ( const Main bmain,
struct wmOperator op 
)
static

Set the "filepath" RNA property based on selected "asset_library_ref".

Returns
true if ok, false if error.

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().