diff options
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/SConscript | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 85 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 15 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 75 |
5 files changed, 182 insertions, 0 deletions
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index 9e1e44e411d..58e38e55fa3 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -58,4 +58,8 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_FREESTYLE) + add_definitions(-DWITH_FREESTYLE) +endif() + blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript index 2a6b381ba66..a4ccf1f6c3c 100644 --- a/source/blender/editors/animation/SConscript +++ b/source/blender/editors/animation/SConscript @@ -37,4 +37,7 @@ defs = [] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_FREESTYLE']: + defs.append('WITH_FREESTYLE') + env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), defs, libtype=['core'], priority=[125] ) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index f5c9bfb4cf5..7362935b4cc 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -47,6 +47,9 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" +#ifdef WITH_FREESTYLE +# include "DNA_linestyle_types.h" +#endif #include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" @@ -2010,6 +2013,85 @@ static bAnimChannelType ACF_DSNTREE = acf_dsntree_setting_ptr /* pointer for setting */ }; +#ifdef WITH_FREESTYLE +/* LineStyle Expander ------------------------------------------- */ + +/* TODO: just get this from RNA? */ +static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale)) +{ + return ICON_BRUSH_DATA; /* FIXME */ +} + +/* get the appropriate flag(s) for the setting when it is valid */ +static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) +{ + /* clear extra return data first */ + *neg = 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return LS_DS_EXPAND; + + case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ + return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg = 1; + return ADT_CURVES_NOT_VISIBLE; + + case ACHANNEL_SETTING_SELECT: /* selected */ + return ADT_UI_SELECTED; + + default: /* unsupported */ + return 0; + } +} + +/* get pointer to the setting */ +static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short *type) +{ + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data; + + /* clear extra return data first */ + *type = 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return GET_ACF_FLAG_PTR(linestyle->flag, type); + + case ACHANNEL_SETTING_SELECT: /* selected */ + case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ + if (linestyle->adt) + return GET_ACF_FLAG_PTR(linestyle->adt->flag, type); + else + return NULL; + + default: /* unsupported */ + return NULL; + } +} + +/* node tree expander type define */ +static bAnimChannelType ACF_DSLINESTYLE= +{ + "Line Style Expander", /* type name */ + + acf_generic_dataexpand_color, /* backdrop color */ + acf_generic_dataexpand_backdrop,/* backdrop */ + acf_generic_indention_1, /* indent level */ + acf_generic_basic_offset, /* offset */ + + acf_generic_idblock_name, /* name */ + acf_generic_idblock_nameprop, /* name prop */ + acf_dslinestyle_icon, /* icon */ + + acf_generic_dataexpand_setting_valid, /* has setting */ + acf_dslinestyle_setting_flag, /* flag for setting */ + acf_dslinestyle_setting_ptr /* pointer for setting */ +}; +#endif + /* Mesh Expander ------------------------------------------- */ // TODO: just get this from RNA? @@ -2722,6 +2804,9 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_DSTEX; /* Texture Channel */ animchannelTypeInfo[type++] = &ACF_DSLAT; /* Lattice Channel */ animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */ +#ifdef WITH_FREESTYLE + animchannelTypeInfo[type++] = &ACF_DSLINESTYLE; /* LineStyle Channel */ +#endif animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 458054c9d7f..275cf723dcd 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -124,6 +124,9 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f case ANIMTYPE_DSMESH: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: +#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -169,6 +172,9 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f case ANIMTYPE_DSARM: case ANIMTYPE_DSMESH: case ANIMTYPE_DSLAT: +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: +#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -249,6 +255,9 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: +#endif case ANIMTYPE_DSSPK: { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) @@ -343,6 +352,9 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: +#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -2207,6 +2219,9 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: +#endif case ANIMTYPE_DSSPK: { /* sanity checking... */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 655ab2bfb15..37fd05f75a5 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -55,6 +55,9 @@ #include "DNA_camera_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" +#ifdef WITH_FREESTYLE +# include "DNA_linestyle_types.h" +#endif #include "DNA_key_types.h" #include "DNA_mask_types.h" #include "DNA_material_types.h" @@ -734,6 +737,21 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->adt = BKE_animdata_from_id(data); } break; +#ifdef WITH_FREESTYLE + case ANIMTYPE_DSLINESTYLE: + { + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)data; + AnimData *adt = linestyle->adt; + + ale->flag = FILTER_LS_SCED(linestyle); + + ale->key_data = (adt) ? adt->action : NULL; + ale->datatype = ALE_ACT; + + ale->adt = BKE_animdata_from_id(data); + } + break; +#endif case ANIMTYPE_DSPART: { ParticleSettings *part = (ParticleSettings *)ale->data; @@ -1511,6 +1529,56 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data, return items; } +#ifdef WITH_FREESTYLE +static size_t animdata_filter_ds_linestyle (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode) +{ + SceneRenderLayer *srl; + size_t items = 0; + + for (srl = sce->r.layers.first; srl; srl = srl->next) { + FreestyleLineSet *lineset; + + /* skip render layers without Freestyle enabled */ + if (!(srl->layflag & SCE_LAY_FRS)) + continue; + + /* loop over linesets defined in the render layer */ + for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { + FreestyleLineStyle *linestyle = lineset->linestyle; + ListBase tmp_data = {NULL, NULL}; + size_t tmp_items = 0; + + /* add scene-level animation channels */ + BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_LS_SCED(linestyle)) + { + /* animation data filtering */ + tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)linestyle, filter_mode); + } + END_ANIMFILTER_SUBCHANNELS; + + /* did we find anything? */ + if (tmp_items) { + /* include anim-expand widget first */ + if (filter_mode & ANIMFILTER_LIST_CHANNELS) { + /* check if filtering by active status */ + if ANIMCHANNEL_ACTIVEOK(linestyle) { + ANIMCHANNEL_NEW_CHANNEL(linestyle, ANIMTYPE_DSLINESTYLE, sce); + } + } + + /* now add the list of collected channels */ + BLI_movelisttolist(anim_data, &tmp_data); + BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL)); + items += tmp_items; + } + } + } + + /* return the number of items added to the list */ + return items; +} +#endif + /* NOTE: owner_id is either material, lamp, or world block, which is the direct owner of the texture stack in question */ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode) { @@ -2145,6 +2213,13 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)sce, ntree, filter_mode); } +#ifdef WITH_FREESTYLE + /* line styles */ + if ((ads->filterflag & ADS_FILTER_NOLINESTYLE) == 0) { + tmp_items += animdata_filter_ds_linestyle(ac, &tmp_data, ads, sce, filter_mode); + } +#endif + /* TODO: one day, when sequencer becomes its own datatype, perhaps it should be included here */ } END_ANIMFILTER_SUBCHANNELS; |