Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_generics.c
| Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | for (; md; md = md->next) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* assumes obedit set to mesh object */ | /* assumes obedit set to mesh object */ | ||||
| static void editbmesh_apply_to_mirror(TransInfo *t) | static void transform_apply_to_mirror(TransInfo *t) | ||||
| { | { | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| if (tc->mirror.axis_flag) { | if (tc->mirror.axis_flag) { | ||||
| TransData *td = tc->data; | |||||
| BMVert *eve; | |||||
| int i; | int i; | ||||
| TransData *td; | |||||
| for (i = 0; i < tc->data_len; i++, td++) { | for (i = 0, td = tc->data; i < tc->data_len; i++, td++) { | ||||
| if (td->flag & TD_NOACTION) { | if (td->flag & (TD_MIRROR_EDGE_X | TD_MIRROR_EDGE_Y | TD_MIRROR_EDGE_Z)) { | ||||
| break; | if (td->flag & TD_MIRROR_EDGE_X) { | ||||
| td->loc[0] = 0.0f; | |||||
| } | } | ||||
| if (td->loc == NULL) { | if (td->flag & TD_MIRROR_EDGE_Y) { | ||||
| break; | td->loc[1] = 0.0f; | ||||
| } | } | ||||
| if (td->flag & TD_SKIP) { | if (td->flag & TD_MIRROR_EDGE_Z) { | ||||
| continue; | td->loc[2] = 0.0f; | ||||
| } | } | ||||
| eve = td->extra; | |||||
| if (eve) { | |||||
| eve->co[0] = -td->loc[0]; | |||||
| eve->co[1] = td->loc[1]; | |||||
| eve->co[2] = td->loc[2]; | |||||
| } | } | ||||
| if (td->flag & TD_MIRROR_EDGE) { | |||||
| td->loc[0] = 0; | |||||
| } | } | ||||
| TransDataMirror *tdm; | |||||
| for (i = 0, tdm = tc->mirror.data; i < tc->mirror.data_len; i++, tdm++) { | |||||
| tdm->loc[0] = tdm->loc_ref[0] * tdm->sign[0]; | |||||
| tdm->loc[1] = tdm->loc_ref[1] * tdm->sign[1]; | |||||
| tdm->loc[2] = tdm->loc_ref[2] * tdm->sign[2]; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* for the realtime animation recording feature, handle overlapping data */ | /* for the realtime animation recording feature, handle overlapping data */ | ||||
| static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) | static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | if (t->obedit_type != -1) { | ||||
| else if (t->obedit_type == OB_MESH) { | else if (t->obedit_type == OB_MESH) { | ||||
| /* mirror modifier clipping? */ | /* mirror modifier clipping? */ | ||||
| if (t->state != TRANS_CANCEL) { | if (t->state != TRANS_CANCEL) { | ||||
| /* apply clipping after so we never project past the clip plane [#25423] */ | /* apply clipping after so we never project past the clip plane [#25423] */ | ||||
| applyProject(t); | applyProject(t); | ||||
| clipMirrorModifier(t); | clipMirrorModifier(t); | ||||
| } | } | ||||
| if ((t->flag & T_NO_MIRROR) == 0 && (t->options & CTX_NO_MIRROR) == 0) { | if ((t->flag & T_NO_MIRROR) == 0 && (t->options & CTX_NO_MIRROR) == 0) { | ||||
| editbmesh_apply_to_mirror(t); | transform_apply_to_mirror(t); | ||||
| } | } | ||||
| if (t->mode == TFM_EDGE_SLIDE) { | if (t->mode == TFM_EDGE_SLIDE) { | ||||
| projectEdgeSlideData(t, false); | projectEdgeSlideData(t, false); | ||||
| } | } | ||||
| else if (t->mode == TFM_VERT_SLIDE) { | else if (t->mode == TFM_VERT_SLIDE) { | ||||
| projectVertSlideData(t, false); | projectVertSlideData(t, false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 447 Lines • ▼ Show 20 Lines | if (objects == NULL) { | ||||
| free_objects = true; | free_objects = true; | ||||
| } | } | ||||
| t->data_container = MEM_callocN(sizeof(*t->data_container) * objects_len, __func__); | t->data_container = MEM_callocN(sizeof(*t->data_container) * objects_len, __func__); | ||||
| t->data_container_len = objects_len; | t->data_container_len = objects_len; | ||||
| for (int i = 0; i < objects_len; i++) { | for (int i = 0; i < objects_len; i++) { | ||||
| TransDataContainer *tc = &t->data_container[i]; | TransDataContainer *tc = &t->data_container[i]; | ||||
| /* TODO, multiple axes. */ | if (((t->flag & T_NO_MIRROR) == 0) && ((t->options & CTX_NO_MIRROR) == 0) && | ||||
| tc->mirror.axis_flag = (((t->flag & T_NO_MIRROR) == 0) && | (objects[i]->type == OB_MESH)) { | ||||
| ((t->options & CTX_NO_MIRROR) == 0) && | tc->mirror.axis_x = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_X) != 0; | ||||
| (objects[i]->type == OB_MESH) && | tc->mirror.axis_y = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_Y) != 0; | ||||
| (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_X) != 0); | tc->mirror.axis_z = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_Z) != 0; | ||||
| } | |||||
| if (object_mode & OB_MODE_EDIT) { | if (object_mode & OB_MODE_EDIT) { | ||||
| tc->obedit = objects[i]; | tc->obedit = objects[i]; | ||||
| /* Check needed for UV's */ | /* Check needed for UV's */ | ||||
| if ((t->flag & T_2D_EDIT) == 0) { | if ((t->flag & T_2D_EDIT) == 0) { | ||||
| tc->use_local_mat = true; | tc->use_local_mat = true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 520 Lines • ▼ Show 20 Lines | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| MEM_freeN(td->hdata); | MEM_freeN(td->hdata); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(tc->data); | MEM_freeN(tc->data); | ||||
| MEM_SAFE_FREE(tc->data_ext); | MEM_SAFE_FREE(tc->data_ext); | ||||
| MEM_SAFE_FREE(tc->data_2d); | MEM_SAFE_FREE(tc->data_2d); | ||||
| MEM_SAFE_FREE(tc->mirror.data); | |||||
| } | } | ||||
| } | } | ||||
| MEM_SAFE_FREE(t->data_container); | MEM_SAFE_FREE(t->data_container); | ||||
| t->data_container = NULL; | t->data_container = NULL; | ||||
| BLI_freelistN(&t->tsnap.points); | BLI_freelistN(&t->tsnap.points); | ||||
| ▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | void calculatePropRatio(TransInfo *t) | ||||
| if (t->flag & T_PROP_EDIT) { | if (t->flag & T_PROP_EDIT) { | ||||
| const char *pet_id = NULL; | const char *pet_id = NULL; | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| for (i = 0; i < tc->data_len; i++, td++) { | for (i = 0; i < tc->data_len; i++, td++) { | ||||
| if (td->flag & TD_SELECTED) { | if (td->flag & TD_SELECTED) { | ||||
| td->factor = 1.0f; | td->factor = 1.0f; | ||||
| } | } | ||||
| else if (tc->mirror.axis_flag && (td->loc[0] * tc->mirror.sign) < -0.00001f) { | |||||
| td->flag |= TD_SKIP; | |||||
| td->factor = 0.0f; | |||||
| restoreElement(td); | |||||
| } | |||||
| else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) || | else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) || | ||||
| (connected == 0 && td->rdist > t->prop_size)) { | (connected == 0 && td->rdist > t->prop_size)) { | ||||
| /* | /* | ||||
| * The elements are sorted according to their dist member in the array, | * The elements are sorted according to their dist member in the array, | ||||
| * that means we can stop when it finds one element outside of the propsize. | * that means we can stop when it finds one element outside of the propsize. | ||||
| * do not set 'td->flag |= TD_NOACTION', the prop circle is being changed. | * do not set 'td->flag |= TD_NOACTION', the prop circle is being changed. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines | |||||