1
1

Compare commits

...

21 Commits

Author SHA1 Message Date
4858f9faab FIx merge issues, move preview resolution setting from RNA to BKE, do not clear preview when setting same resolution as current one. 2016-12-15 12:09:34 +01:00
e3812b525f Merge branch 'master' into multi_previews_id
Conflicts:
	source/blender/editors/interface/interface_widgets.c
2016-12-15 11:56:59 +01:00
65b4a9f403 Add copy_from_render to Image RNA API, allows to get 'real' usable image out of render_result one. 2016-11-14 18:13:14 +01:00
1d31566b76 Partially revert rBd089bfa9f094.
For now, we do want to keep direct access to raw data as ints/floats.
Time will say whether we want to keep those in final version or not.

Also, minor tweaks to 'set from image' functions.
2016-11-14 16:30:14 +01:00
c59ef89456 Ensure given frame index is valid in drawing icon code. 2016-11-14 15:50:50 +01:00
1812ce530d Revert "Somewhat gracefully handle frame index out of bound error."
This is not to be handled in BKE, but in calling code, BKE only asserts
values are valid.

This reverts commit e3fd455d32.
2016-11-14 15:49:13 +01:00
d955781fe0 Merge branch 'master' into multi_previews_id 2016-11-14 15:49:03 +01:00
d089bfa9f0 Don't pass pixels through RNA, but Image pointers.
This makes setting preview images MUCH faster; passing pixels was
O(n^2) in the number of pixels. It also prevents us from having double
setter functions (floats/bytes).
2016-11-11 17:32:32 +01:00
e3fd455d32 Somewhat gracefully handle frame index out of bound error.
@mont29 We should look at how we handle this properly; I think that the
printf() causes too much console noise.
2016-11-11 17:31:24 +01:00
9bf323b8ce Replace multi-dim array access to preview image frames by API functions.
Multi-dim array access in RNA is far (very, very far) from being
optimal, so for now let's use functions instead.
2016-11-08 16:14:24 +01:00
c8a5475aba Merge branch 'master' into multi_previews_id 2016-11-08 14:23:20 +01:00
f8f1155c46 Merge branch 'master' into multi_previews_id 2016-11-07 15:37:24 +01:00
9c96cfd879 Add multi-frame float access in RNA. 2016-11-01 17:23:04 +01:00
d12bd5f7a4 Merge branch 'master' into multi_previews_id 2016-11-01 16:47:29 +01:00
16b2602791 Revert "Applied my work from temp-sybren-poselib branch."
This reverts commit ffb0ed305d.
2016-11-01 15:19:15 +01:00
ffb0ed305d Applied my work from temp-sybren-poselib branch.
Still a bit rough. For example, the viewport used for OpenGL rendering is
more or less randomly chosen from the current screen.
2016-11-01 15:14:15 +01:00
607b8aee08 Merge branch 'master' into multi_previews_id 2016-11-01 14:50:41 +01:00
fc383cd56e Add preview to Action datablock.
Hopefully did not forget anything.
2016-10-22 12:29:26 +02:00
56598fd342 Some UI access to multi-frames icons...
Not so happy to have to change whole UI API like that, but... can't
really see another solution, since layout API does not return any
handler to button(s) it creates. :/
2016-10-22 10:47:27 +02:00
6d33cc1d54 Add first basic RNA API for multi-frames previews.
Not much to say here, still more to add, but this should be enough for a
first basic usage.
2016-10-22 10:47:27 +02:00
6afde3ed69 Multi-previews: basics (not yet usable from end-user code).
This commits adds data and basic API needed to handle multi-previews in
a single PreviewImage struct.

Data model is designed to be fully compatible (backward and forward)
with previous one, while keeping a 'flat array' design to store
previews. It also adds an extra integer per frame, that may be used to
store various meta-data.

This commit also updates write/read code, and adds basic BKE API to handle
multiple frames.

TODO: UI code (only very minimal stuff done so far, probably want to add
some template options too...). Access between icon ID and preview frames
is not yet fully designed, but think will rather go with an extra
integer rather that generating an icon ID/icon struct for every frame.
2016-10-22 10:47:27 +02:00
49 changed files with 937 additions and 309 deletions

View File

@@ -99,6 +99,25 @@ struct PreviewImage *BKE_previewimg_create(void);
/* create a copy of the preview image */
struct PreviewImage *BKE_previewimg_copy(struct PreviewImage *prv);
size_t BKE_previewimg_get_rect_size(struct PreviewImage *prv, const int size);
void BKE_previewimg_resolution_set(struct PreviewImage *prv, const int size, const int width, const int height);
void BKE_previewimg_num_frames_set(struct PreviewImage *prv, const short num_frames);
void BKE_previewimg_frame_delete(struct PreviewImage *prv, const short frame_idx);
unsigned int *BKE_previewimg_frame_data_get(
const struct PreviewImage *prv,
const unsigned short frame_idx, const enum eIconSizes size, int *r_meta);
unsigned int *BKE_previewimg_frame_data_search(
const struct PreviewImage *prv,
const int meta, const enum eIconSizes size, unsigned short *r_frame_idx);
void BKE_previewimg_frame_data_set(
const struct PreviewImage *prv,
const unsigned short frame_idx, const enum eIconSizes size, const int meta, const unsigned int *data);
void BKE_previewimg_id_copy(struct ID *new_id, struct ID *old_id);
/* retrieve existing or create new preview image */

View File

@@ -63,6 +63,7 @@
#include "BKE_library_remap.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_icons.h"
#include "BIK_api.h"
@@ -115,6 +116,8 @@ void BKE_action_free(bAction *act)
/* Free pose-references (aka local markers) */
BLI_freelistN(&act->markers);
BKE_previewimg_free(&act->preview);
}
/* .................................. */
@@ -158,6 +161,8 @@ bAction *BKE_action_copy(Main *bmain, bAction *src)
BKE_id_copy_ensure_local(bmain, &src->id, &dst->id);
BKE_previewimg_id_copy(&dst->id, &src->id);
return dst;
}

View File

@@ -158,6 +158,14 @@ PreviewImage *BKE_previewimg_create(void)
return previewimg_create_ex(0);
}
static void previewimg_gputexture_free_single(PreviewImage *prv, enum eIconSizes size)
{
if (prv->gputexture[size]) {
GPU_texture_free(prv->gputexture[size]);
prv->gputexture[size] = NULL;
}
}
void BKE_previewimg_freefunc(void *link)
{
PreviewImage *prv = (PreviewImage *)link;
@@ -168,8 +176,7 @@ void BKE_previewimg_freefunc(void *link)
if (prv->rect[i]) {
MEM_freeN(prv->rect[i]);
}
if (prv->gputexture[i])
GPU_texture_free(prv->gputexture[i]);
previewimg_gputexture_free_single(prv, i);
}
MEM_freeN(prv);
@@ -184,12 +191,10 @@ void BKE_previewimg_free(PreviewImage **prv)
}
}
void BKE_previewimg_clear_single(struct PreviewImage *prv, enum eIconSizes size)
void BKE_previewimg_clear_single(PreviewImage *prv, enum eIconSizes size)
{
MEM_SAFE_FREE(prv->rect[size]);
if (prv->gputexture[size]) {
GPU_texture_free(prv->gputexture[size]);
}
previewimg_gputexture_free_single(prv, size);
prv->h[size] = prv->w[size] = 0;
prv->flag[size] |= PRV_CHANGED;
prv->flag[size] &= ~PRV_USER_EDITED;
@@ -198,8 +203,8 @@ void BKE_previewimg_clear_single(struct PreviewImage *prv, enum eIconSizes size)
void BKE_previewimg_clear(struct PreviewImage *prv)
{
int i;
for (i = 0; i < NUM_ICON_SIZES; ++i) {
prv->num_frames = 0;
for (int i = 0; i < NUM_ICON_SIZES; ++i) {
BKE_previewimg_clear_single(prv, i);
}
}
@@ -221,6 +226,145 @@ PreviewImage *BKE_previewimg_copy(PreviewImage *prv)
return prv_img;
}
#define PREVIEWIMG_OFFSET(_prv, _size, _idx) \
((_idx) * (_prv)->w[(_size)] * (_prv)->h[(_size)] + (_idx))
size_t BKE_previewimg_get_rect_size(struct PreviewImage *prv, const int size)
{
if (prv->num_frames != 0) {
return PREVIEWIMG_OFFSET(prv, size, prv->num_frames) * sizeof(*prv->rect[size]);
}
else {
return prv->w[size] * prv->h[size] * sizeof(*prv->rect[size]);
}
}
void BKE_previewimg_resolution_set(PreviewImage *prv, const int size, const int width, const int height)
{
if (width == prv->w[size] && height == prv->h[size]) {
/* Same size, do nothing. */
return;
}
BKE_previewimg_clear_single(prv, size);
if (width && height) {
prv->w[size] = width;
prv->h[size] = height;
prv->rect[size] = MEM_callocN(BKE_previewimg_get_rect_size(prv, size), __func__);
}
prv->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
}
void BKE_previewimg_num_frames_set(struct PreviewImage *prv, const short num_frames)
{
BLI_assert(prv != NULL);
if (num_frames == prv->num_frames) {
return;
}
prv->num_frames = num_frames;
for (int i = 0; i < NUM_ICON_SIZES; i++) {
if (prv->rect[i]) {
prv->rect[i] = MEM_recallocN_id(prv->rect[i], BKE_previewimg_get_rect_size(prv, i), __func__);
}
previewimg_gputexture_free_single(prv, i);
}
}
void BKE_previewimg_frame_delete(struct PreviewImage *prv, const short frame_idx)
{
BLI_assert(prv != NULL && frame_idx < prv->num_frames && frame_idx >= 0);
if (prv->num_frames <= 1) {
BKE_previewimg_clear(prv);
return;
}
prv->num_frames--;
for (int i = 0; i < NUM_ICON_SIZES; i++) {
if (prv->rect[i]) {
if (frame_idx != prv->num_frames) {
unsigned int *p_del_idx = &prv->rect[i][PREVIEWIMG_OFFSET(prv, i, frame_idx)];
unsigned int *p_nxt_idx = &prv->rect[i][PREVIEWIMG_OFFSET(prv, i, frame_idx + 1)];
size_t nxt_size = (size_t)(&prv->rect[i][PREVIEWIMG_OFFSET(prv, i, prv->num_frames + 1)] - p_nxt_idx) * sizeof(*prv->rect[i]);
memmove(p_del_idx, p_nxt_idx, nxt_size);
}
prv->rect[i] = MEM_reallocN_id(prv->rect[i], BKE_previewimg_get_rect_size(prv, i), __func__);
}
previewimg_gputexture_free_single(prv, i);
}
}
unsigned int *BKE_previewimg_frame_data_get(
const PreviewImage *prv, const unsigned short frame_idx, const enum eIconSizes size, int *r_meta)
{
BLI_assert(prv != NULL && frame_idx < prv->num_frames);
unsigned int *frame = NULL;
if (r_meta) {
*r_meta = 0;
}
if (prv->rect[size]) {
frame = &prv->rect[size][PREVIEWIMG_OFFSET(prv, size, frame_idx)];
if (r_meta && prv->num_frames > 0) {
*r_meta = frame[prv->w[size] * prv->h[size]];
}
}
return frame;
}
/* Would we want to rather use a search callback? */
unsigned int *BKE_previewimg_frame_data_search(
const PreviewImage *prv, const int meta, const enum eIconSizes size, unsigned short *r_frame_idx)
{
BLI_assert(prv != NULL);
unsigned int *frame = NULL;
if (r_frame_idx) {
*r_frame_idx = 0;
}
if (prv->rect[size]) {
if (prv->num_frames == 0) {
if (meta == 0) { /* Convention... */
frame = prv->rect[size];
}
}
else {
ptrdiff_t stride = &prv->rect[size][PREVIEWIMG_OFFSET(prv, size, 1)] - &prv->rect[size][0];
unsigned int *frame_it = prv->rect[size];
for (unsigned short i = 0; i < prv->num_frames; i++, frame_it += stride) {
if (frame_it[prv->w[size] * prv->h[size]] == meta) {
if (r_frame_idx) {
*r_frame_idx = i;
}
frame = frame_it;
break;
}
}
}
}
return frame;
}
void BKE_previewimg_frame_data_set(
const PreviewImage *prv,
const unsigned short frame_idx, const enum eIconSizes size, const int meta, const unsigned int *data)
{
BLI_assert(prv != NULL && frame_idx < prv->num_frames);
unsigned int *frame = &prv->rect[size][PREVIEWIMG_OFFSET(prv, size, frame_idx)];
memcpy(frame, data, prv->w[size] * prv->h[size] * sizeof(*prv->rect[size]));
if (prv->num_frames > 0) {
frame[prv->w[size] * prv->h[size]] = meta;
}
}
/** Duplicate preview image from \a id and clear icon_id, to be used by datablock copy functions. */
void BKE_previewimg_id_copy(ID *new_id, ID *old_id)
{
@@ -252,6 +396,7 @@ PreviewImage **BKE_previewimg_id_get_p(ID *id)
ID_PRV_CASE(ID_OB, Object);
ID_PRV_CASE(ID_GR, Group);
ID_PRV_CASE(ID_SCE, Scene);
ID_PRV_CASE(ID_AC, bAction);
#undef ID_PRV_CASE
}

View File

@@ -53,6 +53,7 @@
#include "BKE_main.h"
#include "BKE_library.h" // for BKE_main_free
#include "BKE_icons.h"
#include "BKE_idcode.h"
#include "BLO_readfile.h"
@@ -211,7 +212,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
memcpy(new_prv, prv, sizeof(PreviewImage));
if (prv->rect[0] && prv->w[0] && prv->h[0]) {
unsigned int *rect = NULL;
size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(unsigned int);
size_t len = BKE_previewimg_get_rect_size(new_prv, 0);
new_prv->rect[0] = MEM_callocN(len, __func__);
bhead = blo_nextbhead(fd, bhead);
rect = (unsigned int *)(bhead + 1);
@@ -228,7 +229,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
if (prv->rect[1] && prv->w[1] && prv->h[1]) {
unsigned int *rect = NULL;
size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int);
size_t len = BKE_previewimg_get_rect_size(new_prv, 1);
new_prv->rect[1] = MEM_callocN(len, __func__);
bhead = blo_nextbhead(fd, bhead);
rect = (unsigned int *)(bhead + 1);

View File

@@ -2546,6 +2546,8 @@ static void direct_link_action(FileData *fd, bAction *act)
agrp->channels.first= newdataadr(fd, agrp->channels.first);
agrp->channels.last= newdataadr(fd, agrp->channels.last);
}
act->preview = direct_link_preview_image(fd, act->preview);
}
static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list)

