Blender V5.3
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
20namespace blender {
21
22struct bContext;
23
24namespace ui {
25
26#define CURVE_ZOOM_MAX (1.0f / 25.0f)
27#define ERROR_LIBDATA_MESSAGE N_("Cannot edit external library data")
28
29/* Defines for templateID/TemplateSearch. */
30#define TEMPLATE_SEARCH_TEXTBUT_MIN_WIDTH (UI_UNIT_X * 4)
31#define TEMPLATE_SEARCH_TEXTBUT_HEIGHT UI_UNIT_Y
32
37
38static inline void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
39{
40 /* we call update here on the pointer property, this way the
41 * owner of the curve mapping can still define its own update
42 * and notifier, even if the CurveMapping struct is shared. */
43 RNA_property_update(&C, &const_cast<PointerRNA &>(cb.ptr), cb.prop);
44}
45
46static inline void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/)
47{
48 RNAUpdateCb *cb = static_cast<RNAUpdateCb *>(arg_cb);
49 rna_update_cb(*C, *cb);
50}
51
52/* `interface_template.cc` */
59 Layout &layout,
60 Block *block,
61 PointerRNA *ptr,
62 PropertyRNA *prop,
63 BlockCreateFunc block_func,
64 void *block_argN,
65 std::optional<StringRef> tip,
66 const bool use_previews,
67 const bool editable,
68 const bool live_icon,
69 ButtonArgNFree func_argN_free_fn = MEM_delete_void,
70 ButtonArgNCopy func_argN_copy_fn = MEM_dupalloc);
71
73 ARegion *region,
74 ButtonSearchUpdateFn search_update_fn,
75 void *search_arg,
76 ButtonHandleFunc search_exec_fn,
77 void *active_item,
78 ButtonSearchTooltipFn item_tooltip_fn,
79 const int preview_rows,
80 const int preview_cols,
81 float scale);
82
83} // namespace ui
84} // namespace blender
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
float3x3 scale(float3x3 mat, float2 scale)
int template_search_textbut_width(PointerRNA *ptr, PropertyRNA *name_prop)
void(*)(bContext *C, void *arg1, void *arg2) ButtonHandleFunc
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)
static void rna_update_cb(bContext &C, const RNAUpdateCb &cb)
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)
ARegion *(*)(bContext *C, ARegion *region, const rcti *item_rect, void *arg, void *active) ButtonSearchTooltipFn
Block *(*)(bContext *C, ARegion *region, void *arg1) BlockCreateFunc
void *(*)(const void *argN) ButtonArgNCopy
void(*)(const bContext *C, void *arg, const char *str, SearchItems *items, bool is_first) ButtonSearchUpdateFn
void(*)(void *argN) ButtonArgNFree
int template_search_textbut_height()
BMesh Iterators.
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void MEM_delete_void(void *vmemh)