50 const char *preview_id)
53 short *pr_texture =
nullptr;
58 RNA_warning(
"Expected ID of type material, texture, light, world or line style");
64 ID *pparent =
nullptr;
68 pr_texture = &((
Material *)parent)->pr_texture;
71 pr_texture = &((
World *)parent)->pr_texture;
74 pr_texture = &((
Light *)parent)->pr_texture;
90 if (!preview_id || (preview_id[0] ==
'\0')) {
93 preview_id = _preview_id;
128 block,
ButType::Extra, 0,
"", 0, 0,
UI_UNIT_X * 10, ui_preview->
height, pid, 0.0, 0.0,
"");
130 [pid, pparent, slot, ui_preview](
const bContext *
C,
rcti *rect) {
149 if (pid && show_buttons) {
162 col->scale_x_set(1.5);
169 col->prop(&material_ptr,
"use_preview_world",
UI_ITEM_NONE,
"", ICON_WORLD);
261 row = &layout->
row(
false);
262 row->
prop(&texture_ptr,
"use_preview_alpha",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
const char * BKE_idtype_idcode_to_name(short idcode)
Blender kernel freestyle line style functionality.
bool BKE_scene_uses_blender_eevee(const Scene *scene)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_ID_WORLD
#define BLT_I18NCONTEXT_ID_LIGHT
#define CTX_IFACE_(context, msgid)
void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, uiPreview *ui_preview, rcti *rect)
#define RNA_warning(format,...)
void UI_but_func_drawextra_set(uiBlock *block, std::function< void(const bContext *C, rcti *rect)> func)
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
uiBut * uiDefButS(uiBlock *block, ButType type, int retval, blender::StringRef str, int x, int y, short width, short height, short *poin, float min, float max, std::optional< blender::StringRef > tip)
uiBut * uiDefIconButS(uiBlock *block, ButType type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, std::optional< blender::StringRef > tip)
uiBut * uiDefBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
#define ND_SHADING_PREVIEW
void uiTemplatePreview(uiLayout *layout, bContext *C, ID *id, bool show_buttons, ID *parent, MTex *slot, const char *preview_id)
static void do_preview_buttons(bContext *C, void *arg, int event)
void * MEM_callocN(size_t len, const char *str)
PointerRNA RNA_id_pointer_create(ID *id)
uiLayout & column(bool align)
uiLayout & row(bool align)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
unsigned int id_session_uid
void WM_event_add_notifier(const bContext *C, uint type, void *reference)