View File

@@ -161,6 +161,7 @@
#include "BKE_curve.h"
#include "BKE_constraint.h"
#include "BKE_global.h" // for G
#include "BKE_icons.h"
#include "BKE_idcode.h"
#include "BKE_library.h" // for set_listbasepointers
#include "BKE_main.h"
@@ -691,10 +692,10 @@ static void write_previews(WriteData *wd, const PreviewImage *prv_orig)
}
writestruct_at_address(wd, DATA, PreviewImage, 1, prv_orig, &prv);
if (prv.rect[0]) {
writedata(wd, DATA, prv.w[0] * prv.h[0] * sizeof(unsigned int), prv.rect[0]);
writedata(wd, DATA, BKE_previewimg_get_rect_size(&prv, 0), prv.rect[0]);
}
if (prv.rect[1]) {
writedata(wd, DATA, prv.w[1] * prv.h[1] * sizeof(unsigned int), prv.rect[1]);
writedata(wd, DATA, BKE_previewimg_get_rect_size(&prv, 1), prv.rect[1]);
}
}
}
@@ -817,6 +818,8 @@ static void write_actions(WriteData *wd, ListBase *idbase)
for (marker = act->markers.first; marker; marker = marker->next) {
writestruct(wd, DATA, TimeMarker, 1, marker);
}
write_previews(wd, act->preview);
}
}

View File

@@ -290,13 +290,13 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* before range */
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Before:"), ICON_NONE);
uiItemL(col, IFACE_("Before:"), ICON_NONE, 0);
uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
/* after range */
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("After:"), ICON_NONE);
uiItemL(col, IFACE_("After:"), ICON_NONE, 0);
uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
}
@@ -428,7 +428,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* general settings */
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
uiItemL(col, IFACE_("Envelope:"), ICON_NONE, 0);
uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
row = uiLayoutRow(col, true);
@@ -587,9 +587,9 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* name */
if (fmi)
uiItemL(sub, IFACE_(fmi->name), ICON_NONE);
uiItemL(sub, IFACE_(fmi->name), ICON_NONE, 0);
else
uiItemL(sub, IFACE_("<Unknown Modifier>"), ICON_NONE);
uiItemL(sub, IFACE_("<Unknown Modifier>"), ICON_NONE, 0);
/* right-align ------------------------------------------- */
sub = uiLayoutRow(row, true);

View File

@@ -984,7 +984,7 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const ch
PointerRNA uiItemFullO(uiLayout *layout, const char *idname, const char *name, int icon, struct IDProperty *properties, int context, int flag);
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon);
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon);
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon, const unsigned short icon_frame);
void uiItemEnumR_prop(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, PropertyRNA *prop, int value);
void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value);
void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon);
@@ -998,7 +998,7 @@ void uiItemsFullEnumO_items(
IDProperty *properties, int context, int flag,
const EnumPropertyItem *item_array, int totitem);
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
void uiItemL(uiLayout *layout, const char *name, int icon, const unsigned short icon_frame); /* label */
void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */

View File

@@ -70,7 +70,7 @@ void UI_icon_draw_preview(float x, float y, int icon_id);
void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect);
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, float alpha, int size);
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha);
void UI_icon_draw_aspect(float x, float y, int icon_id, const short frame, float aspect, float alpha);
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]);
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha);
void UI_icons_free(void);

View File

@@ -719,6 +719,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu
/* drawing */
oldbut->icon = but->icon;
oldbut->icon_frame = but->icon_frame;
oldbut->iconadd = but->iconadd;
oldbut->alignnr = but->alignnr;
@@ -3219,12 +3220,15 @@ static uiBut *ui_def_but(
return but;
}
void ui_def_but_icon(uiBut *but, const int icon, const int flag)
/* Note that we may extend this further in future (thinking e.g. to some animated icons for active widget,
* could be nice for videos or animations previews... */
void ui_def_but_icon_ex(uiBut *but, const int icon, const short frame, const int flag)
{
if (icon) {
ui_icon_ensure_deferred(but->block->evil_C, icon, (flag & UI_BUT_ICON_PREVIEW) != 0);
}
but->icon = (BIFIconID)icon;
but->icon_frame = frame;
but->flag |= flag;
if (but->str && but->str[0]) {
@@ -3232,6 +3236,11 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag)
}
}
void ui_def_but_icon(uiBut *but, const int icon, const int flag)
{
ui_def_but_icon_ex(but, icon, 0, flag);
}
static void ui_def_but_rna__disable(uiBut *but, const char *info)
{
but->flag |= UI_BUT_DISABLED;
@@ -3329,7 +3338,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
if (!item->identifier[0]) {
if (item->name) {
if (item->icon) {
uiItemL(column, item->name, item->icon);
uiItemL(column, item->name, item->icon, 0);
}
else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */

View File

@@ -825,6 +825,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
prv_img->flag[size] |= PRV_CHANGED;
prv_img->changed_timestamp[size] = 0;
prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(unsigned int), "prv_rect");
prv_img->num_frames = 0;
}
}
@@ -1067,14 +1068,15 @@ static int get_draw_size(enum eIconSizes size)
static void icon_draw_size(
float x, float y, int icon_id, float aspect, float alpha, const float rgb[3],
enum eIconSizes size, int draw_size, const bool UNUSED(nocreate), const bool is_preview)
const float x, const float y, const int icon_id, const short frame_idx, const float aspect,
float alpha, const float rgb[3],
const enum eIconSizes size, const int draw_size, const bool UNUSED(nocreate), const bool is_preview)
{
bTheme *btheme = UI_GetTheme();
Icon *icon = NULL;
DrawInfo *di = NULL;
IconImage *iimg;
const float fdraw_size = (float)draw_size;
const float fdraw_size = (const float)draw_size;
int w, h;
icon = BKE_icon_get(icon_id);
@@ -1133,7 +1135,14 @@ static void icon_draw_size(
/* preview images use premul alpha ... */
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, rgb, is_preview);
if (frame_idx > 0 && frame_idx < pi->num_frames) {
unsigned int *rect = BKE_previewimg_frame_data_get(pi, frame_idx, size, NULL);
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], rect, alpha, rgb, is_preview);
}
else {
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, rgb, is_preview);
}
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
@@ -1248,6 +1257,7 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big)
case ID_IM: /* fall through */
case ID_WO: /* fall through */
case ID_LA: /* fall through */
case ID_AC: /* fall through */
iconid = BKE_icon_id_ensure(id);
/* checks if not exists, or changed */
UI_id_icon_render(C, NULL, id, big, true);
@@ -1364,47 +1374,47 @@ int UI_idcode_icon_get(const int idcode)
}
static void icon_draw_at_size(
float x, float y, int icon_id, float aspect, float alpha,
float x, float y, int icon_id, const short frame, float aspect, float alpha,
enum eIconSizes size, const bool nocreate)
{
int draw_size = get_draw_size(size);
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, false);
icon_draw_size(x, y, icon_id, frame, aspect, alpha, NULL, size, draw_size, nocreate, false);
}
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
void UI_icon_draw_aspect(float x, float y, int icon_id, const short frame, float aspect, float alpha)
{
icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0);
icon_draw_at_size(x, y, icon_id, frame, aspect, alpha, ICON_SIZE_ICON, 0);
}
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3])
{
int draw_size = get_draw_size(ICON_SIZE_ICON);
icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, false, false);
icon_draw_size(x, y, icon_id, 0, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, false, false);
}
/* draws icon with dpi scale factor */
void UI_icon_draw(float x, float y, int icon_id)
{
UI_icon_draw_aspect(x, y, icon_id, 1.0f / UI_DPI_FAC, 1.0f);
UI_icon_draw_aspect(x, y, icon_id, 0, 1.0f / UI_DPI_FAC, 1.0f);
}
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
{
icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, true, false);
icon_draw_size(x, y, icon_id, 0, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, true, false);
}
void UI_icon_draw_preview(float x, float y, int icon_id)
{
icon_draw_at_size(x, y, icon_id, 1.0f, 1.0f, ICON_SIZE_PREVIEW, 0);
icon_draw_at_size(x, y, icon_id, 0, 1.0f, 1.0f, ICON_SIZE_PREVIEW, 0);
}
void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect)
{
icon_draw_at_size(x, y, icon_id, aspect, 1.0f, ICON_SIZE_PREVIEW, 0);
icon_draw_at_size(x, y, icon_id, 0, aspect, 1.0f, ICON_SIZE_PREVIEW, 0);
}
void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, float alpha, int size)
{
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, ICON_SIZE_PREVIEW, size, false, true);
icon_draw_size(x, y, icon_id, 0, aspect, alpha, NULL, ICON_SIZE_PREVIEW, size, false, true);
}

View File

