ID Static Override: add basic UI feedback.
For now, using a new color for overridden properties (similar to animated/driven status), UI team will need to work on a better solution maybe...
This commit is contained in:
parent
638afb9bd4
commit
e36b5f004d
|
@ -860,6 +860,7 @@ class USERPREF_PT_theme(Panel):
|
|||
colsub.row().prop(ui_state, "inner_anim_sel")
|
||||
colsub.row().prop(ui_state, "inner_driven")
|
||||
colsub.row().prop(ui_state, "inner_driven_sel")
|
||||
colsub.row().prop(ui_state, "blend")
|
||||
|
||||
subsplit = row.split(percentage=0.85)
|
||||
|
||||
|
@ -868,7 +869,8 @@ class USERPREF_PT_theme(Panel):
|
|||
colsub = padding.column()
|
||||
colsub.row().prop(ui_state, "inner_key")
|
||||
colsub.row().prop(ui_state, "inner_key_sel")
|
||||
colsub.row().prop(ui_state, "blend")
|
||||
colsub.row().prop(ui_state, "inner_overridden")
|
||||
colsub.row().prop(ui_state, "inner_overridden_sel")
|
||||
|
||||
col.separator()
|
||||
col.separator()
|
||||
|
|
|
@ -183,6 +183,8 @@ enum {
|
|||
UI_BUT_UPDATE_DELAY = (1 << 28), /* don't run updates while dragging (needed in rare cases). */
|
||||
UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
|
||||
UI_BUT_VALUE_CLEAR = (1 << 30), /* show 'x' icon to clear/unlink value of text or search button */
|
||||
|
||||
UI_BUT_OVERRIDEN = (1 << 31), /* RNA property of the button is overriden from linked reference data. */
|
||||
};
|
||||
|
||||
#define UI_PANEL_WIDTH 340
|
||||
|
|
|
@ -1216,6 +1216,20 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||
}
|
||||
}
|
||||
|
||||
void ui_but_override_flag(uiBut *but)
|
||||
{
|
||||
bool is_overridden;
|
||||
|
||||
RNA_property_override_status(&but->rnapoin, but->rnaprop, but->rnaindex, NULL, &is_overridden, NULL, NULL);
|
||||
|
||||
if (is_overridden) {
|
||||
but->flag |= UI_BUT_OVERRIDEN;
|
||||
}
|
||||
else {
|
||||
but->flag &= ~UI_BUT_OVERRIDEN;
|
||||
}
|
||||
}
|
||||
|
||||
void UI_block_update_from_old(const bContext *C, uiBlock *block)
|
||||
{
|
||||
uiBut *but_old;
|
||||
|
@ -1280,6 +1294,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
|
|||
}
|
||||
|
||||
ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
|
||||
ui_but_override_flag(but);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8201,6 +8201,7 @@ void UI_context_update_anim_flag(const bContext *C)
|
|||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
|
||||
ui_but_override_flag(but);
|
||||
ED_region_tag_redraw(ar);
|
||||
|
||||
if (but->active) {
|
||||
|
|
|
@ -509,6 +509,7 @@ extern bool ui_but_supports_cycling(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
|
|||
extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT;
|
||||
extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
void ui_but_override_flag(uiBut *but);
|
||||
|
||||
extern void ui_block_bounds_calc(uiBlock *block);
|
||||
extern void ui_block_translate(uiBlock *block, int x, int y);
|
||||
|
|
|
@ -1710,6 +1710,8 @@ static struct uiWidgetStateColors wcol_state_colors = {
|
|||
{215, 211, 75, 255},
|
||||
{180, 0, 255, 255},
|
||||
{153, 0, 230, 255},
|
||||
{74, 137, 137, 255},
|
||||
{49, 112, 112, 255},
|
||||
0.5f, 0.0f
|
||||
};
|
||||
|
||||
|
@ -2062,6 +2064,8 @@ static void widget_state(uiWidgetType *wt, int state)
|
|||
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend);
|
||||
else if (state & UI_BUT_DRIVEN)
|
||||
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
|
||||
else if (state & UI_BUT_OVERRIDEN)
|
||||
widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden_sel, wcol_state->blend);
|
||||
|
||||
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
|
||||
|
||||
|
@ -2075,6 +2079,8 @@ static void widget_state(uiWidgetType *wt, int state)
|
|||
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend);
|
||||
else if (state & UI_BUT_DRIVEN)
|
||||
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend);
|
||||
else if (state & UI_BUT_OVERRIDEN)
|
||||
widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden, wcol_state->blend);
|
||||
|
||||
if (state & UI_ACTIVE) { /* mouse over? */
|
||||
wt->wcol.inner[0] = wt->wcol.inner[0] >= 240 ? 255 : wt->wcol.inner[0] + 15;
|
||||
|
@ -2120,7 +2126,9 @@ static void widget_state_numslider(uiWidgetType *wt, int state)
|
|||
widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend);
|
||||
else if (state & UI_BUT_DRIVEN)
|
||||
widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend);
|
||||
|
||||
else if (state & UI_BUT_OVERRIDEN)
|
||||
widget_state_blend(wt->wcol.item, wcol_state->inner_overridden_sel, blend);
|
||||
|
||||
if (state & UI_SELECT)
|
||||
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
|
||||
}
|
||||
|
@ -2131,6 +2139,8 @@ static void widget_state_numslider(uiWidgetType *wt, int state)
|
|||
widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend);
|
||||
else if (state & UI_BUT_DRIVEN)
|
||||
widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend);
|
||||
else if (state & UI_BUT_OVERRIDEN)
|
||||
widget_state_blend(wt->wcol.item, wcol_state->inner_overridden, blend);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3157,7 +3167,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
|
|||
|
||||
ui_but_v3_get(but, col);
|
||||
|
||||
if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
|
||||
if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_OVERRIDEN | UI_BUT_REDALERT)) {
|
||||
/* draw based on state - color for keyed etc */
|
||||
widgetbase_draw(&wtb, wcol);
|
||||
|
||||
|
|
|
@ -140,6 +140,8 @@ typedef struct uiWidgetStateColors {
|
|||
char inner_key_sel[4];
|
||||
char inner_driven[4];
|
||||
char inner_driven_sel[4];
|
||||
char inner_overridden[4];
|
||||
char inner_overridden_sel[4];
|
||||
float blend, pad;
|
||||
} uiWidgetStateColors;
|
||||
|
||||
|
|
|
@ -827,6 +827,16 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Driven Selected", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "inner_overridden", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Overridden", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "inner_overridden_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Overridden Selected", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(prop, "Blend", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
|
Loading…
Reference in New Issue