Commit: adf05b018165e7b1ae0d1b1970cdd427e7372ca8
Author: Antonio Vazquez
Date: Thu Jun 8 13:39:02 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBadf05b018165e7b1ae0d1b1970cdd427e7372ca8
Implement object change while in GP modes
Now the user can select other objects for paint or sculpt.
In edit mode is not possible in order to keep UI coherence
===================================================================
M source/blender/editors/gpencil/gpencil_select.c
M source/blender/editors/space_view3d/view3d_select.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_select.c
b/source/blender/editors/gpencil/gpencil_select.c
index c359b41f884..0536fe340c1 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -43,6 +43,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_object_types.h"
@@ -1101,13 +1102,21 @@ void GPENCIL_OT_select_lasso(wmOperatorType *ot)
static int gpencil_select_exec(bContext *C, wmOperator *op)
{
+ ScrArea *sa = CTX_wm_area(C);
+ /* if not edit mode, can select other objects */
+ if ((sa) && (sa->spacetype == SPACE_VIEW3D)) {
+ Object *ob = CTX_data_active_object(C);
+ if ((ob) && (ob->mode != OB_MODE_GPENCIL_EDIT)) {
+ return OPERATOR_PASS_THROUGH;
+ }
+ }
+
bGPdata *gpd = ED_gpencil_data_get_active(C);
/* if not edit mode, the event is catched but not processed */
if ((!gpd) || (gpd->flag & GP_DATA_STROKE_EDITMODE) == 0) {
return OPERATOR_CANCELLED;
}
- ScrArea *sa = CTX_wm_area(C);
/* "radius" is simply a threshold (screen space) to make it easier to
test with a tolerance */
const float radius = 0.75f * U.widget_unit;
diff --git a/source/blender/editors/space_view3d/view3d_select.c
b/source/blender/editors/space_view3d/view3d_select.c
index 1686a08654d..a451f6909f9 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -73,6 +73,7 @@
#include "BKE_scene.h"
#include "BKE_tracking.h"
#include "BKE_utildefines.h"
+#include "BKE_workspace.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1592,6 +1593,26 @@ static bool ed_object_select_pick(
if ((oldbasact != basact) && (is_obedit == false)) {
ED_object_base_activate(C, basact); /* adds
notifier */
}
+
+ /* Set special modes for grease pencil
+ The grease pencil modes are not real modes, but a
hack to make the interface
+ consistent, so need some tricks to keep UI
synchronized */
+ if (((oldbasact) && oldbasact->object->type ==
OB_GPENCIL) || (basact->object->type == OB_GPENCIL)) {
+ /* set cursor */
+ if (basact->object->mode ==
OB_MODE_GPENCIL_PAINT) {
+ WM_cursor_modal_set(CTX_wm_window(C),
BC_PAINTBRUSHCURSOR);
+ }
+ else if (basact->object->mode ==
OB_MODE_GPENCIL_PAINT) {
+ WM_cursor_modal_set(CTX_wm_window(C),
BC_CROSSCURSOR);
+ }
+ else {
+ /* TODO: maybe is better use restore */
+ WM_cursor_modal_set(CTX_wm_window(C),
CURSOR_STD);
+ }
+ /* set workspace mode */
+
BKE_workspace_object_mode_set(CTX_wm_workspace(C), basact->object->mode);
+ }
+
}
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs