12#include "RNA_prototypes.hh"
80 MEM_new<TemplateSearch>(__func__, template_search),
94 if (active_ptr->
data ==
nullptr) {
98 int iconid = ICON_NONE;
101 if (type == &RNA_ActionSlot) {
113 uiDefAutoButR(block, active_ptr, name_prop, 0,
"", iconid, 0, 0, width, height);
118 const char *
const operator_name,
122 const std::optional<StringRefNull> button_text = {})
124 if (!operator_name) {
130 const int button_width = std::max(
168 const char *unlinkop,
169 const std::optional<StringRef> text)
179 if (active_ptr.
type) {
181 type = active_ptr.
type;
187 uiLayout *decorator_layout =
nullptr;
188 if (text && !text->is_empty()) {
199 const bool may_show_new_button = (type == &RNA_ActionSlot);
200 if (may_show_new_button && !active_ptr.
data) {
217 if (decorator_layout) {
225 const char *
const searchpropname)
229 if (searchptr && !searchptr->
data) {
233 if (!searchptr && !searchpropname) {
236 else if (!searchptr && searchpropname) {
237 RNA_warning(
"searchpropname defined (%s) but searchptr is missing", searchpropname);
239 else if (searchptr && !searchpropname) {
240 RNA_warning(
"searchptr defined (%s) but searchpropname is missing",
244 RNA_warning(
"search collection property not found: %s.%s",
249 RNA_warning(
"search collection property is not a collection type: %s.%s",
257 RNA_warning(
"search collection items from %s.%s are not of type %s",
273 const char *
const searchpropname)
275 template_search = {};
298 const char *searchpropname,
300 const char *unlinkop,
301 const std::optional<StringRef> text)
314 const char *searchpropname,
316 const char *unlinkop,
319 const std::optional<StringRef> text)
Functions and classes to work with Actions.
#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 * uiDefIconTextButO(uiBlock *block, ButType type, blender::StringRefNull, blender::wm::OpCallContext opcontext, int icon, blender::StringRef str, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
uiBut * uiDefIconButO(uiBlock *block, ButType type, blender::StringRefNull opname, blender::wm::OpCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
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)
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
void UI_block_align_end(uiBlock *block)
int UI_icon_from_idcode(int idcode)
uiLayout * uiItemL_respect_property_split(uiLayout *layout, blender::StringRef text, int icon)
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_operator(uiBlock *block, const char *const operator_name, const blender::wm::OpCallContext opcontext, const int icon, const bool editable, const std::optional< StringRefNull > button_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)
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)
float wrap(float value, float max, float min)
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
void decorator(PointerRNA *ptr, PropertyRNA *prop, int index)
uiLayout & row(bool align)
PropertyRNA * target_prop
PropertyRNA * search_prop