[Bf-blender-cvs] [300f921be22] temp-transform-conversions-split: Transform: Move ActionData c ocnversion to its own file
mano-wii
noreply at git.blender.org
Wed Sep 4 23:52:46 CEST 2019
Commit: 300f921be223c7358f57aff94ad4256062d82663
Author: mano-wii
Date: Wed Sep 4 17:04:17 2019 -0300
Branches: temp-transform-conversions-split
https://developer.blender.org/rB300f921be223c7358f57aff94ad4256062d82663
Transform: Move ActionData c ocnversion to its own file
===================================================================
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/transform/transform_conversions.h
A source/blender/editors/transform/transform_conversions_actiondata.c
M source/blender/editors/transform/transform_conversions_mesh.c
===================================================================
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index fe7aaf13683..edba894736f 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -41,6 +41,7 @@ set(SRC
transform.c
transform_constraints.c
transform_conversions.c
+ transform_conversions_actiondata.c
transform_conversions_armature.c
transform_conversions_cursor.c
transform_conversions_curve.c
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 2a486c0dee7..d53ed952189 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -25,7 +25,6 @@
#include <math.h>
#include <limits.h>
-#include "DNA_anim_types.h"
#include "DNA_brush_types.h"
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
@@ -47,7 +46,6 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
-#include "BLI_rect.h"
#include "BLI_kdtree.h"
#include "BKE_animsys.h"
@@ -1179,7 +1177,7 @@ void clipUVData(TransInfo *t)
/* ********************* ANIMATION EDITORS (GENERAL) ************************* */
/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
-static bool FrameOnMouseSide(char side, float frame, float cframe)
+bool FrameOnMouseSide(char side, float frame, float cframe)
{
/* both sides, so it doesn't matter */
if (side == 'B') {
@@ -1684,171 +1682,6 @@ static void posttrans_action_clean(bAnimContext *ac, bAction *act)
/* ----------------------------- */
-/* fully select selected beztriples, but only include if it's on the right side of cfra */
-static int count_fcurve_keys(FCurve *fcu, char side, float cfra, bool is_prop_edit)
-{
- BezTriple *bezt;
- int i, count = 0, count_all = 0;
-
- if (ELEM(NULL, fcu, fcu->bezt)) {
- return count;
- }
-
- /* only include points that occur on the right side of cfra */
- for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
- /* no need to adjust the handle selection since they are assumed
- * selected (like graph editor with SIPO_NOHANDLES) */
- if (bezt->f2 & SELECT) {
- count++;
- }
-
- count_all++;
- }
- }
-
- if (is_prop_edit && count > 0) {
- return count_all;
- }
- else {
- return count;
- }
-}
-
-/* fully select selected beztriples, but only include if it's on the right side of cfra */
-static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra, bool is_prop_edit)
-{
- bGPDframe *gpf;
- int count = 0, count_all = 0;
-
- if (gpl == NULL) {
- return count;
- }
-
- /* only include points that occur on the right side of cfra */
- for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
- if (FrameOnMouseSide(side, (float)gpf->framenum, cfra)) {
- if (gpf->flag & GP_FRAME_SELECT) {
- count++;
- }
- count_all++;
- }
- }
-
- if (is_prop_edit && count > 0) {
- return count_all;
- }
- else {
- return count;
- }
-}
-
-/* fully select selected beztriples, but only include if it's on the right side of cfra */
-static int count_masklayer_frames(MaskLayer *masklay, char side, float cfra, bool is_prop_edit)
-{
- MaskLayerShape *masklayer_shape;
- int count = 0, count_all = 0;
-
- if (masklay == NULL) {
- return count;
- }
-
- /* only include points that occur on the right side of cfra */
- for (masklayer_shape = masklay->splines_shapes.first; masklayer_shape;
- masklayer_shape = masklayer_shape->next) {
- if (FrameOnMouseSide(side, (float)masklayer_shape->frame, cfra)) {
- if (masklayer_shape->flag & MASK_SHAPE_SELECT) {
- count++;
- }
- count_all++;
- }
- }
-
- if (is_prop_edit && count > 0) {
- return count_all;
- }
- else {
- return count;
- }
-}
-
-/* This function assigns the information to transdata */
-static void TimeToTransData(TransData *td, float *time, AnimData *adt, float ypos)
-{
- /* memory is calloc'ed, so that should zero everything nicely for us */
- td->val = time;
- td->ival = *(time);
-
- td->center[0] = td->ival;
- td->center[1] = ypos;
-
- /* store the AnimData where this keyframe exists as a keyframe of the
- * active action as td->extra.
- */
- td->extra = adt;
-}
-
-/* This function advances the address to which td points to, so it must return
- * the new address so that the next time new transform data is added, it doesn't
- * overwrite the existing ones... i.e. td = IcuToTransData(td, icu, ob, side, cfra);
- *
- * The 'side' argument is needed for the extend mode. 'B' = both sides, 'R'/'L' mean only data
- * on the named side are used.
- */
-static TransData *ActionFCurveToTransData(TransData *td,
- TransData2D **td2dv,
- FCurve *fcu,
- AnimData *adt,
- char side,
- float cfra,
- bool is_prop_edit,
- float ypos)
-{
- BezTriple *bezt;
- TransData2D *td2d = *td2dv;
- int i;
-
- if (ELEM(NULL, fcu, fcu->bezt)) {
- return td;
- }
-
- for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
- /* only add selected keyframes (for now, proportional edit is not enabled) */
- if (is_prop_edit || (bezt->f2 & SELECT)) { /* note this MUST match count_fcurve_keys(),
- * so can't use BEZT_ISSEL_ANY() macro */
- /* only add if on the right 'side' of the current frame */
- if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
- TimeToTransData(td, bezt->vec[1], adt, ypos);
-
- if (bezt->f2 & SELECT) {
- td->flag |= TD_SELECTED;
- }
-
- /*set flags to move handles as necessary*/
- td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2;
- td2d->h1 = bezt->vec[0];
- td2d->h2 = bezt->vec[2];
-
- copy_v2_v2(td2d->ih1, td2d->h1);
- copy_v2_v2(td2d->ih2, td2d->h2);
-
- td++;
- td2d++;
- }
- }
- }
-
- *td2dv = td2d;
-
- return td;
-}
-
-/* helper struct for gp-frame transforms (only used here) */
-typedef struct tGPFtransdata {
- float val; /* where transdata writes transform */
- int *sdata; /* pointer to gpf->framenum */
-} tGPFtransdata;
-
/* This function helps flush transdata written to tempdata into the gp-frames */
void flushTransIntFrameActionData(TransInfo *t)
{
@@ -1861,348 +1694,6 @@ void flushTransIntFrameActionData(TransInfo *t)
}
}
-/* This function advances the address to which td points to, so it must return
- * the new address so that the next time new transform data is added, it doesn't
- * overwrite the existing ones... i.e. td = GPLayerToTransData(td, ipo, ob, side, cfra);
- *
- * The 'side' argument is needed for the extend mode. 'B' = both sides, 'R'/'L' mean only data
- * on the named side are used.
- */
-static int GPLayerToTransData(TransData *td,
- tGPFtransdata *tfd,
- bGPDlayer *gpl,
- char side,
- float cfra,
- bool is_prop_edit,
- float ypos)
-{
- bGPDframe *gpf;
- int count = 0;
-
- /* check for select frames on right side of current frame */
- for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
- if (is_prop_edit || (gpf->flag & GP_FRAME_SELECT)) {
- if (FrameOnMouseSide(side, (float)gpf->framenum, cfra)) {
- /* memory is calloc'ed, so that should zero everything nicely for us */
- td->val = &tfd->val;
- td->ival = (float)gpf->framenum;
-
- td->center[0] = td->ival;
- td->center[1] = ypos;
-
- tfd->val = (float)gpf->framenum;
- tfd->sdata = &gpf->framenum;
-
- /* advance td now */
- td++;
- tfd++;
- count++;
- }
- }
- }
-
- return count;
-}
-
-/* refer to comment above #GPLayerToTransData, this is the same but for masks */
-static int MaskLayerToTransData(TransData *td,
- tGPFtransdata *tfd,
- MaskLayer *masklay,
- char side,
- float cfra,
- bool is_prop_edit,
- float ypos)
-{
- MaskLayerShape *masklay_shape;
- int count = 0;
-
- /* check for select frames on right side of current frame */
- for (masklay_shape = masklay->splines_shapes.first; masklay_shape;
- masklay_shape = masklay_shape->next) {
- if (is_prop_edit || (masklay_shape->flag & MASK_SHAPE_SELECT)) {
- if (FrameOnMouseSide(side, (float)masklay_shape->frame, cfra)) {
- /* memory is calloc'ed, so that should zero everything nicely for us */
- td->val = &tfd->val;
- td->ival = (float)masklay_shape->frame;
-
- td->center[0] = td->ival;
- td->center[1] = ypos;
-
- tfd->val = (float)masklay_shape->frame;
- tfd->sdata = &masklay_shape->frame;
-
- /* advance td now */
- td++;
- tfd++;
- count++;
- }
- }
- }
-
- return count;
-}
-
-static void createTransActionData(bContext *C, TransInfo *t)
-{
- Scene *scene = t->scene;
- TransData *td = NULL;
- TransData2D *td2d = NULL;
- tGPFtransdata *tfd = NULL;
-
- rcti *mask = &t->ar->v2d.mask;
- rctf *datamask = &t->ar->v2d.cur;
-
- float xsize = BLI_rctf_size_x(datamask);
- float ysize = BLI_rctf_size_y(datamask);
- float xmask = BLI_rcti_size_x(mask);
- float ymask = BLI_rcti_size_y(mask);
-
- bAnimContext ac;
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
- int filter;
- const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
-
- int count = 0;
- float cfra;
- float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * BLI_rctf_cent_y(&t->ar->v2d.cur);
-
- /* determine what type of dat
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list