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.
295 lines
10 KiB
C++
295 lines
10 KiB
C++
/*
|
|
* ***** 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,
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
* All rights reserved.
|
|
*
|
|
* Contributor(s): Blender Foundation (2008).
|
|
*
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
*/
|
|
|
|
#ifndef __BKE_CONTEXT_H__
|
|
#define __BKE_CONTEXT_H__
|
|
|
|
/** \file BKE_context.h
|
|
* \ingroup bke
|
|
*/
|
|
|
|
#include "DNA_listBase.h"
|
|
#include "RNA_types.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct ARegion;
|
|
struct bScreen;
|
|
struct ListBase;
|
|
struct Main;
|
|
struct Object;
|
|
struct PointerRNA;
|
|
struct ReportList;
|
|
struct Scene;
|
|
struct ScrArea;
|
|
struct SpaceLink;
|
|
struct View3D;
|
|
struct RegionView3D;
|
|
struct StructRNA;
|
|
struct ToolSettings;
|
|
struct Image;
|
|
struct Text;
|
|
struct ImBuf;
|
|
struct EditBone;
|
|
struct bPoseChannel;
|
|
struct bGPdata;
|
|
struct bGPDlayer;
|
|
struct bGPDframe;
|
|
struct wmWindow;
|
|
struct wmWindowManager;
|
|
struct SpaceText;
|
|
struct SpaceImage;
|
|
struct SpaceClip;
|
|
struct ID;
|
|
|
|
/* Structs */
|
|
|
|
struct bContext;
|
|
typedef struct bContext bContext;
|
|
|
|
struct bContextDataResult;
|
|
typedef struct bContextDataResult bContextDataResult;
|
|
|
|
typedef int (*bContextDataCallback)(const bContext *C,
|
|
const char *member, bContextDataResult *result);
|
|
|
|
typedef struct bContextStoreEntry {
|
|
struct bContextStoreEntry *next, *prev;
|
|
|
|
char name[128];
|
|
PointerRNA ptr;
|
|
} bContextStoreEntry;
|
|
|
|
typedef struct bContextStore {
|
|
struct bContextStore *next, *prev;
|
|
|
|
ListBase entries;
|
|
bool used;
|
|
} bContextStore;
|
|
|
|
/* for the context's rna mode enum
|
|
* keep aligned with data_mode_strings in context.c */
|
|
enum {
|
|
CTX_MODE_EDIT_MESH = 0,
|
|
CTX_MODE_EDIT_CURVE,
|
|
CTX_MODE_EDIT_SURFACE,
|
|
CTX_MODE_EDIT_TEXT,
|
|
CTX_MODE_EDIT_ARMATURE,
|
|
CTX_MODE_EDIT_METABALL,
|
|
CTX_MODE_EDIT_LATTICE,
|
|
CTX_MODE_POSE,
|
|
CTX_MODE_SCULPT,
|
|
CTX_MODE_PAINT_WEIGHT,
|
|
CTX_MODE_PAINT_VERTEX,
|
|
CTX_MODE_PAINT_TEXTURE,
|
|
CTX_MODE_PARTICLE,
|
|
CTX_MODE_OBJECT
|
|
};
|
|
|
|
/* Context */
|
|
|
|
bContext *CTX_create(void);
|
|
void CTX_free(bContext *C);
|
|
|
|
bContext *CTX_copy(const bContext *C);
|
|
|
|
/* Stored Context */
|
|
|
|
bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *ptr);
|
|
bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context);
|
|
void CTX_store_set(bContext *C, bContextStore *store);
|
|
bContextStore *CTX_store_copy(bContextStore *store);
|
|
void CTX_store_free(bContextStore *store);
|
|
void CTX_store_free_list(ListBase *contexts);
|
|
|
|
/* need to store if python is initialized or not */
|
|
int CTX_py_init_get(bContext *C);
|
|
void CTX_py_init_set(bContext *C, int value);
|
|
|
|
void *CTX_py_dict_get(const bContext *C);
|
|
void CTX_py_dict_set(bContext *C, void *value);
|
|
|
|
/* Window Manager Context */
|
|
|
|
struct wmWindowManager *CTX_wm_manager(const bContext *C);
|
|
struct wmWindow *CTX_wm_window(const bContext *C);
|
|
struct bScreen *CTX_wm_screen(const bContext *C);
|
|
struct ScrArea *CTX_wm_area(const bContext *C);
|
|
struct SpaceLink *CTX_wm_space_data(const bContext *C);
|
|
struct ARegion *CTX_wm_region(const bContext *C);
|
|
void *CTX_wm_region_data(const bContext *C);
|
|
struct ARegion *CTX_wm_menu(const bContext *C);
|
|
struct ReportList *CTX_wm_reports(const bContext *C);
|
|
|
|
struct View3D *CTX_wm_view3d(const bContext *C);
|
|
struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
|
|
struct SpaceText *CTX_wm_space_text(const bContext *C);
|
|
struct SpaceImage *CTX_wm_space_image(const bContext *C);
|
|
struct SpaceConsole *CTX_wm_space_console(const bContext *C);
|
|
struct SpaceButs *CTX_wm_space_buts(const bContext *C);
|
|
struct SpaceFile *CTX_wm_space_file(const bContext *C);
|
|
struct SpaceSeq *CTX_wm_space_seq(const bContext *C);
|
|
struct SpaceOops *CTX_wm_space_outliner(const bContext *C);
|
|
struct SpaceNla *CTX_wm_space_nla(const bContext *C);
|
|
struct SpaceTime *CTX_wm_space_time(const bContext *C);
|
|
struct SpaceNode *CTX_wm_space_node(const bContext *C);
|
|
struct SpaceLogic *CTX_wm_space_logic(const bContext *C);
|
|
struct SpaceIpo *CTX_wm_space_graph(const bContext *C);
|
|
struct SpaceAction *CTX_wm_space_action(const bContext *C);
|
|
struct SpaceInfo *CTX_wm_space_info(const bContext *C);
|
|
struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C);
|
|
struct SpaceClip *CTX_wm_space_clip(const bContext *C);
|
|
|
|
void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm);
|
|
void CTX_wm_window_set(bContext *C, struct wmWindow *win);
|
|
void CTX_wm_screen_set(bContext *C, struct bScreen *screen); /* to be removed */
|
|
void CTX_wm_area_set(bContext *C, struct ScrArea *sa);
|
|
void CTX_wm_region_set(bContext *C, struct ARegion *region);
|
|
void CTX_wm_menu_set(bContext *C, struct ARegion *menu);
|
|
const char *CTX_wm_operator_poll_msg_get(struct bContext *C);
|
|
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg);
|
|
|
|
/* Data Context
|
|
*
|
|
* - listbases consist of CollectionPointerLink items and must be
|
|
* freed with BLI_freelistN!
|
|
* - the dir listbase consists of LinkData items */
|
|
|
|
/* data type, needed so we can tell between a NULL pointer and an empty list */
|
|
enum {
|
|
CTX_DATA_TYPE_POINTER = 0,
|
|
CTX_DATA_TYPE_COLLECTION
|
|
};
|
|
|
|
PointerRNA CTX_data_pointer_get(const bContext *C, const char *member);
|
|
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type);
|
|
ListBase CTX_data_collection_get(const bContext *C, const char *member);
|
|
ListBase CTX_data_dir_get_ex(const bContext *C, const bool use_store, const bool use_rna, const bool use_all);
|
|
ListBase CTX_data_dir_get(const bContext *C);
|
|
int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListBase *r_lb, short *r_type);
|
|
|
|
void CTX_data_id_pointer_set(bContextDataResult *result, struct ID *id);
|
|
void CTX_data_pointer_set(bContextDataResult *result, struct ID *id, StructRNA *type, void *data);
|
|
|
|
void CTX_data_id_list_add(bContextDataResult *result, struct ID *id);
|
|
void CTX_data_list_add(bContextDataResult *result, struct ID *id, StructRNA *type, void *data);
|
|
|
|
void CTX_data_dir_set(bContextDataResult *result, const char **member);
|
|
|
|
void CTX_data_type_set(struct bContextDataResult *result, short type);
|
|
short CTX_data_type_get(struct bContextDataResult *result);
|
|
|
|
bool CTX_data_equals(const char *member, const char *str);
|
|
bool CTX_data_dir(const char *member);
|
|
|
|
#if 0
|
|
void CTX_data_pointer_set(bContextDataResult *result, void *data);
|
|
void CTX_data_list_add(bContextDataResult *result, void *data);
|
|
#endif
|
|
|
|
#define CTX_DATA_BEGIN(C, Type, instance, member) \
|
|
{ \
|
|
ListBase ctx_data_list; \
|
|
CollectionPointerLink *ctx_link; \
|
|
CTX_data_##member(C, &ctx_data_list); \
|
|
for (ctx_link = ctx_data_list.first; \
|
|
ctx_link; \
|
|
ctx_link = ctx_link->next) \
|
|
{ \
|
|
Type instance = ctx_link->ptr.data;
|
|
|
|
#define CTX_DATA_END \
|
|
} \
|
|
BLI_freelistN(&ctx_data_list); \
|
|
} (void)0
|
|
|
|
int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBase *));
|
|
|
|
#define CTX_DATA_COUNT(C, member) \
|
|
ctx_data_list_count(C, CTX_data_##member)
|
|
|
|
/* Data Context Members */
|
|
|
|
struct Main *CTX_data_main(const bContext *C);
|
|
struct Scene *CTX_data_scene(const bContext *C);
|
|
struct ToolSettings *CTX_data_tool_settings(const bContext *C);
|
|
|
|
const char *CTX_data_mode_string(const bContext *C);
|
|
int CTX_data_mode_enum(const bContext *C);
|
|
|
|
void CTX_data_main_set(bContext *C, struct Main *bmain);
|
|
void CTX_data_scene_set(bContext *C, struct Scene *bmain);
|
|
|
|
int CTX_data_selected_editable_objects(const bContext *C, ListBase *list);
|
|
int CTX_data_selected_editable_bases(const bContext *C, ListBase *list);
|
|
|
|
int CTX_data_selected_objects(const bContext *C, ListBase *list);
|
|
int CTX_data_selected_bases(const bContext *C, ListBase *list);
|
|
|
|
int CTX_data_visible_objects(const bContext *C, ListBase *list);
|
|
int CTX_data_visible_bases(const bContext *C, ListBase *list);
|
|
|
|
int CTX_data_selectable_objects(const bContext *C, ListBase *list);
|
|
int CTX_data_selectable_bases(const bContext *C, ListBase *list);
|
|
|
|
struct Object *CTX_data_active_object(const bContext *C);
|
|
struct Base *CTX_data_active_base(const bContext *C);
|
|
struct Object *CTX_data_edit_object(const bContext *C);
|
|
|
|
struct Image *CTX_data_edit_image(const bContext *C);
|
|
|
|
struct Text *CTX_data_edit_text(const bContext *C);
|
|
struct MovieClip *CTX_data_edit_movieclip(const bContext *C);
|
|
struct Mask *CTX_data_edit_mask(const bContext *C);
|
|
|
|
int CTX_data_selected_nodes(const bContext *C, ListBase *list);
|
|
|
|
struct EditBone *CTX_data_active_bone(const bContext *C);
|
|
int CTX_data_selected_bones(const bContext *C, ListBase *list);
|
|
int CTX_data_selected_editable_bones(const bContext *C, ListBase *list);
|
|
int CTX_data_visible_bones(const bContext *C, ListBase *list);
|
|
int CTX_data_editable_bones(const bContext *C, ListBase *list);
|
|
|
|
struct bPoseChannel *CTX_data_active_pose_bone(const bContext *C);
|
|
int CTX_data_selected_pose_bones(const bContext *C, ListBase *list);
|
|
int CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
|
|
|
|
struct bGPdata *CTX_data_gpencil_data(const bContext *C);
|
|
struct bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C);
|
|
struct bGPDframe *CTX_data_active_gpencil_frame(const bContext *C);
|
|
int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list);
|
|
int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
|
|
int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|