Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_generics.c
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
| #include "BIK_api.h" | #include "BIK_api.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_gpencil.h" | |||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| Show All 15 Lines | |||||
| #include "ED_particle.h" | #include "ED_particle.h" | ||||
| #include "ED_screen_types.h" | #include "ED_screen_types.h" | ||||
| #include "ED_space_api.h" | #include "ED_space_api.h" | ||||
| #include "ED_uvedit.h" | #include "ED_uvedit.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "ED_curve.h" /* for curve_editnurbs */ | #include "ED_curve.h" /* for curve_editnurbs */ | ||||
| #include "ED_clip.h" | #include "ED_clip.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_gpencil.h" | |||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "RE_engine.h" | #include "RE_engine.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| ▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | static void recalcData_actedit(TransInfo *t) | ||||
| ANIM_animdata_context_getdata(&ac); | ANIM_animdata_context_getdata(&ac); | ||||
| /* perform flush */ | /* perform flush */ | ||||
| if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { | if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { | ||||
| /* flush transform values back to actual coordinates */ | /* flush transform values back to actual coordinates */ | ||||
| flushTransIntFrameActionData(t); | flushTransIntFrameActionData(t); | ||||
| } | } | ||||
| else { | |||||
| if (ac.datatype != ANIMCONT_MASK) { | |||||
| /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */ | /* get animdata blocks visible in editor, assuming that these will be the ones where things changed */ | ||||
| filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); | filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); | ||||
| ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ||||
| /* just tag these animdata-blocks to recalc, assuming that some data there changed | /* just tag these animdata-blocks to recalc, assuming that some data there changed | ||||
| * BUT only do this if realtime updates are enabled | * BUT only do this if realtime updates are enabled | ||||
| */ | */ | ||||
| if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) { | if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) { | ||||
| ▲ Show 20 Lines • Show All 915 Lines • ▼ Show 20 Lines | void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event) | ||||
| if (op && (prop = RNA_struct_find_property(op->ptr, "remove_on_cancel")) && RNA_property_is_set(op->ptr, prop)) { | if (op && (prop = RNA_struct_find_property(op->ptr, "remove_on_cancel")) && RNA_property_is_set(op->ptr, prop)) { | ||||
| if (RNA_property_boolean_get(op->ptr, prop)) { | if (RNA_property_boolean_get(op->ptr, prop)) { | ||||
| t->remove_on_cancel = true; | t->remove_on_cancel = true; | ||||
| } | } | ||||
| } | } | ||||
| /* GPencil editing context */ | /* GPencil editing context */ | ||||
| if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) { | if (GPENCIL_ANY_MODE(gpd)) { | ||||
| t->options |= CTX_GPENCIL_STROKES; | t->options |= CTX_GPENCIL_STROKES; | ||||
| } | } | ||||
| /* Assign the space type, some exceptions for running in different mode */ | /* Assign the space type, some exceptions for running in different mode */ | ||||
| if (sa == NULL) { | if (sa == NULL) { | ||||
| /* background mode */ | /* background mode */ | ||||
| t->spacetype = SPACE_EMPTY; | t->spacetype = SPACE_EMPTY; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | void calculateCenterCursor(TransInfo *t, float r_center[3]) | ||||
| /* If edit or pose mode, move cursor in local space */ | /* If edit or pose mode, move cursor in local space */ | ||||
| if (t->options & CTX_PAINT_CURVE) { | if (t->options & CTX_PAINT_CURVE) { | ||||
| if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) { | if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) { | ||||
| r_center[0] = t->ar->winx / 2.0f; | r_center[0] = t->ar->winx / 2.0f; | ||||
| r_center[1] = t->ar->winy / 2.0f; | r_center[1] = t->ar->winy / 2.0f; | ||||
| } | } | ||||
| r_center[2] = 0.0f; | r_center[2] = 0.0f; | ||||
| } | } | ||||
| else if (t->options & CTX_GPENCIL_STROKES) { | |||||
| /* move cursor in local space */ | |||||
| TransData *td = NULL; | |||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | |||||
| float mat[3][3], imat[3][3]; | |||||
| td = tc->data; | |||||
| Object *ob = td->ob; | |||||
| sub_v3_v3v3(r_center, r_center, ob->obmat[3]); | |||||
| copy_m3_m4(mat, ob->obmat); | |||||
| invert_m3_m3(imat, mat); | |||||
| mul_m3_v3(imat, r_center); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| void calculateCenterCursor2D(TransInfo *t, float r_center[2]) | void calculateCenterCursor2D(TransInfo *t, float r_center[2]) | ||||
| { | { | ||||
| const float *cursor = NULL; | const float *cursor = NULL; | ||||
| if (t->spacetype == SPACE_IMAGE) { | if (t->spacetype == SPACE_IMAGE) { | ||||
| SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; | SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; | ||||
| ▲ Show 20 Lines • Show All 506 Lines • Show Last 20 Lines | |||||