forked from bartvdbraak/blender
macro to check if an object type supports vgroups
This commit is contained in:
parent
e3f03d72b6
commit
bcdcbb65c1
@ -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; \
|
||||
} \
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user