2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-01-12 19:02:08 +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.
|
2009-01-12 19:02:08 +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 spseq
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
#include <math.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <string.h>
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2021-01-11 17:39:58 +11:00
|
|
|
#include "BLI_string_utils.h"
|
2014-11-24 18:18:35 +01:00
|
|
|
#include "BLI_threads.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_utildefines.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_anim_types.h"
|
2012-06-07 18:24:36 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2017-08-11 18:02:54 +02:00
|
|
|
#include "DNA_object_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_scene_types.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_sound_types.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_fcurve.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "BKE_global.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_scene.h"
|
2010-02-07 23:41:17 +00:00
|
|
|
#include "BKE_sound.h"
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "IMB_colormanagement.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "GPU_framebuffer.h"
|
2016-10-13 23:28:11 +00:00
|
|
|
#include "GPU_immediate.h"
|
2017-04-05 18:30:14 +10:00
|
|
|
#include "GPU_immediate_util.h"
|
2017-03-21 17:49:21 -04:00
|
|
|
#include "GPU_matrix.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2020-02-17 16:02:36 +01:00
|
|
|
#include "GPU_vertex_buffer.h"
|
2020-08-18 14:43:18 +02:00
|
|
|
#include "GPU_viewport.h"
|
2015-11-28 01:20:28 +01:00
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "ED_anim_api.h"
|
2012-06-11 00:21:50 +00:00
|
|
|
#include "ED_gpencil.h"
|
2009-11-26 12:22:43 +00:00
|
|
|
#include "ED_markers.h"
|
2012-06-07 19:24:49 +00:00
|
|
|
#include "ED_mask.h"
|
2015-05-04 12:17:49 +02:00
|
|
|
#include "ED_screen.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "ED_sequencer.h"
|
2012-06-07 19:24:49 +00:00
|
|
|
#include "ED_space_api.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "ED_time_scrub_ui.h"
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2019-04-20 12:47:06 +02:00
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
2020-12-19 06:44:57 +01:00
|
|
|
#include "SEQ_effects.h"
|
|
|
|
#include "SEQ_prefetch.h"
|
|
|
|
#include "SEQ_proxy.h"
|
|
|
|
#include "SEQ_relations.h"
|
|
|
|
#include "SEQ_render.h"
|
|
|
|
#include "SEQ_select.h"
|
2020-11-01 21:03:31 +01:00
|
|
|
#include "SEQ_sequencer.h"
|
2020-12-19 06:44:57 +01:00
|
|
|
#include "SEQ_time.h"
|
|
|
|
#include "SEQ_transform.h"
|
|
|
|
#include "SEQ_utils.h"
|
2020-11-01 21:03:31 +01:00
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
#include "UI_resources.h"
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
#include "WM_api.h"
|
2019-09-13 17:21:54 -07:00
|
|
|
#include "WM_types.h"
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
#include "BLF_api.h"
|
|
|
|
|
2015-01-28 19:45:16 +01:00
|
|
|
#include "MEM_guardedalloc.h"
|
2014-11-24 18:18:35 +01:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Own include. */
|
2009-01-12 19:02:08 +00:00
|
|
|
#include "sequencer_intern.h"
|
|
|
|
|
2012-06-20 17:10:40 +00:00
|
|
|
#define SEQ_LEFTHANDLE 1
|
|
|
|
#define SEQ_RIGHTHANDLE 2
|
2020-03-19 00:24:09 +01:00
|
|
|
#define SEQ_HANDLE_SIZE 8.0f
|
2019-03-18 12:09:22 -07:00
|
|
|
#define SEQ_SCROLLER_TEXT_OFFSET 8
|
2020-03-19 00:24:09 +01:00
|
|
|
#define MUTE_ALPHA 120
|
|
|
|
|
2020-08-21 18:55:27 +02:00
|
|
|
/* Note, Don't use SEQ_ALL_BEGIN/SEQ_ALL_END while drawing!
|
2020-04-05 23:55:51 +02:00
|
|
|
* it messes up transform. */
|
2020-08-21 18:55:27 +02:00
|
|
|
#undef SEQ_ALL_BEGIN
|
|
|
|
#undef SEQ_ALL_END
|
|
|
|
#undef SEQ_CURRENT_BEGIN
|
|
|
|
#undef SEQ_CURRENT_END
|
2014-11-10 19:39:20 +01:00
|
|
|
|
2015-01-06 23:09:56 +11:00
|
|
|
static Sequence *special_seq_update = NULL;
|
|
|
|
|
2020-04-03 16:21:24 +11:00
|
|
|
void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3])
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar blendcol[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
switch (seq->type) {
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_IMAGE:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_META:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_META, col);
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_MOVIE:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_MOVIECLIP:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 18:24:36 +00:00
|
|
|
case SEQ_TYPE_MASK:
|
2020-03-19 00:24:09 +01:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_MASK, col);
|
2012-06-07 18:24:36 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_SCENE:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq->scene == curscene) {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, 20);
|
|
|
|
}
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Transitions use input colors, fallback for when the input is a transition itself. */
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_CROSS:
|
|
|
|
case SEQ_TYPE_GAMCROSS:
|
|
|
|
case SEQ_TYPE_WIPE:
|
2020-03-19 00:24:09 +01:00
|
|
|
col[0] = 130;
|
|
|
|
col[1] = 130;
|
|
|
|
col[2] = 130;
|
2012-03-29 22:26:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Effects. */
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_TRANSFORM:
|
|
|
|
case SEQ_TYPE_SPEED:
|
|
|
|
case SEQ_TYPE_ADD:
|
|
|
|
case SEQ_TYPE_SUB:
|
|
|
|
case SEQ_TYPE_MUL:
|
|
|
|
case SEQ_TYPE_ALPHAOVER:
|
|
|
|
case SEQ_TYPE_ALPHAUNDER:
|
|
|
|
case SEQ_TYPE_OVERDROP:
|
|
|
|
case SEQ_TYPE_GLOW:
|
|
|
|
case SEQ_TYPE_MULTICAM:
|
|
|
|
case SEQ_TYPE_ADJUSTMENT:
|
2014-07-19 22:16:10 +06:00
|
|
|
case SEQ_TYPE_GAUSSIAN_BLUR:
|
2017-11-27 23:33:08 +01:00
|
|
|
case SEQ_TYPE_COLORMIX:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Slightly offset hue to distinguish different effects. */
|
2012-03-29 22:26:11 +00:00
|
|
|
if (seq->type == SEQ_TYPE_ADD) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.03);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_SUB) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.06);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_MUL) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.13);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_ALPHAOVER) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.16);
|
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_ALPHAUNDER) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.23);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_OVERDROP) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.26);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (seq->type == SEQ_TYPE_COLORMIX) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.33);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (seq->type == SEQ_TYPE_GAUSSIAN_BLUR) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.43);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (seq->type == SEQ_TYPE_GLOW) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.46);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_ADJUSTMENT) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_byte_set_hue_float_offset(col, 0.55);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (seq->type == SEQ_TYPE_SPEED) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.65);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (seq->type == SEQ_TYPE_TRANSFORM) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.75);
|
|
|
|
}
|
|
|
|
else if (seq->type == SEQ_TYPE_MULTICAM) {
|
|
|
|
rgb_byte_set_hue_float_offset(col, 0.85);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_COLOR:
|
2020-03-19 00:24:09 +01:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_COLOR, col);
|
2012-03-29 22:26:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-07 15:49:02 +00:00
|
|
|
case SEQ_TYPE_SOUND_RAM:
|
2012-03-29 22:26:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
|
|
|
|
blendcol[0] = blendcol[1] = blendcol[2] = 128;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (seq->flag & SEQ_MUTE) {
|
|
|
|
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
|
|
|
|
}
|
2012-03-29 22:26:11 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-01 23:56:48 +01:00
|
|
|
case SEQ_TYPE_TEXT:
|
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_TEXT, col);
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
default:
|
|
|
|
col[0] = 10;
|
|
|
|
col[1] = 255;
|
|
|
|
col[2] = 40;
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-06 21:42:31 +10:00
|
|
|
/**
|
|
|
|
* \param x1, x2, y1, y2: The starting and end X value to draw the wave, same for y1 and y2.
|
|
|
|
* \param stepsize: The width of a pixel.
|
|
|
|
*/
|
2020-12-15 23:15:32 +01:00
|
|
|
static void draw_seq_waveform_overlay(View2D *v2d,
|
|
|
|
const bContext *C,
|
|
|
|
SpaceSeq *sseq,
|
|
|
|
Scene *scene,
|
|
|
|
Sequence *seq,
|
|
|
|
float x1,
|
|
|
|
float y1,
|
|
|
|
float x2,
|
|
|
|
float y2,
|
|
|
|
float stepsize)
|
2010-02-07 23:41:17 +00:00
|
|
|
{
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Offset x1 and x2 values, to match view min/max, if strip is out of bounds. */
|
2017-02-08 02:43:17 -02:00
|
|
|
int x1_offset = max_ff(v2d->cur.xmin, x1);
|
|
|
|
int x2_offset = min_ff(v2d->cur.xmax + 1.0f, x2);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-04 19:41:26 +11:00
|
|
|
if (seq->sound && ((sseq->flag & SEQ_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
|
2017-02-08 02:43:17 -02:00
|
|
|
int length = floor((x2_offset - x1_offset) / stepsize) + 1;
|
|
|
|
float ymid = (y1 + y2) / 2.0f;
|
|
|
|
float yscale = (y2 - y1) / 2.0f;
|
2011-08-09 14:10:32 +00:00
|
|
|
float samplestep;
|
|
|
|
float startsample, endsample;
|
2019-06-19 10:36:45 -07:00
|
|
|
float volume = seq->volume;
|
2015-10-14 12:15:03 +03:00
|
|
|
float value1, value2;
|
2014-11-24 18:18:35 +01:00
|
|
|
bSound *sound = seq->sound;
|
2012-03-29 22:26:11 +00:00
|
|
|
SoundWaveform *waveform;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (length < 2) {
|
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-28 19:45:16 +01:00
|
|
|
BLI_spin_lock(sound->spinlock);
|
2016-01-04 19:41:26 +11:00
|
|
|
if (!sound->waveform) {
|
2018-07-20 12:11:34 +02:00
|
|
|
if (!(sound->tags & SOUND_TAGS_WAVEFORM_LOADING)) {
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Prevent sounds from reloading. */
|
2018-07-20 12:11:34 +02:00
|
|
|
sound->tags |= SOUND_TAGS_WAVEFORM_LOADING;
|
2015-01-28 19:45:16 +01:00
|
|
|
BLI_spin_unlock(sound->spinlock);
|
2014-11-24 18:18:35 +01:00
|
|
|
sequencer_preview_add_sound(C, seq);
|
|
|
|
}
|
|
|
|
else {
|
2015-01-28 19:45:16 +01:00
|
|
|
BLI_spin_unlock(sound->spinlock);
|
2014-11-24 18:18:35 +01:00
|
|
|
}
|
2020-04-05 23:55:51 +02:00
|
|
|
return; /* Nothing to draw. */
|
2014-11-24 18:18:35 +01:00
|
|
|
}
|
2015-01-28 19:45:16 +01:00
|
|
|
BLI_spin_unlock(sound->spinlock);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-01-04 19:41:26 +11:00
|
|
|
waveform = sound->waveform;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Waveform could not be built. */
|
2015-08-07 23:42:32 +02:00
|
|
|
if (waveform->length == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
startsample = floor((seq->startofs + seq->anim_startofs) / FPS *
|
|
|
|
SOUND_WAVE_SAMPLES_PER_SECOND);
|
|
|
|
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS *
|
|
|
|
SOUND_WAVE_SAMPLES_PER_SECOND);
|
|
|
|
samplestep = (endsample - startsample) * stepsize / (x2 - x1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-01 15:58:12 +01:00
|
|
|
length = min_ii(
|
|
|
|
floor((waveform->length - startsample) / samplestep - (x1_offset - x1) / stepsize),
|
|
|
|
length);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (length < 2) {
|
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-02 09:58:26 +10:00
|
|
|
/* F-curve lookup is quite expensive, so do this after precondition. */
|
2020-04-05 23:55:51 +02:00
|
|
|
FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL);
|
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-03-18 12:10:33 -07:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_TRI_STRIP, length * 2);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-09 18:41:07 +02:00
|
|
|
for (int i = 0; i < length; i++) {
|
2017-02-08 02:43:17 -02:00
|
|
|
float sampleoffset = startsample + ((x1_offset - x1) / stepsize + i) * samplestep;
|
2020-09-09 18:41:07 +02:00
|
|
|
int p = sampleoffset;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
value1 = waveform->data[p * 3];
|
|
|
|
value2 = waveform->data[p * 3 + 1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-14 12:23:17 +03:00
|
|
|
if (samplestep > 1.0f) {
|
2020-09-09 18:41:07 +02:00
|
|
|
for (int j = p + 1; (j < waveform->length) && (j < p + samplestep); j++) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (value1 > waveform->data[j * 3]) {
|
2015-10-14 12:15:03 +03:00
|
|
|
value1 = waveform->data[j * 3];
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (value2 < waveform->data[j * 3 + 1]) {
|
2015-10-14 12:15:03 +03:00
|
|
|
value2 = waveform->data[j * 3 + 1];
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-02-01 15:58:12 +01:00
|
|
|
else if (p + 1 < waveform->length) {
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Use simple linear interpolation. */
|
2017-02-08 02:43:17 -02:00
|
|
|
float f = sampleoffset - p;
|
|
|
|
value1 = (1.0f - f) * value1 + f * waveform->data[p * 3 + 3];
|
|
|
|
value2 = (1.0f - f) * value2 + f * waveform->data[p * 3 + 4];
|
2011-08-09 14:10:32 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-21 18:47:43 -07:00
|
|
|
if (fcu && !BKE_fcurve_is_empty(fcu)) {
|
2019-06-19 10:36:45 -07:00
|
|
|
float evaltime = x1_offset + (i * stepsize);
|
|
|
|
volume = evaluate_fcurve(fcu, evaltime);
|
2020-03-02 02:49:35 +01:00
|
|
|
CLAMP_MIN(volume, 0.0f);
|
2019-06-19 10:36:45 -07:00
|
|
|
}
|
|
|
|
value1 *= volume;
|
|
|
|
value2 *= volume;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-18 12:10:33 -07:00
|
|
|
if (value2 > 1 || value1 < -1) {
|
|
|
|
immAttr4f(col, 1.0f, 0.0f, 0.0f, 0.5f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-18 12:10:33 -07:00
|
|
|
CLAMP_MAX(value2, 1.0f);
|
|
|
|
CLAMP_MIN(value1, -1.0f);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
immAttr4f(col, 1.0f, 1.0f, 1.0f, 0.5f);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immVertex2f(pos, x1_offset + i * stepsize, ymid + value1 * yscale);
|
|
|
|
immVertex2f(pos, x1_offset + i * stepsize, ymid + value2 * yscale);
|
2010-02-07 23:41:17 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immEnd();
|
2019-03-18 12:10:33 -07:00
|
|
|
immUnbindProgram();
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2010-07-04 01:56:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
|
2010-07-04 01:56:04 +00:00
|
|
|
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
|
|
|
|
{
|
2020-08-21 18:55:27 +02:00
|
|
|
/* Don't use SEQ_ALL_BEGIN/SEQ_ALL_END here,
|
2020-04-06 21:42:31 +10:00
|
|
|
* because it changes seq->depth, which is needed for transform. */
|
2010-07-04 01:56:04 +00:00
|
|
|
Sequence *seq;
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar col[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
int chan_min = MAXSEQ;
|
|
|
|
int chan_max = 0;
|
|
|
|
int chan_range = 0;
|
|
|
|
float draw_range = y2 - y1;
|
2010-07-04 01:56:04 +00:00
|
|
|
float draw_height;
|
2014-12-10 15:26:41 +01:00
|
|
|
ListBase *seqbase;
|
|
|
|
int offset;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
seqbase = SEQ_get_seqbase_from_sequence(seqm, &offset);
|
2014-12-10 15:26:41 +01:00
|
|
|
if (!seqbase || BLI_listbase_is_empty(seqbase)) {
|
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-12-10 15:26:41 +01:00
|
|
|
if (seqm->type == SEQ_TYPE_SCENE) {
|
|
|
|
offset = seqm->start - offset;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
offset = 0;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-12-10 15:26:41 +01:00
|
|
|
for (seq = seqbase->first; seq; seq = seq->next) {
|
2012-11-07 12:31:05 +00:00
|
|
|
chan_min = min_ii(chan_min, seq->machine);
|
|
|
|
chan_max = max_ii(chan_max, seq->machine);
|
2010-07-04 01:56:04 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
chan_range = (chan_max - chan_min) + 1;
|
|
|
|
draw_height = draw_range / chan_range;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
col[3] = 196; /* Alpha, used for all meta children. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-02-08 02:43:17 -02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw only immediate children (1 level depth). */
|
2014-12-10 15:26:41 +01:00
|
|
|
for (seq = seqbase->first; seq; seq = seq->next) {
|
|
|
|
const int startdisp = seq->startdisp + offset;
|
|
|
|
const int enddisp = seq->enddisp + offset;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-12-10 15:26:41 +01:00
|
|
|
if ((startdisp > x2 || enddisp < x1) == 0) {
|
2012-03-29 22:26:11 +00:00
|
|
|
float y_chan = (seq->machine - chan_min) / (float)(chan_range)*draw_range;
|
2014-12-10 15:26:41 +01:00
|
|
|
float x1_chan = startdisp;
|
|
|
|
float x2_chan = enddisp;
|
2010-07-04 08:49:54 +00:00
|
|
|
float y1_chan, y2_chan;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->type == SEQ_TYPE_COLOR) {
|
|
|
|
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
|
|
|
|
rgb_float_to_uchar(col, colvars->col);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
color3ubv_from_seq(scene, seq, col);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if ((seqm->flag & SEQ_MUTE) || (seq->flag & SEQ_MUTE)) {
|
|
|
|
col[3] = 64;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
col[3] = 196;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformColor4ubv(col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Clamp within parent sequence strip bounds. */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (x1_chan < x1) {
|
|
|
|
x1_chan = x1;
|
|
|
|
}
|
|
|
|
if (x2_chan > x2) {
|
|
|
|
x2_chan = x2;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
y1_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
|
|
|
|
y2_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immRectf(pos, x1_chan, y1_chan, x2_chan, y2_chan);
|
2010-07-04 01:56:04 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Get handle width in pixels. */
|
2020-02-09 17:59:13 +01:00
|
|
|
float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx)
|
2012-06-20 17:10:40 +00:00
|
|
|
{
|
2020-03-19 12:26:47 +11:00
|
|
|
const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize;
|
2014-11-14 16:47:30 +01:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Ensure that handle is not wider, than half of strip. */
|
2020-03-19 00:24:09 +01:00
|
|
|
return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 2.0f) / pixelx);
|
2012-06-20 17:10:40 +00:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw a handle, on left or right side of strip. */
|
2019-02-28 12:15:42 +11:00
|
|
|
static void draw_seq_handle(View2D *v2d,
|
|
|
|
Sequence *seq,
|
|
|
|
const float handsize_clamped,
|
|
|
|
const short direction,
|
2020-04-03 16:21:24 +11:00
|
|
|
uint pos,
|
2020-03-19 00:24:09 +01:00
|
|
|
bool seq_active,
|
|
|
|
float pixelx,
|
|
|
|
bool y_threshold)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2020-03-19 00:24:09 +01:00
|
|
|
float rx1 = 0, rx2 = 0;
|
2009-01-12 19:02:08 +00:00
|
|
|
float x1, x2, y1, y2;
|
2020-04-03 16:21:24 +11:00
|
|
|
uint whichsel = 0;
|
|
|
|
uchar col[4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
x1 = seq->startdisp;
|
|
|
|
x2 = seq->enddisp;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
|
|
|
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Set up co-ordinates and dimensions for either left or right handle. */
|
2012-10-21 05:46:41 +00:00
|
|
|
if (direction == SEQ_LEFTHANDLE) {
|
2009-01-12 19:02:08 +00:00
|
|
|
rx1 = x1;
|
2020-03-19 00:24:09 +01:00
|
|
|
rx2 = x1 + handsize_clamped;
|
2009-01-12 19:02:08 +00:00
|
|
|
whichsel = SEQ_LEFTSEL;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (direction == SEQ_RIGHTHANDLE) {
|
2020-03-19 00:24:09 +01:00
|
|
|
rx1 = x2 - handsize_clamped;
|
2009-01-12 19:02:08 +00:00
|
|
|
rx2 = x2;
|
|
|
|
whichsel = SEQ_RIGHTSEL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
if (!(seq->type & SEQ_TYPE_EFFECT) || SEQ_effect_get_num_inputs(seq->type) == 0) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (seq->flag & whichsel) {
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq_active) {
|
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_ACTIVE, col);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_SELECTED, col);
|
|
|
|
/* Make handles slightly brighter than the outlines. */
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, 50);
|
|
|
|
}
|
|
|
|
col[3] = 255;
|
|
|
|
immUniformColor4ubv(col);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
|
|
|
else {
|
2020-03-19 00:24:09 +01:00
|
|
|
immUniformColor4ub(0, 0, 0, 50);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immRectf(pos, rx1, y1, rx2, y2);
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw numbers for start and end of the strip next to its handles. */
|
2020-03-19 00:24:09 +01:00
|
|
|
if (y_threshold &&
|
|
|
|
(((seq->flag & SELECT) && (G.moving & G_TRANSFORM_SEQ)) || (seq->flag & whichsel))) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
char numstr[64];
|
|
|
|
size_t numstr_len;
|
|
|
|
const int fontid = BLF_default();
|
|
|
|
BLF_set_default();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Calculate if strip is wide enough for showing the labels. */
|
|
|
|
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d%d", seq->startdisp, seq->enddisp);
|
|
|
|
float tot_width = BLF_width(fontid, numstr, numstr_len);
|
|
|
|
|
|
|
|
if ((x2 - x1) / pixelx > 20 + tot_width) {
|
|
|
|
col[0] = col[1] = col[2] = col[3] = 255;
|
|
|
|
float text_margin = 1.2f * handsize_clamped;
|
|
|
|
|
|
|
|
if (direction == SEQ_LEFTHANDLE) {
|
|
|
|
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->startdisp);
|
|
|
|
x1 += text_margin;
|
|
|
|
y1 += 0.09f;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
|
|
|
|
x1 = x2 - (text_margin + pixelx * BLF_width(fontid, numstr, numstr_len));
|
|
|
|
y1 += 0.09f;
|
|
|
|
}
|
|
|
|
UI_view2d_text_cache_add(v2d, x1, y1, numstr, numstr_len, col);
|
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
static void draw_seq_outline(Sequence *seq,
|
2020-04-03 16:21:24 +11:00
|
|
|
uint pos,
|
2020-03-19 00:24:09 +01:00
|
|
|
float x1,
|
|
|
|
float x2,
|
|
|
|
float y1,
|
|
|
|
float y2,
|
|
|
|
float pixelx,
|
|
|
|
float pixely,
|
|
|
|
bool seq_active)
|
|
|
|
{
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar col[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Get the color for the outline. */
|
|
|
|
if (seq_active && (seq->flag & SELECT)) {
|
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_ACTIVE, col);
|
|
|
|
}
|
|
|
|
else if (seq->flag & SELECT) {
|
|
|
|
UI_GetThemeColor3ubv(TH_SEQ_SELECTED, col);
|
|
|
|
}
|
|
|
|
else {
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Color for unselected strips is a bit darker than the background. */
|
2020-11-25 16:37:33 -05:00
|
|
|
UI_GetThemeColorShade3ubv(TH_BACK, -40, col);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Outline while translating strips:
|
|
|
|
* - Slightly lighter.
|
|
|
|
* - Red when overlapping with other strips.
|
|
|
|
*/
|
|
|
|
if ((G.moving & G_TRANSFORM_SEQ) && (seq->flag & SELECT)) {
|
|
|
|
if (seq->flag & SEQ_OVERLAP) {
|
|
|
|
col[0] = 255;
|
|
|
|
col[1] = col[2] = 33;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-03-19 00:24:09 +01:00
|
|
|
UI_GetColorPtrShade3ubv(col, col, 70);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
|
|
|
immUniformColor3ubv(col);
|
|
|
|
|
|
|
|
/* 2px wide outline for selected strips. */
|
2020-09-02 09:58:26 +10:00
|
|
|
/* XXX: some platforms don't support OpenGL lines wider than 1px (see T57570),
|
|
|
|
* draw outline as four boxes instead. */
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
/* Left */
|
|
|
|
immRectf(pos, x1 - pixelx, y1, x1 + pixelx, y2);
|
|
|
|
/* Bottom */
|
|
|
|
immRectf(pos, x1 - pixelx, y1, x2 + pixelx, y1 + 2 * pixely);
|
|
|
|
/* Right */
|
|
|
|
immRectf(pos, x2 - pixelx, y1, x2 + pixelx, y2);
|
|
|
|
/* Top */
|
|
|
|
immRectf(pos, x1 - pixelx, y2 - 2 * pixely, x2 + pixelx, y2);
|
|
|
|
}
|
|
|
|
else {
|
2020-04-05 23:55:51 +02:00
|
|
|
/* 1px wide outline for unselected strips. */
|
2020-03-19 00:24:09 +01:00
|
|
|
imm_draw_box_wire_2d(pos, x1, y1, x2, y2);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2020-12-16 00:20:20 +01:00
|
|
|
static const char *draw_seq_text_get_name(Sequence *seq)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
const char *name = seq->name + 2;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (name[0] == '\0') {
|
2020-12-19 05:57:27 +01:00
|
|
|
name = SEQ_sequence_give_name(seq);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-12-15 23:15:32 +01:00
|
|
|
return name;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-16 00:20:20 +01:00
|
|
|
static void draw_seq_text_get_source(Sequence *seq, char *r_source, size_t source_len)
|
2020-12-15 23:15:32 +01:00
|
|
|
{
|
2021-01-11 17:13:27 +11:00
|
|
|
*r_source = '\0';
|
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
/* Set source for the most common types. */
|
2021-01-11 17:13:27 +11:00
|
|
|
switch (seq->type) {
|
|
|
|
case SEQ_TYPE_IMAGE:
|
|
|
|
case SEQ_TYPE_MOVIE: {
|
2021-01-11 17:17:10 +11:00
|
|
|
BLI_join_dirfile(r_source, source_len, seq->strip->dir, seq->strip->stripdata->name);
|
2021-01-11 17:13:27 +11:00
|
|
|
break;
|
2012-06-07 18:24:36 +00:00
|
|
|
}
|
2021-01-11 17:13:27 +11:00
|
|
|
case SEQ_TYPE_SOUND_RAM: {
|
|
|
|
if (seq->sound != NULL) {
|
|
|
|
BLI_strncpy(r_source, seq->sound->filepath, source_len);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEQ_TYPE_MULTICAM: {
|
|
|
|
BLI_snprintf(r_source, source_len, "Channel: %d", seq->multicam_source);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEQ_TYPE_TEXT: {
|
|
|
|
const TextVars *textdata = seq->effectdata;
|
|
|
|
BLI_strncpy(r_source, textdata->text, source_len);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEQ_TYPE_SCENE: {
|
|
|
|
if (seq->scene != NULL) {
|
|
|
|
if (seq->scene_camera != NULL) {
|
|
|
|
BLI_snprintf(r_source,
|
|
|
|
source_len,
|
|
|
|
"%s (%s)",
|
|
|
|
seq->scene->id.name + 2,
|
|
|
|
seq->scene_camera->id.name + 2);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BLI_strncpy(r_source, seq->scene->id.name + 2, source_len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEQ_TYPE_MOVIECLIP: {
|
|
|
|
if (seq->clip != NULL) {
|
|
|
|
BLI_strncpy(r_source, seq->clip->id.name + 2, source_len);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SEQ_TYPE_MASK: {
|
|
|
|
if (seq->mask != NULL) {
|
|
|
|
BLI_strncpy(r_source, seq->mask->id.name + 2, source_len);
|
|
|
|
}
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2010-03-09 13:52:52 +00:00
|
|
|
}
|
2020-12-15 23:15:32 +01:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
|
|
|
|
Sequence *seq,
|
|
|
|
char *r_overlay_string,
|
|
|
|
size_t overlay_string_len)
|
|
|
|
{
|
2021-01-11 17:39:58 +11:00
|
|
|
const char *text_sep = " | ";
|
|
|
|
const char *text_array[5];
|
|
|
|
int i = 0;
|
2020-12-15 23:15:32 +01:00
|
|
|
|
2021-01-11 17:39:58 +11:00
|
|
|
if (sseq->flag & SEQ_SHOW_STRIP_NAME) {
|
2021-01-11 17:58:08 +11:00
|
|
|
text_array[i++] = draw_seq_text_get_name(seq);
|
2020-12-15 23:15:32 +01:00
|
|
|
}
|
2021-01-11 17:39:58 +11:00
|
|
|
|
2021-01-11 17:58:08 +11:00
|
|
|
char source[FILE_MAX];
|
|
|
|
if (sseq->flag & SEQ_SHOW_STRIP_SOURCE) {
|
|
|
|
draw_seq_text_get_source(seq, source, sizeof(source));
|
|
|
|
if (source[0] != '\0') {
|
|
|
|
if (i != 0) {
|
|
|
|
text_array[i++] = text_sep;
|
|
|
|
}
|
|
|
|
text_array[i++] = source;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-04-17 15:14:07 +10:00
|
|
|
}
|
2021-01-11 17:39:58 +11:00
|
|
|
|
|
|
|
char strip_duration_text[16];
|
|
|
|
if (sseq->flag & SEQ_SHOW_STRIP_DURATION) {
|
|
|
|
const int strip_duration = seq->enddisp - seq->startdisp;
|
|
|
|
SNPRINTF(strip_duration_text, "%d", strip_duration);
|
|
|
|
if (i != 0) {
|
|
|
|
text_array[i++] = text_sep;
|
|
|
|
}
|
|
|
|
text_array[i++] = strip_duration_text;
|
2014-04-17 15:14:07 +10:00
|
|
|
}
|
2021-01-11 17:39:58 +11:00
|
|
|
|
|
|
|
BLI_assert(i <= ARRAY_SIZE(text_array));
|
|
|
|
|
|
|
|
return BLI_string_join_array(r_overlay_string, overlay_string_len, text_array, i) -
|
|
|
|
r_overlay_string;
|
2020-12-15 23:15:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw info text on a sequence strip. */
|
|
|
|
static void draw_seq_text_overlay(View2D *v2d,
|
|
|
|
Sequence *seq,
|
|
|
|
SpaceSeq *sseq,
|
|
|
|
float x1,
|
|
|
|
float x2,
|
|
|
|
float y1,
|
|
|
|
float y2,
|
|
|
|
bool seq_active)
|
|
|
|
{
|
|
|
|
char overlay_string[FILE_MAX];
|
|
|
|
size_t overlay_string_len = draw_seq_text_get_overlay_string(
|
|
|
|
sseq, seq, overlay_string, sizeof(overlay_string));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
if (overlay_string_len == 0) {
|
|
|
|
return;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* White text for the active strip. */
|
2020-12-15 23:15:32 +01:00
|
|
|
uchar col[4];
|
2020-03-19 00:24:09 +01:00
|
|
|
col[0] = col[1] = col[2] = seq_active ? 255 : 10;
|
2012-03-29 22:26:11 +00:00
|
|
|
col[3] = 255;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Make the text duller when the strip is muted. */
|
|
|
|
if (seq->flag & SEQ_MUTE) {
|
|
|
|
if (seq_active) {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, -70);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, 15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
rctf rect;
|
2012-03-24 02:51:46 +00:00
|
|
|
rect.xmin = x1;
|
|
|
|
rect.ymin = y1;
|
|
|
|
rect.xmax = x2;
|
|
|
|
rect.ymax = y2;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
UI_view2d_text_cache_add_rectf(v2d, &rect, overlay_string, overlay_string_len, col);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
static void draw_sequence_extensions_overlay(Scene *scene, Sequence *seq, uint pos, float pixely)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2020-03-19 00:24:09 +01:00
|
|
|
float x1, x2, y1, y2;
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar col[4], blend_col[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-24 21:11:05 +01:00
|
|
|
x1 = seq->startdisp;
|
|
|
|
x2 = seq->enddisp;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-11-24 21:11:05 +01:00
|
|
|
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
|
|
|
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
color3ubv_from_seq(scene, seq, col);
|
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, 50);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
col[3] = seq->flag & SEQ_MUTE ? MUTE_ALPHA : 200;
|
|
|
|
UI_GetColorPtrShade3ubv(col, blend_col, 10);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->startofs) {
|
|
|
|
immUniformColor4ubv(col);
|
|
|
|
immRectf(pos, (float)(seq->start), y1 - pixely, x1, y1 - SEQ_STRIP_OFSBOTTOM);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Outline. */
|
|
|
|
immUniformColor3ubv(blend_col);
|
|
|
|
imm_draw_box_wire_2d(pos, x1, y1 - pixely, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM);
|
|
|
|
}
|
|
|
|
if (seq->endofs) {
|
|
|
|
immUniformColor4ubv(col);
|
|
|
|
immRectf(pos, x2, y2 + pixely, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Outline. */
|
|
|
|
immUniformColor3ubv(blend_col);
|
|
|
|
imm_draw_box_wire_2d(
|
|
|
|
pos, x2, y2 + pixely, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
|
|
|
|
}
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 16:21:24 +11:00
|
|
|
static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, float y1)
|
2020-03-19 00:24:09 +01:00
|
|
|
{
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar col[4];
|
2020-03-19 00:24:09 +01:00
|
|
|
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
rgb_float_to_uchar(col, colvars->col);
|
|
|
|
if (seq->flag & SEQ_MUTE) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-03-19 00:24:09 +01:00
|
|
|
col[3] = MUTE_ALPHA;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
col[3] = 255;
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immUniformColor4ubv(col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immRectf(pos, seq->startdisp, y1, seq->enddisp, text_margin_y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* 1px line to better separate the color band. */
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, -20);
|
|
|
|
immUniformColor4ubv(col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
|
|
|
immVertex2f(pos, seq->startdisp, text_margin_y);
|
|
|
|
immVertex2f(pos, seq->enddisp, text_margin_y);
|
|
|
|
immEnd();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->flag & SEQ_MUTE) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
static void draw_seq_background(Scene *scene,
|
|
|
|
Sequence *seq,
|
2020-04-03 16:21:24 +11:00
|
|
|
uint pos,
|
2020-03-19 00:24:09 +01:00
|
|
|
float x1,
|
|
|
|
float x2,
|
|
|
|
float y1,
|
|
|
|
float y2,
|
|
|
|
bool is_single_image)
|
|
|
|
{
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar col[4];
|
2020-03-19 00:24:09 +01:00
|
|
|
|
|
|
|
/* Get the correct color per strip type, transitions use their inputs ones. */
|
|
|
|
if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) {
|
|
|
|
Sequence *seq1 = seq->seq1;
|
|
|
|
if (seq1->type == SEQ_TYPE_COLOR) {
|
|
|
|
SolidColorVars *colvars = (SolidColorVars *)seq1->effectdata;
|
|
|
|
rgb_float_to_uchar(col, colvars->col);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
color3ubv_from_seq(scene, seq1, col);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
color3ubv_from_seq(scene, seq, col);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->flag & SEQ_MUTE) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
col[3] = MUTE_ALPHA;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
col[3] = 255;
|
|
|
|
}
|
|
|
|
immUniformColor4ubv(col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Draw the main strip body. */
|
|
|
|
if (is_single_image) {
|
|
|
|
immRectf(pos,
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_transform_get_left_handle_frame(seq, false),
|
2020-03-19 00:24:09 +01:00
|
|
|
y1,
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_transform_get_right_handle_frame(seq, false),
|
2020-03-19 00:24:09 +01:00
|
|
|
y2);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
immRectf(pos, x1, y1, x2, y2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw background for hold still regions. */
|
|
|
|
if (!is_single_image && (seq->startstill || seq->endstill)) {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, -35);
|
|
|
|
immUniformColor4ubv(col);
|
|
|
|
|
|
|
|
if (seq->startstill) {
|
|
|
|
immRectf(pos, seq->startdisp, y1, (float)(seq->start), y2);
|
|
|
|
}
|
|
|
|
if (seq->endstill) {
|
|
|
|
immRectf(pos, (float)(seq->start + seq->len), y1, seq->enddisp, y2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw right half of transition strips. */
|
2020-03-19 00:24:09 +01:00
|
|
|
if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) {
|
|
|
|
float vert_pos[3][2];
|
|
|
|
Sequence *seq1 = seq->seq1;
|
|
|
|
Sequence *seq2 = seq->seq2;
|
|
|
|
|
|
|
|
if (seq2->type == SEQ_TYPE_COLOR) {
|
|
|
|
SolidColorVars *colvars = (SolidColorVars *)seq2->effectdata;
|
|
|
|
rgb_float_to_uchar(col, colvars->col);
|
2014-11-24 21:11:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2020-03-19 00:24:09 +01:00
|
|
|
color3ubv_from_seq(scene, seq2, col);
|
|
|
|
/* If the transition inputs are of the same type, draw the right side slightly darker. */
|
|
|
|
if (seq1->type == seq2->type) {
|
|
|
|
UI_GetColorPtrShade3ubv(col, col, -15);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2014-11-24 21:11:05 +01:00
|
|
|
}
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformColor4ubv(col);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
copy_v2_fl2(vert_pos[0], x1, y2);
|
|
|
|
copy_v2_fl2(vert_pos[1], x2, y2);
|
|
|
|
copy_v2_fl2(vert_pos[2], x2, y1);
|
|
|
|
|
|
|
|
immBegin(GPU_PRIM_TRIS, 3);
|
|
|
|
immVertex2fv(pos, vert_pos[0]);
|
|
|
|
immVertex2fv(pos, vert_pos[1]);
|
|
|
|
immVertex2fv(pos, vert_pos[2]);
|
|
|
|
immEnd();
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->flag & SEQ_MUTE) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2014-11-24 21:11:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
static void draw_seq_locked(float x1, float y1, float x2, float y2)
|
|
|
|
{
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-03-19 00:24:09 +01:00
|
|
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES);
|
|
|
|
|
|
|
|
immUniform4f("color1", 1.0f, 1.0f, 1.0f, 0.0f);
|
|
|
|
immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.25f);
|
|
|
|
immUniform1i("size1", 8);
|
|
|
|
immUniform1i("size2", 4);
|
|
|
|
|
|
|
|
immRectf(pos, x1, y1, x2, y2);
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_seq_invalid(float x1, float x2, float y2, float text_margin_y)
|
|
|
|
{
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-03-19 00:24:09 +01:00
|
|
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
immUniformColor4f(1.0f, 0.0f, 0.0f, 0.9f);
|
|
|
|
immRectf(pos, x1, y2, x2, text_margin_y);
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void calculate_seq_text_offsets(
|
|
|
|
View2D *v2d, Sequence *seq, float *x1, float *x2, float pixelx)
|
|
|
|
{
|
|
|
|
const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
|
|
|
|
float text_margin = 2.0f * handsize_clamped;
|
|
|
|
|
|
|
|
*x1 += text_margin;
|
|
|
|
*x2 -= text_margin;
|
|
|
|
|
|
|
|
float scroller_vert_xoffs = (V2D_SCROLL_HANDLE_WIDTH + SEQ_SCROLLER_TEXT_OFFSET) * pixelx;
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Info text on the strip. */
|
2020-03-19 00:24:09 +01:00
|
|
|
if (*x1 < v2d->cur.xmin + scroller_vert_xoffs) {
|
|
|
|
*x1 = v2d->cur.xmin + scroller_vert_xoffs;
|
|
|
|
}
|
|
|
|
else if (*x1 > v2d->cur.xmax) {
|
|
|
|
*x1 = v2d->cur.xmax;
|
|
|
|
}
|
|
|
|
if (*x2 < v2d->cur.xmin) {
|
|
|
|
*x2 = v2d->cur.xmin;
|
|
|
|
}
|
|
|
|
else if (*x2 > v2d->cur.xmax) {
|
|
|
|
*x2 = v2d->cur.xmax;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-06 00:38:48 +02:00
|
|
|
static void fcurve_batch_add_verts(GPUVertBuf *vbo,
|
|
|
|
float y1,
|
|
|
|
float y2,
|
|
|
|
float y_height,
|
2020-11-06 14:10:59 +01:00
|
|
|
int timeline_frame,
|
2020-04-06 00:38:48 +02:00
|
|
|
float curve_val,
|
|
|
|
unsigned int *vert_count)
|
|
|
|
{
|
|
|
|
float vert_pos[2][2];
|
|
|
|
|
2020-11-06 14:10:59 +01:00
|
|
|
copy_v2_fl2(vert_pos[0], timeline_frame, (curve_val * y_height) + y1);
|
|
|
|
copy_v2_fl2(vert_pos[1], timeline_frame, y2);
|
2020-04-06 00:38:48 +02:00
|
|
|
|
|
|
|
GPU_vertbuf_vert_set(vbo, *vert_count, vert_pos[0]);
|
|
|
|
GPU_vertbuf_vert_set(vbo, *vert_count + 1, vert_pos[1]);
|
|
|
|
*vert_count += 2;
|
|
|
|
}
|
|
|
|
|
2020-04-06 21:42:31 +10:00
|
|
|
/**
|
|
|
|
* Draw f-curves as darkened regions of the strip:
|
|
|
|
* - Volume for sound strips.
|
|
|
|
* - Opacity for the other types.
|
|
|
|
*/
|
2020-12-15 23:15:32 +01:00
|
|
|
static void draw_seq_fcurve_overlay(
|
2020-04-06 00:38:48 +02:00
|
|
|
Scene *scene, View2D *v2d, Sequence *seq, float x1, float y1, float x2, float y2, float pixelx)
|
|
|
|
{
|
|
|
|
FCurve *fcu;
|
|
|
|
|
|
|
|
if (seq->type == SEQ_TYPE_SOUND_RAM) {
|
|
|
|
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "blend_alpha", 0, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fcu && !BKE_fcurve_is_empty(fcu)) {
|
|
|
|
|
|
|
|
/* Clamp curve evaluation to the editor's borders. */
|
|
|
|
int eval_start = max_ff(x1, v2d->cur.xmin);
|
|
|
|
int eval_end = min_ff(x2, v2d->cur.xmax + 1);
|
|
|
|
|
|
|
|
int eval_step = max_ii(1, floor(pixelx));
|
|
|
|
|
|
|
|
if (eval_start >= eval_end) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GPUVertFormat format = {0};
|
|
|
|
GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
|
|
|
|
|
|
|
|
uint max_verts = 2 * ((eval_end - eval_start) / eval_step + 1);
|
|
|
|
GPU_vertbuf_data_alloc(vbo, max_verts);
|
|
|
|
uint vert_count = 0;
|
|
|
|
|
|
|
|
const float y_height = y2 - y1;
|
|
|
|
float curve_val;
|
|
|
|
float prev_val = INT_MIN;
|
|
|
|
bool skip = false;
|
|
|
|
|
2020-11-06 14:10:59 +01:00
|
|
|
for (int timeline_frame = eval_start; timeline_frame <= eval_end;
|
|
|
|
timeline_frame += eval_step) {
|
|
|
|
curve_val = evaluate_fcurve(fcu, timeline_frame);
|
2020-04-06 00:38:48 +02:00
|
|
|
CLAMP(curve_val, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
/* Avoid adding adjacent verts that have the same value. */
|
2020-11-06 14:10:59 +01:00
|
|
|
if (curve_val == prev_val && timeline_frame < eval_end - eval_step) {
|
2020-04-06 00:38:48 +02:00
|
|
|
skip = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If some frames were skipped above, we need to close the shape. */
|
|
|
|
if (skip) {
|
2020-11-06 14:10:59 +01:00
|
|
|
fcurve_batch_add_verts(
|
|
|
|
vbo, y1, y2, y_height, timeline_frame - eval_step, prev_val, &vert_count);
|
2020-04-06 00:38:48 +02:00
|
|
|
skip = false;
|
|
|
|
}
|
|
|
|
|
2020-11-06 14:10:59 +01:00
|
|
|
fcurve_batch_add_verts(vbo, y1, y2, y_height, timeline_frame, curve_val, &vert_count);
|
2020-04-06 00:38:48 +02:00
|
|
|
prev_val = curve_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO);
|
|
|
|
GPU_vertbuf_data_len_set(vbo, vert_count);
|
|
|
|
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
GPU_batch_uniform_4f(batch, "color", 0.0f, 0.0f, 0.0f, 0.15f);
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-04-06 00:38:48 +02:00
|
|
|
|
|
|
|
if (vert_count > 0) {
|
|
|
|
GPU_batch_draw(batch);
|
|
|
|
}
|
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-04-06 00:38:48 +02:00
|
|
|
GPU_batch_discard(batch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-06 09:57:56 +02:00
|
|
|
/* Draw visible strips. Bounds check are already made. */
|
2019-02-28 12:15:42 +11:00
|
|
|
static void draw_seq_strip(const bContext *C,
|
|
|
|
SpaceSeq *sseq,
|
|
|
|
Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region,
|
2019-02-28 12:15:42 +11:00
|
|
|
Sequence *seq,
|
2020-03-19 00:24:09 +01:00
|
|
|
float pixelx,
|
|
|
|
bool seq_active)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
View2D *v2d = ®ion->v2d;
|
2009-01-12 19:02:08 +00:00
|
|
|
float x1, x2, y1, y2;
|
2020-02-09 17:59:13 +01:00
|
|
|
const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
|
2020-03-19 00:24:09 +01:00
|
|
|
float pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Check if we are doing "solo preview". */
|
2020-12-19 05:57:27 +01:00
|
|
|
bool is_single_image = (char)SEQ_transform_single_image_check(seq);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw strip body. */
|
2017-02-08 02:43:17 -02:00
|
|
|
x1 = (seq->startstill) ? seq->start : seq->startdisp;
|
2015-01-06 23:09:56 +11:00
|
|
|
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
|
|
|
x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
|
2017-02-08 02:43:17 -02:00
|
|
|
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
float text_margin_y;
|
|
|
|
bool y_threshold;
|
|
|
|
if ((sseq->flag & SEQ_SHOW_STRIP_NAME) || (sseq->flag & SEQ_SHOW_STRIP_SOURCE) ||
|
|
|
|
(sseq->flag & SEQ_SHOW_STRIP_DURATION)) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
/* Calculate height needed for drawing text on strip. */
|
|
|
|
text_margin_y = y2 - min_ff(0.40f, 20 * U.dpi_fac * pixely);
|
|
|
|
|
|
|
|
/* Is there enough space for drawing something else than text? */
|
|
|
|
y_threshold = ((y2 - y1) / pixely) > 20 * U.dpi_fac;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
text_margin_y = y2;
|
|
|
|
y_threshold = 1;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_seq_background(scene, seq, pos, x1, x2, y1, y2, is_single_image);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw a color band inside color strip. */
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq->type == SEQ_TYPE_COLOR && y_threshold) {
|
|
|
|
draw_color_strip_band(seq, pos, text_margin_y, y1);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw strip offsets when flag is enabled or during "solo preview". */
|
2020-12-15 23:15:32 +01:00
|
|
|
if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) {
|
|
|
|
if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) {
|
|
|
|
if ((sseq->draw_flag & SEQ_DRAW_OFFSET_EXT) || (seq == special_seq_update)) {
|
|
|
|
draw_sequence_extensions_overlay(scene, seq, pos, pixely);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
immUnbindProgram();
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2019-03-18 12:09:22 -07:00
|
|
|
x1 = seq->startdisp;
|
|
|
|
x2 = seq->enddisp;
|
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if ((seq->type == SEQ_TYPE_META) ||
|
|
|
|
((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS))) {
|
|
|
|
drawmeta_contents(scene, seq, x1, y1, x2, y2);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & SEQ_SHOW_FCURVES)) {
|
|
|
|
draw_seq_fcurve_overlay(scene, v2d, seq, x1, y1, x2, y2, pixelx);
|
2020-04-06 00:38:48 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw sound strip waveform. */
|
2020-12-15 23:15:32 +01:00
|
|
|
if ((seq->type == SEQ_TYPE_SOUND_RAM) && ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) &&
|
|
|
|
(sseq->flag & SEQ_NO_WAVEFORMS) == 0) {
|
|
|
|
draw_seq_waveform_overlay(v2d,
|
|
|
|
C,
|
|
|
|
sseq,
|
|
|
|
scene,
|
|
|
|
seq,
|
|
|
|
x1,
|
|
|
|
y_threshold ? y1 + 0.05f : y1,
|
|
|
|
x2,
|
|
|
|
y_threshold ? text_margin_y : y2,
|
|
|
|
BLI_rctf_size_x(®ion->v2d.cur) / region->winx);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
/* Draw locked state. */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (seq->flag & SEQ_LOCK) {
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_seq_locked(x1, y1, x2, y2);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw Red line on the top of invalid strip (Missing media). */
|
2020-12-19 05:57:27 +01:00
|
|
|
if (!SEQ_sequence_has_source(seq)) {
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_seq_invalid(x1, x2, y2, text_margin_y);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if ((seq->flag & SEQ_LOCK) == 0) {
|
|
|
|
draw_seq_handle(
|
|
|
|
v2d, seq, handsize_clamped, SEQ_LEFTHANDLE, pos, seq_active, pixelx, y_threshold);
|
|
|
|
draw_seq_handle(
|
|
|
|
v2d, seq, handsize_clamped, SEQ_RIGHTHANDLE, pos, seq_active, pixelx, y_threshold);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_seq_outline(seq, pos, x1, x2, y1, y2, pixelx, pixely, seq_active);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
calculate_seq_text_offsets(v2d, seq, &x1, &x2, pixelx);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
/* If a waveform is drawn, avoid drawing text when there is not enough vertical space. */
|
|
|
|
if (seq->type == SEQ_TYPE_SOUND_RAM) {
|
|
|
|
if (!y_threshold && (sseq->flag & SEQ_NO_WAVEFORMS) == 0 &&
|
|
|
|
((sseq->flag & SEQ_ALL_WAVEFORMS) || (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sseq->flag & SEQ_SHOW_STRIP_OVERLAY) {
|
|
|
|
/* Don't draw strip if there is not enough vertical or horizontal space. */
|
|
|
|
if (((x2 - x1) > 32 * pixelx * U.dpi_fac) && ((y2 - y1) > 8 * pixely * U.dpi_fac)) {
|
|
|
|
/* Depending on the vertical space, draw text on top or in the center of strip. */
|
|
|
|
draw_seq_text_overlay(
|
|
|
|
v2d, seq, sseq, x1, x2, y_threshold ? text_margin_y : y1, y2, seq_active);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
static void draw_effect_inputs_highlight(Sequence *seq)
|
|
|
|
{
|
|
|
|
Sequence *seq1 = seq->seq1;
|
|
|
|
Sequence *seq2 = seq->seq2;
|
|
|
|
Sequence *seq3 = seq->seq3;
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immUniformColor4ub(255, 255, 255, 48);
|
|
|
|
immRectf(pos,
|
|
|
|
seq1->startdisp,
|
|
|
|
seq1->machine + SEQ_STRIP_OFSBOTTOM,
|
|
|
|
seq1->enddisp,
|
|
|
|
seq1->machine + SEQ_STRIP_OFSTOP);
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq2 && seq2 != seq1) {
|
|
|
|
immRectf(pos,
|
|
|
|
seq2->startdisp,
|
|
|
|
seq2->machine + SEQ_STRIP_OFSBOTTOM,
|
|
|
|
seq2->enddisp,
|
|
|
|
seq2->machine + SEQ_STRIP_OFSTOP);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
if (seq3 && !ELEM(seq3, seq1, seq2)) {
|
|
|
|
immRectf(pos,
|
|
|
|
seq3->startdisp,
|
|
|
|
seq3->machine + SEQ_STRIP_OFSBOTTOM,
|
|
|
|
seq3->enddisp,
|
|
|
|
seq3->machine + SEQ_STRIP_OFSTOP);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2020-03-19 00:24:09 +01:00
|
|
|
immUnbindProgram();
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2015-01-05 02:12:50 +11:00
|
|
|
void sequencer_special_update_set(Sequence *seq)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2015-01-05 02:12:50 +11:00
|
|
|
special_seq_update = seq;
|
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2015-01-05 02:12:50 +11:00
|
|
|
Sequence *ED_sequencer_special_preview_get(void)
|
|
|
|
{
|
|
|
|
return special_seq_update;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ED_sequencer_special_preview_set(bContext *C, const int mval[2])
|
|
|
|
{
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
2015-01-05 02:12:50 +11:00
|
|
|
int hand;
|
|
|
|
Sequence *seq;
|
2020-03-06 16:56:42 +01:00
|
|
|
seq = find_nearest_seq(scene, ®ion->v2d, &hand, mval);
|
2015-01-05 02:12:50 +11:00
|
|
|
sequencer_special_update_set(seq);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ED_sequencer_special_preview_clear(void)
|
|
|
|
{
|
|
|
|
sequencer_special_update_set(NULL);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2020-08-30 19:58:40 +02:00
|
|
|
/**
|
|
|
|
* Rendering using opengl will change the current viewport/context.
|
2020-09-02 09:58:26 +10:00
|
|
|
* This is why we need the \a region, to set back the render area.
|
|
|
|
*
|
|
|
|
* TODO: do not rely on such hack and just update the \a ibuf outside of
|
2020-08-30 19:58:40 +02:00
|
|
|
* the UI drawing code.
|
2021-01-04 12:00:18 +11:00
|
|
|
*/
|
2018-05-31 12:46:32 +02:00
|
|
|
ImBuf *sequencer_ibuf_get(struct Main *bmain,
|
2020-08-30 19:58:40 +02:00
|
|
|
ARegion *region,
|
2018-05-31 12:46:32 +02:00
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
Scene *scene,
|
|
|
|
SpaceSeq *sseq,
|
2020-11-06 14:10:59 +01:00
|
|
|
int timeline_frame,
|
2018-05-31 12:46:32 +02:00
|
|
|
int frame_ofs,
|
|
|
|
const char *viewname)
|
2012-08-23 16:14:52 +00:00
|
|
|
{
|
2017-11-24 12:19:26 +01:00
|
|
|
SeqRenderData context = {0};
|
2012-08-23 16:14:52 +00:00
|
|
|
ImBuf *ibuf;
|
|
|
|
int rectx, recty;
|
2020-01-22 00:27:02 +01:00
|
|
|
double render_size;
|
2019-02-23 11:33:48 -08:00
|
|
|
short is_break = G.is_break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-05 02:24:51 +02:00
|
|
|
if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
|
2020-01-22 00:27:02 +01:00
|
|
|
return NULL;
|
2012-08-23 16:14:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-10-05 02:24:51 +02:00
|
|
|
if (sseq->render_size == SEQ_RENDER_SIZE_SCENE) {
|
2020-01-22 00:27:02 +01:00
|
|
|
render_size = scene->r.size / 100.0;
|
|
|
|
}
|
|
|
|
else {
|
2020-11-05 14:05:25 +01:00
|
|
|
render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
|
2012-08-23 16:14:52 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-04 16:23:00 +02:00
|
|
|
rectx = roundf(render_size * scene->r.xsch);
|
|
|
|
recty = roundf(render_size * scene->r.ysch);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-05 14:05:25 +01:00
|
|
|
SEQ_render_new_render_data(
|
2020-01-22 00:27:02 +01:00
|
|
|
bmain, depsgraph, scene, rectx, recty, sseq->render_size, false, &context);
|
2015-04-06 10:40:12 -03:00
|
|
|
context.view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-08-18 04:11:50 +10:00
|
|
|
/* Sequencer could start rendering, in this case we need to be sure it wouldn't be canceled
|
|
|
|
* by Escape pressed somewhere in the past. */
|
2014-03-20 15:45:20 +06:00
|
|
|
G.is_break = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-30 19:58:40 +02:00
|
|
|
GPUViewport *viewport = WM_draw_region_get_bound_viewport(region);
|
2019-03-23 19:09:25 +01:00
|
|
|
GPUFrameBuffer *fb = GPU_framebuffer_active_get();
|
2020-08-30 19:58:40 +02:00
|
|
|
if (viewport) {
|
|
|
|
/* Unbind viewport to release the DRW context. */
|
|
|
|
GPU_viewport_unbind(viewport);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Rendering can change OGL context. Save & Restore frame-buffer. */
|
2020-08-30 19:58:40 +02:00
|
|
|
GPU_framebuffer_restore();
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (special_seq_update) {
|
2020-11-06 14:10:59 +01:00
|
|
|
ibuf = SEQ_render_give_ibuf_direct(&context, timeline_frame + frame_ofs, special_seq_update);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else {
|
2020-11-06 14:10:59 +01:00
|
|
|
ibuf = SEQ_render_give_ibuf(&context, timeline_frame + frame_ofs, sseq->chanshown);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-30 19:58:40 +02:00
|
|
|
if (viewport) {
|
|
|
|
/* Follows same logic as wm_draw_window_offscreen to make sure to restore the same viewport. */
|
|
|
|
int view = (sseq->multiview_eye == STEREO_RIGHT_ID) ? 1 : 0;
|
|
|
|
GPU_viewport_bind(viewport, view, ®ion->winrct);
|
|
|
|
}
|
|
|
|
else if (fb) {
|
2019-03-31 14:52:47 -07:00
|
|
|
GPU_framebuffer_bind(fb);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Restore state so real rendering would be canceled if needed. */
|
2012-11-21 09:36:36 +00:00
|
|
|
G.is_break = is_break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-23 16:14:52 +00:00
|
|
|
return ibuf;
|
|
|
|
}
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
static void sequencer_check_scopes(SequencerScopes *scopes, ImBuf *ibuf)
|
|
|
|
{
|
|
|
|
if (scopes->reference_ibuf != ibuf) {
|
|
|
|
if (scopes->zebra_ibuf) {
|
|
|
|
IMB_freeImBuf(scopes->zebra_ibuf);
|
|
|
|
scopes->zebra_ibuf = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (scopes->waveform_ibuf) {
|
|
|
|
IMB_freeImBuf(scopes->waveform_ibuf);
|
|
|
|
scopes->waveform_ibuf = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (scopes->sep_waveform_ibuf) {
|
|
|
|
IMB_freeImBuf(scopes->sep_waveform_ibuf);
|
|
|
|
scopes->sep_waveform_ibuf = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (scopes->vector_ibuf) {
|
|
|
|
IMB_freeImBuf(scopes->vector_ibuf);
|
|
|
|
scopes->vector_ibuf = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (scopes->histogram_ibuf) {
|
|
|
|
IMB_freeImBuf(scopes->histogram_ibuf);
|
|
|
|
scopes->histogram_ibuf = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-05 23:39:20 +02:00
|
|
|
static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scope_fn)(ImBuf *ibuf))
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
{
|
|
|
|
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
|
|
|
|
ImBuf *scope;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-15 08:53:22 +11:00
|
|
|
IMB_colormanagement_imbuf_make_display_space(
|
|
|
|
display_ibuf, &scene->view_settings, &scene->display_settings);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2020-04-05 23:39:20 +02:00
|
|
|
scope = make_scope_fn(display_ibuf);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
|
|
|
IMB_freeImBuf(display_ibuf);
|
|
|
|
|
|
|
|
return scope;
|
|
|
|
}
|
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
static void sequencer_display_size(Scene *scene, float r_viewrect[2])
|
2015-02-16 13:19:22 +11:00
|
|
|
{
|
2019-02-27 13:48:27 -08:00
|
|
|
r_viewrect[0] = (float)scene->r.xsch;
|
|
|
|
r_viewrect[1] = (float)scene->r.ysch;
|
2015-02-16 13:19:22 +11:00
|
|
|
|
2019-05-19 11:18:23 -07:00
|
|
|
r_viewrect[0] *= scene->r.xasp / scene->r.yasp;
|
2015-02-16 13:19:22 +11:00
|
|
|
}
|
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
static void sequencer_draw_gpencil_overlay(const bContext *C)
|
2015-04-21 17:35:11 +02:00
|
|
|
{
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw grease-pencil (image aligned). */
|
2019-03-19 11:01:27 +01:00
|
|
|
ED_annotation_draw_2dimage(C);
|
2015-04-21 17:35:11 +02:00
|
|
|
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Orthographic at pixel level. */
|
2015-04-21 17:35:11 +02:00
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw grease-pencil (screen aligned). */
|
2019-03-19 11:01:27 +01:00
|
|
|
ED_annotation_draw_view2d(C, 0);
|
2015-04-21 17:35:11 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw content and safety borders borders. */
|
2020-12-15 23:15:32 +01:00
|
|
|
static void sequencer_draw_borders_overlay(const SpaceSeq *sseq,
|
|
|
|
const View2D *v2d,
|
|
|
|
const Scene *scene)
|
2015-04-21 17:35:11 +02:00
|
|
|
{
|
|
|
|
float x1 = v2d->tot.xmin;
|
|
|
|
float y1 = v2d->tot.ymin;
|
|
|
|
float x2 = v2d->tot.xmax;
|
|
|
|
float y2 = v2d->tot.ymax;
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2016-02-16 23:23:40 +11:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw border. */
|
2018-07-18 00:12:21 +02:00
|
|
|
const uint shdr_pos = GPU_vertformat_attr_add(
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-04-26 12:26:30 +02:00
|
|
|
|
2017-07-13 16:44:02 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
|
2016-10-13 23:28:11 +00:00
|
|
|
|
2017-04-26 20:51:17 +02:00
|
|
|
float viewport_size[4];
|
2018-07-02 18:27:05 +02:00
|
|
|
GPU_viewport_size_get_f(viewport_size);
|
2017-04-26 20:51:17 +02:00
|
|
|
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
|
2017-04-26 12:26:30 +02:00
|
|
|
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniformThemeColor(TH_BACK);
|
2018-07-01 08:42:16 +02:00
|
|
|
immUniform1i("colors_len", 0); /* Simple dashes. */
|
2017-04-26 20:51:17 +02:00
|
|
|
immUniform1f("dash_width", 6.0f);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniform1f("dash_factor", 0.5f);
|
2017-04-26 12:26:30 +02:00
|
|
|
|
2017-09-26 15:21:01 +10:00
|
|
|
imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
|
2015-04-21 17:35:11 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw safety border. */
|
2015-04-21 17:35:11 +02:00
|
|
|
if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f);
|
2017-04-26 12:26:30 +02:00
|
|
|
|
2021-01-25 18:31:11 +11:00
|
|
|
UI_draw_safe_areas(shdr_pos,
|
|
|
|
&(const rctf){
|
|
|
|
.xmin = x1,
|
|
|
|
.xmax = x2,
|
|
|
|
.ymin = y1,
|
|
|
|
.ymax = y2,
|
|
|
|
},
|
|
|
|
scene->safe_areas.title,
|
|
|
|
scene->safe_areas.action);
|
2015-04-21 17:35:11 +02:00
|
|
|
|
|
|
|
if (sseq->flag & SEQ_SHOW_SAFE_CENTER) {
|
|
|
|
UI_draw_safe_areas(shdr_pos,
|
2021-01-25 18:31:11 +11:00
|
|
|
&(const rctf){
|
|
|
|
.xmin = x1,
|
|
|
|
.xmax = x2,
|
|
|
|
.ymin = y1,
|
|
|
|
.ymax = y2,
|
|
|
|
},
|
2015-04-21 17:35:11 +02:00
|
|
|
scene->safe_areas.title_center,
|
|
|
|
scene->safe_areas.action_center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-13 23:28:11 +00:00
|
|
|
immUnbindProgram();
|
2015-04-21 17:35:11 +02:00
|
|
|
}
|
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
#if 0
|
2020-03-06 16:56:42 +01:00
|
|
|
void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq)
|
2015-04-21 17:35:11 +02:00
|
|
|
{
|
2020-09-02 09:58:26 +10:00
|
|
|
/* NOTE: sequencer mask editing isn't finished, the draw code is working but editing not.
|
2020-04-05 23:55:51 +02:00
|
|
|
* For now just disable drawing since the strip frame will likely be offset. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
// if (sc->mode == SC_MODE_MASKEDIT)
|
|
|
|
if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
|
2020-12-19 05:57:27 +01:00
|
|
|
Mask *mask = SEQ_active_mask_get(scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (mask) {
|
|
|
|
int width, height;
|
|
|
|
float aspx = 1.0f, aspy = 1.0f;
|
|
|
|
// ED_mask_get_size(C, &width, &height);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
//Scene *scene = CTX_data_scene(C);
|
|
|
|
width = (scene->r.size * scene->r.xsch) / 100;
|
|
|
|
height = (scene->r.size * scene->r.ysch) / 100;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-17 08:24:14 +02:00
|
|
|
ED_mask_draw_region(mask,
|
2020-03-06 16:56:42 +01:00
|
|
|
region,
|
2019-04-17 08:24:14 +02:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0, /* TODO */
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
aspx,
|
|
|
|
aspy,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
NULL,
|
|
|
|
C);
|
2015-04-21 17:35:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
#endif
|
2015-04-21 17:35:11 +02:00
|
|
|
|
2019-09-13 17:21:54 -07:00
|
|
|
/* Force redraw, when prefetching and using cache view. */
|
|
|
|
static void seq_prefetch_wm_notify(const bContext *C, Scene *scene)
|
|
|
|
{
|
2020-12-19 05:57:27 +01:00
|
|
|
if (SEQ_prefetch_need_redraw(CTX_data_main(C), scene)) {
|
2019-09-13 17:21:54 -07:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-17 16:41:02 +02:00
|
|
|
static void *sequencer_OCIO_transform_ibuf(const bContext *C,
|
|
|
|
ImBuf *ibuf,
|
|
|
|
bool *r_glsl_used,
|
|
|
|
eGPUTextureFormat *r_format,
|
|
|
|
eGPUDataFormat *r_data)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2013-04-04 12:20:13 +00:00
|
|
|
void *display_buffer;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
void *cache_handle = NULL;
|
2019-02-27 13:48:27 -08:00
|
|
|
bool force_fallback = false;
|
2020-03-25 17:58:58 +11:00
|
|
|
*r_glsl_used = false;
|
2019-04-20 12:47:06 +02:00
|
|
|
force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
|
2019-02-27 13:48:27 -08:00
|
|
|
force_fallback |= (ibuf->dither != 0.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-17 16:41:02 +02:00
|
|
|
/* Default */
|
|
|
|
*r_format = GPU_RGBA8;
|
2021-02-17 12:38:21 -03:00
|
|
|
*r_data = GPU_DATA_UBYTE;
|
2020-07-17 16:41:02 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Fallback to CPU based color space conversion. */
|
2019-02-27 13:48:27 -08:00
|
|
|
if (force_fallback) {
|
2020-03-25 17:58:58 +11:00
|
|
|
*r_glsl_used = false;
|
2019-02-27 13:48:27 -08:00
|
|
|
display_buffer = NULL;
|
|
|
|
}
|
|
|
|
else if (ibuf->rect_float) {
|
|
|
|
display_buffer = ibuf->rect_float;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-17 16:41:02 +02:00
|
|
|
*r_data = GPU_DATA_FLOAT;
|
2019-02-27 13:48:27 -08:00
|
|
|
if (ibuf->channels == 4) {
|
2020-07-17 16:41:02 +02:00
|
|
|
*r_format = GPU_RGBA16F;
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
|
|
|
else if (ibuf->channels == 3) {
|
2020-07-17 16:41:02 +02:00
|
|
|
/* Alpha is implicitly 1. */
|
|
|
|
*r_format = GPU_RGB16F;
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
BLI_assert(!"Incompatible number of channels for float buffer in sequencer");
|
2020-07-17 16:41:02 +02:00
|
|
|
*r_format = GPU_RGBA16F;
|
2019-02-27 13:48:27 -08:00
|
|
|
display_buffer = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (ibuf->float_colorspace) {
|
2020-03-25 17:58:58 +11:00
|
|
|
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
2019-02-27 13:48:27 -08:00
|
|
|
C, ibuf->float_colorspace, ibuf->dither, true);
|
|
|
|
}
|
|
|
|
else {
|
2020-03-25 17:58:58 +11:00
|
|
|
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ibuf->rect) {
|
|
|
|
display_buffer = ibuf->rect;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-25 17:58:58 +11:00
|
|
|
*r_glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(
|
2019-02-27 13:48:27 -08:00
|
|
|
C, ibuf->rect_colorspace, ibuf->dither, false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
display_buffer = NULL;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* There is data to be displayed, but GLSL is not initialized
|
|
|
|
* properly, in this case we fallback to CPU-based display transform. */
|
2020-03-25 17:58:58 +11:00
|
|
|
if ((ibuf->rect || ibuf->rect_float) && !*r_glsl_used) {
|
2019-02-27 13:48:27 -08:00
|
|
|
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
|
2020-09-15 15:21:11 +02:00
|
|
|
*r_format = GPU_RGBA8;
|
2021-02-17 12:38:21 -03:00
|
|
|
*r_data = GPU_DATA_UBYTE;
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
if (cache_handle) {
|
2019-02-27 13:48:27 -08:00
|
|
|
IMB_display_buffer_release(cache_handle);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
return display_buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
|
|
|
|
{
|
2017-08-11 18:02:54 +02:00
|
|
|
if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Stop all running jobs, except screen one. Currently previews frustrate Render.
|
2020-09-02 09:58:26 +10:00
|
|
|
* Need to make so sequencers rendering doesn't conflict with compositor. */
|
2013-09-23 19:35:21 +00:00
|
|
|
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_COMPOSITE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* In case of final rendering used for preview, kill all previews,
|
|
|
|
* otherwise threading conflict will happen in rendering module. */
|
2017-08-11 18:02:54 +02:00
|
|
|
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_RENDER_PREVIEW);
|
2012-11-09 16:49:17 +00:00
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2012-11-09 16:49:17 +00:00
|
|
|
|
2019-02-28 12:12:29 +11:00
|
|
|
static void sequencer_preview_clear(void)
|
2019-02-27 13:48:27 -08:00
|
|
|
{
|
2020-08-23 11:11:27 +02:00
|
|
|
UI_ThemeClearColor(TH_SEQ_PREVIEW);
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2015-04-21 17:35:11 +02:00
|
|
|
|
2019-02-28 12:15:42 +11:00
|
|
|
static void sequencer_preview_get_rect(rctf *preview,
|
|
|
|
Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region,
|
2019-02-28 12:15:42 +11:00
|
|
|
SpaceSeq *sseq,
|
|
|
|
bool draw_overlay,
|
|
|
|
bool draw_backdrop)
|
2019-02-27 13:48:27 -08:00
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
struct View2D *v2d = ®ion->v2d;
|
2019-02-27 13:48:27 -08:00
|
|
|
float viewrect[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
sequencer_display_size(scene, viewrect);
|
|
|
|
BLI_rctf_init(preview, -1.0f, 1.0f, -1.0f, 1.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
|
|
|
|
preview->xmax = v2d->tot.xmin +
|
|
|
|
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
|
|
|
|
preview->xmin = v2d->tot.xmin +
|
|
|
|
(fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
|
|
|
|
preview->ymax = v2d->tot.ymin +
|
|
|
|
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
|
|
|
|
preview->ymin = v2d->tot.ymin +
|
|
|
|
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
|
2015-04-21 17:35:11 +02:00
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
else if (draw_backdrop) {
|
2020-03-06 16:56:42 +01:00
|
|
|
float aspect = BLI_rcti_size_x(®ion->winrct) / (float)BLI_rcti_size_y(®ion->winrct);
|
2019-02-27 13:48:27 -08:00
|
|
|
float image_aspect = viewrect[0] / viewrect[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (aspect >= image_aspect) {
|
|
|
|
preview->xmax = image_aspect / aspect;
|
|
|
|
preview->xmin = -preview->xmax;
|
2014-01-08 15:40:55 +11:00
|
|
|
}
|
|
|
|
else {
|
2019-02-27 13:48:27 -08:00
|
|
|
preview->ymax = aspect / image_aspect;
|
|
|
|
preview->ymin = -preview->ymax;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
else {
|
|
|
|
*preview = v2d->tot;
|
2013-04-26 18:56:15 +00:00
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
|
|
|
|
2019-02-28 12:15:42 +11:00
|
|
|
static void sequencer_draw_display_buffer(const bContext *C,
|
|
|
|
Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region,
|
2019-02-28 12:15:42 +11:00
|
|
|
SpaceSeq *sseq,
|
|
|
|
ImBuf *ibuf,
|
|
|
|
ImBuf *scope,
|
|
|
|
bool draw_overlay,
|
|
|
|
bool draw_backdrop)
|
2019-02-27 13:48:27 -08:00
|
|
|
{
|
|
|
|
void *display_buffer;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Format needs to be created prior to any #immBindShader call.
|
2020-04-05 23:55:51 +02:00
|
|
|
* Do it here because OCIO binds its own shader. */
|
2020-07-17 16:41:02 +02:00
|
|
|
eGPUTextureFormat format;
|
|
|
|
eGPUDataFormat data;
|
2019-02-27 13:48:27 -08:00
|
|
|
bool glsl_used = false;
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *imm_format = immVertexFormat();
|
|
|
|
uint pos = GPU_vertformat_attr_add(imm_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
uint texCoord = GPU_vertformat_attr_add(
|
|
|
|
imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-07-23 16:57:11 +00:00
|
|
|
if (scope) {
|
|
|
|
ibuf = scope;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
if (ibuf->rect_float && ibuf->rect == NULL) {
|
|
|
|
IMB_rect_from_float(ibuf);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 16:21:24 +11:00
|
|
|
display_buffer = (uchar *)ibuf->rect;
|
2020-07-17 16:41:02 +02:00
|
|
|
format = GPU_RGBA8;
|
2021-02-17 12:38:21 -03:00
|
|
|
data = GPU_DATA_UBYTE;
|
2010-01-09 00:16:35 +00:00
|
|
|
}
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
else {
|
2020-07-17 16:41:02 +02:00
|
|
|
display_buffer = sequencer_OCIO_transform_ibuf(C, ibuf, &glsl_used, &format, &data);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (draw_backdrop) {
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
|
|
|
GPU_matrix_identity_set();
|
2019-01-24 12:38:40 +01:00
|
|
|
GPU_matrix_push_projection();
|
|
|
|
GPU_matrix_identity_projection_set();
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-05 17:33:56 +02:00
|
|
|
GPUTexture *texture = GPU_texture_create_2d(
|
|
|
|
"seq_display_buf", ibuf->x, ibuf->y, 1, format, NULL);
|
2020-09-04 22:56:30 +02:00
|
|
|
GPU_texture_update(texture, data, display_buffer);
|
2020-07-17 16:41:02 +02:00
|
|
|
GPU_texture_filter_mode(texture, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-17 16:41:02 +02:00
|
|
|
GPU_texture_bind(texture, 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-05-08 16:38:49 +02:00
|
|
|
if (!glsl_used) {
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
|
|
|
immUniformColor3f(1.0f, 1.0f, 1.0f);
|
2018-03-24 20:27:39 +01:00
|
|
|
immUniform1i("image", 0);
|
2017-05-08 16:38:49 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_TRI_FAN, 4);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
rctf preview;
|
|
|
|
rctf canvas;
|
2020-03-06 16:56:42 +01:00
|
|
|
sequencer_preview_get_rect(&preview, scene, region, sseq, draw_overlay, draw_backdrop);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
|
|
|
|
canvas = scene->ed->over_border;
|
2014-11-24 18:18:35 +01:00
|
|
|
}
|
2010-07-08 10:03:29 +00:00
|
|
|
else {
|
2019-02-27 13:48:27 -08:00
|
|
|
BLI_rctf_init(&canvas, 0.0f, 1.0f, 0.0f, 1.0f);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
immAttr2f(texCoord, canvas.xmin, canvas.ymin);
|
|
|
|
immVertex2f(pos, preview.xmin, preview.ymin);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
immAttr2f(texCoord, canvas.xmin, canvas.ymax);
|
|
|
|
immVertex2f(pos, preview.xmin, preview.ymax);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
immAttr2f(texCoord, canvas.xmax, canvas.ymax);
|
|
|
|
immVertex2f(pos, preview.xmax, preview.ymax);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
immAttr2f(texCoord, canvas.xmax, canvas.ymin);
|
|
|
|
immVertex2f(pos, preview.xmax, preview.ymin);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immEnd();
|
2020-07-17 16:41:02 +02:00
|
|
|
|
|
|
|
GPU_texture_unbind(texture);
|
|
|
|
GPU_texture_free(texture);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-05-08 16:38:49 +02:00
|
|
|
if (!glsl_used) {
|
|
|
|
immUnbindProgram();
|
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
else {
|
|
|
|
IMB_colormanagement_finish_glsl_draw();
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (draw_backdrop) {
|
|
|
|
GPU_matrix_pop();
|
|
|
|
GPU_matrix_pop_projection();
|
|
|
|
}
|
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, bool draw_backdrop)
|
|
|
|
{
|
|
|
|
struct ImBuf *scope = NULL;
|
|
|
|
SequencerScopes *scopes = &sseq->scopes;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
|
|
|
|
sequencer_check_scopes(scopes, ibuf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
switch (sseq->mainb) {
|
2019-02-28 12:15:42 +11:00
|
|
|
case SEQ_DRAW_IMG_IMBUF:
|
|
|
|
if (!scopes->zebra_ibuf) {
|
|
|
|
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-28 12:15:42 +11:00
|
|
|
if (display_ibuf->rect_float) {
|
|
|
|
IMB_colormanagement_imbuf_make_display_space(
|
|
|
|
display_ibuf, &scene->view_settings, &scene->display_settings);
|
|
|
|
}
|
|
|
|
scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
|
|
|
|
IMB_freeImBuf(display_ibuf);
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2019-02-28 12:15:42 +11:00
|
|
|
scope = scopes->zebra_ibuf;
|
|
|
|
break;
|
|
|
|
case SEQ_DRAW_IMG_WAVEFORM:
|
|
|
|
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!scopes->sep_waveform_ibuf) {
|
2019-02-28 12:15:42 +11:00
|
|
|
scopes->sep_waveform_ibuf = sequencer_make_scope(
|
|
|
|
scene, ibuf, make_sep_waveform_view_from_ibuf);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-02-28 12:15:42 +11:00
|
|
|
scope = scopes->sep_waveform_ibuf;
|
|
|
|
}
|
|
|
|
else {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!scopes->waveform_ibuf) {
|
2019-02-28 12:15:42 +11:00
|
|
|
scopes->waveform_ibuf = sequencer_make_scope(
|
|
|
|
scene, ibuf, make_waveform_view_from_ibuf);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-02-28 12:15:42 +11:00
|
|
|
scope = scopes->waveform_ibuf;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SEQ_DRAW_IMG_VECTORSCOPE:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!scopes->vector_ibuf) {
|
2019-02-28 12:15:42 +11:00
|
|
|
scopes->vector_ibuf = sequencer_make_scope(scene, ibuf, make_vectorscope_view_from_ibuf);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-02-28 12:15:42 +11:00
|
|
|
scope = scopes->vector_ibuf;
|
|
|
|
break;
|
|
|
|
case SEQ_DRAW_IMG_HISTOGRAM:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!scopes->histogram_ibuf) {
|
2019-02-28 12:15:42 +11:00
|
|
|
scopes->histogram_ibuf = sequencer_make_scope(
|
|
|
|
scene, ibuf, make_histogram_view_from_ibuf);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-02-28 12:15:42 +11:00
|
|
|
scope = scopes->histogram_ibuf;
|
|
|
|
break;
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Future files may have new scopes we don't catch above. */
|
2019-02-27 13:48:27 -08:00
|
|
|
if (scope) {
|
|
|
|
scopes->reference_ibuf = ibuf;
|
|
|
|
}
|
2015-05-04 12:17:49 +02:00
|
|
|
}
|
2019-02-27 13:48:27 -08:00
|
|
|
return scope;
|
|
|
|
}
|
2015-05-04 12:17:49 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
void sequencer_draw_preview(const bContext *C,
|
2019-02-28 12:15:42 +11:00
|
|
|
Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region,
|
2019-02-28 12:15:42 +11:00
|
|
|
SpaceSeq *sseq,
|
2020-11-06 14:10:59 +01:00
|
|
|
int timeline_frame,
|
2020-09-04 20:59:13 +02:00
|
|
|
int offset,
|
2019-02-28 12:15:42 +11:00
|
|
|
bool draw_overlay,
|
|
|
|
bool draw_backdrop)
|
2019-02-27 13:48:27 -08:00
|
|
|
{
|
|
|
|
struct Main *bmain = CTX_data_main(C);
|
2019-07-25 16:36:22 +02:00
|
|
|
struct Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
struct View2D *v2d = ®ion->v2d;
|
2019-02-27 13:48:27 -08:00
|
|
|
struct ImBuf *ibuf = NULL;
|
|
|
|
struct ImBuf *scope = NULL;
|
|
|
|
float viewrect[2];
|
|
|
|
const bool show_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
|
|
|
|
const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
|
|
|
|
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
sequencer_stop_running_jobs(C, scene);
|
|
|
|
if (G.is_rendering) {
|
2014-11-24 18:18:35 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-30 19:58:40 +02:00
|
|
|
/* Get image. */
|
|
|
|
ibuf = sequencer_ibuf_get(
|
2020-11-06 14:10:59 +01:00
|
|
|
bmain, region, depsgraph, scene, sseq, timeline_frame, offset, names[sseq->multiview_eye]);
|
2020-08-30 19:58:40 +02:00
|
|
|
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Setup off-screen buffers. */
|
2020-08-18 14:43:18 +02:00
|
|
|
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
|
|
|
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
|
|
|
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
2020-08-20 16:38:34 +02:00
|
|
|
GPU_depth_test(GPU_DEPTH_NONE);
|
2020-08-18 14:43:18 +02:00
|
|
|
|
2020-10-05 02:24:51 +02:00
|
|
|
if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
|
2019-02-27 13:48:27 -08:00
|
|
|
sequencer_preview_clear();
|
|
|
|
return;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Setup view. */
|
2019-02-27 13:48:27 -08:00
|
|
|
sequencer_display_size(scene, viewrect);
|
2020-09-04 16:23:00 +02:00
|
|
|
UI_view2d_totRect_set(v2d, roundf(viewrect[0] + 0.5f), roundf(viewrect[1] + 0.5f));
|
2019-02-27 13:48:27 -08:00
|
|
|
UI_view2d_curRect_validate(v2d);
|
|
|
|
UI_view2d_view_ortho(v2d);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw background. */
|
2019-02-27 13:48:27 -08:00
|
|
|
if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) {
|
|
|
|
sequencer_preview_clear();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (sseq->flag & SEQ_USE_ALPHA) {
|
|
|
|
imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
|
|
|
|
}
|
2012-12-17 02:34:53 +00:00
|
|
|
}
|
2020-08-18 14:43:18 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
if (ibuf) {
|
|
|
|
scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw image. */
|
2020-03-06 16:56:42 +01:00
|
|
|
sequencer_draw_display_buffer(
|
|
|
|
C, scene, region, sseq, ibuf, scope, draw_overlay, draw_backdrop);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw over image. */
|
2020-12-15 23:15:32 +01:00
|
|
|
if (sseq->flag & SEQ_SHOW_METADATA && sseq->flag & SEQ_SHOW_STRIP_OVERLAY) {
|
2019-02-27 13:48:27 -08:00
|
|
|
ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
if (show_imbuf && (sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) {
|
|
|
|
sequencer_draw_borders_overlay(sseq, v2d, scene);
|
2019-02-27 13:48:27 -08:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-15 23:15:32 +01:00
|
|
|
if (draw_gpencil && show_imbuf && (sseq->flag & SEQ_SHOW_STRIP_OVERLAY)) {
|
|
|
|
sequencer_draw_gpencil_overlay(C);
|
2019-03-01 12:23:15 -08:00
|
|
|
}
|
2020-04-05 23:55:51 +02:00
|
|
|
#if 0
|
|
|
|
sequencer_draw_maskedit(C, scene, region, sseq);
|
|
|
|
#endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Scope is freed in sequencer_check_scopes when `ibuf` changes and redraw is needed. */
|
2019-02-27 13:48:27 -08:00
|
|
|
if (ibuf) {
|
|
|
|
IMB_freeImBuf(ibuf);
|
2012-06-07 19:24:49 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 13:48:27 -08:00
|
|
|
UI_view2d_view_restore(C);
|
2019-09-13 17:21:54 -07:00
|
|
|
seq_prefetch_wm_notify(C, scene);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw backdrop in sequencer timeline. */
|
2009-11-26 12:22:43 +00:00
|
|
|
static void draw_seq_backdrop(View2D *v2d)
|
2009-01-12 19:02:08 +00:00
|
|
|
{
|
2009-11-26 12:22:43 +00:00
|
|
|
int i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-02-08 02:43:17 -02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-05 14:21:54 -06:00
|
|
|
/* View backdrop. */
|
|
|
|
immUniformThemeColorShade(TH_BACK, -25);
|
|
|
|
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
|
|
|
|
|
2020-11-25 16:37:33 -05:00
|
|
|
/* Darker overlay over the view backdrop. */
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformThemeColorShade(TH_BACK, -20);
|
|
|
|
immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Alternating horizontal stripes. */
|
2012-10-23 13:28:22 +00:00
|
|
|
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-05 14:21:54 -06:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
|
|
|
immUniformThemeColor(TH_ROW_ALTERNATE);
|
2020-11-25 16:37:33 -05:00
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
while (i < v2d->cur.ymax) {
|
2017-02-18 15:39:21 -05:00
|
|
|
if (i & 1) {
|
2021-01-05 14:21:54 -06:00
|
|
|
immRectf(pos, v2d->cur.xmin, i, v2d->cur.xmax, i + 1);
|
2017-02-08 02:43:17 -02:00
|
|
|
}
|
|
|
|
i++;
|
2012-03-29 22:26:11 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-05 14:21:54 -06:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
|
|
|
|
2020-11-25 16:37:33 -05:00
|
|
|
/* Lines separating the horizontal bands. */
|
2012-10-23 13:28:22 +00:00
|
|
|
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
|
2018-07-08 13:19:10 +02:00
|
|
|
int line_len = (int)v2d->cur.ymax - i + 1;
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformThemeColor(TH_GRID);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, line_len * 2);
|
2018-07-08 13:19:10 +02:00
|
|
|
while (line_len--) {
|
2017-02-08 02:43:17 -02:00
|
|
|
immVertex2f(pos, v2d->cur.xmax, i);
|
|
|
|
immVertex2f(pos, v2d->cur.xmin, i);
|
2020-12-30 12:56:24 -06:00
|
|
|
i++;
|
2012-03-29 22:26:11 +00:00
|
|
|
}
|
2017-02-08 02:43:17 -02:00
|
|
|
immEnd();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUnbindProgram();
|
2009-11-26 12:22:43 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
2009-11-26 12:22:43 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
View2D *v2d = ®ion->v2d;
|
2014-11-24 18:18:35 +01:00
|
|
|
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
2020-12-19 05:57:27 +01:00
|
|
|
Sequence *last_seq = SEQ_select_active_get(scene);
|
2009-11-26 12:22:43 +00:00
|
|
|
int sel = 0, j;
|
2012-09-15 11:48:20 +00:00
|
|
|
float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Loop through twice, first unselected, then selected. */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (j = 0; j < 2; j++) {
|
2009-11-26 12:22:43 +00:00
|
|
|
Sequence *seq;
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Loop through strips, checking for those that are visible. */
|
2012-03-29 22:26:11 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Bound-box and selection tests for NOT drawing the strip. */
|
2019-03-26 21:16:47 +11:00
|
|
|
if ((seq->flag & SELECT) != sel) {
|
|
|
|
continue;
|
|
|
|
}
|
2020-07-03 17:20:58 +02:00
|
|
|
if (seq == last_seq && (last_seq->flag & SELECT)) {
|
2019-03-26 21:16:47 +11:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-03 17:20:58 +02:00
|
|
|
if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) {
|
2019-03-26 21:16:47 +11:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-03 17:20:58 +02:00
|
|
|
if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) {
|
2019-03-26 21:16:47 +11:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-03 17:20:58 +02:00
|
|
|
if (seq->machine + 1.0f < v2d->cur.ymin) {
|
2019-03-26 21:16:47 +11:00
|
|
|
continue;
|
|
|
|
}
|
2020-07-03 17:20:58 +02:00
|
|
|
if (seq->machine > v2d->cur.ymax) {
|
2019-03-26 21:16:47 +11:00
|
|
|
continue;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Strip passed all tests, draw it now. */
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_seq_strip(C, sseq, scene, region, seq, pixelx, seq == last_seq ? true : false);
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw selected next time round. */
|
2012-03-29 22:26:11 +00:00
|
|
|
sel = SELECT;
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
/* When selected draw the last selected (active) strip last,
|
|
|
|
* removes some overlapping error. */
|
|
|
|
if (last_seq && (last_seq->flag & SELECT)) {
|
|
|
|
draw_seq_strip(C, sseq, scene, region, last_seq, pixelx, true);
|
|
|
|
|
|
|
|
/* When active strip is an effect, highlight its inputs. */
|
2020-12-19 05:57:27 +01:00
|
|
|
if (SEQ_effect_get_num_inputs(last_seq->type) > 0) {
|
2020-03-19 00:24:09 +01:00
|
|
|
draw_effect_inputs_highlight(last_seq);
|
|
|
|
}
|
2020-09-02 09:58:26 +10:00
|
|
|
/* When active is a Multi-cam strip, highlight its source channel. */
|
2020-03-19 00:24:09 +01:00
|
|
|
else if (last_seq->type == SEQ_TYPE_MULTICAM) {
|
|
|
|
int channel = last_seq->multicam_source;
|
|
|
|
if (channel != 0) {
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-03-19 00:24:09 +01:00
|
|
|
uint pos = GPU_vertformat_attr_add(
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
|
|
|
immUniformColor4ub(255, 255, 255, 48);
|
|
|
|
immRectf(pos, v2d->cur.xmin, channel, v2d->cur.xmax, channel + 1);
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2020-03-19 00:24:09 +01:00
|
|
|
}
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw highlight if "solo preview" is used. */
|
2015-01-05 02:12:50 +11:00
|
|
|
if (special_seq_update) {
|
|
|
|
const Sequence *seq = special_seq_update;
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-02-08 02:43:17 -02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformColor4ub(255, 255, 255, 48);
|
|
|
|
immRectf(pos,
|
|
|
|
seq->startdisp,
|
|
|
|
seq->machine + SEQ_STRIP_OFSBOTTOM,
|
|
|
|
seq->enddisp,
|
|
|
|
seq->machine + SEQ_STRIP_OFSTOP);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2015-01-05 02:12:50 +11:00
|
|
|
}
|
2009-11-26 12:22:43 +00:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
|
2010-10-16 08:03:28 +00:00
|
|
|
static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
|
2014-10-16 12:01:01 +02:00
|
|
|
{
|
2020-12-19 05:57:27 +01:00
|
|
|
const Editing *ed = SEQ_editing_get(scene, false);
|
2019-11-02 22:34:44 -07:00
|
|
|
const int frame_sta = scene->r.sfra;
|
|
|
|
const int frame_end = scene->r.efra + 1;
|
2014-10-16 12:01:01 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2017-02-08 02:43:17 -02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-02-08 02:43:17 -02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw overlay outside of frame range. */
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformThemeColorShadeAlpha(TH_BACK, -25, -100);
|
2010-06-06 20:19:22 +00:00
|
|
|
|
2015-06-25 20:10:30 +02:00
|
|
|
if (frame_sta < frame_end) {
|
2017-02-08 02:43:17 -02:00
|
|
|
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)frame_sta, v2d->cur.ymax);
|
|
|
|
immRectf(pos, (float)frame_end, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
|
2010-06-06 20:19:22 +00:00
|
|
|
}
|
|
|
|
else {
|
2017-02-08 02:43:17 -02:00
|
|
|
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
|
2010-06-06 20:19:22 +00:00
|
|
|
}
|
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformThemeColorShade(TH_BACK, -60);
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw frame range boundary. */
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 4);
|
2017-02-08 02:43:17 -02:00
|
|
|
|
|
|
|
immVertex2f(pos, frame_sta, v2d->cur.ymin);
|
|
|
|
immVertex2f(pos, frame_sta, v2d->cur.ymax);
|
|
|
|
|
|
|
|
immVertex2f(pos, frame_end, v2d->cur.ymin);
|
|
|
|
immVertex2f(pos, frame_end, v2d->cur.ymax);
|
|
|
|
|
|
|
|
immEnd();
|
2014-10-16 12:01:01 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* While in meta strip, draw a checkerboard overlay outside of frame range. */
|
2014-10-16 23:18:49 +02:00
|
|
|
if (ed && !BLI_listbase_is_empty(&ed->metastack)) {
|
2014-10-16 12:01:01 +02:00
|
|
|
MetaStack *ms = ed->metastack.last;
|
2020-03-19 00:24:09 +01:00
|
|
|
immUnbindProgram();
|
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_CHECKER);
|
|
|
|
|
|
|
|
immUniform4f("color1", 0.0f, 0.0f, 0.0f, 0.22f);
|
|
|
|
immUniform4f("color2", 1.0f, 1.0f, 1.0f, 0.0f);
|
|
|
|
immUniform1i("size", 8);
|
|
|
|
|
|
|
|
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, ms->disp_range[0], v2d->cur.ymax);
|
|
|
|
immRectf(pos, ms->disp_range[1], v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
|
2014-10-16 12:01:01 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immUnbindProgram();
|
2017-02-08 02:43:17 -02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2017-02-08 02:43:17 -02:00
|
|
|
immUniformThemeColorShade(TH_BACK, -40);
|
2014-10-16 12:01:01 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 4);
|
2014-10-16 12:01:01 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immVertex2f(pos, ms->disp_range[0], v2d->cur.ymin);
|
|
|
|
immVertex2f(pos, ms->disp_range[0], v2d->cur.ymax);
|
|
|
|
|
|
|
|
immVertex2f(pos, ms->disp_range[1], v2d->cur.ymin);
|
|
|
|
immVertex2f(pos, ms->disp_range[1], v2d->cur.ymax);
|
|
|
|
|
|
|
|
immEnd();
|
2014-10-16 12:01:01 +02:00
|
|
|
}
|
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUnbindProgram();
|
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2010-06-06 20:19:22 +00:00
|
|
|
}
|
|
|
|
|
2019-04-28 14:13:41 -07:00
|
|
|
typedef struct CacheDrawData {
|
2020-02-17 16:02:36 +01:00
|
|
|
struct View2D *v2d;
|
2019-04-28 14:13:41 -07:00
|
|
|
float stripe_offs;
|
|
|
|
float stripe_ht;
|
2020-03-25 00:23:06 +01:00
|
|
|
int cache_flag;
|
2020-02-17 16:02:36 +01:00
|
|
|
GPUVertBuf *raw_vbo;
|
|
|
|
GPUVertBuf *preprocessed_vbo;
|
|
|
|
GPUVertBuf *composite_vbo;
|
|
|
|
GPUVertBuf *final_out_vbo;
|
|
|
|
size_t raw_vert_count;
|
|
|
|
size_t preprocessed_vert_count;
|
|
|
|
size_t composite_vert_count;
|
|
|
|
size_t final_out_vert_count;
|
2019-04-28 14:13:41 -07:00
|
|
|
} CacheDrawData;
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Called as a callback. */
|
2020-04-05 23:39:20 +02:00
|
|
|
static bool draw_cache_view_init_fn(void *userdata, size_t item_count)
|
2020-03-25 00:23:06 +01:00
|
|
|
{
|
|
|
|
if (item_count == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CacheDrawData *drawdata = userdata;
|
|
|
|
/* We can not get item count per cache type, so using total item count is safe. */
|
|
|
|
size_t max_vert_count = item_count * 6;
|
|
|
|
GPU_vertbuf_data_alloc(drawdata->raw_vbo, max_vert_count);
|
|
|
|
GPU_vertbuf_data_alloc(drawdata->preprocessed_vbo, max_vert_count);
|
|
|
|
GPU_vertbuf_data_alloc(drawdata->composite_vbo, max_vert_count);
|
|
|
|
GPU_vertbuf_data_alloc(drawdata->final_out_vbo, max_vert_count);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Called as a callback */
|
2020-12-20 03:58:38 +01:00
|
|
|
static bool draw_cache_view_iter_fn(void *userdata,
|
|
|
|
struct Sequence *seq,
|
|
|
|
int timeline_frame,
|
|
|
|
int cache_type)
|
2019-04-28 14:13:41 -07:00
|
|
|
{
|
|
|
|
CacheDrawData *drawdata = userdata;
|
2020-02-17 16:02:36 +01:00
|
|
|
struct View2D *v2d = drawdata->v2d;
|
2019-04-28 14:13:41 -07:00
|
|
|
float stripe_bot, stripe_top, stripe_offs, stripe_ht;
|
2020-02-17 16:02:36 +01:00
|
|
|
GPUVertBuf *vbo;
|
|
|
|
size_t *vert_count;
|
2019-04-28 14:13:41 -07:00
|
|
|
|
2020-03-25 00:23:06 +01:00
|
|
|
if ((cache_type & SEQ_CACHE_STORE_FINAL_OUT) &&
|
|
|
|
(drawdata->cache_flag & SEQ_CACHE_VIEW_FINAL_OUT)) {
|
|
|
|
stripe_ht = UI_view2d_region_to_view_y(v2d, 4.0f * UI_DPI_FAC * U.pixelsize) - v2d->cur.ymin;
|
|
|
|
stripe_bot = UI_view2d_region_to_view_y(v2d, V2D_SCROLL_HANDLE_HEIGHT);
|
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
|
|
|
vbo = drawdata->final_out_vbo;
|
|
|
|
vert_count = &drawdata->final_out_vert_count;
|
|
|
|
}
|
|
|
|
else if ((cache_type & SEQ_CACHE_STORE_RAW) && (drawdata->cache_flag & SEQ_CACHE_VIEW_RAW)) {
|
|
|
|
stripe_offs = drawdata->stripe_offs;
|
|
|
|
stripe_ht = drawdata->stripe_ht;
|
|
|
|
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_offs;
|
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
|
|
|
vbo = drawdata->raw_vbo;
|
|
|
|
vert_count = &drawdata->raw_vert_count;
|
|
|
|
}
|
|
|
|
else if ((cache_type & SEQ_CACHE_STORE_PREPROCESSED) &&
|
|
|
|
(drawdata->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED)) {
|
|
|
|
stripe_offs = drawdata->stripe_offs;
|
|
|
|
stripe_ht = drawdata->stripe_ht;
|
|
|
|
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + (stripe_offs + stripe_ht) + stripe_offs;
|
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
|
|
|
vbo = drawdata->preprocessed_vbo;
|
|
|
|
vert_count = &drawdata->preprocessed_vert_count;
|
|
|
|
}
|
|
|
|
else if ((cache_type & SEQ_CACHE_STORE_COMPOSITE) &&
|
|
|
|
(drawdata->cache_flag & SEQ_CACHE_VIEW_COMPOSITE)) {
|
|
|
|
stripe_offs = drawdata->stripe_offs;
|
|
|
|
stripe_ht = drawdata->stripe_ht;
|
|
|
|
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_offs;
|
|
|
|
stripe_bot = stripe_top - stripe_ht;
|
|
|
|
vbo = drawdata->composite_vbo;
|
|
|
|
vert_count = &drawdata->composite_vert_count;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
2019-04-28 14:13:41 -07:00
|
|
|
}
|
|
|
|
|
2020-02-17 16:02:36 +01:00
|
|
|
float vert_pos[6][2];
|
2020-11-05 15:51:26 +01:00
|
|
|
copy_v2_fl2(vert_pos[0], timeline_frame, stripe_bot);
|
|
|
|
copy_v2_fl2(vert_pos[1], timeline_frame, stripe_top);
|
|
|
|
copy_v2_fl2(vert_pos[2], timeline_frame + 1, stripe_top);
|
2020-02-17 16:02:36 +01:00
|
|
|
copy_v2_v2(vert_pos[3], vert_pos[2]);
|
|
|
|
copy_v2_v2(vert_pos[4], vert_pos[0]);
|
2020-11-05 15:51:26 +01:00
|
|
|
copy_v2_fl2(vert_pos[5], timeline_frame + 1, stripe_bot);
|
2020-02-17 16:02:36 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
GPU_vertbuf_vert_set(vbo, *vert_count + i, vert_pos[i]);
|
|
|
|
}
|
2019-04-28 14:13:41 -07:00
|
|
|
|
2020-02-17 16:02:36 +01:00
|
|
|
*vert_count += 6;
|
2019-04-28 14:13:41 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-02-17 16:02:36 +01:00
|
|
|
static void draw_cache_view_batch(
|
|
|
|
GPUVertBuf *vbo, size_t vert_count, float col_r, float col_g, float col_b, float col_a)
|
|
|
|
{
|
|
|
|
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
|
|
|
|
if (vert_count > 0) {
|
2020-03-25 00:23:06 +01:00
|
|
|
GPU_vertbuf_data_len_set(vbo, vert_count);
|
|
|
|
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
GPU_batch_uniform_4f(batch, "color", col_r, col_g, col_b, col_a);
|
2020-02-17 16:02:36 +01:00
|
|
|
GPU_batch_draw(batch);
|
|
|
|
}
|
|
|
|
GPU_batch_discard(batch);
|
|
|
|
}
|
|
|
|
|
2019-04-28 14:13:41 -07:00
|
|
|
static void draw_cache_view(const bContext *C)
|
|
|
|
{
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
ARegion *region = CTX_wm_region(C);
|
|
|
|
struct View2D *v2d = ®ion->v2d;
|
2019-04-28 14:13:41 -07:00
|
|
|
|
|
|
|
if ((scene->ed->cache_flag & SEQ_CACHE_VIEW_ENABLE) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2019-04-28 14:13:41 -07:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
|
|
|
|
2019-05-12 15:21:38 -07:00
|
|
|
float stripe_bot, stripe_top;
|
|
|
|
float stripe_offs = UI_view2d_region_to_view_y(v2d, 1.0f) - v2d->cur.ymin;
|
2019-04-28 14:13:41 -07:00
|
|
|
float stripe_ht = UI_view2d_region_to_view_y(v2d, 4.0f * UI_DPI_FAC * U.pixelsize) -
|
|
|
|
v2d->cur.ymin;
|
|
|
|
|
2019-05-12 15:21:38 -07:00
|
|
|
CLAMP_MAX(stripe_ht, 0.2f);
|
|
|
|
CLAMP_MIN(stripe_offs, stripe_ht / 2);
|
|
|
|
|
2019-04-28 14:13:41 -07:00
|
|
|
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_FINAL_OUT) {
|
2019-06-04 10:53:12 +10:00
|
|
|
stripe_bot = UI_view2d_region_to_view_y(v2d, V2D_SCROLL_HANDLE_HEIGHT);
|
2019-04-28 14:13:41 -07:00
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
2020-08-07 22:36:11 +10:00
|
|
|
const float bg_color[4] = {1.0f, 0.4f, 0.2f, 0.1f};
|
2019-04-28 14:13:41 -07:00
|
|
|
|
|
|
|
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
|
|
|
|
immRectf(pos, scene->r.sfra, stripe_bot, scene->r.efra, stripe_top);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Sequence *seq = scene->ed->seqbasep->first; seq != NULL; seq = seq->next) {
|
|
|
|
if (seq->type == SEQ_TYPE_SOUND_RAM) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (seq->startdisp > v2d->cur.xmax || seq->enddisp < v2d->cur.xmin) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_offs;
|
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
|
|
|
|
|
|
|
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_RAW) {
|
2020-08-07 22:36:11 +10:00
|
|
|
const float bg_color[4] = {1.0f, 0.1f, 0.02f, 0.1f};
|
2019-04-28 14:13:41 -07:00
|
|
|
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
|
|
|
|
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
|
|
|
|
}
|
|
|
|
|
|
|
|
stripe_bot += stripe_ht + stripe_offs;
|
|
|
|
stripe_top = stripe_bot + stripe_ht;
|
|
|
|
|
|
|
|
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED) {
|
2020-08-07 22:36:11 +10:00
|
|
|
const float bg_color[4] = {0.1f, 0.1f, 0.75f, 0.1f};
|
2019-04-28 14:13:41 -07:00
|
|
|
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
|
|
|
|
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
|
|
|
|
}
|
|
|
|
|
|
|
|
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_offs;
|
|
|
|
stripe_bot = stripe_top - stripe_ht;
|
|
|
|
|
|
|
|
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_COMPOSITE) {
|
2020-08-07 22:36:11 +10:00
|
|
|
const float bg_color[4] = {1.0f, 0.6f, 0.0f, 0.1f};
|
2019-04-28 14:13:41 -07:00
|
|
|
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
|
|
|
|
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-17 16:02:36 +01:00
|
|
|
immUnbindProgram();
|
2019-04-28 14:13:41 -07:00
|
|
|
|
2020-03-25 00:23:06 +01:00
|
|
|
GPUVertFormat format = {0};
|
|
|
|
GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
|
|
|
CacheDrawData userdata;
|
|
|
|
userdata.v2d = v2d;
|
|
|
|
userdata.stripe_offs = stripe_offs;
|
|
|
|
userdata.stripe_ht = stripe_ht;
|
|
|
|
userdata.cache_flag = scene->ed->cache_flag;
|
|
|
|
userdata.raw_vert_count = 0;
|
|
|
|
userdata.preprocessed_vert_count = 0;
|
|
|
|
userdata.composite_vert_count = 0;
|
|
|
|
userdata.final_out_vert_count = 0;
|
|
|
|
userdata.raw_vbo = GPU_vertbuf_create_with_format(&format);
|
|
|
|
userdata.preprocessed_vbo = GPU_vertbuf_create_with_format(&format);
|
|
|
|
userdata.composite_vbo = GPU_vertbuf_create_with_format(&format);
|
|
|
|
userdata.final_out_vbo = GPU_vertbuf_create_with_format(&format);
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
SEQ_cache_iterate(scene, &userdata, draw_cache_view_init_fn, draw_cache_view_iter_fn);
|
2020-03-25 00:23:06 +01:00
|
|
|
|
|
|
|
draw_cache_view_batch(userdata.raw_vbo, userdata.raw_vert_count, 1.0f, 0.1f, 0.02f, 0.4f);
|
|
|
|
draw_cache_view_batch(
|
|
|
|
userdata.preprocessed_vbo, userdata.preprocessed_vert_count, 0.1f, 0.1f, 0.75f, 0.4f);
|
|
|
|
draw_cache_view_batch(
|
|
|
|
userdata.composite_vbo, userdata.composite_vert_count, 1.0f, 0.6f, 0.0f, 0.4f);
|
|
|
|
draw_cache_view_batch(
|
|
|
|
userdata.final_out_vbo, userdata.final_out_vert_count, 1.0f, 0.4f, 0.2f, 0.4f);
|
2019-04-28 14:13:41 -07:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2019-04-28 14:13:41 -07:00
|
|
|
}
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw sequencer timeline. */
|
2020-03-06 16:56:42 +01:00
|
|
|
void draw_timeline_seq(const bContext *C, ARegion *region)
|
2009-11-26 12:22:43 +00:00
|
|
|
{
|
2012-03-29 22:26:11 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2020-12-19 05:57:27 +01:00
|
|
|
Editing *ed = SEQ_editing_get(scene, false);
|
2012-03-29 22:26:11 +00:00
|
|
|
SpaceSeq *sseq = CTX_wm_space_seq(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
View2D *v2d = ®ion->v2d;
|
Refactor grid and scale indicator text drawing
This affects the timeline, dopesheet, graph editor, sequencer,
clip editor and nla editor.
Removed structs and enums: `V2D_ARG_DUMMY`, `eView2D_Units`,
`eView2D_Clamp`, `eView2D_Gridlines`, `View2DGrid`.
A main goal of this refactor is to get rid of the very generic
`View2DGrid` struct. The drawing code became very complex
because there were many different combinations of settings.
This refactor implements a different approach.
Instead of one very generic API, there are many slighly
different functions that do exactly, what we need in the
different editors. Only very little code is duplicated,
because the API functions compose some shared low level code.
This structure makes the code much easier to debug and change,
because every function has much fewer responsibilities.
Additionally, this refactor fixes some long standing bugs.
E.g. when `Show Seconds` is enabled, you zoom in and pan the view.
Or that the step size between displayed frame numbers was
always `>= 2`, no matter how close you zoom in.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4776
2019-05-02 12:00:12 +02:00
|
|
|
short cfra_flag = 0;
|
2009-11-26 12:22:43 +00:00
|
|
|
float col[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-13 17:21:54 -07:00
|
|
|
seq_prefetch_wm_notify(C, scene);
|
|
|
|
|
2020-09-01 12:01:02 +02:00
|
|
|
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
|
|
|
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
|
|
|
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
|
|
|
GPU_depth_test(GPU_DEPTH_NONE);
|
|
|
|
|
2009-11-26 12:22:43 +00:00
|
|
|
UI_GetThemeColor3fv(TH_BACK, col);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ed && ed->metastack.first) {
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear_color(col[0], col[1], col[2] - 0.1f, 0.0f);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else {
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear_color(col[0], col[1], col[2], 0.0f);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-14 01:22:14 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2020-09-02 09:58:26 +10:00
|
|
|
/* Get timeline bound-box, needed for the scroll-bars. */
|
2020-12-17 02:11:22 +01:00
|
|
|
SEQ_timeline_boundbox(scene, SEQ_active_seqbase_get(ed), &v2d->tot);
|
2009-11-26 12:22:43 +00:00
|
|
|
draw_seq_backdrop(v2d);
|
2017-10-23 22:27:21 +11:00
|
|
|
UI_view2d_constant_grid_draw(v2d, FPS);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Only draw backdrop in timeline view. */
|
2016-06-11 17:27:20 +02:00
|
|
|
if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) {
|
2020-03-06 16:56:42 +01:00
|
|
|
sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, true);
|
2014-11-24 18:18:35 +01:00
|
|
|
UI_view2d_view_ortho(v2d);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw attached callbacks. */
|
2020-10-14 18:18:42 +02:00
|
|
|
GPU_framebuffer_bind(framebuffer_overlay);
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
|
2020-10-14 18:18:42 +02:00
|
|
|
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
|
|
|
|
2012-03-29 22:26:11 +00:00
|
|
|
seq_draw_sfra_efra(scene, v2d);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-26 12:22:43 +00:00
|
|
|
if (ed) {
|
2020-03-06 16:56:42 +01:00
|
|
|
draw_seq_strips(C, ed, region);
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw text added in previous function. */
|
2020-03-06 16:56:42 +01:00
|
|
|
UI_view2d_text_cache_draw(region);
|
2009-11-26 12:22:43 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-10-14 01:22:14 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2019-03-26 21:16:47 +11:00
|
|
|
if ((sseq->flag & SEQ_DRAWFRAMES) == 0) {
|
|
|
|
cfra_flag |= DRAWCFRA_UNIT_SECONDS;
|
|
|
|
}
|
2020-04-05 23:55:51 +02:00
|
|
|
|
2020-06-01 14:41:12 +10:00
|
|
|
/* Draw overlap frame frame indicator. */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
|
2020-11-06 14:10:59 +01:00
|
|
|
int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ?
|
|
|
|
scene->ed->over_cfra :
|
|
|
|
scene->r.cfra + scene->ed->over_ofs;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2019-12-02 01:40:58 +01:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
|
|
|
|
float viewport_size[4];
|
|
|
|
GPU_viewport_size_get_f(viewport_size);
|
|
|
|
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Shader may have color set from past usage - reset it. */
|
|
|
|
immUniform1i("colors_len", 0);
|
2019-08-06 16:56:14 +10:00
|
|
|
immUniform1f("dash_width", 20.0f * U.pixelsize);
|
|
|
|
immUniform1f("dash_factor", 0.5f);
|
|
|
|
immUniformThemeColor(TH_CFRAME);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
2020-11-06 14:10:59 +01:00
|
|
|
immVertex2f(pos, overlap_frame, v2d->cur.ymin);
|
|
|
|
immVertex2f(pos, overlap_frame, v2d->cur.ymax);
|
2017-02-08 02:43:17 -02:00
|
|
|
immEnd();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-08 02:43:17 -02:00
|
|
|
immUnbindProgram();
|
2010-07-08 10:03:29 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
UI_view2d_view_orthoSpecial(region, v2d, 1);
|
|
|
|
int marker_draw_flag = DRAW_MARKERS_MARGIN;
|
|
|
|
if (sseq->flag & SEQ_SHOW_MARKERS) {
|
|
|
|
ED_markers_draw(C, marker_draw_flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
UI_view2d_view_ortho(v2d);
|
2020-04-05 23:55:51 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
if (ed) {
|
|
|
|
draw_cache_view(C);
|
|
|
|
}
|
2020-04-05 23:55:51 +02:00
|
|
|
|
2020-03-19 00:24:09 +01:00
|
|
|
ANIM_draw_previewrange(C, v2d, 1);
|
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw registered callbacks. */
|
2020-10-14 18:18:42 +02:00
|
|
|
GPU_framebuffer_bind(framebuffer_overlay);
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
|
2020-10-14 18:18:42 +02:00
|
|
|
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
|
|
|
|
2009-01-12 19:02:08 +00:00
|
|
|
UI_view2d_view_restore(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-05 23:55:51 +02:00
|
|
|
/* Draw channel numbers. */
|
2019-05-08 15:09:02 +02:00
|
|
|
{
|
|
|
|
rcti rect;
|
2020-03-06 16:56:42 +01:00
|
|
|
BLI_rcti_init(
|
|
|
|
&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
|
|
|
|
UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT);
|
2019-05-08 15:09:02 +02:00
|
|
|
}
|
2009-01-12 19:02:08 +00:00
|
|
|
}
|
2020-06-23 07:59:34 +02:00
|
|
|
|
|
|
|
void draw_timeline_seq_display(const bContext *C, ARegion *region)
|
|
|
|
{
|
|
|
|
const Scene *scene = CTX_data_scene(C);
|
|
|
|
const SpaceSeq *sseq = CTX_wm_space_seq(C);
|
|
|
|
View2D *v2d = ®ion->v2d;
|
|
|
|
|
|
|
|
ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
|
|
|
|
UI_view2d_scrollers_draw(v2d, NULL);
|
|
|
|
}
|