[Bf-blender-cvs] [66df7d9b746] greasepencil-object: Fix: Remove most of the code for treating GP as a special case in the vertex group poll functions

Joshua Leung noreply at git.blender.org
Sat Nov 4 05:47:40 CET 2017


Commit: 66df7d9b746d819727528dab7ec2f3bf6db8eb9e
Author: Joshua Leung
Date:   Sun Oct 29 19:29:48 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB66df7d9b746d819727528dab7ec2f3bf6db8eb9e

Fix: Remove most of the code for treating GP as a special case in the vertex group poll functions

These were causing crashes on GP datablocks with ob->data not set
when clicking on the Vertex Groups panel (i.e. as the operator lookups
would cause problems)

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

M	source/blender/editors/object/object_vgroup.c

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

diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 489b88d4388..9d01ad6886c 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2464,32 +2464,18 @@ static int vertex_group_poll(bContext *C)
 	Object *ob = ED_object_context(C);
 	ID *data = (ob) ? ob->data : NULL;
 
-	if ((ob) && (ob->type == OB_GPENCIL)) {
-		return (ob && !ID_IS_LINKED_DATABLOCK(ob) &&
-			!ID_IS_LINKED_DATABLOCK(ob->data) &&
-			OB_TYPE_SUPPORT_VGROUP(ob->type) &&
-			ob->defbase.first);
-	}
-	else {
-		return (ob && !ID_IS_LINKED_DATABLOCK(ob) &&
-			data && !ID_IS_LINKED_DATABLOCK(data) &&
-			OB_TYPE_SUPPORT_VGROUP(ob->type) &&
-			ob->defbase.first);
-	}
+	return (ob && !ID_IS_LINKED_DATABLOCK(ob) &&
+	        data && !ID_IS_LINKED_DATABLOCK(data) &&
+	        OB_TYPE_SUPPORT_VGROUP(ob->type) &&
+	        ob->defbase.first);
 }
 
 static int vertex_group_supported_poll(bContext *C)
 {
 	Object *ob = ED_object_context(C);
 	ID *data = (ob) ? ob->data : NULL;
-	if ((ob) && (ob->type == OB_GPENCIL)) {
-		return (ob && !ID_IS_LINKED_DATABLOCK(ob) && OB_TYPE_SUPPORT_VGROUP(ob->type) &&
-			!ID_IS_LINKED_DATABLOCK(ob->data));
-	}
-	else {
-		return (ob && !ID_IS_LINKED_DATABLOCK(ob) && OB_TYPE_SUPPORT_VGROUP(ob->type) &&
-			data && !ID_IS_LINKED_DATABLOCK(data));
-	}
+	return (ob && !ID_IS_LINKED_DATABLOCK(ob) && OB_TYPE_SUPPORT_VGROUP(ob->type) &&
+	        data && !ID_IS_LINKED_DATABLOCK(data));
 }
 
 static int vertex_group_mesh_poll(bContext *C)



More information about the Bf-blender-cvs mailing list