Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_filter.c
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_particle_types.h" | #include "DNA_particle_types.h" | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "DNA_sequence_types.h" | #include "DNA_sequence_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_speaker_types.h" | #include "DNA_speaker_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_brush_types.h" | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "DNA_layer_types.h" | #include "DNA_layer_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| ▲ Show 20 Lines • Show All 1,558 Lines • ▼ Show 20 Lines | static size_t animdata_filter_gpencil_data(ListBase *anim_data, bDopeSheet *ads, bGPdata *gpd, int filter_mode) | ||||
| size_t items = 0; | size_t items = 0; | ||||
| /* When asked from "AnimData" blocks (i.e. the top-level containers for normal animation), | /* When asked from "AnimData" blocks (i.e. the top-level containers for normal animation), | ||||
| * for convenience, this will return GP Datablocks instead. This may cause issues down | * for convenience, this will return GP Datablocks instead. This may cause issues down | ||||
| * the track, but for now, this will do... | * the track, but for now, this will do... | ||||
| */ | */ | ||||
| if (filter_mode & ANIMFILTER_ANIMDATA) { | if (filter_mode & ANIMFILTER_ANIMDATA) { | ||||
| /* just add GPD as a channel - this will add everything needed */ | /* just add GPD as a channel - this will add everything needed */ | ||||
| ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, NULL); | ANIMCHANNEL_NEW_CHANNEL(gpd, ANIMTYPE_GPDATABLOCK, gpd); | ||||
| } | } | ||||
| else { | else { | ||||
| ListBase tmp_data = {NULL, NULL}; | ListBase tmp_data = {NULL, NULL}; | ||||
| size_t tmp_items = 0; | size_t tmp_items = 0; | ||||
| /* add gpencil animation channels */ | /* add gpencil animation channels */ | ||||
| BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_GPD(gpd)) | BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_GPD(gpd)) | ||||
| { | { | ||||
| Show All 34 Lines | if (ads->filterflag & ADS_FILTER_GP_3DONLY) { | ||||
| /* Active scene's GPencil block first - No parent item needed... */ | /* Active scene's GPencil block first - No parent item needed... */ | ||||
| if (scene->gpd) { | if (scene->gpd) { | ||||
| items += animdata_filter_gpencil_data(anim_data, ads, scene->gpd, filter_mode); | items += animdata_filter_gpencil_data(anim_data, ads, scene->gpd, filter_mode); | ||||
| } | } | ||||
| /* Objects in the scene */ | /* Objects in the scene */ | ||||
| for (base = view_layer->object_bases.first; base; base = base->next) { | for (base = view_layer->object_bases.first; base; base = base->next) { | ||||
| /* Only consider this object if it has got some GP data (saving on all the other tests) */ | /* Only consider this object if it has got some GP data (saving on all the other tests) */ | ||||
| if (base->object && base->object->gpd) { | if (base->object && (base->object->type == OB_GPENCIL)) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| /* firstly, check if object can be included, by the following factors: | /* firstly, check if object can be included, by the following factors: | ||||
| * - if only visible, must check for layer and also viewport visibility | * - if only visible, must check for layer and also viewport visibility | ||||
| * --> while tools may demand only visible, user setting takes priority | * --> while tools may demand only visible, user setting takes priority | ||||
| * as user option controls whether sets of channels get included while | * as user option controls whether sets of channels get included while | ||||
| * tool-flag takes into account collapsed/open channels too | * tool-flag takes into account collapsed/open channels too | ||||
| * - if only selected, must check if object is selected | * - if only selected, must check if object is selected | ||||
| Show All 20 Lines | for (base = view_layer->object_bases.first; base; base = base->next) { | ||||
| */ | */ | ||||
| if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) { | if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) { | ||||
| if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) | if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* finally, include this object's grease pencil datablock */ | /* finally, include this object's grease pencil datablock */ | ||||
| /* XXX: Should we store these under expanders per item? */ | /* XXX: Should we store these under expanders per item? */ | ||||
| items += animdata_filter_gpencil_data(anim_data, ads, ob->gpd, filter_mode); | items += animdata_filter_gpencil_data(anim_data, ads, ob->data, filter_mode); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| bGPdata *gpd; | bGPdata *gpd; | ||||
| /* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */ | /* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */ | ||||
| for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) { | for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) { | ||||
| ▲ Show 20 Lines • Show All 847 Lines • ▼ Show 20 Lines | if (ob->data) { | ||||
| tmp_items += animdata_filter_ds_obdata(ac, &tmp_data, ads, ob, filter_mode); | tmp_items += animdata_filter_ds_obdata(ac, &tmp_data, ads, ob, filter_mode); | ||||
| } | } | ||||
| /* particles */ | /* particles */ | ||||
| if ((ob->particlesystem.first) && !(ads->filterflag & ADS_FILTER_NOPART)) { | if ((ob->particlesystem.first) && !(ads->filterflag & ADS_FILTER_NOPART)) { | ||||
| tmp_items += animdata_filter_ds_particles(ac, &tmp_data, ads, ob, filter_mode); | tmp_items += animdata_filter_ds_particles(ac, &tmp_data, ads, ob, filter_mode); | ||||
| } | } | ||||
| /* grease pencil */ | /* grease pencil */ | ||||
aligorith: Ack! It would have been best to just leave this one alone.
1) When we can mix dopesheet data… | |||||
| if ((ob->gpd) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) { | if ((ob->type == OB_GPENCIL) && | ||||
| tmp_items += animdata_filter_ds_gpencil(ac, &tmp_data, ads, ob->gpd, filter_mode); | (ob->data) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) | ||||
| { | |||||
| tmp_items += animdata_filter_ds_gpencil(ac, &tmp_data, ads, ob->data, filter_mode); | |||||
| } | } | ||||
| } | } | ||||
| END_ANIMFILTER_SUBCHANNELS; | END_ANIMFILTER_SUBCHANNELS; | ||||
| /* if we collected some channels, add these to the new list... */ | /* if we collected some channels, add these to the new list... */ | ||||
| if (tmp_items) { | if (tmp_items) { | ||||
| /* firstly add object expander if required */ | /* firstly add object expander if required */ | ||||
| ▲ Show 20 Lines • Show All 677 Lines • Show Last 20 Lines | |||||
Ack! It would have been best to just leave this one alone.