diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-01 10:45:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-01 10:45:36 +0400 |
commit | bcdcbb65c159cc16b222fc5381e806a6b4f03fb0 (patch) | |
tree | 55d0e97ef22204d56815906773715c719f7ef5c6 /source | |
parent | e3f03d72b6e0a24a2c87e94c68c5f6452ad91e94 (diff) |
macro to check if an object type supports vgroups
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 1 |
4 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c244c26ad7f..aebf3198cf4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -703,7 +703,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC ct->type = CONSTRAINT_OBTYPE_BONE; \ ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \ }\ - else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) { \ + else if (OB_TYPE_SUPPORT_VGROUP(ct->tar->type) && (ct->subtarget[0])) { \ ct->type = CONSTRAINT_OBTYPE_VERT; \ ct->rotOrder = EULER_ORDER_DEFAULT; \ } \ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 0a467142f74..6d095117136 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1381,7 +1381,7 @@ float *do_ob_key(Scene *scene, Object *ob) ob->shapenr= 1; } - if(ELEM(ob->type, OB_MESH, OB_LATTICE)) { + if (OB_TYPE_SUPPORT_VGROUP(ob->type)) { float *weights= get_weights_array(ob, kb->vgroup); cp_key(0, tot, tot, out, key, actkb, kb, weights, 0); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index d4ee68f8b72..ce6730ab1ed 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -99,8 +99,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob) bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name) { bDeformGroup *defgroup; - - if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE)) + if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type)) return NULL; defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup"); @@ -2013,7 +2012,7 @@ static int vertex_group_poll(bContext *C) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; ID *data= (ob)? ob->data: NULL; - return (ob && !ob->id.lib && ELEM(ob->type, OB_MESH, OB_LATTICE) && data && !data->lib); + return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib); } static int vertex_group_poll_edit(bContext *C) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 19eff756ce1..38daf8bae28 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -321,6 +321,7 @@ typedef struct DupliObject { /* check if the object type supports materials */ #define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL) +#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE)) /* partype: first 4 bits: type */ #define PARTYPE 15 |