2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-22 08:13:25 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-22 08:13:25 +00:00
|
|
|
*
|
2009-07-18 07:11:37 +00:00
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
|
2008-12-22 08:13:25 +00:00
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
2009-07-18 07:11:37 +00:00
|
|
|
* Contributor(s): Joshua Leung (full recode)
|
2008-12-22 08:13:25 +00:00
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/animation/keyframes_draw.c
|
|
|
|
|
* \ingroup edanimation
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* System includes ----------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
#include "BLI_dlrbTree.h"
|
2016-07-07 23:37:15 +12:00
|
|
|
#include "BLI_math.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-01-20 11:07:42 +00:00
|
|
|
#include "DNA_anim_types.h"
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
#include "DNA_cachefile_types.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_gpencil_types.h"
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "DNA_brush_types.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
Optimisations for building "Long Keyframes"
For a long time, one of the bottlenecks when drawing summary channels in the dopesheet
(especially with many objects) was how the long keyframes feature (i.e showing holds
between keyframes) got built. Specifically, it was the step where we check on the previous
keyframe to see whether there's a hold between those two.
The old code performed some elaborate checks, which made sense back when we used to handle
certain summary channels (e.g. object-action/ipo, and groups IIRC) differently. However,
nowadays, everything just does it by going over the FCurves one by one, so the offending
code wasn't really providing much benefit. Unless I've forgotten some other reason why
that old method is necessary, this commit should provide a decent speedup here, making
things somewhat interactive now (if still a bit jerky).
Other Tweaks:
1) Introduced float-precision threshold when checking to see whether an existing long
keyframe could be reused. This should hopefully reduce the number of fp-jitter issues
when creating summaries for many channels, reducing the number of duplicates created.
2) Precompute colours used for shading the long keyframes, instead of recomputing for
each block.
2014-04-16 03:21:06 +12:00
|
|
|
#include "BKE_fcurve.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2017-02-12 01:56:08 -05:00
|
|
|
#include "GPU_draw.h"
|
2017-02-11 00:24:59 -05:00
|
|
|
#include "GPU_immediate.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
|
|
|
|
|
#include "ED_anim_api.h"
|
|
|
|
|
#include "ED_keyframes_draw.h"
|
|
|
|
|
|
2009-07-17 00:17:37 +00:00
|
|
|
/* *************************** Keyframe Processing *************************** */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2009-11-17 08:27:46 +00:00
|
|
|
/* ActKeyColumns (Keyframe Columns) ------------------------------------------ */
|
|
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
BLI_INLINE bool is_cfra_eq(float a, float b) {
|
|
|
|
|
return IS_EQT(a, b, BEZT_BINARYSEARCH_THRESH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_INLINE bool is_cfra_lt(float a, float b) {
|
|
|
|
|
return (b - a) > BEZT_BINARYSEARCH_THRESH;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
|
2011-03-24 03:02:34 +00:00
|
|
|
/* NOTE: this is exported to other modules that use the ActKeyColumns for finding keyframes */
|
2012-04-29 17:11:40 +00:00
|
|
|
short compare_ak_cfraPtr(void *node, void *data)
|
2009-11-15 11:20:44 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
2014-04-27 00:22:49 +10:00
|
|
|
const float *cframe = data;
|
2014-04-16 03:22:02 +12:00
|
|
|
float val = *cframe;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
if (is_cfra_eq(val, ak->cfra))
|
2014-04-16 03:22:02 +12:00
|
|
|
return 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-16 03:22:02 +12:00
|
|
|
if (val < ak->cfra)
|
2009-11-15 11:20:44 +00:00
|
|
|
return -1;
|
|
|
|
|
else
|
2018-10-16 19:45:03 +03:00
|
|
|
return 1;
|
2009-11-15 11:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-17 08:27:46 +00:00
|
|
|
/* --------------- */
|
2009-11-15 11:20:44 +00:00
|
|
|
|
|
|
|
|
/* Comparator callback used for ActKeyColumns and BezTriple */
|
2012-05-08 15:30:00 +00:00
|
|
|
static short compare_ak_bezt(void *node, void *data)
|
2009-11-15 11:20:44 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
BezTriple *bezt = (BezTriple *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
return compare_ak_cfraPtr(node, &bezt->vec[1][0]);
|
2009-11-15 11:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* New node callback used for building ActKeyColumns from BezTriples */
|
2012-05-08 15:30:00 +00:00
|
|
|
static DLRBT_Node *nalloc_ak_bezt(void *data)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
|
|
|
|
|
BezTriple *bezt = (BezTriple *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
/* store settings based on state of BezTriple */
|
2012-05-08 15:30:00 +00:00
|
|
|
ak->cfra = bezt->vec[1][0];
|
2015-07-09 14:31:27 +10:00
|
|
|
ak->sel = BEZT_ISSEL_ANY(bezt) ? SELECT : 0;
|
2012-05-08 15:30:00 +00:00
|
|
|
ak->key_type = BEZKEYTYPE(bezt);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey = 1;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
return (DLRBT_Node *)ak;
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* Node updater callback used for building ActKeyColumns from BezTriples */
|
2012-05-08 15:30:00 +00:00
|
|
|
static void nupdate_ak_bezt(void *node, void *data)
|
2009-07-18 07:11:37 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
|
|
|
|
BezTriple *bezt = (BezTriple *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* set selection status and 'touched' status */
|
2015-07-09 14:31:27 +10:00
|
|
|
if (BEZT_ISSEL_ANY(bezt)) ak->sel = SELECT;
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey++;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
|
|
|
|
|
if (BEZKEYTYPE(bezt) == BEZT_KEYTYPE_KEYFRAME)
|
2012-05-08 15:30:00 +00:00
|
|
|
ak->key_type = BEZT_KEYTYPE_KEYFRAME;
|
2009-11-15 11:20:44 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
/* ......... */
|
|
|
|
|
|
|
|
|
|
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
2012-05-08 15:30:00 +00:00
|
|
|
static short compare_ak_gpframe(void *node, void *data)
|
2011-01-10 22:10:28 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
bGPDframe *gpf = (bGPDframe *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
return compare_ak_cfraPtr(node, &gpf->framenum);
|
2011-01-10 22:10:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* New node callback used for building ActKeyColumns from GPencil frames */
|
2012-05-08 15:30:00 +00:00
|
|
|
static DLRBT_Node *nalloc_ak_gpframe(void *data)
|
2011-01-10 22:10:28 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
|
|
|
|
bGPDframe *gpf = (bGPDframe *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
/* store settings based on state of BezTriple */
|
2012-05-08 15:30:00 +00:00
|
|
|
ak->cfra = gpf->framenum;
|
|
|
|
|
ak->sel = (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
ak->key_type = gpf->key_type;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey = 1;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
return (DLRBT_Node *)ak;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
2012-05-08 15:30:00 +00:00
|
|
|
static void nupdate_ak_gpframe(void *node, void *data)
|
2011-01-10 22:10:28 +00:00
|
|
|
{
|
2012-05-08 15:30:00 +00:00
|
|
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
|
|
|
|
bGPDframe *gpf = (bGPDframe *)data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
/* set selection status and 'touched' status */
|
|
|
|
|
if (gpf->flag & GP_FRAME_SELECT) ak->sel = SELECT;
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey++;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
|
|
|
|
|
if (gpf->key_type == BEZT_KEYTYPE_KEYFRAME)
|
|
|
|
|
ak->key_type = BEZT_KEYTYPE_KEYFRAME;
|
2011-01-10 22:10:28 +00:00
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
/* ......... */
|
|
|
|
|
|
|
|
|
|
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
|
|
|
|
static short compare_ak_masklayshape(void *node, void *data)
|
|
|
|
|
{
|
|
|
|
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
|
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
return compare_ak_cfraPtr(node, &masklay_shape->frame);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* New node callback used for building ActKeyColumns from GPencil frames */
|
|
|
|
|
static DLRBT_Node *nalloc_ak_masklayshape(void *data)
|
|
|
|
|
{
|
|
|
|
|
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
|
|
|
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
|
|
|
|
|
|
|
|
|
/* store settings based on state of BezTriple */
|
|
|
|
|
ak->cfra = masklay_shape->frame;
|
2012-06-08 14:31:38 +00:00
|
|
|
ak->sel = (masklay_shape->flag & MASK_SHAPE_SELECT) ? SELECT : 0;
|
2012-06-04 16:42:58 +00:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey = 1;
|
2012-06-04 16:42:58 +00:00
|
|
|
|
|
|
|
|
return (DLRBT_Node *)ak;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
|
|
|
|
static void nupdate_ak_masklayshape(void *node, void *data)
|
|
|
|
|
{
|
|
|
|
|
ActKeyColumn *ak = (ActKeyColumn *)node;
|
|
|
|
|
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
|
|
|
|
|
|
|
|
|
|
/* set selection status and 'touched' status */
|
2012-06-08 14:31:38 +00:00
|
|
|
if (masklay_shape->flag & MASK_SHAPE_SELECT) ak->sel = SELECT;
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
/* count keyframes in this column */
|
|
|
|
|
ak->totkey++;
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-11-15 11:20:44 +00:00
|
|
|
/* --------------- */
|
|
|
|
|
|
|
|
|
|
/* Add the given BezTriple to the given 'list' of Keyframes */
|
|
|
|
|
static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
|
|
|
|
|
{
|
2012-03-25 22:35:18 +00:00
|
|
|
if (ELEM(NULL, keys, bezt))
|
2009-11-15 11:20:44 +00:00
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
BLI_dlrbTree_add(keys, compare_ak_bezt, nalloc_ak_bezt, nupdate_ak_bezt, bezt);
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
|
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
/* Add the given GPencil Frame to the given 'list' of Keyframes */
|
|
|
|
|
static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
|
|
|
|
|
{
|
2012-03-25 22:35:18 +00:00
|
|
|
if (ELEM(NULL, keys, gpf))
|
2011-01-10 22:10:28 +00:00
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
|
|
|
|
|
static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *masklay_shape)
|
|
|
|
|
{
|
|
|
|
|
if (ELEM(NULL, keys, masklay_shape))
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
BLI_dlrbTree_add(keys, compare_ak_masklayshape, nalloc_ak_masklayshape, nupdate_ak_masklayshape, masklay_shape);
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-17 08:27:46 +00:00
|
|
|
/* ActKeyBlocks (Long Keyframes) ------------------------------------------ */
|
2009-07-18 07:11:37 +00:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
static const ActKeyBlockInfo dummy_keyblock = { 0 };
|
2011-03-24 03:02:34 +00:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
static void compute_keyblock_data(ActKeyBlockInfo *info, BezTriple *prev, BezTriple *beztn)
|
2009-07-18 07:11:37 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
memset(info, 0, sizeof (ActKeyBlockInfo));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
if (BEZKEYTYPE(beztn) == BEZT_KEYTYPE_MOVEHOLD) {
|
|
|
|
|
/* Animator tagged a "moving hold"
|
|
|
|
|
* - Previous key must also be tagged as a moving hold, otherwise
|
|
|
|
|
* we're just dealing with the first of a pair, and we don't
|
|
|
|
|
* want to be creating any phantom holds...
|
|
|
|
|
*/
|
2018-10-13 20:22:44 +03:00
|
|
|
if (BEZKEYTYPE(prev) == BEZT_KEYTYPE_MOVEHOLD) {
|
|
|
|
|
info->flag |= ACTKEYBLOCK_FLAG_MOVING_HOLD | ACTKEYBLOCK_FLAG_ANY_HOLD;
|
|
|
|
|
}
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
/* Check for same values...
|
|
|
|
|
* - Handles must have same central value as each other
|
|
|
|
|
* - Handles which control that section of the curve must be constant
|
|
|
|
|
*/
|
|
|
|
|
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1])) {
|
|
|
|
|
bool hold;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-12 22:16:05 +03:00
|
|
|
/* Only check handles in case of actual bezier interpolation. */
|
|
|
|
|
if (prev->ipo == BEZT_IPO_BEZ) {
|
2018-10-13 20:22:44 +03:00
|
|
|
hold = IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) && IS_EQF(prev->vec[1][1], prev->vec[2][1]);
|
2018-10-12 22:16:05 +03:00
|
|
|
}
|
|
|
|
|
/* This interpolation type induces movement even between identical keys. */
|
2018-10-13 20:22:44 +03:00
|
|
|
else {
|
|
|
|
|
hold = !ELEM(prev->ipo, BEZT_IPO_ELASTIC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hold) {
|
|
|
|
|
info->flag |= ACTKEYBLOCK_FLAG_STATIC_HOLD | ACTKEYBLOCK_FLAG_ANY_HOLD;
|
2018-10-12 22:16:05 +03:00
|
|
|
}
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
info->sel = BEZT_ISSEL_ANY(prev) || BEZT_ISSEL_ANY(beztn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void add_keyblock_info(ActKeyColumn *col, const ActKeyBlockInfo *block)
|
|
|
|
|
{
|
|
|
|
|
/* New curve and block. */
|
|
|
|
|
if (col->totcurve <= 1 && col->totblock == 0) {
|
|
|
|
|
memcpy(&col->block, block, sizeof(ActKeyBlockInfo));
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Existing curve. */
|
2009-07-18 07:11:37 +00:00
|
|
|
else {
|
2018-10-13 20:22:44 +03:00
|
|
|
col->block.conflict |= (col->block.flag ^ block->flag);
|
|
|
|
|
col->block.flag |= block->flag;
|
|
|
|
|
col->block.sel |= block->sel;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
if (block->flag) {
|
|
|
|
|
col->totblock++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
static void add_bezt_to_keyblocks_list(DLRBT_Tree *keys, BezTriple *bezt, int num_bezt)
|
|
|
|
|
{
|
|
|
|
|
ActKeyColumn *col = keys->first;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
if (bezt && num_bezt >= 2) {
|
|
|
|
|
ActKeyBlockInfo block;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Find the first key column while inserting dummy blocks. */
|
2018-10-16 19:45:03 +03:00
|
|
|
for (; col != NULL && is_cfra_lt(col->cfra, bezt[0].vec[1][0]); col = col->next) {
|
2018-10-13 20:22:44 +03:00
|
|
|
add_keyblock_info(col, &dummy_keyblock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_assert(col != NULL);
|
|
|
|
|
|
|
|
|
|
/* Insert real blocks. */
|
|
|
|
|
for (int v = 1; col != NULL && v < num_bezt; v++, bezt++) {
|
2018-10-16 19:45:03 +03:00
|
|
|
BLI_assert(is_cfra_eq(col->cfra, bezt[0].vec[1][0]));
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
compute_keyblock_data(&block, bezt, bezt + 1);
|
|
|
|
|
|
2018-10-16 19:45:03 +03:00
|
|
|
for (; col != NULL && is_cfra_lt(col->cfra, bezt[1].vec[1][0]); col = col->next) {
|
2018-10-13 20:22:44 +03:00
|
|
|
add_keyblock_info(col, &block);
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
BLI_assert(col != NULL);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Insert dummy blocks at the end. */
|
|
|
|
|
for (; col != NULL; col = col->next) {
|
|
|
|
|
add_keyblock_info(col, &dummy_keyblock);
|
|
|
|
|
}
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Walk through columns and propagate blocks and totcurve.
|
|
|
|
|
*
|
|
|
|
|
* This must be called even by animation sources that don't generate
|
|
|
|
|
* keyblocks to keep the data structure consistent after adding columns.
|
|
|
|
|
*/
|
|
|
|
|
static void update_keyblocks(DLRBT_Tree *keys, BezTriple *bezt, int num_bezt)
|
2009-07-18 07:11:37 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Recompute the prev/next linked list. */
|
|
|
|
|
BLI_dlrbTree_linkedlist_sync(keys);
|
|
|
|
|
|
|
|
|
|
/* Find the curve count */
|
|
|
|
|
int max_curve = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
for (ActKeyColumn *col = keys->first; col; col = col->next) {
|
|
|
|
|
max_curve = MAX2(max_curve, col->totcurve);
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Propagate blocks to inserted keys */
|
|
|
|
|
ActKeyColumn *prev_ready = NULL;
|
2009-07-18 07:11:37 +00:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
for (ActKeyColumn *col = keys->first; col; col = col->next) {
|
|
|
|
|
/* Pre-existing column. */
|
|
|
|
|
if (col->totcurve > 0) {
|
|
|
|
|
prev_ready = col;
|
|
|
|
|
}
|
|
|
|
|
/* Newly inserted column, so copy block data from previous. */
|
|
|
|
|
else if (prev_ready != NULL) {
|
|
|
|
|
col->totblock = prev_ready->totblock;
|
|
|
|
|
memcpy(&col->block, &prev_ready->block, sizeof(ActKeyBlockInfo));
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
col->totcurve = max_curve + 1;
|
2009-07-18 07:11:37 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Add blocks on top */
|
|
|
|
|
add_bezt_to_keyblocks_list(keys, bezt, num_bezt);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 03:19:30 +00:00
|
|
|
/* --------- */
|
|
|
|
|
|
|
|
|
|
/* Checks if ActKeyBlock should exist... */
|
2018-10-13 20:22:44 +03:00
|
|
|
int actkeyblock_get_valid_hold(ActKeyColumn *ac)
|
2011-03-24 03:19:30 +00:00
|
|
|
{
|
|
|
|
|
/* check that block is valid */
|
2018-10-13 20:22:44 +03:00
|
|
|
if (ac == NULL || ac->next == NULL || ac->totblock == 0)
|
2011-03-24 03:19:30 +00:00
|
|
|
return 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
const int hold_mask = (ACTKEYBLOCK_FLAG_ANY_HOLD | ACTKEYBLOCK_FLAG_STATIC_HOLD | ACTKEYBLOCK_FLAG_ANY_HOLD);
|
|
|
|
|
return (ac->block.flag & ~ac->block.conflict) & hold_mask;
|
2011-03-24 03:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-17 00:17:37 +00:00
|
|
|
/* *************************** Keyframe Drawing *************************** */
|
|
|
|
|
|
2017-02-11 00:24:59 -05:00
|
|
|
void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha,
|
|
|
|
|
unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2017-02-11 00:24:59 -05:00
|
|
|
bool draw_fill = ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH);
|
|
|
|
|
bool draw_outline = ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH);
|
|
|
|
|
|
2017-02-28 01:21:27 -05:00
|
|
|
BLI_assert(draw_fill || draw_outline);
|
2017-02-11 00:24:59 -05:00
|
|
|
|
|
|
|
|
/* tweak size of keyframe shape according to type of keyframe
|
2012-10-23 03:38:26 +00:00
|
|
|
* - 'proper' keyframes have key_type = 0, so get drawn at full size
|
2009-09-04 02:44:56 +00:00
|
|
|
*/
|
2016-07-07 23:37:15 +12:00
|
|
|
switch (key_type) {
|
|
|
|
|
case BEZT_KEYTYPE_KEYFRAME: /* must be full size */
|
|
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_BREAKDOWN: /* slightly smaller than normal keyframe */
|
2017-02-11 00:24:59 -05:00
|
|
|
size *= 0.85f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes (but by less than for breakdowns) */
|
2017-02-28 01:21:27 -05:00
|
|
|
size *= 0.925f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_EXTREME: /* slightly larger */
|
2017-02-11 00:24:59 -05:00
|
|
|
size *= 1.2f;
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
default:
|
2017-08-03 01:25:55 +12:00
|
|
|
size -= 0.8f * key_type;
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
2017-02-11 00:24:59 -05:00
|
|
|
|
|
|
|
|
unsigned char fill_col[4];
|
|
|
|
|
unsigned char outline_col[4];
|
|
|
|
|
|
2009-07-10 00:32:13 +00:00
|
|
|
/* draw! */
|
2017-02-11 00:24:59 -05:00
|
|
|
if (draw_fill) {
|
2014-01-16 23:56:40 +13:00
|
|
|
/* get interior colors from theme (for selected and unselected only) */
|
2009-09-04 02:44:56 +00:00
|
|
|
switch (key_type) {
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_BREAKDOWN_SELECT : TH_KEYTYPE_BREAKDOWN, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_EXTREME: /* reddish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_EXTREME_SELECT : TH_KEYTYPE_EXTREME, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_JITTER: /* greenish frames (default theme) */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_JITTER_SELECT : TH_KEYTYPE_JITTER, fill_col);
|
2013-07-19 15:23:42 +00:00
|
|
|
break;
|
2016-07-07 23:37:15 +12:00
|
|
|
case BEZT_KEYTYPE_MOVEHOLD: /* similar to traditional keyframes, but different... */
|
|
|
|
|
/* XXX: Should these get their own theme options instead? */
|
2017-02-11 00:24:59 -05:00
|
|
|
if (sel) UI_GetThemeColorShade3ubv(TH_STRIP_SELECT, 35, fill_col);
|
|
|
|
|
else UI_GetThemeColorShade3ubv(TH_STRIP, 50, fill_col);
|
|
|
|
|
fill_col[3] = 255; /* full opacity, to avoid problems with visual glitches */
|
2016-07-07 23:37:15 +12:00
|
|
|
break;
|
2014-01-16 23:56:40 +13:00
|
|
|
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames (default theme) */
|
2009-09-04 02:44:56 +00:00
|
|
|
default:
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_KEYFRAME_SELECT : TH_KEYTYPE_KEYFRAME, fill_col);
|
2009-09-04 02:44:56 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
/* NOTE: we don't use the straight alpha from the theme, or else effects such as
|
2015-03-19 14:14:48 +11:00
|
|
|
* graying out protected/muted channels doesn't work correctly!
|
2014-01-16 23:56:40 +13:00
|
|
|
*/
|
2017-02-11 00:24:59 -05:00
|
|
|
fill_col[3] *= alpha;
|
|
|
|
|
|
|
|
|
|
if (!draw_outline) {
|
|
|
|
|
/* force outline color to match */
|
|
|
|
|
outline_col[0] = fill_col[0];
|
|
|
|
|
outline_col[1] = fill_col[1];
|
|
|
|
|
outline_col[2] = fill_col[2];
|
|
|
|
|
outline_col[3] = fill_col[3];
|
|
|
|
|
}
|
2009-07-10 00:32:13 +00:00
|
|
|
}
|
2017-02-11 00:24:59 -05:00
|
|
|
|
|
|
|
|
if (draw_outline) {
|
2009-07-10 00:32:13 +00:00
|
|
|
/* exterior - black frame */
|
2017-02-11 00:24:59 -05:00
|
|
|
UI_GetThemeColor4ubv(sel ? TH_KEYBORDER_SELECT : TH_KEYBORDER, outline_col);
|
|
|
|
|
outline_col[3] *= alpha;
|
|
|
|
|
|
|
|
|
|
if (!draw_fill) {
|
|
|
|
|
/* fill color needs to be (outline.rgb, 0) */
|
|
|
|
|
fill_col[0] = outline_col[0];
|
|
|
|
|
fill_col[1] = outline_col[1];
|
|
|
|
|
fill_col[2] = outline_col[2];
|
|
|
|
|
fill_col[3] = 0;
|
|
|
|
|
}
|
2009-07-10 00:32:13 +00:00
|
|
|
}
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2018-10-09 11:01:50 +11:00
|
|
|
immAttr1f(size_id, size);
|
|
|
|
|
immAttr4ubv(color_id, fill_col);
|
|
|
|
|
immAttr4ubv(outline_color_id, outline_col);
|
2017-02-11 00:24:59 -05:00
|
|
|
immVertex2f(pos_id, x, y);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, float ypos, float yscale_fac, bool channelLocked)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2017-02-28 01:21:27 -05:00
|
|
|
const float icon_sz = U.widget_unit * 0.5f * yscale_fac;
|
|
|
|
|
const float half_icon_sz = 0.5f * icon_sz;
|
2018-10-13 20:22:44 +03:00
|
|
|
const float smaller_sz = 0.35f * icon_sz;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-01-17 00:00:40 +13:00
|
|
|
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
|
|
|
|
|
/* TODO: allow this opacity factor to be themed? */
|
2017-02-11 00:24:59 -05:00
|
|
|
float alpha = channelLocked ? 0.25f : 1.0f;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
/* draw keyblocks */
|
2018-10-13 20:22:44 +03:00
|
|
|
if (keys) {
|
Optimisations for building "Long Keyframes"
For a long time, one of the bottlenecks when drawing summary channels in the dopesheet
(especially with many objects) was how the long keyframes feature (i.e showing holds
between keyframes) got built. Specifically, it was the step where we check on the previous
keyframe to see whether there's a hold between those two.
The old code performed some elaborate checks, which made sense back when we used to handle
certain summary channels (e.g. object-action/ipo, and groups IIRC) differently. However,
nowadays, everything just does it by going over the FCurves one by one, so the offending
code wasn't really providing much benefit. Unless I've forgotten some other reason why
that old method is necessary, this commit should provide a decent speedup here, making
things somewhat interactive now (if still a bit jerky).
Other Tweaks:
1) Introduced float-precision threshold when checking to see whether an existing long
keyframe could be reused. This should hopefully reduce the number of fp-jitter issues
when creating summaries for many channels, reducing the number of duplicates created.
2) Precompute colours used for shading the long keyframes, instead of recomputing for
each block.
2014-04-16 03:21:06 +12:00
|
|
|
float sel_color[4], unsel_color[4];
|
2016-07-07 23:37:15 +12:00
|
|
|
float sel_mhcol[4], unsel_mhcol[4];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Optimisations for building "Long Keyframes"
For a long time, one of the bottlenecks when drawing summary channels in the dopesheet
(especially with many objects) was how the long keyframes feature (i.e showing holds
between keyframes) got built. Specifically, it was the step where we check on the previous
keyframe to see whether there's a hold between those two.
The old code performed some elaborate checks, which made sense back when we used to handle
certain summary channels (e.g. object-action/ipo, and groups IIRC) differently. However,
nowadays, everything just does it by going over the FCurves one by one, so the offending
code wasn't really providing much benefit. Unless I've forgotten some other reason why
that old method is necessary, this commit should provide a decent speedup here, making
things somewhat interactive now (if still a bit jerky).
Other Tweaks:
1) Introduced float-precision threshold when checking to see whether an existing long
keyframe could be reused. This should hopefully reduce the number of fp-jitter issues
when creating summaries for many channels, reducing the number of duplicates created.
2) Precompute colours used for shading the long keyframes, instead of recomputing for
each block.
2014-04-16 03:21:06 +12:00
|
|
|
/* cache colours first */
|
|
|
|
|
UI_GetThemeColor4fv(TH_STRIP_SELECT, sel_color);
|
|
|
|
|
UI_GetThemeColor4fv(TH_STRIP, unsel_color);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Optimisations for building "Long Keyframes"
For a long time, one of the bottlenecks when drawing summary channels in the dopesheet
(especially with many objects) was how the long keyframes feature (i.e showing holds
between keyframes) got built. Specifically, it was the step where we check on the previous
keyframe to see whether there's a hold between those two.
The old code performed some elaborate checks, which made sense back when we used to handle
certain summary channels (e.g. object-action/ipo, and groups IIRC) differently. However,
nowadays, everything just does it by going over the FCurves one by one, so the offending
code wasn't really providing much benefit. Unless I've forgotten some other reason why
that old method is necessary, this commit should provide a decent speedup here, making
things somewhat interactive now (if still a bit jerky).
Other Tweaks:
1) Introduced float-precision threshold when checking to see whether an existing long
keyframe could be reused. This should hopefully reduce the number of fp-jitter issues
when creating summaries for many channels, reducing the number of duplicates created.
2) Precompute colours used for shading the long keyframes, instead of recomputing for
each block.
2014-04-16 03:21:06 +12:00
|
|
|
sel_color[3] *= alpha;
|
|
|
|
|
unsel_color[3] *= alpha;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
copy_v4_v4(sel_mhcol, sel_color);
|
|
|
|
|
sel_mhcol[3] *= 0.8f;
|
|
|
|
|
copy_v4_v4(unsel_mhcol, unsel_color);
|
|
|
|
|
unsel_mhcol[3] *= 0.8f;
|
2017-02-11 00:24:59 -05:00
|
|
|
|
2018-07-08 13:19:10 +02:00
|
|
|
uint block_len = 0;
|
2018-10-13 20:22:44 +03:00
|
|
|
for (ActKeyColumn *ab = keys->first; ab; ab = ab->next) {
|
|
|
|
|
if (actkeyblock_get_valid_hold(ab)) {
|
2018-07-08 13:19:10 +02:00
|
|
|
block_len++;
|
2018-04-17 19:37:00 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-08 13:19:10 +02:00
|
|
|
if (block_len > 0) {
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
2018-04-17 19:37:00 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_TRIS, 6 * block_len);
|
2018-10-13 20:22:44 +03:00
|
|
|
for (ActKeyColumn *ab = keys->first; ab; ab = ab->next) {
|
|
|
|
|
int valid_hold = actkeyblock_get_valid_hold(ab);
|
|
|
|
|
if (valid_hold != 0) {
|
|
|
|
|
if ((valid_hold & ACTKEYBLOCK_FLAG_STATIC_HOLD) == 0) {
|
2018-04-17 19:37:00 +02:00
|
|
|
/* draw "moving hold" long-keyframe block - slightly smaller */
|
|
|
|
|
immRectf_fast_with_color(pos_id, color_id,
|
2018-10-13 20:22:44 +03:00
|
|
|
ab->cfra, ypos - smaller_sz, ab->next->cfra, ypos + smaller_sz,
|
|
|
|
|
(ab->block.sel) ? sel_mhcol : unsel_mhcol);
|
2018-04-17 19:37:00 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* draw standard long-keyframe block */
|
|
|
|
|
immRectf_fast_with_color(pos_id, color_id,
|
2018-10-13 20:22:44 +03:00
|
|
|
ab->cfra, ypos - half_icon_sz, ab->next->cfra, ypos + half_icon_sz,
|
|
|
|
|
(ab->block.sel) ? sel_color : unsel_color);
|
2018-04-17 19:37:00 +02:00
|
|
|
}
|
2016-07-07 23:37:15 +12:00
|
|
|
}
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-04-17 19:37:00 +02:00
|
|
|
immEnd();
|
|
|
|
|
immUnbindProgram();
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
if (keys) {
|
2017-02-11 00:24:59 -05:00
|
|
|
/* count keys */
|
2018-07-08 13:19:10 +02:00
|
|
|
uint key_len = 0;
|
2017-02-11 00:24:59 -05:00
|
|
|
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
|
2012-07-06 23:56:59 +00:00
|
|
|
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
|
2009-07-20 12:42:31 +00:00
|
|
|
* - this might give some improvements, since we current have to flip between view/region matrices
|
|
|
|
|
*/
|
2017-02-11 00:24:59 -05:00
|
|
|
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax))
|
2018-07-08 13:19:10 +02:00
|
|
|
key_len++;
|
2017-02-11 00:24:59 -05:00
|
|
|
}
|
|
|
|
|
|
2018-07-08 13:19:10 +02:00
|
|
|
if (key_len > 0) {
|
2017-02-11 00:24:59 -05:00
|
|
|
/* draw keys */
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
uint size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
|
|
|
|
uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
|
|
|
|
uint outline_color_id = GPU_vertformat_attr_add(format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
2017-02-11 00:24:59 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
|
2017-02-12 01:56:08 -05:00
|
|
|
GPU_enable_program_point_size();
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_POINTS, key_len);
|
2017-02-11 00:24:59 -05:00
|
|
|
|
|
|
|
|
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
|
|
|
|
|
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) {
|
2017-02-28 01:21:27 -05:00
|
|
|
draw_keyframe_shape(ak->cfra, ypos, icon_sz, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, alpha,
|
2017-02-11 00:24:59 -05:00
|
|
|
pos_id, size_id, color_id, outline_color_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
immEnd();
|
2017-02-12 01:56:08 -05:00
|
|
|
GPU_disable_program_point_size();
|
2017-02-11 00:24:59 -05:00
|
|
|
immUnbindProgram();
|
2012-07-06 23:56:59 +00:00
|
|
|
}
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2012-07-06 23:56:59 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-22 10:15:02 +00:00
|
|
|
/* *************************** Channel Drawing Funcs *************************** */
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_summary_channel(View2D *v2d, bAnimContext *ac, float ypos, float yscale_fac)
|
2009-10-13 11:21:02 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
summary_to_keylist(ac, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_scene_channel(View2D *v2d, bDopeSheet *ads, Scene *sce, float ypos, float yscale_fac)
|
2009-02-13 06:33:07 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
scene_to_keylist(ads, sce, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2009-02-13 06:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_object_channel(View2D *v2d, bDopeSheet *ads, Object *ob, float ypos, float yscale_fac)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
ob_to_keylist(ads, ob, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos, float yscale_fac)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (fcu->flag & FCURVE_PROTECTED) ||
|
|
|
|
|
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
|
2017-11-06 17:17:10 +01:00
|
|
|
((adt && adt->action) && ID_IS_LINKED(adt->action));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(adt, fcu, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, locked);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float ypos, float yscale_fac)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (agrp->flag & AGRP_PROTECTED) ||
|
2017-11-06 17:17:10 +01:00
|
|
|
((adt && adt->action) && ID_IS_LINKED(adt->action));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
agroup_to_keylist(adt, agrp, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, locked);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos, float yscale_fac)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2018-10-13 20:22:44 +03:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2017-11-06 17:17:10 +01:00
|
|
|
bool locked = (act && ID_IS_LINKED(act));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
action_to_keylist(adt, act, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, locked);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_gpencil_channel(View2D *v2d, bDopeSheet *ads, bGPdata *gpd, float ypos, float yscale_fac)
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
{
|
|
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
gpencil_to_keylist(ads, gpd, &keys, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
BLI_dlrbTree_free(&keys);
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos, float yscale_fac)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2009-07-18 07:11:37 +00:00
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (gpl->flag & GP_LAYER_LOCKED) != 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-05-08 15:30:00 +00:00
|
|
|
gpl_to_keylist(ads, gpl, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, locked);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
void draw_masklay_channel(View2D *v2d, bDopeSheet *ads, MaskLayer *masklay, float ypos, float yscale_fac)
|
2012-06-08 14:31:38 +00:00
|
|
|
{
|
|
|
|
|
DLRBT_Tree keys;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2016-07-03 03:42:28 +12:00
|
|
|
bool locked = (masklay->flag & MASK_LAYERFLAG_LOCKED) != 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
BLI_dlrbTree_init(&keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
mask_to_keylist(ads, masklay, &keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
draw_keylist(v2d, &keys, ypos, yscale_fac, locked);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-18 07:11:37 +00:00
|
|
|
BLI_dlrbTree_free(&keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-22 10:15:02 +00:00
|
|
|
/* *************************** Keyframe List Conversions *************************** */
|
2008-12-22 08:13:25 +00:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys)
|
2009-10-13 11:21:02 +00:00
|
|
|
{
|
|
|
|
|
if (ac) {
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
/* get F-Curves to take keyframes from */
|
2012-08-27 08:23:51 +00:00
|
|
|
filter = ANIMFILTER_DATA_VISIBLE;
|
2009-10-13 11:21:02 +00:00
|
|
|
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-13 11:21:02 +00:00
|
|
|
/* loop through each F-Curve, grabbing the keyframes */
|
2012-06-26 10:14:50 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2012-08-27 08:23:51 +00:00
|
|
|
/* Why not use all #eAnim_KeyType here?
|
|
|
|
|
* All of the other key types are actually "summaries" themselves, and will just end up duplicating stuff
|
|
|
|
|
* that comes up through standard filtering of just F-Curves.
|
|
|
|
|
* Given the way that these work, there isn't really any benefit at all from including them. - Aligorith */
|
|
|
|
|
|
2012-08-27 06:55:33 +00:00
|
|
|
switch (ale->datatype) {
|
|
|
|
|
case ALE_FCURVE:
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(ale->adt, ale->data, keys);
|
2012-08-27 06:55:33 +00:00
|
|
|
break;
|
|
|
|
|
case ALE_MASKLAY:
|
|
|
|
|
mask_to_keylist(ac->ads, ale->data, keys);
|
|
|
|
|
break;
|
|
|
|
|
case ALE_GPFRAME:
|
|
|
|
|
gpl_to_keylist(ac->ads, ale->data, keys);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2012-08-27 08:23:51 +00:00
|
|
|
// printf("%s: datatype %d unhandled\n", __func__, ale->datatype);
|
2012-08-27 06:55:33 +00:00
|
|
|
break;
|
2012-06-26 10:14:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2009-10-13 11:21:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys)
|
2009-02-13 06:33:07 +00:00
|
|
|
{
|
2011-06-30 13:56:47 +00:00
|
|
|
bAnimContext ac = {NULL};
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-08-07 03:36:05 +00:00
|
|
|
bAnimListElem dummychan = {NULL};
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
if (sce == NULL)
|
|
|
|
|
return;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* create a dummy wrapper data to work with */
|
|
|
|
|
dummychan.type = ANIMTYPE_SCENE;
|
|
|
|
|
dummychan.data = sce;
|
|
|
|
|
dummychan.id = &sce->id;
|
|
|
|
|
dummychan.adt = sce->adt;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
ac.ads = ads;
|
|
|
|
|
ac.data = &dummychan;
|
|
|
|
|
ac.datatype = ANIMCONT_CHANNEL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* get F-Curves to take keyframes from */
|
2012-05-08 15:30:00 +00:00
|
|
|
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
2011-06-30 13:56:47 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* loop through each F-Curve, grabbing the keyframes */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next)
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(ale->adt, ale->data, keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2009-02-13 06:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2011-06-30 13:56:47 +00:00
|
|
|
bAnimContext ac = {NULL};
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
|
int filter;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-08-07 03:36:05 +00:00
|
|
|
bAnimListElem dummychan = {NULL};
|
2017-11-09 15:44:56 -02:00
|
|
|
Base dummybase = {NULL};
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-10-06 03:05:20 +00:00
|
|
|
if (ob == NULL)
|
|
|
|
|
return;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* create a dummy wrapper data to work with */
|
|
|
|
|
dummybase.object = ob;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
dummychan.type = ANIMTYPE_OBJECT;
|
|
|
|
|
dummychan.data = &dummybase;
|
|
|
|
|
dummychan.id = &ob->id;
|
|
|
|
|
dummychan.adt = ob->adt;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
ac.ads = ads;
|
|
|
|
|
ac.data = &dummychan;
|
|
|
|
|
ac.datatype = ANIMCONT_CHANNEL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* get F-Curves to take keyframes from */
|
2012-05-08 15:30:00 +00:00
|
|
|
filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
2011-06-30 13:56:47 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-06-30 13:56:47 +00:00
|
|
|
/* loop through each F-Curve, grabbing the keyframes */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next)
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(ale->adt, ale->data, keys);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void cachefile_to_keylist(bDopeSheet *ads, CacheFile *cache_file, DLRBT_Tree *keys)
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
{
|
|
|
|
|
if (cache_file == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* create a dummy wrapper data to work with */
|
|
|
|
|
bAnimListElem dummychan = {NULL};
|
|
|
|
|
dummychan.type = ANIMTYPE_DSCACHEFILE;
|
|
|
|
|
dummychan.data = cache_file;
|
|
|
|
|
dummychan.id = &cache_file->id;
|
|
|
|
|
dummychan.adt = cache_file->adt;
|
|
|
|
|
|
|
|
|
|
bAnimContext ac = {NULL};
|
|
|
|
|
ac.ads = ads;
|
|
|
|
|
ac.data = &dummychan;
|
|
|
|
|
ac.datatype = ANIMCONT_CHANNEL;
|
|
|
|
|
|
|
|
|
|
/* get F-Curves to take keyframes from */
|
|
|
|
|
ListBase anim_data = { NULL, NULL };
|
|
|
|
|
int filter = ANIMFILTER_DATA_VISIBLE; // curves only
|
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
|
|
/* loop through each F-Curve, grabbing the keyframes */
|
|
|
|
|
for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(ale->adt, ale->data, keys);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ANIM_animdata_freelist(&anim_data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
|
|
|
|
BezTriple *bezt;
|
2011-02-27 08:31:10 +00:00
|
|
|
unsigned int v;
|
|
|
|
|
|
2009-03-02 00:55:10 +00:00
|
|
|
if (fcu && fcu->totvert && fcu->bezt) {
|
2009-07-09 13:14:51 +00:00
|
|
|
/* apply NLA-mapping (if applicable) */
|
2012-10-21 05:46:41 +00:00
|
|
|
if (adt)
|
2010-01-18 00:35:28 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* loop through beztriples, making ActKeysColumns */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++) {
|
2009-07-18 07:11:37 +00:00
|
|
|
add_bezt_to_keycolumns_list(keys, bezt);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
/* Update keyblocks. */
|
|
|
|
|
update_keyblocks(keys, fcu->bezt, fcu->totvert);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-09 13:14:51 +00:00
|
|
|
/* unapply NLA-mapping if applicable */
|
2010-01-12 21:20:09 +00:00
|
|
|
if (adt)
|
2010-01-18 00:35:28 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void agroup_to_keylist(AnimData *adt, bActionGroup *agrp, DLRBT_Tree *keys)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2009-01-20 11:07:42 +00:00
|
|
|
FCurve *fcu;
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
if (agrp) {
|
2009-01-20 11:07:42 +00:00
|
|
|
/* loop through F-Curves */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) {
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(adt, fcu, keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 20:22:44 +03:00
|
|
|
void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
2009-01-20 11:07:42 +00:00
|
|
|
FCurve *fcu;
|
2008-12-22 08:13:25 +00:00
|
|
|
|
|
|
|
|
if (act) {
|
2009-01-20 11:07:42 +00:00
|
|
|
/* loop through F-Curves */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
2018-10-13 20:22:44 +03:00
|
|
|
fcurve_to_keylist(adt, fcu, keys);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys, const bool active)
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
{
|
|
|
|
|
bGPDlayer *gpl;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
if (gpd && keys) {
|
|
|
|
|
/* for now, just aggregate out all the frames, but only for visible layers */
|
2018-10-16 10:37:18 +02:00
|
|
|
for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
if ((gpl->flag & GP_LAYER_HIDE) == 0) {
|
2018-07-31 10:22:19 +02:00
|
|
|
if ((!active) || ((active) && (gpl->flag & GP_LAYER_SELECT))) {
|
|
|
|
|
gpl_to_keylist(ads, gpl, keys);
|
|
|
|
|
}
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
|
2008-12-22 08:13:25 +00:00
|
|
|
{
|
|
|
|
|
bGPDframe *gpf;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-22 08:13:25 +00:00
|
|
|
if (gpl && keys) {
|
2011-01-10 22:10:28 +00:00
|
|
|
/* although the frames should already be in an ordered list, they are not suitable for displaying yet */
|
2012-05-08 15:30:00 +00:00
|
|
|
for (gpf = gpl->frames.first; gpf; gpf = gpf->next)
|
2011-01-10 22:10:28 +00:00
|
|
|
add_gpframe_to_keycolumns_list(keys, gpf);
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
update_keyblocks(keys, NULL, 0);
|
2008-12-22 08:13:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, DLRBT_Tree *keys)
|
|
|
|
|
{
|
|
|
|
|
MaskLayerShape *masklay_shape;
|
|
|
|
|
|
|
|
|
|
if (masklay && keys) {
|
|
|
|
|
for (masklay_shape = masklay->splines_shapes.first;
|
|
|
|
|
masklay_shape;
|
|
|
|
|
masklay_shape = masklay_shape->next)
|
|
|
|
|
{
|
|
|
|
|
add_masklay_to_keycolumns_list(keys, masklay_shape);
|
|
|
|
|
}
|
2018-10-13 20:22:44 +03:00
|
|
|
|
|
|
|
|
update_keyblocks(keys, NULL, 0);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
|
}
|