Fix for [#20008] In the Graph Editor, clicking on the eye doesn't update the GUI
As part of this, fixed a typo in rna flags which was causing some strange behaviour with icons earlier. Reverted the workaround for this, too.
This commit is contained in:
@@ -111,16 +111,6 @@ static void validate_fmodifier_cb (bContext *C, void *fcm_v, void *dummy)
|
||||
fmi->verify_data(fcm);
|
||||
}
|
||||
|
||||
/* callback to set the active modifier */
|
||||
static void activate_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
|
||||
{
|
||||
ListBase *modifiers = (ListBase *)fmods_v;
|
||||
FModifier *fcm= (FModifier *)fcm_v;
|
||||
|
||||
/* call API function to set the active modifier for active modifier-stack */
|
||||
set_active_fmodifier(modifiers, fcm);
|
||||
}
|
||||
|
||||
/* callback to remove the given modifier */
|
||||
static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
|
||||
{
|
||||
@@ -636,6 +626,10 @@ void ANIM_uiTemplate_fmodifier_draw (const bContext *C, uiLayout *layout, ID *id
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
short width= 314;
|
||||
PointerRNA ptr;
|
||||
|
||||
/* init the RNA-pointer */
|
||||
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
|
||||
|
||||
/* draw header */
|
||||
{
|
||||
@@ -645,31 +639,33 @@ void ANIM_uiTemplate_fmodifier_draw (const bContext *C, uiLayout *layout, ID *id
|
||||
row= uiLayoutRow(box, 0);
|
||||
block= uiLayoutGetBlock(row); // err...
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* left-align -------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* expand */
|
||||
uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_EXPANDED, B_REDR, ICON_TRIA_RIGHT, 0, -1, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is expanded.");
|
||||
uiItemR(subrow, "", 0, &ptr, "expanded", UI_ITEM_R_ICON_ONLY);
|
||||
|
||||
/* checkbox for 'active' status (for now) */
|
||||
but= uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_ACTIVE, B_REDR, ICON_RADIOBUT_OFF, 0, -1, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is active one.");
|
||||
uiButSetFunc(but, activate_fmodifier_cb, modifiers, fcm);
|
||||
uiItemR(subrow, "", 0, &ptr, "active", UI_ITEM_R_ICON_ONLY);
|
||||
|
||||
/* name */
|
||||
if (fmi)
|
||||
uiDefBut(block, LABEL, 1, fmi->name, 0, 0, 150, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
|
||||
uiItemL(subrow, fmi->name, 0);
|
||||
else
|
||||
uiDefBut(block, LABEL, 1, "<Unknown Modifier>", 0, 0, 150, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
|
||||
uiItemL(subrow, "<Unknown Modifier>", 0);
|
||||
|
||||
/* right-align ------------------------------------------- */
|
||||
subrow= uiLayoutRow(row, 0);
|
||||
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
|
||||
|
||||
|
||||
/* 'mute' button */
|
||||
uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_MUTED, B_REDR, ICON_MUTE_IPO_OFF, 0, 0, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is temporarily muted (not evaluated).");
|
||||
uiItemR(subrow, "", 0, &ptr, "muted", UI_ITEM_R_ICON_ONLY);
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
/* delete button */
|
||||
but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete F-Curve Modifier.");
|
||||
|
@@ -2235,6 +2235,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
|
||||
but->bit= type & BIT;
|
||||
but->bitnr= type & 31;
|
||||
but->icon = 0;
|
||||
but->iconadd=0;
|
||||
|
||||
but->retval= retval;
|
||||
if( strlen(str)>=UI_MAX_NAME_STR-1 ) {
|
||||
|
@@ -69,11 +69,10 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
||||
else
|
||||
value= RNA_property_boolean_get(ptr, prop);
|
||||
|
||||
// XXX: when to do TOG, and when to do ICONTOG? for now, let's just do TOG, since ICONTOG causes too much trouble everywhere else
|
||||
if(icon && name && strcmp(name, "") == 0)
|
||||
but= uiDefIconButR(block, TOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
but= uiDefIconButR(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
else if(icon)
|
||||
but= uiDefIconTextButR(block, TOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
but= uiDefIconTextButR(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
else
|
||||
but= uiDefButR(block, OPTION, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
break;
|
||||
|
@@ -140,7 +140,7 @@ typedef enum PropertyFlag {
|
||||
PROP_ANIMATEABLE = 1<<1,
|
||||
|
||||
/* icon */
|
||||
PROP_ICONS_CONSECUTIVE = 1<12,
|
||||
PROP_ICONS_CONSECUTIVE = 1<<12,
|
||||
|
||||
/* hidden in the user interface */
|
||||
PROP_HIDDEN = 1<<19,
|
||||
|
@@ -252,6 +252,30 @@ static int rna_FCurve_modifiers_remove(FCurve *fcu, bContext *C, int index)
|
||||
return remove_fmodifier_index(&fcu->modifiers, index);
|
||||
}
|
||||
|
||||
static void rna_Fmodifier_active_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
FModifier *fm= (FModifier*)ptr->data;
|
||||
|
||||
/* don't toggle, always switch on */
|
||||
fm->flag |= FMODIFIER_FLAG_ACTIVE;
|
||||
}
|
||||
|
||||
static void rna_Fmodifier_active_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
FModifier *fm, *fmo= (FModifier*)ptr->data;
|
||||
|
||||
/* clear active state of other FModifiers in this list */
|
||||
for (fm=fmo->prev; fm; fm=fm->prev)
|
||||
{
|
||||
fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
|
||||
}
|
||||
for (fm=fmo->next; fm; fm=fm->next)
|
||||
{
|
||||
fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_fmodifier_generator(BlenderRNA *brna)
|
||||
@@ -629,12 +653,13 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
|
||||
RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI.");
|
||||
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
|
||||
|
||||
prop= RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
|
||||
RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be evaluated.");
|
||||
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
|
||||
RNA_def_property_ui_icon(prop, ICON_MUTE_IPO_OFF, 1);
|
||||
|
||||
// XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
|
||||
prop= RNA_def_property(srna, "disabled", PROP_BOOLEAN, PROP_NONE);
|
||||
@@ -647,7 +672,9 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE);
|
||||
RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited ");
|
||||
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Fmodifier_active_set");
|
||||
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, "rna_Fmodifier_active_update");
|
||||
RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
|
||||
}
|
||||
|
||||
/* *********************** */
|
||||
@@ -809,7 +836,6 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active fcurve modifier", "Active fcurve modifier.");
|
||||
|
||||
|
||||
/* Constraint collection */
|
||||
func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
|
Reference in New Issue
Block a user