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:
		| @@ -2013,12 +2013,10 @@ static void give_parvert(Object *par, int nr, float vec[3]) | |||||||
|  |  | ||||||
| static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) | 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 */ | 	/* in local ob space */ | ||||||
| 	unit_m4(mat); | 	if (OB_TYPE_SUPPORT_PARVERT(par->type)) { | ||||||
| 	 | 		float cmat[3][3], v1[3], v2[3], v3[3], q[4]; | ||||||
| 	if (ELEM4(par->type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE)) { |  | ||||||
|  |  | ||||||
| 		give_parvert(par, ob->par1, v1); | 		give_parvert(par, ob->par1, v1); | ||||||
| 		give_parvert(par, ob->par2, v2); | 		give_parvert(par, ob->par2, v2); | ||||||
| @@ -2028,14 +2026,10 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) | |||||||
| 		quat_to_mat3(cmat, q); | 		quat_to_mat3(cmat, q); | ||||||
| 		copy_m4_m3(mat, cmat); | 		copy_m4_m3(mat, cmat); | ||||||
|  |  | ||||||
| 		if (ob->type == OB_CURVE) { | 		mid_v3_v3v3v3(mat[3], v1, v2, v3); | ||||||
| 			copy_v3_v3(mat[3], v1); |  | ||||||
| 	} | 	} | ||||||
| 	else { | 	else { | ||||||
| 			add_v3_v3v3(mat[3], v1, v2); | 		unit_m4(mat); | ||||||
| 			add_v3_v3(mat[3], v3); |  | ||||||
| 			mul_v3_fl(mat[3], 1.0f / 3.0f); |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -904,7 +904,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	/* vertex parenting */ | 	/* 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); | ||||||
| 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI); | 		uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -353,6 +353,8 @@ enum { | |||||||
| 	(ELEM(_type, OB_MESH, OB_LATTICE)) | 	(ELEM(_type, OB_MESH, OB_LATTICE)) | ||||||
| #define OB_TYPE_SUPPORT_EDITMODE(_type) \ | #define OB_TYPE_SUPPORT_EDITMODE(_type) \ | ||||||
| 	(ELEM7(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) | 	(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 */ | /* is this ID type used as object data */ | ||||||
| #define OB_DATA_SUPPORT_ID(_id_type) \ | #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); | 			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, PARVERT1); | ||||||
| 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3); | 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3); | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user