61 const ListBaseT<bAnimListElem> &anim_data)
71 size_t channel_index = 0;
74 for (ale = anim_data.first(); ale; ale = ale->
next, ymax -= channel_step, channel_index++) {
88 size_t channel_index = 0;
91 for (ale = anim_data.first(); ale; ale = ale->
next, ymax -= channel_step, channel_index++) {
106 block_draw(
C, block);
117#define EXTRA_SCROLL_PAD 100.0f
130 float ymin = ymax - ystep;
132 for (
bAnimListElem *ale = anim_data->first(); ale; ale = ale->
next, ymax = ymin, ymin -= ystep) {
151 if (action != cur_action || adt != cur_adt) {
169 ListBaseT<bAnimListElem> &anim_data,
173 uchar col1[4], col2[4];
174 uchar col1a[4], col2a[4];
175 uchar col1b[4], col2b[4];
176 uchar col_summary[4];
192 for (ale = anim_data.first(); ale; ale = ale->
next, ymax -= channel_step) {
257 color = sel ? col1a : col2a;
262 color[3] = sel ? col1[3] : col2b[3];
266 color = sel ? col1 : col2;
286 color = sel ? col1 : col2;
314 const ListBaseT<bAnimListElem> &anim_data)
321 int action_flag = saction->
flag;
336 for (ale = anim_data.first(); ale; ale = ale->
next, ymax -= channel_step) {
338 float ycenter = (ymin + ymax) / 2.0f;
356 draw_list,
static_cast<bAnimContext *
>(ale->
data), ycenter, scale_factor, action_flag);
469 ListBaseT<bAnimListElem> *anim_data)
605 float color_state[4])
608 color[3] = color_state[3] = 1.0f;
611 color[3] = color_state[3] = 0.7f;
615 color[3] = color_state[3] = 0.7f;
620 int search_start_frame,
621 int *r_segment_start,
625 int current = search_start_frame;
633 *r_segment_start = current;
642 *r_segment_end = current - 1;
646 *r_segment_end = current - 1;
662 current = segment_end + 1;
671 if (segments_count == 0) {
681 immRectf_fast(pos_id, segment_start, 0, segment_end + 1.0f, 1.0f);
682 current = segment_end + 1;
728 const bool all_simulations_baked,
730 const float line_height,
737 bool has_bake =
false;
739 for (
const CacheRange &sim_range : cache_ranges) {
740 switch (sim_range.status) {
751 for (
const CacheRange &sim_range : cache_ranges) {
752 status_change_frames_set.
add(sim_range.frames.first());
753 status_change_frames_set.
add(sim_range.frames.one_after_last());
756 status_change_frames.
extend(status_change_frames_set.
begin(), status_change_frames_set.
end());
757 std::ranges::sort(status_change_frames);
768 invalid_color.
a *= 0.7f;
770 valid_color.
a *= 0.7f;
773 float max_used_height = 1.0f;
774 for (
const int range_i : frame_ranges.
index_range()) {
775 const IndexRange frame_range = frame_ranges[range_i];
776 const int start_frame = frame_range.
first();
777 const int end_frame = frame_range.
last();
779 bool has_bake_at_frame =
false;
780 bool has_valid_at_frame =
false;
781 bool has_invalid_at_frame =
false;
782 for (
const CacheRange &sim_range : cache_ranges) {
783 if (sim_range.frames.contains(start_frame)) {
784 switch (sim_range.status) {
786 has_invalid_at_frame =
true;
789 has_valid_at_frame =
true;
792 has_bake_at_frame =
true;
797 if (!(has_bake_at_frame || has_valid_at_frame || has_invalid_at_frame)) {
801 if (all_simulations_baked) {
805 immRectf_fast(pos_id, start_frame, 0, end_frame + 1.0f, 1.0f);
809 if (has_valid_at_frame || has_invalid_at_frame) {
811 immUniform4fv(
"color2", has_invalid_at_frame ? invalid_color : valid_color);
813 const float top = has_bake ? 2.0f : 1.0f;
814 immRectf_fast(pos_id, start_frame, 0.0f, end_frame + 1.0f, top);
816 max_used_height = top;
818 if (has_bake_at_frame) {
822 immRectf_fast(pos_id, start_frame, 0, end_frame + 1.0f, 1.0f);
829 *y_offset += max_used_height * 2;
835 const float y_offset,
836 const float line_height,
851 immRectf_fast(pos_id, range.start, 0.0f, range.end + 1.0f, 1.0f);
872 const float cache_draw_height = 4.0f *
UI_SCALE_FAC *
U.pixelsize;
876 float y_offset = 0.0f;
880 if (!cached_frame_ranges.
is_empty()) {
882 y_offset += cache_draw_height;
891 ListBaseT<PTCacheID> pidlist;
898 if (pid.cache->cached_frames ==
nullptr) {
904 y_offset += cache_draw_height;
906 pidlist.free_no_destruct();
910 bool all_simulations_baked =
true;
928 std::lock_guard
lock{modifier_cache.
mutex};
932 all_simulations_baked =
false;
936 all_simulations_baked =
false;
957 cache_ranges, all_simulations_baked, &y_offset, cache_draw_height, pos_id);
Functions and classes to work with Actions.
#define PTCACHE_TYPE_SMOKE_HIGHRES
#define PTCACHE_TYPE_CLOTH
#define PTCACHE_TYPE_DYNAMICPAINT
#define PTCACHE_TYPE_PARTICLES
#define PTCACHE_TYPE_SOFTBODY
#define PTCACHE_TYPE_SMOKE_DOMAIN
#define PTCACHE_TYPE_RIGIDBODY
#define BLI_SCOPED_DEFER(function_to_defer)
Object is a sort of wrapper for general info.
#define V2D_SCROLL_HANDLE_HEIGHT
#define BLI_assert_unreachable()
#define IN_RANGE(a, b, c)
constexpr int64_t first() const
constexpr int64_t last(const int64_t n=0) const
constexpr bool is_empty() const
void append(const T &value)
void extend(Span< T > array)
Span< T > as_span() const
bke::compositor::Cache cache
CompositorRuntime compositor
IndexRange index_range() const
void get_color_4ubv(int colorid, unsigned char col[4])
void get_color_4fv(int colorid, float col[4])
void view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index)
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region, const ListBaseT< bAnimListElem > &anim_data)
void ED_add_grease_pencil_datablock_channel(ChannelDrawList *channel_list, bAnimContext *ac, bAnimListElem *ale, const GreasePencil *grease_pencil, const float ypos, const float yscale_fac, int saction_flag)
const bAnimChannelType * ANIM_channel_get_typeinfo(const bAnimListElem *ale)
void immUniformColor3f(float r, float g, float b)
ChannelDrawList * ED_channel_draw_list_create()
static void timeline_cache_draw_geometry_nodes(const Span< CacheRange > cache_ranges, const bool all_simulations_baked, float *y_offset, const float line_height, const uint pos_id)
void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region, ListBaseT< bAnimListElem > *anim_data)
void ANIM_draw_action_framerange(AnimData *adt, bAction *action, View2D *v2d, float ymin, float ymax)
void immBeginAtMost(GPUPrimType, uint max_vertex_len)
GPUVertFormat * immVertexFormat()
void immBegin(GPUPrimType, uint vertex_len)
static void draw_backdrops(bAnimContext *ac, ListBaseT< bAnimListElem > &anim_data, View2D *v2d, uint pos)
static bool timeline_cache_find_next_cached_segment(PointCache *cache, int search_start_frame, int *r_segment_start, int *r_segment_end)
@ TH_DOPESHEET_CHANNELSUBOB
@ USER_ANIM_SHOW_CHANNEL_GROUP_COLORS
@ ANIMTYPE_GREASE_PENCIL_LAYER_GROUP
@ ANIMTYPE_GREASE_PENCIL_DATABLOCK
@ ANIMTYPE_FILLACT_LAYERED
static bool timeline_cache_is_hidden_by_setting(const SpaceAction *saction, const PTCacheID *pid)
void ED_add_mask_layer_channel(ChannelDrawList *channel_list, bDopeSheet *ads, MaskLayer *masklay, float ypos, float yscale_fac, int saction_flag)
static void timeline_cache_draw_single(PTCacheID *pid, float y_offset, float height, uint pos_id)
MINLINE void mul_v3_fl(float r[3], float f)
void GPU_matrix_scale_2f(float x, float y)
float ANIM_UI_get_channel_height()
@ TIME_CACHE_DYNAMICPAINT
@ TIME_CACHE_SIMULATION_NODES
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void ED_add_grease_pencil_layer_group_channel(ChannelDrawList *channel_list, bDopeSheet *ads, const GreasePencilLayerTreeGroup *layer_group, const float ypos, const float yscale_fac, int saction_flag)
float ANIM_UI_get_first_channel_top(View2D *v2d)
@ ACHANNEL_SETTING_EXPAND
@ ACHANNEL_SETTING_SELECT
void immUniformThemeColor(int color_id)
@ ALE_GREASE_PENCIL_GROUP
void ED_add_fcurve_channel(ChannelDrawList *channel_list, bAnimListElem *ale, FCurve *fcu, float ypos, float yscale_fac, int saction_flag)
void immVertex2f(uint attr_id, float x, float y)
static void draw_keyframes(bAnimContext *ac, View2D *v2d, SpaceAction *saction, const ListBaseT< bAnimListElem > &anim_data)
void ED_add_scene_channel(ChannelDrawList *channel_list, bDopeSheet *ads, Scene *sce, float ypos, float yscale_fac, int saction_flag)
@ GPU_SHADER_2D_DIAG_STRIPES
@ GPU_SHADER_3D_UNIFORM_COLOR
@ NODES_MODIFIER_BAKE_MODE_STILL
void immUniform4fv(const char *name, const float data[4])
void ED_add_summary_channel(ChannelDrawList *channel_list, bAnimContext *ac, float ypos, float yscale_fac, int saction_flag)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
void BKE_ptcache_ids_from_object(ListBaseT< PTCacheID > *lb, struct Object *ob, struct Scene *scene, int duplis)
void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListElem *ale, ui::Block *block, const rctf *rect, size_t channel_index)
void GPU_matrix_translate_2f(float x, float y)
bAction * ANIM_channel_action_get(const bAnimListElem *ale)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
static void timeline_cache_draw_compositor(const Vector< bke::compositor::Cache::FrameRange > cached_frame_ranges, const float y_offset, const float line_height, const uint pos_id)
void ED_channel_list_free(ChannelDrawList *channel_list)
float ANIM_UI_get_channel_skip()
static void timeline_cache_color_get(PTCacheID *pid, float color[4])
void ED_add_action_slot_channel(ChannelDrawList *channel_list, bAnimContext *ac, bAnimListElem *ale, animrig::Action &action, animrig::Slot &slot, const float ypos, const float yscale_fac, int saction_flag)
void ANIM_animdata_freelist(ListBaseT< bAnimListElem > *anim_data)
static void timeline_cache_modify_color_based_on_state(PointCache *cache, float color[4], float color_state[4])
void ED_channel_list_flush(ChannelDrawList *channel_list, View2D *v2d)
void immRectf_fast(uint pos, float x1, float y1, float x2, float y2)
void ED_add_object_channel(ChannelDrawList *channel_list, bDopeSheet *ads, Object *ob, float ypos, float yscale_fac, int saction_flag)
float ANIM_UI_get_keyframe_scale_factor()
static uint timeline_cache_segments_count(PointCache *cache)
static void draw_channel_action_ranges(ListBaseT< bAnimListElem > *anim_data, View2D *v2d)
MINLINE void copy_v4_v4(float r[4], const float a[4])
ColorTheme4< float > ColorTheme4f
@ SACTION_SHOW_INTERPOLATION
void GPU_blend(GPUBlend blend)
void immUniform1i(const char *name, int x)
void ED_add_action_layered_channel(ChannelDrawList *channel_list, bAnimContext *ac, bAnimListElem *ale, bAction *action, const float ypos, const float yscale_fac, int saction_flag)
void timeline_draw_cache(const SpaceAction *saction, const Object *ob, const Scene *scene)
void immUniformColor4ubv(const unsigned char rgba[4])
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a)
void ED_add_action_group_channel(ChannelDrawList *channel_list, bAnimListElem *ale, bActionGroup *agrp, float ypos, float yscale_fac, int saction_flag)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void ED_add_grease_pencil_layer_legacy_channel(ChannelDrawList *channel_list, bDopeSheet *ads, bGPDlayer *gpl, float ypos, float yscale_fac, int saction_flag)
float ANIM_UI_get_channel_step()
static void timeline_cache_draw_cached_segments(PointCache *cache, uint pos_id)
void ED_add_grease_pencil_cels_channel(ChannelDrawList *channel_list, bDopeSheet *ads, const GreasePencilLayer *layer, const float ypos, const float yscale_fac, int saction_flag)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
bke::bake::CacheStatus status
struct bNodeTree * node_group
NodesModifierRuntime * runtime
std::shared_ptr< bke::bake::ModifierCache > cache
ListBaseT< ModifierData > modifiers
struct PointCache * cache
bke::SceneRuntime * runtime
eTimeline_Cache_Flag cache_display
bool(*) has_setting(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
bool(*) get_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
Map< int, std::unique_ptr< SimulationNodeCache > > simulation_cache_by_id
Map< int, std::unique_ptr< BakeNodeCache > > bake_cache_by_id
IndexRange frame_range() const
Vector< std::unique_ptr< FrameCache > > frames
Vector< FrameRange > compute_frame_ranges()