@@ -275,6 +275,7 @@ struct uiBut {
const char *disabled_info;
BIFIconID icon;
short icon_frame; /* For icon pointing to multi-frames ImagePreview. */
char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */
signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */
char changed; /* could be made into a single flag */
@@ -482,6 +483,7 @@ extern bool ui_but_string_set_eval_num(struct bContext *C, uiBut *but, const cha
extern int ui_but_string_get_max_length(uiBut *but);
extern uiBut *ui_but_drag_multi_edit_get(uiBut *but);
void ui_def_but_icon_ex(uiBut *but, const int icon, const short frame, const int flag);
void ui_def_but_icon(uiBut *but, const int icon, const int flag);
extern uiButExtraIconType ui_but_icon_extra_get(uiBut *but);

View File

@@ -978,7 +978,7 @@ void uiItemsFullEnumO_items(
}
if (item->icon || radial) {
uiItemL(target, item->name, item->icon);
uiItemL(target, item->name, item->icon, 0);
but = block->buttons.last;
}
@@ -1264,7 +1264,7 @@ static void ui_item_rna_size(
*r_h = h;
}
void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, const char *name, int icon)
void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, const char *name, int icon, const unsigned short icon_frame)
{
uiBlock *block = layout->root->block;
uiBut *but = NULL;
@@ -1345,11 +1345,11 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
/* enum item */
else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
if (icon && name[0] && !icon_only)
uiDefIconTextButR_prop(block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
but = uiDefIconTextButR_prop(block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else if (icon)
uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
else
uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
but = uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
}
/* expanded enum */
else if (type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
@@ -1376,6 +1376,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
if (but && icon_frame != 0) {
ui_def_but_icon_ex(but, icon, icon_frame, UI_HAS_ICON);
}
/* Mark non-embossed textfields inside a listbox. */
if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && (but->dt & UI_EMBOSS_NONE)) {
UI_but_flag_enable(but, UI_BUT_LIST_ITEM);
@@ -1401,7 +1405,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag,
return;
}
uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon);
uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon, 0);
}
void uiItemEnumR_prop(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, PropertyRNA *prop, int value)
@@ -1413,7 +1417,7 @@ void uiItemEnumR_prop(uiLayout *layout, const char *name, int icon, struct Point
return;
}
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon);
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon, 0);
}
void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value)
@@ -1426,7 +1430,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA
return;
}
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon);
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon, 0);
}
void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon)
@@ -1457,7 +1461,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
if (item[a].value == ivalue) {
const char *item_name = name ? name : CTX_IFACE_(RNA_property_translation_context(prop), item[a].name);
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, item_name, icon ? icon : item[a].icon);
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, item_name, icon ? icon : item[a].icon, 0);
break;
}
}
@@ -1507,7 +1511,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
block->flag |= UI_BLOCK_NO_FLIP;
}
uiItemL(column, item[i].name, ICON_NONE);
uiItemL(column, item[i].name, ICON_NONE, 0);
bt = block->buttons.last;
bt->drawflag = UI_BUT_TEXT_LEFT;
@@ -1843,7 +1847,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
}
/* label item */
static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon, const unsigned short icon_frame)
{
uiBlock *block = layout->root->block;
uiBut *but;
@@ -1865,6 +1869,10 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
else
but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
if (icon_frame != 0) {
ui_def_but_icon_ex(but, icon, icon_frame, UI_HAS_ICON);
}
/* to compensate for string size padding in ui_text_icon_width,
* make text aligned right if the layout is aligned right.
*/
@@ -1881,14 +1889,14 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
return but;
}
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiItemL(uiLayout *layout, const char *name, int icon, const unsigned short icon_frame)
{
uiItemL_(layout, name, icon);
uiItemL_(layout, name, icon, icon_frame);
}
void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
{
uiBut *but = uiItemL_(layout, name, icon);
uiBut *but = uiItemL_(layout, name, icon, 0);
if (ptr && ptr->type)
if (RNA_struct_is_ID(ptr->type))
@@ -3448,7 +3456,7 @@ void uiLayoutOperatorButs(
}
if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE, 0);
}
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
@@ -3457,7 +3465,7 @@ void uiLayoutOperatorButs(
UI_block_lock_set(uiLayoutGetBlock(layout), true, "Operator can't' redo");
/* XXX, could give some nicer feedback or not show redo panel at all? */
uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE);
uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE, 0);
}
else {
/* useful for macros where only one of the steps can't be re-done */
@@ -3503,7 +3511,7 @@ void uiLayoutOperatorButs(
empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
if (empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
uiItemL(layout, IFACE_("No Properties"), ICON_NONE, 0);
}
}

View File

@@ -621,7 +621,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
{
glEnable(GL_BLEND);
UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
(panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
(panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED, 0,
(block->aspect / UI_DPI_FAC), 1.0f);
glDisable(GL_BLEND);
}

View File

@@ -3075,7 +3075,7 @@ int UI_pie_menu_invoke_from_rna_enum(
layout = UI_pie_menu_layout(pie);
layout = uiLayoutRadial(layout);
uiItemFullR(layout, &r_ptr, r_prop, RNA_NO_INDEX, 0, UI_ITEM_R_EXPAND, NULL, 0);
uiItemFullR(layout, &r_ptr, r_prop, RNA_NO_INDEX, 0, UI_ITEM_R_EXPAND, NULL, 0, 0);
UI_pie_menu_end(C, pie);
@@ -3220,7 +3220,7 @@ void UI_popup_menu_reports(bContext *C, ReportList *reports)
BLI_strncpy(buf, msg, MIN2(sizeof(buf), msg_next - msg));
msg = buf;
}
uiItemL(layout, msg, icon);
uiItemL(layout, msg, icon, 0);
icon = ICON_NONE;
} while ((msg = msg_next) && *msg);
}

View File

@@ -713,10 +713,10 @@ void uiTemplateAnyID(
/* Label - either use the provided text, or will become "ID-Block:" */
if (text) {
if (text[0])
uiItemL(row, text, ICON_NONE);
uiItemL(row, text, ICON_NONE, 0);
}
else {
uiItemL(row, IFACE_("ID-Block:"), ICON_NONE);
uiItemL(row, IFACE_("ID-Block:"), ICON_NONE, 0);
}
/* SECOND PART ................................................ */
@@ -726,13 +726,13 @@ void uiTemplateAnyID(
sub = uiLayoutRow(row, true); /* HACK: special group just for the enum, otherwise we */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE, 0);
/* ID-Block Selector - just use pointer widget... */
sub = uiLayoutRow(row, true); /* HACK: special group to counteract the effects of the previous */
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE, 0);
}
/********************* RNA Path Builder Template ********************/
@@ -866,7 +866,7 @@ static uiLayout *draw_modifier(
uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
/* modifier-type icon */
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
uiItemL(row, "", RNA_struct_ui_icon(ptr.type), 0);
UI_block_emboss_set(block, UI_EMBOSS);
/* modifier name */
@@ -1000,7 +1000,7 @@ static uiLayout *draw_modifier(
if (md->error) {
box = uiLayoutBox(column);
row = uiLayoutRow(box, false);
uiItemL(row, md->error, ICON_ERROR);
uiItemL(row, md->error, ICON_ERROR, 0);
}
return result;
@@ -1153,7 +1153,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
}
else
uiItemL(row, con->name, ICON_NONE);
uiItemL(row, con->name, ICON_NONE, 0);
uiLayoutSetRedAlert(row, false);
@@ -2619,16 +2619,16 @@ static void uilist_draw_item_default(
/* Simplest one! */
switch (ui_list->layout_type) {
case UILST_LAYOUT_GRID:
uiItemL(layout, "", icon);
uiItemL(layout, "", icon, 0);
break;
case UILST_LAYOUT_DEFAULT:
case UILST_LAYOUT_COMPACT:
default:
if (nameprop) {
uiItemFullR(layout, itemptr, nameprop, RNA_NO_INDEX, 0, UI_ITEM_R_NO_BG, "", icon);
uiItemFullR(layout, itemptr, nameprop, RNA_NO_INDEX, 0, UI_ITEM_R_NO_BG, "", icon, 0);
}
else {
uiItemL(layout, "", icon);
uiItemL(layout, "", icon, 0);
}
break;
}
@@ -3134,7 +3134,7 @@ void uiTemplateList(
/* add dummy buttons to fill space */
for (; i < layoutdata.start_idx + layoutdata.visual_items; i++) {
uiItemL(col, "", ICON_NONE);
uiItemL(col, "", ICON_NONE, 0);
}
/* add scrollbar */
@@ -3161,7 +3161,7 @@ void uiTemplateList(
}
/* if list is empty, add in dummy button */
else {
uiItemL(row, "", ICON_NONE);
uiItemL(row, "", ICON_NONE, 0);
}
/* next/prev button */
@@ -3223,7 +3223,7 @@ void uiTemplateList(
if (!(i % columns)) {
subrow = uiLayoutRow(col, false);
}
uiItemL(subrow, "", ICON_NONE);
uiItemL(subrow, "", ICON_NONE, 0);
}
/* add scrollbar */
@@ -3672,7 +3672,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
uiItemS(layout);
if (title)
uiItemL(layout, title, ICON_NONE);
uiItemL(layout, title, ICON_NONE, 0);
flow = uiLayoutColumnFlow(layout, 2, false);
@@ -3697,7 +3697,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
row = uiLayoutRow(box, false);
/* property value */
uiItemFullR(row, ptr, prop, -1, 0, 0, NULL, ICON_NONE);
uiItemFullR(row, ptr, prop, -1, 0, 0, NULL, ICON_NONE, 0);
if (is_set) {
/* unset operator */
@@ -3913,7 +3913,7 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiItemR(row, &fileptr, "frame", 0, "Frame", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE, 0);
row = uiLayoutRow(layout, false);
uiLayoutSetEnabled(row, (sbuts->mainb == BCONTEXT_CONSTRAINT));

View File

@@ -189,14 +189,14 @@ int uiDefAutoButsRNA(
col = uiLayoutColumn(layout, true);
if (!is_boolean)
uiItemL(col, name, ICON_NONE);
uiItemL(col, name, ICON_NONE, 0);
}
else { /* (label_align == 'H') */
BLI_assert(label_align == 'H');
split = uiLayoutSplit(layout, 0.5f, false);
col = uiLayoutColumn(split, false);
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE, 0);
col = uiLayoutColumn(split, false);
}
@@ -211,7 +211,7 @@ int uiDefAutoButsRNA(
name = NULL; /* no smart label alignment, show default name with button */
}
uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE);
uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE, 0);
tot++;
}
RNA_STRUCT_END;

View File

@@ -831,7 +831,7 @@ static int ui_but_draw_menu_icon(const uiBut *but)
/* icons have been standardized... and this call draws in untransformed coordinates */
static void widget_draw_icon(
const uiBut *but, BIFIconID icon, float alpha, const rcti *rect,
const uiBut *but, BIFIconID icon, const float frame, float alpha, const rcti *rect,
const bool show_menu_icon)
{
float xs = 0.0f, ys = 0.0f;
@@ -901,15 +901,16 @@ static void widget_draw_icon(
float rgb[3] = {1.25f, 1.25f, 1.25f};
UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
}
else
UI_icon_draw_aspect(xs, ys, icon, aspect, alpha);
else {
UI_icon_draw_aspect(xs, ys, icon, frame, aspect, alpha);
}
}
if (show_menu_icon) {
xs = rect->xmax - UI_DPI_ICON_SIZE - aspect;
ys = (rect->ymin + rect->ymax - height) / 2.0f;
UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, 0, aspect, alpha);
}
glDisable(GL_BLEND);
@@ -1519,7 +1520,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (but->type == UI_BTYPE_MENU && (but->flag & UI_BUT_NODE_LINK)) {
rcti temp = *rect;
temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1;
widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false);
widget_draw_icon(but, ICON_LAYER_USED, 0, alpha, &temp, false);
}
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
@@ -1554,6 +1555,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
/* Icons on the left with optional text label on the right */
else if (but->flag & UI_HAS_ICON || show_menu_icon) {
const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE;
const short frame = (but->flag & UI_HAS_ICON) ? but->icon_frame : 0;
const float icon_size = ICON_SIZE_FROM_BUTRECT(rect);
/* menu item - add some more padding so menus don't feel cramped. it must
@@ -1561,7 +1563,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (ui_block_is_menu(but->block))
rect->xmin += 0.3f * U.widget_unit;
widget_draw_icon(but, icon, alpha, rect, show_menu_icon);
widget_draw_icon(but, icon, frame, alpha, rect, show_menu_icon);
rect->xmin += icon_size;
/* without this menu keybindings will overlap the arrow icon [#38083] */
@@ -1584,10 +1586,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f);
if (extra_icon_type == UI_BUT_ICONEXTRA_CLEAR) {
widget_draw_icon(but, ICON_X, alpha, &temp, false);
widget_draw_icon(but, ICON_X, 0, alpha, &temp, false);
}
else if (extra_icon_type == UI_BUT_ICONEXTRA_EYEDROPPER) {
widget_draw_icon(but, ICON_EYEDROPPER, alpha, &temp, false);
widget_draw_icon(but, ICON_EYEDROPPER, 0, alpha, &temp, false);
}
else {
BLI_assert(0);
@@ -4133,7 +4135,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
aspect = ICON_DEFAULT_HEIGHT / height;
glEnable(GL_BLEND);
UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f); /* XXX scale weak get from fstyle? */
UI_icon_draw_aspect(xs, ys, iconid, 0, aspect, 1.0f); /* XXX scale weak get from fstyle? */
glDisable(GL_BLEND);
}
}

View File

@@ -144,7 +144,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
#ifdef WITH_ALEMBIC_HDF5
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Archive Options:"), ICON_NONE);
uiItemL(row, IFACE_("Archive Options:"), ICON_NONE, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "compression_type", 0, NULL, ICON_NONE);
@@ -152,7 +152,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "global_scale", 0, NULL, ICON_NONE);
@@ -160,7 +160,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
/* Scene Options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Scene Options:"), ICON_SCENE_DATA);
uiItemL(row, IFACE_("Scene Options:"), ICON_SCENE_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "start", 0, NULL, ICON_NONE);
@@ -195,7 +195,7 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
/* Object Data */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Object Options:"), ICON_OBJECT_DATA);
uiItemL(row, IFACE_("Object Options:"), ICON_OBJECT_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "uvs", 0, NULL, ICON_NONE);
@@ -441,14 +441,14 @@ static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr)
{
uiLayout *box = uiLayoutBox(layout);
uiLayout *row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "scale", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Options:"), ICON_NONE);
uiItemL(row, IFACE_("Options:"), ICON_NONE, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "set_frame_range", 0, NULL, ICON_NONE);

View File

@@ -197,7 +197,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
/* Export Options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA, 0);
row = uiLayoutRow(box, false);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
@@ -225,7 +225,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
/* Texture options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
@@ -243,7 +243,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
/* Armature options */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
@@ -253,7 +253,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
/* Collada options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "triangulate", 0, NULL, ICON_NONE);
@@ -264,7 +264,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
row = uiLayoutRow(box, false);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
uiItemL(split, IFACE_("Transformation Type"), ICON_NONE);
uiItemL(split, IFACE_("Transformation Type"), ICON_NONE, 0);
uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE);
row = uiLayoutRow(box, false);
@@ -433,14 +433,14 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
/* Import Options: */
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA);
uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "import_units", 0, NULL, ICON_NONE);
box = uiLayoutBox(layout);
row = uiLayoutRow(box, false);
uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA);
uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA, 0);
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "fix_orientation", 0, NULL, ICON_NONE);

