12#include "RNA_prototypes.hh"
78 MEM_new<TemplateSearch>(__func__, template_search),
92 if (active_ptr->
data ==
nullptr) {
97 if (type == &RNA_ActionSlot) {
106 uiDefAutoButR(block, active_ptr, name_prop, 0,
"", ICON_NONE, 0, 0, width, height);
111 const char *
const operator_name,
115 const std::optional<StringRefNull> button_text = {})
117 if (!operator_name) {
123 const int button_width = std::max(
161 const char *unlinkop,
162 const std::optional<StringRef> text)
172 if (active_ptr.
type) {
174 type = active_ptr.
type;
180 uiLayout *decorator_layout =
nullptr;
181 if (text && !text->is_empty()) {
192 const bool may_show_new_button = (type == &RNA_ActionSlot);
193 if (may_show_new_button && !active_ptr.
data) {
206 if (decorator_layout) {
214 const char *
const searchpropname)
218 if (searchptr && !searchptr->
data) {
222 if (!searchptr && !searchpropname) {
225 else if (!searchptr && searchpropname) {
226 RNA_warning(
"searchpropname defined (%s) but searchptr is missing", searchpropname);
228 else if (searchptr && !searchpropname) {
229 RNA_warning(
"searchptr defined (%s) but searchpropname is missing",
233 RNA_warning(
"search collection property not found: %s.%s",
238 RNA_warning(
"search collection property is not a collection type: %s.%s",
246 RNA_warning(
"search collection items from %s.%s are not of type %s",
262 const char *
const searchpropname)
264 template_search = {};
287 const char *searchpropname,
289 const char *unlinkop,
290 const std::optional<StringRef> text)
303 const char *searchpropname,
305 const char *unlinkop,
308 const std::optional<StringRef> text)
#define RNA_warning(format,...)
void * but_func_argN_copy(const void *argN)
void but_func_argN_free(void *argN)
void UI_but_drawflag_enable(uiBut *but, int flag)
uiBut * uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, std::optional< blender::StringRef > name, int icon, int x, int y, int width, int height)
uiBut * uiDefIconButO(uiBlock *block, int type, blender::StringRefNull opname, wmOperatorCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
void UI_block_align_begin(uiBlock *block)
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
uiBut * uiDefIconTextButO(uiBlock *block, int type, blender::StringRefNull, wmOperatorCallContext opcontext, int icon, blender::StringRef str, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
void UI_block_align_end(uiBlock *block)
void uiItemDecoratorR(uiLayout *layout, PointerRNA *ptr, std::optional< blender::StringRefNull > propname, int index)
uiLayout * uiItemL_respect_property_split(uiLayout *layout, blender::StringRef text, int icon)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ WM_OP_INVOKE_REGION_WIN
constexpr const char * c_str() const
void ui_rna_collection_search_update_fn(const bContext *C, void *arg, const char *str, uiSearchItems *items, bool is_first)
static void template_search_buttons(const bContext *C, uiLayout *layout, TemplateSearch &template_search, const char *newop, const char *unlinkop, const std::optional< StringRef > text)
static uiBlock * template_search_menu(bContext *C, ARegion *region, void *arg_template)
static void template_search_exec_fn(bContext *C, void *arg_template, void *item)
static bool template_search_setup(TemplateSearch &template_search, PointerRNA *ptr, const StringRefNull propname, PointerRNA *searchptr, const char *const searchpropname)
void uiTemplateSearchPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, const int rows, const int cols, const std::optional< StringRef > text)
static void template_search_add_button_searchmenu(const bContext *C, uiLayout *layout, uiBlock *block, TemplateSearch &template_search, const bool editable, const bool live_icon)
static void template_search_add_button_name(uiBlock *block, PointerRNA *active_ptr, const StructRNA *type)
static PropertyRNA * template_search_get_searchprop(PointerRNA *targetptr, PropertyRNA *targetprop, PointerRNA *searchptr, const char *const searchpropname)
static void template_search_add_button_operator(uiBlock *block, const char *const operator_name, const wmOperatorCallContext opcontext, const int icon, const bool editable, const std::optional< StringRefNull > button_text={})
void uiTemplateSearch(uiLayout *layout, const bContext *C, PointerRNA *ptr, const StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, const std::optional< StringRef > text)
void template_add_button_search_menu(const bContext *C, uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, uiBlockCreateFunc block_func, void *block_argN, const std::optional< blender::StringRef > tip, const bool use_previews, const bool editable, const bool live_icon, uiButArgNFree func_argN_free_fn, uiButArgNCopy func_argN_copy_fn)
int template_search_textbut_height()
int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop)
uiBlock * template_common_search_menu(const bContext *C, ARegion *region, uiButSearchUpdateFn search_update_fn, void *search_arg, uiButHandleFunc search_exec_fn, void *active_item, uiButSearchTooltipFn item_tooltip_fn, const int preview_rows, const int preview_cols, float scale)
const char * RNA_property_ui_description(const PropertyRNA *prop)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
PropertyType RNA_property_type(PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_struct_identifier(const StructRNA *type)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
uiRNACollectionSearch search_data
uiLayout & row(bool align)
PropertyRNA * target_prop
PropertyRNA * search_prop