[Bf-blender-cvs] [ed9fb4201ad] greasepencil-object: Fix tab key for Edit Strokes after Workspaces merge
Antonio Vazquez
noreply at git.blender.org
Fri Jun 2 13:27:08 CEST 2017
Commit: ed9fb4201add427505f1b00f2755acf2551a32c3
Author: Antonio Vazquez
Date: Fri Jun 2 13:26:36 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBed9fb4201add427505f1b00f2755acf2551a32c3
Fix tab key for Edit Strokes after Workspaces merge
The tab key for enter in edit mode for GPencil objects was not working with new workspaces.
Still there is a problem with datablocks at Scene level (TBD)
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 2e615584009..a6a2d20b5a9 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -58,6 +58,7 @@
#include "BKE_library.h"
#include "BKE_report.h"
#include "BKE_screen.h"
+#include "BKE_workspace.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -94,11 +95,25 @@ static int gpencil_editmode_toggle_poll(bContext *C)
static int gpencil_editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
+ WorkSpace *workspace = CTX_wm_workspace(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
/* if using a gpencil object, use this datablock */
Object *ob = CTX_data_active_object(C);
if ((ob) && (ob->type == OB_GPENCIL)) {
gpd = ob->gpd;
+ if (gpd) {
+ if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
+ ob->mode = OB_MODE_OBJECT;
+ }
+ else {
+ ob->mode = OB_MODE_GPENCIL_EDIT;
+ }
+#ifdef USE_WORKSPACE_MODE
+ BKE_workspace_object_mode_set(workspace, ob->mode);
+#else
+ UNUSED_VARS(workspace);
+#endif
+ }
}
if (gpd == NULL)
More information about the Bf-blender-cvs
mailing list