diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-19 04:44:49 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-19 04:44:49 +0300 |
commit | dd9e2cd6fa58d92e2cdc5d988b581063cd226717 (patch) | |
tree | 44e82b1ed81776431d0057105854341e60f59b8b /source | |
parent | a5ad2d7f75d1a59abe6a002860f4103252f64525 (diff) |
Review feedback from Julian
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 83 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 38 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 17 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_buttons.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 4 |
6 files changed, 74 insertions, 84 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 0d8b097b32a..8f188d56bb2 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -880,7 +880,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (bAction *, act, &bmain->actions) { LISTBASE_FOREACH (FCurve *, fcu, &act->curves) { LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) { - if (fcm->flag & FMODIFIER_FLAG_EXPANDED_DEPRECATED) { + if (fcm->flag & FMODIFIER_FLAG_EXPANDED) { fcm->ui_expand_flag = 1; } else { diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index cae249ea925..4e635caa7b5 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -63,16 +63,12 @@ static void fmodifier_panel_header(const bContext *C, Panel *panel); static PointerRNA *fmodifier_get_pointers(const Panel *panel, ID **r_owner_id) { - /* TODO(Hans): Use #UI_panel_custom_data_get. */ - PointerRNA *ptr = panel->runtime.custom_data_ptr; + PointerRNA *ptr = UI_panel_custom_data_get(panel); if (r_owner_id != NULL) { *r_owner_id = ptr->owner_id; } - // FModifier *fcm = (FModifier *)ptr->data; - // uiLayoutSetActive(panel->layout, !(fcu->flag & FCURVE_MOD_OFF)); - return ptr; } @@ -148,16 +144,15 @@ static PanelType *fmodifier_panel_register(ARegionType *region_type, { /* Get the name for the modifier's panel. */ char panel_idname[BKE_ST_MAXNAME]; - snprintf(panel_idname, BKE_ST_MAXNAME, "%s_PT_", id_prefix); const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); - strcat(panel_idname, fmi->name); + BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_PT_%s", id_prefix, fmi->name); PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); - strcpy(panel_type->idname, panel_idname); - strcpy(panel_type->label, ""); - strcpy(panel_type->category, "Modifiers"); - strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + /* Intentionally leave the label field blank. The header is filled with buttons. */ + BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME); + BLI_strncpy(panel_type->category, "Modifiers", BKE_ST_MAXNAME); + BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); panel_type->draw_header = fmodifier_panel_header; panel_type->draw = draw; @@ -191,16 +186,14 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type, { /* Create the subpanel's ID name. */ char panel_idname[BKE_ST_MAXNAME]; - strcpy(panel_idname, parent->idname); - strcat(panel_idname, "_"); - strcat(panel_idname, name); + BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_%s", parent->idname, name); PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); - strcpy(panel_type->idname, panel_idname); - strcpy(panel_type->label, label); - strcpy(panel_type->category, "Modifiers"); - strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME); + BLI_strncpy(panel_type->label, label, BKE_ST_MAXNAME); + BLI_strncpy(panel_type->category, "Modifiers", BKE_ST_MAXNAME); + BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); panel_type->draw_header = draw_header; panel_type->draw = draw; @@ -208,7 +201,7 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type, panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX); BLI_assert(parent != NULL); - strcpy(panel_type->parent_id, parent->idname); + BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME); panel_type->parent = parent; BLI_addtail(&parent->children, BLI_genericNodeN(panel_type)); BLI_addtail(®ion_type->paneltypes, panel_type); @@ -311,12 +304,11 @@ static void fmodifier_panel_header(const bContext *C, Panel *panel) FModifier *fcm = (FModifier *)ptr->data; const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); - uiBlock *block = uiLayoutGetBlock(layout); // err... + uiBlock *block = uiLayoutGetBlock(layout); uiLayout *sub = uiLayoutRow(layout, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); - - UI_block_emboss_set(block, UI_EMBOSS_NONE); + uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); /* Checkbox for 'active' status (for now). */ uiItemR(sub, ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); @@ -332,12 +324,11 @@ static void fmodifier_panel_header(const bContext *C, Panel *panel) /* Right align. */ sub = uiLayoutRow(layout, true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); + uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); /* 'Mute' button. */ uiItemR(sub, ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); - UI_block_emboss_set(block, UI_EMBOSS_NONE); - /* Delete button. */ uiBut *but = uiDefIconBut(block, UI_BTYPE_BUT, @@ -365,8 +356,6 @@ static void fmodifier_panel_header(const bContext *C, Panel *panel) BLI_assert(ctx->modifiers != NULL); UI_but_funcN_set(but, delete_fmodifier_cb, ctx, fcm); - UI_block_emboss_set(block, UI_EMBOSS); - uiItemS(layout); } @@ -554,9 +543,9 @@ static void generator_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_generator_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_generator_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_GENERATOR, generator_panel_draw, poll_fn, id_prefix); @@ -598,9 +587,9 @@ static void fn_generator_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_fn_generator_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_generator_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_FN_GENERATOR, fn_generator_panel_draw, poll_fn, id_prefix); @@ -642,9 +631,9 @@ static void cycles_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_cycles_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_cycles_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_CYCLES, cycles_panel_draw, poll_fn, id_prefix); @@ -685,9 +674,9 @@ static void noise_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_noise_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_noise_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_NOISE, noise_panel_draw, poll_fn, id_prefix); @@ -870,9 +859,9 @@ static void envelope_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_envelope_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_envelope_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_ENVELOPE, envelope_panel_draw, poll_fn, id_prefix); @@ -931,9 +920,9 @@ static void limits_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_limits_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifers_limits_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_LIMITS, limits_panel_draw, poll_fn, id_prefix); @@ -983,9 +972,9 @@ static void stepped_panel_draw(const bContext *UNUSED(C), Panel *panel) fmodifier_influence_draw(layout, ptr); } -void ANIM_fcm_stepped_panel_register(ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn) +void ANIM_fmodifiers_stepped_panel_register(ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn) { PanelType *panel_type = fmodifier_panel_register( region_type, FMODIFIER_TYPE_STEPPED, stepped_panel_draw, poll_fn, id_prefix); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 3395385071e..1fd9395af9a 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -688,27 +688,27 @@ void ANIM_fmodifier_panels(const struct bContext *C, ListBase *fmodifiers, uiListPanelIDFromDataFunc panel_id_fn); -void ANIM_fcm_generator_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); -void ANIM_fcm_fn_generator_panel_register(struct ARegionType *region_type, +void ANIM_fmodifiers_generator_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); +void ANIM_fmodifiers_generator_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); +void ANIM_fmodifiers_cycles_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); +void ANIM_fmodifiers_noise_panel_register(struct ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn); -void ANIM_fcm_cycles_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); -void ANIM_fcm_noise_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); -void ANIM_fcm_envelope_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); -void ANIM_fcm_limits_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); -void ANIM_fcm_stepped_panel_register(struct ARegionType *region_type, - const char *id_prefix, - PanelTypePollFn poll_fn); +void ANIM_fmodifiers_envelope_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); +void ANIM_fmodifers_limits_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); +void ANIM_fmodifiers_stepped_panel_register(struct ARegionType *region_type, + const char *id_prefix, + PanelTypePollFn poll_fn); /* ------------- Copy/Paste Buffer -------------- */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 09fe0b0fd16..aef1582c497 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1329,9 +1329,8 @@ static void graph_fmodifier_panel_id(void *fcm_link, char *r_name) { FModifier *fcm = (FModifier *)fcm_link; eFModifier_Types type = fcm->type; - snprintf(r_name, BKE_ST_MAXNAME, "%s_PT_", GRAPH_FMODIFIER_PANEL_PREFIX); const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); - strcat(r_name, fmi->name); + BLI_snprintf(r_name, BKE_ST_MAXNAME, "%s_PT_%s", GRAPH_FMODIFIER_PANEL_PREFIX, fmi->name); } static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) @@ -1444,13 +1443,13 @@ void graph_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); const char *fmodifier_panel_prefix = GRAPH_FMODIFIER_PANEL_PREFIX; - ANIM_fcm_generator_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_fn_generator_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_cycles_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_noise_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_envelope_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_limits_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); - ANIM_fcm_stepped_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_generator_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_generator_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_cycles_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_noise_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_envelope_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifers_limits_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); + ANIM_fmodifiers_stepped_panel_register(art, fmodifier_panel_prefix, graph_panel_poll); pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view"); strcpy(pt->idname, "GRAPH_PT_view"); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 9e58fcd471b..dcdc36141df 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -555,7 +555,7 @@ static void nla_fmodifier_panel_id(void *fcm_link, char *r_name) eFModifier_Types type = fcm->type; snprintf(r_name, BKE_ST_MAXNAME, "%s_PT_", NLA_FMODIFIER_PANEL_PREFIX); const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); - strcat(r_name, fmi->name); + BLI_snprintf(r_name, BKE_ST_MAXNAME, "%s_PT_%s", NLA_FMODIFIER_PANEL_PREFIX, fmi->name); } /* F-Modifiers for active NLA-Strip */ @@ -678,10 +678,10 @@ void nla_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); const char *modifier_panel_prefix = NLA_FMODIFIER_PANEL_PREFIX; - ANIM_fcm_generator_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); - ANIM_fcm_fn_generator_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); - ANIM_fcm_noise_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); - ANIM_fcm_envelope_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); - ANIM_fcm_limits_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); - ANIM_fcm_stepped_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifiers_generator_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifiers_generator_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifiers_noise_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifiers_envelope_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifers_limits_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); + ANIM_fmodifiers_stepped_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll); } diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 0c58e0674d2..be12265fb92 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -100,8 +100,10 @@ typedef enum eFModifier_Types { typedef enum eFModifier_Flags { /** Modifier is not able to be evaluated for some reason, and should be skipped (internal). */ FMODIFIER_FLAG_DISABLED = (1 << 0), +#ifdef DNA_DEPRECATED_ALLOW /** Modifier's data is expanded (in UI). */ - FMODIFIER_FLAG_EXPANDED_DEPRECATED = (1 << 1), + FMODIFIER_FLAG_EXPANDED = (1 << 1), +#endif /** Modifier is active one (in UI) for editing purposes. */ FMODIFIER_FLAG_ACTIVE = (1 << 2), /** User wants modifier to be skipped. */ |