View File

@@ -197,7 +197,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f
alpha = min_ff(alpha, 0.75f);
UI_icon_draw_aspect(x, y, ICON_FULLSCREEN_EXIT, 0.7f / UI_DPI_FAC, alpha);
UI_icon_draw_aspect(x, y, ICON_FULLSCREEN_EXIT, 0, 0.7f / UI_DPI_FAC, alpha);
/* debug drawing :
* The click_rect is the same as defined in fullscreen_click_rcti_init

View File

@@ -5136,8 +5136,8 @@ static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, enum eDynTopoW
if (flag & (DYNTOPO_WARN_VDATA | DYNTOPO_WARN_EDATA | DYNTOPO_WARN_LDATA)) {
const char *msg_error = TIP_("Vertex Data Detected!");
const char *msg = TIP_("Dyntopo will not preserve vertex colors, UVs, or other customdata");
uiItemL(layout, msg_error, ICON_INFO);
uiItemL(layout, msg, ICON_NONE);
uiItemL(layout, msg_error, ICON_INFO, 0);
uiItemL(layout, msg, ICON_NONE, 0);
uiItemS(layout);
}
@@ -5145,8 +5145,8 @@ static int dyntopo_warning_popup(bContext *C, wmOperatorType *ot, enum eDynTopoW
const char *msg_error = TIP_("Generative Modifiers Detected!");
const char *msg = TIP_("Keeping the modifiers will increase polycount when returning to object mode");
uiItemL(layout, msg_error, ICON_INFO);
uiItemL(layout, msg, ICON_NONE);
uiItemL(layout, msg_error, ICON_INFO, 0);
uiItemL(layout, msg, ICON_NONE, 0);
uiItemS(layout);
}

View File

@@ -1114,7 +1114,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
ptr = &path->ptr[a];
if (a != 0)
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC);
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC, 0);
if (ptr->data) {
icon = RNA_struct_ui_icon(ptr->type);
@@ -1130,7 +1130,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
MEM_freeN(name);
}
else
uiItemL(row, "", icon);
uiItemL(row, "", icon, 0);
}
}
}

View File

@@ -563,7 +563,7 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
/* add label per category */
if (!last_category || !STREQ(last_category, user->category)) {
uiItemL(layout, IFACE_(user->category), ICON_NONE);
uiItemL(layout, IFACE_(user->category), ICON_NONE, 0);
but = block->buttons.last;
but->drawflag = UI_BUT_TEXT_LEFT;
}
@@ -610,7 +610,7 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
user = ct->user;
if (!user) {
uiItemL(layout, IFACE_("No textures in context"), ICON_NONE);
uiItemL(layout, IFACE_("No textures in context"), ICON_NONE, 0);
return;
}

View File

@@ -537,7 +537,7 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", failed to load"), sizeof(str) - ofs);
}
uiItemL(col, str, ICON_NONE);
uiItemL(col, str, ICON_NONE, 0);
/* Display current frame number. */
framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr);
@@ -545,7 +545,7 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha
BLI_snprintf(str, sizeof(str), IFACE_("Frame: %d / %d"), framenr, clip->len);
else
BLI_snprintf(str, sizeof(str), IFACE_("Frame: - / %d"), clip->len);
uiItemL(col, str, ICON_NONE);
uiItemL(col, str, ICON_NONE, 0);
/* Display current file name if it's a sequence clip. */
if (clip->source == MCLIP_SRC_SEQUENCE) {
@@ -562,7 +562,7 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha
BLI_snprintf(str, sizeof(str), IFACE_("File: %s"), file);
uiItemL(col, str, ICON_NONE);
uiItemL(col, str, ICON_NONE, 0);
}
IMB_freeImBuf(ibuf);

View File

@@ -210,7 +210,7 @@ static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOp
{
if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) {
uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE, 0);
clip_panel_operator_redo_operator(C, pa, op);
}
}

View File

@@ -389,7 +389,7 @@ static void file_draw_preview(
glaDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect, scale, scale);
if (icon) {
UI_icon_draw_aspect((float)xco, (float)yco, icon, icon_aspect, 1.0f);
UI_icon_draw_aspect((float)xco, (float)yco, icon, 0, icon_aspect, 1.0f);
}
/* border */

View File

@@ -190,7 +190,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
if (ale->type == ANIMTYPE_NLACURVE)
icon = ICON_NLA;
}
uiItemL(col, name, icon);
uiItemL(col, name, icon, 0);
/* RNA-Path Editing - only really should be enabled when things aren't working */
col = uiLayoutColumn(layout, true);
@@ -200,7 +200,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
/* color settings */
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
uiItemL(col, IFACE_("Display Color:"), ICON_NONE, 0);
row = uiLayoutRow(col, true);
uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
@@ -360,8 +360,8 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
col = uiLayoutColumn(layout, false);
if (fcu->flag & FCURVE_DISCRETE_VALUES) {
uiLayout *split = uiLayoutSplit(col, 0.33f, true);
uiItemL(split, IFACE_("Interpolation:"), ICON_NONE);
uiItemL(split, IFACE_("None for Enum/Boolean"), ICON_IPO_CONSTANT);
uiItemL(split, IFACE_("Interpolation:"), ICON_NONE, 0);
uiItemL(split, IFACE_("None for Enum/Boolean"), ICON_IPO_CONSTANT, 0);
}
else {
uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
@@ -393,7 +393,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
col = uiLayoutColumn(layout, true);
/* keyframe itself */
{
uiItemL(col, IFACE_("Key:"), ICON_NONE);
uiItemL(col, IFACE_("Key:"), ICON_NONE, 0);
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, IFACE_("Frame:"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
@@ -407,7 +407,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
/* previous handle - only if previous was Bezier interpolation */
if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) {
uiItemL(col, IFACE_("Left Handle:"), ICON_NONE);
uiItemL(col, IFACE_("Left Handle:"), ICON_NONE, 0);
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_left", 0, 0, 0, -1, -1, NULL);
@@ -427,7 +427,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
/* next handle - only if current is Bezier interpolation */
if (bezt->ipo == BEZT_IPO_BEZ) {
/* NOTE: special update callbacks are needed on the coords here due to T39911 */
uiItemL(col, IFACE_("Right Handle:"), ICON_NONE);
uiItemL(col, IFACE_("Right Handle:"), ICON_NONE, 0);
but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, "X:", 0, 0, UI_UNIT_X, UI_UNIT_Y,
&bezt_ptr, "handle_right", 0, 0, 0, -1, -1, NULL);
@@ -447,16 +447,16 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
else {
if ((fcu->bezt == NULL) && (fcu->modifiers.first)) {
/* modifiers only - so no keyframes to be active */
uiItemL(layout, IFACE_("F-Curve only has F-Modifiers"), ICON_NONE);
uiItemL(layout, IFACE_("See Modifiers panel below"), ICON_INFO);
uiItemL(layout, IFACE_("F-Curve only has F-Modifiers"), ICON_NONE, 0);
uiItemL(layout, IFACE_("See Modifiers panel below"), ICON_INFO, 0);
}
else if (fcu->fpt) {
/* samples only */
uiItemL(layout, IFACE_("F-Curve doesn't have any keyframes as it only contains sampled points"),
ICON_NONE);
ICON_NONE, 0);
}
else
uiItemL(layout, IFACE_("No active keyframe on F-Curve"), ICON_NONE);
uiItemL(layout, IFACE_("No active keyframe on F-Curve"), ICON_NONE, 0);
}
MEM_freeN(ale);
@@ -528,28 +528,28 @@ static void driver_dvar_invalid_name_query_cb(bContext *C, void *dvar_v, void *U
DriverVar *dvar = (DriverVar *)dvar_v;
if (dvar->flag & DVAR_FLAG_INVALID_EMPTY) {
uiItemL(layout, "It cannot be left blank", ICON_ERROR);
uiItemL(layout, "It cannot be left blank", ICON_ERROR, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_START_NUM) {
uiItemL(layout, "It cannot start with a number", ICON_ERROR);
uiItemL(layout, "It cannot start with a number", ICON_ERROR, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_START_CHAR) {
uiItemL(layout,
"It cannot start with a special character,"
" including '$', '@', '!', '~', '+', '-', '_', '.', or ' '",
ICON_NONE);
ICON_NONE, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_SPACE) {
uiItemL(layout, "It cannot contain spaces (e.g. 'a space')", ICON_ERROR);
uiItemL(layout, "It cannot contain spaces (e.g. 'a space')", ICON_ERROR, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_DOT) {
uiItemL(layout, "It cannot contain dots (e.g. 'a.dot')", ICON_ERROR);
uiItemL(layout, "It cannot contain dots (e.g. 'a.dot')", ICON_ERROR, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_SPECIAL) {
uiItemL(layout, "It cannot contain special (non-alphabetical/numeric) characters", ICON_ERROR);
uiItemL(layout, "It cannot contain special (non-alphabetical/numeric) characters", ICON_ERROR, 0);
}
if (dvar->flag & DVAR_FLAG_INVALID_PY_KEYWORD) {
uiItemL(layout, "It cannot be a reserved keyword in Python", ICON_INFO);
uiItemL(layout, "It cannot be a reserved keyword in Python", ICON_INFO, 0);
}
UI_popup_menu_end(C, pup);
@@ -771,29 +771,29 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* errors? */
if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
uiItemL(col, IFACE_("ERROR: Python auto-execution disabled"), ICON_CANCEL);
uiItemL(col, IFACE_("ERROR: Python auto-execution disabled"), ICON_CANCEL, 0);
}
else if (driver->flag & DRIVER_FLAG_INVALID) {
uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL);
uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL, 0);
}
/* Explicit bpy-references are evil. Warn about these to prevent errors */
/* TODO: put these in a box? */
if (bpy_data_expr_error || bpy_ctx_expr_error) {
uiItemL(col, IFACE_("WARNING: Driver expression may not work correctly"), ICON_HELP);
uiItemL(col, IFACE_("WARNING: Driver expression may not work correctly"), ICON_HELP, 0);
if (bpy_data_expr_error) {
uiItemL(col, IFACE_("TIP: Use variables instead of bpy.data paths (see below)"), ICON_ERROR);
uiItemL(col, IFACE_("TIP: Use variables instead of bpy.data paths (see below)"), ICON_ERROR, 0);
}
if (bpy_ctx_expr_error) {
uiItemL(col, IFACE_("TIP: bpy.context is not safe for renderfarm usage"), ICON_ERROR);
uiItemL(col, IFACE_("TIP: bpy.context is not safe for renderfarm usage"), ICON_ERROR, 0);
}
}
}
else {
/* errors? */
if (driver->flag & DRIVER_FLAG_INVALID)
uiItemL(col, IFACE_("ERROR: Invalid target channel(s)"), ICON_ERROR);
uiItemL(col, IFACE_("ERROR: Invalid target channel(s)"), ICON_ERROR, 0);
/* Warnings about a lack of variables
* NOTE: The lack of variables is generally a bad thing, since it indicates
@@ -802,11 +802,11 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
* property animation
*/
if (BLI_listbase_is_empty(&driver->variables)) {
uiItemL(col, IFACE_("ERROR: Driver is useless without any inputs"), ICON_ERROR);
uiItemL(col, IFACE_("ERROR: Driver is useless without any inputs"), ICON_ERROR, 0);
if (!BLI_listbase_is_empty(&fcu->modifiers)) {
uiItemL(col, IFACE_("TIP: Use F-Curves for procedural animation instead"), ICON_INFO);
uiItemL(col, IFACE_("F-Modifiers can generate curves for those too"), ICON_INFO);
uiItemL(col, IFACE_("TIP: Use F-Curves for procedural animation instead"), ICON_INFO, 0);
uiItemL(col, IFACE_("F-Modifiers can generate curves for those too"), ICON_INFO, 0);
}
}
}
@@ -825,10 +825,10 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
uiLayout *row = uiLayoutRow(col, true);
char valBuf[32];
uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
uiItemL(row, IFACE_("Driver Value:"), ICON_NONE, 0);
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
uiItemL(row, valBuf, ICON_NONE);
uiItemL(row, valBuf, ICON_NONE, 0);
}
/* add/copy/paste driver variables */
@@ -923,7 +923,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
box = uiLayoutBox(col);
row = uiLayoutRow(box, true);
uiItemL(row, IFACE_("Value:"), ICON_NONE);
uiItemL(row, IFACE_("Value:"), ICON_NONE, 0);
if ((dvar->type == DVAR_TYPE_ROT_DIFF) ||
(dvar->type == DVAR_TYPE_TRANSFORM_CHAN &&
@@ -936,7 +936,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
}
uiItemL(row, valBuf, ICON_NONE);
uiItemL(row, valBuf, ICON_NONE, 0);
}
}

View File

@@ -900,8 +900,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
image_info(scene, iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
BKE_image_release_ibuf(ima, ibuf, lock);
uiItemL(layout, ima->id.name + 2, ICON_NONE);
uiItemL(layout, str, ICON_NONE);
uiItemL(layout, ima->id.name + 2, ICON_NONE, 0);
uiItemL(layout, str, ICON_NONE, 0);
if (ima->type == IMA_TYPE_COMPOSITE) {
// XXX not working yet
@@ -1109,7 +1109,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man
{
row = uiLayoutRow(col, false);
uiItemL(row, IFACE_("Color Depth:"), ICON_NONE);
uiItemL(row, IFACE_("Color Depth:"), ICON_NONE, 0);
uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1151,7 +1151,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man
if (imf->imtype == R_IMF_IMTYPE_CINEON) {
#if 1
uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE, 0);
#else
uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
@@ -1173,7 +1173,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man
display_settings_ptr = RNA_property_pointer_get(imfptr, prop);
col = uiLayoutColumn(layout, false);
uiItemL(col, IFACE_("Color Management"), ICON_NONE);
uiItemL(col, IFACE_("Color Management"), ICON_NONE, 0);
uiItemR(col, &display_settings_ptr, "display_device", 0, NULL, ICON_NONE);
@@ -1220,7 +1220,7 @@ static void uiTemplateViewsFormat(uiLayout *layout, PointerRNA *ptr, PointerRNA
col = uiLayoutColumn(layout, false);
uiItemL(col, IFACE_("Views Format:"), ICON_NONE);
uiItemL(col, IFACE_("Views Format:"), ICON_NONE, 0);
uiItemR(uiLayoutRow(col, false), ptr, "views_format", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
if (stereo3d_format_ptr) {
@@ -1305,7 +1305,7 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i
image_info(CTX_data_scene(C), iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
BKE_image_release_ibuf(ima, ibuf, lock);
uiItemL(layout, str, ICON_NONE);
uiItemL(layout, str, ICON_NONE, 0);
}
#undef MAX_IMAGE_INFO_LEN

View File

@@ -2503,30 +2503,30 @@ static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
col[0] = uiLayoutColumn(split, false);
col[1] = uiLayoutColumn(split, false);
uiItemL(col[0], IFACE_("Name"), ICON_NONE);
uiItemL(col[0], IFACE_("Name"), ICON_NONE, 0);
uiItemR(col[1], &ptr, "name", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Width"), ICON_NONE);
uiItemL(col[0], IFACE_("Width"), ICON_NONE, 0);
uiItemR(col[1], &ptr, "width", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Height"), ICON_NONE);
uiItemL(col[0], IFACE_("Height"), ICON_NONE, 0);
uiItemR(col[1], &ptr, "height", 0, "", ICON_NONE);
uiItemL(col[0], IFACE_("Color"), ICON_NONE);
uiItemL(col[0], IFACE_("Color"), ICON_NONE, 0);
uiItemR(col[1], &ptr, "color", 0, "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE, 0);
uiItemR(col[1], &ptr, "alpha", 0, NULL, ICON_NONE);
uiItemL(col[0], IFACE_("Generated Type"), ICON_NONE);
uiItemL(col[0], IFACE_("Generated Type"), ICON_NONE, 0);
uiItemR(col[1], &ptr, "generated_type", 0, "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE, 0);
uiItemR(col[1], &ptr, "float", 0, NULL, ICON_NONE);
#if 0
if (is_multiview) {
uiItemL(col[0], "", ICON_NONE);
uiItemL(col[0], "", ICON_NONE, 0);
uiItemR(col[1], &ptr, "use_stereo_3d", 0, NULL, ICON_NONE);
}
#endif

View File

@@ -292,7 +292,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
}
}
else {
uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE);
uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE, 0);
}
}

View File

@@ -863,8 +863,8 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
uiItemR(sub, ptr, "name", 0, "", ICON_NONE);
}
else {
uiItemL(sub, IFACE_(sensor_name(sens->type)), ICON_NONE);
uiItemL(sub, sens->name, ICON_NONE);
uiItemL(sub, IFACE_(sensor_name(sens->type)), ICON_NONE, 0);
uiItemL(sub, sens->name, ICON_NONE, 0);
}
sub = uiLayoutRow(row, false);
@@ -930,7 +930,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
uiLayout *row;
if (ob->type != OB_ARMATURE) {
uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE);
uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE, 0);
return;
}
@@ -1033,7 +1033,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *col;
row = uiLayoutRow(layout, false);
uiItemL(row, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE);
uiItemL(row, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE, 0);
col = uiLayoutColumn(row, false);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false);
uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
@@ -1043,11 +1043,11 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false);
row = uiLayoutRow(col, false);
uiItemL(row, IFACE_("First Modifier:"), ICON_NONE);
uiItemL(row, IFACE_("First Modifier:"), ICON_NONE, 0);
uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE);
row = uiLayoutRow(col, false);
uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE);
uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE, 0);
uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE);
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
@@ -1246,9 +1246,9 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)"));
}
else {
uiItemL(sub, IFACE_(controller_name(cont->type)), ICON_NONE);
uiItemL(sub, cont->name, ICON_NONE);
uiItemL(sub, state, ICON_NONE);
uiItemL(sub, IFACE_(controller_name(cont->type)), ICON_NONE, 0);
uiItemL(sub, cont->name, ICON_NONE, 0);
uiItemL(sub, state, ICON_NONE, 0);
}
sub = uiLayoutRow(row, false);
@@ -1347,8 +1347,8 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
uiItemR(sub, ptr, "name", 0, "", ICON_NONE);
}
else {
uiItemL(sub, IFACE_(actuator_name(act->type)), ICON_NONE);
uiItemL(sub, act->name, ICON_NONE);
uiItemL(sub, IFACE_(actuator_name(act->type)), ICON_NONE, 0);
uiItemL(sub, act->name, ICON_NONE, 0);
}
sub = uiLayoutRow(row, false);
@@ -1432,7 +1432,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
PropertyRNA *bones_prop = NULL;
if (ob->type != OB_ARMATURE) {
uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE);
uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE, 0);
return;
}
@@ -1538,7 +1538,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
row = uiLayoutRow(layout, false);
col = uiLayoutColumn(row, true);
uiItemL(col, IFACE_("Range:"), ICON_NONE);
uiItemL(col, IFACE_("Range:"), ICON_NONE, 0);
uiItemR(col, ptr, "range", 0, "", ICON_NONE);
col = uiLayoutColumn(row, true);
@@ -1636,7 +1636,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
break;
case ACT_EDOB_REPLACE_MESH:
if (ob->type != OB_MESH) {
uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE, 0);
break;
}
split = uiLayoutSplit(layout, 0.6, false);
@@ -1660,7 +1660,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
break;
case ACT_EDOB_DYNAMICS:
if (ob->type != OB_MESH) {
uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE, 0);
break;
}
uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE);
@@ -1749,7 +1749,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
if (ELEM(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {
uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE);
uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE, 0);
split = uiLayoutSplit(layout, 0.9, false);
row = uiLayoutRow(split, false);
uiItemR(row, ptr, "force", 0, NULL, ICON_NONE);
@@ -1830,7 +1830,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
split = uiLayoutSplit(layout, 0.9, false);
row = uiLayoutRow(split, false);
split = uiLayoutSplit(row, 0.7, false);
uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */
uiItemL(split, "", ICON_NONE, 0); /*Just use this for some spacing */
uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
}
@@ -1919,7 +1919,7 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
break;
case ACT_RANDOM_BOOL_UNIFORM:
uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE);
uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE, 0);
break;
case ACT_RANDOM_BOOL_BERNOUILLI:
@@ -1982,7 +1982,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
uiLayout *row;
if (ob->type != OB_MESH) {
uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE);
uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE, 0);
return;
}
@@ -2020,7 +2020,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
if (!RNA_pointer_get(ptr, "sound").data) {
uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE);
uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE, 0);
return;
}
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
@@ -2362,8 +2362,8 @@ void logic_buttons(bContext *C, ARegion *ar)
split = uiLayoutSplit(box, 0.2f, false);
col = uiLayoutColumn(split, false);
uiItemL(col, IFACE_("Visible"), ICON_NONE);
uiItemL(col, IFACE_("Initial"), ICON_NONE);
uiItemL(col, IFACE_("Visible"), ICON_NONE, 0);
uiItemL(col, IFACE_("Initial"), ICON_NONE, 0);
subsplit = uiLayoutSplit(split, 0.85f, false);
col = uiLayoutColumn(subsplit, false);

View File

@@ -275,9 +275,9 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
row = uiLayoutRow(layout, true);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
uiItemL(row, id->name + 2, RNA_struct_ui_icon(id_ptr.type)); /* id-block (src) */
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC); /* expander */
uiItemL(row, IFACE_("Animation Data"), ICON_ANIM_DATA); /* animdata */
uiItemL(row, id->name + 2, RNA_struct_ui_icon(id_ptr.type), 0); /* id-block (src) */
uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC, 0); /* expander */
uiItemL(row, IFACE_("Animation Data"), ICON_ANIM_DATA, 0); /* animdata */
uiItemS(layout);
}
@@ -343,7 +343,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* strip extents */
column = uiLayoutColumn(layout, true);
uiItemL(column, IFACE_("Strip Extents:"), ICON_NONE);
uiItemL(column, IFACE_("Strip Extents:"), ICON_NONE, 0);
uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE);
uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE);
@@ -378,7 +378,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* settings */
column = uiLayoutColumn(layout, true);
uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time")));
uiItemL(column, IFACE_("Playback Settings:"), ICON_NONE);
uiItemL(column, IFACE_("Playback Settings:"), ICON_NONE, 0);
uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE);
uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE);
}
@@ -408,7 +408,7 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
/* action extents */
// XXX custom names were used here (to avoid the prefixes)... probably not necessary in future?
column = uiLayoutColumn(layout, true);
uiItemL(column, IFACE_("Action Extents:"), ICON_NONE);
uiItemL(column, IFACE_("Action Extents:"), ICON_NONE, 0);
uiItemR(column, &strip_ptr, "action_frame_start", 0, IFACE_("Start Frame"), ICON_NONE);
uiItemR(column, &strip_ptr, "action_frame_end", 0, IFACE_("End Frame"), ICON_NONE);
@@ -420,7 +420,7 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
/* action usage */
column = uiLayoutColumn(layout, true);
uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time") == false);
uiItemL(column, IFACE_("Playback Settings:"), ICON_NONE);
uiItemL(column, IFACE_("Playback Settings:"), ICON_NONE, 0);
uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NONE);
uiItemR(column, &strip_ptr, "repeat", 0, NULL, ICON_NONE);
}

View File

