12#include "RNA_prototypes.hh"
97 int iconid = ICON_NONE;
100 if (type == RNA_ActionSlot) {
111 if (iconid != ICON_NONE) {
117 uiDefAutoButR(block, active_ptr, name_prop, 0,
"", iconid, 0, 0, width, height);
122 const char *
const operator_name,
126 const std::optional<StringRefNull> button_text = {})
128 if (!operator_name) {
134 const int button_width = std::max(
172 const char *unlinkop,
173 const std::optional<StringRef> text)
185 type = active_ptr.
type;
191 Layout *decorator_layout =
nullptr;
192 if (text && !text->is_empty()) {
203 const bool may_show_new_button = (type == RNA_ActionSlot);
204 if (may_show_new_button && !active_ptr) {
217 if (decorator_layout) {
225 const char *
const searchpropname)
229 if (searchptr && !*searchptr) {
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)
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,...)
constexpr const char * c_str() const
BLI_INLINE Texture * wrap(MTLTexture *texture)
int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop)
Button * uiDefAutoButR(Block *block, PointerRNA *ptr, PropertyRNA *prop, int index, std::optional< StringRef > name, int icon, int x, int y, int width, int height, std::optional< ButtonType > button_type_override=std::nullopt)
static Block * template_search_menu(bContext *C, ARegion *region, void *arg_template)
void template_search_preview(Layout *layout, bContext *C, PointerRNA *ptr, StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, int rows, int cols, std::optional< StringRef > text=std::nullopt)
int fontstyle_string_width(const uiFontStyle *fs, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void template_add_button_search_menu(const bContext *C, Layout &layout, Block *block, PointerRNA *ptr, PropertyRNA *prop, BlockCreateFunc block_func, void *block_argN, const std::optional< StringRef > tip, const bool use_previews, const bool editable, const bool live_icon, ButtonArgNFree func_argN_free_fn, ButtonArgNCopy func_argN_copy_fn)
void block_align_begin(Block *block)
int icon_from_idcode(int idcode)
static void template_search_add_button_searchmenu(const bContext *C, Layout *layout, Block *block, TemplateSearch &template_search, const bool editable, const bool live_icon)
Block * template_common_search_menu(const bContext *C, ARegion *region, ButtonSearchUpdateFn search_update_fn, void *search_arg, ButtonHandleFunc search_exec_fn, void *active_item, ButtonSearchTooltipFn item_tooltip_fn, const int preview_rows, const int preview_cols, float scale)
static void template_search_add_button_name(Block *block, PointerRNA *active_ptr, const StructRNA *type)
Button * uiDefIconButO(Block *block, ButtonType type, StringRefNull opname, wm::OpCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< StringRef > tip)
void button_drawflag_enable(Button *but, int flag)
void * but_func_argN_copy(const void *argN)
void template_search(Layout *layout, const bContext *C, PointerRNA *ptr, StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, std::optional< StringRef > text=std::nullopt)
static void template_search_exec_fn(bContext *C, void *arg_template, void *item)
void block_align_end(Block *block)
Button * uiDefIconTextButO(Block *block, ButtonType type, StringRefNull, wm::OpCallContext opcontext, int icon, StringRef str, int x, int y, short width, short height, std::optional< StringRef > tip)
static bool template_search_setup(TemplateSearch &template_search, PointerRNA *ptr, const StringRefNull propname, PointerRNA *searchptr, const char *const searchpropname)
void rna_collection_search_update_fn(const bContext *C, void *arg, const char *str, SearchItems *items, bool is_first)
void but_func_argN_free(void *argN)
Layout * uiItemL_respect_property_split(Layout *layout, StringRef text, int icon)
static void template_search_add_button_operator(Block *block, const char *const operator_name, const wm::OpCallContext opcontext, const int icon, const bool editable, const std::optional< StringRefNull > button_text={})
static PropertyRNA * template_search_get_searchprop(PointerRNA *targetptr, PropertyRNA *targetprop, PointerRNA *searchptr, const char *const searchpropname)
int template_search_textbut_height()
static void template_search_buttons(const bContext *C, Layout &layout, TemplateSearch &template_search, const char *newop, const char *unlinkop, const std::optional< StringRef > text)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
PropertyType RNA_property_type(PropertyRNA *prop)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
const char * RNA_struct_identifier(const StructRNA *type)
const char * RNA_property_ui_description(const PropertyRNA *prop, const PointerRNA *ptr)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
void decorator(PointerRNA *ptr, PropertyRNA *prop, int index)
PropertyRNA * target_prop
RNACollectionSearch search_data