Compare commits
25 Commits
geometry-n
...
fcurve-mod
Author | SHA1 | Date | |
---|---|---|---|
a17de3ed5f | |||
dd9e2cd6fa | |||
a5ad2d7f75 | |||
7c977ae4c9 | |||
9e55344d89 | |||
b2890d6366 | |||
1f82713fb1 | |||
fb61d6d1bd | |||
0a93775715 | |||
1b19bc7b8e | |||
320bc5360c | |||
2d88c64b61 | |||
0d5b62db04 | |||
0d3cb37626 | |||
84ba71ba32 | |||
384ccd1671 | |||
318a5cc4ba | |||
1d8f17c64e | |||
d52081d048 | |||
bb3d0e4904 | |||
a5e456f913 | |||
75bd1b4bb8 | |||
06349b903b | |||
fea5097eb8 | |||
afa83b5bce |
@@ -1133,7 +1133,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
|
||||
/* add modifier itself */
|
||||
fcm = MEM_callocN(sizeof(FModifier), "F-Curve Modifier");
|
||||
fcm->type = type;
|
||||
fcm->flag = FMODIFIER_FLAG_EXPANDED;
|
||||
fcm->ui_expand_flag = (1 << 0); /* Expand the main panel, not the subpanels. */
|
||||
fcm->curve = owner_fcu;
|
||||
fcm->influence = 1.0f;
|
||||
BLI_addtail(modifiers, fcm);
|
||||
|
@@ -875,5 +875,19 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
*/
|
||||
{
|
||||
/* Keep this block, even when empty. */
|
||||
|
||||
/* Move to storing expansion for all panels of FModifiers. */
|
||||
LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
|
||||
LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
|
||||
LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
|
||||
if (fcm->flag & FMODIFIER_FLAG_EXPANDED) {
|
||||
fcm->ui_expand_flag = 1;
|
||||
}
|
||||
else {
|
||||
fcm->ui_expand_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,11 @@ struct ID;
|
||||
struct ListBase;
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
struct Main;
|
||||
struct NlaStrip;
|
||||
struct FModifier;
|
||||
struct PanelType;
|
||||
struct ReportList;
|
||||
struct ScrArea;
|
||||
struct SpaceLink;
|
||||
@@ -675,11 +679,38 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d);
|
||||
|
||||
/* ------------- UI Panel Drawing -------------- */
|
||||
|
||||
/* draw a given F-Modifier for some layout/UI-Block */
|
||||
void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout,
|
||||
struct ID *fcurve_owner_id,
|
||||
ListBase *modifiers,
|
||||
struct FModifier *fcm);
|
||||
struct NlaStrip *ANIM_nla_context_strip(const struct bContext *C);
|
||||
struct FCurve *ANIM_graph_context_fcurve(const struct bContext *C);
|
||||
|
||||
typedef bool (*PanelTypePollFn)(const struct bContext *C, struct PanelType *pt);
|
||||
typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname);
|
||||
|
||||
void ANIM_fmodifier_panels(const struct bContext *C,
|
||||
struct ID *owner_id,
|
||||
ListBase *fmodifiers,
|
||||
uiListPanelIDFromDataFunc panel_id_fn);
|
||||
|
||||
void ANIM_fmodifiers_generator_panel_register(struct ARegionType *region_type,
|
||||
const char *id_prefix,
|
||||
PanelTypePollFn poll_fn);
|
||||
void ANIM_fmodifiers_fn_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_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 -------------- */
|
||||
|
||||
|
@@ -105,6 +105,16 @@ static bool graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve *
|
||||
return true;
|
||||
}
|
||||
|
||||
FCurve *ANIM_graph_context_fcurve(const bContext *C)
|
||||
{
|
||||
FCurve *fcu;
|
||||
if (!graph_panel_context(C, NULL, &fcu)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return fcu;
|
||||
}
|
||||
|
||||
static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
return graph_panel_context(C, NULL, NULL);
|
||||
@@ -1313,6 +1323,15 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
|
||||
/* All the drawing code is in editors/animation/fmodifier_ui.c */
|
||||
|
||||
#define B_FMODIFIER_REDRAW 20
|
||||
#define GRAPH_FMODIFIER_PANEL_PREFIX "GRAPH"
|
||||
|
||||
static void graph_fmodifier_panel_id(void *fcm_link, char *r_name)
|
||||
{
|
||||
FModifier *fcm = (FModifier *)fcm_link;
|
||||
eFModifier_Types type = fcm->type;
|
||||
const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type);
|
||||
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)
|
||||
{
|
||||
@@ -1328,10 +1347,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *panel)
|
||||
{
|
||||
bAnimListElem *ale;
|
||||
FCurve *fcu;
|
||||
FModifier *fcm;
|
||||
uiLayout *col, *row;
|
||||
uiLayout *row;
|
||||
uiBlock *block;
|
||||
bool active;
|
||||
|
||||
if (!graph_panel_context(C, &ale, &fcu)) {
|
||||
return;
|
||||
@@ -1356,14 +1373,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *panel)
|
||||
uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
|
||||
}
|
||||
|
||||
active = !(fcu->flag & FCURVE_MOD_OFF);
|
||||
/* draw each modifier */
|
||||
for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
|
||||
col = uiLayoutColumn(panel->layout, true);
|
||||
uiLayoutSetActive(col, active);
|
||||
|
||||
ANIM_uiTemplate_fmodifier_draw(col, ale->fcurve_owner_id, &fcu->modifiers, fcm);
|
||||
}
|
||||
ANIM_fmodifier_panels(C, ale->fcurve_owner_id, &fcu->modifiers, graph_fmodifier_panel_id);
|
||||
|
||||
MEM_freeN(ale);
|
||||
}
|
||||
@@ -1427,10 +1437,20 @@ void graph_buttons_register(ARegionType *art)
|
||||
strcpy(pt->label, N_("Modifiers"));
|
||||
strcpy(pt->category, "Modifiers");
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
pt->draw = graph_panel_modifiers;
|
||||
pt->poll = graph_panel_poll;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
const char *fmodifier_panel_prefix = GRAPH_FMODIFIER_PANEL_PREFIX;
|
||||
ANIM_fmodifiers_generator_panel_register(art, fmodifier_panel_prefix, graph_panel_poll);
|
||||
ANIM_fmodifiers_fn_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");
|
||||
strcpy(pt->label, N_("Show Cursor"));
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_fcurve.h"
|
||||
#include "BKE_nla.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
@@ -184,6 +185,17 @@ bool nla_panel_context(const bContext *C,
|
||||
return (found != 0);
|
||||
}
|
||||
|
||||
NlaStrip *ANIM_nla_context_strip(const bContext *C)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) {
|
||||
return NULL;
|
||||
}
|
||||
NlaStrip *strip = strip_ptr.data;
|
||||
|
||||
return strip;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool nla_panel_poll(const bContext *C, PanelType *pt)
|
||||
{
|
||||
@@ -535,13 +547,23 @@ static void nla_panel_animated_strip_time(const bContext *C, Panel *panel)
|
||||
uiItemR(layout, &strip_ptr, "strip_time", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
#define NLA_FMODIFIER_PANEL_PREFIX "NLA"
|
||||
|
||||
static void nla_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_", NLA_FMODIFIER_PANEL_PREFIX);
|
||||
const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type);
|
||||
BLI_snprintf(r_name, BKE_ST_MAXNAME, "%s_PT_%s", NLA_FMODIFIER_PANEL_PREFIX, fmi->name);
|
||||
}
|
||||
|
||||
/* F-Modifiers for active NLA-Strip */
|
||||
static void nla_panel_modifiers(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA strip_ptr;
|
||||
NlaStrip *strip;
|
||||
FModifier *fcm;
|
||||
uiLayout *col, *row;
|
||||
uiLayout *row;
|
||||
uiBlock *block;
|
||||
|
||||
/* check context and also validity of pointer */
|
||||
@@ -569,12 +591,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *panel)
|
||||
uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste");
|
||||
}
|
||||
|
||||
/* draw each modifier */
|
||||
for (fcm = strip->modifiers.first; fcm; fcm = fcm->next) {
|
||||
col = uiLayoutColumn(panel->layout, true);
|
||||
|
||||
ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.owner_id, &strip->modifiers, fcm);
|
||||
}
|
||||
ANIM_fmodifier_panels(C, strip_ptr.owner_id, &strip->modifiers, nla_fmodifier_panel_id);
|
||||
}
|
||||
|
||||
/* ******************* general ******************************** */
|
||||
@@ -657,5 +674,15 @@ void nla_buttons_register(ARegionType *art)
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw = nla_panel_modifiers;
|
||||
pt->poll = nla_strip_eval_panel_poll;
|
||||
pt->flag = PNL_NO_HEADER;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
const char *modifier_panel_prefix = NLA_FMODIFIER_PANEL_PREFIX;
|
||||
ANIM_fmodifiers_generator_panel_register(art, modifier_panel_prefix, nla_strip_eval_panel_poll);
|
||||
ANIM_fmodifiers_fn_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);
|
||||
}
|
||||
|
@@ -57,6 +57,10 @@ typedef struct FModifier {
|
||||
short type;
|
||||
/** Settings for the modifier. */
|
||||
short flag;
|
||||
/** Expansion state for the modifier panel and subpanels. */
|
||||
short ui_expand_flag;
|
||||
|
||||
char _pad[6];
|
||||
|
||||
/** The amount that the modifier should influence the value. */
|
||||
float influence;
|
||||
@@ -96,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 = (1 << 1),
|
||||
#endif
|
||||
/** Modifier is active one (in UI) for editing purposes. */
|
||||
FMODIFIER_FLAG_ACTIVE = (1 << 2),
|
||||
/** User wants modifier to be skipped. */
|
||||
|
@@ -1109,6 +1109,17 @@ static void rna_Keyframe_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
|
||||
rna_tag_animation_update(bmain, ptr->owner_id);
|
||||
}
|
||||
|
||||
static void rna_FModifier_show_expanded_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
FModifier *fcm = ptr->data;
|
||||
if (value) {
|
||||
fcm->ui_expand_flag |= (1 << 0);
|
||||
}
|
||||
else {
|
||||
fcm->ui_expand_flag &= ~(1 << 0);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_fmodifier_generator(BlenderRNA *brna)
|
||||
@@ -1199,7 +1210,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Phase Multiplier", "Scale factor determining the 'speed' of the function");
|
||||
prop, "Phase Multiple", "Scale factor determining the 'speed' of the function");
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
|
||||
@@ -1612,13 +1623,14 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
/* settings */
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_show_expanded_set");
|
||||
RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI");
|
||||
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
||||
|
||||
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
|
||||
RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
|
||||
RNA_def_property_ui_text(prop, "Enabled", "Enable F-Curve modifier evaluation");
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
|
||||
RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
|
||||
|
||||
@@ -1632,7 +1644,7 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
/* TODO: setting this to true must ensure that all others in stack are turned off too... */
|
||||
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_ui_text(prop, "Active", "F-Curve modifier will show settings in the editor");
|
||||
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);
|
||||
@@ -1646,8 +1658,6 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
"F-Curve Modifier is only applied for the specified frame range to help "
|
||||
"mask off effects in order to chain them");
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
|
||||
RNA_def_property_ui_icon(
|
||||
prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
|
||||
|
||||
prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "sfra");
|
||||
@@ -1689,8 +1699,6 @@ static void rna_def_fmodifier(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor");
|
||||
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
|
||||
RNA_def_property_ui_icon(
|
||||
prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
|
||||
|
||||
prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "influence");
|
||||
|
Reference in New Issue
Block a user