Merge branch 'master' into blender2.8

This commit is contained in:
2018-05-23 10:50:35 +02:00
18 changed files with 1642 additions and 1642 deletions

View File

@@ -93,7 +93,7 @@
/**
* a full doc with API notes can be found in 'blender/doc/guides/interface_API.txt'
*
*
* `uiBlahBlah()` external function.
* `ui_blah_blah()` internal function.
*/
@@ -318,7 +318,7 @@ void ui_block_bounds_calc(uiBlock *block)
{
uiBut *bt;
int xof;
if (BLI_listbase_is_empty(&block->buttons)) {
if (block->panel) {
block->rect.xmin = 0.0; block->rect.xmax = block->panel->sizex;
@@ -326,13 +326,13 @@ void ui_block_bounds_calc(uiBlock *block)
}
}
else {
BLI_rctf_init_minmax(&block->rect);
for (bt = block->buttons.first; bt; bt = bt->next) {
BLI_rctf_union(&block->rect, &bt->rect);
}
block->rect.xmin -= block->bounds;
block->rect.ymin -= block->bounds;
block->rect.xmax += block->bounds;
@@ -341,7 +341,7 @@ void ui_block_bounds_calc(uiBlock *block)
block->rect.xmax = block->rect.xmin + max_ff(BLI_rctf_size_x(&block->rect), block->minbounds);
/* hardcoded exception... but that one is annoying with larger safety */
/* hardcoded exception... but that one is annoying with larger safety */
bt = block->buttons.first;
if (bt && STREQLEN(bt->str, "ERROR", 5)) xof = 10;
else xof = 40;
@@ -357,7 +357,7 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
int xmax, ymax;
int startx, starty;
int width, height;
/* note: this is used for the splash where window bounds event has not been
* updated by ghost, get the window bounds from ghost directly */
@@ -365,18 +365,18 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
ymax = WM_window_pixels_y(window);
ui_block_bounds_calc(block);
width = BLI_rctf_size_x(&block->rect);
height = BLI_rctf_size_y(&block->rect);
startx = (xmax * 0.5f) - (width * 0.5f);
starty = (ymax * 0.5f) - (height * 0.5f);
UI_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
/* now recompute bounds and safety */
ui_block_bounds_calc(block);
}
static void ui_block_bounds_calc_centered_pie(uiBlock *block)
@@ -406,7 +406,7 @@ static void ui_block_bounds_calc_popup(
/* compute mouse position with user defined offset */
ui_block_bounds_calc(block);
xmax = WM_window_pixels_x(window);
ymax = WM_window_pixels_y(window);
@@ -464,7 +464,7 @@ void UI_block_bounds_set_normal(uiBlock *block, int addval)
{
if (block == NULL)
return;
block->bounds = addval;
block->bounds_type = UI_BLOCK_BOUNDS;
}
@@ -723,7 +723,7 @@ bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *b
uiBlock *oldblock;
uiBut *oldbut;
bool activate = false, found = false, isactive = false;
oldblock = block->oldblock;
if (!oldblock) {
activate = true;
@@ -746,7 +746,7 @@ bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *b
ui_but_free(C, but);
return false;
}
return true;
}
@@ -950,27 +950,27 @@ static bool ui_but_event_property_operator_string(
"WM_OT_context_cycle_array",
"WM_OT_context_menu_enum",
NULL
};
};
const size_t num_ops = sizeof(ctx_toggle_opnames) / sizeof(const char *);
bool found = false;
/* this version is only for finding hotkeys for properties (which get set via context using operators) */
if (but->rnaprop) {
/* to avoid massive slowdowns on property panels, for now, we only check the
/* to avoid massive slowdowns on property panels, for now, we only check the
* hotkeys for Editor / Scene settings...
*
* TODO: userpref settings?
*/
// TODO: value (for enum stuff)?
char *data_path = NULL;
if (but->rnapoin.id.data) {
ID *id = but->rnapoin.id.data;
if (GS(id->name) == ID_SCR) {
/* screen/editor property
* NOTE: in most cases, there is actually no info for backwards tracing
/* screen/editor property
* NOTE: in most cases, there is actually no info for backwards tracing
* how to get back to ID from the editor data we may be dealing with
*/
if (RNA_struct_is_a(but->rnapoin.type, &RNA_Space)) {
@@ -991,7 +991,7 @@ static bool ui_but_event_property_operator_string(
}
else if (GS(id->name) == ID_SCE) {
if (RNA_struct_is_a(but->rnapoin.type, &RNA_ToolSettings)) {
/* toolsettings property
/* toolsettings property
* NOTE: toolsettings is usually accessed directly (i.e. not through scene)
*/
data_path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
@@ -999,7 +999,7 @@ static bool ui_but_event_property_operator_string(
else {
/* scene property */
char *path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
if (path) {
data_path = BLI_sprintfN("scene.%s", path);
MEM_freeN(path);
@@ -1015,23 +1015,23 @@ static bool ui_but_event_property_operator_string(
else {
//puts("other id");
}
//printf("prop shortcut: '%s' (%s)\n", RNA_property_identifier(but->rnaprop), data_path);
}
/* we have a datapath! */
if (data_path) {
size_t i;
/* create a property to host the "datapath" property we're sending to the operators */
IDProperty *prop_path;
IDProperty *prop_path_value;
IDPropertyTemplate val = {0};
prop_path = IDP_New(IDP_GROUP, &val, __func__);
prop_path_value = IDP_NewString(data_path, "data_path", strlen(data_path) + 1);
IDP_AddToGroup(prop_path, prop_path_value);
/* check each until one works... */
for (i = 0; (i < num_ops) && (ctx_toggle_opnames[i]); i++) {
if (WM_key_event_operator_string(
@@ -1042,14 +1042,14 @@ static bool ui_but_event_property_operator_string(
break;
}
}
/* cleanup */
IDP_FreeProperty(prop_path);
MEM_freeN(prop_path);
MEM_freeN(data_path);
}
}
return found;
}
@@ -1225,7 +1225,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
if (block->flag & (UI_BLOCK_LOOP | UI_BLOCK_SHOW_SHORTCUT_ALWAYS)) {
ui_menu_block_set_keymaps(C, block);
}
/* after keymaps! */
switch (block->bounds_type) {
case UI_BLOCK_BOUNDS_NONE:
@@ -1273,12 +1273,12 @@ void ui_fontscale(short *points, float aspect)
{
if (aspect < 0.9f || aspect > 1.1f) {
float pointsf = *points;
/* for some reason scaling fonts goes too fast compared to widget size */
/* XXX not true anymore? (ton) */
//aspect = sqrt(aspect);
pointsf /= aspect;
if (aspect > 1.0f)
*points = ceilf(pointsf);
else
@@ -1303,7 +1303,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
ARegion *ar;
uiBut *but;
rcti rect;
/* get menu region or area region */
ar = CTX_wm_menu(C);
if (!ar)
@@ -1314,23 +1314,23 @@ void UI_block_draw(const bContext *C, uiBlock *block)
/* we set this only once */
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
/* scale fonts */
ui_fontscale(&style.paneltitle.points, block->aspect);
ui_fontscale(&style.grouplabel.points, block->aspect);
ui_fontscale(&style.widgetlabel.points, block->aspect);
ui_fontscale(&style.widget.points, block->aspect);
/* scale block min/max to rect */
ui_but_to_pixelrect(&rect, ar, block, NULL);
/* pixel space for AA widgets */
gpuPushProjectionMatrix();
gpuPushMatrix();
gpuLoadIdentity();
wmOrtho2_region_pixelspace(ar);
/* back */
if (block->flag & UI_BLOCK_RADIAL)
ui_draw_pie_center(block);
@@ -1349,7 +1349,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
for (but = block->buttons.first; but; but = but->next) {
if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
ui_but_to_pixelrect(&rect, ar, block, but);
/* XXX: figure out why invalid coordinates happen when closing render window */
/* and material preview is redrawn in main window (temp fix for bug #23848) */
if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
@@ -1360,7 +1360,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
UI_widgetbase_draw_cache_end();
UI_icon_draw_cache_end();
BLF_batch_draw_end();
/* restore matrix */
gpuPopProjectionMatrix();
gpuPopMatrix();
@@ -1680,10 +1680,10 @@ bool ui_but_is_float(const uiBut *but)
{
if (but->pointype == UI_BUT_POIN_FLOAT && but->poin)
return true;
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
return true;
return false;
}
@@ -1714,7 +1714,7 @@ bool ui_but_is_unit(const uiBut *but)
if (ui_but_is_unit_radians_ex(unit, unit_type))
return false;
#endif
/* for now disable time unit conversion */
if (unit_type == PROP_UNIT_TIME)
return false;
@@ -1898,7 +1898,7 @@ void ui_but_value_set(uiBut *but, double value)
if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f; /* prevent negative zero */
value = fval;
}
/* then set value with possible edit override */
if (but->editval)
value = *but->editval = value;
@@ -2032,11 +2032,11 @@ void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
UnitSettings *unit = but->block->unit;
int unit_type = UI_but_unit_type_get(but);
char *orig_str;
orig_str = BLI_strdup(str);
bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
MEM_freeN(orig_str);
}
}
@@ -2692,7 +2692,7 @@ void UI_block_free(const bContext *C, uiBlock *block)
BLI_freelistN(&block->saferct);
BLI_freelistN(&block->color_pickers.list);
MEM_freeN(block);
}
@@ -2721,7 +2721,7 @@ void UI_blocklist_draw(const bContext *C, const ListBase *lb)
void UI_blocklist_free(const bContext *C, ListBase *lb)
{
uiBlock *block;
while ((block = BLI_pophead(lb))) {
UI_block_free(C, block);
}
@@ -2733,7 +2733,7 @@ void UI_blocklist_free_inactive(const bContext *C, ListBase *lb)
for (block = lb->first; block; block = nextblock) {
nextblock = block->next;
if (!block->handle) {
if (!block->active) {
BLI_remlink(lb, block);
@@ -2834,9 +2834,9 @@ void ui_but_update_ex(uiBut *but, const bool validate)
/* if something changed in the button */
double value = UI_BUT_VALUE_UNSET;
// float okwidth; // UNUSED
ui_but_update_select_flag(but, &value);
/* only update soft range while not editing */
if (!(but->editval || but->editstr || but->editvec)) {
if ((but->rnaprop != NULL) ||
@@ -2865,7 +2865,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
but->hardmin <= but->hardmax);
}
break;
case UI_BTYPE_ICON_TOGGLE:
case UI_BTYPE_ICON_TOGGLE_N:
if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
@@ -2873,16 +2873,16 @@ void ui_but_update_ex(uiBut *but, const bool validate)
else but->iconadd = 0;
}
break;
/* quiet warnings for unhandled types */
default:
break;
}
/* safety is 4 to enable small number buttons (like 'users') */
// okwidth = -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED
/* name: */
switch (but->type) {
@@ -2970,7 +2970,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
else {
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
}
break;
case UI_BTYPE_TEXT:
@@ -2983,7 +2983,7 @@ void ui_but_update_ex(uiBut *but, const bool validate)
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str);
}
break;
case UI_BTYPE_KEY_EVENT:
{
const char *str;
@@ -3030,13 +3030,13 @@ void ui_but_update_ex(uiBut *but, const bool validate)
default:
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
break;
}
/* if we are doing text editing, this will override the drawstr */
if (but->editstr)
but->drawstr[0] = '\0';
/* text clipping moved to widget drawing code itself */
}
@@ -3129,7 +3129,7 @@ static uiBut *ui_def_but(
int slen;
BLI_assert(width >= 0 && height >= 0);
/* we could do some more error checks here */
if ((type & BUTTYPE) == UI_BTYPE_LABEL) {
BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == false);
@@ -3184,7 +3184,7 @@ static uiBut *ui_def_but(
but->funcN = block->funcN;
if (block->func_argN)
but->func_argN = MEM_dupallocN(block->func_argN);
but->pos = -1; /* cursor invisible */
if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) { /* add a space to name */
@@ -3237,7 +3237,7 @@ static uiBut *ui_def_but(
}
BLI_addtail(&block->buttons, but);
if (block->curlayout)
ui_layout_add_but(block->curlayout, but);
@@ -3526,7 +3526,7 @@ static uiBut *ui_def_but_rna(
if (icon) {
ui_def_but_icon(but, icon, UI_HAS_ICON);
}
if ((type == UI_BTYPE_MENU) && (but->dt == UI_EMBOSS_PULLDOWN)) {
but->flag |= UI_BUT_ICON_SUBMENU;
}
@@ -3603,7 +3603,7 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, in
uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
ui_but_update(but);
return but;
}
@@ -3645,7 +3645,7 @@ struct AutoComplete {
AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxlen)
{
AutoComplete *autocpl;
autocpl = MEM_callocN(sizeof(AutoComplete), "AutoComplete");
autocpl->maxlen = maxlen;
autocpl->matches = 0;
@@ -3686,7 +3686,7 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
}
int UI_autocomplete_end(AutoComplete *autocpl, char *autoname)
{
{
int match = AUTOCOMPLETE_NO_MATCH;
if (autocpl->truncate[0]) {
if (autocpl->matches == 1) {
@@ -3944,7 +3944,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int o
uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
if (str && str[0] == '\0')
if (str && str[0] == '\0')
return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip);
return uiDefIconTextButO_ptr(block, type, ot, opcontext, icon, str, x, y, width, height, tip);
}
@@ -3957,11 +3957,11 @@ int UI_blocklist_min_y_get(ListBase *lb)
{
uiBlock *block;
int min = 0;
for (block = lb->first; block; block = block->next)
if (block == lb->first || block->rect.ymin < min)
min = block->rect.ymin;
return min;
}
@@ -3980,7 +3980,7 @@ void UI_block_order_flip(uiBlock *block)
return;
else if (block->flag & UI_BLOCK_NO_FLIP)
return;
for (but = block->buttons.first; but; but = but->next) {
if (but->drawflag & UI_BUT_ALIGN) return;
if (but->rect.ymin < miny) miny = but->rect.ymin;
@@ -4129,8 +4129,8 @@ void UI_but_unit_type_set(uiBut *but, const int unit_type)
int UI_but_unit_type_get(const uiBut *but)
{
int ownUnit = (int)but->unit_type;
/* own unit define always takes precedence over RNA provided, allowing for overriding
/* own unit define always takes precedence over RNA provided, allowing for overriding
* default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
*/
/* XXX: this doesn't allow clearing unit completely, though the same could be said for icons */
@@ -4292,7 +4292,7 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
/* XXX temp, old menu calls pass on icon arrow, which is now UI_BUT_ICON_SUBMENU flag */
if (icon != ICON_RIGHTARROW_THIN) {
ui_def_but_icon(but, icon, 0);
@@ -4303,7 +4303,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
but->block_create_func = func;
ui_but_update(but);
return but;
}
@@ -4311,14 +4311,14 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_BLOCK, retval, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
ui_def_but_icon(but, icon, UI_HAS_ICON);
but->drawflag |= UI_BUT_ICON_LEFT;
but->block_create_func = func;
ui_but_update(but);
return but;
}
@@ -4345,13 +4345,13 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, in
uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip)
{
uiBut *but = ui_def_but(block, UI_BTYPE_SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip);
ui_def_but_icon(but, icon, UI_HAS_ICON);
but->drawflag |= UI_BUT_ICON_LEFT | UI_BUT_TEXT_LEFT;
ui_but_update(but);
return but;
}
@@ -4375,7 +4375,7 @@ void UI_but_func_search_set(
but->search_create_func = search_create_func;
but->search_func = search_func;
but->search_arg = arg;
if (bfunc) {
#ifdef DEBUG
if (but->func) {
@@ -4385,7 +4385,7 @@ void UI_but_func_search_set(
#endif
UI_but_func_set(but, bfunc, arg, active);
}
/* search buttons show red-alert if item doesn't exist, not for menus */
if (0 == (but->block->flag & UI_BLOCK_LOOP)) {
/* skip empty buttons, not all buttons need input, we only show invalid */
@@ -4483,14 +4483,14 @@ uiBut *uiDefSearchButO_ptr(
void UI_but_focus_on_enter_event(wmWindow *win, uiBut *but)
{
wmEvent event;
wm_event_init_from_window(win, &event);
event.type = EVT_BUT_OPEN;
event.val = KM_PRESS;
event.customdata = but;
event.customdatafree = false;
wm_event_add(win, &event);
}
@@ -4614,7 +4614,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
PointerRNA *ptr = NULL;
PropertyRNA *prop = NULL;
int value = 0;
/* get the enum property... */
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
/* enum property */
@@ -4625,8 +4625,8 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
else if (but->optype) {
PointerRNA *opptr = UI_but_operator_ptr_get(but);
wmOperatorType *ot = but->optype;
/* if the default property of the operator is enum and it is set,
/* if the default property of the operator is enum and it is set,
* fetch the tooltip of the selected value so that "Snap" and "Mirror"
* operator menus in the Anim Editors will show tooltips for the different
* operations instead of the meaningless generic operator tooltip
@@ -4639,7 +4639,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
}
}
}
/* get strings from matching enum item */
if (ptr && prop) {
if (!item) {

View File

@@ -524,7 +524,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
{
uiBut *prev, *but = NULL, *next;
int flag = 0, cols = 0, rows = 0;
/* auto align */
for (but = first; but && but->alignnr == nr; but = but->next) {
@@ -535,7 +535,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
}
/* rows == 0: 1 row, cols == 0: 1 column */
/* note; how it uses 'flag' in loop below (either set it, or OR it) is confusing */
for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) {
next = but->next;
@@ -544,13 +544,13 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
/* clear old flag */
but->drawflag &= ~UI_BUT_ALIGN;
if (flag == 0) { /* first case */
if (next) {
if (buts_are_horiz(but, next)) {
if (rows == 0)
flag = UI_BUT_ALIGN_RIGHT;
else
else
flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT;
}
else {
@@ -597,14 +597,14 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
flag |= UI_BUT_ALIGN_TOP;
}
else { /* next button switches to new row */
if (prev && buts_are_horiz(prev, but))
flag |= UI_BUT_ALIGN_LEFT;
else {
flag &= ~UI_BUT_ALIGN_LEFT;
flag |= UI_BUT_ALIGN_TOP;
}
if ((flag & UI_BUT_ALIGN_TOP) == 0) { /* still top row */
if (prev) {
if (next && buts_are_horiz(but, next))
@@ -614,16 +614,16 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT;
}
}
else
else
flag |= UI_BUT_ALIGN_DOWN;
}
else
else
flag |= UI_BUT_ALIGN_TOP;
}
}
but->drawflag |= flag;
/* merge coordinates */
if (prev) {
/* simple cases */
@@ -646,7 +646,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
/* the previous button is a single one in its row */
but->rect.ymax = (prev->rect.ymin + but->rect.ymax) / 2.0f;
prev->rect.ymin = but->rect.ymax;
but->rect.xmin = prev->rect.xmin;
if (next && buts_are_horiz(but, next) == 0)
but->rect.xmax = prev->rect.xmax;

View File

@@ -73,26 +73,26 @@ void ui_but_anim_flag(uiBut *but, float cfra)
FCurve *fcu;
bool driven;
bool special;
but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN);
/* NOTE: "special" is reserved for special F-Curves stored on the animation data
* itself (which are used to animate properties of the animation data).
* We count those as "animated" too for now
*/
fcu = ui_but_get_fcurve(but, &adt, &act, &driven, &special);
if (fcu) {
if (!driven) {
but->flag |= UI_BUT_ANIMATED;
/* T41525 - When the active action is a NLA strip being edited,
/* T41525 - When the active action is a NLA strip being edited,
* we need to correct the frame number to "look inside" the
* remapped action
*/
if (adt)
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
if (fcurve_frame_has_keyframe(fcu, cfra, 0))
but->flag |= UI_BUT_ANIMATED_KEY;
}
@@ -111,9 +111,9 @@ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
FCurve *fcu;
ChannelDriver *driver;
bool driven, special;
fcu = ui_but_get_fcurve(but, NULL, NULL, &driven, &special);
if (fcu && driven) {
driver = fcu->driver;
@@ -138,20 +138,20 @@ bool ui_but_anim_expression_set(uiBut *but, const char *str)
if (fcu && driven) {
driver = fcu->driver;
if (driver && (driver->type == DRIVER_TYPE_PYTHON)) {
BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression));
/* tag driver as needing to be recompiled */
driver->flag |= DRIVER_FLAG_RECOMPILE;
/* clear invalid flags which may prevent this from working */
driver->flag &= ~DRIVER_FLAG_INVALID;
fcu->flag &= ~FCURVE_DISABLED;
/* this notifier should update the Graph Editor and trigger depsgraph refresh? */
WM_event_add_notifier(but->block->evil_C, NC_ANIMATION | ND_KEYFRAME, NULL);
return true;
}
}
@@ -167,14 +167,14 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
FCurve *fcu;
char *path;
bool ok = false;
/* button must have RNA-pointer to a numeric-capable property */
if (ELEM(NULL, but->rnapoin.data, but->rnaprop)) {
if (G.debug & G_DEBUG)
printf("ERROR: create expression failed - button has no RNA info attached\n");
return false;
}
if (RNA_property_array_check(but->rnaprop) != 0) {
if (but->rnaindex == -1) {
if (G.debug & G_DEBUG)
@@ -182,7 +182,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
return false;
}
}
/* make sure we have animdata for this */
/* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
@@ -191,18 +191,18 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
printf("ERROR: create expression failed - invalid data-block for adding drivers (%p)\n", id);
return false;
}
/* get path */
path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
if (path == NULL) {
return false;
}
/* create driver */
fcu = verify_driver_fcurve(id, path, but->rnaindex, 1);
if (fcu) {
ChannelDriver *driver = fcu->driver;
if (driver) {
/* set type of driver */
driver->type = DRIVER_TYPE_PYTHON;
@@ -218,9 +218,9 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
ok = true;
}
}
MEM_freeN(path);
return ok;
}
@@ -233,17 +233,17 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
bool special;
fcu = ui_but_get_fcurve(but, NULL, &action, &driven, &special);
if (fcu == NULL)
return;
if (special) {
/* NLA Strip property */
if (IS_AUTOKEY_ON(scene)) {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
insert_keyframe_direct(depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, 0);
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
@@ -256,23 +256,23 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
insert_keyframe_direct(depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, INSERTKEY_DRIVER);
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
}
else {
id = but->rnapoin.id.data;
/* TODO: this should probably respect the keyingset only option for anim */
if (autokeyframe_cfra_can_key(scene, id)) {
Depsgraph *depsgraph = CTX_data_depsgraph(C);
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
short flag = ANIM_get_keyframing_flags(scene, 1);
fcu->flag &= ~FCURVE_SELECTED;
/* Note: We use but->rnaindex instead of fcu->array_index,
* because a button may control all items of an array at once.
* E.g., color wheels (see T42567). */
@@ -280,7 +280,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
insert_keyframe(depsgraph, reports, id, action,
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, but->rnaindex, cfra, ts->keyframe_type, flag);
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
}

View File

@@ -184,7 +184,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
else {
immVertex2f(pos, maxx, miny);
}
/* corner right-top */
if (roundboxtype & UI_CNR_TOP_RIGHT) {
immVertex2f(pos, maxx, maxy - rad);
@@ -196,7 +196,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
else {
immVertex2f(pos, maxx, maxy);
}
/* corner left-top */
if (roundboxtype & UI_CNR_TOP_LEFT) {
immVertex2f(pos, minx + rad, maxy);
@@ -208,7 +208,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
else {
immVertex2f(pos, minx, maxy);
}
/* corner left-bottom */
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
immVertex2f(pos, minx, miny + rad);
@@ -220,7 +220,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
else {
immVertex2f(pos, minx, miny);
}
immEnd();
immUnbindProgram();
#endif
@@ -302,15 +302,15 @@ void UI_draw_roundbox_shade_x(
/* start with corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(color, coltop, coldown, 0.0);
immVertex2f(pos, maxx - rad, miny);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, coltop, coldown, vec[a][1] * idiv);
immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
}
round_box_shade_col(color, coltop, coldown, rad * idiv);
immVertex2f(pos, maxx, miny + rad);
}
@@ -318,13 +318,13 @@ void UI_draw_roundbox_shade_x(
round_box_shade_col(color, coltop, coldown, 0.0);
immVertex2f(pos, maxx, miny);
}
/* corner right-top */
if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(color, coltop, coldown, (div - rad) * idiv);
immVertex2f(pos, maxx, maxy - rad);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, coltop, coldown, (div - rad + vec[a][1]) * idiv);
immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
@@ -336,18 +336,18 @@ void UI_draw_roundbox_shade_x(
round_box_shade_col(color, coltop, coldown, 1.0);
immVertex2f(pos, maxx, maxy);
}
/* corner left-top */
if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(color, coltop, coldown, 1.0);
immVertex2f(pos, minx + rad, maxy);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, coltop, coldown, (div - vec[a][1]) * idiv);
immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
}
round_box_shade_col(color, coltop, coldown, (div - rad) * idiv);
immVertex2f(pos, minx, maxy - rad);
}
@@ -355,18 +355,18 @@ void UI_draw_roundbox_shade_x(
round_box_shade_col(color, coltop, coldown, 1.0);
immVertex2f(pos, minx, maxy);
}
/* corner left-bottom */
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(color, coltop, coldown, rad * idiv);
immVertex2f(pos, minx, miny + rad);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, coltop, coldown, (rad - vec[a][1]) * idiv);
immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
}
round_box_shade_col(color, coltop, coldown, 0.0);
immVertex2f(pos, minx + rad, miny);
}
@@ -418,7 +418,7 @@ void UI_draw_roundbox_shade_y(
float colLeft[3], colRight[3];
int vert_count = 0;
int a;
/* mult */
for (a = 0; a < 7; a++) {
mul_v2_fl(vec[a], rad);
@@ -450,12 +450,12 @@ void UI_draw_roundbox_shade_y(
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
round_box_shade_col(color, colLeft, colRight, 0.0);
immVertex2f(pos, maxx - rad, miny);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, colLeft, colRight, vec[a][0] * idiv);
immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
}
round_box_shade_col(color, colLeft, colRight, rad * idiv);
immVertex2f(pos, maxx, miny + rad);
}
@@ -463,14 +463,14 @@ void UI_draw_roundbox_shade_y(
round_box_shade_col(color, colLeft, colRight, 0.0);
immVertex2f(pos, maxx, miny);
}
/* corner right-top */
if (roundboxtype & UI_CNR_TOP_RIGHT) {
round_box_shade_col(color, colLeft, colRight, 0.0);
immVertex2f(pos, maxx, maxy - rad);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, colLeft, colRight, (div - rad - vec[a][0]) * idiv);
immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
}
@@ -481,17 +481,17 @@ void UI_draw_roundbox_shade_y(
round_box_shade_col(color, colLeft, colRight, 0.0);
immVertex2f(pos, maxx, maxy);
}
/* corner left-top */
if (roundboxtype & UI_CNR_TOP_LEFT) {
round_box_shade_col(color, colLeft, colRight, (div - rad) * idiv);
immVertex2f(pos, minx + rad, maxy);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, colLeft, colRight, (div - rad + vec[a][0]) * idiv);
immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
}
round_box_shade_col(color, colLeft, colRight, 1.0);
immVertex2f(pos, minx, maxy - rad);
}
@@ -499,17 +499,17 @@ void UI_draw_roundbox_shade_y(
round_box_shade_col(color, colLeft, colRight, 1.0);
immVertex2f(pos, minx, maxy);
}
/* corner left-bottom */
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
round_box_shade_col(color, colLeft, colRight, 1.0);
immVertex2f(pos, minx, miny + rad);
for (a = 0; a < 7; a++) {
round_box_shade_col(color, colLeft, colRight, (vec[a][0]) * idiv);
immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
}
round_box_shade_col(color, colLeft, colRight, 1.0);
immVertex2f(pos, minx + rad, miny);
}
@@ -638,10 +638,10 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
float facx = 1.0f;
float facy = 1.0f;
int w = BLI_rcti_size_x(rect);
int h = BLI_rcti_size_y(rect);
/* scissor doesn't seem to be doing the right thing...? */
#if 0
/* prevent drawing outside widget area */
@@ -649,9 +649,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(rect->xmin, rect->ymin, w, h);
#endif
glEnable(GL_BLEND);
if (w != ibuf->x || h != ibuf->y) {
facx = (float)w / (float)ibuf->x;
facy = (float)h / (float)ibuf->y;
@@ -660,14 +660,14 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect,
facx, facy, NULL);
glDisable(GL_BLEND);
#if 0
// restore scissortest
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
#endif
#endif
}
@@ -788,10 +788,10 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
.ymin = (float)recti->ymin + 1,
.ymax = (float)recti->ymax - 1
};
float w = BLI_rctf_size_x(&rect);
float h = BLI_rctf_size_y(&rect) * hist->ymax;
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -850,7 +850,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
}
immUnbindProgram();
/* outline */
draw_scope_end(&rect, scissor);
}
@@ -884,9 +884,9 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
float min, max;
if (scopes == NULL) return;
rctf rect = {
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
@@ -900,10 +900,10 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
float h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac;
float yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) * 0.5f;
float w3 = w / 3.0f;
/* log scale for alpha */
float alpha = scopes->wavefrm_alpha * scopes->wavefrm_alpha;
unit_m3(colors);
for (int c = 0; c < 3; c++) {
@@ -974,7 +974,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
immEnd();
}
/* separate min max zone on the right */
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect.xmin + w, rect.ymin);
@@ -1171,20 +1171,20 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
const float colors[6][3] = {
{0.75, 0.0, 0.0}, {0.75, 0.75, 0.0}, {0.0, 0.75, 0.0},
{0.0, 0.75, 0.75}, {0.0, 0.0, 0.75}, {0.75, 0.0, 0.75}};
rctf rect = {
.xmin = (float)recti->xmin + 1,
.xmax = (float)recti->xmax - 1,
.ymin = (float)recti->ymin + 1,
.ymax = (float)recti->ymax - 1
};
float w = BLI_rctf_size_x(&rect);
float h = BLI_rctf_size_y(&rect);
float centerx = rect.xmin + w * 0.5f;
float centery = rect.ymin + h * 0.5f;
float diam = (w < h) ? w : h;
float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
glEnable(GL_BLEND);
@@ -1202,7 +1202,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
(rect.ymin - 1),
(rect.xmax + 1) - (rect.xmin - 1),
(rect.ymax + 1) - (rect.ymin - 1));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1243,7 +1243,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
/* saturation points */
for (int i = 0; i < 6; i++)
vectorscope_draw_target(pos, centerx, centery, diam, colors[i]);
if (scopes->ok && scopes->vecscope != NULL) {
/* pixel point cloud */
float col[3] = {alpha, alpha, alpha};
@@ -1434,16 +1434,16 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
v1[1] = y1 + sizey_solid;
v2[1] = rect->ymax;
immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2);
for (int a = 0; a <= sizex; a++) {
float pos = ((float)a) / sizex;
BKE_colorband_evaluate(coba, pos, colf);
if (display)
IMB_colormanagement_scene_linear_to_display_v3(colf, display);
v1[0] = v2[0] = x1 + a;
immAttrib4fv(color, colf);
immVertex2fv(position, v1);
immVertex2fv(position, v2);
@@ -1499,7 +1499,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
immEnd();
glDisable(GL_BLEND);
/* layer: draw handles */
for (int a = 0; a < coba->tot; a++, cbd++) {
if (a != coba->cur) {
@@ -1524,20 +1524,20 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
float diffuse[3] = {1.0f, 1.0f, 1.0f};
float light[3];
float size;
/* backdrop */
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_3ubAlpha(true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, (unsigned char *)wcol->inner, 255);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
/* setup lights */
ui_but_v3_get(but, light);
/* transform to button */
gpuPushMatrix();
if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect))
size = 0.5f * BLI_rcti_size_x(rect);
else
@@ -1554,7 +1554,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
/* restore */
glDisable(GL_CULL_FACE);
/* AA circle */
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1578,7 +1578,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
float dx = step * zoomx;
float fx = rect->xmin + zoomx * (-offsx);
if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin));
float dy = step * zoomy;
float fy = rect->ymin + zoomy * (-offsy);
if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
@@ -1598,7 +1598,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
fy += dy;
}
immEnd();
}
static void gl_shaded_color(unsigned char *col, int shade)
@@ -1732,7 +1732,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
else if (cumap->cur == 3) {
float lum = IMB_colormanagement_get_luminance(cumap->sample);
immUniformColor3ub(240, 240, 240);
immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymin);
immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymax);
}
@@ -1743,7 +1743,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immUniformColor3ub(100, 240, 100);
else
immUniformColor3ub(100, 100, 240);
immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymin);
immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymax);
}
@@ -1755,7 +1755,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
immBegin(GWN_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2);
if (cuma->table == NULL)
curvemapping_changed(cumap, false);
@@ -1811,7 +1811,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
}
immEnd();
immUnbindProgram();
/* restore scissortest */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
@@ -1959,7 +1959,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
static const float size = 5.0f;
/* 16 values of sin function */
const float si[16] = {
0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
@@ -1974,12 +1974,12 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
-0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
};
GLint scissor[4];
/* need scissor test, can draw outside of boundary */
glGetIntegerv(GL_SCISSOR_BOX, scissor);
rcti scissor_new = {
.xmin = recti->xmin,
.ymin = recti->ymin,
@@ -1994,7 +1994,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
scissor_new.ymin,
BLI_rcti_size_x(&scissor_new),
BLI_rcti_size_y(&scissor_new));
float x = 0.5f * (recti->xmin + recti->xmax);
float y = 0.5f * (recti->ymin + recti->ymax);
@@ -2008,7 +2008,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
for (int a = 0; a < 16; a++)
immVertex2f(pos, x + size * si[a], y + size * co[a]);
immEnd();
immUniformColor4ub(0, 0, 0, 150);
glLineWidth(1);
glEnable(GL_LINE_SMOOTH);
@@ -2020,7 +2020,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
glDisable(GL_BLEND);
immUnbindProgram();
/* restore scissortest */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
@@ -2107,7 +2107,7 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8);
ui_shadowbox(pos, color, minx, miny, maxx, maxy, 7.0, (40 * alpha) >> 8);
ui_shadowbox(pos, color, minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8);
immEnd();
immUnbindProgram();
@@ -2119,7 +2119,7 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
{
float rad;
if (radius > (BLI_rctf_size_y(rct) - 10.0f) * 0.5f)
rad = (BLI_rctf_size_y(rct) - 10.0f) * 0.5f;
else
@@ -2135,7 +2135,7 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
{
a = i * aspect;
}
glEnable(GL_BLEND);
const float dalpha = alpha * 2.0f / 255.0f;
float calpha = dalpha;
@@ -2151,7 +2151,7 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
visibility = visibility * (1.0f - calpha);
calpha += dalpha;
}
uiWidgetBaseParameters widget_params = {
.recti.xmin = rct->xmin, .recti.ymin = rct->ymin,
.recti.xmax = rct->xmax, .recti.ymax = rct->ymax - 10.0f,
@@ -2177,6 +2177,6 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
UI_draw_roundbox_4fv(false, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f, color);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}