@@ -77,7 +77,7 @@
static void node_socket_button_label(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr),
const char *text)
{
uiItemL(layout, text, 0);
uiItemL(layout, text, ICON_NONE, 0);
}
@@ -706,7 +706,7 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr,
char numstr[32];
const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL);
BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr);
uiItemL(layout, numstr, ICON_NONE);
uiItemL(layout, numstr, ICON_NONE, 0);
}
if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
@@ -750,15 +750,15 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), Poin
row = uiLayoutRow(layout, false);
col = uiLayoutColumn(row, true);
uiItemL(col, IFACE_("Location:"), ICON_NONE);
uiItemL(col, IFACE_("Location:"), ICON_NONE, 0);
uiItemR(col, ptr, "translation", 0, "", ICON_NONE);
col = uiLayoutColumn(row, true);
uiItemL(col, IFACE_("Rotation:"), ICON_NONE);
uiItemL(col, IFACE_("Rotation:"), ICON_NONE, 0);
uiItemR(col, ptr, "rotation", 0, "", ICON_NONE);
col = uiLayoutColumn(row, true);
uiItemL(col, IFACE_("Scale:"), ICON_NONE);
uiItemL(col, IFACE_("Scale:"), ICON_NONE, 0);
uiItemR(col, ptr, "scale", 0, "", ICON_NONE);
row = uiLayoutRow(layout, false);
@@ -1369,7 +1369,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NONE);
if (RNA_boolean_get(ptr, "use_relative")) {
uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE);
uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE, 0);
row = uiLayoutRow(layout, true);
uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1393,7 +1393,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), Poin
uiItemR(layout, ptr, "use_wrap", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Center:"), ICON_NONE);
uiItemL(col, IFACE_("Center:"), ICON_NONE, 0);
uiItemR(col, ptr, "center_x", 0, IFACE_("X"), ICON_NONE);
uiItemR(col, ptr, "center_y", 0, IFACE_("Y"), ICON_NONE);
@@ -1424,7 +1424,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA
uiLayout *sub, *col;
col = uiLayoutColumn(layout, false);
uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE);
uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE, 0);
uiItemR(col, ptr, "bokeh", 0, "", ICON_NONE);
uiItemR(col, ptr, "angle", 0, NULL, ICON_NONE);
@@ -1521,7 +1521,7 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), Po
uiItemR(col, ptr, "factor", 0, IFACE_("Blur"), ICON_NONE);
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Speed:"), ICON_NONE);
uiItemL(col, IFACE_("Speed:"), ICON_NONE, 0);
uiItemR(col, ptr, "speed_min", 0, IFACE_("Min"), ICON_NONE);
uiItemR(col, ptr, "speed_max", 0, IFACE_("Max"), ICON_NONE);
@@ -1576,9 +1576,9 @@ static void node_composit_buts_double_edge_mask(uiLayout *layout, bContext *UNUS
col = uiLayoutColumn(layout, false);
uiItemL(col, IFACE_("Inner Edge:"), ICON_NONE);
uiItemL(col, IFACE_("Inner Edge:"), ICON_NONE, 0);
uiItemR(col, ptr, "inner_mode", 0, "", ICON_NONE);
uiItemL(col, IFACE_("Buffer Edge:"), ICON_NONE);
uiItemL(col, IFACE_("Buffer Edge:"), ICON_NONE, 0);
uiItemR(col, ptr, "edge_mode", 0, "", ICON_NONE);
}
@@ -1683,7 +1683,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED
col = uiLayoutColumn(layout, true);
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE, 0);
row = uiLayoutRow(layout, false);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1695,7 +1695,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
{
uiLayout *row, *col;
uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE);
uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE, 0);
row = uiLayoutRow(layout, false);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1703,7 +1703,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method") == 0) {
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE);
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE, 0);
row = uiLayoutRow(col, false);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1745,12 +1745,12 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
{
uiLayout *col, *row;
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE, 0);
row = uiLayoutRow(layout, false);
uiItemR(row, ptr, "color_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiItemL(col, IFACE_("Key Channel:"), ICON_NONE);
uiItemL(col, IFACE_("Key Channel:"), ICON_NONE, 0);
row = uiLayoutRow(col, false);
uiItemR(row, ptr, "matte_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1758,7 +1758,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method") == 0) {
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE);
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE, 0);
row = uiLayoutRow(col, false);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1793,9 +1793,9 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C)
const bool multilayer = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER;
if (multilayer)
uiItemL(layout, IFACE_("Path:"), ICON_NONE);
uiItemL(layout, IFACE_("Path:"), ICON_NONE, 0);
else
uiItemL(layout, IFACE_("Base Path:"), ICON_NONE);
uiItemL(layout, IFACE_("Base Path:"), ICON_NONE, 0);
uiItemR(layout, ptr, "base_path", 0, "", ICON_NONE);
}
static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1852,7 +1852,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
if (multilayer) {
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Layer:"), ICON_NONE);
uiItemL(col, IFACE_("Layer:"), ICON_NONE, 0);
row = uiLayoutRow(col, false);
uiItemR(row, &active_input_ptr, "name", 0, "", ICON_NONE);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
@@ -1861,7 +1861,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
else {
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("File Subpath:"), ICON_NONE);
uiItemL(col, IFACE_("File Subpath:"), ICON_NONE, 0);
row = uiLayoutRow(col, false);
uiItemR(row, &active_input_ptr, "path", 0, "", ICON_NONE);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "",
@@ -1871,7 +1871,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
imfptr = RNA_pointer_get(&active_input_ptr, "format");
col = uiLayoutColumn(layout, true);
uiItemL(col, IFACE_("Format:"), ICON_NONE);
uiItemL(col, IFACE_("Format:"), ICON_NONE, 0);
uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
@@ -2082,15 +2082,15 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, "", ICON_NONE);
uiItemL(row, IFACE_("Saturation"), ICON_NONE);
uiItemL(row, IFACE_("Contrast"), ICON_NONE);
uiItemL(row, IFACE_("Gamma"), ICON_NONE);
uiItemL(row, IFACE_("Gain"), ICON_NONE);
uiItemL(row, IFACE_("Lift"), ICON_NONE);
uiItemL(row, "", ICON_NONE, 0);
uiItemL(row, IFACE_("Saturation"), ICON_NONE, 0);
uiItemL(row, IFACE_("Contrast"), ICON_NONE, 0);
uiItemL(row, IFACE_("Gamma"), ICON_NONE, 0);
uiItemL(row, IFACE_("Gain"), ICON_NONE, 0);
uiItemL(row, IFACE_("Lift"), ICON_NONE, 0);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Master"), ICON_NONE);
uiItemL(row, IFACE_("Master"), ICON_NONE, 0);
uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2098,7 +2098,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Highlights"), ICON_NONE);
uiItemL(row, IFACE_("Highlights"), ICON_NONE, 0);
uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2106,7 +2106,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Midtones"), ICON_NONE);
uiItemL(row, IFACE_("Midtones"), ICON_NONE, 0);
uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2114,7 +2114,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_("Shadows"), ICON_NONE);
uiItemL(row, IFACE_("Shadows"), ICON_NONE, 0);
uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2135,31 +2135,31 @@ static void node_composit_buts_colorcorrection_ex(uiLayout *layout, bContext *UN
uiItemR(row, ptr, "green", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
row = layout;
uiItemL(row, IFACE_("Saturation"), ICON_NONE);
uiItemL(row, IFACE_("Saturation"), ICON_NONE, 0);
uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemL(row, IFACE_("Contrast"), ICON_NONE);
uiItemL(row, IFACE_("Contrast"), ICON_NONE, 0);
uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemL(row, IFACE_("Gamma"), ICON_NONE);
uiItemL(row, IFACE_("Gamma"), ICON_NONE, 0);
uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemL(row, IFACE_("Gain"), ICON_NONE);
uiItemL(row, IFACE_("Gain"), ICON_NONE, 0);
uiItemR(row, ptr, "master_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "highlights_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemL(row, IFACE_("Lift"), ICON_NONE);
uiItemL(row, IFACE_("Lift"), ICON_NONE, 0);
uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -2931,7 +2931,7 @@ static void node_template_properties_update(bNodeType *ntype)
static void node_socket_undefined_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr),
const char *UNUSED(text))
{
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR, 0);
}
static void node_socket_undefined_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), float *r_color)
@@ -2944,7 +2944,7 @@ static void node_socket_undefined_draw_color(bContext *UNUSED(C), PointerRNA *UN
static void node_socket_undefined_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr))
{
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR, 0);
}
static void node_socket_undefined_interface_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), float *r_color)
@@ -3065,7 +3065,7 @@ static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerR
NodeImageMultiFileSocket *input = sock->storage;
RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input, &inputptr);
uiItemL(row, input->layer, ICON_NONE);
uiItemL(row, input->layer, ICON_NONE, 0);
}
else {
NodeImageMultiFileSocket *input = sock->storage;
@@ -3074,7 +3074,7 @@ static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerR
uiBlock *block;
RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input, &inputptr);
uiItemL(row, input->path, ICON_NONE);
uiItemL(row, input->path, ICON_NONE, 0);
if (!RNA_boolean_get(&inputptr, "use_node_format"))
imfptr = RNA_pointer_get(&inputptr, "format");
@@ -3084,7 +3084,7 @@ static void node_file_output_socket_draw(bContext *C, uiLayout *layout, PointerR
RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
block = uiLayoutGetBlock(row);
UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
uiItemL(row, imtype_name, ICON_NONE);
uiItemL(row, imtype_name, ICON_NONE, 0);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
}
}
@@ -3122,7 +3122,7 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr,
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
/* draw the socket name right of the actual button */
uiItemR(row, ptr, "default_value", 0, "", 0);
uiItemL(row, text, 0);
uiItemL(row, text, ICON_NONE, 0);
break;
}
case SOCK_STRING:
@@ -3130,7 +3130,7 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr,
uiLayout *row = uiLayoutRow(layout, true);
/* draw the socket name right of the actual button */
uiItemR(row, ptr, "default_value", 0, "", 0);
uiItemL(row, text, 0);
uiItemL(row, text, ICON_NONE, 0);
break;
}
default:

View File

@@ -90,7 +90,7 @@ static void node_sockets_panel(const bContext *C, Panel *pa)
BLI_snprintf(name, sizeof(name), "%s:", sock->name);
split = uiLayoutSplit(layout, 0.35f, false);
uiItemL(split, name, ICON_NONE);
uiItemL(split, name, ICON_NONE, 0);
uiTemplateNodeLink(split, ntree, node, sock);
}
}
@@ -146,14 +146,14 @@ static void node_tree_interface_panel(const bContext *C, Panel *pa)
split = uiLayoutRow(row, true);
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Inputs:"), ICON_NONE);
uiItemL(col, IFACE_("Inputs:"), ICON_NONE, 0);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "inputs", &ptr, "inputs", &ptr, "active_input",
NULL, 0, 0, 0, 0);
opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&opptr, "in_out", SOCK_IN);
col = uiLayoutColumn(split, true);
uiItemL(col, IFACE_("Outputs:"), ICON_NONE);
uiItemL(col, IFACE_("Outputs:"), ICON_NONE, 0);
uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "outputs", &ptr, "outputs", &ptr, "active_output",
NULL, 0, 0, 0, 0);
opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);

View File

@@ -510,7 +510,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
column = uiLayoutColumn(layout, 0);
UI_block_layout_set_current(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
uiItemL(column, IFACE_(cname), ICON_NODE, 0);
but = block->buttons.last;
first = 0;
@@ -581,7 +581,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
UI_block_layout_set_current(block, column);
if (sock->link) {
uiItemL(column, IFACE_("Link"), ICON_NONE);
uiItemL(column, IFACE_("Link"), ICON_NONE, 0);
but = block->buttons.last;
but->drawflag = UI_BUT_TEXT_LEFT;
@@ -701,7 +701,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
}
else
uiItemL(row, "", ICON_BLANK1);
uiItemL(row, "", ICON_BLANK1, 0);
bt = block->buttons.last;
bt->rect.xmax = UI_UNIT_X / 2;
@@ -709,13 +709,13 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
UI_block_emboss_set(block, UI_EMBOSS);
}
uiItemL(row, label, ICON_NONE);
uiItemL(row, label, ICON_NONE, 0);
bt = block->buttons.last;
bt->drawflag = UI_BUT_TEXT_LEFT;
if (dependency_loop) {
row = uiLayoutRow(split, false);
uiItemL(row, IFACE_("Dependency Loop"), ICON_ERROR);
uiItemL(row, IFACE_("Dependency Loop"), ICON_ERROR, 0);
}
else if (lnode) {
/* input linked to a node */

View File

@@ -986,7 +986,7 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
/* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */
if (arg->x >= arg->xmax) {
glEnable(GL_BLEND);
UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f / UI_DPI_FAC, arg->alpha);
UI_icon_draw_aspect(arg->x, arg->y, icon, 0, 1.0f / UI_DPI_FAC, arg->alpha);
glDisable(GL_BLEND);
}
else {

View File

@@ -945,7 +945,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
colsub = uiLayoutColumn(split, true);
uiItemR(colsub, ptr, "location", 0, NULL, ICON_NONE);
colsub = uiLayoutColumn(split, true);
uiItemL(colsub, "", ICON_NONE);
uiItemL(colsub, "", ICON_NONE, 0);
uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
split = uiLayoutSplit(layout, 0.8f, false);
@@ -959,7 +959,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE + UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
else
uiItemL(colsub, "", ICON_NONE);
uiItemL(colsub, "", ICON_NONE, 0);
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
case ROT_MODE_AXISANGLE: /* axis angle */
@@ -970,14 +970,14 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
else
uiItemL(colsub, "", ICON_NONE);
uiItemL(colsub, "", ICON_NONE, 0);
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
default: /* euler rotations */
colsub = uiLayoutColumn(split, true);
uiItemR(colsub, ptr, "rotation_euler", 0, IFACE_("Rotation"), ICON_NONE);
colsub = uiLayoutColumn(split, true);
uiItemL(colsub, "", ICON_NONE);
uiItemL(colsub, "", ICON_NONE, 0);
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
}
@@ -987,7 +987,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
colsub = uiLayoutColumn(split, true);
uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
colsub = uiLayoutColumn(split, true);
uiItemL(colsub, "", ICON_NONE);
uiItemL(colsub, "", ICON_NONE, 0);
uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (ptr->type == &RNA_Object) {
@@ -1008,7 +1008,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
pchan = BKE_pose_channel_active(ob);
if (!pchan) {
uiItemL(layout, IFACE_("No Bone Active"), ICON_NONE);
uiItemL(layout, IFACE_("No Bone Active"), ICON_NONE, 0);
return;
}
@@ -1032,7 +1032,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
ebone = arm->act_edbone;
if (!ebone || (ebone->layer & arm->layer) == 0) {
uiItemL(layout, IFACE_("Nothing selected"), ICON_NONE);
uiItemL(layout, IFACE_("Nothing selected"), ICON_NONE, 0);
return;
}
@@ -1081,22 +1081,22 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
case MB_BALL:
break;
case MB_CUBE:
uiItemL(col, IFACE_("Size:"), ICON_NONE);
uiItemL(col, IFACE_("Size:"), ICON_NONE, 0);
uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
break;
case MB_TUBE:
uiItemL(col, IFACE_("Size:"), ICON_NONE);
uiItemL(col, IFACE_("Size:"), ICON_NONE, 0);
uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
break;
case MB_PLANE:
uiItemL(col, IFACE_("Size:"), ICON_NONE);
uiItemL(col, IFACE_("Size:"), ICON_NONE, 0);
uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
break;
case MB_ELIPSOID:
uiItemL(col, IFACE_("Size:"), ICON_NONE);
uiItemL(col, IFACE_("Size:"), ICON_NONE, 0);
uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);

