fix odd (intentional) behavior with vertex parent,

curve children of a triangle vertex parent would only display their relationship line to the first vertex. (confusing)

also added OB_TYPE_SUPPORT_PARVERT macro.
This commit is contained in:
Campbell Barton 2013-09-01 22:38:41 +00:00
parent 4c7ded98bc
commit 7ad59c4e2c
4 changed files with 13 additions and 17 deletions

@ -2013,29 +2013,23 @@ static void give_parvert(Object *par, int nr, float vec[3])
static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
{
float cmat[3][3], v1[3], v2[3], v3[3], q[4];
/* in local ob space */
unit_m4(mat);
if (ELEM4(par->type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE)) {
if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
float cmat[3][3], v1[3], v2[3], v3[3], q[4];
give_parvert(par, ob->par1, v1);
give_parvert(par, ob->par2, v2);
give_parvert(par, ob->par3, v3);
tri_to_quat(q, v1, v2, v3);
quat_to_mat3(cmat, q);
copy_m4_m3(mat, cmat);
if (ob->type == OB_CURVE) {
copy_v3_v3(mat[3], v1);
}
else {
add_v3_v3v3(mat[3], v1, v2);
add_v3_v3(mat[3], v3);
mul_v3_fl(mat[3], 1.0f / 3.0f);
}
mid_v3_v3v3v3(mat[3], v1, v2, v3);
}
else {
unit_m4(mat);
}
}

@ -904,7 +904,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
}
/* vertex parenting */
if (ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE)) {
if (OB_TYPE_SUPPORT_PARVERT(ob->type)) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI);
}

@ -353,6 +353,8 @@ enum {
(ELEM(_type, OB_MESH, OB_LATTICE))
#define OB_TYPE_SUPPORT_EDITMODE(_type) \
(ELEM7(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
#define OB_TYPE_SUPPORT_PARVERT(_type) \
(ELEM4(_type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE))
/* is this ID type used as object data */
#define OB_DATA_SUPPORT_ID(_id_type) \

@ -465,7 +465,7 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
}
if (ELEM4(par->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE)) {
if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
}