36#include "RNA_prototypes.hh"
85 if (r_disabled_hint) {
86 *r_disabled_hint =
RPT_(
"Cannot edit external library data");
91 if (r_disabled_hint) {
92 *r_disabled_hint =
RPT_(
"Cannot edit previews of overridden library data");
97 if (r_disabled_hint) {
98 *r_disabled_hint =
RPT_(
"Data-block does not support previews");
111 const ID *
id =
static_cast<ID *
>(idptr.
data);
112 const char *disabled_hint =
nullptr;
129 return static_cast<ID *
>(idptr.
data);
146 op->
reports,
RPT_ERROR,
"Failed to set preview: no ID in context (incorrect context?)");
173 ot->
name =
"Load Custom Preview";
174 ot->
description =
"Choose an image to help identify the data-block visually";
175 ot->
idname =
"ED_OT_lib_id_load_custom_preview";
202 ID *
id =
static_cast<ID *
>(idptr.data);
221 FunctionRef<
bool(
const ID *,
const char **r_disabled_hint)> additional_condition =
nullptr)
229 const char *disabled_hint =
nullptr;
232 const ID *
id =
static_cast<const ID *
>(idptr.data);
234 const char *iter_disabled_hint =
nullptr;
236 (!additional_condition || additional_condition(
id, &iter_disabled_hint)))
242 if (iter_disabled_hint && !disabled_hint) {
243 disabled_hint = iter_disabled_hint;
295 ot->
name =
"Generate Preview";
296 ot->
description =
"Create an automatic preview for the selected data-block";
297 ot->
idname =
"ED_OT_lib_id_generate_preview";
322 if (object_to_render ==
nullptr) {
325 const char *disabled_hint =
nullptr;
358 ot->
name =
"Generate Preview from Object";
359 ot->
description =
"Create a preview for this asset by rendering the active object";
360 ot->
idname =
"ED_OT_lib_id_generate_preview_from_object";
376 bool has_any_removable =
false;
379 has_any_removable =
true;
383 if (!has_any_removable) {
403 ot->
name =
"Remove Preview";
404 ot->
description =
"Remove the preview of this data-block";
405 ot->
idname =
"ED_OT_lib_id_remove_preview";
434 op->
reports,
RPT_ERROR,
"Incorrect context for running data-block fake user toggling");
438 ID *
id =
static_cast<ID *
>(idptr.
data);
460 ot->
name =
"Toggle Fake User";
461 ot->
description =
"Save this data-block even if it has no users";
462 ot->
idname =
"ED_OT_lib_id_fake_user_toggle";
484 op->
reports,
RPT_ERROR,
"Incorrect context for running data-block fake user toggling");
498 ot->
name =
"Unlink Data-Block";
499 ot->
description =
"Remove a usage of a data-block, clearing the assignment";
500 ot->
idname =
"ED_OT_lib_id_unlink";
512 const ID *
id =
static_cast<ID *
>(id_ptr.
data);
521 ID *
id =
static_cast<ID *
>(id_ptr.
data);
524 if (is_system_override) {
544 ot->
name =
"Toggle Library Override Editable";
545 ot->
description =
"Set if this library override data-block can be edited";
546 ot->
idname =
"ED_OT_lib_id_override_editable_toggle";
572 ot->
name =
"Flush Edits";
573 ot->
description =
"Flush edit data from active editing modes";
574 ot->
idname =
"ED_OT_flush_edits";
File and directory operations.
#define ID_FAKE_USERS(id)
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_LINKED(_id)
#define ID_IS_EDITABLE(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define ND_LIB_OVERRIDE_CHANGED
void append(const T &value)
void storage_tag_main_data_dirty()
void context_active_but_prop_get_templateID(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop)
void icon_render_id_ex(const bContext *C, Scene *scene, ID *id_to_render, const enum eIconSizes size, const bool use_job, PreviewImage *r_preview_image)
void icon_render_id(const bContext *C, Scene *scene, ID *id, enum eIconSizes size, bool use_job)
void WM_main_add_notifier(uint type, void *reference)
static void ED_OT_lib_id_override_editable_toggle(wmOperatorType *ot)
bool CTX_data_selected_ids(const bContext *C, Vector< PointerRNA > *list)
void BKE_previewimg_id_custom_set(ID *id, const char *filepath)
bool ED_preview_id_render_is_supported(const ID *id, const char **r_disabled_hint=nullptr)
static bool lib_id_generate_preview_from_object_poll(bContext *C)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static bool lib_id_override_editable_toggle_poll(bContext *C)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void ED_OT_undo_push(wmOperatorType *ot)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
static wmOperatorStatus lib_id_generate_preview_from_object_exec(bContext *C, wmOperator *)
void BKE_previewimg_id_free(ID *id)
static void lib_id_batch_edit_previews(bContext *C, FunctionRef< void(ID *)> foreach_id)
void BKE_previewimg_clear(PreviewImage *prv)
bool ED_editors_flush_edits(Main *bmain)
static void ED_OT_lib_id_generate_preview(wmOperatorType *ot)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
static bool lib_id_preview_editing_poll_ex(const ID *id, const char **r_disabled_hint)
void ED_OT_undo_redo(wmOperatorType *ot)
wmOperatorStatus WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus lib_id_fake_user_toggle_exec(bContext *C, wmOperator *op)
static bool lib_id_remove_preview_poll(bContext *C)
static bool lib_id_generate_preview_poll(bContext *C)
void ED_OT_undo(wmOperatorType *ot)
static wmOperatorStatus lib_id_unlink_exec(bContext *C, wmOperator *op)
void ED_OT_redo(wmOperatorType *ot)
static bool lib_id_batch_editing_preview_poll(bContext *C, FunctionRef< bool(const ID *, const char **r_disabled_hint)> additional_condition=nullptr)
bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id)
void id_fake_user_set(ID *id)
@ LIBOVERRIDE_FLAG_SYSTEM_DEFINED
static void ED_OT_flush_edits(wmOperatorType *ot)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
static void ED_OT_lib_id_remove_preview(wmOperatorType *ot)
PreviewImage ** BKE_previewimg_id_get_p(const ID *id)
Vector< PointerRNA > ED_operator_get_ids_from_context_as_vec(const bContext *C)
void ED_preview_kill_jobs(wmWindowManager *wm, Main *bmain)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
static wmOperatorStatus lib_id_generate_preview_exec(bContext *C, wmOperator *)
void BKE_report(ReportList *reports, eReportType type, const char *message)
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
static wmOperatorStatus ed_flush_edits_exec(bContext *C, wmOperator *)
wmWindowManager * CTX_wm_manager(const bContext *C)
PreviewImage * BKE_previewimg_id_ensure(ID *id)
void BKE_lib_override_library_id_reset(Main *bmain, ID *id_root, bool do_reset_system_override)
void ED_OT_undo_history(wmOperatorType *ot)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PreviewImage * BKE_previewimg_id_get(const ID *id)
bool RNA_struct_is_ID(const StructRNA *type)
static void ED_OT_lib_id_unlink(wmOperatorType *ot)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Main * CTX_data_main(const bContext *C)
static wmOperatorStatus lib_id_remove_preview_exec(bContext *C, wmOperator *)
static void ED_OT_lib_id_fake_user_toggle(wmOperatorType *ot)
ID_Type GS(const char *name)
static wmOperatorStatus lib_id_load_custom_preview_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void ED_OT_lib_id_generate_preview_from_object(wmOperatorType *ot)
static ID * lib_id_load_custom_preview_id_get(bContext *C, const wmOperator *op)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
static wmOperatorStatus lib_id_load_custom_preview_exec(bContext *C, wmOperator *op)
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Vector< PointerRNA > ED_operator_single_id_from_context_as_vec(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
static wmOperatorStatus lib_id_override_editable_toggle_exec(bContext *C, wmOperator *)
void id_fake_user_clear(ID *id)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
static void ED_OT_lib_id_load_custom_preview(wmOperatorType *ot)
void ED_operatortypes_edutils()
static bool lib_id_preview_editing_poll(bContext *C)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports