macro to check if an object type supports vgroups
This commit is contained in:
@@ -703,7 +703,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
|
|||||||
ct->type = CONSTRAINT_OBTYPE_BONE; \
|
ct->type = CONSTRAINT_OBTYPE_BONE; \
|
||||||
ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \
|
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->type = CONSTRAINT_OBTYPE_VERT; \
|
||||||
ct->rotOrder = EULER_ORDER_DEFAULT; \
|
ct->rotOrder = EULER_ORDER_DEFAULT; \
|
||||||
} \
|
} \
|
||||||
|
@@ -1381,7 +1381,7 @@ float *do_ob_key(Scene *scene, Object *ob)
|
|||||||
ob->shapenr= 1;
|
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);
|
float *weights= get_weights_array(ob, kb->vgroup);
|
||||||
|
|
||||||
cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
|
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 *ED_vgroup_add_name(Object *ob, const char *name)
|
||||||
{
|
{
|
||||||
bDeformGroup *defgroup;
|
bDeformGroup *defgroup;
|
||||||
|
if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
|
||||||
if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
|
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;
|
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||||
ID *data= (ob)? ob->data: NULL;
|
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)
|
static int vertex_group_poll_edit(bContext *C)
|
||||||
|
@@ -321,6 +321,7 @@ typedef struct DupliObject {
|
|||||||
|
|
||||||
/* check if the object type supports materials */
|
/* check if the object type supports materials */
|
||||||
#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL)
|
#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 */
|
/* partype: first 4 bits: type */
|
||||||
#define PARTYPE 15
|
#define PARTYPE 15
|
||||||
|
Reference in New Issue
Block a user