Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_290.c
| Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | static bool can_use_proxy(const Sequence *seq, int psize) | ||||
| if (seq->strip->proxy == NULL) { | if (seq->strip->proxy == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| short size_flags = seq->strip->proxy->build_size_flags; | short size_flags = seq->strip->proxy->build_size_flags; | ||||
| return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; | return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; | ||||
| } | } | ||||
| /* image_size is width or height depending what RNA property is converted - X or Y. */ | /* image_size is width or height depending what RNA property is converted - X or Y. */ | ||||
| static void seq_convert_transform_animation(const Scene *scene, | static void seq_convert_transform_animation(const Sequence *seq, | ||||
| const Scene *scene, | |||||
| const char *path, | const char *path, | ||||
| const int image_size) | const int image_size, | ||||
| const int scene_size) | |||||
| { | { | ||||
| if (scene->adt == NULL || scene->adt->action == NULL) { | if (scene->adt == NULL || scene->adt->action == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Hardcoded legacy bit-flags which has been removed. */ | |||||
| const uint32_t use_transform_flag = (1 << 16); | |||||
| const uint32_t use_crop_flag = (1 << 17); | |||||
| /* Convert offset animation, but only if crop is not used. */ | |||||
sergey: Maybe worth stating why only do it if the crop is not used. Maybe something like:
/* Convert… | |||||
| if ((seq->flag & use_transform_flag) != 0 && (seq->flag & use_crop_flag) == 0) { | |||||
| FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0); | FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0); | ||||
| if (fcu != NULL && !BKE_fcurve_is_empty(fcu)) { | if (fcu != NULL && !BKE_fcurve_is_empty(fcu)) { | ||||
| BezTriple *bezt = fcu->bezt; | BezTriple *bezt = fcu->bezt; | ||||
| for (int i = 0; i < fcu->totvert; i++, bezt++) { | for (int i = 0; i < fcu->totvert; i++, bezt++) { | ||||
| /* Same math as with old_image_center_*, but simplified. */ | /* Same math as with old_image_center_*, but simplified. */ | ||||
| bezt->vec[0][1] = image_size / 2 + bezt->vec[0][1] - scene->r.xsch / 2; | bezt->vec[0][1] = (image_size - scene_size) / 2 + bezt->vec[0][1]; | ||||
| bezt->vec[1][1] = image_size / 2 + bezt->vec[1][1] - scene->r.xsch / 2; | bezt->vec[1][1] = (image_size - scene_size) / 2 + bezt->vec[1][1]; | ||||
| bezt->vec[2][1] = image_size / 2 + bezt->vec[2][1] - scene->r.xsch / 2; | bezt->vec[2][1] = (image_size - scene_size) / 2 + bezt->vec[2][1]; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { /* Else, remove offset animation. */ | |||||
| FCurve *fcu = BKE_fcurve_find(&scene->adt->action->curves, path, 0); | |||||
| BLI_remlink(&scene->adt->action->curves, fcu); | |||||
| BKE_fcurve_free(fcu); | |||||
Done Inline ActionsShall we reset the offset stored in the strip somehow? Thing is, f-curve will write new values to the sequence. So removing the f-curve might not be enough to get rid of unwanted offset. sergey: Shall we reset the offset stored in the strip somehow? Thing is, f-curve will write new values… | |||||
Done Inline ActionsWith offset unused, values are reset to 0. I think it would make sense to reset values even if it's due to crop usage. ISS: With offset unused, values are reset to 0. I think it would make sense to reset values even if… | |||||
| } | |||||
| } | |||||
| static void seq_convert_transform_crop(const Scene *scene, | static void seq_convert_transform_crop(const Scene *scene, | ||||
| Sequence *seq, | Sequence *seq, | ||||
| const eSpaceSeq_Proxy_RenderSize render_size) | const eSpaceSeq_Proxy_RenderSize render_size) | ||||
| { | { | ||||
| if (seq->strip->transform == NULL) { | if (seq->strip->transform == NULL) { | ||||
| seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform"); | seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | if ((seq->flag & use_crop_flag) != 0) { | ||||
| c->left /= t->scale_x; | c->left /= t->scale_x; | ||||
| c->right /= t->scale_x; | c->right /= t->scale_x; | ||||
| } | } | ||||
| } | } | ||||
| t->xofs = old_image_center_x - scene->r.xsch / 2; | t->xofs = old_image_center_x - scene->r.xsch / 2; | ||||
| t->yofs = old_image_center_y - scene->r.ysch / 2; | t->yofs = old_image_center_y - scene->r.ysch / 2; | ||||
| /* Convert offset animation, but only if crop is not used. */ | |||||
| if ((seq->flag & use_transform_flag) != 0 && (seq->flag & use_crop_flag) == 0) { | |||||
| char name_esc[(sizeof(seq->name) - 2) * 2], *path; | char name_esc[(sizeof(seq->name) - 2) * 2], *path; | ||||
| BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); | BLI_str_escape(name_esc, seq->name + 2, sizeof(name_esc)); | ||||
| path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_x", name_esc); | path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_x", name_esc); | ||||
| seq_convert_transform_animation(scene, path, image_size_x); | seq_convert_transform_animation(seq, scene, path, image_size_x, scene->r.xsch); | ||||
| MEM_freeN(path); | MEM_freeN(path); | ||||
| path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_y", name_esc); | path = BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform.offset_y", name_esc); | ||||
| seq_convert_transform_animation(scene, path, image_size_y); | seq_convert_transform_animation(seq, scene, path, image_size_y, scene->r.ysch); | ||||
| MEM_freeN(path); | MEM_freeN(path); | ||||
| } | |||||
| seq->flag &= ~use_transform_flag; | seq->flag &= ~use_transform_flag; | ||||
| seq->flag &= ~use_crop_flag; | seq->flag &= ~use_crop_flag; | ||||
| } | } | ||||
| static void seq_convert_transform_crop_lb(const Scene *scene, | static void seq_convert_transform_crop_lb(const Scene *scene, | ||||
| const ListBase *lb, | const ListBase *lb, | ||||
| const eSpaceSeq_Proxy_RenderSize render_size) | const eSpaceSeq_Proxy_RenderSize render_size) | ||||
| ▲ Show 20 Lines • Show All 1,829 Lines • Show Last 20 Lines | |||||
Maybe worth stating why only do it if the crop is not used. Maybe something like: