2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-22 08:13:25 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-22 08:13:25 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spaction
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* System includes ----------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
/* Types --------------------------------------------------------------- */
|
|
|
|
|
|
2009-01-20 11:07:42 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2018-04-19 16:04:26 +02:00
|
|
|
#include "DNA_cachefile_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2018-04-19 16:04:26 +02:00
|
|
|
#include "DNA_scene_types.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
#include "BKE_action.h"
|
|
|
|
|
#include "BKE_context.h"
|
2018-04-19 16:04:26 +02:00
|
|
|
#include "BKE_pointcache.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2018-06-04 09:31:30 +02:00
|
|
|
/* Everything from source (BIF, BDR, BSE) ------------------------------ */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
|
2018-04-19 16:04:26 +02:00
|
|
|
#include "GPU_immediate.h"
|
|
|
|
|
#include "GPU_matrix.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2018-04-19 16:04:26 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_anim_api.h"
|
|
|
|
|
#include "ED_keyframes_draw.h"
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
#include "action_intern.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2008-12-22 09:43:54 +00:00
|
|
|
/* ************************************************************************* */
|
|
|
|
|
/* Channel List */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
/* left hand part */
|
2018-06-04 09:31:30 +02:00
|
|
|
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
float y = 0.0f;
|
2011-06-21 04:01:51 +00:00
|
|
|
size_t items;
|
|
|
|
|
int height;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* build list of channels to draw */
|
2012-05-08 16:02:13 +00:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
|
|
|
|
items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
height = ((items * ACHANNEL_STEP(ac)) + (ACHANNEL_HEIGHT(ac)));
|
2012-09-15 11:48:20 +00:00
|
|
|
if (height > BLI_rcti_size_y(&v2d->mask)) {
|
2018-06-04 09:31:30 +02:00
|
|
|
/* don't use totrect set, as the width stays the same
|
|
|
|
|
* (NOTE: this is ok here, the configuration is pretty straightforward)
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
*/
|
2012-03-24 02:51:46 +00:00
|
|
|
v2d->tot.ymin = (float)(-height);
|
2.5 - Action Editor: All Keyframe Selection Tools Ported
User Notes (for using tools whose behaviour has changed):
* Mouse Selection Tools:
1) Click on keyframe to modify its selection. Holding the 'Shift' modifier when doing so, will result in keyframe selection being toggled instead of replacing existing selections.
2) Click on either side of the current frame indicator while holding the 'Alt' modifier. This will select only all the keyframes on the relevant side of the current frame indicator.
3) Click on a keyframe while holding the 'Ctrl' modifier. This will select all the keyframes that fall on that frame.
* Borderselect Tools
1) BKEY selects all the keyframes within the specified range (as per normal)
2) ALT-BKEY will select either all the keyframes in the frame-range specified or the channel range specified, depending on which axis of the select region was larger. This method is prejudiced towards frame-range selection.
Code Notes:
* Finished porting over all of the remaining keyframe selection tools, and recoded the ported ones to make them easier to use (after running into some technical limitations)
* Simplified the way to check if 'animation context' is valid by moving a necessary check into that function.
* Refactored internal keyframe-looping tools to reduce the amount of code needed per tool to edit keyframes, removing a lot of the unnecessary bulk. Now, the ipo/icu_keys_bezier_loop functions recieve a few more arguments (1st arg is pointer to generic customdata, and another defines a validation callback which makes it easier to reuse some of the select callbacks).
* Added 'totrect' adjustment for number of channels being shown in Action Editor, so that scrolling will be limited to where there is data (and also so that scroller displays more relevant context info).
For this to work, filtering channels now returns the number of channels extracted. This may come into use for other tools if there's such a need.
* I still need to port over some code for markers, which is required for some of the tools which use them. For now, those tools do nothing.
* Grease-Pencil editing mode in Action Editor is currently non-functional (code is commented out due to missing dependencies). This is currently pending the re-implementation of Grease Pencil in 2.5
2008-12-26 10:55:07 +00:00
|
|
|
}
|
2010-10-16 05:07:33 +00:00
|
|
|
/* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
|
|
|
|
|
UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
/* loop through channels, and set up drawing depending on their type */
|
2012-05-08 16:02:13 +00:00
|
|
|
{ /* first pass: just the standard GL-drawing for backdrop + text */
|
2015-04-04 01:38:56 +13:00
|
|
|
size_t channel_index = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
y = (float)ACHANNEL_FIRST(ac);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2016-07-03 03:42:28 +12:00
|
|
|
float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
|
|
|
|
|
float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-16 02:21:43 +00:00
|
|
|
/* check if visible */
|
2012-05-08 16:02:13 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2009-08-16 02:21:43 +00:00
|
|
|
{
|
|
|
|
|
/* draw all channels using standard channel-drawing API */
|
2015-04-04 01:38:56 +13:00
|
|
|
ANIM_channel_draw(ac, ale, yminc, ymaxc, channel_index);
|
2009-08-16 02:21:43 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-16 02:21:43 +00:00
|
|
|
/* adjust y-position for next one */
|
2016-07-03 03:42:28 +12:00
|
|
|
y -= ACHANNEL_STEP(ac);
|
2015-04-04 01:38:56 +13:00
|
|
|
channel_index++;
|
2009-08-16 02:21:43 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-08 16:02:13 +00:00
|
|
|
{ /* second pass: widgets */
|
2014-11-09 21:20:40 +01:00
|
|
|
uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
size_t channel_index = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
y = (float)ACHANNEL_FIRST(ac);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2016-07-03 03:42:28 +12:00
|
|
|
float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
|
|
|
|
|
float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-16 02:21:43 +00:00
|
|
|
/* check if visible */
|
2012-05-08 16:02:13 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2009-08-16 02:21:43 +00:00
|
|
|
{
|
|
|
|
|
/* draw all channels using standard channel-drawing API */
|
2019-03-18 17:28:36 +01:00
|
|
|
rctf channel_rect;
|
|
|
|
|
BLI_rctf_init(&channel_rect, 0, v2d->cur.xmax, yminc, ymaxc);
|
|
|
|
|
ANIM_channel_draw_widgets(C, ac, ale, block, &channel_rect, channel_index);
|
2009-08-16 02:21:43 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-08-16 02:21:43 +00:00
|
|
|
/* adjust y-position for next one */
|
2016-07-03 03:42:28 +12:00
|
|
|
y -= ACHANNEL_STEP(ac);
|
Animation channels can now be renamed by Ctrl-Clicking on them, as in
the Outliner
Channels which can be renamed include:
- Scenes, Objects, World, Material, Texture, etc. (i.e. "ID-blocks",
or the dark and light blue channels)
- Action Groups (green channels)
- Action expanders (i.e. "CubeAction", "WorldAction", etc.)
- Grease Pencil stuff
Channels which CANNOT be renamed, as they mostly use hardcoded values
or otherwise include:
- Drivers expander
- FCurves (they don't technically have a "name"; what is shown is just
a user-friendly representation of their rna_paths)
2011-08-03 01:22:31 +00:00
|
|
|
channel_index++;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_end(C, block);
|
|
|
|
|
UI_block_draw(C, block);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* free tempolary channels */
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-22 09:43:54 +00:00
|
|
|
/* ************************************************************************* */
|
|
|
|
|
/* Keyframes */
|
|
|
|
|
|
2009-07-09 13:14:51 +00:00
|
|
|
/* extra padding for lengths (to go under scrollers) */
|
2012-05-08 16:02:13 +00:00
|
|
|
#define EXTRA_SCROLL_PAD 100.0f
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2008-12-22 09:43:54 +00:00
|
|
|
/* draw keyframes in each channel */
|
|
|
|
|
void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
View2D *v2d = &ar->v2d;
|
|
|
|
|
bDopeSheet *ads = &saction->ads;
|
|
|
|
|
AnimData *adt = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-09 13:14:51 +00:00
|
|
|
float act_start, act_end, y;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-18 23:48:06 +03:00
|
|
|
unsigned char col1[4], col2[4];
|
|
|
|
|
unsigned char col1a[4], col2a[4];
|
|
|
|
|
unsigned char col1b[4], col2b[4];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2017-01-20 18:14:28 +13:00
|
|
|
const bool show_group_colors = !(saction->flag & SACTION_NODRAWGCOLORS);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* get theme colors */
|
2018-10-18 23:48:06 +03:00
|
|
|
UI_GetThemeColor4ubv(TH_SHADE2, col2);
|
|
|
|
|
UI_GetThemeColor4ubv(TH_HILITE, col1);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-18 23:48:06 +03:00
|
|
|
UI_GetThemeColor4ubv(TH_GROUP, col2a);
|
|
|
|
|
UI_GetThemeColor4ubv(TH_GROUP_ACTIVE, col1a);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-18 23:48:06 +03:00
|
|
|
UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELOB, col1b);
|
|
|
|
|
UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* set view-mapping rect (only used for x-axis), for NLA-scaling mapping with less calculation */
|
|
|
|
|
|
|
|
|
|
/* if in NLA there's a strip active, map the view */
|
2008-12-22 09:43:54 +00:00
|
|
|
if (ac->datatype == ANIMCONT_ACTION) {
|
2012-10-26 04:14:10 +00:00
|
|
|
/* adt = ANIM_nla_mapping_get(ac, NULL); */ /* UNUSED */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* start and end of action itself */
|
2009-07-09 13:14:51 +00:00
|
|
|
calc_action_range(ac->data, &act_start, &act_end, 0);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* build list of channels to draw */
|
2017-02-11 00:24:59 -05:00
|
|
|
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
|
|
|
|
size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
int height = ((items * ACHANNEL_STEP(ac)) + (ACHANNEL_HEIGHT(ac)));
|
2018-06-04 09:31:30 +02:00
|
|
|
/* don't use totrect set, as the width stays the same
|
|
|
|
|
* (NOTE: this is ok here, the configuration is pretty straightforward)
|
2009-02-19 17:13:04 +00:00
|
|
|
*/
|
2012-03-24 02:51:46 +00:00
|
|
|
v2d->tot.ymin = (float)(-height);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* first backdrop strips */
|
2016-07-03 03:42:28 +12:00
|
|
|
y = (float)(-ACHANNEL_HEIGHT(ac));
|
2016-11-14 22:54:56 -05:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2016-11-14 22:54:56 -05:00
|
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2016-07-03 03:42:28 +12:00
|
|
|
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
|
|
|
|
|
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* check if visible */
|
2012-05-08 16:02:13 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2015-03-30 21:29:20 +11:00
|
|
|
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
2012-05-08 16:02:13 +00:00
|
|
|
int sel = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* determine if any need to draw channel */
|
|
|
|
|
if (ale->datatype != ALE_NONE) {
|
|
|
|
|
/* determine if channel is selected */
|
2009-08-24 04:31:13 +00:00
|
|
|
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
|
2012-05-08 16:02:13 +00:00
|
|
|
sel = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
|
2016-11-14 22:54:56 -05:00
|
|
|
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
|
2008-12-22 08:13:25 +00:00
|
|
|
switch (ale->type) {
|
2009-10-13 11:21:02 +00:00
|
|
|
case ANIMTYPE_SUMMARY:
|
|
|
|
|
{
|
2012-06-04 01:17:37 +00:00
|
|
|
/* reddish color from NLA */
|
2017-02-07 20:53:20 -02:00
|
|
|
immUniformThemeColor(TH_ANIM_ACTIVE);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2009-10-13 11:21:02 +00:00
|
|
|
}
|
2009-02-13 06:33:07 +00:00
|
|
|
case ANIMTYPE_SCENE:
|
2008-12-22 08:13:25 +00:00
|
|
|
case ANIMTYPE_OBJECT:
|
|
|
|
|
{
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor3ubvAlpha(col1b, sel ? col1[3] : col1b[3]);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2009-01-22 10:53:22 +00:00
|
|
|
case ANIMTYPE_FILLACTD:
|
2008-12-22 08:13:25 +00:00
|
|
|
case ANIMTYPE_DSSKEY:
|
2009-02-13 06:33:07 +00:00
|
|
|
case ANIMTYPE_DSWOR:
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor3ubvAlpha(col2b, sel ? col1[3] : col2b[3]);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
case ANIMTYPE_GROUP:
|
|
|
|
|
{
|
2017-01-20 18:14:28 +13:00
|
|
|
bActionGroup *agrp = ale->data;
|
|
|
|
|
if (show_group_colors && agrp->customCol) {
|
|
|
|
|
if (sel) {
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor3ubvAlpha((unsigned char *)agrp->cs.select, col1a[3]);
|
2017-01-20 18:14:28 +13:00
|
|
|
}
|
|
|
|
|
else {
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor3ubvAlpha((unsigned char *)agrp->cs.solid, col2a[3]);
|
2017-01-20 18:14:28 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor4ubv(sel ? col1a : col2a);
|
2017-01-20 18:14:28 +13:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ANIMTYPE_FCURVE:
|
|
|
|
|
{
|
|
|
|
|
FCurve *fcu = ale->data;
|
|
|
|
|
if (show_group_colors && fcu->grp && fcu->grp->customCol) {
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor3ubvAlpha((unsigned char *)fcu->grp->cs.active, sel ? col1[3] : col2[3]);
|
2017-01-20 18:14:28 +13:00
|
|
|
}
|
|
|
|
|
else {
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor4ubv(sel ? col1 : col2);
|
2017-01-20 18:14:28 +13:00
|
|
|
}
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
2018-10-18 23:48:06 +03:00
|
|
|
immUniformColor4ubv(sel ? col1 : col2);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* draw region twice: firstly backdrop, then the current range */
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 09:43:54 +00:00
|
|
|
if (ac->datatype == ANIMCONT_ACTION)
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, act_start, (float)y - ACHANNEL_HEIGHT_HALF(ac), act_end, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2008-12-22 09:43:54 +00:00
|
|
|
else if (ac->datatype == ANIMCONT_GPENCIL) {
|
2008-12-22 08:13:25 +00:00
|
|
|
/* frames less than one get less saturated background */
|
2018-10-18 23:48:06 +03:00
|
|
|
unsigned char *color = sel ? col1 : col2;
|
|
|
|
|
immUniformColor4ubv(color);
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
/* frames one and higher get a saturated background */
|
2018-10-21 16:22:46 +11:00
|
|
|
immUniformColor3ubvAlpha(color, MIN2(255, color[3] * 2));
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2012-06-08 14:31:38 +00:00
|
|
|
}
|
|
|
|
|
else if (ac->datatype == ANIMCONT_MASK) {
|
|
|
|
|
/* TODO --- this is a copy of gpencil */
|
|
|
|
|
/* frames less than one get less saturated background */
|
2018-10-18 23:48:06 +03:00
|
|
|
unsigned char *color = sel ? col1 : col2;
|
|
|
|
|
immUniformColor4ubv(color);
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2012-06-08 14:31:38 +00:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* frames one and higher get a saturated background */
|
2018-10-21 16:22:46 +11:00
|
|
|
immUniformColor3ubvAlpha(color, MIN2(255, color[3] * 2));
|
2016-11-14 22:54:56 -05:00
|
|
|
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-11-14 12:53:15 +11:00
|
|
|
/* Increment the step */
|
2016-07-03 03:42:28 +12:00
|
|
|
y -= ACHANNEL_STEP(ac);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2017-02-11 00:24:59 -05:00
|
|
|
|
|
|
|
|
/* black line marking 'current frame' for Time-Slide transform mode */
|
|
|
|
|
if (saction->flag & SACTION_MOVING) {
|
|
|
|
|
immUniformColor3f(0.0f, 0.0f, 0.0f);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
2017-02-11 00:24:59 -05:00
|
|
|
immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD);
|
|
|
|
|
immVertex2f(pos, saction->timeslide, v2d->cur.ymax);
|
|
|
|
|
immEnd();
|
|
|
|
|
}
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
|
|
|
|
|
/* Draw keyframes
|
2018-11-14 12:53:15 +11:00
|
|
|
* 1) Only channels that are visible in the Action Editor get drawn/evaluated.
|
|
|
|
|
* This is to try to optimize this for heavier data sets
|
|
|
|
|
* 2) Keyframes which are out of view horizontally are disregarded
|
2008-12-22 08:13:25 +00:00
|
|
|
*/
|
2016-07-03 03:42:28 +12:00
|
|
|
y = (float)(-ACHANNEL_HEIGHT(ac));
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2012-05-08 16:02:13 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2016-07-03 03:42:28 +12:00
|
|
|
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
|
|
|
|
|
const float ymaxc = (float)(y + ACHANNEL_HEIGHT_HALF(ac));
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* check if visible */
|
2012-05-08 16:02:13 +00:00
|
|
|
if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
|
|
|
|
|
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
|
|
|
|
/* check if anything to show for this channel */
|
|
|
|
|
if (ale->datatype != ALE_NONE) {
|
2012-05-08 16:02:13 +00:00
|
|
|
adt = ANIM_nla_mapping_get(ac, ale);
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* draw 'keyframes' for each specific datatype */
|
|
|
|
|
switch (ale->datatype) {
|
2009-10-13 11:21:02 +00:00
|
|
|
case ALE_ALL:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_summary_channel(v2d, ale->data, y, ac->yscale_fac, saction->flag);
|
2009-10-13 11:21:02 +00:00
|
|
|
break;
|
2009-02-13 06:33:07 +00:00
|
|
|
case ALE_SCE:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_scene_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
|
2009-02-13 06:33:07 +00:00
|
|
|
break;
|
2008-12-22 08:13:25 +00:00
|
|
|
case ALE_OB:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_object_channel(v2d, ads, ale->key_data, y, ac->yscale_fac, saction->flag);
|
2008-12-22 08:13:25 +00:00
|
|
|
break;
|
|
|
|
|
case ALE_ACT:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_action_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
|
2008-12-22 08:13:25 +00:00
|
|
|
break;
|
|
|
|
|
case ALE_GROUP:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_agroup_channel(v2d, adt, ale->data, y, ac->yscale_fac, saction->flag);
|
2008-12-22 08:13:25 +00:00
|
|
|
break;
|
2009-01-20 11:07:42 +00:00
|
|
|
case ALE_FCURVE:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_fcurve_channel(v2d, adt, ale->key_data, y, ac->yscale_fac, saction->flag);
|
2008-12-22 08:13:25 +00:00
|
|
|
break;
|
|
|
|
|
case ALE_GPFRAME:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_gpl_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
|
2008-12-22 08:13:25 +00:00
|
|
|
break;
|
2012-06-08 14:31:38 +00:00
|
|
|
case ALE_MASKLAY:
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
draw_masklay_channel(v2d, ads, ale->data, y, ac->yscale_fac, saction->flag);
|
2012-06-08 14:31:38 +00:00
|
|
|
break;
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
y -= ACHANNEL_STEP(ac);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
/* free temporary channels used for drawing */
|
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-04-19 16:04:26 +02:00
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
|
/* Timeline - Caches */
|
|
|
|
|
|
|
|
|
|
void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
PTCacheID *pid;
|
|
|
|
|
ListBase pidlist;
|
|
|
|
|
const float cache_draw_height = (4.0f * UI_DPI_FAC * U.pixelsize);
|
|
|
|
|
float yoffs = 0.f;
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2018-04-19 16:04:26 +02:00
|
|
|
if (!(saction->cache_display & TIME_CACHE_DISPLAY) || (!ob))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2018-04-19 16:04:26 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
|
2018-04-19 16:28:27 +02:00
|
|
|
/* iterate over pointcaches on the active object, and draw each one's range */
|
2018-04-19 16:04:26 +02:00
|
|
|
for (pid = pidlist.first; pid; pid = pid->next) {
|
|
|
|
|
float col[4];
|
|
|
|
|
|
|
|
|
|
switch (pid->type) {
|
|
|
|
|
case PTCACHE_TYPE_SOFTBODY:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_SOFTBODY)) continue;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_PARTICLES:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_PARTICLES)) continue;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_CLOTH:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_CLOTH)) continue;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_SMOKE_DOMAIN:
|
|
|
|
|
case PTCACHE_TYPE_SMOKE_HIGHRES:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_SMOKE)) continue;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_DYNAMICPAINT:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_DYNAMICPAINT)) continue;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_RIGIDBODY:
|
|
|
|
|
if (!(saction->cache_display & TIME_CACHE_RIGIDBODY)) continue;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pid->cache->cached_frames == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
|
|
|
|
GPU_matrix_translate_2f(0.0, (float)V2D_SCROLL_HEIGHT_TEXT + yoffs);
|
|
|
|
|
GPU_matrix_scale_2f(1.0, cache_draw_height);
|
2018-06-04 09:39:04 +02:00
|
|
|
|
2018-04-19 16:04:26 +02:00
|
|
|
switch (pid->type) {
|
|
|
|
|
case PTCACHE_TYPE_SOFTBODY:
|
|
|
|
|
col[0] = 1.0; col[1] = 0.4; col[2] = 0.02;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_PARTICLES:
|
|
|
|
|
col[0] = 1.0; col[1] = 0.1; col[2] = 0.02;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_CLOTH:
|
|
|
|
|
col[0] = 0.1; col[1] = 0.1; col[2] = 0.75;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_SMOKE_DOMAIN:
|
|
|
|
|
case PTCACHE_TYPE_SMOKE_HIGHRES:
|
|
|
|
|
col[0] = 0.2; col[1] = 0.2; col[2] = 0.2;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_DYNAMICPAINT:
|
|
|
|
|
col[0] = 1.0; col[1] = 0.1; col[2] = 0.75;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
case PTCACHE_TYPE_RIGIDBODY:
|
|
|
|
|
col[0] = 1.0; col[1] = 0.6; col[2] = 0.0;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
col[0] = 1.0; col[1] = 0.0; col[2] = 1.0;
|
|
|
|
|
col[3] = 0.1;
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int sta = pid->cache->startframe, end = pid->cache->endframe;
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2018-04-19 16:04:26 +02:00
|
|
|
|
|
|
|
|
immUniformColor4fv(col);
|
|
|
|
|
immRectf(pos, (float)sta, 0.0, (float)end, 1.0);
|
|
|
|
|
|
|
|
|
|
col[3] = 0.4f;
|
|
|
|
|
if (pid->cache->flag & PTCACHE_BAKED) {
|
|
|
|
|
col[0] -= 0.4f; col[1] -= 0.4f; col[2] -= 0.4f;
|
|
|
|
|
}
|
|
|
|
|
else if (pid->cache->flag & PTCACHE_OUTDATED) {
|
|
|
|
|
col[0] += 0.4f; col[1] += 0.4f; col[2] += 0.4f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
immUniformColor4fv(col);
|
|
|
|
|
|
2018-11-16 19:26:23 +01:00
|
|
|
{
|
|
|
|
|
/* draw a quad for each chunk of consecutive cached frames */
|
|
|
|
|
const int chunk_tot = 32;
|
|
|
|
|
int chunk_len = 0;
|
|
|
|
|
int ista = 0, iend = -1;
|
2018-04-19 16:04:26 +02:00
|
|
|
|
|
|
|
|
for (int i = sta; i <= end; i++) {
|
|
|
|
|
if (pid->cache->cached_frames[i - sta]) {
|
2018-11-16 19:26:23 +01:00
|
|
|
if (chunk_len == 0) {
|
|
|
|
|
immBeginAtMost(GPU_PRIM_TRIS, chunk_tot * 6);
|
|
|
|
|
}
|
|
|
|
|
if (ista > iend) {
|
|
|
|
|
chunk_len++;
|
|
|
|
|
ista = i;
|
|
|
|
|
}
|
|
|
|
|
iend = i;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (ista <= iend) {
|
|
|
|
|
immRectf_fast(pos, (float)ista - 0.5f, 0.0f, (float)iend + 0.5f, 1.0f);
|
|
|
|
|
iend = ista - 1;
|
|
|
|
|
}
|
|
|
|
|
if (chunk_len >= chunk_tot) {
|
|
|
|
|
immEnd();
|
|
|
|
|
chunk_len = 0;
|
|
|
|
|
}
|
2018-04-19 16:04:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
2018-11-16 19:26:23 +01:00
|
|
|
if (ista <= iend) {
|
|
|
|
|
immRectf_fast(pos, (float)ista - 0.5f, 0.0f, (float)iend + 0.5f, 1.0f);
|
|
|
|
|
}
|
|
|
|
|
if (chunk_len != 0) {
|
|
|
|
|
immEnd();
|
|
|
|
|
}
|
2018-04-19 16:04:26 +02:00
|
|
|
}
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2018-04-19 16:04:26 +02:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2018-04-19 16:04:26 +02:00
|
|
|
|
|
|
|
|
yoffs += cache_draw_height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
|
|
|
|
|
BLI_freelistN(&pidlist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|