41 const char *preview_id)
44 short *pr_texture =
nullptr;
49 RNA_warning(
"Expected ID of type material, texture, light, world or line style");
55 ID *pparent =
nullptr;
59 pr_texture = &(id_cast<Material *>(parent))->pr_texture;
62 pr_texture = &(id_cast<World *>(parent))->pr_texture;
65 pr_texture = &(id_cast<Light *>(parent))->pr_texture;
68 pr_texture = &(id_cast<FreestyleLineStyle *>(parent))->pr_texture;
81 if (!preview_id || (preview_id[0] ==
'\0')) {
84 preview_id = _preview_id;
93 ui_preview = MEM_new<uiPreview>(__func__);
119 block,
ButtonType::Extra,
"", 0, 0,
UI_UNIT_X * 10, ui_preview->
height, pid, 0.0, 0.0,
"");
121 [pid, pparent, slot, ui_preview](
const bContext *
C,
rcti *rect) {
137 if (pid && show_buttons) {
140 ma = id_cast<Material *>(pid);
143 ma = id_cast<Material *>(pparent);
157 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);
Blender kernel freestyle line style functionality.
#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)
#define RNA_warning(format,...)
#define ND_SHADING_PREVIEW
void button_func_set(Button *but, std::function< void(bContext &)> func)
Button * uiDefIconButV(Block *block, ButtonType type, int icon, int x, int y, short width, short height, T *poin, float min, float max, std::optional< StringRef > tip)
Button * uiDefBut(Block *block, ButtonTypeWithPointerType but_and_ptr_type, StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< StringRef > tip)
Button * uiDefButV(Block *block, ButtonType type, StringRef str, int x, int y, short width, short height, T *poin, float min, float max, std::optional< StringRef > tip)
void template_preview(Layout *layout, bContext *C, ID *id, bool show_buttons, ID *parent, MTex *slot, const char *preview_id)
void button_func_drawextra_set(Block *block, std::function< void(const bContext *C, rcti *rect)> func)
const char * BKE_idtype_idcode_to_name(short idcode)
PointerRNA RNA_id_pointer_create(ID *id)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BKE_scene_uses_blender_eevee(const Scene *scene)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
ID_Type GS(const char *name)
Scene * CTX_data_scene(const bContext *C)
void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, uiPreview *ui_preview, rcti *rect)
ARegion * CTX_wm_region(const bContext *C)
ListBaseT< uiPreview > ui_previews
unsigned int id_session_uid
void scale_x_set(float scale)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)