View File

@@ -84,7 +84,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
{
if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) {
uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE, 0);
view3d_panel_operator_redo_operator(C, pa, op);
}
}

View File

@@ -1441,7 +1441,9 @@ GPUNodeLink *GPU_cube_map(Image *ima, ImageUser *iuser, bool is_data)
GPUNodeLink *GPU_image_preview(PreviewImage *prv)
{
GPUNodeLink *link = GPU_node_link_create();
BLI_assert(prv->num_frames == 0); /* For now, only usual, single-image previews should reach this point. */
link->image = GPU_NODE_LINK_IMAGE_PREVIEW;
link->ptr1 = prv;

View File

@@ -430,7 +430,9 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
{
GPUTexture *tex = prv->gputexture[0];
GLuint bindcode = 0;
BLI_assert(prv->num_frames == 0); /* For now, only usual, single-image previews should reach this point. */
if (tex)
bindcode = tex->bindcode;

View File

@@ -185,14 +185,21 @@ typedef struct PreviewImage {
unsigned int h[2];
short flag[2];
short changed_timestamp[2];
/* To keep backward/forward compat here, format of those rect is as follow:
*
* flat array of frames, each frame takes w * h + 1 integers,
* last integer is free to be used as needed (flags, timecode, ...).
*/
unsigned int *rect[2];
/* Runtime-only data. */
struct GPUTexture *gputexture[2];
int icon_id; /* Used by previews outside of ID context. */
/* Number of frames stored in each rect (0 means 'old format', rect is only w * h integers). */
unsigned short num_frames;
short tag; /* Runtime data. */
char pad[2];
} PreviewImage;
#define PRV_DEFERRED_DATA(prv) \

View File

@@ -537,6 +537,8 @@ typedef struct bAction {
int idroot; /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */
int pad;
struct PreviewImage *preview;
} bAction;

View File

@@ -35,8 +35,11 @@
#include "BLI_utildefines.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_object.h"
#include "IMB_imbuf_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
@@ -479,6 +482,11 @@ static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIco
BKE_previewimg_clear_single(prv_img, size);
}
static void rna_ImagePreview_frames_number_set(PointerRNA *ptr, int value)
{
BKE_previewimg_num_frames_set((PreviewImage *)ptr->data, (short)value);
}
static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size)
{
ID *id = (ID *)ptr->id.data;
@@ -503,16 +511,7 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
BKE_previewimg_clear_single(prv_img, size);
if (values[0] && values[1]) {
prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect");
prv_img->w[size] = values[0];
prv_img->h[size] = values[1];
}
prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
BKE_previewimg_resolution_set(prv_img, size, values[0], values[1]);
}
@@ -527,7 +526,7 @@ static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr, int length[RNA_MA
BKE_previewimg_ensure(prv_img, size);
length[0] = prv_img->w[size] * prv_img->h[size];
length[0] = BKE_previewimg_get_rect_size(prv_img, size) / sizeof(*prv_img->rect[size]);
return length[0];
}
@@ -543,7 +542,7 @@ static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIcon
BKE_previewimg_ensure(prv_img, size);
memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
memcpy(values, prv_img->rect[size], BKE_previewimg_get_rect_size(prv_img, size));
}
static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
@@ -555,7 +554,7 @@ static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum
BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
}
memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
memcpy(prv_img->rect[size], values, BKE_previewimg_get_rect_size(prv_img, size));
prv_img->flag[size] |= PRV_USER_EDITED;
}
@@ -574,7 +573,7 @@ static int rna_ImagePreview_pixels_float_get_length(
BKE_previewimg_ensure(prv_img, size);
length[0] = prv_img->w[size] * prv_img->h[size] * 4;
length[0] = BKE_previewimg_get_rect_size(prv_img, size); /* / sizeof(*prv_img->rect[size]) * 4 */
return length[0];
}
@@ -585,7 +584,7 @@ static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, en
PreviewImage *prv_img = (PreviewImage *)ptr->data;
unsigned char *data = (unsigned char *)prv_img->rect[size];
const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
const size_t len = BKE_previewimg_get_rect_size(prv_img, size);
size_t i;
BLI_assert(sizeof(unsigned int) == 4);
@@ -607,7 +606,7 @@ static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, const float *valu
PreviewImage *prv_img = (PreviewImage *)ptr->data;
unsigned char *data = (unsigned char *)prv_img->rect[size];
const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
const size_t len = BKE_previewimg_get_rect_size(prv_img, size);
size_t i;
BLI_assert(sizeof(unsigned int) == 4);
@@ -720,6 +719,8 @@ static int rna_ImagePreview_icon_id_get(PointerRNA *ptr)
/* Using a callback here allows us to only generate icon matching that preview when icon_id is requested. */
return BKE_icon_preview_ensure(ptr->id.data, (PreviewImage *)(ptr->data));
}
static void rna_ImagePreview_icon_reload(PreviewImage *prv)
{
/* will lazy load on next use, but only in case icon is not user-modified! */
@@ -728,6 +729,219 @@ static void rna_ImagePreview_icon_reload(PreviewImage *prv)
}
}
static void rna_ImagePreview_frame_delete(PreviewImage *prv, ReportList *reports, int frame_idx)
{
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
return;
}
BKE_previewimg_frame_delete(prv, (unsigned short) frame_idx);
}
static void rna_ImagePreview_frame_get(
PreviewImage *prv, ReportList *reports,
int frame_idx, int *r_data_len, int **r_data, int *r_meta, enum eIconSizes size)
{
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
*r_data = NULL;
*r_data_len = 0;
*r_meta = 0;
return;
}
BKE_previewimg_ensure(prv, size);
unsigned int *frame = BKE_previewimg_frame_data_get(prv, (unsigned short) frame_idx, size, r_meta);
*r_data_len = prv->w[size] * prv->h[size];
size_t frame_size = sizeof(**r_data) * (*r_data_len);
*r_data = MEM_mallocN(frame_size, __func__);
memcpy(*r_data, frame, frame_size);
}
static void rna_ImagePreview_frame_set(
PreviewImage *prv, ReportList *reports,
int frame_idx, int data_len, int *data, int meta, enum eIconSizes size)
{
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
return;
}
if (data_len != prv->w[size] * prv->h[size]) {
BKE_reportf(reports, RPT_ERROR, "Expected an array of %u integers, not %d", prv->w[size] * prv->h[size], data_len);
return;
}
BKE_previewimg_frame_data_set(prv, (unsigned short) frame_idx, size, meta, (unsigned int *)data);
prv->flag[size] |= PRV_USER_EDITED;
}
static void rna_ImagePreview_frame_float_get(
PreviewImage *prv, ReportList *reports,
int frame_idx, int *r_data_len, float **r_data, int *r_meta, enum eIconSizes size)
{
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
*r_data = NULL;
*r_data_len = 0;
*r_meta = 0;
return;
}
BLI_assert(sizeof(unsigned int) == 4);
BKE_previewimg_ensure(prv, size);
unsigned char *frame = (unsigned char *)BKE_previewimg_frame_data_get(prv, (unsigned short) frame_idx, size, r_meta);
*r_data_len = prv->w[size] * prv->h[size] * 4;
size_t frame_size = sizeof(**r_data) * (*r_data_len);
*r_data = MEM_mallocN(frame_size, __func__);
for (int i = 0; i < *r_data_len; i++) {
(*r_data)[i] = frame[i] * (1.0f / 255.0f);
}
}
static void rna_ImagePreview_frame_float_set(
PreviewImage *prv, ReportList *reports,
int frame_idx, int data_len, float *data, int meta, enum eIconSizes size)
{
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
return;
}
if (data_len != prv->w[size] * prv->h[size] * 4) {
BKE_reportf(reports, RPT_ERROR, "Expected an array of %u floats, not %d", prv->w[size] * prv->h[size] * 4, data_len);
return;
}
unsigned char *frame = (unsigned char *)BKE_previewimg_frame_data_get(prv, (unsigned short) frame_idx, size, NULL);
int i;
BLI_assert(sizeof(unsigned int) == 4);
for (i = 0; i < data_len; i++) {
frame[i] = FTOCHAR(data[i]);
}
*((int *)(&frame[i])) = meta;
prv->flag[size] |= PRV_USER_EDITED;
}
static void rna_ImagePreview_frame_img_set(
PreviewImage *prv, ReportList *reports,
int frame_idx, Image *ima, int meta, enum eIconSizes size)
{
ImBuf *ibuf;
void *lock;
if (frame_idx < 0 || frame_idx >= (prv->num_frames ? prv->num_frames : 1)) {
BKE_reportf(reports, RPT_ERROR, "Invalid frame index %d", frame_idx);
return;
}
/* get the image's pixels, checking for the correct size and channel count */
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
if (!ibuf) {
BKE_reportf(reports, RPT_ERROR, "Error acquiring image buffer");
BKE_image_release_ibuf(ima, ibuf, lock);
return;
}
if (ibuf->x != prv->w[size] || ibuf->y != prv->h[size]) {
BKE_reportf(reports, RPT_ERROR, "Expected an %ux%u image, not %dx%d", prv->w[size], prv->h[size], ibuf->x, ibuf->y);
BKE_image_release_ibuf(ima, ibuf, lock);
return;
}
if (ibuf->channels != 4) {
BKE_reportf(reports, RPT_ERROR, "Expected an RGBA (4-channel) image, not %i channels", ibuf->channels);
BKE_image_release_ibuf(ima, ibuf, lock);
return;
}
BLI_assert(sizeof(unsigned int) == 4);
unsigned char *frame = (unsigned char *)BKE_previewimg_frame_data_get(prv, (unsigned short)frame_idx, size, NULL);
int img_memsize = ibuf->x * ibuf->y * ibuf->channels;
if (ibuf->rect) {
memcpy(frame, ibuf->rect, img_memsize);
}
else if (ibuf->rect_float) {
for (int i = 0; i < img_memsize; i++) {
frame[i] = FTOCHAR(ibuf->rect_float[i]);
}
}
BKE_image_release_ibuf(ima, ibuf, lock);
*((int *)(&frame[img_memsize])) = meta;
prv->flag[size] |= PRV_USER_EDITED;
}
static void rna_ImagePreview_image_frame_get(
PreviewImage *prv, ReportList *reports, int frame_idx, int *r_data_len, int **r_data, int *r_meta)
{
rna_ImagePreview_frame_get(prv, reports, frame_idx, r_data_len, r_data, r_meta, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_frame_set(
PreviewImage *prv, ReportList *reports, int frame_idx, int data_len, int *data, int meta)
{
rna_ImagePreview_frame_set(prv, reports, frame_idx, data_len, data, meta, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_frame_float_get(
PreviewImage *prv, ReportList *reports, int frame_idx, int *r_data_len, float **r_data, int *r_meta)
{
rna_ImagePreview_frame_float_get(prv, reports, frame_idx, r_data_len, r_data, r_meta, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_frame_float_set(
PreviewImage *prv, ReportList *reports, int frame_idx, int data_len, float *data, int meta)
{
rna_ImagePreview_frame_float_set(prv, reports, frame_idx, data_len, data, meta, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_frame_img_set(
PreviewImage *prv, ReportList *reports, int frame_idx, Image *image, int meta)
{
rna_ImagePreview_frame_img_set(prv, reports, frame_idx, image, meta, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_icon_frame_get(
PreviewImage *prv, ReportList *reports, int frame_idx, int *r_data_len, int **r_data, int *r_meta)
{
rna_ImagePreview_frame_get(prv, reports, frame_idx, r_data_len, r_data, r_meta, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_frame_set(
PreviewImage *prv, ReportList *reports, int frame_idx, int data_len, int *data, int meta)
{
rna_ImagePreview_frame_set(prv, reports, frame_idx, data_len, data, meta, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_frame_float_get(
PreviewImage *prv, ReportList *reports, int frame_idx, int *r_data_len, float **r_data, int *r_meta)
{
rna_ImagePreview_frame_float_get(prv, reports, frame_idx, r_data_len, r_data, r_meta, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_frame_float_set(
PreviewImage *prv, ReportList *reports, int frame_idx, int data_len, float *data, int meta)
{
rna_ImagePreview_frame_float_set(prv, reports, frame_idx, data_len, data, meta, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_frame_img_set(
PreviewImage *prv, ReportList *reports, int frame_idx, Image *image, int meta)
{
rna_ImagePreview_frame_img_set(prv, reports, frame_idx, image, meta, ICON_SIZE_ICON);
}
static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
{
ID *id = (ID *)ptr->data;
@@ -860,6 +1074,7 @@ static void rna_def_image_preview(BlenderRNA *brna)
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *prop;
PropertyRNA *parm;
srna = RNA_def_struct(brna, "ImagePreview", NULL);
RNA_def_struct_sdna(srna, "PreviewImage");
@@ -871,6 +1086,18 @@ static void rna_def_image_preview(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Custom Image", "True if this preview image has been modified by py script,"
"and is no more auto-generated by Blender");
prop = RNA_def_property(srna, "is_image_multiframes", PROP_BOOLEAN, PROP_NONE);
/* Any non-zero value means it's a multiframes one. */
RNA_def_property_boolean_sdna(prop, NULL, "num_frames", USHRT_MAX);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "MultiFrames Image", "True if this preview image has multiple frames");
prop = RNA_def_int(srna, "frames_number", 0, 0, USHRT_MAX, "Number of Frames",
"Number of frames in theis preview image", 0, USHRT_MAX);
RNA_def_property_int_sdna(prop, NULL, "num_frames");
RNA_def_property_int_funcs(prop, NULL, "rna_ImagePreview_frames_number_set", NULL);
prop = RNA_def_int_vector(srna, "image_size", 2, NULL, 0, 0, "Image Size",
"Width and height in pixels", 0, 0);
RNA_def_property_subtype(prop, PROP_PIXEL);
@@ -879,7 +1106,7 @@ static void rna_def_image_preview(BlenderRNA *brna)
prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)");
RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits - raw data!)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
@@ -887,12 +1114,11 @@ static void rna_def_image_preview(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Float Image Pixels",
"Image pixels components, as floats (RGBA concatenated values)");
"Image pixels components, as floats (RGBA concatenated values - raw data!)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
RNA_def_property_float_funcs(prop, "rna_ImagePreview_image_pixels_float_get",
"rna_ImagePreview_image_pixels_float_set", NULL);
prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
@@ -907,14 +1133,15 @@ static void rna_def_image_preview(BlenderRNA *brna)
prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)");
RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits - raw data!)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
RNA_def_property_ui_text(prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
RNA_def_property_ui_text(prop, "Float Icon Pixels",
"Icon pixels components, as floats (RGBA concatenated values - raw data!)");
RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
RNA_def_property_float_funcs(prop, "rna_ImagePreview_icon_pixels_float_get",
"rna_ImagePreview_icon_pixels_float_set", NULL);
@@ -926,6 +1153,129 @@ static void rna_def_image_preview(BlenderRNA *brna)
func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
RNA_def_function_ui_description(func, "Reload the preview from its source path");
func = RNA_def_function(srna, "frame_delete", "rna_ImagePreview_frame_delete");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Delete a frame from this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to remove", 0, USHRT_MAX);
func = RNA_def_function(srna, "image_frame_get", "rna_ImagePreview_image_frame_get");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Get a frame data and meta-data from this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)");
RNA_def_function_output(func, parm);
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame");
RNA_def_function_output(func, parm);
func = RNA_def_function(srna, "image_frame_set", "rna_ImagePreview_image_frame_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame");
func = RNA_def_function(srna, "image_frame_float_get", "rna_ImagePreview_image_frame_float_get");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Get a frame data and meta-data from this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)");
RNA_def_function_output(func, parm);
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame");
RNA_def_function_output(func, parm);
func = RNA_def_function(srna, "image_frame_float_set", "rna_ImagePreview_image_frame_float_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame");
func = RNA_def_function(srna, "image_frame_img_set", "rna_ImagePreview_image_frame_img_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this preview");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "image", PROP_POINTER, PROP_NONE);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_property_struct_type(parm, "Image");
RNA_def_property_ui_text(parm, "", "Image whose pixels to copy and use for this preview");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame");
func = RNA_def_function(srna, "icon_frame_get", "rna_ImagePreview_icon_frame_get");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Get a frame data and meta-data from this icon");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)");
RNA_def_function_output(func, parm);
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame");
RNA_def_function_output(func, parm);
func = RNA_def_function(srna, "icon_frame_set", "rna_ImagePreview_icon_frame_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this icon");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame");
func = RNA_def_function(srna, "icon_frame_float_get", "rna_ImagePreview_icon_frame_float_get");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Get a frame data and meta-data from this icon");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)");
RNA_def_function_output(func, parm);
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame");
RNA_def_function_output(func, parm);
func = RNA_def_function(srna, "icon_frame_float_set", "rna_ImagePreview_icon_frame_float_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this icon");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(parm, 1);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame");
func = RNA_def_function(srna, "icon_frame_img_set", "rna_ImagePreview_icon_frame_img_set");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Set a frame data and meta-data for this icon");
RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX);
parm = RNA_def_property(func, "image", PROP_POINTER, PROP_NONE);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_property_struct_type(parm, "Image");
RNA_def_property_ui_text(parm, "", "Image whose pixels to copy and use for this preview");
parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame");
}
static void rna_def_ID(BlenderRNA *brna)

View File

@@ -72,48 +72,95 @@ static void rna_ImagePackedFile_save(ImagePackedFile *imapf, ReportList *reports
}
}
static ImBuf *get_render_ibuf(Image *image, ReportList *reports, Scene *scene)
{
ImBuf *ibuf, *ret_ibuf = NULL;
ImageUser iuser = {NULL};
void *lock;
iuser.scene = scene;
iuser.ok = 1;
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
if (ibuf == NULL) {
BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
}
else {
ret_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, true, true, &scene->view_settings,
&scene->display_settings, &scene->r.im_format);
/* We do not want to change ibuf acquired from image in any way, so always ensure we are working on a copy. */
if (ret_ibuf == ibuf) {
ret_ibuf = IMB_dupImBuf(ibuf);
}
ret_ibuf->planes = scene->r.im_format.planes;
ret_ibuf->dither = scene->r.dither_intensity;
BKE_image_release_ibuf(image, ibuf, lock);
}
return ret_ibuf;
}
static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports, const char *path, Scene *scene)
{
ImBuf *ibuf;
if (scene == NULL) {
scene = CTX_data_scene(C);
}
if (scene) {
ImBuf *write_ibuf = get_render_ibuf(image, reports, scene);
if (write_ibuf == NULL) {
BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
}
else {
if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
BKE_reportf(reports, RPT_ERROR, "Could not write image: %s, '%s'", strerror(errno), path);
}
IMB_freeImBuf(write_ibuf);
}
}
else {
BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
}
}
static Image *rna_Image_copy_from_render(Image *image, bContext *C, ReportList *reports, Scene *scene)
{
Image *ret_image = NULL;
if (scene == NULL) {
scene = CTX_data_scene(C);
}
if (scene) {
ImageUser iuser = {NULL};
void *lock;
ImBuf *new_ibuf = get_render_ibuf(image, reports, scene);
iuser.scene = scene;
iuser.ok = 1;
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
if (ibuf == NULL) {
if (new_ibuf == NULL) {
BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
}
else {
ImBuf *write_ibuf;
ret_image = BKE_image_add_from_imbuf(new_ibuf, image->id.name + 2);
write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, true, true, &scene->view_settings,
&scene->display_settings, &scene->r.im_format);
write_ibuf->planes = scene->r.im_format.planes;
write_ibuf->dither = scene->r.dither_intensity;
if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
BKE_reportf(reports, RPT_ERROR, "Could not write image: %s, '%s'", strerror(errno), path);
if (!ret_image) {
BKE_reportf(reports, RPT_ERROR, "Could not create copy image.");
IMB_freeImBuf(new_ibuf);
}
else {
id_us_min(&ret_image->id);
}
if (write_ibuf != ibuf)
IMB_freeImBuf(write_ibuf);
IMB_freeImBuf(new_ibuf);
}
BKE_image_release_ibuf(image, ibuf, lock);
}
else {
BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
}
return ret_image;
}
static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *reports)
@@ -317,6 +364,14 @@ void RNA_api_image(StructRNA *srna)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");
func = RNA_def_function(srna, "copy_from_render", "rna_Image_copy_from_render");
RNA_def_function_ui_description(func, "Return a new, regular image, copy of given render result one");
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");
parm = RNA_def_pointer(func, "image", "Image", "",
"Copied image from this render result one");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "save", "rna_Image_save");
RNA_def_function_ui_description(func, "Save image to its source path");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);

View File

@@ -97,7 +97,7 @@ static const char *rna_translate_ui_text(const char *text, const char *text_ctxt
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
int full_event, int emboss, int index, int icon_value)
int full_event, int emboss, int index, int icon_value, int icon_frame)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
@@ -122,7 +122,7 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon, (unsigned short)icon_frame);
}
static void rna_uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
@@ -218,7 +218,7 @@ static void rna_uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opnam
}
static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctxt, int translate,
int icon, int icon_value)
int icon, int icon_value, int icon_frame)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
@@ -227,7 +227,7 @@ static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctx
icon = icon_value;
}
uiItemL(layout, name, icon);
uiItemL(layout, name, icon, (unsigned short)icon_frame);
}
static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
@@ -530,6 +530,8 @@ void RNA_api_ui_layout(StructRNA *srna)
"when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
parm = RNA_def_property(func, "icon_frame", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Frame", "For multi-frame icons, index of frame to show");
func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
api_ui_item_rna_common(func);
@@ -622,6 +624,8 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_common(func);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
parm = RNA_def_property(func, "icon_frame", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Frame", "For multi-frame icons, index of frame to show");
func = RNA_def_function(srna, "menu", "rna_uiItemM");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);

View File

@@ -343,7 +343,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
if (rect)
drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
else
UI_icon_draw_aspect(x, y, drag->icon, 1.0f / UI_DPI_FAC, 0.8);
UI_icon_draw_aspect(x, y, drag->icon, 0, 1.0f / UI_DPI_FAC, 0.8);
}
/* item name */

