49 const char *preview_id)
52 short *pr_texture =
nullptr;
57 RNA_warning(
"Expected ID of type material, texture, light, world or line style");
63 ID *pparent =
nullptr;
67 pr_texture = &((
Material *)parent)->pr_texture;
70 pr_texture = &((
World *)parent)->pr_texture;
73 pr_texture = &((
Light *)parent)->pr_texture;
89 if (!preview_id || (preview_id[0] ==
'\0')) {
92 preview_id = _preview_id;
128 block,
UI_BTYPE_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) {
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(dst, format,...)
char * STRNCPY(char(&dst)[N], const char *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,...)
uiBut * uiDefButS(uiBlock *block, int 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)
void UI_but_func_drawextra_set(uiBlock *block, std::function< void(const bContext *C, rcti *rect)> func)
uiBut * uiDefBut(uiBlock *block, int 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)
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
uiBut * uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, std::optional< blender::StringRef > tip)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
void uiLayoutSetScaleX(uiLayout *layout, float scale)
void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect)
#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)