Blender V5.3
anim_filter.cc File Reference
#include <cstring>
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_cachefile_types.h"
#include "DNA_camera_types.h"
#include "DNA_curves_types.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
#include "DNA_layer_types.h"
#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mask_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "DNA_speaker_types.h"
#include "DNA_userdef_types.h"
#include "DNA_volume_types.h"
#include "DNA_world_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_alloca.hh"
#include "BLI_listbase.hh"
#include "BLI_string.hh"
#include "BLI_utildefines.hh"
#include "BKE_action.hh"
#include "BKE_anim_data.hh"
#include "BKE_collection.hh"
#include "BKE_context.hh"
#include "BKE_fcurve.hh"
#include "BKE_fcurve_driver.h"
#include "BKE_global.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_library.hh"
#include "BKE_main.hh"
#include "BKE_mask.hh"
#include "BKE_material.hh"
#include "BKE_modifier.hh"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "ED_anim_api.hh"
#include "SEQ_iterator.hh"
#include "SEQ_modifier.hh"
#include "SEQ_sequencer.hh"
#include "SEQ_utils.hh"
#include "ANIM_action.hh"
#include "ANIM_armature.hh"
#include "anim_intern.hh"

Go to the source code of this file.

Classes

struct  blender::tAnimFilterModifiersContext

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define BEGIN_ANIMFILTER_SUBCHANNELS(expanded_check)
#define END_ANIMFILTER_SUBCHANNELS
#define ANIMDATA_HAS_ACTION(id)
#define ANIMDATA_HAS_DRIVERS(id)
#define ANIMDATA_HAS_NLA(id)
#define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, nlaKeysOk, legacyActionOk, layeredActionOk)
#define ANIMCHANNEL_NEW_CHANNEL_FULL(bmain, channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement)
#define ANIMCHANNEL_NEW_CHANNEL(bmain, channel_data, channel_type, owner_id, fcurve_owner_id)
#define ANIMCHANNEL_ACTIVEOK(ale)
#define ANIMCHANNEL_SELOK(test_func)
#define ANIMCHANNEL_SELEDITOK(test_func)

Functions