File diff suppressed because it is too large Load Diff

View File

@@ -133,7 +133,7 @@ typedef struct IconTexture {
} IconTexture;
/* ******************* STATIC LOCAL VARS ******************* */
/* static here to cache results of icon directory scan, so it's not
/* static here to cache results of icon directory scan, so it's not
* scanning the filesystem each time the menu is drawn */
static struct ListBase iconfilelist = {NULL, NULL};
static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f};
@@ -170,9 +170,9 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
/* icon buffers can get initialized runtime now, via datatoc */
if (bbuf) {
int y, imgsize;
iimg->rect = MEM_mallocN(size * size * sizeof(unsigned int), "icon_rect");
/* Here we store the rect in the icon - same as before */
if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0)
memcpy(iimg->rect, bbuf->rect, size * size * sizeof(int));
@@ -191,7 +191,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
new_icon->drawinfo = di;
BKE_icon_set(icon_id, new_icon);
return di;
}
@@ -255,10 +255,10 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha,
* (since we're doing this offscreen, free from any particular space_id)
*/
struct bThemeState theme_state;
UI_Theme_Store(&theme_state);
UI_SetTheme(SPACE_ACTION, RGN_TYPE_WINDOW);
/* the "x" and "y" given are the bottom-left coordinates of the icon,
* while the draw_keyframe_shape() function needs the midpoint for
* the keyframe
@@ -353,7 +353,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU
{ \
vicon_colorset_draw(index, x, y, w, h, alpha); \
}
DEF_VICON_COLORSET_DRAW_NTH(01, 0)
DEF_VICON_COLORSET_DRAW_NTH(02, 1)
DEF_VICON_COLORSET_DRAW_NTH(03, 2)
@@ -437,14 +437,14 @@ static void icon_verify_datatoc(IconImage *iimg)
/* if it has own rect, things are all OK */
if (iimg->rect)
return;
if (iimg->datatoc_rect) {
ImBuf *bbuf = IMB_ibImageFromMemory(iimg->datatoc_rect,
iimg->datatoc_size, IB_rect, NULL, "<matcap icon>");
/* w and h were set on initialize */
if (bbuf->x != iimg->h && bbuf->y != iimg->w)
IMB_scaleImBuf(bbuf, iimg->w, iimg->h);
iimg->rect = bbuf->rect;
bbuf->rect = NULL;
IMB_freeImBuf(bbuf);
@@ -504,7 +504,7 @@ static void init_internal_icons(void)
if ((btheme != NULL) && btheme->tui.iconfile[0]) {
char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons");
char iconfilestr[FILE_MAX];
if (icondir) {
BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); /* if the image is missing bbuf will just be NULL */
@@ -530,7 +530,7 @@ static void init_internal_icons(void)
datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>");
if (b32buf)
IMB_premultiply_alpha(b32buf);
if (b16buf && b32buf) {
/* free existing texture if any */
if (icongltex.id) {
@@ -548,17 +548,17 @@ static void init_internal_icons(void)
if (icongltex.id) {
int level = 2;
icongltex.w = b32buf->x;
icongltex.h = b32buf->y;
icongltex.invw = 1.0f / b32buf->x;
icongltex.invh = 1.0f / b32buf->y;
glBindTexture(GL_TEXTURE_2D, icongltex.id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, b32buf->x, b32buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b32buf->rect);
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect);
while (b16buf->x > 1) {
ImBuf *nbuf = IMB_onehalf(b16buf);
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, nbuf->x, nbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nbuf->rect);
@@ -566,10 +566,10 @@ static void init_internal_icons(void)
IMB_freeImBuf(b16buf);
b16buf = nbuf;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
}
}
@@ -579,7 +579,7 @@ static void init_internal_icons(void)
icontype = ICON_TYPE_TEXTURE;
else
icontype = ICON_TYPE_BUFFER;
if (b32buf) {
for (y = 0; y < ICON_GRID_ROWS; y++) {
for (x = 0; x < ICON_GRID_COLS; x++) {
@@ -592,13 +592,13 @@ static void init_internal_icons(void)
}
def_internal_vicon(VICO_SMALL_TRI_RIGHT_VEC, vicon_small_tri_right_draw);
def_internal_vicon(VICO_KEYTYPE_KEYFRAME_VEC, vicon_keytype_keyframe_draw);
def_internal_vicon(VICO_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw);
def_internal_vicon(VICO_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw);
def_internal_vicon(VICO_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw);
def_internal_vicon(VICO_KEYTYPE_MOVING_HOLD_VEC, vicon_keytype_moving_hold_draw);
def_internal_vicon(VICO_COLORSET_01_VEC, vicon_colorset_draw_01);
def_internal_vicon(VICO_COLORSET_02_VEC, vicon_colorset_draw_02);
def_internal_vicon(VICO_COLORSET_03_VEC, vicon_colorset_draw_03);
@@ -622,7 +622,7 @@ static void init_internal_icons(void)
IMB_freeImBuf(b16buf);
IMB_freeImBuf(b32buf);
}
#endif /* WITH_HEADLESS */
@@ -638,13 +638,13 @@ static void init_iconfile_list(struct ListBase *list)
if (icondir == NULL)
return;
totfile = BLI_filelist_dir_contents(icondir, &dir);
for (i = 0; i < totfile; i++) {
if ((dir[i].type & S_IFREG)) {
const char *filename = dir[i].relname;
if (BLI_testextensie(filename, ".png")) {
/* loading all icons on file start is overkill & slows startup
* its possible they change size after blender load anyway. */
@@ -666,7 +666,7 @@ static void init_iconfile_list(struct ListBase *list)
else {
ifilex = ifiley = 0;
}
/* bad size or failed to load */
if ((ifilex != ICON_IMAGE_W) || (ifiley != ICON_IMAGE_H)) {
printf("icon '%s' is wrong size %dx%d\n", iconfilestr, ifilex, ifiley);
@@ -676,12 +676,12 @@ static void init_iconfile_list(struct ListBase *list)
/* found a potential icon file, so make an entry for it in the cache list */
ifile = MEM_callocN(sizeof(IconFile), "IconFile");
BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename));
ifile->index = index;
BLI_addtail(list, ifile);
index++;
}
}
@@ -694,7 +694,7 @@ static void init_iconfile_list(struct ListBase *list)
static void free_iconfile_list(struct ListBase *list)
{
IconFile *ifile = NULL, *next_ifile = NULL;
for (ifile = list->first; ifile; ifile = next_ifile) {
next_ifile = ifile->next;
BLI_freelinkN(list, ifile);
@@ -707,20 +707,20 @@ int UI_iconfile_get_index(const char *filename)
{
IconFile *ifile;
ListBase *list = &(iconfilelist);
for (ifile = list->first; ifile; ifile = ifile->next) {
if (BLI_path_cmp(filename, ifile->filename) == 0) {
return ifile->index;
}
}
return 0;
}
ListBase *UI_iconfile_list(void)
{
ListBase *list = &(iconfilelist);
return list;
}
@@ -811,13 +811,13 @@ int UI_icon_get_width(int icon_id)
DrawInfo *di = NULL;
icon = BKE_icon_get(icon_id);
if (icon == NULL) {
if (G.debug & G_DEBUG)
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
return 0;
}
di = icon_ensure_drawinfo(icon);
if (di) {
return ICON_DEFAULT_WIDTH;
@@ -955,7 +955,7 @@ static void icon_set_image(
PreviewImage *UI_icon_to_preview(int icon_id)
{
Icon *icon = BKE_icon_get(icon_id);
if (icon) {
DrawInfo *di = (DrawInfo *)icon->drawinfo;
if (di) {
@@ -1225,10 +1225,10 @@ static void icon_draw_size(
IconImage *iimg;
const float fdraw_size = (float)draw_size;
int w, h;
icon = BKE_icon_get(icon_id);
alpha *= btheme->tui.icon_alpha;
if (icon == NULL) {
if (G.debug & G_DEBUG)
printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
@@ -1304,7 +1304,7 @@ static void icon_draw_size(
if (pi) {
/* no create icon on this level in code */
if (!pi->rect[size]) return; /* something has gone wrong! */
/* preview images use premul alpha ... */
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1341,10 +1341,10 @@ static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
{
PreviewImage *pi = BKE_previewimg_id_ensure(id);
enum eIconSizes i;
if (!pi)
return;
for (i = 0; i < NUM_ICON_SIZES; i++) {
/* check if rect needs to be created; changed
* only set by dynamic icons */
@@ -1435,7 +1435,7 @@ static int ui_id_screen_get_icon(const bContext *C, ID *id)
int ui_id_icon_get(const bContext *C, ID *id, const bool big)
{
int iconid = 0;
/* icon */
switch (GS(id->name)) {
case ID_BR:

View File

@@ -75,19 +75,19 @@ typedef enum {
UI_WTYPE_TOOLBAR_ITEM,
UI_WTYPE_TAB,
UI_WTYPE_TOOLTIP,
/* strings */
UI_WTYPE_NAME,
UI_WTYPE_NAME_LINK,
UI_WTYPE_POINTER_LINK,
UI_WTYPE_FILENAME,
/* menus */
UI_WTYPE_MENU_RADIO,
UI_WTYPE_MENU_ICON_RADIO,
UI_WTYPE_MENU_POINTER_LINK,
UI_WTYPE_MENU_NODE_LINK,
UI_WTYPE_PULLDOWN,
UI_WTYPE_MENU_ITEM,
UI_WTYPE_MENU_ITEM_RADIAL,
@@ -245,7 +245,7 @@ struct uiBut {
uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
uiButSearchCreateFunc search_create_func;
uiButSearchFunc search_func;
bool free_search_arg;
@@ -302,7 +302,7 @@ struct uiBut {
void *dragpoin;
struct ImBuf *imb;
float imb_scale;
/* active button data */
struct uiHandleButtonData *active;
@@ -314,7 +314,7 @@ struct uiBut {
float *editvec;
void *editcoba;
void *editcumap;
/* pointer back */
uiBlock *block;
};
@@ -362,9 +362,9 @@ struct uiBlock {
struct uiLayout *curlayout;
ListBase contexts;
char name[UI_MAX_NAME_STR];
float winmat[4][4];
rctf rect;
@@ -384,10 +384,10 @@ struct uiBlock {
uiBlockHandleFunc handle_func;
void *handle_func_arg;
/* custom extra handling */
int (*block_event_func)(const struct bContext *C, struct uiBlock *, const struct wmEvent *);
/* extra draw function for custom blocks */
void (*drawextra)(const struct bContext *C, void *idv, void *arg1, void *arg2, rcti *rect);
void *drawextra_arg1;
@@ -545,7 +545,7 @@ struct uiPopupBlockHandle {
void (*popup_func)(struct bContext *C, void *arg, int event);
void (*cancel_func)(struct bContext *C, void *arg);
void *popup_arg;
/* store data for refreshing popups */
struct uiPopupBlockCreate popup_create_vars;
/* true if we can re-create the popup using 'popup_create_vars' */
@@ -563,7 +563,7 @@ struct uiPopupBlockHandle {
ScrArea *ctx_area;
ARegion *ctx_region;
int opcontext;
/* return values */
int butretval;
int menuretval;

View File

@@ -301,7 +301,7 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h)
bitem->but->rect.ymin = y;
bitem->but->rect.xmax = x + w;
bitem->but->rect.ymax = y + h;
ui_but_update(bitem->but); /* for strlen */
}
else {
@@ -321,7 +321,7 @@ static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax)
bitem->but->rect.xmin += delta_xmin;
bitem->but->rect.xmax += delta_xmax;
ui_but_update(bitem->but); /* for strlen */
}
else {
@@ -361,7 +361,7 @@ static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int a
sub = uiLayoutRow(layout, align);
else
sub = uiLayoutColumn(layout, align);
sub->space = 0;
return sub;
}
@@ -431,9 +431,9 @@ static void ui_item_array(
if (ptr->type == &RNA_Armature) {
bArmature *arm = (bArmature *)ptr->data;
layer_used = arm->layer_used;
if (arm->edbo) {
if (arm->act_edbone) {
layer_active |= arm->act_edbone->layer;
@@ -452,7 +452,7 @@ static void ui_item_array(
for (a = 0; a < colbuts; a++) {
const int layer_num = a + b * colbuts;
const unsigned int layer_flag = (1u << layer_num);
if (layer_used & layer_flag) {
if (layer_active & layer_flag)
icon = ICON_LAYER_ACTIVE;
@@ -470,7 +470,7 @@ static void ui_item_array(
for (a = 0; a < colbuts; a++) {
const int layer_num = a + len / 2 + b * colbuts;
const unsigned int layer_flag = (1u << layer_num);
if (layer_used & layer_flag) {
if (layer_active & layer_flag)
icon = ICON_LAYER_ACTIVE;
@@ -498,7 +498,7 @@ static void ui_item_array(
totdim = RNA_property_array_dimension(ptr, prop, dim_size);
if (totdim != 2) return; /* only 2D matrices supported in UI so far */
w /= dim_size[0];
/* h /= dim_size[1]; */ /* UNUSED */
@@ -1451,7 +1451,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if (icon == ICON_NONE)
icon = RNA_property_ui_icon(prop);
if (flag & UI_ITEM_R_ICON_ONLY) {
/* pass */
}
@@ -1504,7 +1504,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if (no_bg) {
layout->emboss = UI_EMBOSS_NONE;
}
/* array property */
if (index == RNA_NO_INDEX && is_array)
ui_item_array(
@@ -1526,7 +1526,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
but = ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
ui_but_add_search(but, ptr, prop, NULL, NULL);
if (layout->redalert)
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
@@ -1539,7 +1539,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if (toggle && but->type == UI_BTYPE_CHECKBOX)
but->type = UI_BTYPE_TOGGLE;
if (layout->redalert)
UI_but_flag_enable(but, UI_BUT_REDALERT);
}
@@ -1783,7 +1783,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
StructRNA *icontype;
int w, h;
char namestr[UI_MAX_NAME_STR];
/* validate arguments */
prop = RNA_struct_find_property(ptr, propname);
@@ -1792,7 +1792,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
RNA_struct_identifier(ptr->type), propname);
return;
}
type = RNA_property_type(prop);
if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) {
RNA_warning("Property %s must be a pointer, string or enum", propname);
@@ -2296,7 +2296,7 @@ static void ui_litem_layout_row(uiLayout *litem)
if (totw == 0)
return;
if (w != 0)
w -= (tot - 1) * litem->space;
fixedw = 0;
@@ -2327,7 +2327,7 @@ static void ui_litem_layout_row(uiLayout *litem)
/* ignore min flag for rows with right or center alignment */
if (item->type != ITEM_BUTTON &&
ELEM(((uiLayout *)item)->alignment, UI_LAYOUT_ALIGN_RIGHT, UI_LAYOUT_ALIGN_CENTER) &&
litem->alignment == UI_LAYOUT_ALIGN_EXPAND &&
litem->alignment == UI_LAYOUT_ALIGN_EXPAND &&
((uiItem *)litem)->flag & UI_ITEM_MIN)
{
min_flag = false;
@@ -2435,7 +2435,7 @@ static void ui_litem_estimate_column(uiLayout *litem, bool is_box)
if (item->next && (!is_box || item != litem->items.first))
litem->h += litem->space;
}
if (min_size_flag) {
litem->item.flag |= UI_ITEM_MIN;
}
@@ -2825,7 +2825,7 @@ static void ui_litem_layout_absolute(uiLayout *litem)
scalex = (float)litem->w / (float)totw;
if (litem->h && toth > 0)
scaley = (float)litem->h / (float)toth;
x = litem->x;
y = litem->y - scaley * toth;
@@ -2876,7 +2876,7 @@ static void ui_litem_layout_split(uiLayout *litem)
y = litem->y;
percentage = (split->percentage == 0.0f) ? 1.0f / (float)tot : split->percentage;
w = (litem->w - (tot - 1) * litem->space);
colw = w * percentage;
colw = MAX2(colw, 0);
@@ -3509,7 +3509,7 @@ uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int s
BLI_addtail(&block->layouts, root);
ui_layout_add_padding_button(root);
return layout;
}
@@ -3532,7 +3532,7 @@ void UI_block_layout_set_current(uiBlock *block, uiLayout *layout)
void ui_layout_add_but(uiLayout *layout, uiBut *but)
{
uiButtonItem *bitem;
bitem = MEM_callocN(sizeof(uiButtonItem), "uiButtonItem");
bitem->item.type = ITEM_BUTTON;
bitem->but = but;

View File

@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation, Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
@@ -78,7 +78,7 @@ static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
ui_theme_init_default();
ui_style_init_default();
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
@@ -88,10 +88,10 @@ static void UI_OT_reset_default_theme(wmOperatorType *ot)
ot->name = "Reset to Default Theme";
ot->idname = "UI_OT_reset_default_theme";
ot->description = "Reset to the default theme colors";
/* callbacks */
ot->exec = reset_default_theme_exec;
/* flags */
ot->flag = OPTYPE_REGISTER;
}
@@ -109,7 +109,7 @@ static int copy_data_path_button_poll(bContext *C)
if (ptr.id.data && ptr.data && prop) {
path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
MEM_freeN(path);
return 1;
@@ -255,7 +255,7 @@ static int reset_default_button_poll(bContext *C)
int index;
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
return (ptr.data && prop && RNA_property_editable(&ptr, prop));
}
@@ -268,7 +268,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
/* try to reset the nominated setting to its default value */
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
/* if there is a valid property that is editable... */
if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
if (RNA_property_reset(&ptr, prop, (all) ? -1 : index))
@@ -291,7 +291,7 @@ static void UI_OT_reset_default_button(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
}
@@ -800,7 +800,7 @@ static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
/* Reports to Textblock Operator ------------------------ */
/* FIXME: this is just a temporary operator so that we can see all the reports somewhere
/* FIXME: this is just a temporary operator so that we can see all the reports somewhere
* when there are too many to display...
*/
@@ -815,10 +815,10 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Text *txt;
char *str;
/* create new text-block to write to */
txt = BKE_text_add(bmain, "Recent Reports");
/* convert entire list to a display string, and add this to the text-block
* - if commandline debug option enabled, show debug reports too
* - otherwise, up to info (which is what users normally see)
@@ -843,7 +843,7 @@ static void UI_OT_reports_to_textblock(wmOperatorType *ot)
ot->name = "Reports to Text Block";
ot->idname = "UI_OT_reports_to_textblock";
ot->description = "Write the reports ";
/* callbacks */
ot->poll = reports_to_text_poll;
ot->exec = reports_to_text_exec;

View File

@@ -29,7 +29,7 @@
/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */
#include <math.h>
#include <stdlib.h>
#include <string.h>
@@ -129,7 +129,7 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
return BUT_VERTICAL;
else if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
return BUT_VERTICAL;
return 0;
}
@@ -170,7 +170,7 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
return 1;
}
}
return 0;
}
@@ -270,7 +270,7 @@ Panel *UI_panel_begin(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, P
else
pa->flag |= PNL_CLOSEDX;
}
pa->ofsx = 0;
pa->ofsy = 0;
pa->sizex = 0;
@@ -318,7 +318,7 @@ Panel *UI_panel_begin(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, P
for (palast = ar->panels.first; palast; palast = palast->next)
if (palast->runtime_flag & PNL_LAST_ADDED)
break;
if (newpanel) {
pa->sortorder = (palast) ? palast->sortorder + 1 : 0;
@@ -340,7 +340,7 @@ Panel *UI_panel_begin(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, P
if (pa->flag & PNL_CLOSED) return pa;
*r_open = true;
return pa;
}
@@ -398,7 +398,7 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4])
float f3 = 0.15 * U.widget_unit;
float f5 = 0.25 * U.widget_unit;
float f7 = 0.35 * U.widget_unit;
if (dir == 'h') {
UI_draw_anti_tria(x - f3, y - f5, x - f3, y + f5, x + f7, y, color);
}
@@ -445,10 +445,10 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float
immVertex2f(pos, x2, y1);
immEnd();
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
/* x 'icon' for panel header */
@@ -465,15 +465,15 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
{
float xmin, xmax, dx;
float ymin, ymax, dy;
xmin = rect->xmax - PNL_HEADER + 2;
xmax = rect->xmax - 3;
ymin = rect->ymin + 3;
ymax = rect->ymin + PNL_HEADER - 2;
dx = 0.5f * (xmax - xmin);
dy = 0.5f * (ymax - ymin);
glEnable(GL_BLEND);
immUniformColor4ub(255, 255, 255, 50);
@@ -486,7 +486,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
immVertex2f(pos, xmax, ymax - dy);
immEnd();
immUniformColor4ub(0, 0, 0, 50);
immBegin(GWN_PRIM_LINES, 4);
@@ -583,7 +583,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const r
UI_fontstyle_draw(&style->paneltitle, &hrect, activename, col_title);
}
else {
/* ignore 'pnl_icons', otherwise the text gets offset horizontally
/* ignore 'pnl_icons', otherwise the text gets offset horizontally
* + 0.001f to avoid flirting with float inaccuracy
*/
hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f;
@@ -818,7 +818,7 @@ typedef struct PanelSort {
static int find_leftmost_panel(const void *a1, const void *a2)
{
const PanelSort *ps1 = a1, *ps2 = a2;
if (ps1->pa->ofsx > ps2->pa->ofsx) return 1;
else if (ps1->pa->ofsx < ps2->pa->ofsx) return -1;
else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
@@ -831,7 +831,7 @@ static int find_leftmost_panel(const void *a1, const void *a2)
static int find_highest_panel(const void *a1, const void *a2)
{
const PanelSort *ps1 = a1, *ps2 = a2;
/* stick uppermost header-less panels to the top of the region -
* prevent them from being sorted (multiple header-less panels have to be sorted though) */
if (ps1->pa->type->flag & PNL_NO_HEADER && ps2->pa->type->flag & PNL_NO_HEADER) {
@@ -844,17 +844,17 @@ static int find_highest_panel(const void *a1, const void *a2)
else if (ps1->pa->ofsy + ps1->pa->sizey > ps2->pa->ofsy + ps2->pa->sizey) return -1;
else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
static int compare_panel(const void *a1, const void *a2)
{
const PanelSort *ps1 = a1, *ps2 = a2;
if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
return 0;
}
@@ -868,7 +868,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
bool done;
int align = panel_aligned(sa, ar);
bool has_category_tabs = UI_panel_category_is_visible(ar);
/* count active, not tabbed panels */
for (pa = ar->panels.first; pa; pa = pa->next)
if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL)
@@ -888,7 +888,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
/* sort panels */
panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort");
ps = panelsort;
for (pa = ar->panels.first; pa; pa = pa->next) {
if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
@@ -897,7 +897,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
ps++;
}
}
if (drag) {
/* while we are dragging, we sort on location and update sortorder */
if (align == BUT_VERTICAL)
@@ -911,7 +911,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
else
/* otherwise use sortorder */
qsort(panelsort, tot, sizeof(PanelSort), compare_panel);
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
ps = panelsort;
ps->pa->ofsx = 0;
@@ -935,7 +935,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
psnext->pa->ofsy = ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
}
}
/* we interpolate */
done = false;
ps = panelsort;
@@ -959,7 +959,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
MEM_freeN(ps->pa);
}
MEM_freeN(panelsort);
return done;
}
@@ -993,7 +993,7 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
sizex = UI_PANEL_WIDTH;
if (sizey == 0)
sizey = -UI_PANEL_WIDTH;
*x = sizex;
*y = sizey;
}
@@ -1042,7 +1042,7 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *x, int *y)
ScrArea *sa = CTX_wm_area(C);
uiBlock *block;
Panel *panot, *panew, *patest, *pa, *firstpa;
/* offset contents */
for (block = ar->uiblocks.first; block; block = block->next)
if (block->active && block->panel)
@@ -1088,10 +1088,10 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *x, int *y)
if (block->active && block->panel)
if (!firstpa || block->panel->sortorder < firstpa->sortorder)
firstpa = block->panel;
if (firstpa)
firstpa->runtime_flag |= PNL_FIRST;
/* compute size taken up by panel */
ui_panels_size(sa, ar, x, y);
}
@@ -1101,7 +1101,7 @@ void UI_panels_draw(const bContext *C, ARegion *ar)
uiBlock *block;
UI_ThemeClearColor(TH_BACK);
/* draw panels, selected on top */
for (block = ar->uiblocks.first; block; block = block->next) {
if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
@@ -1120,12 +1120,12 @@ void UI_panels_scale(ARegion *ar, float new_width)
{
uiBlock *block;
uiBut *but;
for (block = ar->uiblocks.first; block; block = block->next) {
if (block->panel) {
float fac = new_width / (float)block->panel->sizex;
block->panel->sizex = new_width;
for (but = block->buttons.first; but; but = but->next) {
but->rect.xmin *= fac;
but->rect.xmax *= fac;
@@ -1141,13 +1141,13 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
Panel *pa;
/* also called with (panel == NULL) for clear */
for (pa = ar->panels.first; pa; pa = pa->next) {
pa->flag &= ~PNL_OVERLAP;
if (panel && (pa != panel)) {
if (pa->paneltab == NULL && (pa->runtime_flag & PNL_ACTIVE)) {
float safex = 0.2, safey = 0.2;
if (pa->flag & PNL_CLOSEDX) safex = 0.05;
else if (pa->flag & PNL_CLOSEDY) safey = 0.05;
else if (panel->flag & PNL_CLOSEDX) safex = 0.05;
@@ -1171,7 +1171,7 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
short align = panel_aligned(sa, ar), dx = 0, dy = 0;
/* first clip for window, no dragging outside */
if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x))
return;
@@ -1181,10 +1181,10 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct);
dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct);
if (data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
if (data->startsizey - dy < UI_PANEL_MINY)
dy = -UI_PANEL_MINY + data->startsizey;
@@ -1194,11 +1194,11 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
else {
/* reset the panel snapping, to allow dragging away from snapped edges */
panel->snap = PNL_SNAP_NONE;
panel->ofsx = data->startofsx + dx;
panel->ofsy = data->startofsy + dy;
check_panel_overlap(ar, panel);
if (align) uiAlignPanelStep(sa, ar, 0.2, true);
}
@@ -1388,9 +1388,9 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
rect_leftmost = rect_pin.xmin;
/* mouse coordinates in panel space! */
/* XXX weak code, currently it assumes layout style for location of widgets */
/* check open/collapsed button */
if (event == RETKEY)
button = 1;
@@ -1411,7 +1411,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
else if (mx < rect_leftmost) {
button = 1;
}
if (button) {
if (button == 2) { /* close */
ED_region_tag_redraw(ar);
@@ -1427,7 +1427,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
if (block->panel->flag & PNL_CLOSED) {
block->panel->flag &= ~PNL_CLOSED;
/* snap back up so full panel aligns with screen edge */
if (block->panel->snap & PNL_SNAP_BOTTOM)
if (block->panel->snap & PNL_SNAP_BOTTOM)
block->panel->ofsy = 0;
if (event == LEFTMOUSE) {
@@ -1444,14 +1444,14 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
else {
/* snap down to bottom screen edge */
block->panel->flag |= PNL_CLOSEDY;
if (block->panel->snap & PNL_SNAP_BOTTOM)
if (block->panel->snap & PNL_SNAP_BOTTOM)
block->panel->ofsy = -block->panel->sizey;
if (event == LEFTMOUSE) {
ui_panel_drag_collapse_handler_add(C, true);
}
}
for (pa = ar->panels.first; pa; pa = pa->next) {
if (pa->paneltab == block->panel) {
if (block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
@@ -2068,27 +2068,27 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
/* XXX hardcoded key warning */
if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER) && event->val == KM_PRESS) {
if (event->type == AKEY && ((event->ctrl + event->oskey + event->shift + event->alt) == 0)) {
if (pa->flag & PNL_CLOSEDY) {
if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my))
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
}
else
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
retval = WM_UI_HANDLER_BREAK;
continue;
}
}
/* on active button, do not handle panels */
if (ui_but_is_active(ar))
continue;
if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) {
if (event->val == KM_PRESS) {
/* open close on header */
if (ELEM(event->type, RETKEY, PADENTER)) {
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
@@ -2100,7 +2100,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
else if (event->type == LEFTMOUSE) {
/* all inside clicks should return in break - overlapping/float panels */
retval = WM_UI_HANDLER_BREAK;
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
ui_handle_panel_header(C, block, mx, my, event->type, event->ctrl, event->shift);
retval = WM_UI_HANDLER_BREAK;
@@ -2133,7 +2133,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
else if (event->type == PADPLUSKEY || event->type == PADMINUS) {
#if 0 /* XXX make float panel exception? */
int zoom = 0;
/* if panel is closed, only zoom if mouse is over the header */
if (pa->flag & (PNL_CLOSEDX | PNL_CLOSEDY)) {
if (inside_header)
@@ -2216,7 +2216,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
uiHandlePanelData *data = pa->activedata;
wmWindow *win = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
if (data && data->state == state)
return;

View File

@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****

View File

@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -65,10 +65,10 @@
/* style + theme + layout-engine = UI */
/**
* This is a complete set of layout rules, the 'state' of the Layout
* Engine. Multiple styles are possible, defined via C or Python. Styles
* get a name, and will typically get activated per region type, like
* "Header", or "Listview" or "Toolbar". Properties of Style definitions
* This is a complete set of layout rules, the 'state' of the Layout
* Engine. Multiple styles are possible, defined via C or Python. Styles
* get a name, and will typically get activated per region type, like
* "Header", or "Listview" or "Toolbar". Properties of Style definitions
* are:
*
* - default column properties, internal spacing, aligning, min/max width
@@ -85,10 +85,10 @@
static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
{
uiStyle *style = MEM_callocN(sizeof(uiStyle), "new style");
BLI_addtail(styles, style);
BLI_strncpy(style->name, name, MAX_STYLE_NAME);
style->panelzoom = 1.0; /* unused */
style->paneltitle.uifont_id = uifont_id;
@@ -129,14 +129,14 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id
style->buttonspacey = 2;
style->panelspace = 8;
style->panelouter = 4;
return style;
}
static uiFont *uifont_to_blfont(int id)
{
uiFont *font = U.uifonts.first;
for (; font; font = font->next) {
if (font->uifont_id == id) {
return font;
@@ -154,7 +154,7 @@ void UI_fontstyle_draw_ex(
{
int xofs = 0, yofs;
int font_flag = BLF_CLIPPING;
UI_fontstyle_set(fs);
/* set the flag */
@@ -192,7 +192,7 @@ void UI_fontstyle_draw_ex(
else if (fs->align == UI_STYLE_TEXT_RIGHT) {
xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len) - 0.1f * U.widget_unit;
}
/* clip is very strict, so we give it some space */
BLF_clipping(fs->uifont_id, rect->xmin - 2, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
@@ -349,16 +349,16 @@ uiStyle *UI_style_get_dpi(void)
{
uiStyle *style = UI_style_get();
static uiStyle _style;
_style = *style;
_style.paneltitle.shadx = (short)(UI_DPI_FAC * _style.paneltitle.shadx);
_style.paneltitle.shady = (short)(UI_DPI_FAC * _style.paneltitle.shady);
_style.grouplabel.shadx = (short)(UI_DPI_FAC * _style.grouplabel.shadx);
_style.grouplabel.shady = (short)(UI_DPI_FAC * _style.grouplabel.shady);
_style.widgetlabel.shadx = (short)(UI_DPI_FAC * _style.widgetlabel.shadx);
_style.widgetlabel.shady = (short)(UI_DPI_FAC * _style.widgetlabel.shady);
_style.columnspace = (short)(UI_DPI_FAC * _style.columnspace);
_style.templatespace = (short)(UI_DPI_FAC * _style.templatespace);
_style.boxspace = (short)(UI_DPI_FAC * _style.boxspace);
@@ -366,23 +366,23 @@ uiStyle *UI_style_get_dpi(void)
_style.buttonspacey = (short)(UI_DPI_FAC * _style.buttonspacey);
_style.panelspace = (short)(UI_DPI_FAC * _style.panelspace);
_style.panelouter = (short)(UI_DPI_FAC * _style.panelouter);
return &_style;
}
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
{
int width;
if (fs->kerning == 1) /* for BLF_width */
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
UI_fontstyle_set(fs);
width = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
if (fs->kerning == 1)
BLF_disable(fs->uifont_id, BLF_KERNING_DEFAULT);
return width;
}
@@ -403,12 +403,12 @@ void uiStyleInit(void)
uiStyle *style = U.uistyles.first;
int monofont_size = datatoc_bmonofont_ttf_size;
unsigned char *monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf;
/* recover from uninitialized dpi */
if (U.dpi == 0)
U.dpi = 72;
CLAMP(U.dpi, 48, 144);
for (font = U.uifonts.first; font; font = font->next) {
BLF_unload_id(font->blf_id);
}
@@ -439,9 +439,9 @@ void uiStyleInit(void)
BLI_strncpy(font->filename, "default", sizeof(font->filename));
font->uifont_id = UIFONT_DEFAULT;
}
for (font = U.uifonts.first; font; font = font->next) {
if (font->uifont_id == UIFONT_DEFAULT) {
#ifdef WITH_INTERNATIONAL
int font_size = datatoc_bfont_ttf_size;
@@ -493,11 +493,11 @@ void uiStyleInit(void)
BLF_size(font->blf_id, 14 * U.pixelsize, U.dpi);
}
}
if (style == NULL) {
ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT);
}
#ifdef WITH_INTERNATIONAL
/* use unicode font for text editor and interactive console */
if (U.transopts & USER_DOTRANSLATE) {
@@ -521,7 +521,7 @@ void uiStyleInit(void)
}
BLF_size(blf_mono_font, 12 * U.pixelsize, 72);
/**
* Second for rendering else we get threading problems,
*
@@ -537,7 +537,7 @@ void uiStyleInit(void)
void UI_fontstyle_set(const uiFontStyle *fs)
{
uiFont *font = uifont_to_blfont(fs->uifont_id);
BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi);
}

View File

@@ -426,7 +426,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop);
ID *id = idptr.data;
int event = GET_INT_FROM_POINTER(arg_event);
switch (event) {
case UI_ID_BROWSE:
case UI_ID_PIN:
@@ -727,14 +727,14 @@ static void template_ID(
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
}
if (user_alert) UI_but_flag_enable(but, UI_BUT_REDALERT);
if (id->lib == NULL && !(ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
uiDefButR(block, UI_BTYPE_TOGGLE, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL);
}
}
if (flag & UI_ID_ADD_NEW) {
template_id_def_new_but(block, id, template_ui, type, newop, editable, flag & UI_ID_OPEN, false, UI_UNIT_X);
}
@@ -745,14 +745,14 @@ static void template_ID(
but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
UI_but_operator_ptr_get(but);
RNA_string_set(but->opptr, "id_name", id->name + 2);
RNA_int_set(but->opptr, "id_type", GS(id->name));
}
else if (flag & UI_ID_OPEN) {
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
0, 0, w, UI_UNIT_Y, NULL);
@@ -767,7 +767,7 @@ static void template_ID(
if ((idfrom && idfrom->lib) || !editable)
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
/* delete button */
/* don't use RNA_property_is_unlink here */
if (id && (flag & UI_ID_DELETE)) {
@@ -973,7 +973,7 @@ void uiTemplateAnyID(
{
PropertyRNA *propID, *propType;
uiLayout *split, *row, *sub;
/* get properties... */
propID = RNA_struct_find_property(ptr, propname);
propType = RNA_struct_find_property(ptr, proptypename);
@@ -986,13 +986,13 @@ void uiTemplateAnyID(
RNA_warning("pointer-type property not found: %s.%s", RNA_struct_identifier(ptr->type), proptypename);
return;
}
/* Start drawing UI Elements using standard defines */
split = uiLayoutSplit(layout, 0.33f, false); /* NOTE: split amount here needs to be synced with normal labels */
/* FIRST PART ................................................ */
row = uiLayoutRow(split, false);
/* Label - either use the provided text, or will become "ID-Block:" */
if (text) {
if (text[0])
@@ -1001,20 +1001,20 @@ void uiTemplateAnyID(
else {
uiItemL(row, IFACE_("ID-Block:"), ICON_NONE);
}
/* SECOND PART ................................................ */
row = uiLayoutRow(split, true);
/* ID-Type Selector - just have a menu of icons */
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);
/* 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);
}
@@ -1236,20 +1236,20 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna
{
PropertyRNA *propPath;
uiLayout *row;
/* check that properties are valid */
propPath = RNA_struct_find_property(ptr, propname);
if (!propPath || RNA_property_type(propPath) != PROP_STRING) {
RNA_warning("path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* Start drawing UI Elements using standard defines */
row = uiLayoutRow(layout, true);
/* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA);
/* TODO: attach something to this to make allow searching of nested properties to 'build' the path */
}
@@ -1267,7 +1267,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
nmd->mode &= ~eModifierMode_Virtual;
BLI_addhead(&ob->modifiers, nmd);
modifier_unique_name(&ob->modifiers, nmd);
ob->partype = PAROBJECT;
@@ -1327,7 +1327,7 @@ static uiLayout *draw_modifier(
/* rounded header ------------------------------------------------------------------- */
box = uiLayoutBox(column);
if (isVirtual) {
row = uiLayoutRow(box, false);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
@@ -1336,7 +1336,7 @@ static uiLayout *draw_modifier(
/* XXX this is not used now, since these cannot be accessed via RNA */
BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name"));
but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
TIP_("Convert virtual modifier to a real modifier"));
UI_but_func_set(but, modifiers_convertToReal, ob, md);
@@ -1345,15 +1345,15 @@ static uiLayout *draw_modifier(
/* REAL MODIFIER */
row = uiLayoutRow(box, false);
block = uiLayoutGetBlock(row);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
/* Open/Close ................................. */
uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
/* modifier-type icon */
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
UI_block_emboss_set(block, UI_EMBOSS);
/* modifier name */
md->scene = scene;
if (mti->isDisabled && mti->isDisabled(md, 0)) {
@@ -1361,7 +1361,7 @@ static uiLayout *draw_modifier(
}
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
uiLayoutSetRedAlert(row, false);
/* mode enabling buttons */
UI_block_align_begin(block);
/* Collision and Surface are always enabled, hide buttons! */
@@ -1370,7 +1370,7 @@ static uiLayout *draw_modifier(
{
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
if (mti->flags & eModifierTypeFlag_SupportsEditmode) {
sub = uiLayoutRow(row, true);
if (!(md->mode & eModifierMode_Realtime)) {
@@ -1406,13 +1406,13 @@ static uiLayout *draw_modifier(
}
UI_block_align_end(block);
/* Up/Down + Delete ........................... */
UI_block_align_begin(block);
uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_modifier_move_up");
uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_modifier_move_down");
UI_block_align_end(block);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
/* When Modifier is a simulation, show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) &&
@@ -1429,20 +1429,20 @@ static uiLayout *draw_modifier(
UI_block_emboss_set(block, UI_EMBOSS);
}
/* modifier settings (under the header) --------------------------------------------------- */
if (!isVirtual && (md->mode & eModifierMode_Expanded)) {
/* apply/convert/copy */
box = uiLayoutBox(column);
row = uiLayoutRow(box, false);
if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
/* only here obdata, the rest of modifiers is ob level */
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if (md->type == eModifierType_ParticleSystem) {
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
@@ -1456,17 +1456,17 @@ static uiLayout *draw_modifier(
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
0, "apply_as", MODIFIER_APPLY_DATA);
if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
uiItemEnumO(row, "OBJECT_OT_modifier_apply",
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
0, "apply_as", MODIFIER_APPLY_SHAPE);
}
}
UI_block_lock_clear(block);
UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
eModifierType_Cloth, eModifierType_Smoke))
{
@@ -1474,19 +1474,19 @@ static uiLayout *draw_modifier(
"OBJECT_OT_modifier_copy");
}
}
/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
result = uiLayoutColumn(box, false);
block = uiLayoutAbsoluteBlock(box);
}
/* error messages */
if (md->error) {
box = uiLayoutBox(column);
row = uiLayoutRow(box, false);
uiItemL(row, md->error, ICON_ERROR);
}
return result;
}
@@ -1511,9 +1511,9 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
RNA_warning("Expected modifier on object");
return NULL;
}
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
/* find modifier and draw it */
cageIndex = modifiers_getCageIndex(scene, ob, &lastCageIndex, 0);
@@ -1630,7 +1630,7 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event)
*
* object_test_constraints(ob);
* if (ob->pose) BKE_pose_update_constraint_flags(ob->pose); */
if (ob->type == OB_ARMATURE) DEG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
else DEG_id_tag_update(&ob->id, OB_RECALC_OB);
@@ -1662,7 +1662,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
}
else
BLI_strncpy(typestr, IFACE_(cti->name), sizeof(typestr));
/* determine whether constraint is proxy protected or not */
if (BKE_constraints_proxylocked_owner(ob, pchan))
proxy_protected = (con->flag & CONSTRAINT_PROXY_LOCAL) == 0;
@@ -1696,34 +1696,34 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
if (con->flag & CONSTRAINT_DISABLE)
uiLayoutSetRedAlert(row, true);
if (proxy_protected == 0) {
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
}
else
uiItemL(row, con->name, ICON_NONE);
uiLayoutSetRedAlert(row, false);
/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
if (proxy_protected) {
UI_block_emboss_set(block, UI_EMBOSS_NONE);
/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 12.2f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiDefIconBut(block, UI_BTYPE_BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 13.1f * UI_UNIT_X, yco, 0.95f * UI_UNIT_X, 0.95f * UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
UI_block_emboss_set(block, UI_EMBOSS);
}
else {
short prev_proxylock, show_upbut, show_downbut;
/* Up/Down buttons:
/* Up/Down buttons:
* Proxy-constraints are not allowed to occur after local (non-proxy) constraints
* as that poses problems when restoring them, so disable the "up" button where
* it may cause this situation.
* it may cause this situation.
*
* Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose.
*/
@@ -1736,29 +1736,29 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
}
else
prev_proxylock = 0;
show_upbut = ((prev_proxylock == 0) && (con->prev));
show_downbut = (con->next) ? 1 : 0;
/* enabled */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
uiItemR(row, &ptr, "mute", 0, "",
(con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
UI_block_emboss_set(block, UI_EMBOSS);
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
/* up/down */
if (show_upbut || show_downbut) {
UI_block_align_begin(block);
if (show_upbut)
uiItemO(row, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up");
if (show_downbut)
uiItemO(row, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down");
UI_block_align_end(block);
}
/* Close 'button' - emboss calls here disable drawing of 'button' behind X */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
uiItemO(row, "", ICON_X, "CONSTRAINT_OT_delete");
@@ -1803,7 +1803,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
RNA_warning("Expected constraint on object");
return NULL;
}
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
/* hrms, the temporal constraint should not draw! */
@@ -1922,7 +1922,7 @@ void uiTemplatePreview(
if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
if (GS(pid->name) == ID_MA) ma = (Material *)pid;
else ma = (Material *)pparent;
/* Create RNA Pointer */
RNA_pointer_create(&ma->id, &RNA_Material, ma, &material_ptr);
@@ -1934,7 +1934,7 @@ void uiTemplatePreview(
if (pr_texture) {
/* Create RNA Pointer */
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
uiLayoutRow(layout, true);
uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
@@ -1956,7 +1956,7 @@ void uiTemplatePreview(
}
uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Both"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
/* Alpha button for texture preview */
if (*pr_texture != TEX_PR_OTHER) {
row = uiLayoutRow(layout, false);
@@ -2238,7 +2238,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
if (free) {
MEM_freeN((void *)item);
}
return block;
}
@@ -2416,26 +2416,26 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
if (BLI_rctf_size_x(&cumap->curr) < 20.0f * BLI_rctf_size_x(&cumap->clipr)) {
d = d1 = 0.15f * BLI_rctf_size_x(&cumap->curr);
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.xmin - d < cumap->clipr.xmin)
d1 = cumap->curr.xmin - cumap->clipr.xmin;
cumap->curr.xmin -= d1;
d1 = d;
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.xmax + d > cumap->clipr.xmax)
d1 = -cumap->curr.xmax + cumap->clipr.xmax;
cumap->curr.xmax += d1;
d = d1 = 0.15f * BLI_rctf_size_y(&cumap->curr);
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.ymin - d < cumap->clipr.ymin)
d1 = cumap->curr.ymin - cumap->clipr.ymin;
cumap->curr.ymin -= d1;
d1 = d;
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.ymax + d > cumap->clipr.ymax)
d1 = -cumap->curr.ymax + cumap->clipr.ymax;
cumap->curr.ymax += d1;
@@ -2449,7 +2449,7 @@ static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *U
CurveMapping *cumap = cumap_v;
curvemapping_changed(cumap, false);
}
}
static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
{
@@ -2622,15 +2622,15 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
{
CurveMapping *cumap = cumap_v;
int a;
cumap->preset = CURVE_PRESET_LINE;
for (a = 0; a < CM_TOT; a++)
curvemap_reset(cumap->cm + a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
cumap->black[0] = cumap->black[1] = cumap->black[2] = 0.0f;
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
curvemapping_set_black_white(cumap, NULL, NULL);
curvemapping_changed(cumap, false);
rna_update_cb(C, cb_v, NULL);
@@ -2700,7 +2700,7 @@ static void curvemap_buttons_layout(
/* HSV */
sub = uiLayoutRow(row, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
if (cumap->cm[0].curve) {
bt = uiDefButI(block, UI_BTYPE_ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
UI_but_func_set(bt, curvemap_buttons_redraw, NULL, NULL);
@@ -2716,7 +2716,7 @@ static void curvemap_buttons_layout(
}
else
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
if (labeltype == 'h')
bg = UI_GRAD_H;
@@ -2906,7 +2906,7 @@ void uiTemplateColorPicker(
if (cubic)
but->flag |= UI_BUT_COLOR_CUBIC;
if (value_slider) {
switch (U.color_picker_type) {
case USER_CP_CIRCLE_HSL:
@@ -3005,7 +3005,7 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
if (!shift) {
tot = RNA_property_array_length(&but->rnapoin, but->rnaprop);
/* Normally clicking only selects one layer */
RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, true);
for (i = 0; i < tot; ++i) {
@@ -3037,8 +3037,8 @@ void uiTemplateLayers(
RNA_warning("layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
return;
}
/* the number of layers determines the way we group them
/* the number of layers determines the way we group them
* - we want 2 rows only (for now)
* - the number of columns (cols) is the total number of buttons per row
* the 'remainder' is added to this, as it will be ok to have first row slightly wider if need be
@@ -3058,12 +3058,12 @@ void uiTemplateLayers(
if (RNA_property_array_length(used_ptr, used_prop) < layers)
used_prop = NULL;
}
/* layers are laid out going across rows, with the columns being divided into groups */
for (group = 0; group < groups; group++) {
uCol = uiLayoutColumn(layout, true);
for (row = 0; row < 2; row++) {
uiBlock *block;
uiBut *but;
@@ -3071,7 +3071,7 @@ void uiTemplateLayers(
uRow = uiLayoutRow(uCol, true);
block = uiLayoutGetBlock(uRow);
layer = groups * cols_per_group * row + cols_per_group * group;
/* add layers as toggle buts */
for (col = 0; (col < cols_per_group) && (layer < layers); col++, layer++) {
int icon = 0;
@@ -3081,7 +3081,7 @@ void uiTemplateLayers(
icon = ICON_LAYER_ACTIVE;
else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
icon = ICON_LAYER_USED;
but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2);
UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer));
but->type = UI_BTYPE_TOGGLE;
@@ -3778,7 +3778,7 @@ void uiTemplateList(
static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
{
wmOperatorType *ot = arg2;
if (ot)
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, NULL);
}
@@ -3827,10 +3827,10 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
if (WM_operator_poll((bContext *)C, ot)) {
char name[256];
int len = strlen(ot_ui_name);
/* display name for menu, can hold hotkey */
BLI_strncpy(name, ot_ui_name, sizeof(name));
/* check for hotkey */
if (len < sizeof(name) - 6) {
if (WM_key_event_operator_string(
@@ -3840,7 +3840,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
name[len] = UI_SEP_CHAR;
}
}
if (false == UI_search_item_add(items, name, ot, 0))
break;
}
@@ -3860,7 +3860,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
uiBlock *block;
uiBut *but;
static char search[256] = "";
block = uiLayoutGetBlock(layout);
UI_block_layout_set_current(block, layout);
@@ -4073,7 +4073,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiBlock *block;
void *owner = NULL;
int handle_event, icon = 0;
block = uiLayoutGetBlock(layout);
UI_block_layout_set_current(block, layout);
@@ -4157,7 +4157,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
if (owner) {
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
bool active = !(G.is_break || WM_jobs_is_stopped(wm, owner));
uiLayout *row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
@@ -4209,29 +4209,29 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
ReportList *reports = CTX_wm_reports(C);
Report *report = BKE_reports_last_displayable(reports);
ReportTimerInfo *rti;
uiLayout *ui_abs;
uiBlock *block;
uiBut *but;
uiStyle *style = UI_style_get();
int width;
int icon;
/* if the report display has timed out, don't show */
if (!reports->reporttimer) return;
rti = (ReportTimerInfo *)reports->reporttimer->customdata;
if (!rti || rti->widthfac == 0.0f || !report) return;
ui_abs = uiLayoutAbsolute(layout, false);
block = uiLayoutGetBlock(ui_abs);
UI_fontstyle_set(&style->widgetlabel);
width = BLF_width(style->widgetlabel.uifont_id, report->message, report->len);
width = min_ii((int)(rti->widthfac * width), width);
width = max_ii(width, 10);
/* make a box around the report to make it stand out */
UI_block_align_begin(block);
but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
@@ -4245,12 +4245,12 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
but->col[3] = 255;
UI_block_align_end(block);
/* icon and report message on top */
icon = UI_icon_from_report_type(report->type);
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
* to be shown instead of icon when appropriate...
*/
UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -4262,7 +4262,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiDefIconBut(block, UI_BTYPE_LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
UI_block_emboss_set(block, UI_EMBOSS);
uiDefBut(block, UI_BTYPE_LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
NULL, 0.0f, 0.0f, 0, 0, "");
}
@@ -4283,7 +4283,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
if (title)
uiItemL(layout, title, ICON_NONE);
flow = uiLayoutColumnFlow(layout, 2, false);
RNA_STRUCT_BEGIN (ptr, prop)
@@ -4413,17 +4413,17 @@ static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v)
ComponentMenuArgs *args = (ComponentMenuArgs *)args_v;
uiBlock *block;
uiLayout *layout;
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN);
layout = uiLayoutColumn(UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, UI_style_get()), 0);
uiItemR(layout, &args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE);
UI_block_bounds_set_normal(block, 6);
UI_block_direction_set(block, UI_DIR_DOWN);
return block;
}
void uiTemplateComponentMenu(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name)
@@ -4431,10 +4431,10 @@ void uiTemplateComponentMenu(uiLayout *layout, PointerRNA *ptr, const char *prop
ComponentMenuArgs *args = MEM_callocN(sizeof(ComponentMenuArgs), "component menu template args");
uiBlock *block;
uiBut *but;
args->ptr = *ptr;
BLI_strncpy(args->propname, propname, sizeof(args->propname));
block = uiLayoutGetBlock(layout);
UI_block_align_begin(block);
@@ -4443,7 +4443,7 @@ void uiTemplateComponentMenu(uiLayout *layout, PointerRNA *ptr, const char *prop
but->rnapoin = *ptr;
but->rnaprop = RNA_struct_find_property(ptr, propname);
but->rnaindex = 0;
UI_block_align_end(block);
}
@@ -4453,17 +4453,17 @@ void uiTemplateNodeSocket(uiLayout *layout, bContext *UNUSED(C), float *color)
{
uiBlock *block;
uiBut *but;
block = uiLayoutGetBlock(layout);
UI_block_align_begin(block);
/* XXX using explicit socket colors is not quite ideal.
* Eventually it should be possible to use theme colors for this purpose,
* but this requires a better design for extendable color palettes in user prefs.
*/
but = uiDefBut(block, UI_BTYPE_NODE_SOCKET, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
rgba_float_to_uchar(but->col, color);
UI_block_align_end(block);
}

View File

@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -71,7 +71,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
if (arraylen && index == -1)
return NULL;
if (icon && name && name[0] == '\0')
but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
else if (icon)
@@ -309,7 +309,7 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char
}
/***************************** ID Utilities *******************************/
/***************************** ID Utilities *******************************/
int UI_icon_from_id(ID *id)
{
Object *ob;
@@ -318,7 +318,7 @@ int UI_icon_from_id(ID *id)
if (id == NULL)
return ICON_NONE;
idcode = GS(id->name);
/* exception for objects */

File diff suppressed because it is too large Load Diff

View File

@@ -98,16 +98,16 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
static char headerdesel[4] = {0, 0, 0, 255};
static char setting = 0;
const char *cp = error;
/* ensure we're not getting a color after running BKE_blender_userdef_free */
BLI_assert(BLI_findindex(&U.themes, theme_active) != -1);
BLI_assert(colorid != TH_UNDEFINED);
if (btheme) {
/* first check for ui buttons theme */
if (colorid < TH_THEMEUI) {
switch (colorid) {
case TH_REDALERT:
@@ -115,7 +115,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
}
}
else {
switch (spacetype) {
case SPACE_BUTS:
ts = &btheme->tbuts;
@@ -250,7 +250,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = &setting;
setting = ts->panelcolors.show_back;
break;
case TH_BUTBACK:
cp = ts->button; break;
case TH_BUTBACK_TEXT:
@@ -273,7 +273,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->shade2; break;
case TH_HILITE:
cp = ts->hilite; break;
case TH_GRID:
cp = ts->grid; break;
case TH_VIEW_OVERLAY:
@@ -524,7 +524,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_HANDLE_VERTEX_SIZE:
cp = &ts->handle_vertex_size;
break;
case TH_GP_VERTEX:
cp = ts->gp_vertex;
break;
@@ -534,7 +534,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_GP_VERTEX_SIZE:
cp = &ts->gp_vertex_size;
break;
case TH_DOPESHEET_CHANNELOB:
cp = ts->ds_channel;
break;
@@ -622,21 +622,21 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_SKIN_ROOT:
cp = ts->skin_root;
break;
case TH_ANIM_ACTIVE:
cp = ts->anim_active;
break;
case TH_ANIM_INACTIVE:
cp = ts->anim_non_active;
break;
case TH_NLA_TWEAK:
cp = ts->nla_tweaking;
break;
case TH_NLA_TWEAK_DUPLI:
cp = ts->nla_tweakdupli;
break;
case TH_NLA_TRANSITION:
cp = ts->nla_transition;
break;
@@ -655,7 +655,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_NLA_SOUND_SEL:
cp = ts->nla_sound_sel;
break;
case TH_WIDGET_EMBOSS:
cp = btheme->tui.widget_emboss; break;
@@ -716,7 +716,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
}
}
}
return (const unsigned char *)cp;
}
@@ -724,7 +724,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
static void ui_theme_init_boneColorSets(bTheme *btheme)
{
int i;
/* define default color sets - currently we only define 15 of these, though that should be ample */
/* set 1 */
rgba_char_args_set(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
@@ -786,7 +786,7 @@ static void ui_theme_init_boneColorSets(bTheme *btheme)
rgba_char_args_set(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
rgba_char_args_set(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
rgba_char_args_set(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
/* reset flags too */
for (i = 0; i < 20; i++)
btheme->tarm[i].flag = 0;
@@ -867,16 +867,16 @@ static void ui_theme_space_init_manipulator_colors(bTheme *btheme)
void ui_theme_init_default(void)
{
bTheme *btheme;
/* we search for the theme with name Default */
btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
if (btheme == NULL) {
btheme = MEM_callocN(sizeof(bTheme), "theme");
BLI_addtail(&U.themes, btheme);
strcpy(btheme->name, "Default");
}
UI_SetTheme(0, 0); /* make sure the global used in this file is set */
/* UI buttons */
@@ -893,13 +893,13 @@ void ui_theme_init_default(void)
btheme->tui.menu_shadow_fac = 0.5f;
btheme->tui.menu_shadow_width = 12;
/* Bone Color Sets */
ui_theme_init_boneColorSets(btheme);
/* common (new) variables */
ui_theme_init_new(btheme);
/* Manipulator. */
ui_theme_space_init_manipulator_colors(btheme);
@@ -907,11 +907,11 @@ void ui_theme_init_default(void)
rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
rgba_char_args_set_fl(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
rgba_char_args_set_fl(btheme->tv3d.button, 0.45, 0.45, 0.45, 0.5);
// rgba_char_args_set(btheme->tv3d.panel, 165, 165, 165, 127);
rgba_char_args_set(btheme->tv3d.shade1, 160, 160, 160, 100);
rgba_char_args_set(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
@@ -1024,7 +1024,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
btheme->tipo.handle_vertex_size = 5;
rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
@@ -1034,9 +1034,9 @@ void ui_theme_init_default(void)
btheme->tact = btheme->tipo;
rgba_char_args_set(btheme->tact.strip, 12, 10, 10, 128);
rgba_char_args_set(btheme->tact.strip_select, 255, 140, 0, 255);
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
rgba_char_args_set(btheme->tact.keytype_keyframe, 232, 232, 232, 255);
rgba_char_args_set(btheme->tact.keytype_keyframe_select, 255, 190, 50, 255);
rgba_char_args_set(btheme->tact.keytype_extreme, 232, 179, 204, 255);
@@ -1045,31 +1045,31 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tact.keytype_breakdown_select, 84, 191, 237, 255);
rgba_char_args_set(btheme->tact.keytype_jitter, 148, 229, 117, 255);
rgba_char_args_set(btheme->tact.keytype_jitter_select, 97, 192, 66, 255);
rgba_char_args_set(btheme->tact.keyborder, 0, 0, 0, 255);
rgba_char_args_set(btheme->tact.keyborder_select, 0, 0, 0, 255);
btheme->tact.keyframe_scale_fac = 1.0f;
/* space nla */
btheme->tnla = btheme->tact;
rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as for dopesheet; duplicate here for easier reference */
rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
rgba_char_args_set(btheme->tnla.nla_meta_sel, 105, 33, 150, 255);
rgba_char_args_set(btheme->tnla.nla_sound, 43, 61, 61, 255);
rgba_char_args_set(btheme->tnla.nla_sound_sel, 31, 122, 122, 255);
rgba_char_args_set(btheme->tnla.keyborder, 0, 0, 0, 255);
rgba_char_args_set(btheme->tnla.keyborder_select, 0, 0, 0, 255);
/* space file */
/* to have something initialized */
btheme->tfile = btheme->tv3d;
@@ -1085,7 +1085,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tfile.movie, 250, 250, 250, 255);
rgba_char_args_set(btheme->tfile.scene, 250, 250, 250, 255);
/* space seq */
btheme->tseq = btheme->tv3d;
rgba_char_args_set(btheme->tseq.back, 116, 116, 116, 255);
@@ -1134,7 +1134,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->text.shade1, 143, 143, 143, 255);
rgba_char_args_set(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
rgba_char_args_set(btheme->text.hilite, 255, 0, 0, 255);
/* syntax highlighting */
rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings Red */
@@ -1144,11 +1144,11 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->text.syntaxr, 140, 60, 0, 255); /* Reserved Orange*/
rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin Red-purple */
rgba_char_args_set(btheme->text.syntaxs, 76, 76, 76, 255); /* Gray (mix between fg/bg) */
/* space oops */
btheme->toops = btheme->tv3d;
rgba_char_args_set_fl(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3); /* highlighting search match - soft green*/
rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
@@ -1169,7 +1169,7 @@ void ui_theme_init_default(void)
/* space user preferences */
btheme->tuserpref = btheme->tv3d;
rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
/* space console */
btheme->tconsole = btheme->tv3d;
rgba_char_args_set(btheme->tconsole.back, 0, 0, 0, 255);
@@ -1179,16 +1179,16 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255);
rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255);
rgba_char_args_set(btheme->tconsole.console_select, 255, 255, 255, 48);
/* space time */
btheme->ttime = btheme->tv3d;
rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */
rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
/* space node, re-uses syntax and console color storage */
btheme->tnode = btheme->tv3d;
rgba_char_args_set(btheme->tnode.syntaxr, 115, 115, 115, 255); /* wire inner color */
@@ -1291,7 +1291,7 @@ void UI_Theme_Restore(struct bThemeState *theme_state)
void UI_ThemeColor(int colorid)
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
glColor3ubv(cp);
@@ -1301,7 +1301,7 @@ void UI_ThemeColor(int colorid)
void UI_ThemeColor4(int colorid)
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
glColor4ubv(cp);
}
@@ -1318,7 +1318,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
{
int r, g, b, a;
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = coloffset + (int) cp[0];
CLAMP(r, 0, 255);
@@ -1336,7 +1336,7 @@ void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset,
{
int r, g, b, a;
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = coloffset + (int) cp[0];
CLAMP(r, 0, 255);
@@ -1392,7 +1392,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
{
int r, g, b;
const unsigned char *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -1400,11 +1400,11 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
CLAMP(r, 0, 255);
CLAMP(g, 0, 255);
CLAMP(b, 0, 255);
glColor3ub(r, g, b);
}
@@ -1413,7 +1413,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
{
int r, g, b, a;
const unsigned char *cp1, *cp2;
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
@@ -1422,7 +1422,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
a = alphaoffset + floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
CLAMP(r, 0, 255);
CLAMP(g, 0, 255);
CLAMP(b, 0, 255);
@@ -1442,7 +1442,7 @@ void UI_FontThemeColor(int fontid, int colorid)
float UI_GetThemeValuef(int colorid)
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((float)cp[0]);
}
@@ -1451,7 +1451,7 @@ float UI_GetThemeValuef(int colorid)
int UI_GetThemeValue(int colorid)
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((int) cp[0]);
}
@@ -1478,7 +1478,7 @@ int UI_GetThemeValueType(int colorid, int spacetype)
void UI_GetThemeColor3fv(int colorid, float col[3])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
col[1] = ((float)cp[1]) / 255.0f;
@@ -1488,7 +1488,7 @@ void UI_GetThemeColor3fv(int colorid, float col[3])
void UI_GetThemeColor4fv(int colorid, float col[4])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
col[1] = ((float)cp[1]) / 255.0f;
@@ -1501,16 +1501,16 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
{
int r, g, b;
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = offset + (int) cp[0];
CLAMP(r, 0, 255);
g = offset + (int) cp[1];
CLAMP(g, 0, 255);
b = offset + (int) cp[2];
CLAMP(b, 0, 255);
col[0] = ((float)r) / 255.0f;
col[1] = ((float)g) / 255.0f;
col[2] = ((float)b) / 255.0f;
@@ -1644,7 +1644,7 @@ void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int of
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = cp[0];
col[1] = cp[1];
@@ -1656,19 +1656,19 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
{
int r, g, b, a;
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r = offset + (int) cp[0];
CLAMP(r, 0, 255);
g = offset + (int) cp[1];
CLAMP(g, 0, 255);
b = offset + (int) cp[2];
CLAMP(b, 0, 255);
a = (int) cp[3]; /* no shading offset... */
CLAMP(a, 0, 255);
col[0] = ((float)r) / 255.0f;
col[1] = ((float)g) / 255.0f;
col[2] = ((float)b) / 255.0f;
@@ -1679,7 +1679,7 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = cp[0];
col[1] = cp[1];
@@ -1690,7 +1690,7 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
col[0] = cp[0];
col[1] = cp[1];
@@ -1710,7 +1710,7 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c
r = r < 0 ? 0 : (r > 255 ? 255 : r);
g = g < 0 ? 0 : (g > 255 ? 255 : g);
b = b < 0 ? 0 : (b > 255 ? 255 : b);
glColor3ub(r, g, b);
}
@@ -1755,7 +1755,7 @@ void UI_GetColorPtrBlendShade3ubv(
void UI_ThemeClearColor(int colorid)
{
float col[3];
UI_GetThemeColor3fv(colorid, col);
glClearColor(col[0], col[1], col[2], 0.0f);
}
@@ -1777,7 +1777,7 @@ int UI_ThemeMenuShadowWidth(void)
void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
{
unsigned char col[3];
switch (axis) {
case 'X':
UI_GetThemeColor3ubv(TH_AXIS_X, col);
@@ -1803,7 +1803,7 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
void init_userdef_do_versions(void)
{
Main *bmain = G.main;
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver)
/* the UserDef struct is not corrected with do_versions() .... ugh! */
@@ -1834,12 +1834,12 @@ void init_userdef_do_versions(void)
}
if (U.pad_rot_angle == 0.0f)
U.pad_rot_angle = 15.0f;
/* graph editor - unselected F-Curve visibility */
if (U.fcu_inactive_alpha == 0) {
U.fcu_inactive_alpha = 0.25f;
}
/* signal for derivedmesh to use colorband */
/* run in case this was on and is now off in the user prefs [#28096] */
vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, UI_GetTheme()->tv3d.vertex_unreferenced);
@@ -1847,19 +1847,19 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(192, 0)) {
strcpy(U.sounddir, "/");
}
/* patch to set Dupli Armature */
if (!USER_VERSION_ATLEAST(220, 0)) {
U.dupflag |= USER_DUP_ARM;
}
/* added seam, normal color, undo */
if (!USER_VERSION_ATLEAST(235, 0)) {
bTheme *btheme;
U.uiflag |= USER_GLOBALUNDO;
if (U.undosteps == 0) U.undosteps = 32;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* check for (alpha == 0) is safe, then color was never set */
if (btheme->tv3d.edge_seam[3] == 0) {
@@ -1879,7 +1879,7 @@ void init_userdef_do_versions(void)
}
if (!USER_VERSION_ATLEAST(236, 0)) {
/* illegal combo... */
if (U.flag & USER_LMOUSESELECT)
if (U.flag & USER_LMOUSESELECT)
U.flag &= ~USER_TWOBUTTONMOUSE;
}
if (!USER_VERSION_ATLEAST(237, 0)) {
@@ -1927,15 +1927,15 @@ void init_userdef_do_versions(void)
}
if (!USER_VERSION_ATLEAST(240, 0)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* Lamp theme, check for alpha==0 is safe, then color was never set */
if (btheme->tv3d.lamp[3] == 0) {
rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
/* TEMPORAL, remove me! (ton) */
/* TEMPORAL, remove me! (ton) */
U.uiflag |= USER_PLAINMENUS;
}
}
if (U.obcenter_dia == 0) U.obcenter_dia = 6;
}
@@ -1969,19 +1969,19 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
}
}
/* set defaults for 3D View rotating axis indicator */
/* set defaults for 3D View rotating axis indicator */
/* since size can't be set to 0, this indicates it's not saved in startup.blend */
if (U.rvisize == 0) {
U.rvisize = 15;
U.rvibright = 8;
U.uiflag |= USER_SHOW_ROTVIEWICON;
}
}
if (!USER_VERSION_ATLEAST(243, 0)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* long keyframe color */
/* check for alpha==0 is safe, then color was never set */
@@ -1990,7 +1990,7 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
rgba_char_args_set(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
}
/* IPO-Editor - Vertex Size*/
if (btheme->tipo.vertex_size == 0) {
btheme->tipo.vertex_size = 3;
@@ -2028,7 +2028,7 @@ void init_userdef_do_versions(void)
/* action channel groups (recolor anyway) */
rgba_char_args_set(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
rgba_char_args_set(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
/* bone custom-color sets */
if (btheme->tarm[0].solid[3] == 0)
ui_theme_init_boneColorSets(btheme);
@@ -2039,18 +2039,18 @@ void init_userdef_do_versions(void)
}
if (!USER_VERSION_ATLEAST(245, 3)) {
bTheme *btheme;
/* adjust themes */
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
const char *col;
/* IPO Editor: Handles/Vertices */
col = btheme->tipo.vertex;
rgba_char_args_set(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
col = btheme->tipo.vertex_select;
rgba_char_args_set(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
btheme->tipo.handle_vertex_size = btheme->tipo.vertex_size;
/* Sequence/Image Editor: colors for GPencil text */
col = btheme->tv3d.bone_pose;
rgba_char_args_set(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
@@ -2061,7 +2061,7 @@ void init_userdef_do_versions(void)
}
if (!USER_VERSION_ATLEAST(250, 0)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* this was not properly initialized in 2.45 */
if (btheme->tima.face_dot[3] == 0) {
@@ -2069,21 +2069,21 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tima.face_dot, 255, 133, 0, 255);
btheme->tima.facedot_size = 2;
}
/* DopeSheet - (Object) Channel color */
rgba_char_args_set(btheme->tact.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tact.ds_subchannel, 124, 137, 150, 255);
/* DopeSheet - Group Channel color (saner version) */
rgba_char_args_set(btheme->tact.group, 79, 101, 73, 255);
rgba_char_args_set(btheme->tact.group_active, 135, 177, 125, 255);
/* Graph Editor - (Object) Channel color */
rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
/* Graph Editor - Group Channel color */
rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
/* Nla Editor - (Object) Channel color */
rgba_char_args_set(btheme->tnla.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
@@ -2091,20 +2091,20 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tnla.strip, 12, 10, 10, 128);
rgba_char_args_set(btheme->tnla.strip_select, 255, 140, 0, 255);
}
/* adjust grease-pencil distances */
U.gp_manhattendist = 1;
U.gp_euclideandist = 2;
/* adjust default interpolation for new IPO-curves */
U.ipo_new = BEZT_IPO_BEZ;
}
if (!USER_VERSION_ATLEAST(250, 1)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* common (new) variables, it checks for alpha==0 */
ui_theme_init_new(btheme);
@@ -2133,10 +2133,10 @@ void init_userdef_do_versions(void)
if (U.audiorate == 0)
U.audiorate = 48000;
}
if (!USER_VERSION_ATLEAST(250, 8)) {
wmKeyMap *km;
for (km = U.user_keymaps.first; km; km = km->next) {
if (STREQ(km->idname, "Armature_Sketch"))
strcpy(km->idname, "Armature Sketch");
@@ -2172,17 +2172,17 @@ void init_userdef_do_versions(void)
strcpy(km->idname, "Property Editor");
}
}
if (!USER_VERSION_ATLEAST(252, 3)) {
if (U.flag & USER_LMOUSESELECT)
if (U.flag & USER_LMOUSESELECT)
U.flag &= ~USER_TWOBUTTONMOUSE;
}
if (!USER_VERSION_ATLEAST(252, 4)) {
bTheme *btheme;
/* default new handle type is auto handles */
U.keyhandles_new = HD_AUTO;
/* init new curve colors */
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
ui_theme_space_init_handles_color(&btheme->tv3d);
@@ -2203,21 +2203,21 @@ void init_userdef_do_versions(void)
}
if (!USER_VERSION_ATLEAST(252, 5)) {
bTheme *btheme;
/* interface_widgets.c */
struct uiWidgetColors wcol_progress = {
{0, 0, 0, 255},
{190, 190, 190, 255},
{100, 100, 100, 180},
{128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
5, -5
};
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* init progress bar theme */
btheme->tui.wcol_progress = wcol_progress;
@@ -2232,7 +2232,7 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
}
}
if (!USER_VERSION_ATLEAST(256, 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2255,7 +2255,7 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(259, 1)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
btheme->tv3d.speaker[3] = 255;
}
@@ -2263,23 +2263,23 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(260, 3)) {
bTheme *btheme;
/* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead
/* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead
* was changed in 260 as part of GSoC11, but version patch was wrong
*/
if (U.keyhandles_new == HD_AUTO)
if (U.keyhandles_new == HD_AUTO)
U.keyhandles_new = HD_AUTO_ANIM;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
if (btheme->tv3d.bundle_solid[3] == 0)
rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
if (btheme->tv3d.camera_path[3] == 0)
rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
if ((btheme->tclip.back[3]) == 0) {
btheme->tclip = btheme->tv3d;
rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
@@ -2294,7 +2294,7 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
btheme->tclip.handle_vertex_size = 5;
}
/* auto-clamped handles -> based on auto */
if (btheme->tipo.handle_auto_clamped[3] == 0)
rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
@@ -2305,16 +2305,16 @@ void init_userdef_do_versions(void)
/* enable (Cycles) addon by default */
BKE_addon_ensure(&U.addons, "cycles");
}
if (!USER_VERSION_ATLEAST(260, 5)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
btheme->tui.icon_alpha = 1.0;
}
}
if (!USER_VERSION_ATLEAST(261, 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2324,11 +2324,11 @@ void init_userdef_do_versions(void)
rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
rgba_char_args_set_fl(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
}
U.use_16bit_textures = true;
}
@@ -2377,21 +2377,21 @@ void init_userdef_do_versions(void)
for (btheme = U.themes.first; btheme; btheme = btheme->next)
rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
}
if (!USER_VERSION_ATLEAST(263, 7)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* DopeSheet Summary */
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
/* NLA Colors */
rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
@@ -2440,10 +2440,10 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
}
}
if (!USER_VERSION_ATLEAST(264, 9)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->tui.xaxis, 220, 0, 0, 255);
rgba_char_args_set(btheme->tui.yaxis, 0, 220, 0, 255);
@@ -2496,7 +2496,7 @@ void init_userdef_do_versions(void)
U.ndof_sensitivity = 1.0f;
U.ndof_flag = (NDOF_LOCK_HORIZON | NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE);
}
if (U.ndof_orbit_sensitivity == 0.0f) {
U.ndof_orbit_sensitivity = U.ndof_sensitivity;
@@ -2509,7 +2509,7 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(265, 1)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* note: the toggle operator for transparent backdrops limits to these spacetypes */
if (btheme->tnode.button[3] == 255) {
@@ -2521,18 +2521,18 @@ void init_userdef_do_versions(void)
}
}
}
/* panel header/backdrop supported locally per editor now */
if (!USER_VERSION_ATLEAST(265, 2)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
ThemeSpace *ts;
/* new color, panel backdrop. Not used anywhere yet, until you enable it */
copy_v3_v3_char(btheme->tui.panel.back, btheme->tbuts.button);
btheme->tui.panel.back[3] = 128;
for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
ts->panelcolors = btheme->tui.panel;
}
@@ -2545,7 +2545,7 @@ void init_userdef_do_versions(void)
if (!USER_VERSION_ATLEAST(266, 0)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* rna definition limits fac to 0.01 */
if (btheme->tui.menu_shadow_fac == 0.0f) {
@@ -2645,7 +2645,7 @@ void init_userdef_do_versions(void)
rgba_char_args_test_set(btheme->tinfo.info_debug_text, 0, 0, 0, 255);
}
}
if (!USER_VERSION_ATLEAST(269, 9)) {
bTheme *btheme;
/* Action Editor (and NLA Editor) - Keyframe Colors */
@@ -2661,21 +2661,21 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tact.keytype_breakdown_select, 84, 191, 237, 255);
rgba_char_args_set(btheme->tact.keytype_jitter, 148, 229, 117, 255);
rgba_char_args_set(btheme->tact.keytype_jitter_select, 97, 192, 66, 255);
/* key border */
rgba_char_args_set(btheme->tact.keyborder, 0, 0, 0, 255);
rgba_char_args_set(btheme->tact.keyborder_select, 0, 0, 0, 255);
/* NLA ............................ */
/* key border */
rgba_char_args_set(btheme->tnla.keyborder, 0, 0, 0, 255);
rgba_char_args_set(btheme->tnla.keyborder_select, 0, 0, 0, 255);
/* Graph Editor ................... */
btheme->tipo.vertex_size = 6;
btheme->tipo.handle_vertex_size = 5;
}
/* grease pencil - new layer color */
if (U.gpencil_new_layer_col[3] < 0.1f) {
/* defaults to black, but must at least be visible! */
@@ -2761,7 +2761,7 @@ void init_userdef_do_versions(void)
rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 1.0f, 1.0f, 0.02f);
}
}
if (!USER_VERSION_ATLEAST(273, 1)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2769,15 +2769,15 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tv3d.gp_vertex, 0, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.gp_vertex_select, 255, 133, 0, 255);
btheme->tv3d.gp_vertex_size = 3;
rgba_char_args_set(btheme->tseq.gp_vertex, 0, 0, 0, 255);
rgba_char_args_set(btheme->tseq.gp_vertex_select, 255, 133, 0, 255);
btheme->tseq.gp_vertex_size = 3;
rgba_char_args_set(btheme->tima.gp_vertex, 0, 0, 0, 255);
rgba_char_args_set(btheme->tima.gp_vertex_select, 255, 133, 0, 255);
btheme->tima.gp_vertex_size = 3;
rgba_char_args_set(btheme->tnode.gp_vertex, 0, 0, 0, 255);
rgba_char_args_set(btheme->tnode.gp_vertex_select, 255, 133, 0, 255);
btheme->tnode.gp_vertex_size = 3;
@@ -2874,7 +2874,7 @@ void init_userdef_do_versions(void)
}
}
}
if (!USER_VERSION_ATLEAST(277, 2)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2940,7 +2940,7 @@ void init_userdef_do_versions(void)
copy_v4_v4_char(btheme->ttopbar.back, tmp);
}
}
if (!USER_VERSION_ATLEAST(280, 9)) {
/* Timeline removal */
for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2948,7 +2948,7 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tipo.anim_active, 204, 112, 26, 102);
}
if (btheme->tseq.anim_active[3] == 0) {
rgba_char_args_set(btheme->tseq.anim_active, 204, 112, 26, 102);
rgba_char_args_set(btheme->tseq.anim_active, 204, 112, 26, 102);
}
}
}
@@ -3016,10 +3016,10 @@ void init_userdef_do_versions(void)
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
if (U.image_draw_method == 0)
U.image_draw_method = IMAGE_DRAW_METHOD_2DTEXTURE;
// we default to the first audio device
U.audiodevice = 0;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff