2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-01-14 16:13:50 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-01-14 16:13:50 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-14 16:13:50 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup edgpencil
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __GPENCIL_INTERN_H__
|
|
|
|
#define __GPENCIL_INTERN_H__
|
2009-01-14 16:13:50 +00: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
|
|
|
#include "DNA_vec_types.h"
|
2009-08-26 12:01:15 +00:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "ED_numinput.h"
|
|
|
|
|
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
|
|
|
/* internal exports only */
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Material;
|
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
|
|
|
struct bGPDspoint;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bGPDstroke;
|
|
|
|
struct bGPdata;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct tGPspoint;
|
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
|
|
|
|
2017-06-08 03:07:57 +12:00
|
|
|
struct GHash;
|
2018-06-16 18:02:02 +02:00
|
|
|
struct RNG;
|
2017-06-08 03:07:57 +12:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ARegion;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Brush;
|
|
|
|
struct Scene;
|
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
|
|
|
struct View2D;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct View3D;
|
2009-08-26 12:01:15 +00:00
|
|
|
struct wmOperatorType;
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Depsgraph;
|
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct EnumPropertyItem;
|
2015-12-13 21:03:13 +13:00
|
|
|
struct PointerRNA;
|
|
|
|
struct PropertyRNA;
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* ***************************************************** */
|
|
|
|
/* Modal Operator Geometry Preview
|
|
|
|
*
|
|
|
|
* Several modal operators (Fill, Interpolate, Primitive)
|
|
|
|
* need to run some drawing code to display previews, or
|
|
|
|
* to perform screen-space/image-based analysis routines.
|
|
|
|
* The following structs + function prototypes are used
|
|
|
|
* by these operators so that the operator code
|
|
|
|
* (in gpencil_<opname>.c) can communicate with the drawing
|
|
|
|
* code (in drawgpencil.c).
|
|
|
|
*
|
|
|
|
* NOTE: All this is within the gpencil module, so nothing needs
|
|
|
|
* to be exported to other modules.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Internal Operator-State Data ------------------------ */
|
|
|
|
|
2020-05-07 15:02:21 +02:00
|
|
|
/** Random settings by stroke */
|
|
|
|
typedef struct GpRandomSettings {
|
|
|
|
/** Pressure used for evaluated curves. */
|
|
|
|
float pen_press;
|
|
|
|
|
|
|
|
float hsv[3];
|
|
|
|
float pressure;
|
|
|
|
float strength;
|
|
|
|
float uv;
|
|
|
|
} GpRandomSettings;
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* Temporary draw data (no draw manager mode) */
|
|
|
|
typedef struct tGPDdraw {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct RegionView3D *rv3d; /* region to draw */
|
|
|
|
struct Depsgraph *depsgraph; /* depsgraph */
|
|
|
|
struct Object *ob; /* GP object */
|
|
|
|
struct bGPdata *gpd; /* current GP datablock */
|
|
|
|
struct bGPDlayer *gpl; /* layer */
|
|
|
|
struct bGPDframe *gpf; /* frame */
|
|
|
|
struct bGPDframe *t_gpf; /* temporal frame */
|
|
|
|
struct bGPDstroke *gps; /* stroke */
|
|
|
|
int disable_fill; /* disable fill */
|
|
|
|
int offsx; /* windows offset x */
|
|
|
|
int offsy; /* windows offset y */
|
|
|
|
int winx; /* windows width */
|
|
|
|
int winy; /* windows height */
|
|
|
|
int dflag; /* flags datablock */
|
|
|
|
short lthick; /* layer thickness */
|
|
|
|
float opacity; /* opacity */
|
|
|
|
float tintcolor[4]; /* tint color */
|
|
|
|
bool onion; /* onion flag */
|
|
|
|
bool custonion; /* use custom onion colors */
|
|
|
|
bool is_fill_stroke; /* use fill tool */
|
|
|
|
float diff_mat[4][4]; /* matrix */
|
2018-07-31 10:22:19 +02:00
|
|
|
} tGPDdraw;
|
|
|
|
|
|
|
|
/* Temporary interpolate operation data */
|
|
|
|
typedef struct tGPDinterpolate_layer {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct tGPDinterpolate_layer *next, *prev;
|
|
|
|
|
|
|
|
/** layer */
|
|
|
|
struct bGPDlayer *gpl;
|
|
|
|
/** frame before current frame (interpolate-from) */
|
|
|
|
struct bGPDframe *prevFrame;
|
|
|
|
/** frame after current frame (interpolate-to) */
|
|
|
|
struct bGPDframe *nextFrame;
|
|
|
|
/** interpolated frame */
|
|
|
|
struct bGPDframe *interFrame;
|
|
|
|
/** interpolate factor */
|
|
|
|
float factor;
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
} tGPDinterpolate_layer;
|
|
|
|
|
|
|
|
typedef struct tGPDinterpolate {
|
2020-03-09 16:27:24 +01:00
|
|
|
/** Current depsgraph from context */
|
|
|
|
struct Depsgraph *depsgraph;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** current scene from context */
|
|
|
|
struct Scene *scene;
|
|
|
|
/** area where painting originated */
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** region where painting originated */
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** current GP datablock */
|
|
|
|
struct bGPdata *gpd;
|
|
|
|
/** current material */
|
|
|
|
struct Material *mat;
|
|
|
|
|
|
|
|
/** current frame number */
|
|
|
|
int cframe;
|
|
|
|
/** (tGPDinterpolate_layer) layers to be interpolated */
|
|
|
|
ListBase ilayers;
|
|
|
|
/** value for determining the displacement influence */
|
|
|
|
float shift;
|
|
|
|
/** initial interpolation factor for active layer */
|
|
|
|
float init_factor;
|
|
|
|
/** shift low limit (-100%) */
|
|
|
|
float low_limit;
|
|
|
|
/** shift upper limit (200%) */
|
|
|
|
float high_limit;
|
|
|
|
/** flag from toolsettings */
|
|
|
|
int flag;
|
|
|
|
|
|
|
|
NumInput num; /* numeric input */
|
2018-07-31 10:22:19 +02:00
|
|
|
} tGPDinterpolate;
|
|
|
|
|
|
|
|
/* Temporary primitive operation data */
|
|
|
|
typedef struct tGPDprimitive {
|
2019-04-17 06:17:24 +02:00
|
|
|
/** main database pointer */
|
|
|
|
struct Main *bmain;
|
|
|
|
struct Depsgraph *depsgraph;
|
|
|
|
/** window where painting originated */
|
|
|
|
struct wmWindow *win;
|
|
|
|
/** current scene from context */
|
|
|
|
struct Scene *scene;
|
|
|
|
/** current active gp object */
|
|
|
|
struct Object *ob;
|
2020-03-09 16:27:24 +01:00
|
|
|
/** current evaluated gp object */
|
|
|
|
struct Object *ob_eval;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** area where painting originated */
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** region where painting originated */
|
|
|
|
struct RegionView3D *rv3d;
|
|
|
|
/** view3d where painting originated */
|
|
|
|
struct View3D *v3d;
|
|
|
|
/** region where painting originated */
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** current GP datablock */
|
|
|
|
struct bGPdata *gpd;
|
|
|
|
/** current material */
|
2020-03-09 16:27:24 +01:00
|
|
|
struct Material *material;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** current brush */
|
|
|
|
struct Brush *brush;
|
|
|
|
|
|
|
|
/** current frame number */
|
|
|
|
int cframe;
|
|
|
|
/** layer */
|
|
|
|
struct bGPDlayer *gpl;
|
|
|
|
/** frame */
|
|
|
|
struct bGPDframe *gpf;
|
|
|
|
/** type of primitive */
|
|
|
|
int type;
|
|
|
|
/** original type of primitive */
|
|
|
|
int orign_type;
|
|
|
|
/** type of primitive is a curve */
|
|
|
|
bool curve;
|
|
|
|
/** brush size */
|
|
|
|
int brush_size;
|
|
|
|
/** brush strength */
|
|
|
|
float brush_strength;
|
|
|
|
/** flip option */
|
|
|
|
short flip;
|
|
|
|
/** array of data-points for stroke */
|
|
|
|
tGPspoint *points;
|
|
|
|
/** number of edges allocated */
|
|
|
|
int point_count;
|
|
|
|
/** stored number of polygon edges */
|
|
|
|
int tot_stored_edges;
|
|
|
|
/** number of polygon edges */
|
|
|
|
int tot_edges;
|
|
|
|
/** move distance */
|
|
|
|
float move[2];
|
|
|
|
/** initial box corner */
|
|
|
|
float origin[2];
|
|
|
|
/** first box corner */
|
|
|
|
float start[2];
|
|
|
|
/** last box corner */
|
|
|
|
float end[2];
|
|
|
|
/** midpoint box corner */
|
|
|
|
float midpoint[2];
|
|
|
|
/** first control point */
|
|
|
|
float cp1[2];
|
|
|
|
/** second control point */
|
|
|
|
float cp2[2];
|
|
|
|
/** flag to determine control point is selected */
|
|
|
|
int sel_cp;
|
|
|
|
/** flag to determine operations in progress */
|
|
|
|
int flag;
|
2019-10-18 22:02:45 +01:00
|
|
|
/** flag to determine operations previous mode */
|
|
|
|
int prev_flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
/** recorded mouse-position */
|
|
|
|
float mval[2];
|
|
|
|
/** previous recorded mouse-position */
|
|
|
|
float mvalo[2];
|
|
|
|
|
|
|
|
/** lock to viewport axis */
|
|
|
|
int lock_axis;
|
|
|
|
struct RNG *rng;
|
|
|
|
|
|
|
|
/** numeric input */
|
|
|
|
NumInput num;
|
|
|
|
|
|
|
|
/** size in pixels for uv calculation */
|
|
|
|
float totpixlen;
|
2020-05-07 15:02:21 +02:00
|
|
|
|
|
|
|
/** Random settings by stroke */
|
|
|
|
GpRandomSettings random_settings;
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
} tGPDprimitive;
|
|
|
|
|
|
|
|
/* Modal Operator Drawing Callbacks ------------------------ */
|
|
|
|
void ED_gp_draw_fill(struct tGPDdraw *tgpw);
|
|
|
|
|
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
|
|
|
/* ***************************************************** */
|
|
|
|
/* Internal API */
|
|
|
|
|
|
|
|
/* Stroke Coordinates API ------------------------------ */
|
|
|
|
/* gpencil_utils.c */
|
|
|
|
|
|
|
|
typedef struct GP_SpaceConversion {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct Scene *scene;
|
|
|
|
struct Object *ob;
|
|
|
|
struct bGPdata *gpd;
|
|
|
|
struct bGPDlayer *gpl;
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
struct ScrArea *area;
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region;
|
2019-04-17 06:17:24 +02:00
|
|
|
struct View2D *v2d;
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
rctf *subrect; /* for using the camera rect within the 3d view */
|
|
|
|
rctf subrect_data;
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */
|
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
|
|
|
} GP_SpaceConversion;
|
|
|
|
|
2020-03-27 12:31:30 +01:00
|
|
|
bool gp_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1);
|
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
|
|
|
|
|
|
|
void gp_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_point_to_xy(const GP_SpaceConversion *gsc,
|
|
|
|
const struct bGPDstroke *gps,
|
|
|
|
const struct bGPDspoint *pt,
|
|
|
|
int *r_x,
|
|
|
|
int *r_y);
|
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
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
|
|
|
|
const bGPDstroke *gps,
|
|
|
|
const bGPDspoint *pt,
|
|
|
|
float *r_x,
|
|
|
|
float *r_y);
|
2016-08-29 03:03:09 +12:00
|
|
|
|
2018-11-13 14:04:00 +11:00
|
|
|
void gp_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt);
|
2018-07-31 10:22:19 +02:00
|
|
|
/**
|
|
|
|
* Change points position relative to parent object
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_apply_parent(struct Depsgraph *depsgraph,
|
|
|
|
struct Object *obact,
|
|
|
|
bGPDlayer *gpl,
|
|
|
|
bGPDstroke *gps);
|
2018-07-31 10:22:19 +02:00
|
|
|
/**
|
|
|
|
* Change point position relative to parent object
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_apply_parent_point(struct Depsgraph *depsgraph,
|
|
|
|
struct Object *obact,
|
|
|
|
bGPDlayer *gpl,
|
|
|
|
bGPDspoint *pt);
|
|
|
|
|
|
|
|
void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
|
|
|
|
const short flag,
|
|
|
|
const float pt[3],
|
|
|
|
float xy[2]);
|
|
|
|
|
|
|
|
bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
|
|
|
|
struct Scene *scene,
|
|
|
|
const float screen_co[2],
|
|
|
|
float r_out[3]);
|
2015-12-13 21:03:13 +13:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* helper to convert 2d to 3d */
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_stroke_convertcoords_tpoint(struct Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region,
|
2019-04-17 06:17:24 +02:00
|
|
|
struct Object *ob,
|
|
|
|
const struct tGPspoint *point2D,
|
|
|
|
float *depth,
|
|
|
|
float out[3]);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2015-04-02 16:29:33 +13:00
|
|
|
/* Poll Callbacks ------------------------------------ */
|
|
|
|
/* gpencil_utils.c */
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool gp_add_poll(struct bContext *C);
|
|
|
|
bool gp_active_layer_poll(struct bContext *C);
|
|
|
|
bool gp_active_brush_poll(struct bContext *C);
|
|
|
|
bool gp_brush_crt_presets_poll(bContext *C);
|
2015-04-02 16:29:33 +13:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
/* Copy/Paste Buffer --------------------------------- */
|
|
|
|
/* gpencil_edit.c */
|
|
|
|
|
|
|
|
extern ListBase gp_strokes_copypastebuf;
|
|
|
|
|
2017-06-08 03:07:57 +12:00
|
|
|
/* Build a map for converting between old colornames and destination-color-refs */
|
2018-07-31 10:22:19 +02:00
|
|
|
struct GHash *gp_copybuf_validate_colormap(struct bContext *C);
|
2017-06-08 03:07:57 +12:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
/* Stroke Editing ------------------------------------ */
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void gp_stroke_delete_tagged_points(bGPDframe *gpf,
|
|
|
|
bGPDstroke *gps,
|
|
|
|
bGPDstroke *next_stroke,
|
|
|
|
int tag_flags,
|
|
|
|
bool select,
|
|
|
|
int limit);
|
2018-07-31 10:22:19 +02:00
|
|
|
int gp_delete_selected_point_wrap(bContext *C);
|
2016-03-28 02:33:14 +13:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
/* Layers Enums -------------------------------------- */
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
const struct EnumPropertyItem *ED_gpencil_layers_enum_itemf(struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PropertyRNA *prop,
|
|
|
|
bool *r_free);
|
|
|
|
const struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PropertyRNA *prop,
|
|
|
|
bool *r_free);
|
2020-04-30 16:12:34 +02:00
|
|
|
const struct EnumPropertyItem *ED_gpencil_material_enum_itemf(struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PropertyRNA *prop,
|
|
|
|
bool *r_free);
|
2015-12-13 21:03:13 +13: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
|
|
|
/* ***************************************************** */
|
|
|
|
/* Operator Defines */
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* annotations ------ */
|
|
|
|
|
|
|
|
void GPENCIL_OT_annotate(struct wmOperatorType *ot);
|
|
|
|
|
2009-08-26 12:01:15 +00:00
|
|
|
/* drawing ---------- */
|
|
|
|
|
|
|
|
void GPENCIL_OT_draw(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
void GPENCIL_OT_fill(struct wmOperatorType *ot);
|
2009-08-26 12:01:15 +00:00
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
/* Vertex Paint. */
|
|
|
|
void GPENCIL_OT_vertex_paint(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_color_brightness_contrast(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_color_hsv(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_color_invert(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_color_levels(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_color_set(struct wmOperatorType *ot);
|
|
|
|
|
2019-01-11 19:15:23 +01:00
|
|
|
/* Guides ----------------------- */
|
|
|
|
|
|
|
|
void GPENCIL_OT_guide_rotate(struct wmOperatorType *ot);
|
|
|
|
|
2016-08-06 02:10:27 +12:00
|
|
|
/* Paint Modes for operator */
|
2009-08-30 04:48:34 +00:00
|
|
|
typedef enum eGPencil_PaintModes {
|
2019-04-17 06:17:24 +02:00
|
|
|
GP_PAINTMODE_DRAW = 0,
|
|
|
|
GP_PAINTMODE_ERASER,
|
|
|
|
GP_PAINTMODE_DRAW_STRAIGHT,
|
|
|
|
GP_PAINTMODE_DRAW_POLY,
|
|
|
|
GP_PAINTMODE_SET_CP,
|
2009-08-30 04:48:34 +00:00
|
|
|
} eGPencil_PaintModes;
|
|
|
|
|
2019-07-20 23:01:19 +02:00
|
|
|
/* chunk size for gp-session buffer (the total size is a multiple of this number) */
|
|
|
|
#define GP_STROKE_BUFFER_CHUNK 2048
|
2016-08-26 16:25:39 +12: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
|
|
|
/* stroke editing ----- */
|
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
void GPENCIL_OT_editmode_toggle(struct wmOperatorType *ot);
|
2018-09-20 11:56:41 +02:00
|
|
|
void GPENCIL_OT_selectmode_toggle(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
void GPENCIL_OT_paintmode_toggle(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_sculptmode_toggle(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_weightmode_toggle(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_vertexmode_toggle(struct wmOperatorType *ot);
|
2016-08-03 23:31:48 +02:00
|
|
|
void GPENCIL_OT_selection_opacity_toggle(struct wmOperatorType *ot);
|
2015-12-13 21:03:13 +13: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
|
|
|
void GPENCIL_OT_select(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_select_all(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_select_circle(struct wmOperatorType *ot);
|
2018-10-05 10:27:04 +10:00
|
|
|
void GPENCIL_OT_select_box(struct wmOperatorType *ot);
|
2014-12-02 13:52:48 +13:00
|
|
|
void GPENCIL_OT_select_lasso(struct wmOperatorType *ot);
|
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
|
|
|
|
|
|
|
void GPENCIL_OT_select_linked(struct wmOperatorType *ot);
|
2016-01-22 15:31:20 +13:00
|
|
|
void GPENCIL_OT_select_grouped(struct wmOperatorType *ot);
|
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
|
|
|
void GPENCIL_OT_select_more(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_select_less(struct wmOperatorType *ot);
|
2016-05-09 17:23:15 +12:00
|
|
|
void GPENCIL_OT_select_first(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_select_last(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
void GPENCIL_OT_select_alternate(struct wmOperatorType *ot);
|
2020-03-14 10:33:33 +01:00
|
|
|
void GPENCIL_OT_select_vertex_color(struct wmOperatorType *ot);
|
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
|
|
|
|
|
|
|
void GPENCIL_OT_duplicate(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_delete(struct wmOperatorType *ot);
|
2015-07-05 14:34:17 +10:00
|
|
|
void GPENCIL_OT_dissolve(struct wmOperatorType *ot);
|
2015-01-01 12:36:01 +13:00
|
|
|
void GPENCIL_OT_copy(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_paste(struct wmOperatorType *ot);
|
2019-03-04 19:31:36 +01:00
|
|
|
void GPENCIL_OT_extrude(struct wmOperatorType *ot);
|
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
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
void GPENCIL_OT_move_to_layer(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_layer_change(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_layer_active(struct wmOperatorType *ot);
|
2015-12-13 21:03:13 +13:00
|
|
|
|
|
|
|
void GPENCIL_OT_snap_to_grid(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_snap_to_cursor(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
|
|
|
|
|
2016-08-29 03:03:09 +12:00
|
|
|
void GPENCIL_OT_reproject(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_recalc_geometry(struct wmOperatorType *ot);
|
2015-12-13 21:03:13 +13:00
|
|
|
|
|
|
|
/* stroke sculpting -- */
|
|
|
|
|
2018-11-18 18:07:16 +01:00
|
|
|
void GPENCIL_OT_sculpt_paint(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_weight_paint(struct wmOperatorType *ot);
|
2015-12-13 21:03:13 +13:00
|
|
|
|
2009-08-29 06:50:32 +00:00
|
|
|
/* buttons editing --- */
|
|
|
|
|
2020-01-07 11:29:42 +01:00
|
|
|
void GPENCIL_OT_annotation_add(struct wmOperatorType *ot);
|
2009-08-29 06:50:32 +00:00
|
|
|
void GPENCIL_OT_data_unlink(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
void GPENCIL_OT_layer_add(struct wmOperatorType *ot);
|
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
|
|
|
void GPENCIL_OT_layer_remove(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_layer_move(struct wmOperatorType *ot);
|
2020-01-07 11:29:42 +01:00
|
|
|
void GPENCIL_OT_layer_annotation_add(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_layer_annotation_remove(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_layer_annotation_move(struct wmOperatorType *ot);
|
2014-12-31 14:20:44 +13:00
|
|
|
void GPENCIL_OT_layer_duplicate(struct wmOperatorType *ot);
|
2018-08-27 16:29:19 +02:00
|
|
|
void GPENCIL_OT_layer_duplicate_object(struct wmOperatorType *ot);
|
2009-08-29 06:50:32 +00:00
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_layer_mask_add(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_layer_mask_remove(struct wmOperatorType *ot);
|
|
|
|
|
2015-04-02 17:26:43 +13:00
|
|
|
void GPENCIL_OT_hide(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_reveal(struct wmOperatorType *ot);
|
|
|
|
|
2015-12-13 21:03:13 +13:00
|
|
|
void GPENCIL_OT_lock_all(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_unlock_all(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
void GPENCIL_OT_layer_isolate(struct wmOperatorType *ot);
|
2016-08-03 23:31:48 +02:00
|
|
|
void GPENCIL_OT_layer_merge(struct wmOperatorType *ot);
|
2015-12-13 21:03:13 +13:00
|
|
|
|
2017-01-19 02:11:51 +13:00
|
|
|
void GPENCIL_OT_blank_frame_add(struct wmOperatorType *ot);
|
|
|
|
|
2009-08-31 01:58:11 +00:00
|
|
|
void GPENCIL_OT_active_frame_delete(struct wmOperatorType *ot);
|
2020-01-07 11:29:42 +01:00
|
|
|
void GPENCIL_OT_annotation_active_frame_delete(struct wmOperatorType *ot);
|
2016-06-18 12:58:26 +12:00
|
|
|
void GPENCIL_OT_active_frames_delete_all(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
void GPENCIL_OT_frame_duplicate(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_frame_clean_fill(struct wmOperatorType *ot);
|
2018-08-15 17:01:27 +02:00
|
|
|
void GPENCIL_OT_frame_clean_loose(struct wmOperatorType *ot);
|
2009-08-31 01:58:11 +00:00
|
|
|
|
|
|
|
void GPENCIL_OT_convert(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_image_to_grease_pencil(struct wmOperatorType *ot);
|
2009-08-31 01:58:11 +00:00
|
|
|
|
2016-08-06 02:10:27 +12:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
GP_STROKE_JOIN = -1,
|
|
|
|
GP_STROKE_JOINCOPY = 1,
|
2016-08-06 02:10:27 +12:00
|
|
|
};
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
GP_STROKE_BOX = -1,
|
|
|
|
GP_STROKE_LINE = 1,
|
|
|
|
GP_STROKE_CIRCLE = 2,
|
|
|
|
GP_STROKE_ARC = 3,
|
|
|
|
GP_STROKE_CURVE = 4,
|
2019-10-18 22:02:45 +01:00
|
|
|
GP_STROKE_POLYLINE = 5,
|
2018-07-31 10:22:19 +02:00
|
|
|
};
|
|
|
|
|
2018-12-30 13:08:04 +01:00
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
GP_MERGE_STROKE = -1,
|
|
|
|
GP_MERGE_POINT = 1,
|
2018-12-30 13:08:04 +01:00
|
|
|
};
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
|
2019-01-11 19:15:23 +01:00
|
|
|
void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
|
2016-08-03 23:31:48 +02:00
|
|
|
void GPENCIL_OT_stroke_join(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot);
|
2016-09-15 13:29:26 +02:00
|
|
|
void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
void GPENCIL_OT_stroke_simplify(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_simplify_fixed(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_separate(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_stroke_split(struct wmOperatorType *ot);
|
2018-12-13 19:49:13 +01:00
|
|
|
void GPENCIL_OT_stroke_smooth(struct wmOperatorType *ot);
|
2019-08-08 16:12:13 +02:00
|
|
|
void GPENCIL_OT_stroke_sample(struct wmOperatorType *ot);
|
2018-12-30 13:08:04 +01:00
|
|
|
void GPENCIL_OT_stroke_merge(struct wmOperatorType *ot);
|
2019-01-11 19:15:23 +01:00
|
|
|
void GPENCIL_OT_stroke_cutter(struct wmOperatorType *ot);
|
2019-02-26 16:04:27 +00:00
|
|
|
void GPENCIL_OT_stroke_trim(struct wmOperatorType *ot);
|
2019-08-08 10:23:05 +02:00
|
|
|
void GPENCIL_OT_stroke_merge_by_distance(struct wmOperatorType *ot);
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_stroke_merge_material(struct wmOperatorType *ot);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
2020-03-09 16:27:24 +01:00
|
|
|
void GPENCIL_OT_material_to_vertex_color(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_extract_palette_vertex(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
void GPENCIL_OT_transform_fill(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_reset_transform_fill(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
void GPENCIL_OT_brush_reset(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_brush_reset_all(struct wmOperatorType *ot);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
2011-09-06 07:59:18 +00:00
|
|
|
/* undo stack ---------- */
|
|
|
|
|
|
|
|
void gpencil_undo_init(struct bGPdata *gpd);
|
|
|
|
void gpencil_undo_push(struct bGPdata *gpd);
|
|
|
|
void gpencil_undo_finish(void);
|
2009-08-26 12:01:15 +00:00
|
|
|
|
2016-09-07 09:54:50 +02:00
|
|
|
/* interpolation ---------- */
|
|
|
|
|
|
|
|
void GPENCIL_OT_interpolate(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_interpolate_sequence(struct wmOperatorType *ot);
|
2017-01-18 19:40:48 +13:00
|
|
|
void GPENCIL_OT_interpolate_reverse(struct wmOperatorType *ot);
|
2016-09-07 09:54:50 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* primitives ---------- */
|
|
|
|
|
|
|
|
void GPENCIL_OT_primitive(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
/* vertex groups ------------ */
|
|
|
|
void GPENCIL_OT_vertex_group_assign(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_group_remove_from(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_group_select(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_group_deselect(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_group_invert(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_vertex_group_smooth(struct wmOperatorType *ot);
|
2019-04-16 10:47:30 +02:00
|
|
|
void GPENCIL_OT_vertex_group_normalize(struct wmOperatorType *ot);
|
2019-04-16 12:12:35 +02:00
|
|
|
void GPENCIL_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
/* color handle */
|
|
|
|
void GPENCIL_OT_lock_layer(struct wmOperatorType *ot);
|
2020-03-17 18:29:18 +01:00
|
|
|
void GPENCIL_OT_material_isolate(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_hide(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_reveal(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_lock_all(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_unlock_all(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_lock_unused(struct wmOperatorType *ot);
|
2020-04-30 16:12:34 +02:00
|
|
|
void GPENCIL_OT_material_select(struct wmOperatorType *ot);
|
|
|
|
void GPENCIL_OT_material_set(struct wmOperatorType *ot);
|
2019-09-05 13:28:42 +02:00
|
|
|
void GPENCIL_OT_set_active_material(struct wmOperatorType *ot);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
/* convert old 2.7 files to 2.8 */
|
|
|
|
void GPENCIL_OT_convert_old_files(struct wmOperatorType *ot);
|
|
|
|
|
2018-08-30 12:22:55 +02:00
|
|
|
/* armatures */
|
|
|
|
void GPENCIL_OT_generate_weights(struct wmOperatorType *ot);
|
|
|
|
|
2016-08-29 01:37:14 +12:00
|
|
|
/* ****************************************************** */
|
2020-03-19 20:33:23 +01:00
|
|
|
/* FILTERED ACTION DATA - TYPES ---> XXX DEPRECATED OLD ANIM SYSTEM CODE! */
|
2009-01-14 16:13:50 +00:00
|
|
|
|
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
|
|
|
/* XXX - TODO: replace this with the modern bAnimListElem... */
|
2009-01-14 16:13:50 +00:00
|
|
|
/* This struct defines a structure used for quick access */
|
|
|
|
typedef struct bActListElem {
|
2019-04-17 06:17:24 +02:00
|
|
|
struct bActListElem *next, *prev;
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void *data; /* source data this elem represents */
|
|
|
|
int type; /* one of the ACTTYPE_* values */
|
|
|
|
int flag; /* copy of elem's flags for quick access */
|
|
|
|
int index; /* copy of adrcode where applicable */
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void *key_data; /* motion data - ipo or ipo-curve */
|
|
|
|
short datatype; /* type of motion data to expect */
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
struct bActionGroup *grp; /* action group that owns the channel */
|
2014-12-26 20:00:52 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
|
|
|
|
short ownertype; /* type of owner */
|
2009-01-14 16:13:50 +00:00
|
|
|
} bActListElem;
|
|
|
|
|
2016-08-29 01:37:14 +12:00
|
|
|
/* ****************************************************** */
|
2009-01-14 16:13:50 +00:00
|
|
|
/* FILTER ACTION DATA - METHODS/TYPES */
|
|
|
|
|
|
|
|
/* filtering flags - under what circumstances should a channel be added */
|
|
|
|
typedef enum ACTFILTER_FLAGS {
|
2019-04-17 06:17:24 +02:00
|
|
|
ACTFILTER_VISIBLE = (1 << 0), /* should channels be visible */
|
|
|
|
ACTFILTER_SEL = (1 << 1), /* should channels be selected */
|
|
|
|
ACTFILTER_FOREDIT = (1 << 2), /* does editable status matter */
|
|
|
|
ACTFILTER_CHANNELS = (1 << 3), /* do we only care that it is a channel */
|
|
|
|
ACTFILTER_IPOKEYS = (1 << 4), /* only channels referencing ipo's */
|
|
|
|
ACTFILTER_ONLYICU = (1 << 5), /* only reference ipo-curves */
|
|
|
|
ACTFILTER_FORDRAWING = (1 << 6), /* make list for interface drawing */
|
|
|
|
ACTFILTER_ACTGROUPED = (1 << 7), /* belongs to the active group */
|
2009-01-14 16:13:50 +00:00
|
|
|
} ACTFILTER_FLAGS;
|
|
|
|
|
|
|
|
/* Action Editor - Main Data types */
|
|
|
|
typedef enum ACTCONT_TYPES {
|
2019-04-17 06:17:24 +02:00
|
|
|
ACTCONT_NONE = 0,
|
|
|
|
ACTCONT_ACTION,
|
|
|
|
ACTCONT_SHAPEKEY,
|
|
|
|
ACTCONT_GPENCIL,
|
2009-01-14 16:13:50 +00:00
|
|
|
} ACTCONT_TYPES;
|
|
|
|
|
2016-08-29 01:37:14 +12:00
|
|
|
/* ****************************************************** */
|
|
|
|
/* Stroke Iteration Utilities */
|
|
|
|
|
2018-11-13 15:02:32 +11:00
|
|
|
struct GP_EditableStrokes_Iter {
|
2019-04-17 06:17:24 +02:00
|
|
|
float diff_mat[4][4];
|
2019-07-25 12:10:47 +02:00
|
|
|
float inverse_diff_mat[4][4];
|
2018-11-13 15:02:32 +11:00
|
|
|
};
|
|
|
|
|
2016-08-03 23:31:48 +02:00
|
|
|
/**
|
2018-09-02 18:28:27 +10:00
|
|
|
* Iterate over all editable strokes in the current context,
|
|
|
|
* stopping on each usable layer + stroke pair (i.e. gpl and gps)
|
|
|
|
* to perform some operations on the stroke.
|
|
|
|
*
|
2018-12-12 12:50:58 +11:00
|
|
|
* \param gpl: The identifier to use for the layer of the stroke being processed.
|
2018-09-02 18:28:27 +10:00
|
|
|
* Choose a suitable value to avoid name clashes.
|
2018-12-12 12:50:58 +11:00
|
|
|
* \param gps: The identifier to use for current stroke being processed.
|
2018-09-02 18:28:27 +10:00
|
|
|
* Choose a suitable value to avoid name clashes.
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
#define GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps) \
|
|
|
|
{ \
|
|
|
|
struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
|
2019-07-25 16:36:22 +02:00
|
|
|
Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
|
2019-04-17 06:17:24 +02:00
|
|
|
Object *obact_ = CTX_data_active_object(C); \
|
|
|
|
bGPdata *gpd_ = CTX_data_gpencil_data(C); \
|
|
|
|
const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
|
|
|
|
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { \
|
2019-06-07 16:07:32 +02:00
|
|
|
bGPDframe *init_gpf_ = (is_multiedit_) ? gpl->frames.first : gpl->actframe; \
|
2019-04-17 06:17:24 +02:00
|
|
|
for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
|
|
|
|
if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
|
2020-03-09 16:27:24 +01:00
|
|
|
BKE_gpencil_parent_matrix_get(depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
|
2019-07-25 12:10:47 +02:00
|
|
|
invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
|
2019-04-17 06:17:24 +02:00
|
|
|
/* loop over strokes */ \
|
2019-08-02 11:22:08 +02:00
|
|
|
bGPDstroke *gpsn_; \
|
|
|
|
for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
|
|
|
|
gpsn_ = gps->next; \
|
2019-04-17 06:17:24 +02:00
|
|
|
/* skip strokes that are invalid for current view */ \
|
|
|
|
if (ED_gpencil_stroke_can_use(C, gps) == false) \
|
|
|
|
continue; \
|
|
|
|
/* check if the color is editable */ \
|
|
|
|
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) \
|
|
|
|
continue; \
|
|
|
|
/* ... Do Stuff With Strokes ... */
|
|
|
|
|
|
|
|
#define GP_EDITABLE_STROKES_END(gpstroke_iter) \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (!is_multiedit_) { \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
CTX_DATA_END; \
|
|
|
|
} \
|
|
|
|
(void)0
|
2016-08-03 23:31:48 +02:00
|
|
|
|
2019-08-24 13:46:00 +02:00
|
|
|
/**
|
|
|
|
* Iterate over all editable strokes using evaluated data in the current context,
|
|
|
|
* stopping on each usable layer + stroke pair (i.e. gpl and gps)
|
|
|
|
* to perform some operations on the stroke.
|
|
|
|
*
|
|
|
|
* \param gpl: The identifier to use for the layer of the stroke being processed.
|
|
|
|
* Choose a suitable value to avoid name clashes.
|
|
|
|
* \param gps: The identifier to use for current stroke being processed.
|
|
|
|
* Choose a suitable value to avoid name clashes.
|
|
|
|
*/
|
|
|
|
#define GP_EVALUATED_STROKES_BEGIN(gpstroke_iter, C, gpl, gps) \
|
|
|
|
{ \
|
|
|
|
struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
|
|
|
|
Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
|
|
|
|
Object *obact_ = CTX_data_active_object(C); \
|
2020-03-09 16:27:24 +01:00
|
|
|
Object *ob_eval_ = (Object *)DEG_get_evaluated_id(depsgraph_, &obact_->id); \
|
|
|
|
bGPdata *gpd_ = (bGPdata *)ob_eval_->data; \
|
2019-08-24 13:46:00 +02:00
|
|
|
const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
|
2020-03-09 16:27:24 +01:00
|
|
|
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_->layers) { \
|
|
|
|
if (BKE_gpencil_layer_is_editable(gpl)) { \
|
2019-08-24 13:46:00 +02:00
|
|
|
bGPDframe *init_gpf_ = gpl->actframe; \
|
|
|
|
if (is_multiedit_) { \
|
|
|
|
init_gpf_ = gpl->frames.first; \
|
|
|
|
} \
|
|
|
|
for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
|
|
|
|
if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
|
2020-03-09 16:27:24 +01:00
|
|
|
BKE_gpencil_parent_matrix_get(depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
|
2019-08-24 13:46:00 +02:00
|
|
|
invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
|
|
|
|
/* loop over strokes */ \
|
2020-03-09 16:27:24 +01:00
|
|
|
for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gps->next) { \
|
2019-08-24 13:46:00 +02:00
|
|
|
/* skip strokes that are invalid for current view */ \
|
|
|
|
if (ED_gpencil_stroke_can_use(C, gps) == false) \
|
|
|
|
continue; \
|
|
|
|
/* check if the color is editable */ \
|
|
|
|
if (ED_gpencil_stroke_color_use(obact_, gpl, gps) == false) \
|
|
|
|
continue; \
|
|
|
|
/* ... Do Stuff With Strokes ... */
|
|
|
|
|
|
|
|
#define GP_EVALUATED_STROKES_END(gpstroke_iter) \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (!is_multiedit_) { \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
(void)0
|
|
|
|
|
2016-08-29 01:37:14 +12:00
|
|
|
/* ****************************************************** */
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __GPENCIL_INTERN_H__ */
|