diff options
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 18 | ||||
-rw-r--r-- | source/blender/editors/include/ED_object.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 42 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 5 |
5 files changed, 33 insertions, 37 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index c9668295173..7b0f9fed358 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -79,6 +79,8 @@ void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target); void BKE_object_unlink(struct Object *ob); bool BKE_object_exists_check(struct Object *obtest); bool BKE_object_is_in_editmode(struct Object *ob); +bool BKE_object_is_in_editmode_vgroup(struct Object *ob); +bool BKE_object_is_in_wpaint_select_vert(struct Object *ob); struct Object *BKE_object_add_only_object(struct Main *bmain, int type, const char *name); struct Object *BKE_object_add(struct Main *bmain, struct Scene *scene, int type); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index bb160cff86a..f1183868e8b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -764,6 +764,24 @@ bool BKE_object_is_in_editmode(Object *ob) return false; } +bool BKE_object_is_in_editmode_vgroup(Object *ob) +{ + return (OB_TYPE_SUPPORT_VGROUP(ob->type) && + BKE_object_is_in_editmode(ob)); +} + +bool BKE_object_is_in_wpaint_select_vert(Object *ob) +{ + if (ob->type == OB_MESH) { + Mesh *me = ob->data; + return ( (ob->mode & OB_MODE_WEIGHT_PAINT) && + (me->edit_btmesh == NULL) && + (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX) ); + } + + return false; +} + bool BKE_object_exists_check(Object *obtest) { Object *ob; diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index eb99b5976d4..90b131e5acc 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -214,9 +214,6 @@ struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( int *free, const unsigned int selection_mask); -bool ED_vgroup_object_in_edit_mode(struct Object *ob); -bool ED_vgroup_object_in_wpaint_vert_select(struct Object *ob); - #ifdef __cplusplus } #endif diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index f5c9ad67fa7..89989d73049 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2775,35 +2775,13 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg) } } -bool ED_vgroup_object_in_edit_mode(Object *ob) -{ - if (ob->type == OB_MESH) - return (BKE_editmesh_from_object(ob) != NULL); - else if (ob->type == OB_LATTICE) - return (((Lattice *)ob->data)->editlatt != NULL); - - return false; -} - -bool ED_vgroup_object_in_wpaint_vert_select(Object *ob) -{ - if (ob->type == OB_MESH) { - Mesh *me = ob->data; - return ( (ob->mode & OB_MODE_WEIGHT_PAINT) && - (me->edit_btmesh == NULL) && - (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX) ); - } - - return false; -} - static void vgroup_delete(Object *ob) { bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1); if (!dg) return; - if (ED_vgroup_object_in_edit_mode(ob)) + if (BKE_object_is_in_editmode_vgroup(ob)) vgroup_delete_edit_mode(ob, dg); else vgroup_delete_object_mode(ob, dg); @@ -2956,7 +2934,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) if (!(ob && !ob->id.lib && data && !data->lib)) return 0; - return ED_vgroup_object_in_edit_mode(ob); + return BKE_object_is_in_editmode_vgroup(ob); } /* editmode _or_ weight paint vertex sel */ @@ -2968,8 +2946,8 @@ static int vertex_group_vert_select_poll(bContext *C) if (!(ob && !ob->id.lib && data && !data->lib)) return 0; - return (ED_vgroup_object_in_edit_mode(ob) || - ED_vgroup_object_in_wpaint_vert_select(ob)); + return (BKE_object_is_in_editmode_vgroup(ob) || + BKE_object_is_in_wpaint_select_vert(ob)); } /* editmode _or_ weight paint vertex sel and active group unlocked */ @@ -2981,8 +2959,8 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) if (!(ob && !ob->id.lib && data && !data->lib)) return 0; - if (!(ED_vgroup_object_in_edit_mode(ob) || - ED_vgroup_object_in_wpaint_vert_select(ob))) + if (!(BKE_object_is_in_editmode_vgroup(ob) || + BKE_object_is_in_wpaint_select_vert(ob))) { return 0; } @@ -3008,8 +2986,8 @@ static int vertex_group_vert_select_mesh_poll(bContext *C) if (ob->type != OB_MESH) return 0; - return (ED_vgroup_object_in_edit_mode(ob) || - ED_vgroup_object_in_wpaint_vert_select(ob)); + return (BKE_object_is_in_editmode_vgroup(ob) || + BKE_object_is_in_wpaint_select_vert(ob)); } static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) @@ -3076,7 +3054,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) RNA_def_boolean(ot->srna, "all", 0, "All", "Remove all vertex groups"); } -static int vertex_group_assign_exec(bContext *C, wmOperator *op) +static int vertex_group_assign_exec(bContext *C, wmOperator *UNUSED(op)) { ToolSettings *ts = CTX_data_tool_settings(C); Object *ob = ED_object_context(C); @@ -3513,7 +3491,7 @@ static int vertex_group_blend_poll(bContext *C) if (!(ob && !ob->id.lib && data && !data->lib)) return false; - if (ED_vgroup_object_in_edit_mode(ob)) { + if (BKE_object_is_in_editmode_vgroup(ob)) { return true; } else if ((ob->type == OB_MESH) && (ob->mode & OB_MODE_WEIGHT_PAINT)) { diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 474a30b6635..098c1daa031 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -798,8 +798,9 @@ static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { Scene *scene = CTX_data_scene(C); Object *ob = OBACT; - if (ob && (ED_vgroup_object_in_edit_mode(ob) || - ED_vgroup_object_in_wpaint_vert_select(ob))) { + if (ob && (BKE_object_is_in_editmode_vgroup(ob) || + BKE_object_is_in_wpaint_select_vert(ob))) + { MDeformVert *dvert_act = ED_mesh_active_dvert_get_only(ob); if (dvert_act) { return (dvert_act->totweight != 0); |