View File

@@ -1833,7 +1833,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
split = uiLayoutSplit(layout, 0.0f, false);
col = uiLayoutColumn(split, false);
uiItemL(col, IFACE_("Links"), ICON_NONE);
uiItemL(col, IFACE_("Links"), ICON_NONE, 0);
#if 0
uiItemStringO(col, IFACE_("Support an Open Animation Movie"), ICON_URL, "WM_OT_url_open", "url",
"https://cloud.blender.org/join");
@@ -1858,7 +1858,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
}
uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url);
uiItemL(col, "", ICON_NONE);
uiItemL(col, "", ICON_NONE, 0);
col = uiLayoutColumn(split, false);
@@ -1867,7 +1867,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemS(col);
}
uiItemL(col, IFACE_("Recent"), ICON_NONE);
uiItemL(col, IFACE_("Recent"), ICON_NONE, 0);
for (recent = G.recent_files.first, i = 0; (i < 5) && (recent); recent = recent->next, i++) {
const char *filename = BLI_path_basename(recent->filepath);
uiItemStringO(col, filename,
@@ -1877,7 +1877,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemS(col);
uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session");
uiItemL(col, "", ICON_NONE);
uiItemL(col, "", ICON_NONE, 0);
mt = WM_menutype_find("USERPREF_MT_splash_footer", false);
if (mt) {

View File

@@ -585,10 +585,10 @@ void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *op
void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value) RET_NONE
void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, float value) RET_NONE
void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, const char *value) RET_NONE
void uiItemL(struct uiLayout *layout, const char *name, int icon) RET_NONE
void uiItemL(struct uiLayout *layout, const char *name, int icon, const unsigned short icon_frame) RET_NONE
void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon) RET_NONE
void uiItemS(struct uiLayout *layout) RET_NONE
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon) RET_NONE
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon, const unsigned short icon_frame) RET_NONE
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr) RET_NONE
const char *uiLayoutIntrospect(uiLayout *layout) RET_NULL
void UI_reinit_font(void) RET_NONE