realize-depth #5

Merged
Arye Ramaty merged 43 commits from David-Haver/blender:realize-depth into WIP-realize-depth 2024-03-31 17:22:49 +02:00
Showing only changes of commit 5ff8738dce - Show all commits

View File

@ -3674,138 +3674,136 @@ size_t ANIM_animdata_filter(bAnimContext *ac,
void *data, void *data,
eAnimCont_Types datatype) eAnimCont_Types datatype)
{ {
if (!data || !anim_data) {
return 0;
}
size_t items = 0; size_t items = 0;
switch (datatype) {
/* Action-Editing Modes */
case ANIMCONT_ACTION: /* 'Action Editor' */
{
Object *obact = ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction) ? &saction->ads : nullptr;
/* only filter data if there's somewhere to put it */ /* specially check for AnimData filter, see #36687. */
if (data && anim_data) { if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* firstly filter the data */ /* all channels here are within the same AnimData block, hence this special case */
switch (datatype) { if (LIKELY(obact->adt)) {
/* Action-Editing Modes */ ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact, nullptr);
case ANIMCONT_ACTION: /* 'Action Editor' */
{
Object *obact = ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction) ? &saction->ads : nullptr;
/* specially check for AnimData filter, see #36687. */
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(obact->adt)) {
ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact, nullptr);
}
} }
else {
/* The check for the DopeSheet summary is included here
* since the summary works here too. */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items += animfilter_action(
ac, anim_data, ads, static_cast<bAction *>(data), filter_mode, (ID *)obact);
}
}
break;
} }
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */ else {
{ /* The check for the DopeSheet summary is included here
Key *key = (Key *)data; * since the summary works here too. */
/* specially check for AnimData filter, see #36687. */
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(key->adt)) {
ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key, nullptr);
}
}
else {
/* The check for the DopeSheet summary is included here
* since the summary works here too. */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items = animdata_filter_shapekey(ac, anim_data, key, filter_mode);
}
}
break;
}
/* Modes for Specialty Data Types (i.e. not keyframes) */
case ANIMCONT_GPENCIL: {
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) { if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
if (U.experimental.use_grease_pencil_version3) { items += animfilter_action(
items = animdata_filter_grease_pencil(ac, anim_data, filter_mode); ac, anim_data, ads, static_cast<bAction *>(data), filter_mode, (ID *)obact);
}
else {
items = animdata_filter_gpencil_legacy(ac, anim_data, data, filter_mode);
}
} }
break;
} }
case ANIMCONT_MASK: {
break;
}
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */
{
Key *key = (Key *)data;
/* specially check for AnimData filter, see #36687. */
if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
/* all channels here are within the same AnimData block, hence this special case */
if (LIKELY(key->adt)) {
ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key, nullptr);
}
}
else {
/* The check for the DopeSheet summary is included here
* since the summary works here too. */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) { if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items = animdata_filter_mask(ac->bmain, anim_data, data, filter_mode); items = animdata_filter_shapekey(ac, anim_data, key, filter_mode);
} }
break;
} }
/* DopeSheet Based Modes */ break;
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
{
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items += animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
}
break;
}
case ANIMCONT_FCURVES: /* Graph Editor -> F-Curves/Animation Editing */
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
case ANIMCONT_NLA: /* NLA Editor */
{
/* all of these editors use the basic DopeSheet data for filtering options,
* but don't have all the same features */
items = animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
break;
}
/* Timeline Mode - Basically the same as dopesheet,
* except we only have the summary for now */
case ANIMCONT_TIMELINE: {
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items += animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
}
break;
}
/* Special/Internal Use */
case ANIMCONT_CHANNEL: /* animation channel */
{
bDopeSheet *ads = ac->ads;
/* based on the channel type, filter relevant data for this */
items = animdata_filter_animchan(
ac, anim_data, ads, static_cast<bAnimListElem *>(data), filter_mode);
break;
}
/* unhandled */
default: {
printf("ANIM_animdata_filter() - Invalid datatype argument %i\n", datatype);
break;
}
} }
/* remove any 'weedy' entries */ /* Modes for Specialty Data Types (i.e. not keyframes) */
items = animdata_filter_remove_invalid(anim_data); case ANIMCONT_GPENCIL: {
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
if (U.experimental.use_grease_pencil_version3) {
items = animdata_filter_grease_pencil(ac, anim_data, filter_mode);
}
else {
items = animdata_filter_gpencil_legacy(ac, anim_data, data, filter_mode);
}
}
break;
}
case ANIMCONT_MASK: {
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items = animdata_filter_mask(ac->bmain, anim_data, data, filter_mode);
}
break;
}
/* remove duplicates (if required) */ /* DopeSheet Based Modes */
if (filter_mode & ANIMFILTER_NODUPLIS) { case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
items = animdata_filter_remove_duplis(anim_data); {
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items += animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
}
break;
}
case ANIMCONT_FCURVES: /* Graph Editor -> F-Curves/Animation Editing */
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
case ANIMCONT_NLA: /* NLA Editor */
{
/* all of these editors use the basic DopeSheet data for filtering options,
* but don't have all the same features */
items = animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
break;
}
/* Timeline Mode - Basically the same as dopesheet,
* except we only have the summary for now */
case ANIMCONT_TIMELINE: {
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) {
items += animdata_filter_dopesheet(
ac, anim_data, static_cast<bDopeSheet *>(data), filter_mode);
}
break;
}
/* Special/Internal Use */
case ANIMCONT_CHANNEL: /* animation channel */
{
bDopeSheet *ads = ac->ads;
/* based on the channel type, filter relevant data for this */
items = animdata_filter_animchan(
ac, anim_data, ads, static_cast<bAnimListElem *>(data), filter_mode);
break;
}
/* unhandled */
default: {
printf("ANIM_animdata_filter() - Invalid datatype argument %i\n", datatype);
break;
} }
} }
/* return the number of items in the list */ /* remove any 'weedy' entries */
items = animdata_filter_remove_invalid(anim_data);
/* remove duplicates (if required) */
if (filter_mode & ANIMFILTER_NODUPLIS) {
items = animdata_filter_remove_duplis(anim_data);
}
return items; return items;
} }