Commit: 71b3495a086531342a8ba9f3ebc6feea28ce64eb
Author: Joshua Leung
Date:   Fri Feb 9 03:25:49 2018 +1300
Branches: greasepencil-object
https://developer.blender.org/rB71b3495a086531342a8ba9f3ebc6feea28ce64eb

Compile Fix: ob->mode lookups

===================================================================

M       source/blender/editors/gpencil/gpencil_data.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_data.c 
b/source/blender/editors/gpencil/gpencil_data.c
index 6e800513fbc..ef1e14f62de 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -55,6 +55,7 @@
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_workspace_types.h"
 
 #include "BKE_main.h"
 #include "BKE_animsys.h"
@@ -1895,14 +1896,19 @@ static int gpencil_vertex_group_poll(bContext *C)
        Object *ob = CTX_data_active_object(C);
 
        if ((ob) && (ob->type == OB_GPENCIL)) {
-               return (!ID_IS_LINKED(ob) &&
-                       !ID_IS_LINKED(ob->data) &&
-                       ob->defbase.first && 
-                       ((ob->mode == OB_MODE_GPENCIL_EDIT) || (ob->mode == 
OB_MODE_GPENCIL_SCULPT)));
-       }
-       else {
-               return false;
+               if (!ID_IS_LINKED(ob) && !ID_IS_LINKED(ob->data) && 
ob->defbase.first) {
+                       WorkSpace *workspace = CTX_wm_workspace(C);
+                       if (workspace && 
+                               ELEM(workspace->object_mode,
+                                    OB_MODE_GPENCIL_EDIT,
+                                    OB_MODE_GPENCIL_SCULPT))
+                       {
+                               return true;    
+                       }
+               }
        }
+
+       return false;
 }
 
 static int gpencil_vertex_group_weight_poll(bContext *C)
@@ -1910,13 +1916,17 @@ static int gpencil_vertex_group_weight_poll(bContext *C)
        Object *ob = CTX_data_active_object(C);
 
        if ((ob) && (ob->type == OB_GPENCIL)) {
-               return (!ID_IS_LINKED(ob) &&
-                       !ID_IS_LINKED(ob->data) &&
-                       (ob->defbase.first && (ob->mode == 
OB_MODE_GPENCIL_WEIGHT)));
-       }
-       else {
-               return false;
+               if (!ID_IS_LINKED(ob) && !ID_IS_LINKED(ob->data) && 
ob->defbase.first) {
+                       WorkSpace *workspace = CTX_wm_workspace(C);
+                       if (workspace && 
+                               (workspace->object_mode == 
OB_MODE_GPENCIL_WEIGHT))
+                       {
+                               return true;    
+                       }
+               }
        }
+
+       return false;
 }
 
 static int gpencil_vertex_group_assign_exec(bContext *C, wmOperator 
*UNUSED(op))

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to