Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh.c
| Show First 20 Lines • Show All 989 Lines • ▼ Show 20 Lines | int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) | ||||
| if (nr == 3) { | if (nr == 3) { | ||||
| if (mface->v3 == 0) { | if (mface->v3 == 0) { | ||||
| static int corner_indices[4] = {1, 2, 0, 3}; | static int corner_indices[4] = {1, 2, 0, 3}; | ||||
| SWAP(unsigned int, mface->v1, mface->v2); | SWAP(unsigned int, mface->v1, mface->v2); | ||||
| SWAP(unsigned int, mface->v2, mface->v3); | SWAP(unsigned int, mface->v2, mface->v3); | ||||
| if (fdata) | if (fdata) | ||||
| CustomData_swap(fdata, mfindex, corner_indices); | CustomData_swap_corners(fdata, mfindex, corner_indices); | ||||
| } | } | ||||
| } | } | ||||
| else if (nr == 4) { | else if (nr == 4) { | ||||
| if (mface->v3 == 0 || mface->v4 == 0) { | if (mface->v3 == 0 || mface->v4 == 0) { | ||||
| static int corner_indices[4] = {2, 3, 0, 1}; | static int corner_indices[4] = {2, 3, 0, 1}; | ||||
| SWAP(unsigned int, mface->v1, mface->v3); | SWAP(unsigned int, mface->v1, mface->v3); | ||||
| SWAP(unsigned int, mface->v2, mface->v4); | SWAP(unsigned int, mface->v2, mface->v4); | ||||
| if (fdata) | if (fdata) | ||||
| CustomData_swap(fdata, mfindex, corner_indices); | CustomData_swap_corners(fdata, mfindex, corner_indices); | ||||
| } | } | ||||
| } | } | ||||
| return nr; | return nr; | ||||
| } | } | ||||
| Mesh *BKE_mesh_from_object(Object *ob) | Mesh *BKE_mesh_from_object(Object *ob) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 937 Lines • ▼ Show 20 Lines | if (lnors) { | ||||
| copy_m3_m4(m3, mat); | copy_m3_m4(m3, mat); | ||||
| normalize_m3(m3); | normalize_m3(m3); | ||||
| for (i = 0; i < me->totloop; i++, lnors++) { | for (i = 0; i < me->totloop; i++, lnors++) { | ||||
| mul_m3_v3(m3, *lnors); | mul_m3_v3(m3, *lnors); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) | void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) | ||||
| { | { | ||||
| int i = me->totvert; | int i = me->totvert; | ||||
| MVert *mvert; | MVert *mvert; | ||||
campbellbarton: This is going to happen when you do: `ob.data = mesh`, and assigning this twice will flip the… | |||||
Not Done Inline ActionsRemoved that from patch, indeed not convinced we should do that implicitly. Not sure I understand the comment about ob.data = mesh though, afaik it does not call BKE_mesh_transform at all? mont29: Removed that from patch, indeed not convinced we should do that implicitly.
Not sure I… | |||||
Not Done Inline ActionsThough I think we discussed this? BKE_mesh_assign_object is called when assigning object's data. campbellbarton: Though I think we discussed this? `BKE_mesh_assign_object` is called when assigning object's… | |||||
| for (mvert = me->mvert; i--; mvert++) { | for (mvert = me->mvert; i--; mvert++) { | ||||
| add_v3_v3(mvert->co, offset); | add_v3_v3(mvert->co, offset); | ||||
| } | } | ||||
| if (do_keys && me->key) { | if (do_keys && me->key) { | ||||
| KeyBlock *kb; | KeyBlock *kb; | ||||
| for (kb = me->key->block.first; kb; kb = kb->next) { | for (kb = me->key->block.first; kb; kb = kb->next) { | ||||
| float *fp = kb->data; | float *fp = kb->data; | ||||
| ▲ Show 20 Lines • Show All 590 Lines • Show Last 20 Lines | |||||
This is going to happen when you do: ob.data = mesh, and assigning this twice will flip the normals.
In fact think transforming the normals above is incorrect too.