Blender V5.0
interface_templates_intern.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#pragma once
12
13#include "MEM_guardedalloc.h"
14
15#include "RNA_access.hh"
16#include "RNA_types.hh"
17
19
20struct bContext;
21
22#define CURVE_ZOOM_MAX (1.0f / 25.0f)
23#define ERROR_LIBDATA_MESSAGE N_("Cannot edit external library data")
24
25/* Defines for templateID/TemplateSearch. */
26#define TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH (UI_UNIT_X * 4)
27#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y
28
33
34static inline void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
35{
36 /* we call update here on the pointer property, this way the
37 * owner of the curve mapping can still define its own update
38 * and notifier, even if the CurveMapping struct is shared. */
39 RNA_property_update(&C, &const_cast<PointerRNA &>(cb.ptr), cb.prop);
40}
41
42static inline void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/)
43{
44 RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
45 rna_update_cb(*C, *cb);
46}
47
48/* `interface_template.cc` */
55 uiLayout *layout,
56 uiBlock *block,
58 PropertyRNA *prop,
59 uiBlockCreateFunc block_func,
60 void *block_argN,
61 std::optional<blender::StringRef> tip,
62 const bool use_previews,
63 const bool editable,
64 const bool live_icon,
65 uiButArgNFree func_argN_free_fn = MEM_freeN,
66 uiButArgNCopy func_argN_copy_fn = MEM_dupallocN);
67
69 ARegion *region,
70 uiButSearchUpdateFn search_update_fn,
71 void *search_arg,
72 uiButHandleFunc search_exec_fn,
73 void *active_item,
74 uiButSearchTooltipFn item_tooltip_fn,
75 const int preview_rows,
76 const int preview_cols,
77 float scale);
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
void *(*)(const void *argN) uiButArgNCopy
void(*)(void *argN) uiButArgNFree
uiBlock *(*)(bContext *C, ARegion *region, void *arg1) uiBlockCreateFunc
ARegion *(*)(bContext *C, ARegion *region, const rcti *item_rect, void *arg, void *active) uiButSearchTooltipFn
void(*)(const bContext *C, void *arg, const char *str, uiSearchItems *items, bool is_first) uiButSearchUpdateFn
void(*)(bContext *C, void *arg1, void *arg2) uiButHandleFunc
void template_add_button_search_menu(const bContext *C, uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, uiBlockCreateFunc block_func, void *block_argN, std::optional< blender::StringRef > tip, const bool use_previews, const bool editable, const bool live_icon, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
int template_search_textbut_height()
static void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
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)
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
PointerRNA * ptr
Definition wm_files.cc:4238