2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-23 02:07:13 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-23 02:07:13 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/screen/screen_context.c
|
|
|
|
* \ingroup edscr
|
|
|
|
*/
|
|
|
|
|
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 <stdio.h>
|
2008-12-23 02:07:13 +00:00
|
|
|
#include <stdlib.h>
|
2009-03-19 19:03:38 +00:00
|
|
|
#include <string.h>
|
2008-12-23 02:07:13 +00:00
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
2009-10-29 19:59:38 +00:00
|
|
|
#include "DNA_armature_types.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
|
|
|
#include "DNA_gpencil_types.h"
|
2010-07-04 09:13:00 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2008-12-23 02:07:13 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
2011-11-08 16:59:06 +00:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
2008-12-23 02:07:13 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2010-12-04 13:00:28 +00:00
|
|
|
#include "BKE_context.h"
|
|
|
|
#include "BKE_object.h"
|
2009-10-29 19:59:38 +00:00
|
|
|
#include "BKE_action.h"
|
2010-11-03 01:56:02 +00:00
|
|
|
#include "BKE_armature.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
|
|
|
#include "BKE_gpencil.h"
|
2015-05-13 10:56:40 +10:00
|
|
|
#include "BKE_screen.h"
|
2010-07-04 09:13:00 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2008-12-23 02:07:13 +00:00
|
|
|
|
2009-03-19 19:03:38 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2009-10-29 19:59:38 +00:00
|
|
|
#include "ED_armature.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
|
|
|
#include "ED_gpencil.h"
|
2009-07-19 17:44:44 +00:00
|
|
|
|
2011-11-08 16:59:06 +00:00
|
|
|
#include "WM_api.h"
|
2011-11-10 03:44:50 +00:00
|
|
|
#include "UI_interface.h"
|
2011-11-08 16:59:06 +00:00
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
#include "screen_intern.h"
|
|
|
|
|
2015-05-13 10:56:40 +10:00
|
|
|
static unsigned int context_layers(bScreen *sc, Scene *scene, ScrArea *sa_ctx)
|
|
|
|
{
|
|
|
|
/* needed for 'USE_ALLSELECT' define, otherwise we end up editing off-screen layers. */
|
|
|
|
if (sc && sa_ctx && (sa_ctx->spacetype == SPACE_BUTS)) {
|
|
|
|
const unsigned int lay = BKE_screen_view3d_layer_all(sc);
|
|
|
|
if (lay) {
|
|
|
|
return lay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return scene->lay;
|
|
|
|
}
|
|
|
|
|
2011-02-15 14:38:43 +00:00
|
|
|
const char *screen_context_dir[] = {
|
|
|
|
"scene", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
|
|
|
|
"selected_objects", "selected_bases",
|
2016-02-06 12:59:03 +13:00
|
|
|
"editable_objects", "editable_bases",
|
2011-02-15 14:38:43 +00:00
|
|
|
"selected_editable_objects", "selected_editable_bases",
|
|
|
|
"visible_bones", "editable_bones", "selected_bones", "selected_editable_bones",
|
|
|
|
"visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
|
|
|
|
"active_base", "active_object", "object", "edit_object",
|
|
|
|
"sculpt_object", "vertex_paint_object", "weight_paint_object",
|
2011-04-01 04:22:30 +00:00
|
|
|
"image_paint_object", "particle_edit_object",
|
2011-02-15 14:38:43 +00:00
|
|
|
"sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
|
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
|
|
|
"gpencil_data", "gpencil_data_owner", /* grease pencil data */
|
|
|
|
"visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes",
|
2016-08-03 23:31:48 +02:00
|
|
|
"active_gpencil_layer", "active_gpencil_frame", "active_gpencil_palette",
|
|
|
|
"active_gpencil_palettecolor", "active_gpencil_brush",
|
2011-11-08 16:59:06 +00:00
|
|
|
"active_operator",
|
2011-02-15 14:38:43 +00:00
|
|
|
NULL};
|
|
|
|
|
2009-03-19 19:03:38 +00:00
|
|
|
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
|
2008-12-23 02:07:13 +00:00
|
|
|
{
|
2012-05-08 15:43:59 +00:00
|
|
|
bScreen *sc = CTX_wm_screen(C);
|
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
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
2012-05-08 15:43:59 +00:00
|
|
|
Scene *scene = sc->scene;
|
2008-12-23 02:07:13 +00:00
|
|
|
Base *base;
|
2009-08-15 20:36:15 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
#if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */
|
|
|
|
Object *obact = CTX_data_active_object(C);
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
base = CTX_data_active_base(C);
|
2009-10-30 13:26:29 +00:00
|
|
|
#else
|
2012-05-08 15:43:59 +00:00
|
|
|
Object *obedit = scene->obedit;
|
|
|
|
Object *obact = OBACT;
|
|
|
|
base = BASACT;
|
2009-10-30 13:26:29 +00:00
|
|
|
#endif
|
2008-12-23 02:07:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (CTX_data_dir(member)) {
|
2011-02-15 14:38:43 +00:00
|
|
|
CTX_data_dir_set(result, screen_context_dir);
|
2009-06-20 14:55:28 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "scene")) {
|
2009-03-19 19:03:38 +00:00
|
|
|
CTX_data_id_pointer_set(result, &scene->id);
|
2008-12-23 02:07:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
|
2015-05-13 10:56:40 +10:00
|
|
|
const unsigned int lay = context_layers(sc, scene, sa);
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool visible_objects = CTX_data_equals(member, "visible_objects");
|
2010-04-01 19:48:29 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
2015-05-13 10:56:40 +10:00
|
|
|
if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & lay)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (visible_objects)
|
2010-04-01 19:48:29 +00:00
|
|
|
CTX_data_id_list_add(result, &base->object->id);
|
|
|
|
else
|
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
|
|
|
}
|
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2010-04-01 19:48:29 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
|
2015-05-13 10:56:40 +10:00
|
|
|
const unsigned int lay = context_layers(sc, scene, sa);
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool selectable_objects = CTX_data_equals(member, "selectable_objects");
|
2010-10-19 01:24:09 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
2015-05-13 10:56:40 +10:00
|
|
|
if (base->lay & lay) {
|
2012-05-08 15:43:59 +00:00
|
|
|
if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0 && (base->object->restrictflag & OB_RESTRICT_SELECT) == 0) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (selectable_objects)
|
2010-10-19 01:24:09 +00:00
|
|
|
CTX_data_id_list_add(result, &base->object->id);
|
|
|
|
else
|
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
|
2015-05-13 10:56:40 +10:00
|
|
|
const unsigned int lay = context_layers(sc, scene, sa);
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool selected_objects = CTX_data_equals(member, "selected_objects");
|
2009-03-19 19:03:38 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
2015-05-13 10:56:40 +10:00
|
|
|
if ((base->flag & SELECT) && (base->lay & lay)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (selected_objects)
|
2009-03-19 19:03:38 +00:00
|
|
|
CTX_data_id_list_add(result, &base->object->id);
|
2008-12-23 02:07:13 +00:00
|
|
|
else
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
2008-12-23 02:07:13 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2008-12-23 02:07:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
|
2015-05-13 10:56:40 +10:00
|
|
|
const unsigned int lay = context_layers(sc, scene, sa);
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool selected_editable_objects = CTX_data_equals(member, "selected_editable_objects");
|
2009-07-19 00:49:44 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
2015-05-13 10:56:40 +10:00
|
|
|
if ((base->flag & SELECT) && (base->lay & lay)) {
|
2012-05-08 15:43:59 +00:00
|
|
|
if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
|
|
|
|
if (0 == BKE_object_is_libdata(base->object)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (selected_editable_objects)
|
2009-07-19 00:49:44 +00:00
|
|
|
CTX_data_id_list_add(result, &base->object->id);
|
|
|
|
else
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
2009-07-19 00:49:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2016-02-06 12:59:03 +13:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "editable_objects") || CTX_data_equals(member, "editable_bases")) {
|
|
|
|
const unsigned int lay = context_layers(sc, scene, sa);
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool editable_objects = CTX_data_equals(member, "editable_objects");
|
2016-02-06 12:59:03 +13:00
|
|
|
|
|
|
|
/* Visible + Editable, but not necessarily selected */
|
|
|
|
for (base = scene->base.first; base; base = base->next) {
|
|
|
|
if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & lay)) {
|
|
|
|
if (0 == BKE_object_is_libdata(base->object)) {
|
|
|
|
if (editable_objects)
|
|
|
|
CTX_data_id_list_add(result, &base->object->id);
|
|
|
|
else
|
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2009-07-19 00:49:44 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
|
2012-05-08 15:43:59 +00:00
|
|
|
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
|
|
|
EditBone *ebone, *flipbone = NULL;
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool editable_bones = CTX_data_equals(member, "editable_bones");
|
2009-10-29 19:59:38 +00:00
|
|
|
|
|
|
|
if (arm && arm->edbo) {
|
|
|
|
/* Attention: X-Axis Mirroring is also handled here... */
|
2012-05-08 15:43:59 +00:00
|
|
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
|
2009-10-29 19:59:38 +00:00
|
|
|
/* first and foremost, bone must be visible and selected */
|
|
|
|
if (EBONE_VISIBLE(arm, ebone)) {
|
|
|
|
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
|
|
|
* so that most users of this data don't need to explicitly check for it themselves.
|
|
|
|
*
|
|
|
|
* We need to make sure that these mirrored copies are not selected, otherwise some
|
|
|
|
* bones will be operated on twice.
|
|
|
|
*/
|
|
|
|
if (arm->flag & ARM_MIRROR_EDIT)
|
|
|
|
flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone);
|
|
|
|
|
|
|
|
/* if we're filtering for editable too, use the check for that instead, as it has selection check too */
|
|
|
|
if (editable_bones) {
|
|
|
|
/* only selected + editable */
|
|
|
|
if (EBONE_EDITABLE(ebone)) {
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
2009-10-29 19:59:38 +00:00
|
|
|
|
|
|
|
if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* only include bones if visible */
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
2009-10-29 19:59:38 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
if ((flipbone) && EBONE_VISIBLE(arm, flipbone) == 0)
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2009-10-29 19:59:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
|
2012-05-08 15:43:59 +00:00
|
|
|
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
|
|
|
|
EditBone *ebone, *flipbone = NULL;
|
2016-08-04 03:10:28 +02:00
|
|
|
const bool selected_editable_bones = CTX_data_equals(member, "selected_editable_bones");
|
2009-10-29 19:59:38 +00:00
|
|
|
|
|
|
|
if (arm && arm->edbo) {
|
|
|
|
/* Attention: X-Axis Mirroring is also handled here... */
|
2012-05-08 15:43:59 +00:00
|
|
|
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
|
2009-10-29 19:59:38 +00:00
|
|
|
/* first and foremost, bone must be visible and selected */
|
|
|
|
if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) {
|
|
|
|
/* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled
|
|
|
|
* so that most users of this data don't need to explicitly check for it themselves.
|
|
|
|
*
|
|
|
|
* We need to make sure that these mirrored copies are not selected, otherwise some
|
|
|
|
* bones will be operated on twice.
|
|
|
|
*/
|
|
|
|
if (arm->flag & ARM_MIRROR_EDIT)
|
|
|
|
flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone);
|
|
|
|
|
|
|
|
/* if we're filtering for editable too, use the check for that instead, as it has selection check too */
|
|
|
|
if (selected_editable_bones) {
|
|
|
|
/* only selected + editable */
|
|
|
|
if (EBONE_EDITABLE(ebone)) {
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
2009-10-29 19:59:38 +00:00
|
|
|
|
|
|
|
if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* only include bones if selected */
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, ebone);
|
2009-10-29 19:59:38 +00:00
|
|
|
|
|
|
|
if ((flipbone) && !(flipbone->flag & BONE_SELECTED))
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_list_add(result, &arm->id, &RNA_EditBone, flipbone);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2009-10-29 19:59:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "visible_pose_bones")) {
|
2012-05-08 15:43:59 +00:00
|
|
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
|
|
|
bArmature *arm = (obpose) ? obpose->data : NULL;
|
2009-10-29 19:59:38 +00:00
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
2010-10-07 23:17:14 +00:00
|
|
|
if (obpose && obpose->pose && arm) {
|
2012-05-08 15:43:59 +00:00
|
|
|
for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
|
2009-10-29 19:59:38 +00:00
|
|
|
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
2010-11-03 01:56:02 +00:00
|
|
|
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
2010-10-07 23:17:14 +00:00
|
|
|
CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2009-10-29 19:59:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_pose_bones")) {
|
2012-05-08 15:43:59 +00:00
|
|
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
|
|
|
bArmature *arm = (obpose) ? obpose->data : NULL;
|
2009-10-29 19:59:38 +00:00
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
2010-10-07 23:17:14 +00:00
|
|
|
if (obpose && obpose->pose && arm) {
|
2012-05-08 15:43:59 +00:00
|
|
|
for (pchan = obpose->pose->chanbase.first; pchan; pchan = pchan->next) {
|
2009-10-29 19:59:38 +00:00
|
|
|
/* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */
|
2010-11-03 01:56:02 +00:00
|
|
|
if (PBONE_VISIBLE(arm, pchan->bone)) {
|
2010-12-08 03:05:46 +00:00
|
|
|
if (pchan->bone->flag & BONE_SELECTED)
|
2010-10-07 23:17:14 +00:00
|
|
|
CTX_data_list_add(result, &obpose->id, &RNA_PoseBone, pchan);
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
2010-04-24 19:26:05 +00:00
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
2009-10-29 19:59:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "active_bone")) {
|
|
|
|
if (obact && obact->type == OB_ARMATURE) {
|
2012-05-08 15:43:59 +00:00
|
|
|
bArmature *arm = obact->data;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (arm->edbo) {
|
|
|
|
if (arm->act_edbone) {
|
2009-11-10 13:20:32 +00:00
|
|
|
CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
|
|
|
|
return 1;
|
|
|
|
}
|
2009-11-09 21:03:54 +00:00
|
|
|
}
|
2009-11-10 13:20:32 +00:00
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (arm->act_bone) {
|
2009-11-10 13:20:32 +00:00
|
|
|
CTX_data_pointer_set(result, &arm->id, &RNA_Bone, arm->act_bone);
|
|
|
|
return 1;
|
|
|
|
}
|
2009-10-29 19:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "active_pose_bone")) {
|
2009-10-29 19:59:38 +00:00
|
|
|
bPoseChannel *pchan;
|
2012-05-08 15:43:59 +00:00
|
|
|
Object *obpose = BKE_object_pose_armature_get(obact);
|
2009-10-29 19:59:38 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
pchan = BKE_pose_channel_active(obpose);
|
2009-10-29 19:59:38 +00:00
|
|
|
if (pchan) {
|
2010-10-07 23:17:14 +00:00
|
|
|
CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan);
|
2009-10-29 19:59:38 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "active_base")) {
|
|
|
|
if (base)
|
2009-11-11 09:16:53 +00:00
|
|
|
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, base);
|
2008-12-23 02:07:13 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "active_object")) {
|
|
|
|
if (obact)
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2008-12-23 02:07:13 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "object")) {
|
|
|
|
if (obact)
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "edit_object")) {
|
2008-12-31 17:11:42 +00:00
|
|
|
/* convenience for now, 1 object per scene in editmode */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (obedit)
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obedit->id);
|
2008-12-31 17:11:42 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "sculpt_object")) {
|
|
|
|
if (obact && (obact->mode & OB_MODE_SCULPT))
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2009-07-19 01:55:21 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "vertex_paint_object")) {
|
|
|
|
if (obact && (obact->mode & OB_MODE_VERTEX_PAINT))
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2009-07-19 17:44:44 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "weight_paint_object")) {
|
|
|
|
if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2009-07-19 17:44:44 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "image_paint_object")) {
|
|
|
|
if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2009-07-25 22:31:02 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "particle_edit_object")) {
|
|
|
|
if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
|
2009-10-30 12:35:17 +00:00
|
|
|
CTX_data_id_pointer_set(result, &obact->id);
|
2009-07-25 22:31:02 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "sequences")) {
|
2014-03-20 15:45:20 +06:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ed) {
|
2010-07-06 18:07:10 +00:00
|
|
|
Sequence *seq;
|
2012-05-08 15:43:59 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2010-07-06 18:07:10 +00:00
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_sequences")) {
|
2014-03-20 15:45:20 +06:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ed) {
|
2010-07-04 09:13:00 +00:00
|
|
|
Sequence *seq;
|
2012-05-08 15:43:59 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2010-07-04 09:13:00 +00:00
|
|
|
if (seq->flag & SELECT) {
|
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "selected_editable_sequences")) {
|
2014-03-20 15:45:20 +06:00
|
|
|
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ed) {
|
2010-07-04 09:13:00 +00:00
|
|
|
Sequence *seq;
|
2012-05-08 15:43:59 +00:00
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2010-07-04 09:13:00 +00:00
|
|
|
if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
|
|
|
|
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
else if (CTX_data_equals(member, "gpencil_data")) {
|
|
|
|
/* FIXME: for some reason, CTX_data_active_object(C) returns NULL when called from these situations
|
2014-12-01 02:33:23 +13:00
|
|
|
* (as outlined above - see Campbell's #ifdefs). That causes the get_active function to fail when
|
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
|
|
|
* called from context. For that reason, we end up using an alternative where we pass everything in!
|
|
|
|
*/
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
|
|
|
CTX_data_id_pointer_set(result, &gpd->id);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "gpencil_data_owner")) {
|
|
|
|
/* pointer to which data/datablock owns the reference to the Grease Pencil data being used (as gpencil_data)
|
|
|
|
* XXX: see comment for gpencil_data case...
|
|
|
|
*/
|
|
|
|
bGPdata **gpd_ptr = NULL;
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
|
|
|
/* get pointer to Grease Pencil Data */
|
|
|
|
gpd_ptr = ED_gpencil_data_get_pointers_direct((ID *)sc, scene, sa, obact, &ptr);
|
|
|
|
|
|
|
|
if (gpd_ptr) {
|
|
|
|
CTX_data_pointer_set(result, ptr.id.data, ptr.type, ptr.data);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "active_gpencil_layer")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
|
|
|
|
if (gpl) {
|
|
|
|
CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-03 23:31:48 +02:00
|
|
|
else if (CTX_data_equals(member, "active_gpencil_palette")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
|
|
|
if (palette) {
|
|
|
|
CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPalette, palette);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "active_gpencil_palettecolor")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
|
|
|
if (palette) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
|
2016-08-03 23:31:48 +02:00
|
|
|
if (palcolor) {
|
|
|
|
CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPaletteColor, palcolor);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "active_gpencil_brush")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDbrush *brush = BKE_gpencil_brush_getactive(scene->toolsettings);
|
2016-08-03 23:31:48 +02:00
|
|
|
|
|
|
|
if (brush) {
|
2016-09-24 12:49:43 +12:00
|
|
|
CTX_data_pointer_set(result, &scene->id, &RNA_GPencilBrush, brush);
|
2016-08-03 23:31:48 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
else if (CTX_data_equals(member, "active_gpencil_frame")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
2016-08-04 15:03:18 +02:00
|
|
|
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
|
|
|
|
if (gpl) {
|
|
|
|
CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilLayer, gpl->actframe);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "visible_gpencil_layers")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
|
|
|
bGPDlayer *gpl;
|
|
|
|
|
|
|
|
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
|
|
|
if ((gpl->flag & GP_LAYER_HIDE) == 0) {
|
|
|
|
CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "editable_gpencil_layers")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
|
|
|
bGPDlayer *gpl;
|
|
|
|
|
|
|
|
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
2016-02-09 02:44:02 +13:00
|
|
|
if (gpencil_layer_is_editable(gpl)) {
|
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
|
|
|
CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CTX_data_equals(member, "editable_gpencil_strokes")) {
|
|
|
|
/* XXX: see comment for gpencil_data case... */
|
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact);
|
|
|
|
|
|
|
|
if (gpd) {
|
|
|
|
bGPDlayer *gpl;
|
|
|
|
|
|
|
|
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
2016-02-09 02:44:02 +13:00
|
|
|
if (gpencil_layer_is_editable(gpl) && (gpl->actframe)) {
|
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
|
|
|
bGPDframe *gpf = gpl->actframe;
|
|
|
|
bGPDstroke *gps;
|
|
|
|
|
|
|
|
for (gps = gpf->strokes.first; gps; gps = gps->next) {
|
2015-01-19 16:38:32 +13:00
|
|
|
if (ED_gpencil_stroke_can_use_direct(sa, gps)) {
|
2016-08-03 23:31:48 +02:00
|
|
|
/* check if the color is editable */
|
|
|
|
if (ED_gpencil_stroke_color_use(gpl, gps) == false) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-01-19 16:38:32 +13:00
|
|
|
CTX_data_list_add(result, &gpd->id, &RNA_GPencilStroke, gps);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "active_operator")) {
|
2012-05-08 15:43:59 +00:00
|
|
|
wmOperator *op = NULL;
|
2011-11-08 16:59:06 +00:00
|
|
|
|
2012-05-08 15:43:59 +00:00
|
|
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sfile) {
|
2012-05-08 15:43:59 +00:00
|
|
|
op = sfile->op;
|
2011-11-08 16:59:06 +00:00
|
|
|
}
|
2014-11-09 21:20:40 +01:00
|
|
|
else if ((op = UI_context_active_operator_get(C))) {
|
2014-12-01 02:33:23 +13:00
|
|
|
/* do nothing */
|
2011-11-10 03:44:50 +00:00
|
|
|
}
|
2011-11-08 16:59:06 +00:00
|
|
|
else {
|
|
|
|
/* note, this checks poll, could be a problem, but this also
|
|
|
|
* happens for the toolbar */
|
2012-05-08 15:43:59 +00:00
|
|
|
op = WM_operator_last_redo(C);
|
2011-11-08 16:59:06 +00:00
|
|
|
}
|
|
|
|
/* TODO, get the operator from popup's */
|
|
|
|
|
|
|
|
if (op && op->ptr) {
|
|
|
|
CTX_data_pointer_set(result, NULL, &RNA_Operator, op);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2009-11-10 15:09:53 +00:00
|
|
|
else {
|
|
|
|
return 0; /* not found */
|
|
|
|
}
|
2009-07-25 22:31:02 +00:00
|
|
|
|
2009-11-10 15:09:53 +00:00
|
|
|
return -1; /* found but not available */
|
2008-12-23 02:07:13 +00:00
|
|
|
}
|
|
|
|
|