diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 70 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_buttons.c | 58 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_dopesheet_draw.c | 48 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 222 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_draw.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 34 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 30 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 158 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 1504 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 1924 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 542 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 130 |
16 files changed, 2398 insertions, 2402 deletions
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index b59f3756819..c8d03bcbf2f 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -237,7 +237,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin PointerRNA gpd_ptr; bGPDlayer *gpl; uiLayout *col, *row; - SpaceClip *sc= CTX_wm_space_clip(C); + SpaceClip *sc = CTX_wm_space_clip(C); short v3d_stroke_opts = STROKE_OPTS_NORMAL; const short is_v3d = CTX_wm_view3d(C) != NULL; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index f368e7cf4c7..7b69e820467 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1542,7 +1542,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc } else if ((scopes->track_search) && ((!scopes->track_preview) || - (scopes->track_preview->x != width || scopes->track_preview->y != height))) + (scopes->track_preview->x != width || scopes->track_preview->y != height))) { ImBuf *tmpibuf; @@ -1686,7 +1686,7 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSE int i; float rad; float a; - float dalpha = alpha * 2.0f/255.0f, calpha; + float dalpha = alpha * 2.0f / 255.0f, calpha; glEnable(GL_BLEND); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 66ad05aec7e..98735139136 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -919,7 +919,7 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod /* Grab brush requires to test on original data (see r33888 and * bug #25371) */ original = (paint_brush(&sd->paint)->sculpt_tool == SCULPT_TOOL_GRAB ? - TRUE : ss->cache->original); + TRUE : ss->cache->original); (void)sd; /* unused w/o openmp */ @@ -991,7 +991,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, case SCULPT_DISP_DIR_VIEW: ED_view3d_global_to_vector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], - an); + an); break; case SCULPT_DISP_DIR_X: @@ -1117,21 +1117,21 @@ static void update_brush_local_mat(Sculpt *sd, Object *ob) static int brush_needs_sculpt_normal(const Brush *brush) { return ((ELEM(brush->sculpt_tool, - SCULPT_TOOL_GRAB, - SCULPT_TOOL_SNAKE_HOOK) && - ((brush->normal_weight > 0) || - (brush->flag & BRUSH_FRONTFACE))) || - - ELEM7(brush->sculpt_tool, - SCULPT_TOOL_BLOB, - SCULPT_TOOL_CREASE, - SCULPT_TOOL_DRAW, - SCULPT_TOOL_LAYER, - SCULPT_TOOL_NUDGE, - SCULPT_TOOL_ROTATE, - SCULPT_TOOL_THUMB) || - - (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)); + SCULPT_TOOL_GRAB, + SCULPT_TOOL_SNAKE_HOOK) && + ((brush->normal_weight > 0) || + (brush->flag & BRUSH_FRONTFACE))) || + + ELEM7(brush->sculpt_tool, + SCULPT_TOOL_BLOB, + SCULPT_TOOL_CREASE, + SCULPT_TOOL_DRAW, + SCULPT_TOOL_LAYER, + SCULPT_TOOL_NUDGE, + SCULPT_TOOL_ROTATE, + SCULPT_TOOL_THUMB) || + + (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)); } /* For the smooth brush, uses the neighboring vertices around vert to calculate @@ -1432,14 +1432,14 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) for (n = 0; n < totnode; n++) { - switch(type) { + switch (type) { case PBVH_GRIDS: do_multires_smooth_brush(sd, ss, nodes[n], strength, - smooth_mask); + smooth_mask); break; case PBVH_FACES: do_mesh_smooth_brush(sd, ss, nodes[n], strength, - smooth_mask); + smooth_mask); break; } } @@ -1532,7 +1532,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) /* offset vertex */ float fade = tex_strength(ss, brush, vd.co, test.dist, ss->cache->sculpt_normal_symm, vd.no, - vd.fno, *vd.mask); + vd.fno, *vd.mask); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -1588,7 +1588,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod /* offset vertex */ const float fade = tex_strength(ss, brush, vd.co, test.dist, ss->cache->sculpt_normal_symm, - vd.no, vd.fno, *vd.mask); + vd.no, vd.fno, *vd.mask); float val1[3]; float val2[3]; @@ -1726,7 +1726,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode if (sculpt_brush_test(&test, vd.co)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist, ss->cache->sculpt_normal_symm, - vd.no, vd.fno, *vd.mask); + vd.no, vd.fno, *vd.mask); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -1775,7 +1775,7 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to if (sculpt_brush_test(&test, vd.co)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist, ss->cache->sculpt_normal_symm, - vd.no, vd.fno, *vd.mask); + vd.no, vd.fno, *vd.mask); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -1823,7 +1823,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode if (sculpt_brush_test(&test, origco[vd.i])) { const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist, ss->cache->sculpt_normal_symm, - origno[vd.i], NULL, *vd.mask); + origno[vd.i], NULL, *vd.mask); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -1876,7 +1876,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod if (sculpt_brush_test(&test, origco[vd.i])) { const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist, ss->cache->sculpt_normal_symm, - origno[vd.i], NULL, *vd.mask); + origno[vd.i], NULL, *vd.mask); mul_v3_m4v3(proxy[vd.i], m, origco[vd.i]); sub_v3_v3(proxy[vd.i], origco[vd.i]); @@ -1929,7 +1929,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode if (sculpt_brush_test(&test, origco[vd.i])) { const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist, ss->cache->sculpt_normal_symm, - vd.no, vd.fno, *vd.mask); + vd.no, vd.fno, *vd.mask); float *disp = &layer_disp[vd.i]; float val[3]; @@ -3585,15 +3585,15 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, one of smooth brush, autosmooth, mask smooth, or shift-key smooth) */ static int sculpt_any_smooth_mode(const Brush *brush, - StrokeCache *cache, - int stroke_mode) + StrokeCache *cache, + int stroke_mode) { return ((stroke_mode == BRUSH_STROKE_SMOOTH) || - (cache && cache->alt_smooth) || - (brush->sculpt_tool == SCULPT_TOOL_SMOOTH) || - (brush->autosmooth_factor > 0) || - ((brush->sculpt_tool == SCULPT_TOOL_MASK) && - (brush->mask_tool == BRUSH_MASK_SMOOTH))); + (cache && cache->alt_smooth) || + (brush->sculpt_tool == SCULPT_TOOL_SMOOTH) || + (brush->autosmooth_factor > 0) || + ((brush->sculpt_tool == SCULPT_TOOL_MASK) && + (brush->mask_tool == BRUSH_MASK_SMOOTH))); } static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob) @@ -3605,7 +3605,7 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob) Brush *brush = paint_brush(&sd->paint); sculpt_update_mesh_elements(CTX_data_scene(C), sd, ob, - sculpt_any_smooth_mode(brush, ss->cache, 0)); + sculpt_any_smooth_mode(brush, ss->cache, 0)); } } diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index ca2ae6e8461..66fa2aed862 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -59,7 +59,7 @@ #include "WM_api.h" #include "WM_types.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" /* own include */ /* Panels */ @@ -165,7 +165,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) block = uiLayoutAbsoluteBlock(layout); - scopes->track_preview_height = (scopes->track_preview_height <= UI_UNIT_Y)?UI_UNIT_Y : scopes->track_preview_height; + scopes->track_preview_height = (scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height; uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); @@ -173,27 +173,27 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) /********************* Marker Template ************************/ -#define B_MARKER_POS 3 -#define B_MARKER_OFFSET 4 -#define B_MARKER_PAT_DIM 5 -#define B_MARKER_SEARCH_POS 6 -#define B_MARKER_SEARCH_DIM 7 -#define B_MARKER_FLAG 8 +#define B_MARKER_POS 3 +#define B_MARKER_OFFSET 4 +#define B_MARKER_PAT_DIM 5 +#define B_MARKER_SEARCH_POS 6 +#define B_MARKER_SEARCH_DIM 7 +#define B_MARKER_FLAG 8 typedef struct { - int compact; /* compact mode */ + int compact; /* compact mode */ MovieClip *clip; - MovieClipUser *user; /* user of clip */ + MovieClipUser *user; /* user of clip */ MovieTrackingTrack *track; MovieTrackingMarker *marker; - int framenr; /* current frame number */ - float marker_pos[2]; /* position of marker in pixel coords */ - float marker_pat[2]; /* position and dimensions of marker pattern in pixel coords */ - float track_offset[2]; /* offset of "parenting" point */ - float marker_search_pos[2], marker_search[2]; /* position and dimensions of marker search in pixel coords */ - int marker_flag; /* marker's flags */ + int framenr; /* current frame number */ + float marker_pos[2]; /* position of marker in pixel coords */ + float marker_pat[2]; /* position and dimensions of marker pattern in pixel coords */ + float track_offset[2]; /* offset of "parenting" point */ + float marker_search_pos[2], marker_search[2]; /* position and dimensions of marker search in pixel coords */ + int marker_flag; /* marker's flags */ } MarkerUpdateCb; static void to_pixel_space(float r[2], float a[2], int width, int height) @@ -205,7 +205,7 @@ static void to_pixel_space(float r[2], float a[2], int width, int height) static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { - MarkerUpdateCb *cb = (MarkerUpdateCb*) arg_cb; + MarkerUpdateCb *cb = (MarkerUpdateCb *) arg_cb; MovieTrackingMarker *marker; if (!cb->compact) @@ -220,7 +220,7 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) static void marker_block_handler(bContext *C, void *arg_cb, int event) { - MarkerUpdateCb *cb = (MarkerUpdateCb*) arg_cb; + MarkerUpdateCb *cb = (MarkerUpdateCb *) arg_cb; MovieTrackingMarker *marker; int width, height, ok = FALSE; @@ -431,7 +431,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P tip = "Marker is enabled at current frame"; uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag, - 0, 0, 0, 0, tip); + 0, 0, 0, 0, tip); col = uiLayoutColumn(layout, 1); uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0); @@ -441,31 +441,31 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P uiDefBut(block, LABEL, 0, "Position:", 0, 190, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_POS, "X:", 10, 171, 145, 19, &cb->marker_pos[0], - -10*width, 10.0*width, step, digits, "X-position of marker at frame in screen coordinates"); + -10 * width, 10.0 * width, step, digits, "X-position of marker at frame in screen coordinates"); uiDefButF(block, NUM, B_MARKER_POS, "Y:", 165, 171, 145, 19, &cb->marker_pos[1], - -10*height, 10.0*height, step, digits, "Y-position of marker at frame in screen coordinates"); + -10 * height, 10.0 * height, step, digits, "Y-position of marker at frame in screen coordinates"); uiDefBut(block, LABEL, 0, "Offset:", 0, 152, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_OFFSET, "X:", 10, 133, 145, 19, &cb->track_offset[0], - -10*width, 10.0*width, step, digits, "X-offset to parenting point"); + -10 * width, 10.0 * width, step, digits, "X-offset to parenting point"); uiDefButF(block, NUM, B_MARKER_OFFSET, "Y:", 165, 133, 145, 19, &cb->track_offset[1], - -10*height, 10.0*height, step, digits, "Y-offset to parenting point"); + -10 * height, 10.0 * height, step, digits, "Y-offset to parenting point"); uiDefBut(block, LABEL, 0, "Pattern Area:", 0, 114, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Width:", 10, 95, 300, 19, &cb->marker_pat[0], 3.0f, - 10.0*width, step, digits, "Width of marker's pattern in screen coordinates"); + 10.0 * width, step, digits, "Width of marker's pattern in screen coordinates"); uiDefButF(block, NUM, B_MARKER_PAT_DIM, "Height:", 10, 76, 300, 19, &cb->marker_pat[1], 3.0f, - 10.0*height, step, digits, "Height of marker's pattern in screen coordinates"); + 10.0 * height, step, digits, "Height of marker's pattern in screen coordinates"); uiDefBut(block, LABEL, 0, "Search Area:", 0, 57, 300, 19, NULL, 0, 0, 0, 0, ""); uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "X:", 10, 38, 145, 19, &cb->marker_search_pos[0], - -width, width, step, digits, "X-position of search at frame relative to marker's position"); + -width, width, step, digits, "X-position of search at frame relative to marker's position"); uiDefButF(block, NUM, B_MARKER_SEARCH_POS, "Y:", 165, 38, 145, 19, &cb->marker_search_pos[1], - -height, height, step, digits, "X-position of search at frame relative to marker's position"); + -height, height, step, digits, "X-position of search at frame relative to marker's position"); uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Width:", 10, 19, 300, 19, &cb->marker_search[0], 3.0f, - 10.0*width, step, digits, "Width of marker's search in screen soordinates"); + 10.0 * width, step, digits, "Width of marker's search in screen soordinates"); uiDefButF(block, NUM, B_MARKER_SEARCH_DIM, "Height:", 10, 0, 300, 19, &cb->marker_search[1], 3.0f, - 10.0*height, step, digits, "Height of marker's search in screen soordinates"); + 10.0 * height, step, digits, "Height of marker's search in screen soordinates"); uiBlockEndAlign(block); } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 67609fee653..e9ea70cafea 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -30,7 +30,7 @@ */ #include "DNA_movieclip_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" #include "MEM_guardedalloc.h" @@ -61,7 +61,7 @@ #include "RNA_access.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" /* own include */ static void track_channel_color(MovieTrackingTrack *track, float default_color[3], float color[3]) { @@ -83,10 +83,10 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh { /* coordinates for diamond shape */ static const float _unit_diamond_shape[4][2] = { - {0.0f, 1.0f}, /* top vert */ - {1.0f, 0.0f}, /* mid-right */ - {0.0f, -1.0f}, /* bottom vert */ - {-1.0f, 0.0f} /* mid-left */ + {0.0f, 1.0f}, /* top vert */ + {1.0f, 0.0f}, /* mid-right */ + {0.0f, -1.0f}, /* bottom vert */ + {-1.0f, 0.0f} /* mid-left */ }; static GLuint displist1 = 0; static GLuint displist2 = 0; @@ -95,26 +95,26 @@ static void draw_keyframe_shape(float x, float y, float xscale, float yscale, sh /* initialize 2 display lists for diamond shape - one empty, one filled */ if (displist1 == 0) { displist1 = glGenLists(1); - glNewList(displist1, GL_COMPILE); - - glBegin(GL_LINE_LOOP); - glVertex2fv(_unit_diamond_shape[0]); - glVertex2fv(_unit_diamond_shape[1]); - glVertex2fv(_unit_diamond_shape[2]); - glVertex2fv(_unit_diamond_shape[3]); - glEnd(); + glNewList(displist1, GL_COMPILE); + + glBegin(GL_LINE_LOOP); + glVertex2fv(_unit_diamond_shape[0]); + glVertex2fv(_unit_diamond_shape[1]); + glVertex2fv(_unit_diamond_shape[2]); + glVertex2fv(_unit_diamond_shape[3]); + glEnd(); glEndList(); } if (displist2 == 0) { displist2 = glGenLists(1); - glNewList(displist2, GL_COMPILE); - - glBegin(GL_QUADS); - glVertex2fv(_unit_diamond_shape[0]); - glVertex2fv(_unit_diamond_shape[1]); - glVertex2fv(_unit_diamond_shape[2]); - glVertex2fv(_unit_diamond_shape[3]); - glEnd(); + glNewList(displist2, GL_COMPILE); + + glBegin(GL_QUADS); + glVertex2fv(_unit_diamond_shape[0]); + glVertex2fv(_unit_diamond_shape[1]); + glVertex2fv(_unit_diamond_shape[2]); + glVertex2fv(_unit_diamond_shape[3]); + glEnd(); glEndList(); } @@ -210,7 +210,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (start_frame != end_frame) { glRectf(start_frame, (float) y - STRIP_HEIGHT_HALF, - end_frame, (float) y + STRIP_HEIGHT_HALF); + end_frame, (float) y + STRIP_HEIGHT_HALF); draw_keyframe_shape(start_frame, y, xscale, yscale, sel, alpha); draw_keyframe_shape(end_frame, y, xscale, yscale, sel, alpha); } @@ -309,7 +309,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) font_height = BLF_height(fontid, track->name); BLF_position(fontid, v2d->cur.xmin + CHANNEL_PAD, - y - font_height / 2.0f, 0.0f); + y - font_height / 2.0f, 0.0f); BLF_draw(fontid, track->name, strlen(track->name)); } diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 2e16a9095f0..a9b23d5b939 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -32,7 +32,7 @@ #include "DNA_gpencil_types.h" #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "DNA_mask_types.h" #include "MEM_guardedalloc.h" @@ -69,7 +69,7 @@ #include "BLF_api.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include /*********************** main area drawing *************************/ @@ -277,10 +277,10 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glScalef(zoomx, zoomy, 1.0f); glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); - glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f); - glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); - glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height); + glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); + glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f); + glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); + glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height); glEnd(); glPopMatrix(); @@ -320,10 +320,10 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glMultMatrixf(sc->stabmat); glBegin(GL_LINE_LOOP); - glVertex2f(0.0f, 0.0f); - glVertex2f(width, 0.0f); - glVertex2f(width, height); - glVertex2f(0.0f, height); + glVertex2f(0.0f, 0.0f); + glVertex2f(width, 0.0f); + glVertex2f(width, height); + glVertex2f(0.0f, height); glEnd(); glPopMatrix(); @@ -399,17 +399,17 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if (TRACK_VIEW_SELECTED(sc, track)) { glPointSize(5.0f); glBegin(GL_POINTS); - for (i = a; i < b; i++) { - if (i != curindex) - glVertex2f(path[i][0], path[i][1]); - } + for (i = a; i < b; i++) { + if (i != curindex) + glVertex2f(path[i][0], path[i][1]); + } glEnd(); } glLineWidth(3.0f); glBegin(GL_LINE_STRIP); - for (i = a; i < b; i++) - glVertex2f(path[i][0], path[i][1]); + for (i = a; i < b; i++) + glVertex2f(path[i][0], path[i][1]); glEnd(); glLineWidth(1.0f); } @@ -419,25 +419,25 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if (TRACK_VIEW_SELECTED(sc, track)) { glPointSize(3.0f); glBegin(GL_POINTS); - for (i = a; i < b; i++) { - if (i == count + 1) - UI_ThemeColor(TH_PATH_AFTER); + for (i = a; i < b; i++) { + if (i == count + 1) + UI_ThemeColor(TH_PATH_AFTER); - if (i != curindex) - glVertex2f(path[i][0], path[i][1]); - } + if (i != curindex) + glVertex2f(path[i][0], path[i][1]); + } glEnd(); } UI_ThemeColor(TH_PATH_BEFORE); glBegin(GL_LINE_STRIP); - for (i = a; i < b; i++) { - if (i == count + 1) - UI_ThemeColor(TH_PATH_AFTER); + for (i = a; i < b; i++) { + if (i == count + 1) + UI_ThemeColor(TH_PATH_AFTER); - glVertex2f(path[i][0], path[i][1]); - } + glVertex2f(path[i][0], path[i][1]); + } glEnd(); glPointSize(1.0f); } @@ -470,24 +470,24 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT if (tiny) glPointSize(3.0f); else glPointSize(4.0f); glBegin(GL_POINTS); - glVertex2f(pos[0], pos[1]); + glVertex2f(pos[0], pos[1]); glEnd(); glPointSize(1.0f); } else { if (!tiny) glLineWidth(3.0f); glBegin(GL_LINES); - glVertex2f(pos[0] + px[0]*2, pos[1]); - glVertex2f(pos[0] + px[0]*8, pos[1]); + glVertex2f(pos[0] + px[0] * 2, pos[1]); + glVertex2f(pos[0] + px[0] * 8, pos[1]); - glVertex2f(pos[0] - px[0]*2, pos[1]); - glVertex2f(pos[0] - px[0]*8, pos[1]); + glVertex2f(pos[0] - px[0] * 2, pos[1]); + glVertex2f(pos[0] - px[0] * 8, pos[1]); - glVertex2f(pos[0], pos[1] - px[1]*2); - glVertex2f(pos[0], pos[1] - px[1]*8); + glVertex2f(pos[0], pos[1] - px[1] * 2); + glVertex2f(pos[0], pos[1] - px[1] * 8); - glVertex2f(pos[0], pos[1] + px[1]*2); - glVertex2f(pos[0], pos[1] + px[1]*8); + glVertex2f(pos[0], pos[1] + px[1] * 2); + glVertex2f(pos[0], pos[1] + px[1] * 8); glEnd(); if (!tiny) glLineWidth(1.0f); } @@ -502,10 +502,10 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT if (sc->flag & SC_SHOW_MARKER_PATTERN) { glBegin(GL_LINE_LOOP); - glVertex2fv(marker->pattern_corners[0]); - glVertex2fv(marker->pattern_corners[1]); - glVertex2fv(marker->pattern_corners[2]); - glVertex2fv(marker->pattern_corners[3]); + glVertex2fv(marker->pattern_corners[0]); + glVertex2fv(marker->pattern_corners[1]); + glVertex2fv(marker->pattern_corners[2]); + glVertex2fv(marker->pattern_corners[3]); glEnd(); } @@ -513,10 +513,10 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); if (sc->flag & SC_SHOW_MARKER_SEARCH && show_search) { glBegin(GL_LINE_LOOP); - glVertex2f(marker->search_min[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_max[1]); - glVertex2f(marker->search_min[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_max[1]); glEnd(); } glPopMatrix(); @@ -546,7 +546,7 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float } static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, - float marker_pos[2], int width, int height, int act, int sel) + float marker_pos[2], int width, int height, int act, int sel) { int tiny = sc->flag & SC_SHOW_TINY_MARKER; int show_search = 0; @@ -588,7 +588,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glPointSize(2.0f); glBegin(GL_POINTS); - glVertex2f(pos[0], pos[1]); + glVertex2f(pos[0], pos[1]); glEnd(); if (!tiny) @@ -596,17 +596,17 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } else { glBegin(GL_LINES); - glVertex2f(pos[0] + px[0]*3, pos[1]); - glVertex2f(pos[0] + px[0]*7, pos[1]); + glVertex2f(pos[0] + px[0] * 3, pos[1]); + glVertex2f(pos[0] + px[0] * 7, pos[1]); - glVertex2f(pos[0] - px[0]*3, pos[1]); - glVertex2f(pos[0] - px[0]*7, pos[1]); + glVertex2f(pos[0] - px[0] * 3, pos[1]); + glVertex2f(pos[0] - px[0] * 7, pos[1]); - glVertex2f(pos[0], pos[1] - px[1]*3); - glVertex2f(pos[0], pos[1] - px[1]*7); + glVertex2f(pos[0], pos[1] - px[1] * 3); + glVertex2f(pos[0], pos[1] - px[1] * 7); - glVertex2f(pos[0], pos[1] + px[1]*3); - glVertex2f(pos[0], pos[1] + px[1]*7); + glVertex2f(pos[0], pos[1] + px[1] * 3); + glVertex2f(pos[0], pos[1] + px[1] * 7); glEnd(); glColor3f(0.0f, 0.0f, 0.0f); @@ -616,8 +616,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glLogicOp(GL_NOR); glBegin(GL_LINES); - glVertex2fv(pos); - glVertex2fv(marker_pos); + glVertex2fv(pos); + glVertex2fv(marker_pos); glEnd(); glDisable(GL_COLOR_LOGIC_OP); @@ -656,16 +656,16 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } glBegin(GL_LINE_LOOP); - glVertex2fv(marker->pattern_corners[0]); - glVertex2fv(marker->pattern_corners[1]); - glVertex2fv(marker->pattern_corners[2]); - glVertex2fv(marker->pattern_corners[3]); + glVertex2fv(marker->pattern_corners[0]); + glVertex2fv(marker->pattern_corners[1]); + glVertex2fv(marker->pattern_corners[2]); + glVertex2fv(marker->pattern_corners[3]); glEnd(); } /* search */ show_search = TRACK_VIEW_SELECTED(sc, track) && - ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); + ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); if ((track->search_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_SEARCH) && show_search) { if (track->flag & TRACK_LOCKED) { if (act) @@ -689,10 +689,10 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } glBegin(GL_LINE_LOOP); - glVertex2f(marker->search_min[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_max[1]); - glVertex2f(marker->search_min[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_max[1]); glEnd(); } @@ -733,10 +733,10 @@ static void draw_marker_slide_square(float x, float y, float dx, float dy, int o } glBegin(GL_QUADS); - glVertex3f(x - tdx, y + tdy, 0.0f); - glVertex3f(x + tdx, y + tdy, 0.0f); - glVertex3f(x + tdx, y - tdy, 0.0f); - glVertex3f(x - tdx, y - tdy, 0.0f); + glVertex3f(x - tdx, y + tdy, 0.0f); + glVertex3f(x + tdx, y + tdy, 0.0f); + glVertex3f(x + tdx, y - tdy, 0.0f); + glVertex3f(x - tdx, y - tdy, 0.0f); glEnd(); } @@ -753,9 +753,9 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int } glBegin(GL_TRIANGLES); - glVertex3f(x, y, 0.0f); - glVertex3f(x - tdx, y, 0.0f); - glVertex3f(x, y + tdy, 0.0f); + glVertex3f(x, y, 0.0f); + glVertex3f(x - tdx, y, 0.0f); + glVertex3f(x, y + tdy, 0.0f); glEnd(); } @@ -874,7 +874,7 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } if ((sc->flag & SC_SHOW_MARKER_SEARCH) && - ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0)) + ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0)) { dx = marker->search_min[0]; dy = marker->search_min[1]; @@ -893,8 +893,8 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra mul_m4_v3(sc->stabmat, pos); - pos[0] = pos[0]*zoomx; - pos[1] = pos[1]*zoomy - fontsize; + pos[0] = pos[0] * zoomx; + pos[1] = pos[1] * zoomy - fontsize; if (marker->flag & MARKER_DISABLED) strcpy(state, "disabled"); @@ -934,8 +934,8 @@ static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx y = -v2d->cur.ymin / (v2d->cur.ymax - v2d->cur.ymin); /* convert proportional distances to screen coordinates */ - *regionx = v2d->mask.xmin + x*(v2d->mask.xmax - v2d->mask.xmin); - *regiony = v2d->mask.ymin + y*(v2d->mask.ymax - v2d->mask.ymin); + *regionx = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin); + *regiony = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin); } static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, @@ -987,7 +987,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, /* undistort */ if (count) { - marker_pos = MEM_callocN(2*sizeof(float)*count, "draw_tracking_tracks marker_pos"); + marker_pos = MEM_callocN(2 * sizeof(float) * count, "draw_tracking_tracks marker_pos"); track = tracksbase->first; fp = marker_pos; @@ -1121,10 +1121,10 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, glColor3f(1.0f, 0.0f, 0.0f); glBegin(GL_POINTS); - if (undistort) - glVertex3f(pos[0] / width, pos[1] / (height * aspy), 0); - else - glVertex3f(npos[0] / width, npos[1] / (height * aspy), 0); + if (undistort) + glVertex3f(pos[0] / width, pos[1] / (height * aspy), 0); + else + glVertex3f(npos[0] / width, npos[1] / (height * aspy), 0); glEnd(); } } @@ -1260,7 +1260,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, BKE_tracking_apply_intrinsics(tracking, pos, grid[i][j]); grid[i][j][0] /= width; - grid[i][j][1] /= height*aspy; + grid[i][j][1] /= height * aspy; pos[0] += dx; } @@ -1273,17 +1273,17 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, for (i = 0; i <= n; i++) { glBegin(GL_LINE_STRIP); - for (j = 0; j <= n; j++) { - glVertex2fv(grid[i][j]); - } + for (j = 0; j <= n; j++) { + glVertex2fv(grid[i][j]); + } glEnd(); } for (j = 0; j <= n; j++) { glBegin(GL_LINE_STRIP); - for (i = 0; i <= n; i++) { - glVertex2fv(grid[i][j]); - } + for (i = 0; i <= n; i++) { + glVertex2fv(grid[i][j]); + } glEnd(); } } @@ -1328,40 +1328,40 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, if (stroke->flag & GP_STROKE_2DSPACE) { if (stroke->totpoints > 1) { glBegin(GL_LINE_STRIP); - for (i = 0; i < stroke->totpoints - 1; i++) { - float npos[2], dpos[2], len; - int steps; + for (i = 0; i < stroke->totpoints - 1; i++) { + float npos[2], dpos[2], len; + int steps; - pos[0] = (stroke->points[i].x + offsx) * width; - pos[1] = (stroke->points[i].y + offsy) * height * aspy; + pos[0] = (stroke->points[i].x + offsx) * width; + pos[1] = (stroke->points[i].y + offsy) * height * aspy; - npos[0] = (stroke->points[i + 1].x + offsx) * width; - npos[1] = (stroke->points[i + 1].y + offsy) * height * aspy; + npos[0] = (stroke->points[i + 1].x + offsx) * width; + npos[1] = (stroke->points[i + 1].y + offsy) * height * aspy; - len = len_v2v2(pos, npos); - steps = ceil(len / 5.0f); + len = len_v2v2(pos, npos); + steps = ceil(len / 5.0f); - /* we want to distort only long straight lines */ - if (stroke->totpoints == 2) { - BKE_tracking_invert_intrinsics(tracking, pos, pos); - BKE_tracking_invert_intrinsics(tracking, npos, npos); - } + /* we want to distort only long straight lines */ + if (stroke->totpoints == 2) { + BKE_tracking_invert_intrinsics(tracking, pos, pos); + BKE_tracking_invert_intrinsics(tracking, npos, npos); + } - sub_v2_v2v2(dpos, npos, pos); - mul_v2_fl(dpos, 1.0f / steps); + sub_v2_v2v2(dpos, npos, pos); + mul_v2_fl(dpos, 1.0f / steps); - for (j = 0; j <= steps; j++) { - BKE_tracking_apply_intrinsics(tracking, pos, tpos); - glVertex2f(tpos[0] / width, tpos[1] / (height*aspy)); + for (j = 0; j <= steps; j++) { + BKE_tracking_apply_intrinsics(tracking, pos, tpos); + glVertex2f(tpos[0] / width, tpos[1] / (height * aspy)); - add_v2_v2(pos, dpos); - } + add_v2_v2(pos, dpos); } + } glEnd(); } else if (stroke->totpoints == 1) { glBegin(GL_POINTS); - glVertex2f(stroke->points[0].x + offsx, stroke->points[0].y + offsy); + glVertex2f(stroke->points[0].x + offsx, stroke->points[0].y + offsy); glEnd(); } } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 8d30242c128..7da5dae1b50 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -31,7 +31,7 @@ #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "MEM_guardedalloc.h" @@ -57,7 +57,7 @@ #include "BLF_api.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include static void draw_curve_knot(float x, float y, float xscale, float yscale, float hsize) { @@ -88,7 +88,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float } static void tracking_segment_point_cb(void *UNUSED(userdata), MovieTrackingTrack *UNUSED(track), - MovieTrackingMarker *UNUSED(marker), int UNUSED(coord), int scene_framenr, float val) + MovieTrackingMarker *UNUSED(marker), int UNUSED(coord), int scene_framenr, float val) { glVertex2f(scene_framenr, val); } @@ -123,7 +123,7 @@ void tracking_segment_end_cb(void *UNUSED(userdata)) } static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track, - MovieTrackingMarker *marker, int coord, int scene_framenr, float val) + MovieTrackingMarker *marker, int coord, int scene_framenr, float val) { struct { MovieTrackingTrack *act_track; int sel; float xscale, yscale, hsize; } *data = userdata; int sel = 0, sel_flag; @@ -167,7 +167,7 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc) /* draw graph lines */ glEnable(GL_BLEND); clip_graph_tracking_values_iterate(sc, act_track, tracking_segment_point_cb, - tracking_segment_start_cb, tracking_segment_end_cb); + tracking_segment_start_cb, tracking_segment_end_cb); glDisable(GL_BLEND); /* selected knot handles on top of curves */ diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 79e199a8f06..9af67a2b104 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -29,7 +29,7 @@ * \ingroup spclip */ -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" #include "MEM_guardedalloc.h" @@ -57,7 +57,7 @@ #include "UI_view2d.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include /******************** common graph-editing utilities ********************/ @@ -96,16 +96,16 @@ static void toggle_selection_cb(void *userdata, MovieTrackingMarker *marker) /******************** mouse select operator ********************/ typedef struct { - int coord, /* coordinate index of found entuty (0 = X-axis, 1 = Y-axis) */ - has_prev; /* if there's valid coordinate of previous point of curve segment */ + int coord, /* coordinate index of found entuty (0 = X-axis, 1 = Y-axis) */ + has_prev; /* if there's valid coordinate of previous point of curve segment */ - float min_dist, /* minimal distance between mouse and currently found entuty */ - mouse_co[2], /* mouse coordinate */ - prev_co[2], /* coordinate of previeous point of segment */ - min_co[2]; /* coordinate of entity with minimal distance */ + float min_dist, /* minimal distance between mouse and currently found entuty */ + mouse_co[2], /* mouse coordinate */ + prev_co[2], /* coordinate of previeous point of segment */ + min_co[2]; /* coordinate of entity with minimal distance */ - MovieTrackingTrack *track; /* nearest found track */ - MovieTrackingMarker *marker; /* nearest found marker */ + MovieTrackingTrack *track; /* nearest found track */ + MovieTrackingMarker *marker; /* nearest found marker */ } MouseSelectUserData; static void find_nearest_tracking_segment_cb(void *userdata, MovieTrackingTrack *track, @@ -261,7 +261,7 @@ static int mouse_select(bContext *C, float co[2], int extend) static int select_exec(bContext *C, wmOperator *op) { float co[2]; - int extend = RNA_boolean_get(op->ptr, "extend"); + int extend = RNA_boolean_get(op->ptr, "extend"); RNA_float_get_array(op->ptr, "location", co); @@ -296,9 +296,9 @@ void CLIP_OT_graph_select(wmOperatorType *ot) /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, - "Location", "Mouse location to select nearest entity", -100.0f, 100.0f); + "Location", "Mouse location to select nearest entity", -100.0f, 100.0f); RNA_def_boolean(ot->srna, "extend", 0, - "Extend", "Extend selection rather than clearing the existing selection"); + "Extend", "Extend selection rather than clearing the existing selection"); } /********************** border select operator *********************/ @@ -671,10 +671,10 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op) void CLIP_OT_graph_disable_markers(wmOperatorType *ot) { static EnumPropertyItem actions_items[] = { - {0, "DISABLE", 0, "Disable", "Disable selected markers"}, - {1, "ENABLE", 0, "Enable", "Enable selected markers"}, - {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, - {0, NULL, 0, NULL, NULL} + {0, "DISABLE", 0, "Disable", "Disable selected markers"}, + {1, "ENABLE", 0, "Enable", "Enable selected markers"}, + {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 6908e488157..dd1addd715c 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -43,18 +43,18 @@ struct SpaceClip; struct wmOperatorType; /* channel heights */ -#define CHANNEL_FIRST -UI_UNIT_Y -#define CHANNEL_HEIGHT UI_UNIT_Y -#define CHANNEL_HEIGHT_HALF (UI_UNIT_Y / 2.0f) -#define CHANNEL_SKIP 2 -#define CHANNEL_STEP (CHANNEL_HEIGHT + CHANNEL_SKIP) +#define CHANNEL_FIRST -UI_UNIT_Y +#define CHANNEL_HEIGHT UI_UNIT_Y +#define CHANNEL_HEIGHT_HALF (UI_UNIT_Y / 2.0f) +#define CHANNEL_SKIP 2 +#define CHANNEL_STEP (CHANNEL_HEIGHT + CHANNEL_SKIP) -#define CHANNEL_PAD 4 +#define CHANNEL_PAD 4 /* extra padding for lengths (to go under scrollers) */ -#define EXTRA_SCROLL_PAD 100.0f +#define EXTRA_SCROLL_PAD 100.0f -#define STRIP_HEIGHT_HALF 5 +#define STRIP_HEIGHT_HALF 5 /* internal exports only */ @@ -110,17 +110,17 @@ void ED_clip_tool_props_register(struct ARegionType *art); /* clip_utils.c */ void clip_graph_tracking_values_iterate_track(struct SpaceClip *sc, struct MovieTrackingTrack *track, void *userdata, - void (*func) (void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start) (void *userdata, struct MovieTrackingTrack *track, int coord), - void (*segment_end) (void *userdata)); + void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), + void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), + void (*segment_end)(void *userdata)); void clip_graph_tracking_values_iterate(struct SpaceClip *sc, void *userdata, - void (*func) (void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start) (void *userdata, struct MovieTrackingTrack *track, int coord), - void (*segment_end) (void *userdata)); + void (*func)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int coord, int scene_framenr, float val), + void (*segment_start)(void *userdata, struct MovieTrackingTrack *track, int coord), + void (*segment_end)(void *userdata)); void clip_graph_tracking_iterate(struct SpaceClip *sc, void *userdata, - void (*func) (void *userdata, struct MovieTrackingMarker *marker)); + void (*func)(void *userdata, struct MovieTrackingMarker *marker)); void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track); void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 6b69f316880..8175a84e188 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -30,7 +30,7 @@ */ #include "DNA_scene_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "MEM_guardedalloc.h" @@ -61,12 +61,12 @@ #include "UI_resources.h" #include "UI_view2d.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack *track, void *userdata, - void (*func) (void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start) (void *userdata, MovieTrackingTrack *track, int coord), - void (*segment_end) (void *userdata)) + void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), + void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), + void (*segment_end)(void *userdata)) { MovieClip *clip = ED_space_clip(sc); int width, height, coord; @@ -122,9 +122,9 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack } void clip_graph_tracking_values_iterate(SpaceClip *sc, void *userdata, - void (*func) (void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), - void (*segment_start) (void *userdata, MovieTrackingTrack *track, int coord), - void (*segment_end) (void *userdata)) + void (*func)(void *userdata, MovieTrackingTrack *track, MovieTrackingMarker *marker, int coord, int scene_framenr, float val), + void (*segment_start)(void *userdata, MovieTrackingTrack *track, int coord), + void (*segment_end)(void *userdata)) { MovieClip *clip = ED_space_clip(sc); MovieTracking *tracking = &clip->tracking; @@ -142,7 +142,7 @@ void clip_graph_tracking_values_iterate(SpaceClip *sc, void *userdata, } void clip_graph_tracking_iterate(SpaceClip *sc, void *userdata, - void (*func) (void *userdata, MovieTrackingMarker *marker)) + void (*func)(void *userdata, MovieTrackingMarker *marker)) { MovieClip *clip = ED_space_clip(sc); MovieTracking *tracking = &clip->tracking; @@ -244,11 +244,11 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) glLineWidth(2.0); glBegin(GL_LINE_STRIP); - vec[1] = v2d->cur.ymin; - glVertex2fv(vec); + vec[1] = v2d->cur.ymin; + glVertex2fv(vec); - vec[1] = v2d->cur.ymax; - glVertex2fv(vec); + vec[1] = v2d->cur.ymax; + glVertex2fv(vec); glEnd(); glLineWidth(1.0); @@ -272,10 +272,10 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) /* currently clip editor supposes that editing clip length is equal to scene frame range */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glColor4f(0.0f, 0.0f, 0.0f, 0.4f); + glColor4f(0.0f, 0.0f, 0.0f, 0.4f); - glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); - glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); + glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); glDisable(GL_BLEND); UI_ThemeColorShade(TH_BACK, -60); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 54724881e37..6409ad6b171 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -35,7 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_mask_types.h" #include "DNA_movieclip_types.h" -#include "DNA_view3d_types.h" /* for pivot point */ +#include "DNA_view3d_types.h" /* for pivot point */ #include "MEM_guardedalloc.h" @@ -71,7 +71,7 @@ #include "RNA_access.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" /* own include */ static void init_preview_region(const bContext *C, ARegion *ar) { @@ -299,7 +299,7 @@ static SpaceLink *clip_new(const bContext *C) /* not spacelink itself */ static void clip_free(SpaceLink *sl) { - SpaceClip *sc = (SpaceClip*) sl; + SpaceClip *sc = (SpaceClip *) sl; sc->clip = NULL; @@ -397,7 +397,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_SCREEN: - switch (wmn->data) { + switch (wmn->data) { case ND_ANIMPLAY: case ND_GPENCIL: ED_area_tag_redraw(sa); @@ -634,17 +634,17 @@ static void clip_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CLIP_OT_slide_marker", LEFTMOUSE, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "CLIP_OT_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0); - RNA_enum_set(kmi->ptr, "action", 2); /* toggle */ + RNA_enum_set(kmi->ptr, "action", 2); /* toggle */ /* tracks */ WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0); - RNA_enum_set(kmi->ptr, "action", 0); /* lock */ + RNA_enum_set(kmi->ptr, "action", 0); /* lock */ kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0); - RNA_enum_set(kmi->ptr, "action", 1); /* unlock */ + RNA_enum_set(kmi->ptr, "action", 1); /* unlock */ kmi = WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "unselected", FALSE); @@ -733,7 +733,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* tracks */ kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0); - RNA_enum_set(kmi->ptr, "action", 2); /* toggle */ + RNA_enum_set(kmi->ptr, "action", 2); /* toggle */ transform_keymap_for_space(keyconf, keymap, SPACE_CLIP); @@ -742,7 +742,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf) keymap = WM_keymap_find(keyconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); kmi = WM_keymap_add_item(keymap, "CLIP_OT_dopesheet_select_channel", ACTIONMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "extend", TRUE); /* toggle */ + RNA_boolean_set(kmi->ptr, "extend", TRUE); /* toggle */ } const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL}; @@ -1161,7 +1161,7 @@ static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_SCREEN: if (wmn->data == ND_GPENCIL) ED_region_tag_redraw(ar); - break; + break; } } @@ -1205,7 +1205,7 @@ static void graph_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - unitx = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; + unitx = (sc->flag & SC_SHOW_SECONDS) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; unity = V2D_UNIT_VALUES; scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP); UI_view2d_scrollers_draw(C, v2d, scrollers); @@ -1232,7 +1232,7 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); /* time grid */ - unit = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; + unit = (sc->flag & SC_SHOW_SECONDS) ? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); @@ -1331,10 +1331,10 @@ static void clip_header_area_listener(ARegion *ar, wmNotifier *wmn) case ND_TOOLSETTINGS: /* TODO - should do this when in mask mode only but no datas available */ // if (sc->mode == SC_MODE_MASKEDIT) - { - ED_region_tag_redraw(ar); - } - break; + { + ED_region_tag_redraw(ar); + } + break; } break; } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index f6e9622f0a5..3a195805c53 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -35,7 +35,7 @@ #include "DNA_constraint_types.h" #include "DNA_gpencil_types.h" #include "DNA_movieclip_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" #include "BLI_utildefines.h" @@ -77,7 +77,7 @@ #include "UI_view2d.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include static float dist_to_crns(float co[2], float pos[2], float crns[4][2]); @@ -154,7 +154,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot) /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX, - "Location", "Location of marker on frame", -1.0f, 1.0f); + "Location", "Location of marker on frame", -1.0f, 1.0f); } /********************** delete track operator *********************/ @@ -251,9 +251,9 @@ void CLIP_OT_delete_marker(wmOperatorType *ot) /********************** slide marker operator *********************/ -#define SLIDE_ACTION_POS 0 -#define SLIDE_ACTION_SIZE 1 -#define SLIDE_ACTION_OFFSET 2 +#define SLIDE_ACTION_POS 0 +#define SLIDE_ACTION_SIZE 1 +#define SLIDE_ACTION_OFFSET 2 typedef struct { int area, action; @@ -271,7 +271,7 @@ typedef struct { static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, wmEvent *event, - int area, int corner, int action, int width, int height) + int area, int corner, int action, int width, int height) { SlideMarkerData *data = MEM_callocN(sizeof(SlideMarkerData), "slide marker data"); int framenr = ED_space_clip_clip_framenr(sc); @@ -301,7 +301,7 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra copy_v2_v2(data->soff, track->offset); - data->smarkers = MEM_callocN(sizeof(*data->smarkers)*track->markersnr, "slide marekrs"); + data->smarkers = MEM_callocN(sizeof(*data->smarkers) * track->markersnr, "slide marekrs"); for (a = 0; a < track->markersnr; a++) copy_v2_v2(data->smarkers[a], track->markers[a].pos); } @@ -318,7 +318,7 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra } if ((area == TRACK_AREA_SEARCH) || - (area == TRACK_AREA_PAT && action != SLIDE_ACTION_OFFSET)) + (area == TRACK_AREA_PAT && action != SLIDE_ACTION_OFFSET)) { if (data->corners) { memcpy(data->scorners, data->corners, sizeof(data->scorners)); @@ -647,7 +647,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) data->accurate = event->val == KM_PRESS; - /* no break! update area size */ + /* no break! update area size */ case MOUSEMOVE: mdelta[0] = event->mval[0] - data->mval[0]; @@ -807,7 +807,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot) /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, - "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX); + "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX); } /********************** mouse select operator *********************/ @@ -901,8 +901,8 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]) { float d1, d2, d3, d4; float p[2] = {co[0] - pos[0], co[1] - pos[1]}; - float *v1 = crns[0], *v2 = crns[1], - *v3 = crns[2], *v4 = crns[3]; + float *v1 = crns[0], *v2 = crns[1]; + float *v3 = crns[2], *v4 = crns[3]; d1 = dist_to_line_segment_v2(p, v1, v2); d2 = dist_to_line_segment_v2(p, v2, v3); @@ -927,7 +927,7 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas /* distance to marker point */ d1 = sqrtf((co[0] - marker->pos[0] - cur->offset[0]) * (co[0] - marker->pos[0] - cur->offset[0]) + - (co[1] - marker->pos[1] - cur->offset[1]) * (co[1] - marker->pos[1] - cur->offset[1])); + (co[1] - marker->pos[1] - cur->offset[1]) * (co[1] - marker->pos[1] - cur->offset[1])); /* distance to pattern boundbox */ if (sc->flag & SC_SHOW_MARKER_PATTERN) @@ -959,7 +959,7 @@ static int mouse_select(bContext *C, float co[2], int extend) MovieTracking *tracking = &clip->tracking; ListBase *tracksbase = BKE_tracking_get_tracks(tracking); MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking); - MovieTrackingTrack *track = NULL; /* selected marker */ + MovieTrackingTrack *track = NULL; /* selected marker */ track = find_nearest_track(sc, tracksbase, co); @@ -1053,9 +1053,9 @@ void CLIP_OT_select(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", 0, - "Extend", "Extend selection rather than clearing the existing selection"); + "Extend", "Extend selection rather than clearing the existing selection"); RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, - "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f); + "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f); } /********************** border select operator *********************/ @@ -1234,10 +1234,10 @@ static int marker_inside_ellipse(MovieTrackingMarker *marker, float offset[2], f /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */ float x, y; - x = (marker->pos[0] - offset[0])*ellipse[0]; - y = (marker->pos[1] - offset[1])*ellipse[1]; + x = (marker->pos[0] - offset[0]) * ellipse[0]; + y = (marker->pos[1] - offset[1]) * ellipse[1]; - return x*x + y*y < 1.0f; + return x * x + y * y < 1.0f; } static int circle_select_exec(bContext *C, wmOperator *op) @@ -1325,7 +1325,7 @@ static int select_all_exec(bContext *C, wmOperator *op) SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); MovieTracking *tracking = &clip->tracking; - MovieTrackingTrack *track = NULL; /* selected track */ + MovieTrackingTrack *track = NULL; /* selected track */ MovieTrackingMarker *marker; ListBase *tracksbase = BKE_tracking_get_tracks(tracking); int action = RNA_enum_get(op->ptr, "action"); @@ -1477,14 +1477,14 @@ static int select_groped_exec(bContext *C, wmOperator *op) void CLIP_OT_select_grouped(wmOperatorType *ot) { static EnumPropertyItem select_group_items[] = { - {0, "KEYFRAMED", 0, "Keyframed tracks", "Select all keyframed tracks"}, - {1, "ESTIMATED", 0, "Estimated tracks", "Select all estimated tracks"}, - {2, "TRACKED", 0, "Tracked tracks", "Select all tracked tracks"}, - {3, "LOCKED", 0, "Locked tracks", "Select all locked tracks"}, - {4, "DISABLED", 0, "Disabled tracks", "Select all disabled tracks"}, - {5, "COLOR", 0, "Tracks with same color", "Select all tracks with same color as active track"}, - {6, "FAILED", 0, "Failed Tracks", "Select all tracks which failed to be reconstructed"}, - {0, NULL, 0, NULL, NULL} + {0, "KEYFRAMED", 0, "Keyframed tracks", "Select all keyframed tracks"}, + {1, "ESTIMATED", 0, "Estimated tracks", "Select all estimated tracks"}, + {2, "TRACKED", 0, "Tracked tracks", "Select all tracked tracks"}, + {3, "LOCKED", 0, "Locked tracks", "Select all locked tracks"}, + {4, "DISABLED", 0, "Disabled tracks", "Select all disabled tracks"}, + {5, "COLOR", 0, "Tracks with same color", "Select all tracks with same color as active track"}, + {6, "FAILED", 0, "Failed Tracks", "Select all tracks which failed to be reconstructed"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -1506,11 +1506,11 @@ void CLIP_OT_select_grouped(wmOperatorType *ot) /********************** track operator *********************/ typedef struct TrackMarkersJob { - struct MovieTrackingContext *context; /* tracking context */ - int sfra, efra, lastfra; /* Start, end and recently tracked frames */ - int backwards; /* Backwards tracking flag */ - MovieClip *clip; /* Clip which is tracking */ - float delay; /* Delay in milliseconds to allow tracking at fixed FPS */ + struct MovieTrackingContext *context; /* tracking context */ + int sfra, efra, lastfra; /* Start, end and recently tracked frames */ + int backwards; /* Backwards tracking flag */ + MovieClip *clip; /* Clip which is tracking */ + float delay; /* Delay in milliseconds to allow tracking at fixed FPS */ struct Main *main; struct Scene *scene; @@ -1693,7 +1693,7 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo PIL_sleep_ms(tmj->delay - (float)exec_time); } else if (!BKE_tracking_next(tmj->context)) - break; + break; *do_update = TRUE; *progress = (float)(framenr - tmj->sfra) / (tmj->efra - tmj->sfra); @@ -1926,7 +1926,7 @@ static int solve_camera_initjob(bContext *C, SolveCameraJob *scj, wmOperator *op scj->user = sc->user; scj->context = BKE_tracking_reconstruction_context_new(tracking, object, - settings->keyframe1, settings->keyframe2, width, height); + settings->keyframe1, settings->keyframe2, width, height); tracking->stats = MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats"); @@ -1946,7 +1946,7 @@ static void solve_camera_startjob(void *scv, short *stop, short *do_update, floa SolveCameraJob *scj = (SolveCameraJob *)scv; BKE_tracking_solve_reconstruction(scj->context, stop, do_update, progress, - scj->stats_message, sizeof(scj->stats_message)); + scj->stats_message, sizeof(scj->stats_message)); } static void solve_camera_freejob(void *scv) @@ -1979,7 +1979,7 @@ static void solve_camera_freejob(void *scv) /* set blender camera focal length so result would look fine there */ if (scene->camera) { - Camera *camera = (Camera*)scene->camera->data; + Camera *camera = (Camera *)scene->camera->data; int width, height; BKE_movieclip_get_size(clip, &scj->user, &width, &height); @@ -2190,10 +2190,10 @@ static int clear_track_path_exec(bContext *C, wmOperator *op) void CLIP_OT_clear_track_path(wmOperatorType *ot) { static EnumPropertyItem clear_path_actions[] = { - {TRACK_CLEAR_UPTO, "UPTO", 0, "Clear up-to", "Clear path up to current frame"}, - {TRACK_CLEAR_REMAINED, "REMAINED", 0, "Clear remained", "Clear path at remaining frames (after current)"}, - {TRACK_CLEAR_ALL, "ALL", 0, "Clear all", "Clear the whole path"}, - {0, NULL, 0, NULL, NULL} + {TRACK_CLEAR_UPTO, "UPTO", 0, "Clear up-to", "Clear path up to current frame"}, + {TRACK_CLEAR_REMAINED, "REMAINED", 0, "Clear remained", "Clear path at remaining frames (after current)"}, + {TRACK_CLEAR_ALL, "ALL", 0, "Clear all", "Clear the whole path"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -2249,10 +2249,10 @@ static int disable_markers_exec(bContext *C, wmOperator *op) void CLIP_OT_disable_markers(wmOperatorType *ot) { static EnumPropertyItem actions_items[] = { - {0, "DISABLE", 0, "Disable", "Disable selected markers"}, - {1, "ENABLE", 0, "Enable", "Enable selected markers"}, - {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, - {0, NULL, 0, NULL, NULL} + {0, "DISABLE", 0, "Disable", "Disable selected markers"}, + {1, "ENABLE", 0, "Enable", "Enable selected markers"}, + {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -2498,11 +2498,11 @@ void CLIP_OT_set_origin(wmOperatorType *ot) /********************** set floor operator *********************/ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingObject *tracking_object, - MovieTrackingTrack *track, char axis) + MovieTrackingTrack *track, char axis) { Object *camera = get_camera_with_movieclip(scene, clip); int is_camera = tracking_object->flag & TRACKING_OBJECT_CAMERA; - int flip = FALSE; + int flip = FALSE; float mat[4][4], vec[3], obmat[4][4], dvec[3]; BKE_object_to_mat4(ob, obmat); @@ -2625,7 +2625,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) float rot[4][4] = {{0.0f, 0.0f, -1.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 0.0f, 0.0f}, - {0.0f, 0.0f, 0.0f, 1.0f}}; /* 90 degrees Y-axis rotation matrix */ + {0.0f, 0.0f, 0.0f, 1.0f}}; /* 90 degrees Y-axis rotation matrix */ if (count_selected_bundles(C) != 3) { BKE_report(op->reports, RPT_ERROR, "Three tracks with bundles are needed to orient the floor"); @@ -2723,9 +2723,9 @@ static int set_plane_exec(bContext *C, wmOperator *op) void CLIP_OT_set_plane(wmOperatorType *ot) { static EnumPropertyItem plane_items[] = { - {0, "FLOOR", 0, "Floor", "Set floor plane"}, - {1, "WALL", 0, "Wall", "Set wall plane"}, - {0, NULL, 0, NULL, NULL} + {0, "FLOOR", 0, "Floor", "Set floor plane"}, + {1, "WALL", 0, "Wall", "Set wall plane"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -2795,9 +2795,9 @@ static int set_axis_exec(bContext *C, wmOperator *op) void CLIP_OT_set_axis(wmOperatorType *ot) { static EnumPropertyItem axis_actions[] = { - {0, "X", 0, "X", "Align bundle align X axis"}, - {1, "Y", 0, "Y", "Align bundle align Y axis"}, - {0, NULL, 0, NULL, NULL} + {0, "X", 0, "X", "Align bundle align X axis"}, + {1, "Y", 0, "Y", "Align bundle align Y axis"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -2927,7 +2927,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot) /* properties */ RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX, - "Distance", "Distance between selected tracks", -100.0f, 100.0f); + "Distance", "Distance between selected tracks", -100.0f, 100.0f); } /********************** set solution scale operator *********************/ @@ -2983,7 +2983,7 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot) /* properties */ RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX, - "Distance", "Distance between selected tracks", -100.0f, 100.0f); + "Distance", "Distance between selected tracks", -100.0f, 100.0f); } /********************** set principal center operator *********************/ @@ -3177,7 +3177,7 @@ static int detect_features_exec(bContext *C, wmOperator *op) } BKE_tracking_detect_fast(tracking, tracksbase, ibuf, framenr, margin, - min_trackability, min_distance, layer, place_outside_layer); + min_trackability, min_distance, layer, place_outside_layer); IMB_freeImBuf(ibuf); @@ -3189,10 +3189,10 @@ static int detect_features_exec(bContext *C, wmOperator *op) void CLIP_OT_detect_features(wmOperatorType *ot) { static EnumPropertyItem placement_items[] = { - {0, "FRAME", 0, "Whole Frame", "Place markers across the whole frame"}, - {1, "INSIDE_GPENCIL", 0, "Inside grease pencil", "Place markers only inside areas outlined with grease pencil"}, - {2, "OUTSIDE_GPENCIL", 0, "Outside grease pencil", "Place markers only outside areas outlined with grease pencil"}, - {0, NULL, 0, NULL, NULL} + {0, "FRAME", 0, "Whole Frame", "Place markers across the whole frame"}, + {1, "INSIDE_GPENCIL", 0, "Inside grease pencil", "Place markers only inside areas outlined with grease pencil"}, + {2, "OUTSIDE_GPENCIL", 0, "Outside grease pencil", "Place markers only outside areas outlined with grease pencil"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -3225,7 +3225,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) int pos = RNA_enum_get(op->ptr, "position"); int delta; - if (pos <= 1) { /* jump to path */ + if (pos <= 1) { /* jump to path */ track = BKE_tracking_active_track(&clip->tracking); if (!track) @@ -3243,7 +3243,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) sc->user.framenr += delta; } } - else { /* to to failed frame */ + else { /* to to failed frame */ if (clip->tracking.reconstruction.flag & TRACKING_RECONSTRUCTED) { int a = ED_space_clip_clip_framenr(sc); MovieTracking *tracking = &clip->tracking; @@ -3284,11 +3284,11 @@ static int frame_jump_exec(bContext *C, wmOperator *op) void CLIP_OT_frame_jump(wmOperatorType *ot) { static EnumPropertyItem position_items[] = { - {0, "PATHSTART", 0, "Path Start", "Jump to start of current path"}, - {1, "PATHEND", 0, "Path End", "Jump to end of current path"}, - {2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"}, - {2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"}, - {0, NULL, 0, NULL, NULL} + {0, "PATHSTART", 0, "Path Start", "Jump to start of current path"}, + {1, "PATHEND", 0, "Path End", "Jump to end of current path"}, + {2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"}, + {2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -3392,10 +3392,10 @@ static int lock_tracks_exec(bContext *C, wmOperator *op) void CLIP_OT_lock_tracks(wmOperatorType *ot) { static EnumPropertyItem actions_items[] = { - {0, "LOCK", 0, "Lock", "Lock selected tracks"}, - {1, "UNLOCK", 0, "Unlock", "Unlock selected tracks"}, - {2, "TOGGLE", 0, "Toggle", "Toggle locked flag for selected tracks"}, - {0, NULL, 0, NULL, NULL} + {0, "LOCK", 0, "Lock", "Lock selected tracks"}, + {1, "UNLOCK", 0, "Unlock", "Unlock selected tracks"}, + {2, "TOGGLE", 0, "Toggle", "Toggle locked flag for selected tracks"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ @@ -3660,7 +3660,7 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del) int markersnr = track->markersnr; if (del) - new_markers = MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers"); + new_markers = MEM_callocN(markersnr * sizeof(MovieTrackingMarker), "track cleaned markers"); for (a = 0; a < markersnr; a++) { int end = 0; @@ -3767,7 +3767,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op) int ok = 1; ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) && - (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE) == 0 || track->error < error); + (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE) == 0 || track->error < error); if (!ok) { if (action == TRACKING_CLEAN_SELECT) { @@ -3821,10 +3821,10 @@ static int clean_tracks_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even void CLIP_OT_clean_tracks(wmOperatorType *ot) { static EnumPropertyItem actions_items[] = { - {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"}, - {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"}, - {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"}, - {0, NULL, 0, NULL, NULL} + {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"}, + {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"}, + {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"}, + {0, NULL, 0, NULL, NULL} }; /* identifiers */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d41294c7875..3710ef1d30d 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -51,7 +51,7 @@ #include "DNA_meshdata_types.h" #include "DNA_mask_types.h" #include "DNA_movieclip_types.h" -#include "DNA_scene_types.h" /* PET modes */ +#include "DNA_scene_types.h" /* PET modes */ #include "RNA_access.h" @@ -105,7 +105,7 @@ static int doEdgeSlide(TransInfo *t, float perc); void setTransformViewMatrices(TransInfo *t) { - if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { + if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = t->ar->regiondata; copy_m4_m4(t->viewmat, rv3d->viewmat); @@ -129,12 +129,12 @@ static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy) { float divx, divy; - divx= v2d->mask.xmax - v2d->mask.xmin; - divy= v2d->mask.ymax - v2d->mask.ymin; + divx = v2d->mask.xmax - v2d->mask.xmin; + divy = v2d->mask.ymax - v2d->mask.ymin; - vec[0]= (v2d->cur.xmax - v2d->cur.xmin) * dx / divx; - vec[1]= (v2d->cur.ymax - v2d->cur.ymin) * dy / divy; - vec[2]= 0.0f; + vec[0] = (v2d->cur.xmax - v2d->cur.xmin) * dx / divx; + vec[1] = (v2d->cur.ymax - v2d->cur.ymin) * dy / divy; + vec[2] = 0.0f; } void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) @@ -145,7 +145,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) mval_f[1] = dy; ED_view3d_win_to_delta(t->ar, mval_f, r_vec); } - else if (t->spacetype==SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { float aspx, aspy; convertViewVec2D(t->view, r_vec, dx, dy); @@ -160,17 +160,17 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) { convertViewVec2D(&t->ar->v2d, r_vec, dx, dy); } - else if (t->spacetype==SPACE_CLIP) { + else if (t->spacetype == SPACE_CLIP) { View2D *v2d = t->view; float divx, divy; float mulx, muly; float aspx = 1.0f, aspy = 1.0f; - divx = v2d->mask.xmax-v2d->mask.xmin; - divy = v2d->mask.ymax-v2d->mask.ymin; + divx = v2d->mask.xmax - v2d->mask.xmin; + divy = v2d->mask.ymax - v2d->mask.ymin; - mulx = (v2d->cur.xmax-v2d->cur.xmin); - muly = (v2d->cur.ymax-v2d->cur.ymin); + mulx = (v2d->cur.xmax - v2d->cur.xmin); + muly = (v2d->cur.ymax - v2d->cur.ymin); if (t->options & CTX_MASK) { /* clamp w/h, mask only */ @@ -201,18 +201,18 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) void projectIntView(TransInfo *t, const float vec[3], int adr[2]) { - if (t->spacetype==SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { if (t->ar->regiontype == RGN_TYPE_WINDOW) project_int_noclip(t->ar, vec, adr); } - else if (t->spacetype==SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { float aspx, aspy, v[2]; ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); - v[0]= vec[0]/aspx; - v[1]= vec[1]/aspy; + v[0] = vec[0] / aspx; + v[1] = vec[1] / aspy; - UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1); + UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1); } else if (t->spacetype == SPACE_ACTION) { int out[2] = {0, 0}; @@ -222,32 +222,32 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) if (sact->flag & SACTION_DRAWTIME) { //vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base)); /* same as below */ - UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); + UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1); } else #endif { - UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); + UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1); } - adr[0]= out[0]; - adr[1]= out[1]; + adr[0] = out[0]; + adr[1] = out[1]; } else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) { int out[2] = {0, 0}; - UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); - adr[0]= out[0]; - adr[1]= out[1]; + UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1); + adr[0] = out[0]; + adr[1] = out[1]; } - else if (t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */ + else if (t->spacetype == SPACE_SEQ) { /* XXX not tested yet, but should work */ int out[2] = {0, 0}; - UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1); - adr[0]= out[0]; - adr[1]= out[1]; + UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out + 1); + adr[0] = out[0]; + adr[1] = out[1]; } - else if (t->spacetype==SPACE_CLIP) { + else if (t->spacetype == SPACE_CLIP) { float v[2]; float aspx = 1.0f, aspy = 1.0f; @@ -261,7 +261,7 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) v[0] /= aspx; v[1] /= aspy; - UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1); + UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1); } } @@ -294,11 +294,11 @@ void projectFloatView(TransInfo *t, const float vec[3], float adr[2]) void applyAspectRatio(TransInfo *t, float vec[2]) { - if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) { - SpaceImage *sima= t->sa->spacedata.first; + if ((t->spacetype == SPACE_IMAGE) && (t->mode == TFM_TRANSLATION)) { + SpaceImage *sima = t->sa->spacedata.first; float aspx, aspy; - if ((sima->flag & SI_COORDFLOATS)==0) { + if ((sima->flag & SI_COORDFLOATS) == 0) { int width, height; ED_space_image_size(sima, &width, &height); @@ -310,7 +310,7 @@ void applyAspectRatio(TransInfo *t, float vec[2]) vec[0] /= aspx; vec[1] /= aspy; } - else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) { + else if ((t->spacetype == SPACE_CLIP) && (t->mode == TFM_TRANSLATION)) { if (t->options & (CTX_MOVIECLIP | CTX_MASK)) { SpaceClip *sc = t->sa->spacedata.first; float aspx, aspy; @@ -334,11 +334,11 @@ void applyAspectRatio(TransInfo *t, float vec[2]) void removeAspectRatio(TransInfo *t, float vec[2]) { - if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) { - SpaceImage *sima= t->sa->spacedata.first; + if ((t->spacetype == SPACE_IMAGE) && (t->mode == TFM_TRANSLATION)) { + SpaceImage *sima = t->sa->spacedata.first; float aspx, aspy; - if ((sima->flag & SI_COORDFLOATS)==0) { + if ((sima->flag & SI_COORDFLOATS) == 0) { int width, height; ED_space_image_size(sima, &width, &height); @@ -350,7 +350,7 @@ void removeAspectRatio(TransInfo *t, float vec[2]) vec[0] *= aspx; vec[1] *= aspy; } - else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) { + else if ((t->spacetype == SPACE_CLIP) && (t->mode == TFM_TRANSLATION)) { if (t->options & (CTX_MOVIECLIP | CTX_MASK)) { SpaceClip *sc = t->sa->spacedata.first; float aspx = 1.0f, aspy = 1.0f; @@ -373,55 +373,55 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { /* Do we need more refined tags? */ if (t->flag & T_POSE) - WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); else - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); /* for realtime animation record - send notifiers recognised by animation editors */ // XXX: is this notifier a lame duck? if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) - WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL); } else if (t->spacetype == SPACE_ACTION) { //SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } else if (t->spacetype == SPACE_IPO) { //SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; - WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } else if (t->spacetype == SPACE_NLA) { - WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); } else if (t->spacetype == SPACE_NODE) { //ED_area_tag_redraw(t->sa); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); } else if (t->spacetype == SPACE_SEQ) { - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL); } - else if (t->spacetype==SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { // XXX how to deal with lock? - SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first; - if (sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data); + SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; + if (sima->lock) WM_event_add_notifier(C, NC_GEOM | ND_DATA, t->obedit->data); else ED_area_tag_redraw(t->sa); } - else if (t->spacetype==SPACE_CLIP) { - SpaceClip *sc = (SpaceClip*)t->sa->spacedata.first; + else if (t->spacetype == SPACE_CLIP) { + SpaceClip *sc = (SpaceClip *)t->sa->spacedata.first; if (ED_space_clip_show_trackedit(sc)) { MovieClip *clip = ED_space_clip(sc); /* objects could be parented to tracking data, so send this for viewport refresh */ - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); - WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip); + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); } else if (ED_space_clip_show_maskedit(sc)) { Mask *mask = ED_space_clip_mask(sc); - WM_event_add_notifier(C, NC_MASK|NA_EDITED, mask); + WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); } } } @@ -433,19 +433,19 @@ static void viewRedrawPost(bContext *C, TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { /* if autokeying is enabled, send notifiers that keyframes were added */ if (IS_AUTOKEY_ON(t->scene)) - WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); /* XXX temp, first hack to get auto-render in compositor work (ton) */ - WM_event_add_notifier(C, NC_SCENE|ND_TRANSFORM_DONE, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C)); } #if 0 // TRANSFORM_FIX_ME - if (t->spacetype==SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { allqueue(REDRAWBUTSOBJECT, 0); allqueue(REDRAWVIEW3D, 0); } - else if (t->spacetype==SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { allqueue(REDRAWIMAGE, 0); allqueue(REDRAWVIEW3D, 0); } @@ -469,7 +469,7 @@ void BIF_selectOrientation(void) #if 0 // TRANSFORM_FIX_ME short val; char *str_menu = BIF_menustringTransformOrientation("Orientation"); - val= pupmenu(str_menu); + val = pupmenu(str_menu); MEM_freeN(str_menu); if (val >= 0) { @@ -497,8 +497,8 @@ static void view_editmove(unsigned short UNUSED(event)) switch (event) { case WHEELUPMOUSE: - if ( G.qual & LR_SHIFTKEY ) { - if ( G.qual & LR_ALTKEY ) { + if (G.qual & LR_SHIFTKEY) { + if (G.qual & LR_ALTKEY) { G.qual &= ~LR_SHIFTKEY; persptoetsen(PAD2); G.qual |= LR_SHIFTKEY; @@ -507,8 +507,8 @@ static void view_editmove(unsigned short UNUSED(event)) persptoetsen(PAD2); } } - else if ( G.qual & LR_CTRLKEY ) { - if ( G.qual & LR_ALTKEY ) { + else if (G.qual & LR_CTRLKEY) { + if (G.qual & LR_ALTKEY) { G.qual &= ~LR_CTRLKEY; persptoetsen(PAD4); G.qual |= LR_CTRLKEY; @@ -525,8 +525,8 @@ static void view_editmove(unsigned short UNUSED(event)) refresh = 1; break; case WHEELDOWNMOUSE: - if ( G.qual & LR_SHIFTKEY ) { - if ( G.qual & LR_ALTKEY ) { + if (G.qual & LR_SHIFTKEY) { + if (G.qual & LR_ALTKEY) { G.qual &= ~LR_SHIFTKEY; persptoetsen(PAD8); G.qual |= LR_SHIFTKEY; @@ -535,8 +535,8 @@ static void view_editmove(unsigned short UNUSED(event)) persptoetsen(PAD8); } } - else if ( G.qual & LR_CTRLKEY ) { - if ( G.qual & LR_ALTKEY ) { + else if (G.qual & LR_CTRLKEY) { + if (G.qual & LR_ALTKEY) { G.qual &= ~LR_CTRLKEY; persptoetsen(PAD6); G.qual |= LR_CTRLKEY; @@ -562,27 +562,27 @@ static void view_editmove(unsigned short UNUSED(event)) /* ************************************************* */ /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -#define TFM_MODAL_CANCEL 1 -#define TFM_MODAL_CONFIRM 2 -#define TFM_MODAL_TRANSLATE 3 -#define TFM_MODAL_ROTATE 4 -#define TFM_MODAL_RESIZE 5 -#define TFM_MODAL_SNAP_INV_ON 6 -#define TFM_MODAL_SNAP_INV_OFF 7 -#define TFM_MODAL_SNAP_TOGGLE 8 -#define TFM_MODAL_AXIS_X 9 -#define TFM_MODAL_AXIS_Y 10 -#define TFM_MODAL_AXIS_Z 11 -#define TFM_MODAL_PLANE_X 12 -#define TFM_MODAL_PLANE_Y 13 -#define TFM_MODAL_PLANE_Z 14 -#define TFM_MODAL_CONS_OFF 15 -#define TFM_MODAL_ADD_SNAP 16 -#define TFM_MODAL_REMOVE_SNAP 17 +#define TFM_MODAL_CANCEL 1 +#define TFM_MODAL_CONFIRM 2 +#define TFM_MODAL_TRANSLATE 3 +#define TFM_MODAL_ROTATE 4 +#define TFM_MODAL_RESIZE 5 +#define TFM_MODAL_SNAP_INV_ON 6 +#define TFM_MODAL_SNAP_INV_OFF 7 +#define TFM_MODAL_SNAP_TOGGLE 8 +#define TFM_MODAL_AXIS_X 9 +#define TFM_MODAL_AXIS_Y 10 +#define TFM_MODAL_AXIS_Z 11 +#define TFM_MODAL_PLANE_X 12 +#define TFM_MODAL_PLANE_Y 13 +#define TFM_MODAL_PLANE_Z 14 +#define TFM_MODAL_CONS_OFF 15 +#define TFM_MODAL_ADD_SNAP 16 +#define TFM_MODAL_REMOVE_SNAP 17 /* 18 and 19 used by numinput, defined in transform.h * */ -#define TFM_MODAL_PROPSIZE_UP 20 -#define TFM_MODAL_PROPSIZE_DOWN 21 +#define TFM_MODAL_PROPSIZE_UP 20 +#define TFM_MODAL_PROPSIZE_DOWN 21 #define TFM_MODAL_AUTOIK_LEN_INC 22 #define TFM_MODAL_AUTOIK_LEN_DEC 23 @@ -590,42 +590,43 @@ static void view_editmove(unsigned short UNUSED(event)) #define TFM_MODAL_EDGESLIDE_DOWN 25 /* called in transform_ops.c, on each regeneration of keymaps */ -wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) +wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, - {TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, - {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, - {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, - {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, - {TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Invert Snap On", ""}, - {TFM_MODAL_SNAP_INV_OFF, "SNAP_INV_OFF", 0, "Invert Snap Off", ""}, - {TFM_MODAL_SNAP_TOGGLE, "SNAP_TOGGLE", 0, "Snap Toggle", ""}, - {TFM_MODAL_AXIS_X, "AXIS_X", 0, "Orientation X axis", ""}, - {TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Orientation Y axis", ""}, - {TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Orientation Z axis", ""}, - {TFM_MODAL_PLANE_X, "PLANE_X", 0, "Orientation X plane", ""}, - {TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Orientation Y plane", ""}, - {TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Orientation Z plane", ""}, - {TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Remove Constraints", ""}, - {TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""}, - {TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""}, - {NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""}, - {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, - {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, - {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Proportional Influence", ""}, - {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, - {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, - {TFM_MODAL_EDGESLIDE_UP, "EDGESLIDE_EDGE_NEXT", 0, "Select next Edge Slide Edge", ""}, - {TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""}, - {0, NULL, 0, NULL, NULL}}; - - wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map"); + {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, + {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, + {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, + {TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Invert Snap On", ""}, + {TFM_MODAL_SNAP_INV_OFF, "SNAP_INV_OFF", 0, "Invert Snap Off", ""}, + {TFM_MODAL_SNAP_TOGGLE, "SNAP_TOGGLE", 0, "Snap Toggle", ""}, + {TFM_MODAL_AXIS_X, "AXIS_X", 0, "Orientation X axis", ""}, + {TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Orientation Y axis", ""}, + {TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Orientation Z axis", ""}, + {TFM_MODAL_PLANE_X, "PLANE_X", 0, "Orientation X plane", ""}, + {TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Orientation Y plane", ""}, + {TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Orientation Z plane", ""}, + {TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Remove Constraints", ""}, + {TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""}, + {TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""}, + {NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""}, + {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, + {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, + {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Proportional Influence", ""}, + {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, + {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, + {TFM_MODAL_EDGESLIDE_UP, "EDGESLIDE_EDGE_NEXT", 0, "Select next Edge Slide Edge", ""}, + {TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""}, + {0, NULL, 0, NULL, NULL} + }; + + wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map"); /* this function is called for each spacetype, only needs to add map once */ if (keymap && keymap->modal_items) return NULL; - keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); + keymap = WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); /* items for modal map */ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); @@ -695,8 +696,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm msg1[sizeof(msg1) - 2] = axis; msg2[sizeof(msg2) - 2] = axis; msg3[sizeof(msg3) - 2] = axis; - constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & - (~constraint_axis)); + constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis)); if (edit_2d && (key_type != ZKEY)) { if (cmode == axis) { @@ -733,7 +733,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm int transformEvent(TransInfo *t, wmEvent *event) { - float mati[3][3]= MAT3_UNITY; + float mati[3][3] = MAT3_UNITY; char cmode = constraintModeToChar(t); int handled = 1; @@ -770,7 +770,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_TRANSLATE: /* only switch when... */ - if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { + if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initTranslation(t); @@ -789,7 +789,7 @@ int transformEvent(TransInfo *t, wmEvent *event) case TFM_MODAL_ROTATE: /* only switch when... */ if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) { - if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { + if (ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { resetTransRestrictions(t); @@ -808,7 +808,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_RESIZE: /* only switch when... */ - if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { + if (ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { resetTransRestrictions(t); restoreTransObjects(t); initResize(t); @@ -838,7 +838,7 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= TREDRAW_HARD; break; case TFM_MODAL_AXIS_X: - if ((t->flag & T_NO_CONSTRAINT)==0) { + if ((t->flag & T_NO_CONSTRAINT) == 0) { if (cmode == 'X') { stopConstraint(t); } @@ -854,7 +854,7 @@ int transformEvent(TransInfo *t, wmEvent *event) } break; case TFM_MODAL_AXIS_Y: - if ((t->flag & T_NO_CONSTRAINT)==0) { + if ((t->flag & T_NO_CONSTRAINT) == 0) { if (cmode == 'Y') { stopConstraint(t); } @@ -870,7 +870,7 @@ int transformEvent(TransInfo *t, wmEvent *event) } break; case TFM_MODAL_AXIS_Z: - if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) { + if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { if (cmode == 'Z') { stopConstraint(t); } @@ -881,40 +881,40 @@ int transformEvent(TransInfo *t, wmEvent *event) } break; case TFM_MODAL_PLANE_X: - if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) { + if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { if (cmode == 'X') { stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS1|CON_AXIS2), "locking %s X"); + setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), "locking %s X"); } t->redraw |= TREDRAW_HARD; } break; case TFM_MODAL_PLANE_Y: - if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) { + if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { if (cmode == 'Y') { stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y"); + setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), "locking %s Y"); } t->redraw |= TREDRAW_HARD; } break; case TFM_MODAL_PLANE_Z: - if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) { + if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) { if (cmode == 'Z') { stopConstraint(t); } else { - setUserConstraint(t, t->current_orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z"); + setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), "locking %s Z"); } t->redraw |= TREDRAW_HARD; } break; case TFM_MODAL_CONS_OFF: - if ((t->flag & T_NO_CONSTRAINT)==0) { + if ((t->flag & T_NO_CONSTRAINT) == 0) { stopConstraint(t); t->redraw |= TREDRAW_HARD; } @@ -929,16 +929,16 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_PROPSIZE_UP: if (t->flag & T_PROP_EDIT) { - t->prop_size*= 1.1f; - if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far); + t->prop_size *= 1.1f; + if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) + t->prop_size = MIN2(t->prop_size, ((View3D *)t->view)->far); calculatePropRatio(t); } t->redraw |= TREDRAW_HARD; break; case TFM_MODAL_PROPSIZE_DOWN: if (t->flag & T_PROP_EDIT) { - t->prop_size*= 0.90909090f; + t->prop_size *= 0.90909090f; calculatePropRatio(t); } t->redraw |= TREDRAW_HARD; @@ -968,170 +968,170 @@ int transformEvent(TransInfo *t, wmEvent *event) /* else do non-mapped events */ else if (event->val == KM_PRESS) { switch (event->type) { - case RIGHTMOUSE: - t->state = TRANS_CANCEL; - break; - /* enforce redraw of transform when modifiers are used */ - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: - t->modifiers |= MOD_CONSTRAINT_PLANE; - t->redraw |= TREDRAW_HARD; - break; + case RIGHTMOUSE: + t->state = TRANS_CANCEL; + break; + /* enforce redraw of transform when modifiers are used */ + case LEFTSHIFTKEY: + case RIGHTSHIFTKEY: + t->modifiers |= MOD_CONSTRAINT_PLANE; + t->redraw |= TREDRAW_HARD; + break; - case SPACEKEY: - if ((t->spacetype==SPACE_VIEW3D) && event->alt) { + case SPACEKEY: + if ((t->spacetype == SPACE_VIEW3D) && event->alt) { #if 0 // TRANSFORM_FIX_ME - int mval[2]; + int mval[2]; - getmouseco_sc(mval); - BIF_selectOrientation(); - calc_manipulator_stats(curarea); - copy_m3_m4(t->spacemtx, G.vd->twmat); - warp_pointer(mval[0], mval[1]); + getmouseco_sc(mval); + BIF_selectOrientation(); + calc_manipulator_stats(curarea); + copy_m3_m4(t->spacemtx, G.vd->twmat); + warp_pointer(mval[0], mval[1]); #endif - } - else { - t->state = TRANS_CONFIRM; - } - break; - - case MIDDLEMOUSE: - if ((t->flag & T_NO_CONSTRAINT)==0) { - /* exception for switching to dolly, or trackball, in camera view */ - if (t->flag & T_CAMERA) { - if (t->mode==TFM_TRANSLATION) - setLocalConstraint(t, (CON_AXIS2), "along local Z"); - else if (t->mode==TFM_ROTATION) { - restoreTransObjects(t); - initTrackball(t); - } } else { - t->modifiers |= MOD_CONSTRAINT_SELECT; - if (t->con.mode & CON_APPLY) { - stopConstraint(t); + t->state = TRANS_CONFIRM; + } + break; + + case MIDDLEMOUSE: + if ((t->flag & T_NO_CONSTRAINT) == 0) { + /* exception for switching to dolly, or trackball, in camera view */ + if (t->flag & T_CAMERA) { + if (t->mode == TFM_TRANSLATION) + setLocalConstraint(t, (CON_AXIS2), "along local Z"); + else if (t->mode == TFM_ROTATION) { + restoreTransObjects(t); + initTrackball(t); + } } else { - if (event->shift) { - initSelectConstraint(t, t->spacemtx); + t->modifiers |= MOD_CONSTRAINT_SELECT; + if (t->con.mode & CON_APPLY) { + stopConstraint(t); } else { - /* bit hackish... but it prevents mmb select to print the orientation from menu */ - strcpy(t->spacename, "global"); - initSelectConstraint(t, mati); + if (event->shift) { + initSelectConstraint(t, t->spacemtx); + } + else { + /* bit hackish... but it prevents mmb select to print the orientation from menu */ + strcpy(t->spacename, "global"); + initSelectConstraint(t, mati); + } + postSelectConstraint(t); } - postSelectConstraint(t); } + t->redraw |= TREDRAW_HARD; } - t->redraw |= TREDRAW_HARD; - } - break; - case ESCKEY: - t->state = TRANS_CANCEL; - break; - case PADENTER: - case RETKEY: - t->state = TRANS_CONFIRM; - break; - case GKEY: - /* only switch when... */ - if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { - resetTransRestrictions(t); - restoreTransObjects(t); - initTranslation(t); - initSnapping(t, NULL); // need to reinit after mode change - t->redraw |= TREDRAW_HARD; - } - break; - case SKEY: - /* only switch when... */ - if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { - resetTransRestrictions(t); - restoreTransObjects(t); - initResize(t); - initSnapping(t, NULL); // need to reinit after mode change - t->redraw |= TREDRAW_HARD; - } - break; - case RKEY: - /* only switch when... */ - if (!(t->options & CTX_TEXTURE)) { - if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { - + break; + case ESCKEY: + t->state = TRANS_CANCEL; + break; + case PADENTER: + case RETKEY: + t->state = TRANS_CONFIRM; + break; + case GKEY: + /* only switch when... */ + if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { + resetTransRestrictions(t); + restoreTransObjects(t); + initTranslation(t); + initSnapping(t, NULL); // need to reinit after mode change + t->redraw |= TREDRAW_HARD; + } + break; + case SKEY: + /* only switch when... */ + if (ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) { resetTransRestrictions(t); + restoreTransObjects(t); + initResize(t); + initSnapping(t, NULL); // need to reinit after mode change + t->redraw |= TREDRAW_HARD; + } + break; + case RKEY: + /* only switch when... */ + if (!(t->options & CTX_TEXTURE)) { + if (ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) { - if (t->mode == TFM_ROTATION) { - restoreTransObjects(t); - initTrackball(t); - } - else { - restoreTransObjects(t); - initRotation(t); + resetTransRestrictions(t); + + if (t->mode == TFM_ROTATION) { + restoreTransObjects(t); + initTrackball(t); + } + else { + restoreTransObjects(t); + initRotation(t); + } + initSnapping(t, NULL); // need to reinit after mode change + t->redraw |= TREDRAW_HARD; } - initSnapping(t, NULL); // need to reinit after mode change + } + break; + case CKEY: + if (event->alt) { + t->flag ^= T_PROP_CONNECTED; + sort_trans_data_dist(t); + calculatePropRatio(t); + t->redraw = 1; + } + else { + stopConstraint(t); t->redraw |= TREDRAW_HARD; } - } - break; - case CKEY: - if (event->alt) { - t->flag ^= T_PROP_CONNECTED; - sort_trans_data_dist(t); - calculatePropRatio(t); - t->redraw= 1; - } - else { - stopConstraint(t); - t->redraw |= TREDRAW_HARD; - } - break; - case XKEY: - case YKEY: - case ZKEY: - transform_event_xyz_constraint(t, event->type, cmode); - break; - case OKEY: - if (t->flag & T_PROP_EDIT && event->shift) { - t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX; - calculatePropRatio(t); - t->redraw |= TREDRAW_HARD; - } - break; - case PADPLUSKEY: - if (event->alt && t->flag & T_PROP_EDIT) { - t->prop_size *= 1.1f; - if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO) - t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far); - calculatePropRatio(t); - } - t->redraw= 1; - break; - case PAGEUPKEY: - case WHEELDOWNMOUSE: - if (t->flag & T_AUTOIK) { - transform_autoik_update(t, 1); - } - else view_editmove(event->type); - t->redraw= 1; - break; - case PADMINUS: - if (event->alt && t->flag & T_PROP_EDIT) { - t->prop_size*= 0.90909090f; - calculatePropRatio(t); - } - t->redraw= 1; - break; - case PAGEDOWNKEY: - case WHEELUPMOUSE: - if (t->flag & T_AUTOIK) { - transform_autoik_update(t, -1); - } - else view_editmove(event->type); - t->redraw= 1; - break; - default: - handled = 0; - break; + break; + case XKEY: + case YKEY: + case ZKEY: + transform_event_xyz_constraint(t, event->type, cmode); + break; + case OKEY: + if (t->flag & T_PROP_EDIT && event->shift) { + t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX; + calculatePropRatio(t); + t->redraw |= TREDRAW_HARD; + } + break; + case PADPLUSKEY: + if (event->alt && t->flag & T_PROP_EDIT) { + t->prop_size *= 1.1f; + if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) + t->prop_size = MIN2(t->prop_size, ((View3D *)t->view)->far); + calculatePropRatio(t); + } + t->redraw = 1; + break; + case PAGEUPKEY: + case WHEELDOWNMOUSE: + if (t->flag & T_AUTOIK) { + transform_autoik_update(t, 1); + } + else view_editmove(event->type); + t->redraw = 1; + break; + case PADMINUS: + if (event->alt && t->flag & T_PROP_EDIT) { + t->prop_size *= 0.90909090f; + calculatePropRatio(t); + } + t->redraw = 1; + break; + case PAGEDOWNKEY: + case WHEELUPMOUSE: + if (t->flag & T_AUTOIK) { + transform_autoik_update(t, -1); + } + else view_editmove(event->type); + t->redraw = 1; + break; + default: + handled = 0; + break; } // Numerical input events @@ -1141,30 +1141,30 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= handleSnapping(t, event); } - else if (event->val==KM_RELEASE) { + else if (event->val == KM_RELEASE) { switch (event->type) { - case LEFTSHIFTKEY: - case RIGHTSHIFTKEY: - t->modifiers &= ~MOD_CONSTRAINT_PLANE; - t->redraw |= TREDRAW_HARD; - break; - - case MIDDLEMOUSE: - if ((t->flag & T_NO_CONSTRAINT)==0) { - t->modifiers &= ~MOD_CONSTRAINT_SELECT; - postSelectConstraint(t); + case LEFTSHIFTKEY: + case RIGHTSHIFTKEY: + t->modifiers &= ~MOD_CONSTRAINT_PLANE; t->redraw |= TREDRAW_HARD; - } - break; + break; + + case MIDDLEMOUSE: + if ((t->flag & T_NO_CONSTRAINT) == 0) { + t->modifiers &= ~MOD_CONSTRAINT_SELECT; + postSelectConstraint(t); + t->redraw |= TREDRAW_HARD; + } + break; // case LEFTMOUSE: // case RIGHTMOUSE: // if (WM_modal_tweak_exit(event, t->event_type)) //// if (t->options & CTX_TWEAK) // t->state = TRANS_CONFIRM; // break; - default: - handled = 0; - break; + default: + handled = 0; + break; } /* confirm transform if launch key is released after mouse move */ @@ -1197,11 +1197,11 @@ int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], int c t->mode = TFM_DUMMY; - initTransInfo(C, t, NULL, NULL); // internal data, mouse, vectors + initTransInfo(C, t, NULL, NULL); // internal data, mouse, vectors - createTransData(C, t); // make TransData structs from selection + createTransData(C, t); // make TransData structs from selection - t->around = centerMode; // override userdefined mode + t->around = centerMode; // override userdefined mode if (t->total == 0) { success = FALSE; @@ -1305,7 +1305,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments glBegin(GL_LINE_STRIP); - for ( angle = angle_start; angle < angle_end; angle += delta) { + for (angle = angle_start; angle < angle_end; angle += delta) { glVertex2f(cosf(angle) * size, sinf(angle) * size); } glVertex2f(cosf(angle_end) * size, sinf(angle_end) * size); @@ -1315,35 +1315,35 @@ static void drawArc(float size, float angle_start, float angle_end, int segments static int helpline_poll(bContext *C) { - ARegion *ar= CTX_wm_region(C); + ARegion *ar = CTX_wm_region(C); - if (ar && ar->regiontype==RGN_TYPE_WINDOW) + if (ar && ar->regiontype == RGN_TYPE_WINDOW) return 1; return 0; } static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) { - TransInfo *t = (TransInfo*)customdata; + TransInfo *t = (TransInfo *)customdata; if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) { float vecrot[3], cent[2]; int mval[2]; - mval[0]= x; - mval[1]= y; + mval[0] = x; + mval[1] = y; copy_v3_v3(vecrot, t->center); if (t->flag & T_EDIT) { - Object *ob= t->obedit; + Object *ob = t->obedit; if (ob) mul_m4_v3(ob->obmat, vecrot); } else if (t->flag & T_POSE) { - Object *ob=t->poseobj; + Object *ob = t->poseobj; if (ob) mul_m4_v3(ob->obmat, vecrot); } - projectFloatView(t, vecrot, cent); // no overflow in extreme cases + projectFloatView(t, vecrot, cent); // no overflow in extreme cases glPushMatrix(); @@ -1388,67 +1388,67 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) glLineWidth(1.0); break; case HLP_ANGLE: - { - float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; - float angle = atan2f(dy, dx); - float dist = sqrtf(dx*dx + dy*dy); - float delta_angle = MIN2(15.0f / dist, (float)M_PI/4.0f); - float spacing_angle = MIN2(5.0f / dist, (float)M_PI/12.0f); - UI_ThemeColor(TH_WIRE); + { + float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; + float angle = atan2f(dy, dx); + float dist = sqrtf(dx * dx + dy * dy); + float delta_angle = MIN2(15.0f / dist, (float)M_PI / 4.0f); + float spacing_angle = MIN2(5.0f / dist, (float)M_PI / 12.0f); + UI_ThemeColor(TH_WIRE); - setlinestyle(3); - glBegin(GL_LINE_STRIP); - glVertex2iv(t->mval); - glVertex2fv(cent); - glEnd(); + setlinestyle(3); + glBegin(GL_LINE_STRIP); + glVertex2iv(t->mval); + glVertex2fv(cent); + glEnd(); - glTranslatef(cent[0] - t->mval[0] + mval[0], cent[1] - t->mval[1] + mval[1], 0); + glTranslatef(cent[0] - t->mval[0] + mval[0], cent[1] - t->mval[1] + mval[1], 0); - setlinestyle(0); - glLineWidth(3.0); - drawArc(dist, angle - delta_angle, angle - spacing_angle, 10); - drawArc(dist, angle + spacing_angle, angle + delta_angle, 10); + setlinestyle(0); + glLineWidth(3.0); + drawArc(dist, angle - delta_angle, angle - spacing_angle, 10); + drawArc(dist, angle + spacing_angle, angle + delta_angle, 10); - glPushMatrix(); + glPushMatrix(); - glTranslatef(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0); - glRotatef(RAD2DEGF(angle - delta_angle), 0, 0, 1); + glTranslatef(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0); + glRotatef(RAD2DEGF(angle - delta_angle), 0, 0, 1); - drawArrowHead(DOWN, 5); + drawArrowHead(DOWN, 5); - glPopMatrix(); + glPopMatrix(); - glTranslatef(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0); - glRotatef(RAD2DEGF(angle + delta_angle), 0, 0, 1); + glTranslatef(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0); + glRotatef(RAD2DEGF(angle + delta_angle), 0, 0, 1); - drawArrowHead(UP, 5); + drawArrowHead(UP, 5); - glLineWidth(1.0); - break; - } - case HLP_TRACKBALL: - { - unsigned char col[3], col2[3]; - UI_GetThemeColor3ubv(TH_GRID, col); + glLineWidth(1.0); + break; + } + case HLP_TRACKBALL: + { + unsigned char col[3], col2[3]; + UI_GetThemeColor3ubv(TH_GRID, col); - glTranslatef(mval[0], mval[1], 0); + glTranslatef(mval[0], mval[1], 0); - glLineWidth(3.0); + glLineWidth(3.0); - UI_make_axis_color(col, col2, 'X'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'X'); + glColor3ubv((GLubyte *)col2); - drawArrow(RIGHT, 5, 10, 5); - drawArrow(LEFT, 5, 10, 5); + drawArrow(RIGHT, 5, 10, 5); + drawArrow(LEFT, 5, 10, 5); - UI_make_axis_color(col, col2, 'Y'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'Y'); + glColor3ubv((GLubyte *)col2); - drawArrow(UP, 5, 10, 5); - drawArrow(DOWN, 5, 10, 5); - glLineWidth(1.0); - break; - } + drawArrow(UP, 5, 10, 5); + drawArrow(DOWN, 5, 10, 5); + glLineWidth(1.0); + break; + } } glPopMatrix(); @@ -1482,12 +1482,12 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) PropertyRNA *prop; // Save back mode in case we're in the generic operator - if ((prop= RNA_struct_find_property(op->ptr, "mode"))) { + if ((prop = RNA_struct_find_property(op->ptr, "mode"))) { RNA_property_enum_set(op->ptr, prop, t->mode); } - if ((prop= RNA_struct_find_property(op->ptr, "value"))) { - float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; + if ((prop = RNA_struct_find_property(op->ptr, "value"))) { + float *values = (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; if (RNA_property_array_check(prop)) { RNA_property_float_set_array(op->ptr, prop, values); } @@ -1497,8 +1497,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } /* convert flag to enum */ - switch (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { - case (T_PROP_EDIT|T_PROP_CONNECTED): + switch (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { + case (T_PROP_EDIT | T_PROP_CONNECTED): proportional = PROP_EDIT_CONNECTED; break; case T_PROP_EDIT: @@ -1658,7 +1658,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int else unit_m3(t->spacemtx); - createTransData(C, t); // make TransData structs from selection + createTransData(C, t); // make TransData structs from selection if (t->total == 0) { postTrans(C, t); @@ -1698,114 +1698,114 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int initMouseInput(t, &t->mouse, t->center2d, t->imval); switch (mode) { - case TFM_TRANSLATION: - initTranslation(t); - break; - case TFM_ROTATION: - initRotation(t); - break; - case TFM_RESIZE: - initResize(t); - break; - case TFM_SKIN_RESIZE: - initSkinResize(t); - break; - case TFM_TOSPHERE: - initToSphere(t); - break; - case TFM_SHEAR: - initShear(t); - break; - case TFM_WARP: - initWarp(t); - break; - case TFM_SHRINKFATTEN: - initShrinkFatten(t); - break; - case TFM_TILT: - initTilt(t); - break; - case TFM_CURVE_SHRINKFATTEN: - initCurveShrinkFatten(t); - break; - case TFM_MASK_SHRINKFATTEN: - initMaskShrinkFatten(t); - break; - case TFM_TRACKBALL: - initTrackball(t); - break; - case TFM_PUSHPULL: - initPushPull(t); - break; - case TFM_CREASE: - initCrease(t); - break; - case TFM_BONESIZE: - { /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */ - bArmature *arm= t->poseobj->data; - if (arm->drawtype==ARM_ENVELOPE) + case TFM_TRANSLATION: + initTranslation(t); + break; + case TFM_ROTATION: + initRotation(t); + break; + case TFM_RESIZE: + initResize(t); + break; + case TFM_SKIN_RESIZE: + initSkinResize(t); + break; + case TFM_TOSPHERE: + initToSphere(t); + break; + case TFM_SHEAR: + initShear(t); + break; + case TFM_WARP: + initWarp(t); + break; + case TFM_SHRINKFATTEN: + initShrinkFatten(t); + break; + case TFM_TILT: + initTilt(t); + break; + case TFM_CURVE_SHRINKFATTEN: + initCurveShrinkFatten(t); + break; + case TFM_MASK_SHRINKFATTEN: + initMaskShrinkFatten(t); + break; + case TFM_TRACKBALL: + initTrackball(t); + break; + case TFM_PUSHPULL: + initPushPull(t); + break; + case TFM_CREASE: + initCrease(t); + break; + case TFM_BONESIZE: + { /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */ + bArmature *arm = t->poseobj->data; + if (arm->drawtype == ARM_ENVELOPE) initBoneEnvelope(t); else initBoneSize(t); } break; - case TFM_BONE_ENVELOPE: - initBoneEnvelope(t); - break; - case TFM_EDGE_SLIDE: - initEdgeSlide(t); - break; - case TFM_BONE_ROLL: - initBoneRoll(t); - break; - case TFM_TIME_TRANSLATE: - initTimeTranslate(t); - break; - case TFM_TIME_SLIDE: - initTimeSlide(t); - break; - case TFM_TIME_SCALE: - initTimeScale(t); - break; - case TFM_TIME_DUPLICATE: - /* same as TFM_TIME_EXTEND, but we need the mode info for later - * so that duplicate-culling will work properly - */ - if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) - initTranslation(t); - else - initTimeTranslate(t); - t->mode = mode; - break; - case TFM_TIME_EXTEND: - /* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation - * Editors because they have only 1D transforms for time values) or TFM_TRANSLATION - * (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement) - * depending on which editor this was called from - */ - if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) - initTranslation(t); - else + case TFM_BONE_ENVELOPE: + initBoneEnvelope(t); + break; + case TFM_EDGE_SLIDE: + initEdgeSlide(t); + break; + case TFM_BONE_ROLL: + initBoneRoll(t); + break; + case TFM_TIME_TRANSLATE: initTimeTranslate(t); - break; - case TFM_BAKE_TIME: - initBakeTime(t); - break; - case TFM_MIRROR: - initMirror(t); - break; - case TFM_BEVEL: - initBevel(t); - break; - case TFM_BWEIGHT: - initBevelWeight(t); - break; - case TFM_ALIGN: - initAlign(t); - break; - case TFM_SEQ_SLIDE: - initSeqSlide(t); - break; + break; + case TFM_TIME_SLIDE: + initTimeSlide(t); + break; + case TFM_TIME_SCALE: + initTimeScale(t); + break; + case TFM_TIME_DUPLICATE: + /* same as TFM_TIME_EXTEND, but we need the mode info for later + * so that duplicate-culling will work properly + */ + if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) + initTranslation(t); + else + initTimeTranslate(t); + t->mode = mode; + break; + case TFM_TIME_EXTEND: + /* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation + * Editors because they have only 1D transforms for time values) or TFM_TRANSLATION + * (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement) + * depending on which editor this was called from + */ + if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) + initTranslation(t); + else + initTimeTranslate(t); + break; + case TFM_BAKE_TIME: + initBakeTime(t); + break; + case TFM_MIRROR: + initMirror(t); + break; + case TFM_BEVEL: + initBevel(t); + break; + case TFM_BWEIGHT: + initBevelWeight(t); + break; + case TFM_ALIGN: + initAlign(t); + break; + case TFM_SEQ_SLIDE: + initSeqSlide(t); + break; } if (t->state == TRANS_CANCEL) { @@ -1816,13 +1816,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int /* overwrite initial values if operator supplied a non-null vector */ if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { - float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */ + float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */ if (RNA_property_array_check(prop)) { RNA_float_get_array(op->ptr, "value", values); } else { - values[0]= RNA_float_get(op->ptr, "value"); + values[0] = RNA_float_get(op->ptr, "value"); } copy_v4_v4(t->values, values); @@ -1915,11 +1915,11 @@ int transformEnd(bContext *C, TransInfo *t) /* handle restoring objects */ if (t->state == TRANS_CANCEL) { /* exception, edge slide transformed UVs too */ - if (t->mode==TFM_EDGE_SLIDE) + if (t->mode == TFM_EDGE_SLIDE) doEdgeSlide(t, 0.0f); exit_code = OPERATOR_CANCELLED; - restoreTransObjects(t); // calls recalcData() + restoreTransObjects(t); // calls recalcData() } else { exit_code = OPERATOR_FINISHED; @@ -1943,7 +1943,7 @@ int transformEnd(bContext *C, TransInfo *t) // if (t->undostr) ED_undo_push(C, t->undostr); // else ED_undo_push(C, transform_to_undostr(t)); } - t->undostr= NULL; + t->undostr = NULL; viewRedrawForce(C, t); } @@ -1958,31 +1958,31 @@ int transformEnd(bContext *C, TransInfo *t) static void protectedTransBits(short protectflag, float *vec) { if (protectflag & OB_LOCK_LOCX) - vec[0]= 0.0f; + vec[0] = 0.0f; if (protectflag & OB_LOCK_LOCY) - vec[1]= 0.0f; + vec[1] = 0.0f; if (protectflag & OB_LOCK_LOCZ) - vec[2]= 0.0f; + vec[2] = 0.0f; } static void protectedSizeBits(short protectflag, float *size) { if (protectflag & OB_LOCK_SCALEX) - size[0]= 1.0f; + size[0] = 1.0f; if (protectflag & OB_LOCK_SCALEY) - size[1]= 1.0f; + size[1] = 1.0f; if (protectflag & OB_LOCK_SCALEZ) - size[2]= 1.0f; + size[2] = 1.0f; } static void protectedRotateBits(short protectflag, float *eul, float *oldeul) { if (protectflag & OB_LOCK_ROTX) - eul[0]= oldeul[0]; + eul[0] = oldeul[0]; if (protectflag & OB_LOCK_ROTY) - eul[1]= oldeul[1]; + eul[1] = oldeul[1]; if (protectflag & OB_LOCK_ROTZ) - eul[2]= oldeul[2]; + eul[2] = oldeul[2]; } @@ -1991,19 +1991,19 @@ static void protectedRotateBits(short protectflag, float *eul, float *oldeul) static void protectedAxisAngleBits(short protectflag, float axis[3], float *angle, float oldAxis[3], float oldAngle) { /* check that protection flags are set */ - if ((protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) == 0) + if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; if (protectflag & OB_LOCK_ROT4D) { /* axis-angle getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) - *angle= oldAngle; + *angle = oldAngle; if (protectflag & OB_LOCK_ROTX) - axis[0]= oldAxis[0]; + axis[0] = oldAxis[0]; if (protectflag & OB_LOCK_ROTY) - axis[1]= oldAxis[1]; + axis[1] = oldAxis[1]; if (protectflag & OB_LOCK_ROTZ) - axis[2]= oldAxis[2]; + axis[2] = oldAxis[2]; } else { /* axis-angle get limited with euler... */ @@ -2013,18 +2013,18 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle); if (protectflag & OB_LOCK_ROTX) - eul[0]= oldeul[0]; + eul[0] = oldeul[0]; if (protectflag & OB_LOCK_ROTY) - eul[1]= oldeul[1]; + eul[1] = oldeul[1]; if (protectflag & OB_LOCK_ROTZ) - eul[2]= oldeul[2]; + eul[2] = oldeul[2]; eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT); /* when converting to axis-angle, we need a special exception for the case when there is no axis */ if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) { /* for now, rotate around y-axis then (so that it simply becomes the roll) */ - axis[1]= 1.0f; + axis[1] = 1.0f; } } } @@ -2033,37 +2033,37 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl static void protectedQuaternionBits(short protectflag, float *quat, float *oldquat) { /* check that protection flags are set */ - if ((protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) == 0) + if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; if (protectflag & OB_LOCK_ROT4D) { /* quaternions getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) - quat[0]= oldquat[0]; + quat[0] = oldquat[0]; if (protectflag & OB_LOCK_ROTX) - quat[1]= oldquat[1]; + quat[1] = oldquat[1]; if (protectflag & OB_LOCK_ROTY) - quat[2]= oldquat[2]; + quat[2] = oldquat[2]; if (protectflag & OB_LOCK_ROTZ) - quat[3]= oldquat[3]; + quat[3] = oldquat[3]; } else { /* quaternions get limited with euler... (compatibility mode) */ float eul[3], oldeul[3], nquat[4], noldquat[4]; float qlen; - qlen= normalize_qt_qt(nquat, quat); + qlen = normalize_qt_qt(nquat, quat); normalize_qt_qt(noldquat, oldquat); quat_to_eul(eul, nquat); quat_to_eul(oldeul, noldquat); if (protectflag & OB_LOCK_ROTX) - eul[0]= oldeul[0]; + eul[0] = oldeul[0]; if (protectflag & OB_LOCK_ROTY) - eul[1]= oldeul[1]; + eul[1] = oldeul[1]; if (protectflag & OB_LOCK_ROTZ) - eul[2]= oldeul[2]; + eul[2] = oldeul[2]; eul_to_quat(quat, eul); @@ -2071,7 +2071,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu mul_qt_fl(quat, qlen); /* quaternions flip w sign to accumulate rotations correctly */ - if ( (nquat[0]<0.0f && quat[0]>0.0f) || (nquat[0]>0.0f && quat[0]<0.0f) ) { + if ( (nquat[0] < 0.0f && quat[0] > 0.0f) || (nquat[0] > 0.0f && quat[0] < 0.0f) ) { mul_qt_fl(quat, -1.0f); } } @@ -2082,22 +2082,22 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu static void constraintTransLim(TransInfo *t, TransData *td) { if (td->con) { - bConstraintTypeInfo *ctiLoc= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); - bConstraintTypeInfo *ctiDist= get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT); + bConstraintTypeInfo *ctiLoc = get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); + bConstraintTypeInfo *ctiDist = get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT); - bConstraintOb cob= {NULL}; + bConstraintOb cob = {NULL}; bConstraint *con; float ctime = (float)(t->scene->r.cfra); /* Make a temporary bConstraintOb for using these limit constraints - * - they only care that cob->matrix is correctly set ;-) + * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ unit_m4(cob.matrix); copy_v3_v3(cob.matrix[3], td->loc); /* Evaluate valid constraints */ - for (con= td->con; con; con= con->next) { + for (con = td->con; con; con = con->next) { bConstraintTypeInfo *cti = NULL; ListBase targets = {NULL, NULL}; float tmat[4][4]; @@ -2108,16 +2108,16 @@ static void constraintTransLim(TransInfo *t, TransData *td) /* only use it if it's tagged for this purpose (and the right type) */ if (con->type == CONSTRAINT_TYPE_LOCLIMIT) { - bLocLimitConstraint *data= con->data; + bLocLimitConstraint *data = con->data; - if ((data->flag2 & LIMIT_TRANSFORM)==0) + if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; cti = ctiLoc; } else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) { - bDistLimitConstraint *data= con->data; + bDistLimitConstraint *data = con->data; - if ((data->flag & LIMITDIST_TRANSFORM)==0) + if ((data->flag & LIMITDIST_TRANSFORM) == 0) continue; cti = ctiDist; } @@ -2160,7 +2160,7 @@ static void constraintTransLim(TransInfo *t, TransData *td) static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) { /* Make a temporary bConstraintOb for use by limit constraints - * - they only care that cob->matrix is correctly set ;-) + * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ memset(cob, 0, sizeof(bConstraintOb)); @@ -2168,8 +2168,8 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) if (td->ext->rotOrder == ROT_MODE_QUAT) { /* quats */ /* objects and bones do normalization first too, otherwise - * we don't necessarily end up with a rotation matrix, and - * then conversion back to quat gives a different result */ + * we don't necessarily end up with a rotation matrix, and + * then conversion back to quat gives a different result */ float quat[4]; normalize_qt_qt(quat, td->ext->quat); quat_to_mat4(cob->matrix, quat); @@ -2188,24 +2188,24 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { - bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); + bConstraintTypeInfo *cti = get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); bConstraintOb cob; bConstraint *con; int do_limit = FALSE; /* Evaluate valid constraints */ - for (con= td->con; con; con= con->next) { + for (con = td->con; con; con = con->next) { /* only consider constraint if enabled */ if (con->flag & CONSTRAINT_DISABLE) continue; if (con->enforce == 0.0f) continue; /* we're only interested in Limit-Rotation constraints */ if (con->type == CONSTRAINT_TYPE_ROTLIMIT) { - bRotLimitConstraint *data= con->data; + bRotLimitConstraint *data = con->data; float tmat[4][4]; /* only use it if it's tagged for this purpose */ - if ((data->flag2 & LIMIT_TRANSFORM)==0) + if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; /* skip incompatable spacetypes */ @@ -2258,12 +2258,12 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) static void constraintSizeLim(TransInfo *t, TransData *td) { if (td->con && td->ext) { - bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT); - bConstraintOb cob= {NULL}; + bConstraintTypeInfo *cti = get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT); + bConstraintOb cob = {NULL}; bConstraint *con; /* Make a temporary bConstraintOb for using these limit constraints - * - they only care that cob->matrix is correctly set ;-) + * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) { @@ -2279,18 +2279,18 @@ static void constraintSizeLim(TransInfo *t, TransData *td) } /* Evaluate valid constraints */ - for (con= td->con; con; con= con->next) { + for (con = td->con; con; con = con->next) { /* only consider constraint if enabled */ if (con->flag & CONSTRAINT_DISABLE) continue; if (con->enforce == 0.0f) continue; /* we're only interested in Limit-Scale constraints */ if (con->type == CONSTRAINT_TYPE_SIZELIMIT) { - bSizeLimitConstraint *data= con->data; + bSizeLimitConstraint *data = con->data; float tmat[4][4]; /* only use it if it's tagged for this purpose */ - if ((data->flag2 & LIMIT_TRANSFORM)==0) + if ((data->flag2 & LIMIT_TRANSFORM) == 0) continue; /* do space conversions */ @@ -2381,8 +2381,8 @@ void initWarp(TransInfo *t) mid_v3_v3v3(t->center, min, max); - if (max[0] == min[0]) max[0] += 0.1f; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ - t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */ + if (max[0] == min[0]) max[0] += 0.1f; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ + t->val = (max[0] - min[0]) / 2.0f; /* t->val is X dimension projected boundbox */ } int handleEventWarp(TransInfo *t, wmEvent *event) @@ -2409,7 +2409,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2])) int i; char str[50]; - curs= give_cursor(t->scene, t->view); + curs = give_cursor(t->scene, t->view); /* * gcursor is the one used for helpline. * It has to be in the same space as the drawing loop @@ -2469,18 +2469,18 @@ int Warp(TransInfo *t, const int UNUSED(mval[2])) mul_m4_v3(t->viewmat, vec); sub_v3_v3(vec, t->viewmat[3]); - dist= vec[0]-cursor[0]; + dist = vec[0] - cursor[0]; /* t->val is X dimension projected boundbox */ - phi0= (circumfac*dist/t->val); + phi0 = (circumfac * dist / t->val); - vec[1]= (vec[1]-cursor[1]); + vec[1] = (vec[1] - cursor[1]); - co= (float)cos(phi0); - si= (float)sin(phi0); - loc[0]= -si*vec[1]+cursor[0]; - loc[1]= co*vec[1]+cursor[1]; - loc[2]= vec[2]; + co = (float)cos(phi0); + si = (float)sin(phi0); + loc[0] = -si * vec[1] + cursor[0]; + loc[1] = co * vec[1] + cursor[1]; + loc[2] = vec[2]; mul_m4_v3(t->viewinv, loc); sub_v3_v3(loc, t->viewinv[3]); @@ -2533,7 +2533,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) // Use customData pointer to signal Shear direction if (t->customData == NULL) { initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE); - t->customData = (void*)1; + t->customData = (void *)1; } else { initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE); @@ -2591,7 +2591,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2])) mul_m3_m3m3(tmat, smat, persmat); mul_m3_m3m3(totmat, persinv, tmat); - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -2654,7 +2654,7 @@ void initResize(TransInfo *t) static void headerResize(TransInfo *t, float vec[3], char *str) { char tvec[60]; - char *spos= str; + char *spos = str; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); } @@ -2666,14 +2666,14 @@ static void headerResize(TransInfo *t, float vec[3], char *str) if (t->con.mode & CON_APPLY) { switch (t->num.idx_max) { - case 0: - spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); - break; - case 1: - spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); - break; - case 2: - spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + case 0: + spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); + break; + case 1: + spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); + break; + case 2: + spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } } else { @@ -2683,15 +2683,15 @@ static void headerResize(TransInfo *t, float vec[3], char *str) spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); } (void)spos; } -#define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3) -#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0]))==0 || (SIGN(a[1]) & SIGN(b[1]))==0 || (SIGN(a[2]) & SIGN(b[2]))==0) +#define SIGN(a) (a<-FLT_EPSILON ? 1 : a>FLT_EPSILON ? 2 : 3) +#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0])) == 0 || (SIGN(a[1]) & SIGN(b[1])) == 0 || (SIGN(a[2]) & SIGN(b[2])) == 0) /* smat is reference matrix, only scaled */ static void TransMat3ToSize(float mat[][3], float smat[][3], float *size) @@ -2699,16 +2699,16 @@ static void TransMat3ToSize(float mat[][3], float smat[][3], float *size) float vec[3]; copy_v3_v3(vec, mat[0]); - size[0]= normalize_v3(vec); + size[0] = normalize_v3(vec); copy_v3_v3(vec, mat[1]); - size[1]= normalize_v3(vec); + size[1] = normalize_v3(vec); copy_v3_v3(vec, mat[2]); - size[2]= normalize_v3(vec); + size[2] = normalize_v3(vec); /* first tried with dotproduct... but the sign flip is crucial */ - if ( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0]; - if ( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1]; - if ( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2]; + if (VECSIGNFLIP(mat[0], smat[0]) ) size[0] = -size[0]; + if (VECSIGNFLIP(mat[1], smat[1]) ) size[1] = -size[1]; + if (VECSIGNFLIP(mat[2], smat[2]) ) size[2] = -size[2]; } @@ -2731,10 +2731,10 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) /* local constraint shouldn't alter center */ if ((t->around == V3D_LOCAL) && - ( (t->flag & (T_OBJECT|T_POSE)) || - ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE))) || - (t->obedit && t->obedit->type == OB_ARMATURE)) - ) + ( (t->flag & (T_OBJECT | T_POSE)) || + ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) || + (t->obedit && t->obedit->type == OB_ARMATURE)) + ) { copy_v3_v3(center, td->center); } @@ -2748,7 +2748,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) if (td->ext) { float fsize[3]; - if (t->flag & (T_OBJECT|T_TEXTURE|T_POSE)) { + if (t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) { float obsizemat[3][3]; // Reorient the size mat to fit the oriented object. mul_m3_m3m3(obsizemat, tmat, td->axismtx); @@ -2762,19 +2762,19 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) protectedSizeBits(td->protectflag, fsize); - if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't resize objects itself + if ((t->flag & T_V3D_ALIGN) == 0) { // align mode doesn't resize objects itself if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) { /* scale val and reset size */ - *td->val = td->ival * (1 + (fsize[0] - 1) * td->factor); + *td->val = td->ival * (1 + (fsize[0] - 1) * td->factor); td->ext->size[0] = td->ext->isize[0]; td->ext->size[1] = td->ext->isize[1]; td->ext->size[2] = td->ext->isize[2]; - } + } else { /* Reset val if SINGLESIZE but using a constraint */ if (td->flag & TD_SINGLESIZE) - *td->val = td->ival; + *td->val = td->ival; td->ext->size[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor); td->ext->size[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor); @@ -2801,7 +2801,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) 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); } @@ -2820,8 +2820,8 @@ int Resize(TransInfo *t, const int mval[2]) char str[200]; /* for manipulator, center handle, the scaling can't be done relative to center */ - if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) { - ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f; + if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) { + ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1])) / 100.0f; } else { ratio = t->values[0]; @@ -2850,11 +2850,11 @@ int Resize(TransInfo *t, const int mval[2]) t->con.applySize(t, NULL, mat); } - copy_m3_m3(t->mat, mat); // used in manipulator + copy_m3_m3(t->mat, mat); // used in manipulator headerResize(t, size, str); - for (i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -2871,7 +2871,7 @@ int Resize(TransInfo *t, const int mval[2]) if (t->con.applySize) t->con.applySize(t, NULL, mat); - for (i = 0, td=t->data; i < t->total; i++, td++) + for (i = 0, td = t->data; i < t->total; i++, td++) ElementResize(t, td, mat); } @@ -2996,7 +2996,7 @@ void initToSphere(TransInfo *t) t->flag |= T_NO_CONSTRAINT; // Calculate average radius - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { t->val += len_v3v3(t->center, td->iloc); } @@ -3038,7 +3038,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2])) } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { float tratio; if (td->flag & TD_NOACTION) break; @@ -3086,7 +3086,7 @@ void initRotation(TransInfo *t) t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; - t->snap[1] = (float)((5.0/180)*M_PI); + t->snap[1] = (float)((5.0 / 180) * M_PI); t->snap[2] = t->snap[1] * 0.2f; t->num.increment = 1.0f; @@ -3108,8 +3108,8 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short /* local constraint shouldn't alter center */ if (around == V3D_LOCAL) { - if ( (t->flag & (T_OBJECT|T_POSE)) || - (t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE)) || + if ( (t->flag & (T_OBJECT | T_POSE)) || + (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE)) || (t->obedit && t->obedit->type == OB_ARMATURE)) { center = td->center; @@ -3136,7 +3136,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short if (td->flag & TD_USEQUAT) { mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); - mat3_to_quat(quat, fmat); // Actual transform + mat3_to_quat(quat, fmat); // Actual transform if (td->ext->quat) { mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); @@ -3168,9 +3168,9 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short if ((td->flag & TD_NO_LOC) == 0) { sub_v3_v3v3(vec, td->center, center); - mul_m3_v3(pmtx, vec); // To Global space - mul_m3_v3(mat, vec); // Applying rotation - mul_m3_v3(imtx, vec); // To Local space + mul_m3_v3(pmtx, vec); // To Global space + mul_m3_v3(mat, vec); // Applying rotation + mul_m3_v3(imtx, vec); // To Local space add_v3_v3(vec, center); /* vec now is the location where the object has to be */ @@ -3182,12 +3182,12 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short /* do nothing */ } else if (td->flag & TD_PBONE_LOCAL_MTX_C) { - mul_m3_v3(pmtx, vec); // To Global space - mul_m3_v3(td->ext->l_smtx, vec);// To Pose space (Local Location) + mul_m3_v3(pmtx, vec); // To Global space + mul_m3_v3(td->ext->l_smtx, vec); // To Pose space (Local Location) } else { - mul_m3_v3(pmtx, vec); // To Global space - mul_m3_v3(td->smtx, vec);// To Pose space + mul_m3_v3(pmtx, vec); // To Global space + mul_m3_v3(td->smtx, vec); // To Pose space } protectedTransBits(td->protectflag, vec); @@ -3202,7 +3202,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short * and ElementRotation() might be called in Translation context (with align snapping), * we need to be sure to actually use the *rotation* matrix here... * So no other way than storing it in some dedicated members of td->ext! */ - if ((t->flag & T_V3D_ALIGN)==0) { /* align mode doesn't rotate objects itself */ + if ((t->flag & T_V3D_ALIGN) == 0) { /* align mode doesn't rotate objects itself */ /* euler or quaternion/axis-angle? */ if (td->ext->rotOrder == ROT_MODE_QUAT) { mul_serie_m3(fmat, td->ext->r_mtx, mat, td->ext->r_smtx, NULL, NULL, NULL, NULL, NULL); @@ -3271,11 +3271,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short constraintTransLim(t, td); /* rotation */ - if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself + if ((t->flag & T_V3D_ALIGN) == 0) { // align mode doesn't rotate objects itself /* euler or quaternion? */ if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) { mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); - mat3_to_quat(quat, fmat); // Actual transform + mat3_to_quat(quat, fmat); // Actual transform mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); /* this function works on end result */ @@ -3288,7 +3288,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle); mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); - mat3_to_quat(quat, fmat); // Actual transform + mat3_to_quat(quat, fmat); // Actual transform mul_qt_qtqt(tquat, quat, iquat); quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat); @@ -3331,7 +3331,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) vec_rot_to_mat3(mat, axis, angle); - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3353,7 +3353,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) int Rotation(TransInfo *t, const int UNUSED(mval[2])) { - char str[128], *spos= str; + char str[128], *spos = str; float final; @@ -3378,16 +3378,16 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); - spos+= sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext); + spos += sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext); /* Clamp between -180 and 180 */ - final= angle_wrap_rad(DEG2RADF(final)); + final = angle_wrap_rad(DEG2RADF(final)); } else { spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); } (void)spos; @@ -3416,7 +3416,7 @@ void initTrackball(TransInfo *t) t->idx_max = 1; t->num.idx_max = 1; t->snap[0] = 0.0f; - t->snap[1] = (float)((5.0/180)*M_PI); + t->snap[1] = (float)((5.0 / 180) * M_PI); t->snap[2] = t->snap[1] * 0.2f; t->num.increment = 1.0f; @@ -3435,7 +3435,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a mul_m3_m3m3(mat, smat, totmat); - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3455,7 +3455,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a int Trackball(TransInfo *t, const int UNUSED(mval[2])) { - char str[128], *spos= str; + char str[128], *spos = str; float axis1[3], axis2[3]; float mat[3][3], totmat[3][3], smat[3][3]; float phi[2]; @@ -3486,7 +3486,7 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2])) spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); } (void)spos; @@ -3522,7 +3522,7 @@ void initTranslation(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_VECTOR); - t->idx_max = (t->flag & T_2D_EDIT)? 1: 2; + t->idx_max = (t->flag & T_2D_EDIT) ? 1 : 2; t->num.flag = 0; t->num.idx_max = t->idx_max; @@ -3550,7 +3550,7 @@ void initTranslation(TransInfo *t) static void headerTranslation(TransInfo *t, float vec[3], char *str) { - char *spos= str; + char *spos = str; char tvec[60]; char distvec[20]; char autoik[20]; @@ -3568,10 +3568,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) dist = len_v3(vec); if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) { - int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0; + int i, do_split = t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1 : 0; - for (i=0; i<3; i++) - bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1); + for (i = 0; i < 3; i++) + bUnit_AsString(&tvec[i * 20], 20, dvec[i] * t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1); } else { sprintf(&tvec[0], "%.4f", dvec[0]); @@ -3581,33 +3581,33 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) } if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) - bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0); - else if ( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */ + bUnit_AsString(distvec, sizeof(distvec), dist * t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0); + else if (dist > 1e10f || dist < -1e10f) /* prevent string buffer overflow */ sprintf(distvec, "%.4e", dist); else sprintf(distvec, "%.4f", dist); if (t->flag & T_AUTOIK) { - short chainlen= t->settings->autoik_chainlen; + short chainlen = t->settings->autoik_chainlen; if (chainlen) sprintf(autoik, "AutoIK-Len: %d", chainlen); else - autoik[0]= '\0'; + autoik[0] = '\0'; } else - autoik[0]= '\0'; + autoik[0] = '\0'; if (t->con.mode & CON_APPLY) { switch (t->num.idx_max) { - case 0: - spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]); - break; - case 1: - spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]); - break; - case 2: - spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]); + case 0: + spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]); + break; + case 1: + spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]); + break; + case 2: + spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]); } } else { @@ -3617,7 +3617,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) { spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); } (void)spos; @@ -3629,7 +3629,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) float tvec[3]; int i; - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3733,7 +3733,7 @@ int Translation(TransInfo *t, const int UNUSED(mval[2])) void initShrinkFatten(TransInfo *t) { // If not in mesh edit mode, fallback to Resize - if (t->obedit==NULL || t->obedit->type != OB_MESH) { + if (t->obedit == NULL || t->obedit->type != OB_MESH) { initResize(t); } else { @@ -3785,7 +3785,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) t->values[0] = distance; - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3818,12 +3818,12 @@ void initTilt(TransInfo *t) t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; - t->snap[1] = (float)((5.0/180)*M_PI); + t->snap[1] = (float)((5.0 / 180) * M_PI); t->snap[2] = t->snap[1] * 0.2f; t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } @@ -3855,7 +3855,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3922,7 +3922,7 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Shrink/Fatten: %3f", ratio); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -3930,7 +3930,7 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) continue; if (td->val) { - *td->val= td->ival*ratio; + *td->val = td->ival * ratio; /* apply PET */ *td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival); if (*td->val <= 0.0f) *td->val = 0.001f; @@ -3990,7 +3990,7 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Shrink/Fatten: %3f", ratio); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4064,7 +4064,7 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2])) t->con.applyRot(t, NULL, axis, NULL); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4137,28 +4137,28 @@ int handleEventBevel(TransInfo *t, wmEvent *event) if (!G.editBMesh) return 0; switch (event->type) { - case MIDDLEMOUSE: - G.editBMesh->options ^= BME_BEVEL_VERT; - t->state = TRANS_CANCEL; - return 1; - //case PADPLUSKEY: - // G.editBMesh->options ^= BME_BEVEL_RES; - // G.editBMesh->res += 1; - // if (G.editBMesh->res > 4) { - // G.editBMesh->res = 4; - // } - // t->state = TRANS_CANCEL; - // return 1; - //case PADMINUS: - // G.editBMesh->options ^= BME_BEVEL_RES; - // G.editBMesh->res -= 1; - // if (G.editBMesh->res < 0) { - // G.editBMesh->res = 0; - // } - // t->state = TRANS_CANCEL; - // return 1; - default: - return 0; + case MIDDLEMOUSE: + G.editBMesh->options ^= BME_BEVEL_VERT; + t->state = TRANS_CANCEL; + return 1; + //case PADPLUSKEY: + // G.editBMesh->options ^= BME_BEVEL_RES; + // G.editBMesh->res += 1; + // if (G.editBMesh->res > 4) { + // G.editBMesh->res = 4; + // } + // t->state = TRANS_CANCEL; + // return 1; + //case PADMINUS: + // G.editBMesh->options ^= BME_BEVEL_RES; + // G.editBMesh->res -= 1; + // if (G.editBMesh->res < 0) { + // G.editBMesh->res = 0; + // } + // t->state = TRANS_CANCEL; + // return 1; + default: + return 0; } } return 0; @@ -4195,7 +4195,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2])) } if (distance < 0) distance = -distance; - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) { d = td->axismtx[1][0]; } @@ -4229,7 +4229,7 @@ void initBevelWeight(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) @@ -4267,7 +4267,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4302,7 +4302,7 @@ void initCrease(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } int Crease(TransInfo *t, const int UNUSED(mval[2])) @@ -4340,7 +4340,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Crease: %.3f %s", crease, t->proptext); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4418,11 +4418,11 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3]) } /* we've tucked the scale in loc */ - oldy= td->iloc[1]; + oldy = td->iloc[1]; size_to_mat3(sizemat, td->iloc); mul_m3_m3m3(tmat, tmat, sizemat); mat3_to_size(td->loc, tmat); - td->loc[1]= oldy; + td->loc[1] = oldy; } int BoneSize(TransInfo *t, const int mval[2]) @@ -4435,8 +4435,8 @@ int BoneSize(TransInfo *t, const int mval[2]) // TRANSFORM_FIX_ME MOVE TO MOUSE INPUT /* for manipulator, center handle, the scaling can't be done relative to center */ - if ((t->flag & T_USES_MANIPULATOR) && t->con.mode==0) { - ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f; + if ((t->flag & T_USES_MANIPULATOR) && t->con.mode == 0) { + ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1])) / 100.0f; } else { ratio = t->values[0]; @@ -4457,11 +4457,11 @@ int BoneSize(TransInfo *t, const int mval[2]) t->con.applySize(t, NULL, mat); } - copy_m3_m3(t->mat, mat); // used in manipulator + copy_m3_m3(t->mat, mat); // used in manipulator headerBoneSize(t, size, str); - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4496,7 +4496,7 @@ void initBoneEnvelope(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) @@ -4523,7 +4523,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Envelope: %3f", ratio); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -4533,9 +4533,9 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) if (td->val) { /* if the old/original value was 0.0f, then just use ratio */ if (td->ival) - *td->val= td->ival*ratio; + *td->val = td->ival * ratio; else - *td->val= ratio; + *td->val = ratio; } } @@ -4565,7 +4565,7 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, { BMLoop *firstl; float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f}; - int i=0; + int i = 0; firstl = l; do { @@ -4823,7 +4823,7 @@ static int createSlideVerts(TransInfo *t) sv->down = BM_edge_other_vert(l->e, v); } - v2=v, v = BM_edge_other_vert(e, v); + v2 = v, v = BM_edge_other_vert(e, v); e1 = e; e = get_other_edge(v, e); @@ -4880,8 +4880,8 @@ static int createSlideVerts(TransInfo *t) /* search cross edges for visible edge to the mouse cursor, * then use the shared vertex to calculate screen vector*/ dis2 = -1.0f; - for (i=0; i<2; i++) { - v = i?e->v1:e->v2; + for (i = 0; i < 2; i++) { + v = i ? e->v1 : e->v2; BM_ITER_ELEM (e2, &iter2, v, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(e2, BM_ELEM_SELECT)) continue; @@ -4923,7 +4923,7 @@ static int createSlideVerts(TransInfo *t) /*create copies of faces for customdata projection*/ sv_array = sld->sv; - for (i=0; i<sld->totsv; i++, sv_array++) { + for (i = 0; i < sld->totsv; i++, sv_array++) { BMIter fiter, liter; BMFace *f; BMLoop *l; @@ -4999,7 +4999,7 @@ void projectSVData(TransInfo *t, int final) BLI_smallhash_init(&visit); - for (i=0, sv = sld->sv; i < sld->totsv; sv++, i++) { + for (i = 0, sv = sld->sv; i < sld->totsv; sv++, i++) { BMIter fiter; BMFace *f; @@ -5065,7 +5065,7 @@ void projectSVData(TransInfo *t, int final) BMEdge *e_sel; BM_ITER_ELEM (e_sel, &eiter, l->v, BM_EDGES_OF_VERT) { - if (BM_elem_flag_test(e_sel, BM_ELEM_SELECT)) {; + if (BM_elem_flag_test(e_sel, BM_ELEM_SELECT)) { break; } } @@ -5131,7 +5131,7 @@ void freeSlideTempFaces(SlideData *sld) BMFace *copyf; copyf = BLI_smallhash_iternew(&sld->origfaces, &hiter, NULL); - for (; copyf; copyf=BLI_smallhash_iternext(&hiter, NULL)) { + for (; copyf; copyf = BLI_smallhash_iternext(&hiter, NULL)) { BM_face_verts_kill(sld->em->bm, copyf); } @@ -5152,7 +5152,7 @@ void freeSlideVerts(TransInfo *t) LinkNode *look = sld->vertlist; GHash *vertgh = sld->vhash; while (look) { - sv = BLI_ghash_lookup(vertgh, (EditVert*)look->link); + sv = BLI_ghash_lookup(vertgh, (EditVert *)look->link); if (sv != NULL) { sv->up->f &= !SELECT; sv->down->f &= !SELECT; @@ -5188,7 +5188,7 @@ void initEdgeSlide(TransInfo *t) t->handleEvent = handleEventEdgeSlide; if (!createSlideVerts(t)) { - t->state= TRANS_CANCEL; + t->state = TRANS_CANCEL; return; } @@ -5211,7 +5211,7 @@ void initEdgeSlide(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event) @@ -5340,7 +5340,7 @@ static int doEdgeSlide(TransInfo *t, float perc) sld->perc = perc; sv = svlist; - for (i=0; i<sld->totsv; i++, sv++) { + for (i = 0; i < sld->totsv; i++, sv++) { if (sld->is_proportional == FALSE) { TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index]; float cur_sel = curr_sv->edge_len; @@ -5405,11 +5405,11 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) outputNumInput(&(t->num), c); BLI_snprintf(str, sizeof(str), "Edge Slide: %s (E)ven: %s, (F)lipped: %s", - &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF" ); + &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF"); } else { BLI_snprintf(str, sizeof(str), "Edge Slide: %.2f (E)ven: %s, (F)lipped: %s", - final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF" ); + final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF"); } CLAMP(final, -1.0f, 1.0f); @@ -5443,12 +5443,12 @@ void initBoneRoll(TransInfo *t) t->idx_max = 0; t->num.idx_max = 0; t->snap[0] = 0.0f; - t->snap[1] = (float)((5.0/180)*M_PI); + t->snap[1] = (float)((5.0 / 180) * M_PI); t->snap[2] = t->snap[1] * 0.2f; t->num.increment = 1.0f; - t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; + t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT; } int BoneRoll(TransInfo *t, const int UNUSED(mval[2])) @@ -5523,11 +5523,11 @@ int BakeTime(TransInfo *t, const int mval[2]) if (t->mouse.precision) { /* calculate ratio for shiftkey pos, and for total, and blend these for precision */ - time= (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac; - time+= 0.1f*((float)(t->center2d[0]*fac - mval[0]) -time); + time = (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac; + time += 0.1f * ((float)(t->center2d[0] * fac - mval[0]) - time); } else { - time = (float)(t->center2d[0] - mval[0])*fac; + time = (float)(t->center2d[0] - mval[0]) * fac; } snapGrid(t, &time); @@ -5553,7 +5553,7 @@ int BakeTime(TransInfo *t, const int mval[2]) sprintf(str, "Time: %.3f %s", time, t->proptext); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5612,7 +5612,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Mirror%s", t->con.text); - for (i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5631,7 +5631,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) size_to_mat3(mat, size); - for (i = 0, td=t->data; i < t->total; i++, td++) { + for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; @@ -5672,7 +5672,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2])) /* saving original center */ copy_v3_v3(center, t->center); - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { float mat[3][3], invmat[3][3]; if (td->flag & TD_NOACTION) @@ -5682,7 +5682,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2])) continue; /* around local centers */ - if (t->flag & (T_OBJECT|T_POSE)) { + if (t->flag & (T_OBJECT | T_POSE)) { copy_v3_v3(t->center, td->center); } else { @@ -5746,7 +5746,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) TransData *td = t->data; int i; - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { float tvec[2]; if (td->flag & TD_NOACTION) @@ -5803,38 +5803,38 @@ int SeqSlide(TransInfo *t, const int UNUSED(mval[2])) // XXX these modifier checks should be keymappable static short getAnimEdit_SnapMode(TransInfo *t) { - short autosnap= SACTSNAP_OFF; + short autosnap = SACTSNAP_OFF; if (t->spacetype == SPACE_ACTION) { - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; if (saction) - autosnap= saction->autosnap; + autosnap = saction->autosnap; } else if (t->spacetype == SPACE_IPO) { - SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; + SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; if (sipo) - autosnap= sipo->autosnap; + autosnap = sipo->autosnap; } else if (t->spacetype == SPACE_NLA) { - SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first; + SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first; if (snla) - autosnap= snla->autosnap; + autosnap = snla->autosnap; } else { - autosnap= SACTSNAP_OFF; + autosnap = SACTSNAP_OFF; } /* toggle autosnap on/off - * - when toggling on, prefer nearest frame over 1.0 frame increments + * - when toggling on, prefer nearest frame over 1.0 frame increments */ if (t->modifiers & MOD_SNAP_INVERT) { if (autosnap) - autosnap= SACTSNAP_OFF; + autosnap = SACTSNAP_OFF; else - autosnap= SACTSNAP_FRAME; + autosnap = SACTSNAP_FRAME; } return autosnap; @@ -5849,19 +5849,19 @@ static short getAnimEdit_DrawTime(TransInfo *t) short drawtime; if (t->spacetype == SPACE_ACTION) { - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; - drawtime = (saction->flag & SACTION_DRAWTIME)? 1 : 0; + drawtime = (saction->flag & SACTION_DRAWTIME) ? 1 : 0; } else if (t->spacetype == SPACE_NLA) { - SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first; + SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first; - drawtime = (snla->flag & SNLA_DRAWTIME)? 1 : 0; + drawtime = (snla->flag & SNLA_DRAWTIME) ? 1 : 0; } else if (t->spacetype == SPACE_IPO) { - SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; + SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; - drawtime = (sipo->flag & SIPO_DRAWTIME)? 1 : 0; + drawtime = (sipo->flag & SIPO_DRAWTIME) ? 1 : 0; } else { drawtime = 0; @@ -5881,23 +5881,23 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, #if 0 /* 'do_time' disabled for now */ - const Scene *scene= t->scene; - const short do_time= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behavior given the option's label, hence disabled - const double secf= FPS; + const Scene *scene = t->scene; + const short do_time = 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behavior given the option's label, hence disabled + const double secf = FPS; #endif double val; /* convert frame to nla-action time (if needed) */ if (adt) - val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); + val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else - val= *(td->val); + val = *(td->val); -#if 0 /* 'do_time' disabled for now */ +#if 0 /* 'do_time' disabled for now */ /* do the snapping to nearest frame/second */ if (do_time) { - val= (float)(floor((val/secf) + 0.5f) * secf); + val = (float)(floor((val / secf) + 0.5f) * secf); } else #endif @@ -5907,9 +5907,9 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, /* convert frame out of nla-action time */ if (adt) - *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); + *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); else - *(td->val)= val; + *(td->val) = val; } /* snap key to nearest marker? */ else if (autosnap == SACTSNAP_MARKER) { @@ -5917,19 +5917,19 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, /* convert frame to nla-action time (if needed) */ if (adt) - val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); + val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else - val= *(td->val); + val = *(td->val); /* snap to nearest marker */ // TODO: need some more careful checks for where data comes from - val= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val); + val = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val); /* convert frame out of nla-action time */ if (adt) - *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); + *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); else - *(td->val)= val; + *(td->val) = val; } /* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect) @@ -5980,21 +5980,21 @@ static void headerTimeTranslate(TransInfo *t, char *str) } else { const Scene *scene = t->scene; - const short autosnap= getAnimEdit_SnapMode(t); + const short autosnap = getAnimEdit_SnapMode(t); const short do_time = getAnimEdit_DrawTime(t); - const double secf= FPS; + const double secf = FPS; float val = t->values[0]; /* apply snapping + frame->seconds conversions */ if (autosnap == SACTSNAP_STEP) { if (do_time) - val= floorf((double)val / secf + 0.5); + val = floorf((double)val / secf + 0.5); else - val= floorf(val + 0.5f); + val = floorf(val + 0.5f); } else { if (do_time) - val= (float)((double)val / secf); + val = (float)((double)val / secf); } if (autosnap == SACTSNAP_FRAME) @@ -6013,20 +6013,20 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) Scene *scene = t->scene; int i; - const short do_time= getAnimEdit_DrawTime(t); - const double secf= FPS; + const short do_time = getAnimEdit_DrawTime(t); + const double secf = FPS; - const short autosnap= getAnimEdit_SnapMode(t); + const short autosnap = getAnimEdit_SnapMode(t); float deltax, val /* , valprev */; /* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */ - for (i = 0 ; i < t->total; i++, td++, td2d++) { + for (i = 0; i < t->total; i++, td++, td2d++) { /* it is assumed that td->extra is a pointer to the AnimData, * whose active action is where this keyframe comes from * (this is only valid when not in NLA) */ - AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL; + AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; /* valprev = *td->val; */ /* UNUSED */ @@ -6097,7 +6097,7 @@ void initTimeSlide(TransInfo *t) { /* this tool is only really available in the Action Editor... */ if (t->spacetype == SPACE_ACTION) { - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; /* set flag for drawing stuff */ saction->flag |= SACTION_MOVING; @@ -6133,12 +6133,12 @@ static void headerTimeSlide(TransInfo *t, float sval, char *str) outputNumInput(&(t->num), tvec); } else { - float minx= *((float *)(t->customData)); - float maxx= *((float *)(t->customData) + 1); - float cval= t->values[0]; + float minx = *((float *)(t->customData)); + float maxx = *((float *)(t->customData) + 1); + float cval = t->values[0]; float val; - val= 2.0f*(cval-sval) / (maxx-minx); + val = 2.0f * (cval - sval) / (maxx - minx); CLAMP(val, -1.0f, 1.0f); sprintf(&tvec[0], "%.4f", val); @@ -6152,43 +6152,43 @@ static void applyTimeSlide(TransInfo *t, float sval) TransData *td = t->data; int i; - float minx= *((float *)(t->customData)); - float maxx= *((float *)(t->customData) + 1); + float minx = *((float *)(t->customData)); + float maxx = *((float *)(t->customData) + 1); /* set value for drawing black line */ if (t->spacetype == SPACE_ACTION) { - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; float cvalf = t->values[0]; - saction->timeslide= cvalf; + saction->timeslide = cvalf; } /* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */ - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { /* it is assumed that td->extra is a pointer to the AnimData, * whose active action is where this keyframe comes from * (this is only valid when not in NLA) */ - AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL; + AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; float cval = t->values[0]; /* apply NLA-mapping to necessary values */ if (adt) - cval= BKE_nla_tweakedit_remap(adt, cval, NLATIME_CONVERT_UNMAP); + cval = BKE_nla_tweakedit_remap(adt, cval, NLATIME_CONVERT_UNMAP); /* only apply to data if in range */ if ((sval > minx) && (sval < maxx)) { - float cvalc= CLAMPIS(cval, minx, maxx); + float cvalc = CLAMPIS(cval, minx, maxx); float timefac; /* left half? */ if (td->ival < sval) { - timefac= (sval - td->ival) / (sval - minx); - *(td->val)= cvalc - timefac * (cvalc - minx); + timefac = (sval - td->ival) / (sval - minx); + *(td->val) = cvalc - timefac * (cvalc - minx); } else { - timefac= (td->ival - sval) / (maxx - sval); - *(td->val)= cvalc + timefac * (maxx - cvalc); + timefac = (td->ival - sval) / (maxx - sval); + *(td->val) = cvalc + timefac * (maxx - cvalc); } } } @@ -6198,8 +6198,8 @@ int TimeSlide(TransInfo *t, const int mval[2]) { View2D *v2d = (View2D *)t->view; float cval[2], sval[2]; - float minx= *((float *)(t->customData)); - float maxx= *((float *)(t->customData) + 1); + float minx = *((float *)(t->customData)); + float maxx = *((float *)(t->customData) + 1); char str[200]; /* calculate mouse co-ordinates */ @@ -6211,9 +6211,9 @@ int TimeSlide(TransInfo *t, const int mval[2]) t->values[0] = cval[0]; /* handle numeric-input stuff */ - t->vec[0] = 2.0f*(cval[0]-sval[0]) / (maxx-minx); + t->vec[0] = 2.0f * (cval[0] - sval[0]) / (maxx - minx); applyNumInput(&t->num, &t->vec[0]); - t->values[0] = (maxx-minx) * t->vec[0] / 2.0f + sval[0]; + t->values[0] = (maxx - minx) * t->vec[0] / 2.0f + sval[0]; headerTimeSlide(t, sval[0], str); applyTimeSlide(t, sval[0]); @@ -6286,19 +6286,19 @@ static void applyTimeScale(TransInfo *t) TransData2D *td2d = t->data2d; int i; - const short autosnap= getAnimEdit_SnapMode(t); - const short do_time= getAnimEdit_DrawTime(t); - const double secf= FPS; + const short autosnap = getAnimEdit_SnapMode(t); + const short do_time = getAnimEdit_DrawTime(t); + const double secf = FPS; - for (i = 0 ; i < t->total; i++, td++, td2d++) { + for (i = 0; i < t->total; i++, td++, td2d++) { /* it is assumed that td->extra is a pointer to the AnimData, * whose active action is where this keyframe comes from * (this is only valid when not in NLA) */ - AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL; - float startx= CFRA; - float fac= t->values[0]; + AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; + float startx = CFRA; + float fac = t->values[0]; if (autosnap == SACTSNAP_STEP) { if (do_time) @@ -6309,7 +6309,7 @@ static void applyTimeScale(TransInfo *t) /* check if any need to apply nla-mapping */ if (adt) - startx= BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP); + startx = BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP); /* now, calculate the new value */ *(td->val) = ((td->ival - startx) * fac) + startx; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 007ec3c5250..95a9ab5900a 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -107,7 +107,7 @@ #include "ED_mask.h" #include "ED_util.h" /* for crazyspace correction */ -#include "WM_api.h" /* for WM_event_add_notifier to deal with stabilization nodes */ +#include "WM_api.h" /* for WM_event_add_notifier to deal with stabilization nodes */ #include "WM_types.h" #include "UI_view2d.h" @@ -162,10 +162,10 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra *head = *temp; if (ihead < head) { - qsort_trans_data(t, ihead, head-1, temp); + qsort_trans_data(t, ihead, head - 1, temp); } if (itail > head) { - qsort_trans_data(t, head+1, itail, temp); + qsort_trans_data(t, head + 1, itail, temp); } } @@ -217,18 +217,18 @@ static void set_prop_dist(TransInfo *t, short with_dist) TransData *tob; int a; - for (a=0, tob= t->data; a<t->total; a++, tob++) { + for (a = 0, tob = t->data; a < t->total; a++, tob++) { - tob->rdist= 0.0f; // init, it was mallocced + tob->rdist = 0.0f; // init, it was mallocced - if ((tob->flag & TD_SELECTED)==0) { + if ((tob->flag & TD_SELECTED) == 0) { TransData *td; int i; float dist, vec[3]; tob->rdist = -1.0f; // signal for next loop - for (i = 0, td= t->data; i < t->total; i++, td++) { + for (i = 0, td = t->data; i < t->total; i++, td++) { if (td->flag & TD_SELECTED) { sub_v3_v3v3(vec, tob->center, td->center); mul_m3_v3(tob->mtx, vec); @@ -240,7 +240,7 @@ static void set_prop_dist(TransInfo *t, short with_dist) tob->rdist = dist; } } - else break; // by definition transdata has selected items in beginning + else break; // by definition transdata has selected items in beginning } if (with_dist) { tob->dist = tob->rdist; @@ -269,16 +269,16 @@ static void createTransTexspace(TransInfo *t) } id = ob->data; - if (id == NULL || !ELEM3(GS(id->name), ID_ME, ID_CU, ID_MB )) { + if (id == NULL || !ELEM3(GS(id->name), ID_ME, ID_CU, ID_MB)) { t->total = 0; return; } t->total = 1; - td= t->data= MEM_callocN(sizeof(TransData), "TransTexspace"); - td->ext= t->ext= MEM_callocN(sizeof(TransDataExtension), "TransTexspace"); + td = t->data = MEM_callocN(sizeof(TransData), "TransTexspace"); + td->ext = t->ext = MEM_callocN(sizeof(TransDataExtension), "TransTexspace"); - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; copy_v3_v3(td->center, ob->obmat[3]); td->ob = ob; @@ -306,7 +306,7 @@ static void createTransEdge(TransInfo *t) BMEdge *eed; BMIter iter; float mtx[3][3], smtx[3][3]; - int count=0, countsel=0; + int count = 0, countsel = 0; int propmode = t->flag & T_PROP_EDIT; BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { @@ -326,7 +326,7 @@ static void createTransEdge(TransInfo *t) t->total = countsel; } - td= t->data= MEM_callocN(t->total * sizeof(TransData), "TransCrease"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransCrease"); copy_m3_m4(mtx, t->obedit->obmat); invert_m3_m3(smtx, mtx); @@ -340,11 +340,11 @@ static void createTransEdge(TransInfo *t) add_v3_v3v3(td->center, eed->v1->co, eed->v2->co); mul_v3_fl(td->center, 0.5f); - td->loc= NULL; + td->loc = NULL; if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; else - td->flag= 0; + td->flag = 0; copy_m3_m3(td->smtx, smtx); @@ -369,15 +369,15 @@ static void createTransEdge(TransInfo *t) static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan) { - bConstraint *con= pchan->constraints.first; + bConstraint *con = pchan->constraints.first; - for (;con; con= con->next) { - if (con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) { - bKinematicConstraint *data= con->data; + for (; con; con = con->next) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce != 0.0f)) { + bKinematicConstraint *data = con->data; - if (data->tar==NULL) + if (data->tar == NULL) return data; - if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0) + if (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0) return data; } } @@ -388,44 +388,44 @@ static short apply_targetless_ik(Object *ob) { bPoseChannel *pchan, *parchan, *chanlist[256]; bKinematicConstraint *data; - int segcount, apply= 0; + int segcount, apply = 0; /* now we got a difficult situation... we have to find the * target-less IK pchans, and apply transformation to the all * pchans that were in the chain */ - for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { - data= has_targetless_ik(pchan); + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + data = has_targetless_ik(pchan); if (data && (data->flag & CONSTRAINT_IK_AUTO)) { /* fill the array with the bones of the chain (armature.c does same, keep it synced) */ - segcount= 0; + segcount = 0; /* exclude tip from chain? */ if (!(data->flag & CONSTRAINT_IK_TIP)) - parchan= pchan->parent; + parchan = pchan->parent; else - parchan= pchan; + parchan = pchan; /* Find the chain's root & count the segments needed */ - for (; parchan; parchan=parchan->parent) { - chanlist[segcount]= parchan; + for (; parchan; parchan = parchan->parent) { + chanlist[segcount] = parchan; segcount++; - if (segcount==data->rootbone || segcount>255) break; // 255 is weak + if (segcount == data->rootbone || segcount > 255) break; // 255 is weak } - for (;segcount;segcount--) { + for (; segcount; segcount--) { Bone *bone; - float rmat[4][4]/*, tmat[4][4], imat[4][4]*/; + float rmat[4][4] /*, tmat[4][4], imat[4][4]*/; /* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */ /* we put in channel the entire result of rmat= (channel * constraint * IK) */ /* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */ /* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */ - parchan= chanlist[segcount-1]; - bone= parchan->bone; - bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */ + parchan = chanlist[segcount - 1]; + bone = parchan->bone; + bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */ BKE_armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat); @@ -436,11 +436,11 @@ static short apply_targetless_ik(Object *ob) copy_m3_m4(rmat3, rmat); /* rotation */ - /* [#22409] is partially caused by this, as slight numeric error introduced during - * the solving process leads to locked-axis values changing. However, we cannot modify - * the values here, or else there are huge discreptancies between IK-solver (interactive) - * and applied poses. - */ + /* [#22409] is partially caused by this, as slight numeric error introduced during + * the solving process leads to locked-axis values changing. However, we cannot modify + * the values here, or else there are huge discreptancies between IK-solver (interactive) + * and applied poses. + */ if (parchan->rotmode > 0) mat3_to_eulO(parchan->eul, parchan->rotmode, rmat3); else if (parchan->rotmode == ROT_MODE_AXISANGLE) @@ -470,7 +470,7 @@ static short apply_targetless_ik(Object *ob) } - apply= 1; + apply = 1; data->flag &= ~CONSTRAINT_IK_AUTO; } } @@ -480,7 +480,7 @@ static short apply_targetless_ik(Object *ob) static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td) { - Bone *bone= pchan->bone; + Bone *bone = pchan->bone; float pmat[3][3], omat[3][3]; float cmat[3][3], tmat[3][3]; float vec[3]; @@ -499,40 +499,40 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr td->flag |= TD_NO_LOC; } - td->protectflag= pchan->protectflag; + td->protectflag = pchan->protectflag; td->loc = pchan->loc; copy_v3_v3(td->iloc, pchan->loc); - td->ext->size= pchan->size; + td->ext->size = pchan->size; copy_v3_v3(td->ext->isize, pchan->size); if (pchan->rotmode > 0) { - td->ext->rot= pchan->eul; - td->ext->rotAxis= NULL; - td->ext->rotAngle= NULL; - td->ext->quat= NULL; + td->ext->rot = pchan->eul; + td->ext->rotAxis = NULL; + td->ext->rotAngle = NULL; + td->ext->quat = NULL; copy_v3_v3(td->ext->irot, pchan->eul); } else if (pchan->rotmode == ROT_MODE_AXISANGLE) { - td->ext->rot= NULL; - td->ext->rotAxis= pchan->rotAxis; - td->ext->rotAngle= &pchan->rotAngle; - td->ext->quat= NULL; + td->ext->rot = NULL; + td->ext->rotAxis = pchan->rotAxis; + td->ext->rotAngle = &pchan->rotAngle; + td->ext->quat = NULL; - td->ext->irotAngle= pchan->rotAngle; + td->ext->irotAngle = pchan->rotAngle; copy_v3_v3(td->ext->irotAxis, pchan->rotAxis); } else { - td->ext->rot= NULL; - td->ext->rotAxis= NULL; - td->ext->rotAngle= NULL; - td->ext->quat= pchan->quat; + td->ext->rot = NULL; + td->ext->rotAxis = NULL; + td->ext->rotAngle = NULL; + td->ext->quat = pchan->quat; copy_qt_qt(td->ext->iquat, pchan->quat); } - td->ext->rotOrder= pchan->rotmode; + td->ext->rotOrder = pchan->rotmode; /* proper way to get parent transform + own transform + constraints transform */ @@ -559,11 +559,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr copy_m3_m4(tmat, pchan->constinv); invert_m3_m3(cmat, tmat); mul_serie_m3(td->mtx, pmat, omat, cmat, NULL, NULL, NULL, NULL, NULL); - mul_serie_m3(td->ext->r_mtx, rpmat, omat, cmat, NULL,NULL,NULL,NULL,NULL); + mul_serie_m3(td->ext->r_mtx, rpmat, omat, cmat, NULL, NULL, NULL, NULL, NULL); } else { - mul_serie_m3(td->mtx, pmat, omat, NULL, NULL,NULL,NULL,NULL,NULL); - mul_serie_m3(td->ext->r_mtx, rpmat, omat, NULL, NULL,NULL,NULL,NULL,NULL); + mul_serie_m3(td->mtx, pmat, omat, NULL, NULL, NULL, NULL, NULL, NULL); + mul_serie_m3(td->ext->r_mtx, rpmat, omat, NULL, NULL, NULL, NULL, NULL, NULL); } invert_m3_m3(td->ext->r_smtx, td->ext->r_mtx); } @@ -588,25 +588,25 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr mul_m3_m3m3(td->axismtx, omat, pmat); normalize_m3(td->axismtx); - if (t->mode==TFM_BONESIZE) { - bArmature *arm= t->poseobj->data; + if (t->mode == TFM_BONESIZE) { + bArmature *arm = t->poseobj->data; - if (arm->drawtype==ARM_ENVELOPE) { - td->loc= NULL; - td->val= &bone->dist; - td->ival= bone->dist; + if (arm->drawtype == ARM_ENVELOPE) { + td->loc = NULL; + td->val = &bone->dist; + td->ival = bone->dist; } else { // abusive storage of scale in the loc pointer :) - td->loc= &bone->xwidth; + td->loc = &bone->xwidth; copy_v3_v3(td->iloc, td->loc); - td->val= NULL; + td->val = NULL; } } /* in this case we can do target-less IK grabbing */ - if (t->mode==TFM_TRANSLATION) { - bKinematicConstraint *data= has_targetless_ik(pchan); + if (t->mode == TFM_TRANSLATION) { + bKinematicConstraint *data = has_targetless_ik(pchan); if (data) { if (data->flag & CONSTRAINT_IK_TIP) { copy_v3_v3(data->grabtarget, pchan->pose_tail); @@ -625,14 +625,14 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr } /* store reference to first constraint */ - td->con= pchan->constraints.first; + td->con = pchan->constraints.first; } static void bone_children_clear_transflag(int mode, short around, ListBase *lb) { - Bone *bone= lb->first; + Bone *bone = lb->first; - for ( ; bone;bone= bone->next) { + for (; bone; bone = bone->next) { if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED)) { bone->flag |= BONE_HINGE_CHILD_TRANSFORM; } @@ -654,7 +654,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) * returns total number of bones with BONE_TRANSFORM */ int count_set_pose_transflags(int *out_mode, short around, Object *ob) { - bArmature *arm= ob->data; + bArmature *arm = ob->data; bPoseChannel *pchan; Bone *bone; int mode = *out_mode; @@ -699,7 +699,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM) hastranslation = 1; } - else if ((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC) + else if ((pchan->protectflag & OB_LOCK_LOC) != OB_LOCK_LOC) hastranslation = 1; } else @@ -720,26 +720,26 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) /* -------- Auto-IK ---------- */ /* adjust pose-channel's auto-ik chainlen */ -static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen) +static void pchan_autoik_adjust(bPoseChannel *pchan, short chainlen) { bConstraint *con; /* don't bother to search if no valid constraints */ - if ((pchan->constflag & (PCHAN_HAS_IK|PCHAN_HAS_TARGET))==0) + if ((pchan->constflag & (PCHAN_HAS_IK | PCHAN_HAS_TARGET)) == 0) return; /* check if pchan has ik-constraint */ - for (con= pchan->constraints.first; con; con= con->next) { - if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) { - bKinematicConstraint *data= con->data; + for (con = pchan->constraints.first; con; con = con->next) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce != 0.0f)) { + bKinematicConstraint *data = con->data; /* only accept if a temporary one (for auto-ik) */ if (data->flag & CONSTRAINT_IK_TEMP) { /* chainlen is new chainlen, but is limited by maximum chainlen */ - if ((chainlen==0) || (chainlen > data->max_rootbone)) - data->rootbone= data->max_rootbone; + if ((chainlen == 0) || (chainlen > data->max_rootbone)) + data->rootbone = data->max_rootbone; else - data->rootbone= chainlen; + data->rootbone = chainlen; } } } @@ -748,7 +748,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen) /* change the chain-length of auto-ik */ void transform_autoik_update(TransInfo *t, short mode) { - short *chainlen= &t->settings->autoik_chainlen; + short *chainlen = &t->settings->autoik_chainlen; bPoseChannel *pchan; /* mode determines what change to apply to chainlen */ @@ -766,7 +766,7 @@ void transform_autoik_update(TransInfo *t, short mode) return; /* apply to all pose-channels */ - for (pchan=t->poseobj->pose->chanbase.first; pchan; pchan=pchan->next) { + for (pchan = t->poseobj->pose->chanbase.first; pchan; pchan = pchan->next) { pchan_autoik_adjust(pchan, *chainlen); } } @@ -778,17 +778,17 @@ static void pose_grab_with_ik_clear(Object *ob) bPoseChannel *pchan; bConstraint *con, *next; - for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { /* clear all temporary lock flags */ - pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP|BONE_IK_NO_YDOF_TEMP|BONE_IK_NO_ZDOF_TEMP); + pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP | BONE_IK_NO_YDOF_TEMP | BONE_IK_NO_ZDOF_TEMP); - pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET); + pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* remove all temporary IK-constraints added */ - for (con= pchan->constraints.first; con; con= next) { - next= con->next; - if (con->type==CONSTRAINT_TYPE_KINEMATIC) { - data= con->data; + for (con = pchan->constraints.first; con; con = next) { + next = con->next; + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { + data = con->data; if (data->flag & CONSTRAINT_IK_TEMP) { BLI_remlink(&pchan->constraints, con); MEM_freeN(con->data); @@ -796,7 +796,7 @@ static void pose_grab_with_ik_clear(Object *ob) continue; } pchan->constflag |= PCHAN_HAS_IK; - if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)) + if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0)) pchan->constflag |= PCHAN_HAS_TARGET; } } @@ -815,21 +815,21 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) return 0; /* Rule: not if there's already an IK on this channel */ - for (con= pchan->constraints.first; con; con= con->next) { - if (con->type==CONSTRAINT_TYPE_KINEMATIC) { - data= con->data; + for (con = pchan->constraints.first; con; con = con->next) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { + data = con->data; - if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]=='\0')) { + if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == '\0')) { /* make reference to constraint to base things off later (if it's the last targetless constraint encountered) */ targetless = (bKinematicConstraint *)con->data; /* but, if this is a targetless IK, we make it auto anyway (for the children loop) */ - if (con->enforce!=0.0f) { + if (con->enforce != 0.0f) { data->flag |= CONSTRAINT_IK_AUTO; /* if no chain length has been specified, just make things obey standard rotation locks too */ if (data->rootbone == 0) { - for (; pchan; pchan=pchan->parent) { + for (; pchan; pchan = pchan->parent) { /* here, we set ik-settings for bone from pchan->protectflag */ // XXX: careful with quats/axis-angle rotations where we're locking 4d components if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP; @@ -842,23 +842,23 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) } } - if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f)) + if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) return 0; } } con = add_pose_constraint(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC); - pchan->constflag |= (PCHAN_HAS_IK|PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */ - data= con->data; + pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */ + data = con->data; if (targetless) { /* if exists, use values from last targetless (but disabled) IK-constraint as base */ *data = *targetless; } else - data->flag= CONSTRAINT_IK_TIP; - data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO; + data->flag = CONSTRAINT_IK_TIP; + data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO; copy_v3_v3(data->grabtarget, pchan->pose_tail); - data->rootbone= 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */ + data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */ /* we only include bones that are part of a continual connected chain */ while (pchan) { @@ -879,7 +879,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) } /* make a copy of maximum chain-length */ - data->max_rootbone= data->rootbone; + data->max_rootbone = data->rootbone; return 1; } @@ -888,19 +888,19 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) static short pose_grab_with_ik_children(bPose *pose, Bone *bone) { Bone *bonec; - short wentdeeper=0, added=0; + short wentdeeper = 0, added = 0; /* go deeper if children & children are connected */ - for (bonec= bone->childbase.first; bonec; bonec= bonec->next) { + for (bonec = bone->childbase.first; bonec; bonec = bonec->next) { if (bonec->flag & BONE_CONNECTED) { - wentdeeper= 1; - added+= pose_grab_with_ik_children(pose, bonec); + wentdeeper = 1; + added += pose_grab_with_ik_children(pose, bonec); } } - if (wentdeeper==0) { - bPoseChannel *pchan= BKE_pose_channel_find_name(pose, bone->name); + if (wentdeeper == 0) { + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, bone->name); if (pchan) - added+= pose_grab_with_ik_add(pchan); + added += pose_grab_with_ik_add(pchan); } return added; @@ -912,30 +912,30 @@ static short pose_grab_with_ik(Object *ob) bArmature *arm; bPoseChannel *pchan, *parent; Bone *bonec; - short tot_ik= 0; + short tot_ik = 0; - if ((ob==NULL) || (ob->pose==NULL) || (ob->mode & OB_MODE_POSE)==0) + if ((ob == NULL) || (ob->pose == NULL) || (ob->mode & OB_MODE_POSE) == 0) return 0; arm = ob->data; /* Rule: allow multiple Bones (but they must be selected, and only one ik-solver per chain should get added) */ - for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->layer & arm->layer) { if (pchan->bone->flag & BONE_SELECTED) { /* Rule: no IK for solitatry (unconnected) bones */ - for (bonec=pchan->bone->childbase.first; bonec; bonec=bonec->next) { + for (bonec = pchan->bone->childbase.first; bonec; bonec = bonec->next) { if (bonec->flag & BONE_CONNECTED) { break; } } - if ((pchan->bone->flag & BONE_CONNECTED)==0 && (bonec == NULL)) + if ((pchan->bone->flag & BONE_CONNECTED) == 0 && (bonec == NULL)) continue; /* rule: if selected Bone is not a root bone, it gets a temporal IK */ if (pchan->parent) { /* only adds if there's no IK yet (and no parent bone was selected) */ - for (parent= pchan->parent; parent; parent= parent->parent) { + for (parent = pchan->parent; parent; parent = parent->parent) { if (parent->bone->flag & BONE_SELECTED) break; } @@ -961,17 +961,17 @@ static void createTransPose(TransInfo *t, Object *ob) bPoseChannel *pchan; TransData *td; TransDataExtension *tdx; - short ik_on= 0; + short ik_on = 0; int i; - t->total= 0; + t->total = 0; /* check validity of state */ - arm= BKE_armature_from_object(ob); - if ((arm==NULL) || (ob->pose==NULL)) return; + arm = BKE_armature_from_object(ob); + if ((arm == NULL) || (ob->pose == NULL)) return; if (arm->flag & ARM_RESTPOS) { - if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) { + if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE) == 0) { // XXX use transform operator reports // BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled"); return; @@ -979,8 +979,8 @@ static void createTransPose(TransInfo *t, Object *ob) } /* do we need to add temporal IK chains? */ - if ((arm->flag & ARM_AUTO_IK) && t->mode==TFM_TRANSLATION) { - ik_on= pose_grab_with_ik(ob); + if ((arm->flag & ARM_AUTO_IK) && t->mode == TFM_TRANSLATION) { + ik_on = pose_grab_with_ik(ob); if (ik_on) t->flag |= T_AUTOIK; } @@ -990,26 +990,26 @@ static void createTransPose(TransInfo *t, Object *ob) if (t->total == 0) return; t->flag |= T_POSE; - t->poseobj= ob; /* we also allow non-active objects to be transformed, in weightpaint */ + t->poseobj = ob; /* we also allow non-active objects to be transformed, in weightpaint */ /* init trans data */ - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone"); - tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt"); - for (i=0; i<t->total; i++, td++, tdx++) { - td->ext= tdx; + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransPoseBone"); + tdx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "TransPoseBoneExt"); + for (i = 0; i < t->total; i++, td++, tdx++) { + td->ext = tdx; td->val = NULL; } /* use pose channels to fill trans data */ - td= t->data; - for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + td = t->data; + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->flag & BONE_TRANSFORM) { add_pose_transdata(t, pchan, ob, td); td++; } } - if (td != (t->data+t->total)) { + if (td != (t->data + t->total)) { // XXX use transform operator reports // BKE_report(op->reports, RPT_DEBUG, "Bone selection count error"); } @@ -1023,18 +1023,18 @@ static void createTransPose(TransInfo *t, Object *ob) static void createTransArmatureVerts(TransInfo *t) { EditBone *ebo; - bArmature *arm= t->obedit->data; + bArmature *arm = t->obedit->data; ListBase *edbo = arm->edbo; TransData *td; float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3]; /* special hack for envelope drawmode and scaling: - * to allow scaling the size of the envelope around single points, + * to allow scaling the size of the envelope around single points, * mode should become TFM_BONE_ENVELOPE in this case */ // TODO: maybe we need a separate hotkey for it, but this is consistent with 2.4x for now - if ((t->mode == TFM_RESIZE) && (arm->drawtype==ARM_ENVELOPE)) - t->mode= TFM_BONE_ENVELOPE; + if ((t->mode == TFM_RESIZE) && (arm->drawtype == ARM_ENVELOPE)) + t->mode = TFM_BONE_ENVELOPE; t->total = 0; for (ebo = edbo->first; ebo; ebo = ebo->next) { @@ -1061,19 +1061,19 @@ static void createTransArmatureVerts(TransInfo *t) copy_m3_m4(mtx, t->obedit->obmat); invert_m3_m3(smtx, mtx); - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransEditBone"); for (ebo = edbo->first; ebo; ebo = ebo->next) { - ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points + ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) { - if (t->mode==TFM_BONE_ENVELOPE) { + if (t->mode == TFM_BONE_ENVELOPE) { if (ebo->flag & BONE_ROOTSEL) { - td->val= &ebo->rad_head; - td->ival= *td->val; + td->val = &ebo->rad_head; + td->ival = *td->val; copy_v3_v3(td->center, ebo->head); - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1085,10 +1085,10 @@ static void createTransArmatureVerts(TransInfo *t) td++; } if (ebo->flag & BONE_TIPSEL) { - td->val= &ebo->rad_tail; - td->ival= *td->val; + td->val = &ebo->rad_tail; + td->ival = *td->val; copy_v3_v3(td->center, ebo->tail); - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1101,21 +1101,21 @@ static void createTransArmatureVerts(TransInfo *t) } } - else if (t->mode==TFM_BONESIZE) { + else if (t->mode == TFM_BONESIZE) { if (ebo->flag & BONE_SELECTED) { - if (arm->drawtype==ARM_ENVELOPE) { - td->loc= NULL; - td->val= &ebo->dist; - td->ival= ebo->dist; + if (arm->drawtype == ARM_ENVELOPE) { + td->loc = NULL; + td->val = &ebo->dist; + td->ival = ebo->dist; } else { // abusive storage of scale in the loc pointer :) - td->loc= &ebo->xwidth; + td->loc = &ebo->xwidth; copy_v3_v3(td->iloc, td->loc); - td->val= NULL; + td->val = NULL; } copy_v3_v3(td->center, ebo->head); - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; /* use local bone matrix */ sub_v3_v3v3(delta, ebo->tail, ebo->head); @@ -1132,14 +1132,14 @@ static void createTransArmatureVerts(TransInfo *t) td++; } } - else if (t->mode==TFM_BONE_ROLL) { + else if (t->mode == TFM_BONE_ROLL) { if (ebo->flag & BONE_SELECTED) { - td->loc= NULL; - td->val= &(ebo->roll); - td->ival= ebo->roll; + td->loc = NULL; + td->val = &(ebo->roll); + td->ival = ebo->roll; copy_v3_v3(td->center, ebo->head); - td->flag= TD_SELECTED; + td->flag = TD_SELECTED; td->ext = NULL; td->ob = t->obedit; @@ -1150,11 +1150,11 @@ static void createTransArmatureVerts(TransInfo *t) else { if (ebo->flag & BONE_TIPSEL) { copy_v3_v3(td->iloc, ebo->tail); - copy_v3_v3(td->center, (t->around==V3D_LOCAL) ? ebo->head : td->iloc); - td->loc= ebo->tail; - td->flag= TD_SELECTED; + copy_v3_v3(td->center, (t->around == V3D_LOCAL) ? ebo->head : td->iloc); + td->loc = ebo->tail; + td->flag = TD_SELECTED; if (ebo->flag & BONE_EDITMODE_LOCKED) - td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE; + td->protectflag = OB_LOCK_LOC | OB_LOCK_ROT | OB_LOCK_SCALE; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1175,10 +1175,10 @@ static void createTransArmatureVerts(TransInfo *t) if (ebo->flag & BONE_ROOTSEL) { copy_v3_v3(td->iloc, ebo->head); copy_v3_v3(td->center, td->iloc); - td->loc= ebo->head; - td->flag= TD_SELECTED; + td->loc = ebo->head; + td->flag = TD_SELECTED; if (ebo->flag & BONE_EDITMODE_LOCKED) - td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE; + td->protectflag = OB_LOCK_LOC | OB_LOCK_ROT | OB_LOCK_SCALE; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1203,40 +1203,40 @@ static void createTransArmatureVerts(TransInfo *t) static void createTransMBallVerts(TransInfo *t) { - MetaBall *mb = (MetaBall*)t->obedit->data; + MetaBall *mb = (MetaBall *)t->obedit->data; MetaElem *ml; TransData *td; TransDataExtension *tx; float mtx[3][3], smtx[3][3]; - int count=0, countsel=0; + int count = 0, countsel = 0; int propmode = t->flag & T_PROP_EDIT; /* count totals */ - for (ml= mb->editelems->first; ml; ml= ml->next) { + for (ml = mb->editelems->first; ml; ml = ml->next) { if (ml->flag & SELECT) countsel++; if (propmode) count++; } /* note: in prop mode we need at least 1 selected */ - if (countsel==0) return; + if (countsel == 0) return; if (propmode) t->total = count; else t->total = countsel; - td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)"); - tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "MetaElement_TransExtension"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(MBall EditMode)"); + tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "MetaElement_TransExtension"); copy_m3_m4(mtx, t->obedit->obmat); invert_m3_m3(smtx, mtx); - for (ml= mb->editelems->first; ml; ml= ml->next) { + for (ml = mb->editelems->first; ml; ml = ml->next) { if (propmode || (ml->flag & SELECT)) { - td->loc= &ml->x; + td->loc = &ml->x; copy_v3_v3(td->iloc, td->loc); copy_v3_v3(td->center, td->loc); - if (ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE; - else td->flag= TD_USEQUAT; + if (ml->flag & SELECT) td->flag = TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE; + else td->flag = TD_USEQUAT; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1276,7 +1276,7 @@ static void createTransMBallVerts(TransInfo *t) static void calc_distanceCurveVerts(TransData *head, TransData *tail) { TransData *td, *td_near = NULL; - for (td = head; td<=tail; td++) { + for (td = head; td <= tail; td++) { if (td->flag & TD_SELECTED) { td_near = td; td->dist = 0.0f; @@ -1284,8 +1284,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) else if (td_near) { float dist; dist = len_v3v3(td_near->center, td->center); - if (dist < (td-1)->dist) { - td->dist = (td-1)->dist; + if (dist < (td - 1)->dist) { + td->dist = (td - 1)->dist; } else { td->dist = dist; @@ -1297,7 +1297,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) } } td_near = NULL; - for (td = tail; td>=head; td--) { + for (td = tail; td >= head; td--) { if (td->flag & TD_SELECTED) { td_near = td; td->dist = 0.0f; @@ -1305,10 +1305,10 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) else if (td_near) { float dist; dist = len_v3v3(td_near->center, td->center); - if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) { + if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td + 1)->dist < td->dist) { td->flag &= ~TD_NOTCONNECTED; - if (dist < (td+1)->dist) { - td->dist = (td+1)->dist; + if (dist < (td + 1)->dist) { + td->dist = (td + 1)->dist; } else { td->dist = dist; @@ -1333,44 +1333,44 @@ static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struc static void createTransCurveVerts(bContext *C, TransInfo *t) { - Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; + Object *obedit = CTX_data_edit_object(C); + Curve *cu = obedit->data; TransData *td = NULL; Nurb *nu; BezTriple *bezt; BPoint *bp; float mtx[3][3], smtx[3][3]; int a; - int count=0, countsel=0; + int count = 0, countsel = 0; int propmode = t->flag & T_PROP_EDIT; short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); ListBase *nurbs; /* to be sure */ - if (cu->editnurb==NULL) return; + if (cu->editnurb == NULL) return; /* count total of vertices, check identical as in 2nd loop for making transdata! */ - nurbs= BKE_curve_editNurbs_get(cu); - for (nu= nurbs->first; nu; nu= nu->next) { + nurbs = BKE_curve_editNurbs_get(cu); + for (nu = nurbs->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { - for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) { - if (bezt->hide==0) { + for (a = 0, bezt = nu->bezt; a < nu->pntsu; a++, bezt++) { + if (bezt->hide == 0) { if (hide_handles) { - if (bezt->f2 & SELECT) countsel+=3; - if (propmode) count+= 3; + if (bezt->f2 & SELECT) countsel += 3; + if (propmode) count += 3; } else { if (bezt->f1 & SELECT) countsel++; if (bezt->f2 & SELECT) countsel++; if (bezt->f3 & SELECT) countsel++; - if (propmode) count+= 3; + if (propmode) count += 3; } } } } else { - for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) { - if (bp->hide==0) { + for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a > 0; a--, bp++) { + if (bp->hide == 0) { if (propmode) count++; if (bp->f1 & SELECT) countsel++; } @@ -1378,22 +1378,22 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) } } /* note: in prop mode we need at least 1 selected */ - if (countsel==0) return; + if (countsel == 0) return; if (propmode) t->total = count; else t->total = countsel; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)"); + t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Curve EditMode)"); copy_m3_m4(mtx, t->obedit->obmat); invert_m3_m3(smtx, mtx); td = t->data; - for (nu= nurbs->first; nu; nu= nu->next) { + for (nu = nurbs->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { TransData *head, *tail; head = tail = td; - for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) { - if (bezt->hide==0) { + for (a = 0, bezt = nu->bezt; a < nu->pntsu; a++, bezt++) { + if (bezt->hide == 0) { TransDataCurveHandleFlags *hdata = NULL; if (propmode || @@ -1401,15 +1401,15 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) ((bezt->f1 & SELECT) && hide_handles == 0)) { copy_v3_v3(td->iloc, bezt->vec[0]); - td->loc= bezt->vec[0]; - copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]); + td->loc = bezt->vec[0]; + copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1 : 0]); if (hide_handles) { - if (bezt->f2 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bezt->f2 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; } else { - if (bezt->f1 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bezt->f1 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; } td->ext = NULL; td->val = NULL; @@ -1427,17 +1427,17 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) /* This is the Curve Point, the other two are handles */ if (propmode || (bezt->f2 & SELECT)) { copy_v3_v3(td->iloc, bezt->vec[1]); - td->loc= bezt->vec[1]; + td->loc = bezt->vec[1]; copy_v3_v3(td->center, td->loc); - if (bezt->f2 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bezt->f2 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; td->ext = NULL; - if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */ + if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */ td->val = &(bezt->radius); td->ival = bezt->radius; } - else if (t->mode==TFM_TILT) { + else if (t->mode == TFM_TILT) { td->val = &(bezt->alfa); td->ival = bezt->alfa; } @@ -1448,11 +1448,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); - if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0) - /* If the middle is selected but the sides arnt, this is needed */ - if (hdata==NULL) { /* if the handle was not saved by the previous handle */ - hdata = initTransDataCurveHandles(td, bezt); - } + if ((bezt->f1 & SELECT) == 0 && (bezt->f3 & SELECT) == 0) + /* If the middle is selected but the sides arnt, this is needed */ + if (hdata == NULL) { /* if the handle was not saved by the previous handle */ + hdata = initTransDataCurveHandles(td, bezt); + } td++; count++; @@ -1463,20 +1463,20 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) ((bezt->f3 & SELECT) && hide_handles == 0)) { copy_v3_v3(td->iloc, bezt->vec[2]); - td->loc= bezt->vec[2]; - copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]); + td->loc = bezt->vec[2]; + copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1 : 2]); if (hide_handles) { - if (bezt->f2 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bezt->f2 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; } else { - if (bezt->f3 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bezt->f3 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; } td->ext = NULL; td->val = NULL; - if (hdata==NULL) { /* if the handle was not saved by the previous handle */ + if (hdata == NULL) { /* if the handle was not saved by the previous handle */ hdata = initTransDataCurveHandles(td, bezt); } @@ -1489,12 +1489,12 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) } } else if (propmode && head != tail) { - calc_distanceCurveVerts(head, tail-1); + calc_distanceCurveVerts(head, tail - 1); head = tail; } } if (propmode && head != tail) - calc_distanceCurveVerts(head, tail-1); + calc_distanceCurveVerts(head, tail - 1); /* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles * but for now just don't change handle types */ @@ -1506,17 +1506,17 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) else { TransData *head, *tail; head = tail = td; - for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) { - if (bp->hide==0) { + for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a > 0; a--, bp++) { + if (bp->hide == 0) { if (propmode || (bp->f1 & SELECT)) { copy_v3_v3(td->iloc, bp->vec); - td->loc= bp->vec; + td->loc = bp->vec; copy_v3_v3(td->center, td->loc); - if (bp->f1 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bp->f1 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; td->ext = NULL; - if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) { + if (t->mode == TFM_CURVE_SHRINKFATTEN || t->mode == TFM_RESIZE) { td->val = &(bp->radius); td->ival = bp->radius; } @@ -1534,12 +1534,12 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) } } else if (propmode && head != tail) { - calc_distanceCurveVerts(head, tail-1); + calc_distanceCurveVerts(head, tail - 1); head = tail; } } if (propmode && head != tail) - calc_distanceCurveVerts(head, tail-1); + calc_distanceCurveVerts(head, tail - 1); } } } @@ -1548,30 +1548,30 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) static void createTransLatticeVerts(TransInfo *t) { - Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt; + Lattice *latt = ((Lattice *)t->obedit->data)->editlatt->latt; TransData *td = NULL; BPoint *bp; float mtx[3][3], smtx[3][3]; int a; - int count=0, countsel=0; + int count = 0, countsel = 0; int propmode = t->flag & T_PROP_EDIT; bp = latt->def; a = latt->pntsu * latt->pntsv * latt->pntsw; while (a--) { - if (bp->hide==0) { + if (bp->hide == 0) { if (bp->f1 & SELECT) countsel++; if (propmode) count++; } bp++; } - /* note: in prop mode we need at least 1 selected */ - if (countsel==0) return; + /* note: in prop mode we need at least 1 selected */ + if (countsel == 0) return; if (propmode) t->total = count; else t->total = countsel; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)"); + t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Lattice EditMode)"); copy_m3_m4(mtx, t->obedit->obmat); invert_m3_m3(smtx, mtx); @@ -1581,12 +1581,12 @@ static void createTransLatticeVerts(TransInfo *t) a = latt->pntsu * latt->pntsv * latt->pntsw; while (a--) { if (propmode || (bp->f1 & SELECT)) { - if (bp->hide==0) { + if (bp->hide == 0) { copy_v3_v3(td->iloc, bp->vec); - td->loc= bp->vec; + td->loc = bp->vec; copy_v3_v3(td->center, td->loc); - if (bp->f1 & SELECT) td->flag= TD_SELECTED; - else td->flag= 0; + if (bp->f1 & SELECT) td->flag = TD_SELECTED; + else td->flag = 0; copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -1619,7 +1619,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) int count = 0, hasselected = 0; int propmode = t->flag & T_PROP_EDIT; - if (edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return; + if (edit == NULL || t->settings->particle.selectmode == SCE_SELECT_PATH) return; psys = edit->psys; @@ -1628,19 +1628,19 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) base->flag |= BA_HAS_RECALC_DATA; - for (i=0, point=edit->points; i<edit->totpoint; i++, point++) { + for (i = 0, point = edit->points; i < edit->totpoint; i++, point++) { point->flag &= ~PEP_TRANSFORM; - transformparticle= 0; - - if ((point->flag & PEP_HIDE)==0) { - for (k=0, key=point->keys; k<point->totkey; k++, key++) { - if ((key->flag&PEK_HIDE)==0) { - if (key->flag&PEK_SELECT) { - hasselected= 1; - transformparticle= 1; + transformparticle = 0; + + if ((point->flag & PEP_HIDE) == 0) { + for (k = 0, key = point->keys; k < point->totkey; k++, key++) { + if ((key->flag & PEK_HIDE) == 0) { + if (key->flag & PEK_SELECT) { + hasselected = 1; + transformparticle = 1; } else if (propmode) - transformparticle= 1; + transformparticle = 1; } } } @@ -1651,8 +1651,8 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) } } - /* note: in prop mode we need at least 1 selected */ - if (hasselected==0) return; + /* note: in prop mode we need at least 1 selected */ + if (hasselected == 0) return; t->total = count; td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)"); @@ -1666,7 +1666,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) invert_m4_m4(ob->imat, ob->obmat); - for (i=0, point=edit->points; i<edit->totpoint; i++, point++) { + for (i = 0, point = edit->points; i < edit->totpoint; i++, point++) { TransData *head, *tail; head = tail = td; @@ -1675,7 +1675,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat); - for (k=0, key=point->keys; k<point->totkey; k++, key++) { + for (k = 0, key = point->keys; k < point->totkey; k++, key++) { if (key->flag & PEK_USE_WCO) { copy_v3_v3(key->world_co, key->co); mul_m4_v3(mat, key->world_co); @@ -1696,7 +1696,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) unit_m3(td->smtx); /* don't allow moving roots */ - if (k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR))) + if (k == 0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR))) td->protectflag |= OB_LOCK_LOC; td->ob = ob; @@ -1706,7 +1706,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) td->ival = *(key->time); /* abuse size and quat for min/max values */ td->flag |= TD_NO_EXT; - if (k==0) tx->size = NULL; + if (k == 0) tx->size = NULL; else tx->size = (key - 1)->time; if (k == point->totkey - 1) tx->quat = NULL; @@ -1741,15 +1741,15 @@ void flushTransParticles(TransInfo *t) /* we do transform in world space, so flush world space position * back to particle local space (only for hair particles) */ - td= t->data; - for (i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) { + td = t->data; + for (i = 0, point = edit->points; i < edit->totpoint; i++, point++, td++) { if (!(point->flag & PEP_TRANSFORM)) continue; if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat); invert_m4_m4(imat, mat); - for (k=0, key=point->keys; k<point->totkey; k++, key++) { + for (k = 0, key = point->keys; k < point->totkey; k++, key++) { copy_v3_v3(co, key->world_co); mul_m4_v3(imat, co); @@ -1771,7 +1771,7 @@ void flushTransParticles(TransInfo *t) /* ********************* mesh ****************** */ /* proportional distance based on connectivity */ -#define THRESHOLDFACTOR (1.0f-0.0001f) +#define THRESHOLDFACTOR (1.0f - 0.0001f) /* I did this wrong, it should be a breadth-first search * but instead it's a depth-first search, fudged @@ -1781,10 +1781,10 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f { BMVert **queue = NULL; float *dqueue = NULL; - int *tots = MEM_callocN(sizeof(int)*em->bm->totvert, "tots editmesh_set_connectivity_distance"); + int *tots = MEM_callocN(sizeof(int) * em->bm->totvert, "tots editmesh_set_connectivity_distance"); BLI_array_declare(queue); BLI_array_declare(dqueue); - SmallHash svisit, *visit=&svisit; + SmallHash svisit, *visit = &svisit; BMVert *v; BMIter viter; int i, start; @@ -1796,7 +1796,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f BLI_smallhash_init(visit); BM_ITER_MESH (v, &viter, em->bm, BM_VERTS_OF_MESH) { - if (BM_elem_flag_test(v, BM_ELEM_SELECT)==0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN)) + if (BM_elem_flag_test(v, BM_ELEM_SELECT) == 0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN)) continue; @@ -1849,7 +1849,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f BLI_smallhash_release(visit); - for (i=0; i<em->bm->totvert; i++) { + for (i = 0; i < em->bm->totvert; i++) { if (tots[i]) dists[i] /= (float)tots[i]; } @@ -1860,7 +1860,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f } /* loop-in-a-loop I know, but we need it! (ton) */ - static void get_face_center(float cent_r[3], BMVert *eve) +static void get_face_center(float cent_r[3], BMVert *eve) { BMFace *efa; @@ -1899,7 +1899,7 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx copy_v3_v3(td->center, td->loc); - if (t->around==V3D_LOCAL) { + if (t->around == V3D_LOCAL) { if (em->selectmode & SCE_SELECT_FACE) get_face_center(td->center, eve); else if (em->selectmode & SCE_SELECT_EDGE) @@ -1910,11 +1910,11 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx // Setting normals copy_v3_v3(td->axismtx[2], eve->no); td->axismtx[0][0] = - td->axismtx[0][1] = - td->axismtx[0][2] = - td->axismtx[1][0] = - td->axismtx[1][1] = - td->axismtx[1][2] = 0.0f; + td->axismtx[0][1] = + td->axismtx[0][2] = + td->axismtx[1][0] = + td->axismtx[1][1] = + td->axismtx[1][2] = 0.0f; td->ext = NULL; td->val = NULL; @@ -1945,10 +1945,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t) BMVert *eve; BMIter iter; BMVert *eve_act = NULL; - float *mappedcos = NULL, *quats= NULL; + float *mappedcos = NULL, *quats = NULL; float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; - float *dists=NULL; - int count=0, countsel=0, a, totleft; + float *dists = NULL; + int count = 0, countsel = 0, a, totleft; int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) : 0; int mirror = 0; char *selstate = NULL; @@ -1977,10 +1977,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t) BMEdge *eed; eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); + for (; eve; eve = BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); - for ( ; eed; eed=BM_iter_step(&iter)) { + for (; eed; eed = BM_iter_step(&iter)) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { BM_elem_flag_enable(eed->v1, BM_ELEM_TAG); BM_elem_flag_enable(eed->v2, BM_ELEM_TAG); @@ -1990,16 +1990,16 @@ static void createTransEditVerts(bContext *C, TransInfo *t) else { BMFace *efa; eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); + for (; eve; eve = BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); - for ( ; efa; efa=BM_iter_step(&iter)) { + for (; efa; efa = BM_iter_step(&iter)) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BMIter liter; BMLoop *l; l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, efa); - for (; l; l=BM_iter_step(&liter)) { + for (; l; l = BM_iter_step(&liter)) { BM_elem_flag_enable(l->v, BM_ELEM_TAG); } } @@ -2011,7 +2011,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) * verts*/ selstate = MEM_callocN(sizeof(*selstate) * bm->totvert, __func__); eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (a=0; eve; eve=BM_iter_step(&iter), a++) { + for (a = 0; eve; eve = BM_iter_step(&iter), a++) { if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { if (BM_elem_flag_test(eve, BM_ELEM_TAG)) { selstate[a] = 1; @@ -2044,10 +2044,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } else t->total = countsel; - tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)"); + tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)"); if (t->mode == TFM_SKIN_RESIZE) { tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), - "TransObData ext"); + "TransObData ext"); } copy_m3_m4(mtx, t->obedit->obmat); @@ -2058,19 +2058,19 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } /* detect CrazySpace [tm] */ - if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) { + if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1) >= 0) { if (modifiers_isCorrectableDeformed(t->obedit)) { /* check if we can use deform matrices for modifier from the * start up to stack, they are more accurate than quats */ - totleft= editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); + totleft = editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); /* if we still have more modifiers, also do crazyspace * correction with quats, relative to the coordinates after * the modifiers that support deform matrices (defcos) */ if (totleft > 0) { - mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit); - quats= MEM_mallocN((t->total)*sizeof(float)*4, "crazy quats"); - crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */ + mappedcos = crazyspace_get_mapped_editverts(t->scene, t->obedit); + quats = MEM_mallocN((t->total) * sizeof(float) * 4, "crazy quats"); + crazyspace_set_quats_editmesh(em, (float *)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */ if (mappedcos) MEM_freeN(mappedcos); } @@ -2083,8 +2083,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* find out which half we do */ if (mirror) { eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (a=0; eve; eve=BM_iter_step(&iter), a++) { - if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) { + for (a = 0; eve; eve = BM_iter_step(&iter), a++) { + if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0] != 0.0f) { if (eve->co[0] < 0.0f) { t->mirror = -1; mirror = -1; @@ -2095,7 +2095,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (a=0; eve; eve=BM_iter_step(&iter), a++) { + for (a = 0; eve; eve = BM_iter_step(&iter), a++) { if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { if (propmode || selstate[a]) { float *bweight = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_BWEIGHT); @@ -2126,11 +2126,11 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* use both or either quat and defmat correction */ if (quats && BM_elem_index_get(eve) != -1) { - quat_to_mat3(qmat, quats + 4*BM_elem_index_get(eve)); + quat_to_mat3(qmat, quats + 4 * BM_elem_index_get(eve)); if (defmats) mul_serie_m3(mat, mtx, qmat, defmats[a], - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); else mul_m3_m3m3(mat, mtx, qmat); } @@ -2148,8 +2148,8 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } /* Mirror? */ - if ((mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) { - BMVert *vmir= EDBM_verts_mirror_get(em, eve); //t->obedit, em, eve, tob->iloc, a); + if ((mirror > 0 && tob->iloc[0] > 0.0f) || (mirror < 0 && tob->iloc[0] < 0.0f)) { + BMVert *vmir = EDBM_verts_mirror_get(em, eve); //t->obedit, em, eve, tob->iloc, a); if (vmir && vmir != eve) { tob->extra = vmir; } @@ -2161,7 +2161,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) if (mirror != 0) { tob = t->data; - for (a = 0; a < t->total; a++, tob++ ) { + for (a = 0; a < t->total; a++, tob++) { if (ABS(tob->loc[0]) <= 0.00001f) { tob->flag |= TD_MIRROR_EDGE; } @@ -2192,13 +2192,13 @@ void flushTransNodes(TransInfo *t) TransData2D *td; /* flush to 2d vector from internally used 3d vector */ - for (a=0, td= t->data2d; a<t->total; a++, td++) { - td->loc2d[0]= td->loc[0]; - td->loc2d[1]= td->loc[1]; + for (a = 0, td = t->data2d; a < t->total; a++, td++) { + td->loc2d[0] = td->loc[0]; + td->loc2d[1] = td->loc[1]; } /* handle intersection with noodles */ - if (t->total==1) { + if (t->total == 1) { ED_node_link_intersect_test(t->sa, 1); } } @@ -2212,11 +2212,11 @@ void flushTransNodes(TransInfo *t) void flushTransSeq(TransInfo *t) { - ListBase *seqbasep= BKE_sequencer_editing_get(t->scene, FALSE)->seqbasep; /* Editing null check already done */ + ListBase *seqbasep = BKE_sequencer_editing_get(t->scene, FALSE)->seqbasep; /* Editing null check already done */ int a, new_frame, old_start; - TransData *td= NULL; - TransData2D *td2d= NULL; - TransDataSeq *tdsq= NULL; + TransData *td = NULL; + TransData2D *td2d = NULL; + TransDataSeq *tdsq = NULL; Sequence *seq; @@ -2224,43 +2224,43 @@ void flushTransSeq(TransInfo *t) /* prevent updating the same seq twice * if the transdata order is changed this will mess up * but so will TransDataSeq */ - Sequence *seq_prev= NULL; + Sequence *seq_prev = NULL; /* flush to 2d vector from internally used 3d vector */ - for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) { - tdsq= (TransDataSeq *)td->extra; - seq= tdsq->seq; + for (a = 0, td = t->data, td2d = t->data2d; a < t->total; a++, td++, td2d++) { + tdsq = (TransDataSeq *)td->extra; + seq = tdsq->seq; old_start = seq->start; - new_frame= (int)floor(td2d->loc[0] + 0.5f); + new_frame = (int)floor(td2d->loc[0] + 0.5f); switch (tdsq->sel_flag) { - case SELECT: + case SELECT: #ifdef SEQ_TX_NESTED_METAS - if ((seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ - seq->start= new_frame - tdsq->start_offset; + if ((seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ + seq->start = new_frame - tdsq->start_offset; #else - if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ - seq->start= new_frame - tdsq->start_offset; + if (seq->type != SEQ_TYPE_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ + seq->start = new_frame - tdsq->start_offset; #endif - if (seq->depth==0) { - seq->machine= (int)floor(td2d->loc[1] + 0.5f); - CLAMP(seq->machine, 1, MAXSEQ); - } - break; - case SEQ_LEFTSEL: /* no vertical transform */ - seq_tx_set_final_left(seq, new_frame); - seq_tx_handle_xlimits(seq, tdsq->flag&SEQ_LEFTSEL, tdsq->flag&SEQ_RIGHTSEL); - seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */ - break; - case SEQ_RIGHTSEL: /* no vertical transform */ - seq_tx_set_final_right(seq, new_frame); - seq_tx_handle_xlimits(seq, tdsq->flag&SEQ_LEFTSEL, tdsq->flag&SEQ_RIGHTSEL); - seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */ - break; + if (seq->depth == 0) { + seq->machine = (int)floor(td2d->loc[1] + 0.5f); + CLAMP(seq->machine, 1, MAXSEQ); + } + break; + case SEQ_LEFTSEL: /* no vertical transform */ + seq_tx_set_final_left(seq, new_frame); + seq_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); + seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */ + break; + case SEQ_RIGHTSEL: /* no vertical transform */ + seq_tx_set_final_right(seq, new_frame); + seq_tx_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); + seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */ + break; } if (seq != seq_prev) { - if (seq->depth==0) { + if (seq->depth == 0) { /* Calculate this strip and all nested strips * children are ALWAYS transformed first * so we don't need to do this in another loop. */ @@ -2273,7 +2273,7 @@ void flushTransSeq(TransInfo *t) if (tdsq->sel_flag == SELECT) seq_offset_animdata(t->scene, seq, seq->start - old_start); } - seq_prev= seq; + seq_prev = seq; } @@ -2295,14 +2295,14 @@ void flushTransSeq(TransInfo *t) /* need to do the overlap check in a new loop otherwise adjacent strips * will not be updated and we'll get false positives */ - seq_prev= NULL; - for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) { + seq_prev = NULL; + for (a = 0, td = t->data, td2d = t->data2d; a < t->total; a++, td++, td2d++) { - tdsq= (TransDataSeq *)td->extra; - seq= tdsq->seq; + tdsq = (TransDataSeq *)td->extra; + seq = tdsq->seq; if (seq != seq_prev) { - if (seq->depth==0) { + if (seq->depth == 0) { /* test overlap, displayes red outline */ seq->flag &= ~SEQ_OVERLAP; if (seq_test_overlap(seqbasep, seq)) { @@ -2310,7 +2310,7 @@ void flushTransSeq(TransInfo *t) } } } - seq_prev= seq; + seq_prev = seq; } } @@ -2326,8 +2326,8 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f * proportional editing to be consistent with the stretched uv coords * that are displayed. this also means that for display and numinput, * and when the the uv coords are flushed, these are converted each time */ - td2d->loc[0] = uv[0]*aspx; - td2d->loc[1] = uv[1]*aspy; + td2d->loc[0] = uv[0] * aspx; + td2d->loc[1] = uv[1] * aspy; td2d->loc[2] = 0.0f; td2d->loc2d = uv; @@ -2339,14 +2339,14 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; if (selected) { td->flag |= TD_SELECTED; - td->dist= 0.0; + td->dist = 0.0; } else { - td->dist= MAXFLOAT; + td->dist = MAXFLOAT; } unit_m3(td->mtx); unit_m3(td->smtx); @@ -2365,14 +2365,14 @@ static void createTransUVs(bContext *C, TransInfo *t) BMFace *efa; BMLoop *l; BMIter iter, liter; - int count=0, countsel=0; + int count = 0, countsel = 0; int propmode = t->flag & T_PROP_EDIT; if (!ED_space_image_show_uvedit(sima, t->obedit)) return; /* count */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); + tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); if (!uvedit_face_visible_test(scene, ima, efa, tf)) { BM_elem_flag_disable(efa, BM_ELEM_TAG); @@ -2389,20 +2389,20 @@ static void createTransUVs(bContext *C, TransInfo *t) } } - /* note: in prop mode we need at least 1 selected */ - if (countsel==0) return; + /* note: in prop mode we need at least 1 selected */ + if (countsel == 0) return; - t->total= (propmode)? count: countsel; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(UV Editing)"); + t->total = (propmode) ? count : countsel; + t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(UV Editing)"); /* for each 2d uv coord a 3d vector is allocated, so that they can be * treated just as if they were 3d verts */ - t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)"); + t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransObData2D(UV Editing)"); if (sima->flag & SI_CLIP_UV) t->flag |= T_CLIP_UV; - td= t->data; - td2d= t->data2d; + td = t->data; + td2d = t->data2d; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -2430,17 +2430,17 @@ void flushTransUVs(TransInfo *t) ED_space_image_uv_aspect(sima, &aspx, &aspy); ED_space_image_size(sima, &width, &height); - invx= 1.0f/aspx; - invy= 1.0f/aspy; + invx = 1.0f / aspx; + invy = 1.0f / aspy; /* flush to 2d vector from internally used 3d vector */ - for (a=0, td= t->data2d; a<t->total; a++, td++) { - td->loc2d[0]= td->loc[0]*invx; - td->loc2d[1]= td->loc[1]*invy; + for (a = 0, td = t->data2d; a < t->total; a++, td++) { + td->loc2d[0] = td->loc[0] * invx; + td->loc2d[1] = td->loc[1] * invy; if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) { - td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width; - td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height; + td->loc2d[0] = (float)floor(width * td->loc2d[0] + 0.5f) / width; + td->loc2d[1] = (float)floor(height * td->loc2d[1] + 0.5f) / height; } } } @@ -2448,46 +2448,46 @@ void flushTransUVs(TransInfo *t) int clipUVTransform(TransInfo *t, float *vec, int resize) { TransData *td; - int a, clipx=1, clipy=1; + int a, clipx = 1, clipy = 1; float aspx, aspy, min[2], max[2]; ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); - min[0]= min[1]= 0.0f; - max[0]= aspx; max[1]= aspy; + min[0] = min[1] = 0.0f; + max[0] = aspx; max[1] = aspy; - for (a=0, td= t->data; a<t->total; a++, td++) { + for (a = 0, td = t->data; a < t->total; a++, td++) { DO_MINMAX2(td->loc, min, max); } if (resize) { - if (min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f) - vec[0] *= t->center[0]/(t->center[0] - min[0]); + if (min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx * 0.5f) + vec[0] *= t->center[0] / (t->center[0] - min[0]); else if (max[0] > aspx && t->center[0] < aspx) - vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]); + vec[0] *= (t->center[0] - aspx) / (t->center[0] - max[0]); else - clipx= 0; + clipx = 0; - if (min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f) - vec[1] *= t->center[1]/(t->center[1] - min[1]); + if (min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy * 0.5f) + vec[1] *= t->center[1] / (t->center[1] - min[1]); else if (max[1] > aspy && t->center[1] < aspy) - vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]); + vec[1] *= (t->center[1] - aspy) / (t->center[1] - max[1]); else - clipy= 0; + clipy = 0; } else { if (min[0] < 0.0f) vec[0] -= min[0]; else if (max[0] > aspx) - vec[0] -= max[0]-aspx; + vec[0] -= max[0] - aspx; else - clipx= 0; + clipx = 0; if (min[1] < 0.0f) vec[1] -= min[1]; else if (max[1] > aspy) - vec[1] -= max[1]-aspy; + vec[1] -= max[1] - aspy; else - clipy= 0; + clipy = 0; } return (clipx || clipy); @@ -2512,7 +2512,7 @@ static short FrameOnMouseSide(char side, float frame, float cframe) static void createTransNlaData(bContext *C, TransInfo *t) { - Scene *scene= t->scene; + Scene *scene = t->scene; SpaceNla *snla = NULL; TransData *td = NULL; TransDataNla *tdn = NULL; @@ -2522,7 +2522,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) bAnimListElem *ale; int filter; - int count=0; + int count = 0; /* determine what type of data we are operating on */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2530,7 +2530,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) snla = (SpaceNla *)ac.sl; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* which side of the current frame should be allowed */ @@ -2539,7 +2539,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) float xmouse, ymouse; UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse); - t->frame_side= (xmouse > CFRA) ? 'R' : 'L'; + t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; } else { /* normal transform - both sides of current frame are considered */ @@ -2547,15 +2547,15 @@ static void createTransNlaData(bContext *C, TransInfo *t) } /* loop 1: count how many strips are selected (consider each strip as 2 points) */ - for (ale= anim_data.first; ale; ale= ale->next) { - NlaTrack *nlt= (NlaTrack *)ale->data; + for (ale = anim_data.first; ale; ale = ale->next) { + NlaTrack *nlt = (NlaTrack *)ale->data; NlaStrip *strip; /* make some meta-strips for chains of selected strips */ BKE_nlastrips_make_metas(&nlt->strips, 1); /* only consider selected strips */ - for (strip= nlt->strips.first; strip; strip= strip->next) { + for (strip = nlt->strips.first; strip; strip = strip->next) { // TODO: we can make strips have handles later on... /* transition strips can't get directly transformed */ if (strip->type != NLASTRIP_TYPE_TRANSITION) { @@ -2575,24 +2575,24 @@ static void createTransNlaData(bContext *C, TransInfo *t) } /* allocate memory for data */ - t->total= count; + t->total = count; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(NLA Editor)"); - td= t->data; - t->customData= MEM_callocN(t->total*sizeof(TransDataNla), "TransDataNla (NLA Editor)"); - tdn= t->customData; + t->data = MEM_callocN(t->total * sizeof(TransData), "TransData(NLA Editor)"); + td = t->data; + t->customData = MEM_callocN(t->total * sizeof(TransDataNla), "TransDataNla (NLA Editor)"); + tdn = t->customData; t->flag |= T_FREE_CUSTOMDATA; /* loop 2: build transdata array */ - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale = anim_data.first; ale; ale = ale->next) { /* only if a real NLA-track */ if (ale->type == ANIMTYPE_NLATRACK) { AnimData *adt = ale->adt; - NlaTrack *nlt= (NlaTrack *)ale->data; + NlaTrack *nlt = (NlaTrack *)ale->data; NlaStrip *strip; /* only consider selected strips */ - for (strip= nlt->strips.first; strip; strip= strip->next) { + for (strip = nlt->strips.first; strip; strip = strip->next) { // TODO: we can make strips have handles later on... /* transition strips can't get directly transformed */ if (strip->type != NLASTRIP_TYPE_TRANSITION) { @@ -2602,37 +2602,37 @@ static void createTransNlaData(bContext *C, TransInfo *t) * - td structs are transform-elements operated on by the transform system * and represent a single handle. The storage/pointer used (val or loc) depends on * whether we're scaling or transforming. Ultimately though, the handles - * the td writes to will simply be a dummy in tdn + * the td writes to will simply be a dummy in tdn * - for each strip being transformed, a single tdn struct is used, so in some * cases, there will need to be 1 of these tdn elements in the array skipped... */ float center[3], yval; /* firstly, init tdn settings */ - tdn->id= ale->id; - tdn->oldTrack= tdn->nlt= nlt; - tdn->strip= strip; - tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt); - - yval= (float)(tdn->trackIndex * NLACHANNEL_STEP(snla)); - - tdn->h1[0]= strip->start; - tdn->h1[1]= yval; - tdn->h2[0]= strip->end; - tdn->h2[1]= yval; - - center[0]= (float)CFRA; - center[1]= yval; - center[2]= 0.0f; + tdn->id = ale->id; + tdn->oldTrack = tdn->nlt = nlt; + tdn->strip = strip; + tdn->trackIndex = BLI_findindex(&adt->nla_tracks, nlt); + + yval = (float)(tdn->trackIndex * NLACHANNEL_STEP(snla)); + + tdn->h1[0] = strip->start; + tdn->h1[1] = yval; + tdn->h2[0] = strip->end; + tdn->h2[1] = yval; + + center[0] = (float)CFRA; + center[1] = yval; + center[2] = 0.0f; /* set td's based on which handles are applicable */ if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) { /* just set tdn to assume that it only has one handle for now */ - tdn->handle= -1; + tdn->handle = -1; /* now, link the transform data up to this data */ if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { - td->loc= tdn->h1; + td->loc = tdn->h1; copy_v3_v3(td->iloc, tdn->h1); /* store all the other gunk that is required by transform */ @@ -2640,30 +2640,30 @@ static void createTransNlaData(bContext *C, TransInfo *t) memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; td->flag |= TD_SELECTED; - td->dist= 0.0f; + td->dist = 0.0f; unit_m3(td->mtx); unit_m3(td->smtx); } else { /* time scaling only needs single value */ - td->val= &tdn->h1[0]; - td->ival= tdn->h1[0]; + td->val = &tdn->h1[0]; + td->ival = tdn->h1[0]; } - td->extra= tdn; + td->extra = tdn; td++; } if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) { /* if tdn is already holding the start handle, then we're doing both, otherwise, only end */ - tdn->handle= (tdn->handle) ? 2 : 1; + tdn->handle = (tdn->handle) ? 2 : 1; /* now, link the transform data up to this data */ if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) { - td->loc= tdn->h2; + td->loc = tdn->h2; copy_v3_v3(td->iloc, tdn->h2); /* store all the other gunk that is required by transform */ @@ -2671,21 +2671,21 @@ static void createTransNlaData(bContext *C, TransInfo *t) memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; td->flag |= TD_SELECTED; - td->dist= 0.0f; + td->dist = 0.0f; unit_m3(td->mtx); unit_m3(td->smtx); } else { /* time scaling only needs single value */ - td->val= &tdn->h2[0]; - td->ival= tdn->h2[0]; + td->val = &tdn->h2[0]; + td->ival = tdn->h2[0]; } - td->extra= tdn; + td->extra = tdn; td++; } @@ -2713,11 +2713,11 @@ static void createTransNlaData(bContext *C, TransInfo *t) * It also makes sure gp-frames are still stored in chronological order after * transform. */ -static void posttrans_gpd_clean (bGPdata *gpd) +static void posttrans_gpd_clean(bGPdata *gpd) { bGPDlayer *gpl; - for (gpl= gpd->layers.first; gpl; gpl= gpl->next) { + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { ListBase sel_buffer = {NULL, NULL}; bGPDframe *gpf, *gpfn; bGPDframe *gfs, *gfsn; @@ -2725,9 +2725,9 @@ static void posttrans_gpd_clean (bGPdata *gpd) /* loop 1: loop through and isolate selected gp-frames to buffer * (these need to be sorted as they are isolated) */ - for (gpf= gpl->frames.first; gpf; gpf= gpfn) { - short added= 0; - gpfn= gpf->next; + for (gpf = gpl->frames.first; gpf; gpf = gpfn) { + short added = 0; + gpfn = gpf->next; if (gpf->flag & GP_FRAME_SELECT) { BLI_remlink(&gpl->frames, gpf); @@ -2736,11 +2736,11 @@ static void posttrans_gpd_clean (bGPdata *gpd) * - go backwards as most frames will still be in order, * so doing it this way will be faster */ - for (gfs= sel_buffer.last; gfs; gfs= gfs->prev) { + for (gfs = sel_buffer.last; gfs; gfs = gfs->prev) { /* if current (gpf) occurs after this one in buffer, add! */ if (gfs->framenum < gpf->framenum) { BLI_insertlinkafter(&sel_buffer, gfs, gpf); - added= 1; + added = 1; break; } } @@ -2755,19 +2755,19 @@ static void posttrans_gpd_clean (bGPdata *gpd) /* if all were selected (i.e. gpl->frames is empty), then just transfer sel-buf over */ if (gpl->frames.first == NULL) { - gpl->frames.first= sel_buffer.first; - gpl->frames.last= sel_buffer.last; + gpl->frames.first = sel_buffer.first; + gpl->frames.last = sel_buffer.last; continue; } /* loop 2: remove duplicates of frames in buffers */ - for (gpf= gpl->frames.first; gpf && sel_buffer.first; gpf= gpfn) { - gpfn= gpf->next; + for (gpf = gpl->frames.first; gpf && sel_buffer.first; gpf = gpfn) { + gpfn = gpf->next; /* loop through sel_buffer, emptying stuff from front of buffer if ok */ - for (gfs= sel_buffer.first; gfs && gpf; gfs= gfsn) { - gfsn= gfs->next; + for (gfs = sel_buffer.first; gfs && gpf; gfs = gfsn) { + gfsn = gfs->next; /* if this buffer frame needs to go before current, add it! */ if (gfs->framenum < gpf->framenum) { @@ -2788,8 +2788,8 @@ static void posttrans_gpd_clean (bGPdata *gpd) } /* if anything is still in buffer, append to end */ - for (gfs= sel_buffer.first; gfs; gfs= gfsn) { - gfsn= gfs->next; + for (gfs = sel_buffer.first; gfs; gfs = gfsn) { + gfsn = gfs->next; BLI_remlink(&sel_buffer, gfs); BLI_addtail(&gpl->frames, gfs); @@ -2807,7 +2807,7 @@ static void posttrans_mask_clean(Mask *mask) { MaskLayer *masklay; - for (masklay = mask->masklayers.first; masklay; masklay= masklay->next) { + for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { ListBase sel_buffer = {NULL, NULL}; MaskLayerShape *masklay_shape, *masklay_shape_new; MaskLayerShape *masklay_shape_sort, *masklay_shape_sort_new; @@ -2815,9 +2815,9 @@ static void posttrans_mask_clean(Mask *mask) /* loop 1: loop through and isolate selected gp-frames to buffer * (these need to be sorted as they are isolated) */ - for (masklay_shape= masklay->splines_shapes.first; masklay_shape; masklay_shape= masklay_shape_new) { - short added= 0; - masklay_shape_new= masklay_shape->next; + for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape_new) { + short added = 0; + masklay_shape_new = masklay_shape->next; if (masklay_shape->flag & GP_FRAME_SELECT) { BLI_remlink(&masklay->splines_shapes, masklay_shape); @@ -2826,11 +2826,11 @@ static void posttrans_mask_clean(Mask *mask) * - go backwards as most frames will still be in order, * so doing it this way will be faster */ - for (masklay_shape_sort= sel_buffer.last; masklay_shape_sort; masklay_shape_sort= masklay_shape_sort->prev) { + for (masklay_shape_sort = sel_buffer.last; masklay_shape_sort; masklay_shape_sort = masklay_shape_sort->prev) { /* if current (masklay_shape) occurs after this one in buffer, add! */ if (masklay_shape_sort->frame < masklay_shape->frame) { BLI_insertlinkafter(&sel_buffer, masklay_shape_sort, masklay_shape); - added= 1; + added = 1; break; } } @@ -2845,19 +2845,19 @@ static void posttrans_mask_clean(Mask *mask) /* if all were selected (i.e. masklay->splines_shapes is empty), then just transfer sel-buf over */ if (masklay->splines_shapes.first == NULL) { - masklay->splines_shapes.first= sel_buffer.first; - masklay->splines_shapes.last= sel_buffer.last; + masklay->splines_shapes.first = sel_buffer.first; + masklay->splines_shapes.last = sel_buffer.last; continue; } /* loop 2: remove duplicates of splines_shapes in buffers */ - for (masklay_shape= masklay->splines_shapes.first; masklay_shape && sel_buffer.first; masklay_shape= masklay_shape_new) { - masklay_shape_new= masklay_shape->next; + for (masklay_shape = masklay->splines_shapes.first; masklay_shape && sel_buffer.first; masklay_shape = masklay_shape_new) { + masklay_shape_new = masklay_shape->next; /* loop through sel_buffer, emptying stuff from front of buffer if ok */ - for (masklay_shape_sort= sel_buffer.first; masklay_shape_sort && masklay_shape; masklay_shape_sort= masklay_shape_sort_new) { - masklay_shape_sort_new= masklay_shape_sort->next; + for (masklay_shape_sort = sel_buffer.first; masklay_shape_sort && masklay_shape; masklay_shape_sort = masklay_shape_sort_new) { + masklay_shape_sort_new = masklay_shape_sort->next; /* if this buffer frame needs to go before current, add it! */ if (masklay_shape_sort->frame < masklay_shape->frame) { @@ -2878,8 +2878,8 @@ static void posttrans_mask_clean(Mask *mask) } /* if anything is still in buffer, append to end */ - for (masklay_shape_sort= sel_buffer.first; masklay_shape_sort; masklay_shape_sort= masklay_shape_sort_new) { - masklay_shape_sort_new= masklay_shape_sort->next; + for (masklay_shape_sort = sel_buffer.first; masklay_shape_sort; masklay_shape_sort = masklay_shape_sort_new) { + masklay_shape_sort_new = masklay_shape_sort->next; BLI_remlink(&sel_buffer, masklay_shape_sort); BLI_addtail(&masklay->splines_shapes, masklay_shape_sort); @@ -2893,18 +2893,18 @@ static void posttrans_mask_clean(Mask *mask) /* Called during special_aftertrans_update to make sure selected keyframes replace * any other keyframes which may reside on that frame (that is not selected). */ -static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) +static void posttrans_fcurve_clean(FCurve *fcu, const short use_handle) { - float *selcache; /* cache for frame numbers of selected frames (fcu->totvert*sizeof(float)) */ - int len, index, i; /* number of frames in cache, item index */ + float *selcache; /* cache for frame numbers of selected frames (fcu->totvert*sizeof(float)) */ + int len, index, i; /* number of frames in cache, item index */ /* allocate memory for the cache */ // TODO: investigate using BezTriple columns instead? - if (fcu->totvert == 0 || fcu->bezt==NULL) + if (fcu->totvert == 0 || fcu->bezt == NULL) return; - selcache= MEM_callocN(sizeof(float)*fcu->totvert, "FCurveSelFrameNums"); - len= 0; - index= 0; + selcache = MEM_callocN(sizeof(float) * fcu->totvert, "FCurveSelFrameNums"); + len = 0; + index = 0; /* We do 2 loops, 1 for marking keyframes for deletion, one for deleting * as there is no guarantee what order the keyframes are exactly, even though @@ -2913,10 +2913,10 @@ static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) /* Loop 1: find selected keyframes */ for (i = 0; i < fcu->totvert; i++) { - BezTriple *bezt= &fcu->bezt[i]; + BezTriple *bezt = &fcu->bezt[i]; if (BEZSELECTED(bezt)) { - selcache[index]= bezt->vec[1][0]; + selcache[index] = bezt->vec[1][0]; index++; len++; } @@ -2926,12 +2926,12 @@ static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) * (if any keyframes were found, or the whole curve wasn't affected) */ if ((len) && (len != fcu->totvert)) { - for (i= fcu->totvert-1; i >= 0; i--) { - BezTriple *bezt= &fcu->bezt[i]; + for (i = fcu->totvert - 1; i >= 0; i--) { + BezTriple *bezt = &fcu->bezt[i]; if (BEZSELECTED(bezt) == 0) { /* check beztriple should be removed according to cache */ - for (index= 0; index < len; index++) { + for (index = 0; index < len; index++) { if (IS_EQF(bezt->vec[1][0], selcache[index])) { delete_fcurve_key(fcu, i, 0); break; @@ -2955,21 +2955,21 @@ static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle) * any other keyframes which may reside on that frame (that is not selected). * remake_action_ipos should have already been called */ -static void posttrans_action_clean (bAnimContext *ac, bAction *act) +static void posttrans_action_clean(bAnimContext *ac, bAction *act) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); ANIM_animdata_filter(ac, &anim_data, filter, act, ANIMCONT_ACTION); /* loop through relevant data, removing keyframes as appropriate - * - all keyframes are converted in/out of global time + * - all keyframes are converted in/out of global time */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(ac, ale); + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(ac, ale); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); @@ -2977,7 +2977,7 @@ static void posttrans_action_clean (bAnimContext *ac, bAction *act) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else - posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ + posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */ } /* free temp data */ @@ -2996,7 +2996,7 @@ static int count_fcurve_keys(FCurve *fcu, char side, float cfra) return count; /* only include points that occur on the right side of cfra */ - for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { + for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { if (bezt->f2 & SELECT) { /* no need to adjust the handle selection since they are assumed * selected (like graph editor with SIPO_NOHANDLES) */ @@ -3019,7 +3019,7 @@ static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra) return count; /* only include points that occur on the right side of cfra */ - for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { + for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { if (gpf->flag & GP_FRAME_SELECT) { if (FrameOnMouseSide(side, (float)gpf->framenum, cfra)) count++; @@ -3039,7 +3039,7 @@ static int count_masklayer_frames(MaskLayer *masklay, char side, float cfra) 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) { + for (masklayer_shape = masklay->splines_shapes.first; masklayer_shape; masklayer_shape = masklayer_shape->next) { if (masklayer_shape->flag & MASK_SHAPE_SELECT) { if (FrameOnMouseSide(side, (float)masklayer_shape->frame, cfra)) count++; @@ -3060,7 +3060,7 @@ static void TimeToTransData(TransData *td, float *time, AnimData *adt) /* store the AnimData where this keyframe exists as a keyframe of the * active action as td->extra. */ - td->extra= adt; + td->extra = adt; } /* This function advances the address to which td points to, so it must return @@ -3079,7 +3079,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC if (ELEM(NULL, fcu, fcu->bezt)) return td; - for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { + for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { /* only add selected keyframes (for now, proportional edit is not enabled) */ if (bezt->f2 & SELECT) { /* note this MUST match count_fcurve_keys(), so can't use BEZSELECTED() macro */ /* only add if on the right 'side' of the current frame */ @@ -3087,7 +3087,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC TimeToTransData(td, bezt->vec[1], adt); /*set flags to move handles as necessary*/ - td->flag |= TD_MOVEHANDLE1|TD_MOVEHANDLE2; + td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2; td2d->h1 = bezt->vec[0]; td2d->h2 = bezt->vec[2]; @@ -3107,8 +3107,8 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC /* helper struct for gp-frame transforms (only used here) */ typedef struct tGPFtransdata { - float val; /* where transdata writes transform */ - int *sdata; /* pointer to gpf->framenum */ + 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 */ @@ -3119,13 +3119,13 @@ void flushTransIntFrameActionData(TransInfo *t) /* find the first one to start from */ if (t->mode == TFM_TIME_SLIDE) - tfd= (tGPFtransdata *)((float *)(t->customData) + 2); + tfd = (tGPFtransdata *)((float *)(t->customData) + 2); else - tfd= (tGPFtransdata *)(t->customData); + tfd = (tGPFtransdata *)(t->customData); /* flush data! */ for (i = 0; i < t->total; i++, tfd++) { - *(tfd->sdata)= (int)floor(tfd->val + 0.5f); + *(tfd->sdata) = (int)floor(tfd->val + 0.5f); } } @@ -3136,21 +3136,21 @@ void flushTransIntFrameActionData(TransInfo *t) * 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) +static int GPLayerToTransData(TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl, char side, float cfra) { bGPDframe *gpf; - int count= 0; + int count = 0; /* check for select frames on right side of current frame */ - for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { + for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { if (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->val = &tfd->val; + td->ival = (float)gpf->framenum; - tfd->val= (float)gpf->framenum; - tfd->sdata= &gpf->framenum; + tfd->val = (float)gpf->framenum; + tfd->sdata = &gpf->framenum; /* advance td now */ td++; @@ -3167,18 +3167,18 @@ static int GPLayerToTransData (TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl static int MaskLayerToTransData(TransData *td, tGPFtransdata *tfd, MaskLayer *masklay, char side, float cfra) { MaskLayerShape *masklay_shape; - int count= 0; + 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) { + for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { if (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->val = &tfd->val; + td->ival = (float)masklay_shape->frame; - tfd->val= (float)masklay_shape->frame; - tfd->sdata= &masklay_shape->frame; + tfd->val = (float)masklay_shape->frame; + tfd->sdata = &masklay_shape->frame; /* advance td now */ td++; @@ -3194,7 +3194,7 @@ static int MaskLayerToTransData(TransData *td, tGPFtransdata *tfd, MaskLayer *ma static void createTransActionData(bContext *C, TransInfo *t) { - Scene *scene= t->scene; + Scene *scene = t->scene; TransData *td = NULL; TransData2D *td2d = NULL; tGPFtransdata *tfd = NULL; @@ -3204,7 +3204,7 @@ static void createTransActionData(bContext *C, TransInfo *t) bAnimListElem *ale; int filter; - int count=0; + int count = 0; float cfra; /* determine what type of data we are operating on */ @@ -3213,9 +3213,9 @@ static void createTransActionData(bContext *C, TransInfo *t) /* filter data */ if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT); else - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* which side of the current frame should be allowed */ @@ -3232,8 +3232,8 @@ static void createTransActionData(bContext *C, TransInfo *t) } /* loop 1: fully select ipo-keys and count how many BezTriples are selected */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); /* convert current-frame to action-time (slightly less accurate, especially under * higher scaling ratios, but is faster than converting all points) @@ -3261,30 +3261,30 @@ static void createTransActionData(bContext *C, TransInfo *t) } /* allocate memory for data */ - t->total= count; + t->total = count; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)"); - t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "transdata2d"); - td= t->data; + t->data = MEM_callocN(t->total * sizeof(TransData), "TransData(Action Editor)"); + t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "transdata2d"); + td = t->data; td2d = t->data2d; if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { if (t->mode == TFM_TIME_SLIDE) { - t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata"); - tfd= (tGPFtransdata *)((float *)(t->customData) + 2); + t->customData = MEM_callocN((sizeof(float) * 2) + (sizeof(tGPFtransdata) * count), "TimeSlide + tGPFtransdata"); + tfd = (tGPFtransdata *)((float *)(t->customData) + 2); } else { - t->customData= MEM_callocN(sizeof(tGPFtransdata)*count, "tGPFtransdata"); - tfd= (tGPFtransdata *)(t->customData); + t->customData = MEM_callocN(sizeof(tGPFtransdata) * count, "tGPFtransdata"); + tfd = (tGPFtransdata *)(t->customData); } } else if (t->mode == TFM_TIME_SLIDE) - t->customData= MEM_callocN(sizeof(float)*2, "TimeSlide Min/Max"); + t->customData = MEM_callocN(sizeof(float) * 2, "TimeSlide Min/Max"); /* loop 2: build transdata array */ - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - bGPDlayer *gpl= (bGPDlayer *)ale->data; + bGPDlayer *gpl = (bGPDlayer *)ale->data; int i; i = GPLayerToTransData(td, tfd, gpl, t->frame_side, cfra); @@ -3300,8 +3300,8 @@ static void createTransActionData(bContext *C, TransInfo *t) tfd += i; } else { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; /* convert current-frame to action-time (slightly less accurate, especially under * higher scaling ratios, but is faster than converting all points) @@ -3311,19 +3311,19 @@ static void createTransActionData(bContext *C, TransInfo *t) else cfra = (float)CFRA; - td= ActionFCurveToTransData(td, &td2d, fcu, adt, t->frame_side, cfra); + td = ActionFCurveToTransData(td, &td2d, fcu, adt, t->frame_side, cfra); } } /* check if we're supposed to be setting minx/maxx for TimeSlide */ if (t->mode == TFM_TIME_SLIDE) { - float min=999999999.0f, max=-999999999.0f; + float min = 999999999.0f, max = -999999999.0f; int i; - td= t->data; - for (i=0; i < count; i++, td++) { - if (min > *(td->val)) min= *(td->val); - if (max < *(td->val)) max= *(td->val); + td = t->data; + for (i = 0; i < count; i++, td++) { + if (min > *(td->val)) min = *(td->val); + if (max < *(td->val)) max = *(td->val); } if (min == max) { @@ -3349,9 +3349,9 @@ static void createTransActionData(bContext *C, TransInfo *t) /* Helper function for createTransGraphEditData, which is responsible for associating * source data with transform data */ -static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, - int bi, short selected, short ishandle, short intvals, - float mtx[3][3], float smtx[3][3]) +static void bezt_to_transdata(TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, + int bi, short selected, short ishandle, short intvals, + float mtx[3][3], float smtx[3][3]) { float *loc = bezt->vec[bi]; float *cent = bezt->vec[1]; @@ -3404,17 +3404,17 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; /* store AnimData info in td->extra, for applying mapping when flushing */ - td->extra= adt; + td->extra = adt; if (selected) { td->flag |= TD_SELECTED; - td->dist= 0.0f; + td->dist = 0.0f; } else - td->dist= MAXFLOAT; + td->dist = MAXFLOAT; if (ishandle) td->flag |= TD_NOTIMESNAP; @@ -3429,9 +3429,9 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, static void createTransGraphEditData(bContext *C, TransInfo *t) { SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; - Scene *scene= t->scene; - ARegion *ar= t->ar; - View2D *v2d= &ar->v2d; + Scene *scene = t->scene; + ARegion *ar = t->ar; + View2D *v2d = &ar->v2d; TransData *td = NULL; TransData2D *td2d = NULL; @@ -3442,7 +3442,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) int filter; BezTriple *bezt; - int count=0, i; + int count = 0, i; float cfra; float mtx[3][3], smtx[3][3]; const short use_handle = !(sipo->flag & SIPO_NOHANDLES); @@ -3452,11 +3452,11 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) return; /* filter data */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* which side of the current frame should be allowed */ - // XXX we still want this mode, but how to get this using standard transform too? + // XXX we still want this mode, but how to get this using standard transform too? if (t->mode == TFM_TIME_EXTEND) { /* only side on which mouse is gets transformed */ float xmouse, ymouse; @@ -3470,9 +3470,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* loop 1: count how many BezTriples (specifically their verts) are selected (or should be edited) */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; /* convert current-frame to action-time (slightly less accurate, especially under * higher scaling ratios, but is faster than converting all points) @@ -3487,11 +3487,11 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) continue; /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */ - for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { + for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel2= bezt->f2 & SELECT; - const char sel1= use_handle ? bezt->f1 & SELECT : sel2; - const char sel3= use_handle ? bezt->f3 & SELECT : sel2; + const char sel2 = bezt->f2 & SELECT; + const char sel1 = use_handle ? bezt->f1 & SELECT : sel2; + const char sel3 = use_handle ? bezt->f3 & SELECT : sel2; if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { /* for 'normal' pivots - just include anything that is selected. @@ -3531,14 +3531,14 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* allocate memory for data */ - t->total= count; + t->total = count; - t->data= MEM_callocN(t->total*sizeof(TransData), "TransData (Graph Editor)"); - /* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */ - t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransData2D (Graph Editor)"); + t->data = MEM_callocN(t->total * sizeof(TransData), "TransData (Graph Editor)"); + /* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */ + t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransData2D (Graph Editor)"); - td= t->data; - td2d= t->data2d; + td = t->data; + td2d = t->data2d; /* precompute space-conversion matrices for dealing with non-uniform scaling of Graph Editor */ unit_m3(mtx); @@ -3555,15 +3555,15 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) mul_v3_fl(mtx[1], yscale); /* smtx is global (i.e. view) to data conversion */ - if (IS_EQF(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale); - if (IS_EQF(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale); + if (IS_EQF(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f / xscale); + if (IS_EQF(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f / yscale); } /* loop 2: build transdata arrays */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; - short intvals= (fcu->flag & FCURVE_INT_VALUES); + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; + short intvals = (fcu->flag & FCURVE_INT_VALUES); /* convert current-frame to action-time (slightly less accurate, especially under * higher scaling ratios, but is faster than converting all points) @@ -3577,14 +3577,14 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (fcu->bezt == NULL) continue; - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS); /* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */ - for (i=0, bezt= fcu->bezt; i < fcu->totvert; i++, bezt++) { + for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) { - const char sel2= bezt->f2 & SELECT; - const char sel1= use_handle ? bezt->f1 & SELECT : sel2; - const char sel3= use_handle ? bezt->f3 & SELECT : sel2; + const char sel2 = bezt->f2 & SELECT; + const char sel1 = use_handle ? bezt->f1 & SELECT : sel2; + const char sel3 = use_handle ? bezt->f3 & SELECT : sel2; TransDataCurveHandleFlags *hdata = NULL; /* short h1=1, h2=1; */ /* UNUSED */ @@ -3602,7 +3602,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } if (sel3) { - if (hdata==NULL) + if (hdata == NULL) hdata = initTransDataCurveHandles(td, bezt); bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx); } @@ -3639,8 +3639,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) { if (hdata && (sel1) && (sel3)) { - bezt->h1= HD_ALIGN; - bezt->h2= HD_ALIGN; + bezt->h1 = HD_ALIGN; + bezt->h2 = HD_ALIGN; } } } @@ -3660,64 +3660,64 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) /* struct for use in re-sorting BezTriples during Graph Editor transform */ typedef struct BeztMap { BezTriple *bezt; - unsigned int oldIndex; /* index of bezt in fcu->bezt array before sorting */ - unsigned int newIndex; /* index of bezt in fcu->bezt array after sorting */ - short swapHs; /* swap order of handles (-1=clear; 0=not checked, 1=swap) */ - char pipo, cipo; /* interpolation of current and next segments */ + unsigned int oldIndex; /* index of bezt in fcu->bezt array before sorting */ + unsigned int newIndex; /* index of bezt in fcu->bezt array after sorting */ + short swapHs; /* swap order of handles (-1=clear; 0=not checked, 1=swap) */ + char pipo, cipo; /* interpolation of current and next segments */ } BeztMap; /* This function converts an FCurve's BezTriple array to a BeztMap array * NOTE: this allocates memory that will need to get freed later */ -static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert, const short UNUSED(use_handle)) +static BeztMap *bezt_to_beztmaps(BezTriple *bezts, int totvert, const short UNUSED(use_handle)) { - BezTriple *bezt= bezts; - BezTriple *prevbezt= NULL; + BezTriple *bezt = bezts; + BezTriple *prevbezt = NULL; BeztMap *bezm, *bezms; int i; /* allocate memory for this array */ - if (totvert==0 || bezts==NULL) + if (totvert == 0 || bezts == NULL) return NULL; - bezm= bezms= MEM_callocN(sizeof(BeztMap)*totvert, "BeztMaps"); + bezm = bezms = MEM_callocN(sizeof(BeztMap) * totvert, "BeztMaps"); /* assign beztriples to beztmaps */ - for (i=0; i < totvert; i++, bezm++, prevbezt=bezt, bezt++) { - bezm->bezt= bezt; + for (i = 0; i < totvert; i++, bezm++, prevbezt = bezt, bezt++) { + bezm->bezt = bezt; - bezm->oldIndex= i; - bezm->newIndex= i; + bezm->oldIndex = i; + bezm->newIndex = i; - bezm->pipo= (prevbezt) ? prevbezt->ipo : bezt->ipo; - bezm->cipo= bezt->ipo; + bezm->pipo = (prevbezt) ? prevbezt->ipo : bezt->ipo; + bezm->cipo = bezt->ipo; } return bezms; } /* This function copies the code of sort_time_ipocurve, but acts on BeztMap structs instead */ -static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(use_handle)) +static void sort_time_beztmaps(BeztMap *bezms, int totvert, const short UNUSED(use_handle)) { BeztMap *bezm; - int i, ok= 1; + int i, ok = 1; /* keep repeating the process until nothing is out of place anymore */ while (ok) { - ok= 0; + ok = 0; - bezm= bezms; - i= totvert; + bezm = bezms; + i = totvert; while (i--) { /* is current bezm out of order (i.e. occurs later than next)? */ if (i > 0) { - if (bezm->bezt->vec[1][0] > (bezm+1)->bezt->vec[1][0]) { + if (bezm->bezt->vec[1][0] > (bezm + 1)->bezt->vec[1][0]) { bezm->newIndex++; - (bezm+1)->newIndex--; + (bezm + 1)->newIndex--; - SWAP(BeztMap, *bezm, *(bezm+1)); + SWAP(BeztMap, *bezm, *(bezm + 1)); - ok= 1; + ok = 1; } } @@ -3743,7 +3743,7 @@ static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED( } /* This function firstly adjusts the pointers that the transdata has to each BezTriple */ -static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert, const short UNUSED(use_handle)) +static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert, const short UNUSED(use_handle)) { BezTriple *bezts = fcu->bezt; BeztMap *bezm; @@ -3756,17 +3756,17 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv * pointers have been fixed already, so that we don't override ones that are * already done */ - adjusted= MEM_callocN(t->total, "beztmap_adjusted_map"); + adjusted = MEM_callocN(t->total, "beztmap_adjusted_map"); /* for each beztmap item, find if it is used anywhere */ - bezm= bezms; - for (i= 0; i < totvert; i++, bezm++) { + bezm = bezms; + for (i = 0; i < totvert; i++, bezm++) { /* loop through transdata, testing if we have a hit * for the handles (vec[0]/vec[2]), we must also check if they need to be swapped... */ - td2d= t->data2d; - td= t->data; - for (j= 0; j < t->total; j++, td2d++, td++) { + td2d = t->data2d; + td = t->data; + for (j = 0; j < t->total; j++, td2d++, td++) { /* skip item if already marked */ if (adjusted[j] != 0) continue; @@ -3775,26 +3775,26 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv */ if (td2d->loc2d == bezm->bezt->vec[0]) { if (bezm->swapHs == 1) - td2d->loc2d= (bezts + bezm->newIndex)->vec[2]; + td2d->loc2d = (bezts + bezm->newIndex)->vec[2]; else - td2d->loc2d= (bezts + bezm->newIndex)->vec[0]; + td2d->loc2d = (bezts + bezm->newIndex)->vec[0]; adjusted[j] = 1; } else if (td2d->loc2d == bezm->bezt->vec[2]) { if (bezm->swapHs == 1) - td2d->loc2d= (bezts + bezm->newIndex)->vec[0]; + td2d->loc2d = (bezts + bezm->newIndex)->vec[0]; else - td2d->loc2d= (bezts + bezm->newIndex)->vec[2]; + td2d->loc2d = (bezts + bezm->newIndex)->vec[2]; adjusted[j] = 1; } else if (td2d->loc2d == bezm->bezt->vec[1]) { - td2d->loc2d= (bezts + bezm->newIndex)->vec[1]; + td2d->loc2d = (bezts + bezm->newIndex)->vec[1]; /* if only control point is selected, the handle pointers need to be updated as well */ if (td2d->h1) - td2d->h1= (bezts + bezm->newIndex)->vec[0]; + td2d->h1 = (bezts + bezm->newIndex)->vec[0]; if (td2d->h2) - td2d->h2= (bezts + bezm->newIndex)->vec[2]; + td2d->h2 = (bezts + bezm->newIndex)->vec[2]; adjusted[j] = 1; } @@ -3832,15 +3832,15 @@ void remake_graph_transdata(TransInfo *t, ListBase *anim_data) const short use_handle = !(sipo->flag & SIPO_NOHANDLES); /* sort and reassign verts */ - for (ale= anim_data->first; ale; ale= ale->next) { - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data->first; ale; ale = ale->next) { + FCurve *fcu = (FCurve *)ale->key_data; if (fcu->bezt) { BeztMap *bezm; /* adjust transform-data pointers */ /* note, none of these functions use 'use_handle', it could be removed */ - bezm= bezt_to_beztmaps(fcu->bezt, fcu->totvert, use_handle); + bezm = bezt_to_beztmaps(fcu->bezt, fcu->totvert, use_handle); sort_time_beztmaps(bezm, fcu->totvert, use_handle); beztmap_to_data(t, fcu, bezm, fcu->totvert, use_handle); @@ -3864,19 +3864,19 @@ void flushTransGraphData(TransInfo *t) SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; TransData *td; TransData2D *td2d; - Scene *scene= t->scene; - double secf= FPS; + Scene *scene = t->scene; + double secf = FPS; int a; /* flush to 2d vector from internally used 3d vector */ - for (a=0, td= t->data, td2d=t->data2d; a<t->total; a++, td++, td2d++) { - AnimData *adt= (AnimData *)td->extra; /* pointers to relevant AnimData blocks are stored in the td->extra pointers */ + for (a = 0, td = t->data, td2d = t->data2d; a < t->total; a++, td++, td2d++) { + AnimData *adt = (AnimData *)td->extra; /* pointers to relevant AnimData blocks are stored in the td->extra pointers */ /* handle snapping for time values * - we should still be in NLA-mapping timespace * - only apply to keyframes (but never to handles) */ - if ((td->flag & TD_NOTIMESNAP)==0) { + if ((td->flag & TD_NOTIMESNAP) == 0) { switch (sipo->autosnap) { case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */ if (sipo->flag & SIPO_DRAWTIME) @@ -3886,22 +3886,22 @@ void flushTransGraphData(TransInfo *t) break; case SACTSNAP_MARKER: /* snap to nearest marker */ - td2d->loc[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, td2d->loc[0]); + td2d->loc[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, td2d->loc[0]); break; } } /* we need to unapply the nla-mapping from the time in some situations */ if (adt) - td2d->loc2d[0]= BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP); + td2d->loc2d[0] = BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP); else - td2d->loc2d[0]= td2d->loc[0]; + td2d->loc2d[0] = td2d->loc[0]; /* if int-values only, truncate to integers */ if (td->flag & TD_INTVALUES) - td2d->loc2d[1]= floorf(td2d->loc[1] + 0.5f); + td2d->loc2d[1] = floorf(td2d->loc[1] + 0.5f); else - td2d->loc2d[1]= td2d->loc[1]; + td2d->loc2d[1] = td2d->loc[1]; if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) { td2d->h1[0] = td2d->ih1[0] + td->loc[0] - td->iloc[0]; @@ -3933,9 +3933,9 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count /* *** Extend Transform *** */ Scene *scene = t->scene; - int cfra= CFRA; - int left= seq_tx_get_final_left(seq, 1); - int right= seq_tx_get_final_right(seq, 1); + int cfra = CFRA; + int left = seq_tx_get_final_left(seq, 1); + int right = seq_tx_get_final_right(seq, 1); if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) { *recursive = FALSE; @@ -3946,34 +3946,34 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count /* for meta's we only ever need to extend their children, no matter what depth * just check the meta's are in the bounds */ - if (t->frame_side=='R' && right <= cfra) *recursive = FALSE; - else if (t->frame_side=='L' && left >= cfra) *recursive = FALSE; - else *recursive = TRUE; + if (t->frame_side == 'R' && right <= cfra) *recursive = FALSE; + else if (t->frame_side == 'L' && left >= cfra) *recursive = FALSE; + else *recursive = TRUE; - *count= 1; - *flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); + *count = 1; + *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); } else { *recursive = FALSE; /* not a meta, so no thinking here */ *count = 1; /* unless its set to 0, extend will never set 2 handles at once */ - *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); + *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); - if (t->frame_side=='R') { - if (right <= cfra) *count = *flag= 0; /* ignore */ + if (t->frame_side == 'R') { + if (right <= cfra) *count = *flag = 0; /* ignore */ else if (left > cfra) ; /* keep the selection */ - else *flag |= SEQ_RIGHTSEL; + else *flag |= SEQ_RIGHTSEL; } else { - if (left >= cfra) *count = *flag= 0; /* ignore */ - else if (right < cfra) ; /* keep the selection */ - else *flag |= SEQ_LEFTSEL; + if (left >= cfra) *count = *flag = 0; /* ignore */ + else if (right < cfra) ; /* keep the selection */ + else *flag |= SEQ_LEFTSEL; } } } else { - t->frame_side= 'B'; + t->frame_side = 'B'; /* *** Normal Transform *** */ @@ -3988,18 +3988,18 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count *flag = 0; } else { - if ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == (SEQ_LEFTSEL|SEQ_RIGHTSEL)) { - *flag= seq->flag; - *count= 2; /* we need 2 transdata's */ + if ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == (SEQ_LEFTSEL | SEQ_RIGHTSEL)) { + *flag = seq->flag; + *count = 2; /* we need 2 transdata's */ } else { - *flag= seq->flag; - *count= 1; /* selected or with a handle selected */ + *flag = seq->flag; + *count = 1; /* selected or with a handle selected */ } /* Recursive */ - if ((seq->type == SEQ_TYPE_META) && ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == 0)) { + if ((seq->type == SEQ_TYPE_META) && ((seq->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) == 0)) { /* if any handles are selected, don't recurse */ *recursive = TRUE; } @@ -4012,7 +4012,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count /* Nested, different rules apply */ #ifdef SEQ_TX_NESTED_METAS - *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); + *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); *count = 1; /* ignore the selection for nested */ *recursive = (seq->type == SEQ_TYPE_META); #else @@ -4021,13 +4021,13 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count * don't have their start and length set directly (children affect that) * since this Meta is nested we don't need any of its data in fact. * calc_sequence() will update its settings when run on the toplevel meta */ - *flag= 0; - *count= 0; + *flag = 0; + *count = 0; *recursive = TRUE; } else { - *flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL); - *count= 1; /* ignore the selection for nested */ + *flag = (seq->flag | SELECT) & ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); + *count = 1; /* ignore the selection for nested */ *recursive = FALSE; } #endif @@ -4040,10 +4040,10 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int depth) { Sequence *seq; - int tot= 0, recursive, count, flag; + int tot = 0, recursive, count, flag; - for (seq= seqbase->first; seq; seq= seq->next) { - seq->depth= depth; + for (seq = seqbase->first; seq; seq = seq->next) { + seq->depth = depth; /* seq->tmp is used by seq_tx_get_final_{left, right} to check sequence's range and clamp to it if needed. * it's first place where digging into sequences tree, so store link to parent here */ @@ -4053,7 +4053,7 @@ static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int tot += count; if (recursive) { - tot += SeqTransCount(t, seq, &seq->seqbase, depth+1); + tot += SeqTransCount(t, seq, &seq->seqbase, depth + 1); } } @@ -4066,21 +4066,21 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq int start_left; switch (sel_flag) { - case SELECT: - /* Use seq_tx_get_final_left() and an offset here - * so transform has the left hand location of the strip. - * tdsq->start_offset is used when flushing the tx data back */ - start_left= seq_tx_get_final_left(seq, 0); - td2d->loc[0]= start_left; - tdsq->start_offset= start_left - seq->start; /* use to apply the original location */ - break; - case SEQ_LEFTSEL: - start_left= seq_tx_get_final_left(seq, 0); - td2d->loc[0] = start_left; - break; - case SEQ_RIGHTSEL: - td2d->loc[0] = seq_tx_get_final_right(seq, 0); - break; + case SELECT: + /* Use seq_tx_get_final_left() and an offset here + * so transform has the left hand location of the strip. + * tdsq->start_offset is used when flushing the tx data back */ + start_left = seq_tx_get_final_left(seq, 0); + td2d->loc[0] = start_left; + tdsq->start_offset = start_left - seq->start; /* use to apply the original location */ + break; + case SEQ_LEFTSEL: + start_left = seq_tx_get_final_left(seq, 0); + td2d->loc[0] = start_left; + break; + case SEQ_RIGHTSEL: + td2d->loc[0] = seq_tx_get_final_right(seq, 0); + break; } td2d->loc[1] = seq->machine; /* channel - Y location */ @@ -4088,15 +4088,15 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq td2d->loc2d = NULL; - tdsq->seq= seq; + tdsq->seq = seq; /* Use instead of seq->flag for nested strips and other * cases where the selection may need to be modified */ - tdsq->flag= flag; - tdsq->sel_flag= sel_flag; + tdsq->flag = flag; + tdsq->sel_flag = sel_flag; - td->extra= (void *)tdsq; /* allow us to update the strip from here */ + td->extra = (void *)tdsq; /* allow us to update the strip from here */ td->flag = 0; td->loc = td2d->loc; @@ -4106,17 +4106,17 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; td->flag |= TD_SELECTED; - td->dist= 0.0; + td->dist = 0.0; unit_m3(td->mtx); unit_m3(td->smtx); /* Time Transform (extend) */ - td->val= td2d->loc; - td->ival= td2d->loc[0]; + td->val = td2d->loc; + td->ival = td2d->loc[0]; return td; } @@ -4125,26 +4125,26 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData * { Sequence *seq; int recursive, count, flag; - int tot= 0; + int tot = 0; - for (seq= seqbase->first; seq; seq= seq->next) { + for (seq = seqbase->first; seq; seq = seq->next) { SeqTransInfo(t, seq, &recursive, &count, &flag); /* add children first so recalculating metastrips does nested strips first */ if (recursive) { - int tot_children= SeqToTransData_Recursive(t, &seq->seqbase, td, td2d, tdsq); + int tot_children = SeqToTransData_Recursive(t, &seq->seqbase, td, td2d, tdsq); - td= td + tot_children; - td2d= td2d + tot_children; - tdsq= tdsq + tot_children; + td = td + tot_children; + td2d = td2d + tot_children; + tdsq = tdsq + tot_children; tot += tot_children; } /* use 'flag' which is derived from seq->flag but modified for special cases */ if (flag & SELECT) { - if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) { + if (flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) { if (flag & SEQ_LEFTSEL) { SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); tot++; @@ -4166,83 +4166,83 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData * static void freeSeqData(TransInfo *t) { - Editing *ed= BKE_sequencer_editing_get(t->scene, FALSE); + Editing *ed = BKE_sequencer_editing_get(t->scene, FALSE); if (ed != NULL) { - ListBase *seqbasep= ed->seqbasep; - TransData *td= t->data; + ListBase *seqbasep = ed->seqbasep; + TransData *td = t->data; int a; /* prevent updating the same seq twice * if the transdata order is changed this will mess up * but so will TransDataSeq */ - Sequence *seq_prev= NULL; + Sequence *seq_prev = NULL; Sequence *seq; if (!(t->state == TRANS_CANCEL)) { -#if 0 // default 2.4 behavior +#if 0 // default 2.4 behavior /* flush to 2d vector from internally used 3d vector */ - for (a=0; a<t->total; a++, td++) { - if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) { - seq= ((TransDataSeq *)td->extra)->seq; + for (a = 0; a < t->total; a++, td++) { + if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) { + seq = ((TransDataSeq *)td->extra)->seq; shuffle_seq(seqbasep, seq); } - seq_prev= seq; + seq_prev = seq; } -#else // durian hack +#else // durian hack { - int overlap= 0; + int overlap = 0; - for (a=0; a<t->total; a++, td++) { - seq_prev= NULL; - seq= ((TransDataSeq *)td->extra)->seq; - if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) { - overlap= 1; + for (a = 0; a < t->total; a++, td++) { + seq_prev = NULL; + seq = ((TransDataSeq *)td->extra)->seq; + if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) { + overlap = 1; break; } - seq_prev= seq; + seq_prev = seq; } if (overlap) { - int has_effect= 0; - for (seq= seqbasep->first; seq; seq= seq->next) - seq->tmp= NULL; - - td= t->data; - seq_prev= NULL; - for (a=0; a<t->total; a++, td++) { - seq= ((TransDataSeq *)td->extra)->seq; + int has_effect = 0; + for (seq = seqbasep->first; seq; seq = seq->next) + seq->tmp = NULL; + + td = t->data; + seq_prev = NULL; + for (a = 0; a < t->total; a++, td++) { + seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { /* check effects strips, we cant change their time */ if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) { - has_effect= TRUE; + has_effect = TRUE; } else { /* Tag seq with a non zero value, used by shuffle_seq_time to identify the ones to shuffle */ - seq->tmp= (void*)1; + seq->tmp = (void *)1; } } } -#if 1 /* (mango hack! - for Ian) this is truely bad - should _never_ be in a release :| */ +#if 1 /* (mango hack! - for Ian) this is truely bad - should _never_ be in a release :| */ if (CTX_wm_window(t->context)->eventstate->alt) { int minframe = MAXFRAME; - td= t->data; - seq_prev= NULL; - for (a=0; a<t->total; a++, td++) { - seq= ((TransDataSeq *)td->extra)->seq; + td = t->data; + seq_prev = NULL; + for (a = 0; a < t->total; a++, td++) { + seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { minframe = MIN2(minframe, seq->startdisp); } } - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (!(seq->flag & SELECT)) { if (seq->startdisp >= minframe) { seq->machine += MAXSEQ * 2; @@ -4252,13 +4252,13 @@ static void freeSeqData(TransInfo *t) shuffle_seq_time(seqbasep, t->scene); - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->machine >= MAXSEQ * 2) { seq->machine -= MAXSEQ * 2; - seq->tmp= (void*)1; + seq->tmp = (void *)1; } else { - seq->tmp= NULL; + seq->tmp = NULL; } } @@ -4273,10 +4273,10 @@ static void freeSeqData(TransInfo *t) if (has_effect) { /* update effects strips based on strips just moved in time */ - td= t->data; - seq_prev= NULL; - for (a=0; a<t->total; a++, td++) { - seq= ((TransDataSeq *)td->extra)->seq; + td = t->data; + seq_prev = NULL; + for (a = 0; a < t->total; a++, td++) { + seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) { calc_sequence(t->scene, seq); @@ -4285,10 +4285,10 @@ static void freeSeqData(TransInfo *t) } /* now if any effects _still_ overlap, we need to move them up */ - td= t->data; - seq_prev= NULL; - for (a=0; a<t->total; a++, td++) { - seq= ((TransDataSeq *)td->extra)->seq; + td = t->data; + seq_prev = NULL; + for (a = 0; a < t->total; a++, td++) { + seq = ((TransDataSeq *)td->extra)->seq; if ((seq != seq_prev)) { if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) { if (seq_test_overlap(seqbasep, seq)) { @@ -4303,7 +4303,7 @@ static void freeSeqData(TransInfo *t) } #endif - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { /* We might want to build a list of effects that need to be updated during transform */ if (seq->type & SEQ_TYPE_EFFECT) { if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq); @@ -4316,12 +4316,12 @@ static void freeSeqData(TransInfo *t) } else { /* Cancelled, need to update the strips display */ - for (a=0; a<t->total; a++, td++) { - seq= ((TransDataSeq *)td->extra)->seq; - if ((seq != seq_prev) && (seq->depth==0)) { + for (a = 0; a < t->total; a++, td++) { + seq = ((TransDataSeq *)td->extra)->seq; + if ((seq != seq_prev) && (seq->depth == 0)) { calc_sequence_disp(t->scene, seq); } - seq_prev= seq; + seq_prev = seq; } } } @@ -4332,7 +4332,7 @@ static void freeSeqData(TransInfo *t) } if (t->data) { MEM_freeN(t->data); // XXX postTrans usually does this - t->data= NULL; + t->data = NULL; } } @@ -4340,21 +4340,21 @@ static void createTransSeqData(bContext *C, TransInfo *t) { #define XXX_DURIAN_ANIM_TX_HACK - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= t->scene; - Editing *ed= BKE_sequencer_editing_get(t->scene, FALSE); + View2D *v2d = UI_view2d_fromcontext(C); + Scene *scene = t->scene; + Editing *ed = BKE_sequencer_editing_get(t->scene, FALSE); TransData *td = NULL; - TransData2D *td2d= NULL; - TransDataSeq *tdsq= NULL; + TransData2D *td2d = NULL; + TransDataSeq *tdsq = NULL; - int count=0; + int count = 0; - if (ed==NULL) { - t->total= 0; + if (ed == NULL) { + t->total = 0; return; } - t->customFree= freeSeqData; + t->customFree = freeSeqData; /* which side of the current frame should be allowed */ if (t->mode == TFM_TIME_EXTEND) { @@ -4372,16 +4372,16 @@ static void createTransSeqData(bContext *C, TransInfo *t) #ifdef XXX_DURIAN_ANIM_TX_HACK { Sequence *seq; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { /* hack */ - if ((seq->flag & SELECT)==0 && seq->type & SEQ_TYPE_EFFECT) { + if ((seq->flag & SELECT) == 0 && seq->type & SEQ_TYPE_EFFECT) { Sequence *seq_user; int i; - for (i=0; i<3; i++) { - seq_user= *((&seq->seq1) + i); + for (i = 0; i < 3; i++) { + seq_user = *((&seq->seq1) + i); if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && - !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) + !(seq_user->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL))) { seq->flag |= SELECT; } @@ -4394,16 +4394,16 @@ static void createTransSeqData(bContext *C, TransInfo *t) count = SeqTransCount(t, NULL, ed->seqbasep, 0); /* allocate memory for data */ - t->total= count; + t->total = count; /* stop if trying to build list if nothing selected */ if (count == 0) { return; } - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransSeq TransData"); - td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransSeq TransData2D"); - tdsq = t->customData = MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransSeq TransData"); + td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransSeq TransData2D"); + tdsq = t->customData = MEM_callocN(t->total * sizeof(TransDataSeq), "TransSeq TransDataSeq"); t->flag |= T_FREE_CUSTOMDATA; @@ -4431,17 +4431,17 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) * constraints needing special crazyspace corrections */ if (list) { - for (con= list->first; con; con=con->next) { + for (con = list->first; con; con = con->next) { /* only consider constraint if it is enabled, and has influence on result */ - if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f)) { + if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) { /* (affirmative) returns for specific constraints here... */ - /* constraints that require this regardless */ + /* constraints that require this regardless */ if (con->type == CONSTRAINT_TYPE_CHILDOF) return 1; if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) return 1; if (con->type == CONSTRAINT_TYPE_CLAMPTO) return 1; if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) return 1; - /* constraints that require this only under special conditions */ + /* constraints that require this only under special conditions */ if (con->type == CONSTRAINT_TYPE_ROTLIKE) { /* CopyRot constraint only does this when rotating, and offset is on */ bRotateLikeConstraint *data = (bRotateLikeConstraint *)con->data; @@ -4469,11 +4469,11 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) copy_m3_m4(td->axismtx, ob->obmat); normalize_m3(td->axismtx); - td->con= ob->constraints.first; + td->con = ob->constraints.first; /* hack: temporarily disable tracking and/or constraints when getting * object matrix, if tracking is on, or if constraints don't need - * inverse correction to stop it from screwing up space conversion + * inverse correction to stop it from screwing up space conversion * matrix later */ constinv = constraints_list_needinv(t, &ob->constraints); @@ -4484,7 +4484,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) if (skip_invert == 0 && constinv == 0) { if (constinv == 0) - ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */ + ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */ BKE_object_where_is_calc(t->scene, ob); @@ -4500,35 +4500,35 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) copy_v3_v3(td->iloc, td->loc); if (ob->rotmode > 0) { - td->ext->rot= ob->rot; - td->ext->rotAxis= NULL; - td->ext->rotAngle= NULL; - td->ext->quat= NULL; + td->ext->rot = ob->rot; + td->ext->rotAxis = NULL; + td->ext->rotAngle = NULL; + td->ext->quat = NULL; copy_v3_v3(td->ext->irot, ob->rot); copy_v3_v3(td->ext->drot, ob->drot); } else if (ob->rotmode == ROT_MODE_AXISANGLE) { - td->ext->rot= NULL; - td->ext->rotAxis= ob->rotAxis; - td->ext->rotAngle= &ob->rotAngle; - td->ext->quat= NULL; + td->ext->rot = NULL; + td->ext->rotAxis = ob->rotAxis; + td->ext->rotAngle = &ob->rotAngle; + td->ext->quat = NULL; - td->ext->irotAngle= ob->rotAngle; + td->ext->irotAngle = ob->rotAngle; copy_v3_v3(td->ext->irotAxis, ob->rotAxis); // td->ext->drotAngle= ob->drotAngle; // XXX, not implemented // copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implemented } else { - td->ext->rot= NULL; - td->ext->rotAxis= NULL; - td->ext->rotAngle= NULL; - td->ext->quat= ob->quat; + td->ext->rot = NULL; + td->ext->rotAxis = NULL; + td->ext->rotAngle = NULL; + td->ext->quat = ob->quat; copy_qt_qt(td->ext->iquat, ob->quat); copy_qt_qt(td->ext->dquat, ob->dquat); } - td->ext->rotOrder=ob->rotmode; + td->ext->rotOrder = ob->rotmode; td->ext->size = ob->size; copy_v3_v3(td->ext->isize, ob->size); @@ -4586,17 +4586,17 @@ static void set_trans_object_base_flags(TransInfo *t) BKE_scene_base_flag_to_objects(t->scene); /* handle pending update events, otherwise they got copied below */ - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { if (base->object->recalc) BKE_object_handle_update(t->scene, base->object); } - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { base->flag &= ~BA_WAS_SEL; if (TESTBASELIB_BGMODE(v3d, scene, base)) { - Object *ob= base->object; - Object *parsel= ob->parent; + Object *ob = base->object; + Object *parsel = ob->parent; /* if parent selected, deselect */ while (parsel) { @@ -4608,7 +4608,7 @@ static void set_trans_object_base_flags(TransInfo *t) } } } - parsel= parsel->parent; + parsel = parsel->parent; } if (parsel) { @@ -4631,7 +4631,7 @@ static void set_trans_object_base_flags(TransInfo *t) /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { if (base->object->recalc & OB_RECALC_OB) base->flag |= BA_HAS_RECALC_OB; if (base->object->recalc & OB_RECALC_DATA) @@ -4641,7 +4641,7 @@ static void set_trans_object_base_flags(TransInfo *t) static int mark_children(Object *ob) { - if (ob->flag & (SELECT|BA_TRANSFORM_CHILD)) + if (ob->flag & (SELECT | BA_TRANSFORM_CHILD)) return 1; if (ob->parent) { @@ -4664,7 +4664,7 @@ static int count_proportional_objects(TransInfo *t) /* rotations around local centers are allowed to propagate, so we take all objects */ if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) { /* mark all parents */ - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { if (TESTBASELIB_BGMODE(v3d, scene, base)) { Object *parent = base->object->parent; @@ -4677,9 +4677,9 @@ static int count_proportional_objects(TransInfo *t) } /* mark all children */ - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { /* all base not already selected or marked that is editable */ - if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && + if ((base->object->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && (BASE_EDITABLE_BGMODE(v3d, scene, base))) { mark_children(base->object); @@ -4687,11 +4687,11 @@ static int count_proportional_objects(TransInfo *t) } } - for (base= scene->base.first; base; base= base->next) { - Object *ob= base->object; + for (base = scene->base.first; base; base = base->next) { + Object *ob = base->object; /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ - if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && + if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && (BASE_EDITABLE_BGMODE(v3d, scene, base))) { @@ -4708,7 +4708,7 @@ static int count_proportional_objects(TransInfo *t) /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ - for (base= scene->base.first; base; base= base->next) { + for (base = scene->base.first; base; base = base->next) { if (base->object->recalc & OB_RECALC_OB) base->flag |= BA_HAS_RECALC_OB; if (base->object->recalc & OB_RECALC_DATA) @@ -4723,21 +4723,21 @@ static void clear_trans_object_base_flags(TransInfo *t) Scene *sce = t->scene; Base *base; - for (base= sce->base.first; base; base = base->next) { + for (base = sce->base.first; base; base = base->next) { if (base->flag & BA_WAS_SEL) base->flag |= SELECT; - base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT); + base->flag &= ~(BA_WAS_SEL | BA_HAS_RECALC_OB | BA_HAS_RECALC_DATA | BA_TEMP_TAG | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT); } } /* auto-keyframing feature - for objects - * tmode: should be a transform mode + * tmode: should be a transform mode */ // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode) { - ID *id= &ob->id; + ID *id = &ob->id; FCurve *fcu; // TODO: this should probably be done per channel instead... @@ -4745,7 +4745,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, ReportList *reports = CTX_wm_reports(C); KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); ListBase dsources = {NULL, NULL}; - float cfra= (float)CFRA; // xxx this will do for now + float cfra = (float)CFRA; // xxx this will do for now short flag = 0; /* get flags used for inserting keyframes */ @@ -4761,11 +4761,11 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra); } else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { - AnimData *adt= ob->adt; + AnimData *adt = ob->adt; /* only key on available channels */ if (adt && adt->action) { - for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) { + for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) { fcu->flag &= ~FCURVE_SELECTED; insert_keyframe(reports, id, adt->action, (fcu->grp ? fcu->grp->name : NULL), @@ -4788,7 +4788,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, else if (v3d->around == V3D_CURSOR) do_loc = TRUE; - if ((v3d->flag & V3D_ALIGN)==0) + if ((v3d->flag & V3D_ALIGN) == 0) do_rot = TRUE; } else if (tmode == TFM_RESIZE) { @@ -4799,27 +4799,27 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, else if (v3d->around == V3D_CURSOR) do_loc = TRUE; - if ((v3d->flag & V3D_ALIGN)==0) + if ((v3d->flag & V3D_ALIGN) == 0) do_scale = TRUE; } /* insert keyframes for the affected sets of channels using the builtin KeyingSets found */ if (do_loc) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (do_rot) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (do_scale) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } } /* insert keyframe in all (transform) channels */ else { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } @@ -4829,16 +4829,16 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, } /* auto-keyframing feature - for poses/pose-channels - * tmode: should be a transform mode + * tmode: should be a transform mode * targetless_ik: has targetless ik been done on any channels? */ // NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode, short targetless_ik) { - ID *id= &ob->id; - AnimData *adt= ob->adt; - bAction *act= (adt) ? adt->action : NULL; - bPose *pose= ob->pose; + ID *id = &ob->id; + AnimData *adt = ob->adt; + bAction *act = (adt) ? adt->action : NULL; + bPose *pose = ob->pose; bPoseChannel *pchan; FCurve *fcu; @@ -4846,12 +4846,12 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o if (autokeyframe_cfra_can_key(scene, id)) { ReportList *reports = CTX_wm_reports(C); KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene); - float cfra= (float)CFRA; - short flag= 0; + float cfra = (float)CFRA; + short flag = 0; /* flag is initialized from UserPref keyframing settings * - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get - * visual keyframes even if flag not set, as it's not that useful otherwise + * visual keyframes even if flag not set, as it's not that useful otherwise * (for quick animation recording) */ flag = ANIM_get_keyframing_flags(scene, 1); @@ -4859,7 +4859,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o if (targetless_ik) flag |= INSERTKEY_MATRIX; - for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) { + for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->flag & BONE_TRANSFORM) { ListBase dsources = {NULL, NULL}; @@ -4877,16 +4877,16 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o /* only insert into available channels? */ else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) { if (act) { - for (fcu= act->curves.first; fcu; fcu= fcu->next) { + for (fcu = act->curves.first; fcu; fcu = fcu->next) { /* only insert keyframes for this F-Curve if it affects the current bone */ if (strstr(fcu->rna_path, "bones")) { - char *pchanName= BLI_getQuotedStr(fcu->rna_path, "bones["); + char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones["); /* only if bone name matches too... * NOTE: this will do constraints too, but those are ok to do here too? */ if (pchanName && strcmp(pchanName, pchan->name) == 0) - insert_keyframe(reports, id, act, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag); + insert_keyframe(reports, id, act, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag); if (pchanName) MEM_freeN(pchanName); } @@ -4908,33 +4908,33 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE)) do_loc = TRUE; - if ((v3d->flag & V3D_ALIGN)==0) + if ((v3d->flag & V3D_ALIGN) == 0) do_rot = TRUE; } else if (tmode == TFM_RESIZE) { if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE)) do_loc = TRUE; - if ((v3d->flag & V3D_ALIGN)==0) + if ((v3d->flag & V3D_ALIGN) == 0) do_scale = TRUE; } if (do_loc) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (do_rot) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } if (do_scale) { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } } /* insert keyframe in all (transform) channels */ else { - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID); + KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID); ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); } @@ -4944,7 +4944,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o } /* do the bone paths - * - only do this when there is context info, since we need that to resolve + * - only do this when there is context info, since we need that to resolve * how to do the updates and so on... * - do not calculate unless there are paths already to update... */ @@ -4955,7 +4955,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o } else { /* tag channels that should have unkeyed data */ - for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) { + for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->flag & BONE_TRANSFORM) { /* tag this channel */ pchan->bone->flag |= BONE_UNKEYED; @@ -4968,22 +4968,22 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o /* inserting keys, pointcache, redraw events... */ /* * note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell) - * Order changed, the sequencer stuff should go back in here + * Order changed, the sequencer stuff should go back in here * */ void special_aftertrans_update(bContext *C, TransInfo *t) { Object *ob; // short redrawipo=0, resetslowpar=1; - int canceled= (t->state == TRANS_CANCEL); - short duplicate= (t->mode == TFM_TIME_DUPLICATE); + int canceled = (t->state == TRANS_CANCEL); + short duplicate = (t->mode == TFM_TIME_DUPLICATE); /* early out when nothing happened */ if (t->total == 0 || t->mode == TFM_DUMMY) return; - if (t->spacetype==SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { if (t->obedit) { - if (canceled==0) { + if (canceled == 0) { /* we need to delete the temporary faces before automerging */ if (t->mode == TFM_EDGE_SLIDE) { SlideData *sld = t->customData; @@ -5014,7 +5014,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* freeSeqData in transform_conversions.c does this * keep here so the else at the end wont run... */ - SpaceSeq *sseq= (SpaceSeq *)t->sa->spacedata.first; + SpaceSeq *sseq = (SpaceSeq *)t->sa->spacedata.first; /* marker transform, not especially nice but we may want to move markers * at the same time as keyframes in the dope sheet. */ @@ -5033,7 +5033,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_NODE) { - SpaceNode *snode= (SpaceNode *)t->sa->spacedata.first; + SpaceNode *snode = (SpaceNode *)t->sa->spacedata.first; if (canceled == 0) { ED_node_post_apply_transform(C, snode->edittree); @@ -5052,7 +5052,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* tracks can be used for stabilization nodes, * flush update for such nodes */ nodeUpdateID(t->scene->nodetree, &clip->id); - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_NODES, NULL); } } else if (t->options & CTX_MASK) { @@ -5063,7 +5063,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* tracks can be used for stabilization nodes, * flush update for such nodes */ nodeUpdateID(t->scene->nodetree, &mask->id); - WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_NODES, NULL); } /* TODO - dont key all masks... */ @@ -5075,7 +5075,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } } else if (t->spacetype == SPACE_ACTION) { - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; bAnimContext ac; /* initialize relevant anim-context 'context' data */ @@ -5087,22 +5087,22 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (ELEM(ac.datatype, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); + short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/); /* get channels to work on */ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* these should all be F-Curves */ - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; /* 3 cases here for curve cleanups: * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these */ - if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 && + if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && ((canceled == 0) || (duplicate)) ) { if (adt) { @@ -5111,7 +5111,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1); } else - posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ + posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */ } } @@ -5123,7 +5123,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) // fixme... some of this stuff is not good if (ob) { if (ob->pose || ob_get_key(ob)) - DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); else DAG_id_tag_update(&ob->id, OB_RECALC_OB); } @@ -5133,7 +5133,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these */ - if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 && + if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && ((canceled == 0) || (duplicate))) { posttrans_action_clean(&ac, (bAction *)ac.data); @@ -5141,13 +5141,13 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } else if (ac.datatype == ANIMCONT_GPENCIL) { /* remove duplicate frames and also make sure points are in order! */ - /* 3 cases here for curve cleanups: - * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done - * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed - * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these - */ - if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 && - ((canceled == 0) || (duplicate))) + /* 3 cases here for curve cleanups: + * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done + * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed + * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these + */ + if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && + ((canceled == 0) || (duplicate))) { bGPdata *gpd; @@ -5161,13 +5161,13 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } else if (ac.datatype == ANIMCONT_MASK) { /* remove duplicate frames and also make sure points are in order! */ - /* 3 cases here for curve cleanups: - * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done - * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed - * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these - */ - if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 && - ((canceled == 0) || (duplicate))) + /* 3 cases here for curve cleanups: + * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done + * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed + * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these + */ + if ((saction->flag & SACTION_NOTRANSKEYCULL) == 0 && + ((canceled == 0) || (duplicate))) { Mask *mask; @@ -5209,7 +5209,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) saction->flag &= ~SACTION_MOVING; } else if (t->spacetype == SPACE_IPO) { - SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; + SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; bAnimContext ac; const short use_handle = !(sipo->flag & SIPO_NOHANDLES); @@ -5220,21 +5220,21 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (ac.datatype) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); + short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); /* get channels to work on */ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - for (ale= anim_data.first; ale; ale= ale->next) { - AnimData *adt= ANIM_nla_mapping_get(&ac, ale); - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data.first; ale; ale = ale->next) { + AnimData *adt = ANIM_nla_mapping_get(&ac, ale); + FCurve *fcu = (FCurve *)ale->key_data; /* 3 cases here for curve cleanups: * 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done * 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these */ - if ((sipo->flag & SIPO_NOTRANSKEYCULL)==0 && + if ((sipo->flag & SIPO_NOTRANSKEYCULL) == 0 && ((canceled == 0) || (duplicate))) { if (adt) { @@ -5269,13 +5269,13 @@ void special_aftertrans_update(bContext *C, TransInfo *t) if (ac.datatype) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT); + short filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT); /* get channels to work on */ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); - for (ale= anim_data.first; ale; ale= ale->next) { - NlaTrack *nlt= (NlaTrack *)ale->data; + for (ale = anim_data.first; ale; ale = ale->next) { + NlaTrack *nlt = (NlaTrack *)ale->data; /* make sure strips are in order again */ BKE_nlatrack_sort_strips(nlt); @@ -5301,16 +5301,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if ((t->flag & T_POSE) && (t->poseobj)) { bArmature *arm; bPoseChannel *pchan; - short targetless_ik= 0; + short targetless_ik = 0; - ob= t->poseobj; - arm= ob->data; + ob = t->poseobj; + arm = ob->data; if ((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) { /* when running transform non-interactively (operator exec), * we need to update the pose otherwise no updates get called during * transform and the auto-ik is not applied. see [#26164] */ - struct Object *pose_ob=t->poseobj; + struct Object *pose_ob = t->poseobj; BKE_pose_where_is(t->scene, pose_ob); } @@ -5319,17 +5319,17 @@ void special_aftertrans_update(bContext *C, TransInfo *t) count_set_pose_transflags(&t->mode, t->around, ob); /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */ - if (!canceled && t->mode==TFM_TRANSLATION) - targetless_ik= apply_targetless_ik(ob); + if (!canceled && t->mode == TFM_TRANSLATION) + targetless_ik = apply_targetless_ik(ob); else { /* not forget to clear the auto flag */ - for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { - bKinematicConstraint *data= has_targetless_ik(pchan); + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + bKinematicConstraint *data = has_targetless_ik(pchan); if (data) data->flag &= ~CONSTRAINT_IK_AUTO; } } - if (t->mode==TFM_TRANSLATION) + if (t->mode == TFM_TRANSLATION) pose_grab_with_ik_clear(ob); /* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */ @@ -5340,7 +5340,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) else if (arm->flag & ARM_DELAYDEFORM) { /* old optimize trick... this enforces to bypass the depgraph */ DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - ob->recalc= 0; // is set on OK position already by recalcData() + ob->recalc = 0; // is set on OK position already by recalcData() } else DAG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -5354,7 +5354,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* do nothing */ } else { /* Objects */ - int i, recalcObPaths=0; + int i, recalcObPaths = 0; for (i = 0; i < t->total; i++) { TransData *td = t->data + i; @@ -5370,7 +5370,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* flag object caches as outdated */ BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR); - for (pid=pidlist.first; pid; pid=pid->next) { + for (pid = pidlist.first; pid; pid = pid->next) { if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */ pid->cache->flag |= PTCACHE_OUTDATED; } @@ -5392,7 +5392,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* only calculate paths if there are paths to be recalculated */ if (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) - recalcObPaths= 1; + recalcObPaths = 1; } } @@ -5434,7 +5434,7 @@ static void createTransObject(bContext *C, TransInfo *t) set_trans_object_base_flags(t); /* count */ - t->total= CTX_DATA_COUNT(C, selected_objects); + t->total = CTX_DATA_COUNT(C, selected_objects); if (!t->total) { /* clear here, main transform function escapes too */ @@ -5446,17 +5446,17 @@ static void createTransObject(bContext *C, TransInfo *t) t->total += count_proportional_objects(t); } - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransOb"); - tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransObExtension"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransOb"); + tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "TransObExtension"); - CTX_DATA_BEGIN (C, Base*, base, selected_bases) + CTX_DATA_BEGIN(C, Base *, base, selected_bases) { - Object *ob= base->object; + Object *ob = base->object; td->flag = TD_SELECTED; - td->protectflag= ob->protectflag; + td->protectflag = ob->protectflag; td->ext = tx; - td->ext->rotOrder= ob->rotmode; + td->ext->rotOrder = ob->rotmode; if (base->flag & BA_TRANSFORM_CHILD) { td->flag |= TD_NOCENTER; @@ -5480,16 +5480,16 @@ static void createTransObject(bContext *C, TransInfo *t) View3D *v3d = t->view; Base *base; - for (base= scene->base.first; base; base= base->next) { - Object *ob= base->object; + for (base = scene->base.first; base; base = base->next) { + Object *ob = base->object; /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base)) { - td->protectflag= ob->protectflag; + td->protectflag = ob->protectflag; td->ext = tx; - td->ext->rotOrder= ob->rotmode; + td->ext->rotOrder = ob->rotmode; ObjectToTransData(t, td, ob); td->val = NULL; @@ -5522,10 +5522,10 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node) memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; td->val= NULL; + td->ext = NULL; td->val = NULL; td->flag |= TD_SELECTED; - td->dist= 0.0; + td->dist = 0.0; unit_m3(td->mtx); unit_m3(td->smtx); @@ -5535,29 +5535,29 @@ static void createTransNodeData(bContext *C, TransInfo *t) { TransData *td; TransData2D *td2d; - SpaceNode *snode= t->sa->spacedata.first; + SpaceNode *snode = t->sa->spacedata.first; bNode *node; if (!snode->edittree) { - t->total= 0; + t->total = 0; return; } /* set transform flags on nodes */ - for (node=snode->edittree->nodes.first; node; node=node->next) { + for (node = snode->edittree->nodes.first; node; node = node->next) { if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM))) node->flag |= NODE_TRANSFORM; else node->flag &= ~NODE_TRANSFORM; } - t->total= CTX_DATA_COUNT(C, selected_nodes); + t->total = CTX_DATA_COUNT(C, selected_nodes); - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransNode TransData"); - td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransNode TransData2D"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransNode TransData"); + td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransNode TransData2D"); - CTX_DATA_BEGIN (C, bNode *, selnode, selected_nodes) - NodeToTransData(td++, td2d++, selnode); + CTX_DATA_BEGIN(C, bNode *, selnode, selected_nodes) + NodeToTransData(td++, td2d++, selnode); CTX_DATA_END } @@ -5600,7 +5600,7 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d, TransDataTra td2d->loc[0] = rel[0] * aspx; /* hold original location */ td2d->loc[1] = rel[1] * aspy; - tdt->loc= loc; + tdt->loc = loc; td2d->loc2d = loc; /* current location */ } else { @@ -5640,8 +5640,8 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d, TransDataTra memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; - td->val= NULL; + td->ext = NULL; + td->val = NULL; td->flag |= TD_SELECTED; td->dist = 0.0; @@ -5715,19 +5715,19 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t) track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { marker = BKE_tracking_get_marker(track, framenr); - t->total++; /* offset */ + t->total++; /* offset */ if (track->flag & SELECT) t->total++; if (track->pat_flag & SELECT) - t->total+= 4; + t->total += 4; if (track->search_flag & SELECT) - t->total+= 2; + t->total += 2; } track = track->next; @@ -5738,9 +5738,9 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t) ED_space_clip_aspect_dimension_aware(sc, &aspx, &aspy); - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData"); - td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransTracking TransData2D"); - tdt = t->customData = MEM_callocN(t->total*sizeof(TransDataTracking), "TransTracking TransDataTracking"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransTracking TransData"); + td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransTracking TransData2D"); + tdt = t->customData = MEM_callocN(t->total * sizeof(TransDataTracking), "TransTracking TransDataTracking"); t->customFree = transDataTrackingFree; @@ -5815,8 +5815,8 @@ static void markerToTransCurveDataInit(TransData *td, TransData2D *td2d, TransDa memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; - td->val= NULL; + td->ext = NULL; + td->val = NULL; td->flag |= TD_SELECTED; td->dist = 0.0; @@ -5831,7 +5831,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t) TransData2D *td2d; SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); - ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking); + ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); MovieTrackingTrack *track; MovieTrackingMarker *marker, *prev_marker; TransDataTracking *tdt; @@ -5844,10 +5844,10 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t) track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { for (i = 1; i < track->markersnr; i++) { marker = &track->markers[i]; - prev_marker = &track->markers[i-1]; + prev_marker = &track->markers[i - 1]; if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED)) continue; @@ -5866,32 +5866,32 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t) if (t->total == 0) return; - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData"); - td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransTracking TransData2D"); - tdt = t->customData = MEM_callocN(t->total*sizeof(TransDataTracking), "TransTracking TransDataTracking"); + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransTracking TransData"); + td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransTracking TransData2D"); + tdt = t->customData = MEM_callocN(t->total * sizeof(TransDataTracking), "TransTracking TransDataTracking"); t->customFree = transDataTrackingFree; /* create actual data */ track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { for (i = 1; i < track->markersnr; i++) { marker = &track->markers[i]; - prev_marker = &track->markers[i-1]; + prev_marker = &track->markers[i - 1]; if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED)) continue; if (marker->flag & MARKER_GRAPH_SEL_X) { - markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 0, width); + markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i - 1], 0, width); td += 1; td2d += 1; tdt += 1; } if (marker->flag & MARKER_GRAPH_SEL_Y) { - markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 1, height); + markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i - 1], 1, height); td += 1; td2d += 1; @@ -5940,7 +5940,7 @@ static void cancelTransTracking(TransInfo *t) if (tdt->mode == transDataTracking_ModeTracks) { track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { marker = BKE_tracking_get_marker(track, framenr); marker->flag = tdt->flag; @@ -5964,15 +5964,15 @@ static void cancelTransTracking(TransInfo *t) track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { for (a = 1; a < track->markersnr; a++) { marker = &track->markers[a]; - prev_marker = &track->markers[a-1]; + prev_marker = &track->markers[a - 1]; if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED)) continue; - if (marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) { + if (marker->flag & (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)) { marker->flag = tdt->flag; } } @@ -5998,7 +5998,7 @@ void flushTransTracking(TransInfo *t) cancelTransTracking(t); /* flush to 2d vector from internally used 3d vector */ - for (a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) { + for (a = 0, td = t->data, td2d = t->data2d, tdt = t->customData; a < t->total; a++, td2d++, td++, tdt++) { if (tdt->mode == transDataTracking_ModeTracks) { float loc2d[2]; @@ -6019,7 +6019,7 @@ void flushTransTracking(TransInfo *t) float d[2], d2[2]; if (!tdt->smarkers) { - tdt->smarkers = MEM_callocN(sizeof(*tdt->smarkers)*tdt->markersnr, "flushTransTracking markers"); + tdt->smarkers = MEM_callocN(sizeof(*tdt->smarkers) * tdt->markersnr, "flushTransTracking markers"); for (a = 0; a < tdt->markersnr; a++) copy_v2_v2(tdt->smarkers[a], tdt->markers[a].pos); } @@ -6029,7 +6029,7 @@ void flushTransTracking(TransInfo *t) sub_v2_v2v2(d2, loc2d, tdt->srelative); - for (a= 0; a<tdt->markersnr; a++) + for (a = 0; a < tdt->markersnr; a++) add_v2_v2v2(tdt->markers[a].pos, tdt->smarkers[a], d2); negate_v2_v2(td2d->loc2d, d); @@ -6037,7 +6037,7 @@ void flushTransTracking(TransInfo *t) } } - if (tdt->area!=TRACK_AREA_POINT || tdt->relative==0) { + if (tdt->area != TRACK_AREA_POINT || tdt->relative == 0) { td2d->loc2d[0] = loc2d[0]; td2d->loc2d[1] = loc2d[1]; @@ -6054,7 +6054,7 @@ void flushTransTracking(TransInfo *t) /* * masking * */ typedef struct TransDataMasking { - int is_handle; + int is_handle; float handle[2], orig_handle[2]; float vec[3][3]; @@ -6081,8 +6081,8 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, * proportional editing to be consistent with the stretched CV coords * that are displayed. this also means that for display and numinput, * and when the the CV coords are flushed, these are converted each time */ - td2d->loc[0] = bezt->vec[i][0]*aspx; - td2d->loc[1] = bezt->vec[i][1]*aspy; + td2d->loc[0] = bezt->vec[i][0] * aspx; + td2d->loc[1] = bezt->vec[i][1] * aspy; td2d->loc[2] = 0.0f; td2d->loc2d = bezt->vec[i]; @@ -6108,7 +6108,7 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, if (is_sel_any) { td->flag |= TD_SELECTED; } - td->dist= 0.0; + td->dist = 0.0; unit_m3(td->mtx); unit_m3(td->smtx); @@ -6124,8 +6124,8 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, copy_v2_v2(tdm->orig_handle, tdm->handle); - td2d->loc[0] = tdm->handle[0]*aspx; - td2d->loc[1] = tdm->handle[1]*aspy; + td2d->loc[0] = tdm->handle[0] * aspx; + td2d->loc[1] = tdm->handle[1] * aspy; td2d->loc[2] = 0.0f; td2d->loc2d = tdm->handle; @@ -6137,14 +6137,14 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, memset(td->axismtx, 0, sizeof(td->axismtx)); td->axismtx[2][2] = 1.0f; - td->ext= NULL; - td->val= NULL; + td->ext = NULL; + td->val = NULL; if (is_sel_any) { td->flag |= TD_SELECTED; } - td->dist= 0.0; + td->dist = 0.0; unit_m3(td->mtx); unit_m3(td->smtx); @@ -6200,12 +6200,12 @@ static void createTransMaskingData(bContext *C, TransInfo *t) /* note: in prop mode we need at least 1 selected */ if (countsel == 0) return; - t->total = (propmode) ? count: countsel; - td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransObData(Mask Editing)"); + t->total = (propmode) ? count : countsel; + td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mask Editing)"); /* for each 2d uv coord a 3d vector is allocated, so that they can be * treated just as if they were 3d verts */ - td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(Mask Editing)"); - tdm = t->customData = MEM_callocN(t->total*sizeof(TransDataMasking), "TransDataMasking(Mask Editing)"); + td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransObData2D(Mask Editing)"); + tdm = t->customData = MEM_callocN(t->total * sizeof(TransDataMasking), "TransDataMasking(Mask Editing)"); t->flag |= T_FREE_CUSTOMDATA; @@ -6251,13 +6251,13 @@ void flushTransMasking(TransInfo *t) float aspx, aspy, invx, invy; ED_space_clip_mask_aspect(sc, &aspx, &aspy); - invx = 1.0f/aspx; - invy = 1.0f/aspy; + invx = 1.0f / aspx; + invy = 1.0f / aspy; /* flush to 2d vector from internally used 3d vector */ - for (a=0, td = t->data2d, tdm = t->customData; a<t->total; a++, td++, tdm++) { - td->loc2d[0]= td->loc[0]*invx; - td->loc2d[1]= td->loc[1]*invy; + for (a = 0, td = t->data2d, tdm = t->customData; a < t->total; a++, td++, tdm++) { + td->loc2d[0] = td->loc[0] * invx; + td->loc2d[1] = td->loc[1] * invy; if (tdm->is_handle) BKE_mask_point_set_handle(tdm->point, td->loc2d, t->flag & T_ALT_TRANSFORM, tdm->orig_handle, tdm->vec); @@ -6278,7 +6278,7 @@ void createTransData(bContext *C, TransInfo *t) t->flag |= T_EDIT; createTransEdge(t); if (t->data && t->flag & T_PROP_EDIT) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } @@ -6288,56 +6288,56 @@ void createTransData(bContext *C, TransInfo *t) //createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td); } else if (t->spacetype == SPACE_IMAGE) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; createTransUVs(C, t); if (t->data && (t->flag & T_PROP_EDIT)) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } } else if (t->spacetype == SPACE_ACTION) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; createTransActionData(C, t); } else if (t->spacetype == SPACE_NLA) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; createTransNlaData(C, t); } else if (t->spacetype == SPACE_SEQ) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point transformations */ createTransSeqData(C, t); } else if (t->spacetype == SPACE_IPO) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; createTransGraphEditData(C, t); #if 0 if (t->data && (t->flag & T_PROP_EDIT)) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } #endif } else if (t->spacetype == SPACE_NODE) { - t->flag |= T_2D_EDIT|T_POINTS; + t->flag |= T_2D_EDIT | T_POINTS; createTransNodeData(C, t); if (t->data && (t->flag & T_PROP_EDIT)) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } } else if (t->spacetype == SPACE_CLIP) { - t->flag |= T_POINTS|T_2D_EDIT; + t->flag |= T_POINTS | T_2D_EDIT; if (t->options & CTX_MOVIECLIP) createTransTrackingData(C, t); else if (t->options & CTX_MASK) { createTransMaskingData(C, t); if (t->data && (t->flag & T_PROP_EDIT)) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, TRUE); sort_trans_data_dist(t); } @@ -6351,13 +6351,13 @@ void createTransData(bContext *C, TransInfo *t) else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { createTransCurveVerts(C, t); } - else if (t->obedit->type==OB_LATTICE) { + else if (t->obedit->type == OB_LATTICE) { createTransLatticeVerts(t); } - else if (t->obedit->type==OB_MBALL) { + else if (t->obedit->type == OB_MBALL) { createTransMBallVerts(t); } - else if (t->obedit->type==OB_ARMATURE) { + else if (t->obedit->type == OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; createTransArmatureVerts(t); } @@ -6365,26 +6365,26 @@ void createTransData(bContext *C, TransInfo *t) printf("edit type not implemented!\n"); } - t->flag |= T_EDIT|T_POINTS; + t->flag |= T_EDIT | T_POINTS; if (t->data && t->flag & T_PROP_EDIT) { if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 0); sort_trans_data_dist(t); } else { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } } /* exception... hackish, we want bonesize to use bone orientation matrix (ton) */ - if (t->mode==TFM_BONESIZE) { - t->flag &= ~(T_EDIT|T_POINTS); + if (t->mode == TFM_BONESIZE) { + t->flag &= ~(T_EDIT | T_POINTS); t->flag |= T_POSE; - t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */ + t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */ } } else if (ob && (ob->mode & OB_MODE_POSE)) { @@ -6395,9 +6395,9 @@ void createTransData(bContext *C, TransInfo *t) else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { /* important that ob_armature can be set even when its not selected [#23412] * lines below just check is also visible */ - Object *ob_armature= modifiers_isDeformedByArmature(ob); + Object *ob_armature = modifiers_isDeformedByArmature(ob); if (ob_armature && ob_armature->mode & OB_MODE_POSE) { - Base *base_arm= BKE_scene_base_find(t->scene, ob_armature); + Base *base_arm = BKE_scene_base_find(t->scene, ob_armature); if (base_arm) { View3D *v3d = t->view; if (BASE_VISIBLE(v3d, base_arm)) { @@ -6412,12 +6412,12 @@ void createTransData(bContext *C, TransInfo *t) t->flag |= T_POINTS; if (t->data && t->flag & T_PROP_EDIT) { - sort_trans_data(t); // makes selected become first in array + sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); sort_trans_data_dist(t); } } - else if (ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_TEXTURE_PAINT))) { + else if (ob && (ob->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT))) { /* sculpt mode and project paint have own undo stack * transform ops redo clears sculpt/project undo stack. * @@ -6437,7 +6437,7 @@ void createTransData(bContext *C, TransInfo *t) if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { View3D *v3d = t->view; RegionView3D *rv3d = CTX_wm_region_view3d(C); - if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) { + if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp == RV3D_CAMOB) { t->flag |= T_CAMERA; } } @@ -6447,7 +6447,3 @@ void createTransData(bContext *C, TransInfo *t) // /* temporal...? */ // t->scene->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */ } - - - - diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 1b8cc14ecac..f21e0a0515d 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -140,13 +140,13 @@ void getViewVector(TransInfo *t, float coord[3], float vec[3]) static void clipMirrorModifier(TransInfo *t, Object *ob) { - ModifierData *md= ob->modifiers.first; + ModifierData *md = ob->modifiers.first; float tolerance[3] = {0.0f, 0.0f, 0.0f}; int axis = 0; - for (; md; md=md->next) { - if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) { - MirrorModifierData *mmd = (MirrorModifierData*) md; + for (; md; md = md->next) { + if ((md->type == eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) { + MirrorModifierData *mmd = (MirrorModifierData *) md; if (mmd->flag & MOD_MIR_CLIPPING) { axis = 0; @@ -175,13 +175,13 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) invert_m4_m4(imtx, mtx); } - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { int clip; float loc[3], iloc[3]; if (td->flag & TD_NOACTION) break; - if (td->loc==NULL) + if (td->loc == NULL) break; if (td->flag & TD_SKIP) @@ -197,27 +197,27 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) clip = 0; if (axis & 1) { - if (fabsf(iloc[0])<=tolerance[0] || - loc[0]*iloc[0]<0.0f) + if (fabsf(iloc[0]) <= tolerance[0] || + loc[0] * iloc[0] < 0.0f) { - loc[0]= 0.0f; + loc[0] = 0.0f; clip = 1; } } if (axis & 2) { if (fabsf(iloc[1]) <= tolerance[1] || - loc[1] * iloc[1]<0.0f) + loc[1] * iloc[1] < 0.0f) { - loc[1]= 0.0f; + loc[1] = 0.0f; clip = 1; } } if (axis & 4) { if (fabsf(iloc[2]) <= tolerance[2] || - loc[2] * iloc[2] < 0.0f) + loc[2] * iloc[2] < 0.0f) { - loc[2]= 0.0f; + loc[2] = 0.0f; clip = 1; } } @@ -242,19 +242,19 @@ static void editbmesh_apply_to_mirror(TransInfo *t) BMVert *eve; int i; - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) break; - if (td->loc==NULL) + if (td->loc == NULL) break; if (td->flag & TD_SKIP) continue; eve = td->extra; if (eve) { - eve->co[0]= -td->loc[0]; - eve->co[1]= td->loc[1]; - eve->co[2]= td->loc[2]; + eve->co[0] = -td->loc[0]; + eve->co[1] = td->loc[1]; + eve->co[2] = td->loc[2]; } if (td->flag & TD_MIRROR_EDGE) { @@ -264,23 +264,23 @@ static void editbmesh_apply_to_mirror(TransInfo *t) } /* 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) { - ScreenAnimData *sad= (animtimer) ? animtimer->customdata : NULL; + ScreenAnimData *sad = (animtimer) ? animtimer->customdata : NULL; /* sanity checks */ if (ELEM3(NULL, scene, id, sad)) return; /* check if we need a new strip if: - * - if animtimer is running + * - if animtimer is running * - we're not only keying for available channels * - the option to add new actions for each round is not enabled */ - if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) { + if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL) == 0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) { /* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */ if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) { - AnimData *adt= BKE_animdata_from_id(id); + AnimData *adt = BKE_animdata_from_id(id); /* perform push-down manually with some differences * NOTE: BKE_nla_action_pushdown() sync warning... @@ -290,21 +290,21 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer) /* only push down if action is more than 1-2 frames long */ calc_action_range(adt->action, &astart, &aend, 1); - if (aend > astart+2.0f) { - NlaStrip *strip= add_nlastrip_to_stack(adt, adt->action); + if (aend > astart + 2.0f) { + NlaStrip *strip = add_nlastrip_to_stack(adt, adt->action); /* clear reference to action now that we've pushed it onto the stack */ adt->action->id.us--; - adt->action= NULL; + adt->action = NULL; /* adjust blending + extend so that they will behave correctly */ - strip->extendmode= NLASTRIP_EXTEND_NOTHING; - strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE); + strip->extendmode = NLASTRIP_EXTEND_NOTHING; + strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE); /* also, adjust the AnimData's action extend mode to be on * 'nothing' so that previous result still play */ - adt->act_extendmode= NLASTRIP_EXTEND_NOTHING; + adt->act_extendmode = NLASTRIP_EXTEND_NOTHING; } } } @@ -313,13 +313,13 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer) static int fcu_test_selected(FCurve *fcu) { - BezTriple *bezt= fcu->bezt; + BezTriple *bezt = fcu->bezt; unsigned int i; - if (bezt==NULL) /* ignore baked */ + if (bezt == NULL) /* ignore baked */ return 0; - for (i=0; i < fcu->totvert; i++, bezt++) { + for (i = 0; i < fcu->totvert; i++, bezt++) { if (BEZSELECTED(bezt)) return 1; } @@ -329,23 +329,23 @@ static int fcu_test_selected(FCurve *fcu) /* helper for recalcData() - for Action Editor transforms */ static void recalcData_actedit(TransInfo *t) { - Scene *scene= t->scene; - SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; + Scene *scene = t->scene; + SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; - bAnimContext ac= {NULL}; + bAnimContext ac = {NULL}; ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* initialize relevant anim-context 'context' data from TransInfo data */ - /* NOTE: sync this with the code in ANIM_animdata_get_context() */ - ac.scene= t->scene; - ac.obact= OBACT; - ac.sa= t->sa; - ac.ar= t->ar; - ac.sl= (t->sa)? t->sa->spacedata.first : NULL; - ac.spacetype= (t->sa)? t->sa->spacetype : 0; - ac.regiontype= (t->ar)? t->ar->regiontype : 0; + /* NOTE: sync this with the code in ANIM_animdata_get_context() */ + ac.scene = t->scene; + ac.obact = OBACT; + ac.sa = t->sa; + ac.ar = t->ar; + ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; + ac.spacetype = (t->sa) ? t->sa->spacetype : 0; + ac.regiontype = (t->ar) ? t->ar->regiontype : 0; ANIM_animdata_context_getdata(&ac); @@ -356,14 +356,14 @@ static void recalcData_actedit(TransInfo *t) } else { /* 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); /* just tag these animdata-blocks to recalc, assuming that some data there changed * BUT only do this if realtime updates are enabled */ if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) { - for (ale= anim_data.first; ale; ale= ale->next) { + for (ale = anim_data.first; ale; ale = ale->next) { /* set refresh tags for objects using this animation */ ANIM_list_elem_update(t->scene, ale); } @@ -376,11 +376,11 @@ static void recalcData_actedit(TransInfo *t) /* helper for recalcData() - for Graph Editor transforms */ static void recalcData_graphedit(TransInfo *t) { - SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; + SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; Scene *scene; ListBase anim_data = {NULL, NULL}; - bAnimContext ac= {NULL}; + bAnimContext ac = {NULL}; int filter; bAnimListElem *ale; @@ -388,14 +388,14 @@ static void recalcData_graphedit(TransInfo *t) /* initialize relevant anim-context 'context' data from TransInfo data */ - /* NOTE: sync this with the code in ANIM_animdata_get_context() */ - scene= ac.scene= t->scene; - ac.obact= OBACT; - ac.sa= t->sa; - ac.ar= t->ar; - ac.sl= (t->sa)? t->sa->spacedata.first : NULL; - ac.spacetype= (t->sa)? t->sa->spacetype : 0; - ac.regiontype= (t->ar)? t->ar->regiontype : 0; + /* NOTE: sync this with the code in ANIM_animdata_get_context() */ + scene = ac.scene = t->scene; + ac.obact = OBACT; + ac.sa = t->sa; + ac.ar = t->ar; + ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; + ac.spacetype = (t->sa) ? t->sa->spacetype : 0; + ac.regiontype = (t->ar) ? t->ar->regiontype : 0; ANIM_animdata_context_getdata(&ac); @@ -403,19 +403,19 @@ static void recalcData_graphedit(TransInfo *t) flushTransGraphData(t); /* get curves to check if a re-sort is needed */ - filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* now test if there is a need to re-sort */ - for (ale= anim_data.first; ale; ale= ale->next) { - FCurve *fcu= (FCurve *)ale->key_data; + for (ale = anim_data.first; ale; ale = ale->next) { + FCurve *fcu = (FCurve *)ale->key_data; /* ignore unselected fcurves */ if (!fcu_test_selected(fcu)) continue; // fixme: only do this for selected verts... - ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS|ANIM_UNITCONV_RESTORE); + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE); /* watch it: if the time is wrong: do not correct handles yet */ @@ -441,10 +441,10 @@ static void recalcData_graphedit(TransInfo *t) /* helper for recalcData() - for NLA Editor transforms */ static void recalcData_nla(TransInfo *t) { - TransDataNla *tdn= (TransDataNla *)t->customData; - SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first; - Scene *scene= t->scene; - double secf= FPS; + TransDataNla *tdn = (TransDataNla *)t->customData; + SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first; + Scene *scene = t->scene; + double secf = FPS; int i; /* for each strip we've got, perform some additional validation of the values that got set before @@ -452,7 +452,7 @@ static void recalcData_nla(TransInfo *t) * sure that everything works ok) */ for (i = 0; i < t->total; i++, tdn++) { - NlaStrip *strip= tdn->strip; + NlaStrip *strip = tdn->strip; PointerRNA strip_ptr; short pExceeded, nExceeded, iter; int delta_y1, delta_y2; @@ -474,16 +474,16 @@ static void recalcData_nla(TransInfo *t) */ /* start */ - strip->start= tdn->h1[0]; + strip->start = tdn->h1[0]; if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION)) - strip->prev->end= tdn->h1[0]; + strip->prev->end = tdn->h1[0]; /* end */ - strip->end= tdn->h2[0]; + strip->end = tdn->h2[0]; if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION)) - strip->next->start= tdn->h2[0]; + strip->next->start = tdn->h2[0]; /* flush transforms to child strips (since this should be a meta) */ BKE_nlameta_flush_transforms(strip); @@ -503,9 +503,9 @@ static void recalcData_nla(TransInfo *t) * * this is done as a iterative procedure (done 5 times max for now) */ - for (iter=0; iter < 5; iter++) { - pExceeded= ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end)); - nExceeded= ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start)); + for (iter = 0; iter < 5; iter++) { + pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end)); + nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start)); if ((pExceeded && nExceeded) || (iter == 4) ) { /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise) @@ -513,24 +513,24 @@ static void recalcData_nla(TransInfo *t) * - if there were no neighbors, clear the transforms (make it default to the strip's current values) */ if (strip->prev && strip->next) { - tdn->h1[0]= strip->prev->end; - tdn->h2[0]= strip->next->start; + tdn->h1[0] = strip->prev->end; + tdn->h2[0] = strip->next->start; } else { - tdn->h1[0]= strip->start; - tdn->h2[0]= strip->end; + tdn->h1[0] = strip->start; + tdn->h2[0] = strip->end; } } else if (nExceeded) { /* move backwards */ - float offset= tdn->h2[0] - strip->next->start; + float offset = tdn->h2[0] - strip->next->start; tdn->h1[0] -= offset; tdn->h2[0] -= offset; } else if (pExceeded) { /* more forwards */ - float offset= strip->prev->end - tdn->h1[0]; + float offset = strip->prev->end - tdn->h1[0]; tdn->h1[0] += offset; tdn->h2[0] += offset; @@ -553,8 +553,8 @@ static void recalcData_nla(TransInfo *t) break; case SACTSNAP_MARKER: /* snap to nearest marker */ - tdn->h1[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]); - tdn->h2[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]); + tdn->h1[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]); + tdn->h2[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]); break; } @@ -572,8 +572,8 @@ static void recalcData_nla(TransInfo *t) /* now, check if we need to try and move track * - we need to calculate both, as only one may have been altered by transform if only 1 handle moved */ - delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); - delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); + delta_y1 = ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); + delta_y2 = ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); if (delta_y1 || delta_y2) { NlaTrack *track; @@ -584,14 +584,14 @@ static void recalcData_nla(TransInfo *t) * stopping on the last track available or that we're able to fit in */ if (delta > 0) { - for (track=tdn->nlt->next, n=0; (track) && (n < delta); track=track->next, n++) { + for (track = tdn->nlt->next, n = 0; (track) && (n < delta); track = track->next, n++) { /* check if space in this track for the strip */ if (BKE_nlatrack_has_space(track, strip->start, strip->end)) { /* move strip to this track */ BLI_remlink(&tdn->nlt->strips, strip); BKE_nlatrack_add_strip(track, strip); - tdn->nlt= track; + tdn->nlt = track; tdn->trackIndex++; } else /* can't move any further */ @@ -600,16 +600,16 @@ static void recalcData_nla(TransInfo *t) } else { /* make delta 'positive' before using it, since we now know to go backwards */ - delta= -delta; + delta = -delta; - for (track=tdn->nlt->prev, n=0; (track) && (n < delta); track=track->prev, n++) { + for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) { /* check if space in this track for the strip */ if (BKE_nlatrack_has_space(track, strip->start, strip->end)) { /* move strip to this track */ BLI_remlink(&tdn->nlt->strips, strip); BKE_nlatrack_add_strip(track, strip); - tdn->nlt= track; + tdn->nlt = track; tdn->trackIndex--; } else /* can't move any further */ @@ -624,7 +624,7 @@ static void recalcData_nla(TransInfo *t) static void recalcData_image(TransInfo *t) { if (t->obedit && t->obedit->type == OB_MESH) { - SpaceImage *sima= t->sa->spacedata.first; + SpaceImage *sima = t->sa->spacedata.first; flushTransUVs(t); if (sima->flag & SI_LIVE_UNWRAP) @@ -649,7 +649,7 @@ static void recalcData_spaceclip(TransInfo *t) track = tracksbase->first; while (track) { - if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) { + if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr); if (t->mode == TFM_TRANSLATION) { @@ -691,9 +691,9 @@ static void recalcData_view3d(TransInfo *t) if (t->obedit) { if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { - Curve *cu= t->obedit->data; - ListBase *nurbs= BKE_curve_editNurbs_get(cu); - Nurb *nu= nurbs->first; + Curve *cu = t->obedit->data; + ListBase *nurbs = BKE_curve_editNurbs_get(cu); + Nurb *nu = nurbs->first; if (t->state != TRANS_CANCEL) { clipMirrorModifier(t, t->obedit); @@ -705,7 +705,7 @@ static void recalcData_view3d(TransInfo *t) if (t->state == TRANS_CANCEL) { while (nu) { BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */ - nu= nu->next; + nu = nu->next; } } else { @@ -713,12 +713,12 @@ static void recalcData_view3d(TransInfo *t) while (nu) { BKE_nurb_test2D(nu); BKE_nurb_handles_calc(nu); - nu= nu->next; + nu = nu->next; } } } - else if (t->obedit->type==OB_LATTICE) { - Lattice *la= t->obedit->data; + else if (t->obedit->type == OB_LATTICE) { + Lattice *la = t->obedit->data; if (t->state != TRANS_CANCEL) { applyProject(t); @@ -744,8 +744,8 @@ static void recalcData_view3d(TransInfo *t) EDBM_mesh_normals_update(em); BMEdit_RecalcTessellation(em); } - else if (t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */ - bArmature *arm= t->obedit->data; + else if (t->obedit->type == OB_ARMATURE) { /* no recalc flag, does pose */ + bArmature *arm = t->obedit->data; ListBase *edbo = arm->edbo; EditBone *ebo; TransData *td = t->data; @@ -761,33 +761,33 @@ static void recalcData_view3d(TransInfo *t) if ((ebo->flag & BONE_CONNECTED) && ebo->parent) { /* If this bone has a parent tip that has been moved */ if (ebo->parent->flag & BONE_TIPSEL) { - copy_v3_v3 (ebo->head, ebo->parent->tail); - if (t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail; + copy_v3_v3(ebo->head, ebo->parent->tail); + if (t->mode == TFM_BONE_ENVELOPE) ebo->rad_head = ebo->parent->rad_tail; } /* If this bone has a parent tip that has NOT been moved */ else { - copy_v3_v3 (ebo->parent->tail, ebo->head); - if (t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head; + copy_v3_v3(ebo->parent->tail, ebo->head); + if (t->mode == TFM_BONE_ENVELOPE) ebo->parent->rad_tail = ebo->rad_head; } } /* on extrude bones, oldlength==0.0f, so we scale radius of points */ - ebo->length= len_v3v3(ebo->head, ebo->tail); - if (ebo->oldlength==0.0f) { - ebo->rad_head= 0.25f*ebo->length; - ebo->rad_tail= 0.10f*ebo->length; - ebo->dist= 0.25f*ebo->length; + ebo->length = len_v3v3(ebo->head, ebo->tail); + if (ebo->oldlength == 0.0f) { + ebo->rad_head = 0.25f * ebo->length; + ebo->rad_tail = 0.10f * ebo->length; + ebo->dist = 0.25f * ebo->length; if (ebo->parent) { if (ebo->rad_head > ebo->parent->rad_tail) - ebo->rad_head= ebo->parent->rad_tail; + ebo->rad_head = ebo->parent->rad_tail; } } - else if (t->mode!=TFM_BONE_ENVELOPE) { + else if (t->mode != TFM_BONE_ENVELOPE) { /* if bones change length, lets do that for the deform distance as well */ - ebo->dist*= ebo->length/ebo->oldlength; - ebo->rad_head*= ebo->length/ebo->oldlength; - ebo->rad_tail*= ebo->length/ebo->oldlength; - ebo->oldlength= ebo->length; + ebo->dist *= ebo->length / ebo->oldlength; + ebo->rad_head *= ebo->length / ebo->oldlength; + ebo->rad_tail *= ebo->length / ebo->oldlength; + ebo->oldlength = ebo->length; } } @@ -829,8 +829,8 @@ static void recalcData_view3d(TransInfo *t) } } else if ( (t->flag & T_POSE) && t->poseobj) { - Object *ob= t->poseobj; - bArmature *arm= ob->data; + Object *ob = t->poseobj; + bArmature *arm = ob->data; /* if animtimer is running, and the object already has animation data, * check if the auto-record feature means that we should record 'samples' @@ -840,7 +840,7 @@ static void recalcData_view3d(TransInfo *t) */ // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes? if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) { - int targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet! + int targetless_ik = (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet! animrecord_check_state(t->scene, &ob->id, t->animtimer); autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik); @@ -897,10 +897,10 @@ static void recalcData_view3d(TransInfo *t) /* called for updating while transform acts, once per redraw */ void recalcData(TransInfo *t) { - if (t->spacetype==SPACE_NODE) { + if (t->spacetype == SPACE_NODE) { flushTransNodes(t); } - else if (t->spacetype==SPACE_SEQ) { + else if (t->spacetype == SPACE_SEQ) { flushTransSeq(t); } else if (t->spacetype == SPACE_ACTION) { @@ -953,8 +953,8 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) setlinestyle(0); glBegin(GL_LINE_STRIP); - glVertex3fv(v1); - glVertex3fv(v2); + glVertex3fv(v1); + glVertex3fv(v2); glEnd(); glPopMatrix(); @@ -1011,20 +1011,20 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->mval[0] = t->imval[0]; t->mval[1] = t->imval[1]; - t->transform = NULL; - t->handleEvent = NULL; + t->transform = NULL; + t->handleEvent = NULL; - t->total = 0; + t->total = 0; t->val = 0.0f; - t->vec[0] = - t->vec[1] = - t->vec[2] = 0.0f; - - t->center[0] = - t->center[1] = - t->center[2] = 0.0f; + t->vec[0] = + t->vec[1] = + t->vec[2] = 0.0f; + + t->center[0] = + t->center[1] = + t->center[2] = 0.0f; unit_m3(t->mat); @@ -1042,15 +1042,15 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* Assign the space type, some exceptions for running in different mode */ if (sa == NULL) { /* background mode */ - t->spacetype= SPACE_EMPTY; + t->spacetype = SPACE_EMPTY; } else if ((ar == NULL) && (sa->spacetype == SPACE_VIEW3D)) { /* running in the text editor */ - t->spacetype= SPACE_EMPTY; + t->spacetype = SPACE_EMPTY; } else { /* normal operation */ - t->spacetype= sa->spacetype; + t->spacetype = sa->spacetype; } @@ -1059,7 +1059,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C)); t->view = v3d; - t->animtimer= (animscreen)? animscreen->animtimer: NULL; + t->animtimer = (animscreen) ? animscreen->animtimer : NULL; /* turn manipulator off during transform */ // FIXME: but don't do this when USING the manipulator... @@ -1085,7 +1085,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } /* exceptional case */ - if (t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { + if (t->around == V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) { t->options |= CTX_NO_PET; } @@ -1107,23 +1107,23 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - else if (t->spacetype==SPACE_IMAGE) { + else if (t->spacetype == SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; // XXX for now, get View2D from the active region t->view = &ar->v2d; t->around = sima->around; } - else if (t->spacetype==SPACE_NODE) { + else if (t->spacetype == SPACE_NODE) { // XXX for now, get View2D from the active region t->view = &ar->v2d; t->around = V3D_CENTER; } - else if (t->spacetype==SPACE_IPO) { - SpaceIpo *sipo= sa->spacedata.first; + else if (t->spacetype == SPACE_IPO) { + SpaceIpo *sipo = sa->spacedata.first; t->view = &ar->v2d; t->around = sipo->around; } - else if (t->spacetype==SPACE_CLIP) { + else if (t->spacetype == SPACE_CLIP) { SpaceClip *sclip = sa->spacedata.first; t->view = &ar->v2d; t->around = sclip->around; @@ -1140,7 +1140,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) // XXX for now, the center point is the midpoint of the data } else { - t->view= NULL; + t->view = NULL; } t->around = V3D_CENTER; } @@ -1277,7 +1277,7 @@ void postTrans(bContext *C, TransInfo *t) int a; /* free data malloced per trans-data */ - for (a=0, td= t->data; a<t->total; a++, td++) { + for (a = 0, td = t->data; a < t->total; a++, td++) { if (td->flag & TD_BEZTRIPLE) MEM_freeN(td->hdata); } @@ -1289,15 +1289,15 @@ void postTrans(bContext *C, TransInfo *t) if (t->ext) MEM_freeN(t->ext); if (t->data2d) { MEM_freeN(t->data2d); - t->data2d= NULL; + t->data2d = NULL; } - if (t->spacetype==SPACE_IMAGE) { - SpaceImage *sima= t->sa->spacedata.first; + if (t->spacetype == SPACE_IMAGE) { + SpaceImage *sima = t->sa->spacedata.first; if (sima->flag & SI_LIVE_UNWRAP) ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL); } - else if (t->spacetype==SPACE_VIEW3D) { + else if (t->spacetype == SPACE_VIEW3D) { View3D *v3d = t->sa->spacedata.first; /* restore manipulator */ if (t->flag & T_MODAL) { @@ -1336,12 +1336,12 @@ static void restoreElement(TransData *td) *td->val = td->ival; } - if (td->ext && (td->flag&TD_NO_EXT)==0) { + if (td->ext && (td->flag & TD_NO_EXT) == 0) { if (td->ext->rot) { copy_v3_v3(td->ext->rot, td->ext->irot); } if (td->ext->rotAngle) { - *td->ext->rotAngle= td->ext->irotAngle; + *td->ext->rotAngle = td->ext->irotAngle; } if (td->ext->rotAxis) { copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis); @@ -1370,7 +1370,7 @@ void restoreTransObjects(TransInfo *t) restoreElement(td); } - for (td2d=t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) { + for (td2d = t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) { if (td2d->h1) { td2d->h1[0] = td2d->ih1[0]; td2d->h1[1] = td2d->ih1[1]; @@ -1388,8 +1388,8 @@ void restoreTransObjects(TransInfo *t) void calculateCenter2D(TransInfo *t) { - if (t->flag & (T_EDIT|T_POSE)) { - Object *ob= t->obedit?t->obedit:t->poseobj; + if (t->flag & (T_EDIT | T_POSE)) { + Object *ob = t->obedit ? t->obedit : t->poseobj; float vec[3]; copy_v3_v3(vec, t->center); @@ -1409,8 +1409,8 @@ void calculateCenterCursor(TransInfo *t) copy_v3_v3(t->center, cursor); /* If edit or pose mode, move cursor in local space */ - if (t->flag & (T_EDIT|T_POSE)) { - Object *ob = t->obedit?t->obedit:t->poseobj; + if (t->flag & (T_EDIT | T_POSE)) { + Object *ob = t->obedit ? t->obedit : t->poseobj; float mat[3][3], imat[3][3]; sub_v3_v3v3(t->center, t->center, ob->obmat[3]); @@ -1424,11 +1424,11 @@ void calculateCenterCursor(TransInfo *t) void calculateCenterCursor2D(TransInfo *t) { - float aspx=1.0, aspy=1.0; - float *cursor= NULL; + float aspx = 1.0, aspy = 1.0; + float *cursor = NULL; - if (t->spacetype==SPACE_IMAGE) { - SpaceImage *sima= (SpaceImage *)t->sa->spacedata.first; + if (t->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; /* only space supported right now but may change */ ED_space_image_uv_aspect(sima, &aspx, &aspy); cursor = sima->cursor; @@ -1444,12 +1444,12 @@ void calculateCenterCursor2D(TransInfo *t) static void calculateCenterCursorGraph2D(TransInfo *t) { - SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first; - Scene *scene= t->scene; + SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first; + Scene *scene = t->scene; /* cursor is combination of current frame, and graph-editor cursor value */ - t->center[0]= (float)(scene->r.cfra); - t->center[1]= sipo->cursorVal; + t->center[0] = (float)(scene->r.cfra); + t->center[1] = sipo->cursorVal; calculateCenter2D(t); } @@ -1515,95 +1515,95 @@ void calculateCenterBound(TransInfo *t) void calculateCenter(TransInfo *t) { switch (t->around) { - case V3D_CENTER: - calculateCenterBound(t); - break; - case V3D_CENTROID: - calculateCenterMedian(t); - break; - case V3D_CURSOR: - if (t->spacetype==SPACE_IMAGE) - calculateCenterCursor2D(t); - else if (t->spacetype==SPACE_IPO) - calculateCenterCursorGraph2D(t); - else - calculateCenterCursor(t); - break; - case V3D_LOCAL: - /* Individual element center uses median center for helpline and such */ - calculateCenterMedian(t); - break; - case V3D_ACTIVE: + case V3D_CENTER: + calculateCenterBound(t); + break; + case V3D_CENTROID: + calculateCenterMedian(t); + break; + case V3D_CURSOR: + if (t->spacetype == SPACE_IMAGE) + calculateCenterCursor2D(t); + else if (t->spacetype == SPACE_IPO) + calculateCenterCursorGraph2D(t); + else + calculateCenterCursor(t); + break; + case V3D_LOCAL: + /* Individual element center uses median center for helpline and such */ + calculateCenterMedian(t); + break; + case V3D_ACTIVE: { - /* set median, and if if if... do object center */ + /* set median, and if if if... do object center */ - /* EDIT MODE ACTIVE EDITMODE ELEMENT */ + /* EDIT MODE ACTIVE EDITMODE ELEMENT */ - if (t->obedit) { - if (t->obedit && t->obedit->type == OB_MESH) { - BMEditSelection ese; - BMEditMesh *em = BMEdit_FromObject(t->obedit); + if (t->obedit) { + if (t->obedit && t->obedit->type == OB_MESH) { + BMEditSelection ese; + BMEditMesh *em = BMEdit_FromObject(t->obedit); - if (BM_select_history_active_get(em->bm, &ese)) { - BM_editselection_center(&ese, t->center); - calculateCenter2D(t); - break; + if (BM_select_history_active_get(em->bm, &ese)) { + BM_editselection_center(&ese, t->center); + calculateCenter2D(t); + break; + } } - } - else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { - float center[3]; - Curve *cu= (Curve *)t->obedit->data; + else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { + float center[3]; + Curve *cu = (Curve *)t->obedit->data; - if (ED_curve_actSelection(cu, center)) { - copy_v3_v3(t->center, center); - calculateCenter2D(t); - break; + if (ED_curve_actSelection(cu, center)) { + copy_v3_v3(t->center, center); + calculateCenter2D(t); + break; + } + } + } /* END EDIT MODE ACTIVE ELEMENT */ + + calculateCenterMedian(t); + if ((t->flag & (T_EDIT | T_POSE)) == 0) { + Scene *scene = t->scene; + Object *ob = OBACT; + if (ob) { + copy_v3_v3(t->center, ob->obmat[3]); + projectIntView(t, t->center, t->center2d); } } - } /* END EDIT MODE ACTIVE ELEMENT */ - - calculateCenterMedian(t); - if ((t->flag & (T_EDIT|T_POSE))==0) { - Scene *scene = t->scene; - Object *ob= OBACT; - if (ob) { - copy_v3_v3(t->center, ob->obmat[3]); - projectIntView(t, t->center, t->center2d); - } - } } } /* setting constraint center */ copy_v3_v3(t->con.center, t->center); - if (t->flag & (T_EDIT|T_POSE)) { - Object *ob= t->obedit?t->obedit:t->poseobj; + if (t->flag & (T_EDIT | T_POSE)) { + Object *ob = t->obedit ? t->obedit : t->poseobj; mul_m4_v3(ob->obmat, t->con.center); } /* for panning from cameraview */ if (t->flag & T_OBJECT) { - if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { + if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { View3D *v3d = t->view; Scene *scene = t->scene; RegionView3D *rv3d = t->ar->regiondata; - if (v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) { + if (v3d->camera == OBACT && rv3d->persp == RV3D_CAMOB) { float axis[3]; /* persinv is nasty, use viewinv instead, always right */ copy_v3_v3(axis, t->viewinv[2]); normalize_v3(axis); /* 6.0 = 6 grid units */ - axis[0]= t->center[0]- 6.0f*axis[0]; - axis[1]= t->center[1]- 6.0f*axis[1]; - axis[2]= t->center[2]- 6.0f*axis[2]; + axis[0] = t->center[0] - 6.0f * axis[0]; + axis[1] = t->center[1] - 6.0f * axis[1]; + axis[2] = t->center[2] - 6.0f * axis[2]; projectIntView(t, axis, t->center2d); /* rotate only needs correct 2d center, grab needs initgrabz() value */ - if (t->mode==TFM_TRANSLATION) { + if (t->mode == TFM_TRANSLATION) { copy_v3_v3(t->center, axis); copy_v3_v3(t->con.center, t->center); } @@ -1611,10 +1611,10 @@ void calculateCenter(TransInfo *t) } } - if (t->spacetype==SPACE_VIEW3D) { + if (t->spacetype == SPACE_VIEW3D) { /* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */ - if (t->flag & (T_EDIT|T_POSE)) { - Object *ob= t->obedit?t->obedit:t->poseobj; + if (t->flag & (T_EDIT | T_POSE)) { + Object *ob = t->obedit ? t->obedit : t->poseobj; float vec[3]; copy_v3_v3(vec, t->center); @@ -1635,7 +1635,7 @@ void calculatePropRatio(TransInfo *t) short connected = t->flag & T_PROP_CONNECTED; if (t->flag & T_PROP_EDIT) { - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_SELECTED) { td->factor = 1.0f; } @@ -1660,9 +1660,9 @@ void calculatePropRatio(TransInfo *t) td->flag &= ~TD_NOACTION; if (connected) - dist= (t->prop_size-td->dist)/t->prop_size; + dist = (t->prop_size - td->dist) / t->prop_size; else - dist= (t->prop_size-td->rdist)/t->prop_size; + dist = (t->prop_size - td->rdist) / t->prop_size; /* * Clamp to positive numbers. @@ -1673,63 +1673,63 @@ void calculatePropRatio(TransInfo *t) dist = 0.0f; switch (t->prop_mode) { - case PROP_SHARP: - td->factor= dist*dist; - break; - case PROP_SMOOTH: - td->factor= 3.0f*dist*dist - 2.0f*dist*dist*dist; - break; - case PROP_ROOT: - td->factor = (float)sqrt(dist); - break; - case PROP_LIN: - td->factor = dist; - break; - case PROP_CONST: - td->factor = 1.0f; - break; - case PROP_SPHERE: - td->factor = (float)sqrt(2*dist - dist * dist); - break; - case PROP_RANDOM: - BLI_srand(BLI_rand()); /* random seed */ - td->factor = BLI_frand()*dist; - break; - default: - td->factor = 1; + case PROP_SHARP: + td->factor = dist * dist; + break; + case PROP_SMOOTH: + td->factor = 3.0f * dist * dist - 2.0f * dist * dist * dist; + break; + case PROP_ROOT: + td->factor = (float)sqrt(dist); + break; + case PROP_LIN: + td->factor = dist; + break; + case PROP_CONST: + td->factor = 1.0f; + break; + case PROP_SPHERE: + td->factor = (float)sqrt(2 * dist - dist * dist); + break; + case PROP_RANDOM: + BLI_srand(BLI_rand()); /* random seed */ + td->factor = BLI_frand() * dist; + break; + default: + td->factor = 1; } } } switch (t->prop_mode) { - case PROP_SHARP: - strcpy(t->proptext, "(Sharp)"); - break; - case PROP_SMOOTH: - strcpy(t->proptext, "(Smooth)"); - break; - case PROP_ROOT: - strcpy(t->proptext, "(Root)"); - break; - case PROP_LIN: - strcpy(t->proptext, "(Linear)"); - break; - case PROP_CONST: - strcpy(t->proptext, "(Constant)"); - break; - case PROP_SPHERE: - strcpy(t->proptext, "(Sphere)"); - break; - case PROP_RANDOM: - strcpy(t->proptext, "(Random)"); - break; - default: - t->proptext[0]= '\0'; + case PROP_SHARP: + strcpy(t->proptext, "(Sharp)"); + break; + case PROP_SMOOTH: + strcpy(t->proptext, "(Smooth)"); + break; + case PROP_ROOT: + strcpy(t->proptext, "(Root)"); + break; + case PROP_LIN: + strcpy(t->proptext, "(Linear)"); + break; + case PROP_CONST: + strcpy(t->proptext, "(Constant)"); + break; + case PROP_SPHERE: + strcpy(t->proptext, "(Sphere)"); + break; + case PROP_RANDOM: + strcpy(t->proptext, "(Random)"); + break; + default: + t->proptext[0] = '\0'; } } else { - for (i = 0 ; i < t->total; i++, td++) { + for (i = 0; i < t->total; i++, td++) { td->factor = 1.0; } - t->proptext[0]= '\0'; + t->proptext[0] = '\0'; } } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 52b32ae66fc..f00e2418ad9 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -53,8 +53,8 @@ typedef struct TransformModeItem { char *idname; - int mode; - void (*opfunc)(wmOperatorType*); + int mode; + void (*opfunc)(wmOperatorType *); } TransformModeItem; static float VecOne[3] = {1, 1, 1}; @@ -151,11 +151,11 @@ EnumPropertyItem transform_mode_types[] = static int snap_type_exec(bContext *C, wmOperator *op) { - ToolSettings *ts= CTX_data_tool_settings(C); + ToolSettings *ts = CTX_data_tool_settings(C); ts->snap_mode = RNA_enum_get(op->ptr, "type"); - WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ return OPERATOR_FINISHED; } @@ -187,7 +187,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op) BIF_selectTransformOrientationValue(C, orientation); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; } @@ -197,8 +197,8 @@ static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEven uiPopupMenu *pup; uiLayout *layout; - pup= uiPupMenuBegin(C, "Orientation", ICON_NONE); - layout= uiPupMenuLayout(pup); + pup = uiPupMenuBegin(C, "Orientation", ICON_NONE); + layout = uiPupMenuLayout(pup); uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation"); uiPupMenuEnd(C, pup); @@ -220,7 +220,7 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) ot->exec = select_orientation_exec; ot->poll = ED_operator_view3d_active; - prop= RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE); RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); } @@ -233,8 +233,8 @@ static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) BIF_removeTransformOrientationIndex(C, selected_index); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); - WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C)); return OPERATOR_FINISHED; } @@ -284,8 +284,8 @@ static int create_orientation_exec(bContext *C, wmOperator *op) BIF_createTransformOrientation(C, op->reports, name, use, overwrite); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); - WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C)); return OPERATOR_FINISHED; } @@ -301,13 +301,13 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot) ot->name = "Create Orientation"; ot->description = "Create transformation orientation from selection"; ot->idname = "TRANSFORM_OT_create_orientation"; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* api callbacks */ ot->invoke = create_orientation_invoke; ot->exec = create_orientation_exec; ot->poll = ED_operator_areaactive; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Text to insert at the cursor position"); RNA_def_boolean(ot->srna, "use", 0, "Use after creation", "Select orientation after its creation"); @@ -372,9 +372,9 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event) #endif /* XXX insert keys are called here, and require context */ - t->context= C; + t->context = C; exit_code = transformEvent(t, event); - t->context= NULL; + t->context = NULL; transformApply(C, t); @@ -418,7 +418,7 @@ static int transform_exec(bContext *C, wmOperator *op) transformops_exit(C, op); - WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -447,7 +447,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) PropertyRNA *prop; if (flags & P_AXIS) { - prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION); + prop = RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_array(prop, 3); /* Make this not hidden when there's a nice axis selection widget */ RNA_def_property_flag(prop, PROP_HIDDEN); @@ -457,7 +457,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) if (flags & P_CONSTRAINT) { RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", ""); - prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE); RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); @@ -476,19 +476,19 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } if (flags & P_SNAP) { - prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", ""); + prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", ""); RNA_def_property_flag(prop, PROP_HIDDEN); if (flags & P_GEO_SNAP) { - prop= RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", ""); + prop = RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX); + prop = RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN); if (flags & P_ALIGN_SNAP) { - prop= RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", ""); + prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", ""); RNA_def_property_flag(prop, PROP_HIDDEN); - prop= RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX); + prop = RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN); } } @@ -513,7 +513,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot) ot->name = "Translate"; ot->description = "Translate (move) selected items"; ot->idname = OP_TRANSLATION; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -524,7 +524,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot) RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP|P_OPTIONS); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS); } static void TRANSFORM_OT_resize(struct wmOperatorType *ot) @@ -533,7 +533,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot) ot->name = "Resize"; ot->description = "Scale (resize) selected items"; ot->idname = OP_RESIZE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -544,7 +544,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS); } static int skin_resize_poll(bContext *C) @@ -563,7 +563,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot) ot->name = "Skin Resize"; ot->description = "Scale selected vertices' skin radii"; ot->idname = OP_SKIN_RESIZE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -574,7 +574,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS); } static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) @@ -583,7 +583,7 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) ot->name = "Trackball"; ot->description = "Trackball style rotation of selected items"; ot->idname = OP_TRACKBALL; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -594,7 +594,7 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) @@ -603,7 +603,7 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) ot->name = "Rotate"; ot->description = "Rotate selected items"; ot->idname = OP_ROTATION; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -612,9 +612,9 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; - RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2); + RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); - Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP); + Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP); } static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) @@ -626,7 +626,7 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) * "Specify an extra axis rotation for selected vertices of 3d curve" */ ot->description = "Tilt selected control vertices of 3d curve"; ot->idname = OP_TILT; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -635,9 +635,9 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_editcurve_3d; - RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2); + RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); - Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_SNAP); } static void TRANSFORM_OT_warp(struct wmOperatorType *ot) @@ -646,7 +646,7 @@ static void TRANSFORM_OT_warp(struct wmOperatorType *ot) ot->name = "Warp"; ot->description = "Warp selected items around the cursor"; ot->idname = OP_WARP; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -655,9 +655,9 @@ static void TRANSFORM_OT_warp(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; - RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2); + RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); // XXX Warp axis? } @@ -667,7 +667,7 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot) ot->name = "Shear"; ot->description = "Shear selected items along the horizontal screen axis"; ot->idname = OP_SHEAR; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -678,7 +678,7 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); // XXX Shear axis? } @@ -688,7 +688,7 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot) ot->name = "Push/Pull"; ot->description = "Push/Pull selected items"; ot->idname = OP_PUSH_PULL; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -699,7 +699,7 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot) @@ -708,7 +708,7 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot) ot->name = "Shrink/Fatten"; ot->description = "Shrink/fatten selected vertices along normals"; ot->idname = OP_SHRINK_FATTEN; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -719,7 +719,7 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) @@ -729,7 +729,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) //added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()" ot->description = "Move selected vertices outward in a spherical shape around mesh center"; ot->idname = OP_TOSPHERE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -740,7 +740,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); - Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); + Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); } static void TRANSFORM_OT_mirror(struct wmOperatorType *ot) @@ -749,7 +749,7 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot) ot->name = "Mirror"; ot->description = "Mirror selected vertices around one or more axes"; ot->idname = OP_MIRROR; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -758,7 +758,7 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; - Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL); + Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL); } static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) @@ -767,7 +767,7 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) ot->name = "Edge Slide"; ot->description = "Slide an edge loop along a mesh"; ot->idname = OP_EDGE_SLIDE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -778,7 +778,7 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); - Transform_Properties(ot, P_MIRROR|P_SNAP|P_CORRECT_UV); + Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV); } static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot) @@ -787,7 +787,7 @@ static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot) ot->name = "Edge Crease"; ot->description = "Change the crease of edges"; ot->idname = OP_EDGE_CREASE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -807,7 +807,7 @@ static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot) ot->name = "Edge Bevel Weight"; ot->description = "Change the bevel weight of edges"; ot->idname = OP_EDGE_BWEIGHT; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -827,7 +827,7 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot) ot->name = "Sequence Slide"; ot->description = "Slide a sequence strip in time"; ot->idname = OP_SEQ_SLIDE; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -849,7 +849,7 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot) ot->name = "Transform"; ot->description = "Transform selected items by mode type"; ot->idname = "TRANSFORM_OT_transform"; - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; @@ -858,12 +858,12 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; - prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); + prop = RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); RNA_def_property_flag(prop, PROP_HIDDEN); RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); - Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP); + Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP); } void transform_operatortypes(void) @@ -913,13 +913,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac WM_keymap_add_item(keymap, OP_WARP, WKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0); + WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0); - WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0); + WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0); WM_keymap_add_item(keymap, "TRANSFORM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0); - kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL|KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "use", TRUE); WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0); @@ -927,12 +927,12 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap"); - WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); + WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "texture_space", TRUE); - kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "texture_space", TRUE); WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0); @@ -1014,7 +1014,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0); + WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0); WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0); |