|
Blender V5.0
|
#include <cstring>#include "DNA_space_types.h"#include "DNA_windowmanager_types.h"#include "BLI_fileops.h"#include "BLI_utildefines.h"#include "BLI_vector.hh"#include "BKE_context.hh"#include "BKE_lib_id.hh"#include "BKE_lib_override.hh"#include "BKE_library.hh"#include "BKE_preview_image.hh"#include "BKE_report.hh"#include "ED_asset.hh"#include "ED_render.hh"#include "ED_undo.hh"#include "ED_util.hh"#include "RNA_access.hh"#include "RNA_prototypes.hh"#include "UI_interface.hh"#include "WM_api.hh"#include "WM_types.hh"Go to the source code of this file.
Utility operators for UI data or for the UI to use.
Definition in file ed_util_ops.cc.
|
static |
Definition at line 550 of file ed_util_ops.cc.
References C, CTX_data_main(), ED_editors_flush_edits(), and OPERATOR_FINISHED.
Referenced by ED_OT_flush_edits().
| blender::Vector< PointerRNA > ED_operator_get_ids_from_context_as_vec | ( | const bContext * | C | ) |
Helper for context sensitive operations: Returns the "selected_ids" context member or, if none, the "id" context member as a PointerRNA vector. Batch operations can use this to get all IDs to act on, including a fallback to the active ID if there's no selection.
Definition at line 54 of file ed_util_ops.cc.
References C, CTX_data_selected_ids(), ED_operator_single_id_from_context_as_vec(), and blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty().
Referenced by blender::ed::asset::ASSET_OT_clear(), blender::ed::asset::ASSET_OT_mark(), lib_id_batch_edit_previews(), and lib_id_batch_editing_preview_poll().
| blender::Vector< PointerRNA > ED_operator_single_id_from_context_as_vec | ( | const bContext * | C | ) |
Helper for context sensitive operations: Returns the "id" context member wrapped in a PointerRNA vector. Useful when the API uses vectors to also support acting on multiple IDs, e.g. as returned by ED_operator_get_ids_from_context_as_vec().
Definition at line 44 of file ed_util_ops.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), C, CTX_data_pointer_get_type(), and PointerRNA::data.
Referenced by blender::ed::asset::ASSET_OT_clear_single(), blender::ed::asset::ASSET_OT_mark_single(), and ED_operator_get_ids_from_context_as_vec().
| void ED_operatortypes_edutils | ( | ) |
Definition at line 573 of file ed_util_ops.cc.
References ED_OT_flush_edits(), ED_OT_lib_id_fake_user_toggle(), ED_OT_lib_id_generate_preview(), ED_OT_lib_id_generate_preview_from_object(), ED_OT_lib_id_load_custom_preview(), ED_OT_lib_id_override_editable_toggle(), ED_OT_lib_id_remove_preview(), ED_OT_lib_id_unlink(), ED_OT_redo(), ED_OT_undo(), ED_OT_undo_history(), ED_OT_undo_push(), ED_OT_undo_redo(), and WM_operatortype_append().
Referenced by ED_spacetypes_init().
|
static |
Definition at line 557 of file ed_util_ops.cc.
References ed_flush_edits_exec(), OPTYPE_INTERNAL, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 445 of file ed_util_ops.cc.
References lib_id_fake_user_toggle_exec(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 285 of file ed_util_ops.cc.
References lib_id_generate_preview_exec(), lib_id_generate_preview_poll(), OPTYPE_INTERNAL, OPTYPE_REGISTER, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 344 of file ed_util_ops.cc.
References lib_id_generate_preview_from_object_exec(), lib_id_generate_preview_from_object_poll(), OPTYPE_INTERNAL, OPTYPE_REGISTER, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 166 of file ed_util_ops.cc.
References FILE_DEFAULTDISPLAY, FILE_OPENFILE, FILE_SORT_DEFAULT, FILE_SPECIAL, FILE_TYPE_FOLDER, FILE_TYPE_IMAGE, lib_id_load_custom_preview_exec(), lib_id_load_custom_preview_invoke(), lib_id_preview_editing_poll(), OPTYPE_INTERNAL, OPTYPE_UNDO, ot, WM_FILESEL_FILEPATH, and WM_operator_properties_filesel().
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 529 of file ed_util_ops.cc.
References lib_id_override_editable_toggle_exec(), lib_id_override_editable_toggle_poll(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 388 of file ed_util_ops.cc.
References lib_id_remove_preview_exec(), lib_id_remove_preview_poll(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Definition at line 483 of file ed_util_ops.cc.
References lib_id_unlink_exec(), OPTYPE_INTERNAL, OPTYPE_UNDO, and ot.
Referenced by ED_operatortypes_edutils().
|
static |
Helper for batch editing previews. Gets selected or active IDs from context and calls foreach_id for each ID that supports previews.
Definition at line 193 of file ed_util_ops.cc.
References C, ED_operator_get_ids_from_context_as_vec(), and lib_id_preview_editing_poll_ex().
Referenced by lib_id_generate_preview_exec(), lib_id_generate_preview_from_object_exec(), lib_id_remove_preview_exec(), and lib_id_remove_preview_poll().
|
static |
Helper for batch editing previews. Check if at least one of the selected or active IDs supports previews, setting a disabled hint if not. Note that only one disabled hint can be set, this simply uses the first one set while polling individual IDs. That's more useful than a generic message still.
| additional_condition | When set, IDs need to additionally pass this check (return true) to be considered as supporting this operation. |
Definition at line 214 of file ed_util_ops.cc.
References C, CTX_wm_operator_poll_msg_set(), ED_operator_get_ids_from_context_as_vec(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), and lib_id_preview_editing_poll_ex().
Referenced by lib_id_generate_preview_from_object_poll(), lib_id_generate_preview_poll(), and lib_id_remove_preview_poll().
|
static |
Definition at line 409 of file ed_util_ops.cc.
References BKE_id_is_editable(), BKE_report(), C, CTX_data_main(), PointerRNA::data, ELEM, GS, id_fake_user_clear(), id_fake_user_set(), ID_FAKE_USERS, ID_GR, ID_OB, ID_SCE, ID_SCR, ID_TXT, ID_WS, ID::name, OPERATOR_CANCELLED, OPERATOR_FINISHED, PointerRNA_NULL, PropertyPointerRNA::prop, PropertyPointerRNA::ptr, wmOperator::reports, RNA_pointer_is_null(), RNA_property_pointer_get(), RNA_struct_is_ID(), RPT_ERROR, PointerRNA::type, and UI_context_active_but_prop_get_templateID().
Referenced by ED_OT_lib_id_fake_user_toggle().
|
static |
Definition at line 261 of file ed_util_ops.cc.
References BKE_previewimg_clear(), BKE_previewimg_id_get(), C, CTX_data_main(), CTX_wm_manager(), ED_preview_id_is_supported(), ED_preview_kill_jobs(), ICON_SIZE_PREVIEW, lib_id_batch_edit_previews(), NA_EDITED, NC_ASSET, OPERATOR_FINISHED, blender::ed::asset::list::storage_tag_main_data_dirty(), UI_icon_render_id(), and WM_event_add_notifier().
Referenced by ED_OT_lib_id_generate_preview().
|
static |
Definition at line 322 of file ed_util_ops.cc.
References BKE_previewimg_id_ensure(), BKE_previewimg_id_free(), C, CTX_data_active_object(), CTX_data_main(), CTX_wm_manager(), ED_preview_kill_jobs(), ICON_SIZE_PREVIEW, Object::id, lib_id_batch_edit_previews(), NA_EDITED, NC_ASSET, OPERATOR_FINISHED, blender::ed::asset::list::storage_tag_main_data_dirty(), UI_icon_render_id_ex(), and WM_event_add_notifier().
Referenced by ED_OT_lib_id_generate_preview_from_object().
|
static |
Definition at line 299 of file ed_util_ops.cc.
References C, CTX_data_active_object(), CTX_wm_operator_poll_msg_set(), ED_preview_id_is_supported(), Object::id, and lib_id_batch_editing_preview_poll().
Referenced by ED_OT_lib_id_generate_preview_from_object().
|
static |
Definition at line 254 of file ed_util_ops.cc.
References C, ED_preview_id_is_supported(), and lib_id_batch_editing_preview_poll().
Referenced by ED_OT_lib_id_generate_preview().
|
static |
Definition at line 127 of file ed_util_ops.cc.
References BKE_previewimg_id_custom_set(), BKE_report(), BKE_reportf(), BLI_is_file(), C, FILE_MAX, lib_id_load_custom_preview_id_get(), NA_EDITED, NC_ASSET, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, wmOperator::reports, RNA_string_get(), RPT_ERROR, and WM_event_add_notifier().
Referenced by ED_OT_lib_id_load_custom_preview().
|
static |
Definition at line 116 of file ed_util_ops.cc.
References C, CTX_data_pointer_get(), wmOperator::customdata, and PointerRNA::data.
Referenced by lib_id_load_custom_preview_exec(), and lib_id_load_custom_preview_invoke().
|
static |
Obtain the ID from context, and spawn a File Browser to select the preview image. The File Browser may re-use the Asset Browser under the cursor, and clear the file-list on confirmation, leading to failure to obtain the ID at that point. So get it before spawning the File Browser (store it in the operator custom data).
Definition at line 158 of file ed_util_ops.cc.
References C, wmOperator::customdata, lib_id_load_custom_preview_id_get(), and WM_operator_filesel().
Referenced by ED_OT_lib_id_load_custom_preview().
|
static |
Definition at line 505 of file ed_util_ops.cc.
References BKE_lib_override_library_id_reset(), BKE_lib_override_library_is_system_defined(), C, CTX_data_main(), CTX_data_pointer_get_type(), PointerRNA::data, LIBOVERRIDE_FLAG_SYSTEM_DEFINED, NC_SPACE, NC_WINDOW, NC_WM, ND_LIB_OVERRIDE_CHANGED, ND_SPACE_VIEW3D, OPERATOR_FINISHED, WM_event_add_notifier(), and WM_main_add_notifier().
Referenced by ED_OT_lib_id_override_editable_toggle().
|
static |
Definition at line 497 of file ed_util_ops.cc.
References C, CTX_data_pointer_get_type(), PointerRNA::data, ID_IS_LINKED, and ID_IS_OVERRIDE_LIBRARY_REAL.
Referenced by ED_OT_lib_id_override_editable_toggle().
|
static |
Definition at line 101 of file ed_util_ops.cc.
References BLI_assert, C, CTX_data_pointer_get(), CTX_wm_operator_poll_msg_set(), PointerRNA::data, lib_id_preview_editing_poll_ex(), RNA_struct_is_ID(), and PointerRNA::type.
Referenced by ED_OT_lib_id_load_custom_preview().
|
static |
Definition at line 74 of file ed_util_ops.cc.
References BKE_previewimg_id_get_p(), ID_IS_EDITABLE, and ID_IS_OVERRIDE_LIBRARY.
Referenced by lib_id_batch_edit_previews(), lib_id_batch_editing_preview_poll(), and lib_id_preview_editing_poll().
|
static |
Definition at line 379 of file ed_util_ops.cc.
References BKE_previewimg_id_free(), C, lib_id_batch_edit_previews(), NA_EDITED, NC_ASSET, OPERATOR_FINISHED, and WM_event_add_notifier().
Referenced by ED_OT_lib_id_remove_preview().
|
static |
Definition at line 358 of file ed_util_ops.cc.
References BKE_previewimg_id_get(), C, CTX_wm_operator_poll_msg_set(), lib_id_batch_edit_previews(), and lib_id_batch_editing_preview_poll().
Referenced by ED_OT_lib_id_remove_preview().
|
static |
Definition at line 459 of file ed_util_ops.cc.
References BKE_report(), C, OPERATOR_CANCELLED, OPERATOR_FINISHED, PropertyPointerRNA::prop, PropertyPointerRNA::ptr, wmOperator::reports, RNA_pointer_is_null(), RNA_property_pointer_get(), RNA_property_pointer_set(), RNA_property_update(), RNA_struct_is_ID(), RPT_ERROR, PointerRNA::type, and UI_context_active_but_prop_get_templateID().
Referenced by ED_OT_lib_id_unlink().