[Bf-blender-cvs] [1010b75aafa] greasepencil-object: More changes in object mode switch
Antonio Vazquez
noreply at git.blender.org
Sun Mar 4 13:52:11 CET 2018
Commit: 1010b75aafa428572b0abb0f04f7866a5d6250d7
Author: Antonio Vazquez
Date: Sun Mar 4 13:52:03 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB1010b75aafa428572b0abb0f04f7866a5d6250d7
More changes in object mode switch
The outliner does not need special code.
Mode change still need more work, because in some situations, still the old mode remains activated.
===================================================================
M source/blender/editors/object/object_edit.c
M source/blender/editors/space_outliner/outliner_select.c
===================================================================
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index c18723fa03a..967bb83721c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1502,14 +1502,14 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
{
WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- bGPdata *gpd = CTX_data_gpencil_data(C);
eObjectMode mode = RNA_enum_get(op->ptr, "mode");
eObjectMode restore_mode = workspace->object_mode;
const bool toggle = RNA_boolean_get(op->ptr, "toggle");
/* if type is OB_GPENCIL, select mode for grease pencil strokes */
if ((ob) && (ob->type == OB_GPENCIL)) {
- if ((ob->data) && (ob->data == gpd)) {
+ if (ob->data) {
+ bGPdata *gpd = (bGPdata *)ob->data;
/* restore status */
if ((workspace->object_mode == OB_MODE_OBJECT) &&
((workspace->object_mode != mode) || (mode == OB_MODE_OBJECT)))
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index ce51d1936b2..b4804b4753b 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -197,34 +197,6 @@ static eOLDrawState tree_element_set_active_object(
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
-
- /* set special grease pencil modes */
- if (ob->type == OB_GPENCIL) {
- WorkSpace *workspace = CTX_wm_workspace(C);
- wmWindow *win = CTX_wm_window(C);
-
- /* set cursor */
- if (workspace->object_mode == OB_MODE_GPENCIL_PAINT) {
- WM_cursor_modal_set(win, BC_PAINTBRUSHCURSOR);
- ED_gpencil_toggle_brush_cursor(C, false, NULL);
- }
- else if (workspace->object_mode == OB_MODE_GPENCIL_SCULPT) {
- WM_cursor_modal_set(win, BC_CROSSCURSOR);
- ED_gpencil_toggle_brush_cursor(C, true, NULL);
- }
- else if (workspace->object_mode == OB_MODE_GPENCIL_WEIGHT) {
- WM_cursor_modal_set(win, BC_CROSSCURSOR);
- ED_gpencil_toggle_brush_cursor(C, true, NULL);
- }
- else {
- WM_cursor_modal_set(win, CURSOR_STD);
- ED_gpencil_toggle_brush_cursor(C, false, NULL);
- }
- /* set workspace mode */
- workspace->object_mode_restore = workspace->object_mode;
- workspace->object_mode = OB_MODE_GPENCIL_PAINT;
- ED_object_base_activate(C, view_layer->basact); // XXX
- }
if (CTX_data_edit_object(C)) {
ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
More information about the Bf-blender-cvs
mailing list