static Key * blender::actedit_get_shapekeys (bAnimContext *ac)
static bool blender::actedit_get_context (bAnimContext *ac, SpaceAction *saction)
static bool blender::graphedit_get_context (bAnimContext *ac, SpaceGraph *sipo)
static bool blender::nlaedit_get_context (bAnimContext *ac, SpaceNla *snla)
bool blender::ANIM_animdata_context_getdata (bAnimContext *ac)
bool blender::ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
bool blender::ANIM_animdata_can_have_greasepencil (const eAnimCont_Types type)
static void blender::key_data_from_adt (bAnimListElem &ale, AnimData *adt)
static bAnimListElem * blender::make_new_animlistelem (Main *bmain, void *data, const eAnim_ChannelType datatype, ID *owner_id, ID *fcurve_owner_id)
static bool blender::skip_fcurve_selected_data (bAnimContext *ac, FCurve *fcu, ID *owner_id, const eAnimFilter_Flags filter_mode)
static bool blender::name_matches_dopesheet_filter (const bDopeSheet *ads, const char *name)
static bool blender::skip_fcurve_with_name (bAnimContext *ac, FCurve *fcu, eAnim_ChannelType channel_type, void *owner, ID *owner_id)
static bool blender::ale_name_matches_dopesheet_filter (const bDopeSheet &ads, bAnimListElem &ale)
static bool blender::fcurve_has_errors (bAnimContext *ac, const FCurve *fcu)
static FCurve * blender::animfilter_fcurve_next (bAnimContext *ac, FCurve *first, eAnim_ChannelType channel_type, const eAnimFilter_Flags filter_mode, void *owner, ID *owner_id)
static size_t blender::animfilter_fcurves (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, FCurve *first, eAnim_ChannelType fcurve_type, const eAnimFilter_Flags filter_mode, void *owner, ID *owner_id, ID *fcurve_owner_id)
static bool blender::fcurve_span_selection_matters (const eAnimFilter_Flags filter_mode)
static bool blender::fcurve_span_must_be_selected (const eAnimFilter_Flags filter_mode)
static size_t blender::animfilter_fcurves_span (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Span< FCurve * > fcurves, const animrig::slot_handle_t slot_handle, const eAnimFilter_Flags filter_mode, ID *animated_id, ID *fcurve_owner_id)
static size_t blender::animfilter_act_group (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, bAction *act, animrig::slot_handle_t slot_handle, bActionGroup *agrp, eAnimFilter_Flags filter_mode, ID *owner_id)
size_t blender::ANIM_animfilter_action_slot (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, animrig::Action &action, animrig::Slot &slot, const eAnimFilter_Flags filter_mode, ID *animated_id)
static size_t blender::animfilter_action_slots (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, animrig::Action &action, const eAnimFilter_Flags filter_mode, ID *owner_id)
static size_t blender::animfilter_action (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, animrig::Action &action, const animrig::slot_handle_t slot_handle, const eAnimFilter_Flags filter_mode, ID *owner_id)
static size_t blender::animfilter_nla (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, AnimData *adt, const eAnimFilter_Flags filter_mode, ID *owner_id)
static size_t blender::animfilter_nla_controls (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, AnimData *adt, eAnimFilter_Flags filter_mode, ID *owner_id)
static size_t blender::animfilter_block_data (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, ID *id, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_shapekey (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Key *key, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_grease_pencil_layer (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, GreasePencil *grease_pencil, bke::greasepencil::Layer &layer, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_grease_pencil_layer_node_recursive (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, GreasePencil *grease_pencil, bke::greasepencil::TreeNode &node, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_grease_pencil_layers_data (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, GreasePencil *grease_pencil, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_gpencil_layers_data_legacy (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, bGPdata *gpd, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_grease_pencil_data (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, GreasePencil *grease_pencil, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_grease_pencil (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_gpencil (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, bGPdata *gpd, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_cachefile (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, CacheFile *cache_file, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_mask_data (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Mask *mask, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_mask (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, void *, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_nodetree_group (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, ID *owner_id, bNodeTree *ntree, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_nodetree (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, ID *owner_id, bNodeTree *ntree, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_linestyle (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Scene *sce, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_texture (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Tex *tex, ID *owner_id, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_textures (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, ID *owner_id, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_material (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Material *ma, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_materials (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, const eAnimFilter_Flags filter_mode)
static void blender::animfilter_modifier_idpoin_cb (void *afm_ptr, Object *ob, ID **idpoin, LibraryForeachIDCallbackFlag)
static size_t blender::animdata_filter_ds_modifiers (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_particles (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_obdata (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_keyanim (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, Key *key, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_obanim (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Object *ob, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_dopesheet_ob (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Base *base, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_world (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Scene *sce, World *wo, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_scene (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Scene *sce, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_dopesheet_scene (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, Scene *sce, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_ds_movieclip (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, MovieClip *clip, eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_dopesheet_movieclips (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode)
static bool blender::animdata_filter_base_is_ok (bAnimContext *ac, Base *base, const eObjectMode object_mode, const eAnimFilter_Flags filter_mode)
static int blender::ds_base_sorting_cmp (const void *base1_ptr, const void *base2_ptr)
static Base ** blender::animdata_filter_ds_sorted_bases (bAnimContext *ac, const Scene *scene, ViewLayer *view_layer, const eAnimFilter_Flags filter_mode, size_t *r_usable_bases)
static size_t blender::animdata_filter_dopesheet (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, eAnimFilter_Flags filter_mode)
static short blender::animdata_filter_dopesheet_summary (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, size_t *items)
static size_t blender::animdata_filter_animchan (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, bAnimListElem *channel, const eAnimFilter_Flags filter_mode)
static size_t blender::animdata_filter_remove_invalid (ListBaseT< bAnimListElem > *anim_data)
static size_t blender::animdata_filter_remove_duplis (ListBaseT< bAnimListElem > *anim_data)
size_t blender::ANIM_animdata_filter (bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
Public API
bAction * blender::ANIM_active_action_from_area (const Main &bmain, Scene *scene, ViewLayer *view_layer, const ScrArea *area, ID **r_action_user)

Macro Definition Documentation

◆ ANIMCHANNEL_ACTIVEOK

◆ ANIMCHANNEL_NEW_CHANNEL

#define ANIMCHANNEL_NEW_CHANNEL ( bmain,
channel_data,
channel_type,
owner_id,
fcurve_owner_id )

◆ ANIMCHANNEL_NEW_CHANNEL_FULL

#define ANIMCHANNEL_NEW_CHANNEL_FULL ( bmain,
channel_data,
channel_type,
owner_id,
fcurve_owner_id,
ale_statement )
Value:
if (filter_mode & ANIMFILTER_TMP_PEEK) { \
return 1; \
} \
{ \
bAnimListElem *ale = make_new_animlistelem( \
bmain, channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \
if (ale) { \
BLI_addtail(anim_data, ale); \
items++; \
ale_statement \
} \
} \
(void)0

Add a new animation channel, taking into account the "peek" flag, which is used to just check whether any channels will be added (but without needing them to actually get created).

Warning
This causes the calling function to return early if we're only "peeking" for channels.

Definition at line 591 of file anim_filter.cc.

Referenced by blender::animfilter_act_group(), blender::animfilter_fcurves(), and blender::animfilter_nla().

◆ ANIMCHANNEL_SELEDITOK

#define ANIMCHANNEL_SELEDITOK ( test_func)
Value:
(!(filter_mode & ANIMFILTER_SELEDIT) || !(filter_mode & ANIMFILTER_FOREDIT) || (test_func))

Quick macro to test if an anim-channel (F-Curve) is selected ok for editing purposes

  • *_SELEDIT means that only selected curves will have visible+editable key-frames.

checks here work as follows: 1) SELEDIT off - don't need to consider the implications of this option. 2) FOREDIT off - we're not considering editing, so channel is ok still. 3) test_func (i.e. selection test) - only if selected, this test will pass.

Definition at line 632 of file anim_filter.cc.

Referenced by blender::animfilter_fcurve_next().

◆ ANIMCHANNEL_SELOK

#define ANIMCHANNEL_SELOK ( test_func)
Value:
(!(filter_mode & (ANIMFILTER_SEL | ANIMFILTER_UNSEL)) || \
((filter_mode & ANIMFILTER_SEL) && test_func) || \
((filter_mode & ANIMFILTER_UNSEL) && test_func == 0))

Definition at line 618 of file anim_filter.cc.

Referenced by blender::animdata_filter_dopesheet_ob(), blender::animdata_filter_gpencil_layers_data_legacy(), blender::animdata_filter_grease_pencil_layer(), blender::animdata_filter_mask_data(), blender::animdata_filter_shapekey(), blender::animfilter_act_group(), blender::animfilter_block_data(), blender::animfilter_fcurve_next(), and blender::animfilter_nla().

◆ ANIMDATA_FILTER_CASES

#define ANIMDATA_FILTER_CASES ( id,
adtOk,
nlaOk,
driversOk,
nlaKeysOk,
legacyActionOk,
layeredActionOk )

Quick macro to test for all three above usability tests, performing the appropriate provided action for each when the AnimData context is appropriate.

Priority order for this goes (most important, to least): AnimData blocks, NLA, Drivers, Keyframes.

For this to work correctly, a standard set of data needs to be available within the scope that this

Gets called in:

  • ListBaseT<bAnimListElem> anim_data;
  • bDopeSheet *ads;
  • bAnimListElem *ale;
  • size_t items;
  • id: ID block which should have an AnimData pointer following it immediately, to use
  • adtOk: line or block of code to execute for AnimData-blocks case (usually #ANIMDATA_ADD_ANIMDATA).
  • nlaOk: line or block of code to execute for NLA tracks+strips case
  • driversOk: line or block of code to execute for Drivers case
  • nlaKeysOk: line or block of code for NLA Strip Keyframes case
  • legacyActionOk: line or block of code for Keyframes from legacy Actions
  • layeredActionOk: line or block of code for Keyframes from layered Actions

The checks for the various cases are as follows: 0) top level: checks for animdata and also that all the F-Curves for the block will be visible 1) animdata check: for filtering animdata blocks only 2A) nla tracks: include animdata block's data as there are NLA tracks+strips there 2B) actions to convert to nla: include animdata block's data as there is an action that can be converted to a new NLA strip, and the filtering options allow this 2C) allow non-animated data-blocks to be included so that data-blocks can be added 3) drivers: include drivers from animdata block (for Drivers mode in Graph Editor) 4A) nla strip keyframes: these are the per-strip controls for time and influence 4B) normal keyframes: only when there is an active action 4C) normal keyframes: only when there is an Animation assigned

Definition at line 547 of file anim_filter.cc.

Referenced by blender::animdata_filter_ds_obanim(), blender::animdata_filter_ds_scene(), and blender::animfilter_block_data().

◆ ANIMDATA_HAS_ACTION

#define ANIMDATA_HAS_ACTION ( id)
Value:
((id)->adt && (id)->adt->action)

Definition at line 502 of file anim_filter.cc.

◆ ANIMDATA_HAS_DRIVERS

#define ANIMDATA_HAS_DRIVERS ( id)
Value:
((id)->adt && (id)->adt->drivers.first_)

Definition at line 505 of file anim_filter.cc.

◆ ANIMDATA_HAS_NLA

#define ANIMDATA_HAS_NLA ( id)
Value:
((id)->adt && (id)->adt->nla_tracks.first_)

Definition at line 508 of file anim_filter.cc.

◆ BEGIN_ANIMFILTER_SUBCHANNELS

◆ END_ANIMFILTER_SUBCHANNELS