diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-24 01:26:59 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-24 01:26:59 +0400 |
commit | ab24f8aa9d0a66aa02623caa2642ea894d0a9f61 (patch) | |
tree | f7f2a6a5b31a77869304d7a9a96974e4efbe0ea6 /source/blender/editors/gpencil | |
parent | d54b2f7d91a84750bfb9f52fce49354ccff4d02e (diff) |
Related to [#36548] "Grease Pencil" Problems
Use scene's GPencil when active object is deselected. Else it can be tricky and not user-friendly to access to the scene's GPencil once some objects have GPencil data (you have to select/active a non-gpencil object, or switch to a layout without active object...).
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 5ed34f0d0f0..c5dc8654e9d 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -106,8 +106,8 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) /* TODO: we can include other data-types such as bones later if need be... */ - /* just in case no active object */ - if (ob) { + /* just in case no active/selected object */ + if (ob && (ob->flag & SELECT)) { /* for now, as long as there's an object, default to using that in 3D-View */ if (ptr) RNA_id_pointer_create(&ob->id, ptr); return &ob->gpd; @@ -193,14 +193,12 @@ bGPdata *gpencil_data_get_active(const bContext *C) bGPdata *gpencil_data_get_active_v3d(Scene *scene) { Base *base = scene->basact; - bGPdata *gpd = base ? base->object->gpd : NULL; - if (base && gpd) { - /* We have to make sure active object is actually visible, else we must use default scene gpd, - * to be consistent with gpencil_data_get_active's behavior. - */ - if ((scene->lay & base->lay) == 0) { - gpd = NULL; - } + bGPdata *gpd = NULL; + /* We have to make sure active object is actually visible and selected, else we must use default scene gpd, + * to be consistent with gpencil_data_get_active's behavior. + */ + if (base && (scene->lay & base->lay) && (base->object->flag & SELECT)) { + gpd = base->object->gpd; } return gpd ? gpd : scene->gpd; } |