Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
| Context not available. | |||||
| #include "DNA_movieclip_types.h" | #include "DNA_movieclip_types.h" | ||||
| #include "DNA_scene_types.h" /* PET modes */ | #include "DNA_scene_types.h" /* PET modes */ | ||||
| #include "DNA_workspace_types.h" | #include "DNA_workspace_types.h" | ||||
| #include "DNA_gpencil_types.h" | |||||
| #include "BLI_alloca.h" | #include "BLI_alloca.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| Context not available. | |||||
| #include "ED_mesh.h" | #include "ED_mesh.h" | ||||
| #include "ED_clip.h" | #include "ED_clip.h" | ||||
| #include "ED_node.h" | #include "ED_node.h" | ||||
| #include "ED_gpencil.h" | |||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| Context not available. | |||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "DEG_depsgraph.h" | |||||
| /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */ | /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */ | ||||
| // #define USE_NUM_NO_ZERO | // #define USE_NUM_NO_ZERO | ||||
| Context not available. | |||||
| static void viewRedrawForce(const bContext *C, TransInfo *t) | static void viewRedrawForce(const bContext *C, TransInfo *t) | ||||
| { | { | ||||
| if (t->options & CTX_GPENCIL_STROKES) { | if (t->options & CTX_GPENCIL_STROKES) { | ||||
| bGPdata *gpd = ED_gpencil_data_get_active(C); | |||||
| if (gpd) { | |||||
| DEG_id_tag_update(&gpd->id, OB_RECALC_DATA); | |||||
| } | |||||
| WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| else if (t->spacetype == SPACE_VIEW3D) { | else if (t->spacetype == SPACE_VIEW3D) { | ||||
| Context not available. | |||||
| float cent[2]; | float cent[2]; | ||||
| float mval[3] = { x, y, 0.0f }; | float mval[3] = { x, y, 0.0f }; | ||||
| #if 0 /* XXX: Fix from 1c9690e7607bc990cc4a3e6ba839949bb83a78af cannot be used anymore */ | |||||
| if ((t->flag & T_POINTS) && (t->options & CTX_GPENCIL_STROKES)) { | |||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | |||||
| Object *ob = tc->obedit; | |||||
| float vecrot[3]; | |||||
| copy_v3_v3(vecrot, t->center); | |||||
| mul_m4_v3(ob->obmat, vecrot); | |||||
| projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO); | |||||
| } | |||||
| } | |||||
| else { | |||||
| projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO); | |||||
| } | |||||
| #else | |||||
| projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO); | projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO); | ||||
| #endif | |||||
| gpuPushMatrix(); | gpuPushMatrix(); | ||||
| Context not available. | |||||
| else | else | ||||
| sub_v3_v3(vec, td->center); | sub_v3_v3(vec, td->center); | ||||
| mul_v3_fl(vec, td->factor); | /* grease pencil falloff */ | ||||
| if (t->options & CTX_GPENCIL_STROKES) { | |||||
| bGPDstroke *gps = (bGPDstroke *)td->extra; | |||||
| mul_v3_fl(vec, td->factor * gps->falloff); | |||||
| /* scale stroke thickness */ | |||||
| if (td->val) { | |||||
| float ratio = t->values[0]; | |||||
| snapGridIncrement(t, &ratio); | |||||
| applyNumInput(&t->num, &ratio); | |||||
| t->values[0] = ratio; | |||||
| *td->val = td->ival * ratio * gps->falloff; | |||||
| CLAMP_MIN(*td->val, 0.001f); | |||||
| } | |||||
| } | |||||
| else { | |||||
| mul_v3_fl(vec, td->factor); | |||||
| } | |||||
| if (t->flag & (T_OBJECT | T_POSE)) { | if (t->flag & (T_OBJECT | T_POSE)) { | ||||
| mul_m3_v3(td->smtx, vec); | mul_m3_v3(td->smtx, vec); | ||||
| Context not available. | |||||
| if (t->flag & T_POINTS) { | if (t->flag & T_POINTS) { | ||||
| mul_m3_m3m3(totmat, mat, td->mtx); | mul_m3_m3m3(totmat, mat, td->mtx); | ||||
| mul_m3_m3m3(smat, td->smtx, totmat); | mul_m3_m3m3(smat, td->smtx, totmat); | ||||
| /* apply gpencil falloff */ | |||||
| if (t->options & CTX_GPENCIL_STROKES) { | |||||
| bGPDstroke *gps = (bGPDstroke *)td->extra; | |||||
| float sx = smat[0][0]; | |||||
| float sy = smat[1][1]; | |||||
| float sz = smat[2][2]; | |||||
| mul_m3_fl(smat, gps->falloff); | |||||
| /* fix scale */ | |||||
| smat[0][0] = sx; | |||||
| smat[1][1] = sy; | |||||
| smat[2][2] = sz; | |||||
| } | |||||
| sub_v3_v3v3(vec, td->iloc, center); | sub_v3_v3v3(vec, td->iloc, center); | ||||
| mul_m3_v3(smat, vec); | mul_m3_v3(smat, vec); | ||||
| Context not available. | |||||
| } | } | ||||
| mul_m3_v3(td->smtx, tvec); | mul_m3_v3(td->smtx, tvec); | ||||
| mul_v3_fl(tvec, td->factor); | |||||
| if (t->options & CTX_GPENCIL_STROKES) { | |||||
| /* grease pencil multiframe falloff */ | |||||
| bGPDstroke *gps = (bGPDstroke *)td->extra; | |||||
| mul_v3_fl(tvec, td->factor * gps->falloff); | |||||
| } | |||||
| else { | |||||
| /* proportional editing falloff */ | |||||
| mul_v3_fl(tvec, td->factor); | |||||
| } | |||||
| protectedTransBits(td->protectflag, tvec); | protectedTransBits(td->protectflag, tvec); | ||||
| Context not available. | |||||