diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-20 02:46:32 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-20 02:46:32 +0400 |
commit | 65edeb6755bd396f6ee47a605c5de2f460000154 (patch) | |
tree | 850f8f5b66acdbddf9b2ab3f15f25c87989108f8 /source/blender | |
parent | 4095fac8493ec9697babe85cdb3af4b036a8e48c (diff) |
Fix GPencil part of [#36101] BSurface Throw an Error When Press "Add Surface"
gpencil_data_get_active and gpencil_data_get_active_v3d did not have consistent behavior when we had an active object, but not on any visible layer (the first would return the default scene gpd in this case, while the first was still returning active object's one). Now they both return scene's one.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 99157b074fd..5ed34f0d0f0 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -192,7 +192,16 @@ bGPdata *gpencil_data_get_active(const bContext *C) /* needed for offscreen rendering */ bGPdata *gpencil_data_get_active_v3d(Scene *scene) { - bGPdata *gpd = scene->basact ? scene->basact->object->gpd : NULL; + 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; + } + } return gpd ? gpd : scene->gpd; } |