svn merge ^/trunk/blender -r44235:44250
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 17:59:30 +0000 (17:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 17:59:30 +0000 (17:59 +0000)
21 files changed:
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/editors/object/object_edit.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/intern/indexer.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/shadeoutput.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/creator/creator.c

index b09122d022b90b9a96b4abcfcd81d3474dfc6f5f..e94ad6ecfacecd3588497794bb452c903b878b41 100644 (file)
@@ -107,6 +107,7 @@ void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outma
 void armature_loc_world_to_pose(struct Object *ob, float *inloc, float *outloc);
 void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
 void armature_loc_pose_to_bone(struct bPoseChannel *pchan, float *inloc, float *outloc);
+void armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
 void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]);
 
 void armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
index 02b9330d5882ed451727864b97f8ed48db90c45a..036116c54daf947a3b543ef5f311c53144ff16fc 100644 (file)
@@ -1302,6 +1302,17 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm
        mul_v3_m4v3(outmat[3], loc_mat, inmat[3]);
 }
 
+/* Convert Bone-Space Matrix to Pose-Space Matrix. */
+void armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outmat[][4])
+{
+       float rotscale_mat[4][4], loc_mat[4][4];
+
+       pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
+
+       mult_m4_m4m4(outmat, rotscale_mat, inmat);
+       mul_v3_m4v3(outmat[3], loc_mat, inmat[3]);
+}
+
 /* Convert Pose-Space Location to Bone-Space Location
  * NOTE: this cannot be used to convert to pose-space location of the supplied
  *             pose-channel into its local space (i.e. 'visual'-keyframing) 
@@ -2405,6 +2416,8 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
 
        /* Construct the posemat based on PoseChannels, that we do before applying constraints. */
        /* pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
+       armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
+#if 0 /* XXX Old code, will remove this later. */
        {
                float rotscale_mat[4][4], loc_mat[4][4];
                pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
@@ -2413,6 +2426,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
                /* Location. */
                mul_v3_m4v3(pchan->pose_mat[3], loc_mat, pchan->chan_mat[3]);
        }
+#endif
 
        /* Only rootbones get the cyclic offset (unless user doesn't want that). */
        /* XXX That could be a problem for snapping and other "reverse transform" features... */
index 9edcc7a73e88dcaf4477b4cebab898e76b8c13f5..d88a5c26c2ce235728c149980b5257d20151ddb1 100644 (file)
@@ -1697,7 +1697,7 @@ float hyp3,hyp4,b4,b5
                                hyp2 = fabsf(angle*x+y+(-(yo-posy*0.5f)-angle*(xo-posx*0.5f)))*wipezone->pythangle;
                        }
 
-                       hwidth= MIN2(hwidth, fabsf(b3-b1)/2.0f);
+                       hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
 
                        if(b2 < b1 && b2 < b3 ){
                                output = in_band(hwidth,hyp,0,1);
index b8cc749888c38e36cf9461e29ca898417394adab..a28b5c4feaaea1756a65b3a00db7d3e929483b8e 100644 (file)
@@ -1005,7 +1005,10 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
         * view3d_edit_object_copyattrmenu() and in toolbox.c
         */
        
-       strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
+       strcpy(str,
+              "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|"
+              "Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|"
+              "Logic Bricks%x10|Protected Transform%x29|%l");
        
        strcat (str, "|Object Constraints%x22");
        strcat (str, "|NLA Strips%x26");
index 9929de8e89c1256f2de725ed4d2c80b450ce50cd..5648bc69099ced9c5e1ecd4391c46b67658e09e2 100644 (file)
@@ -3474,7 +3474,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
                view3d_operator_needs_opengl(C);
                selected= (short)count_selected_keys(scene, edit);
 
-               dmax = MAX2(fabs(dx), fabs(dy));
+               dmax = maxf(fabsf(dx), fabsf(dy));
                tot_steps = dmax/(0.2f * brush->size) + 1;
 
                dx /= (float)tot_steps;
index 5d0f294b06a87fd251d2763cda29f92aef8cdeaa..a77e6dccbb83dd2cb2b2459de4a62ef735a01b70 100644 (file)
@@ -879,6 +879,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
                        IMB_anim_index_rebuild(clip->anim, tc_flag, size_flag, quality, stop, do_update, progress);
 
                if(!build_undistort_count) {
+                       BKE_movieclip_reload(clip);
                        return;
                }
                else {
@@ -905,6 +906,8 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
 
        if(distortion)
                BKE_tracking_distortion_destroy(distortion);
+
+       BKE_movieclip_reload(clip);
 }
 
 static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
index 4f46a746b9e4cc123841c0cef7bee1e37e03102e..c73d8e14f05dda6ca6931ce79432f9cf8e1714ab 100644 (file)
@@ -1584,7 +1584,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
                                /* calc window coord */
                                initgrabz(rv3d, 0.0, 0.0, 0.0);
                                ED_view3d_win_to_delta(ar, mval_f, vec);
-                               fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
+                               fac= maxf(fabsf(vec[0]), maxf(fabsf(vec[1]), fabsf(vec[2]))); /* largest abs axis */
                                fac= 1.0f/fac;
 
                                asp= ( (float)ibuf->y)/(float)ibuf->x;
index a7647a8124dc5e6aa6070be0d588d81bd08cfc4a..d15d6b8b3bcea009f90f7fd0a7c8e80829092524 100644 (file)
@@ -4845,7 +4845,8 @@ static int doEdgeSlide(TransInfo *t, float perc)
                        copy_v3_v3(vec, sv->upvec);
                        mul_v3_fl(vec, perc);
                        add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
-               } else {
+               }
+               else {
                        copy_v3_v3(vec, sv->downvec);
                        mul_v3_fl(vec, -perc);
                        add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
index b96317cd22bc14c6353899dd1cd26cf3381f9fcc..5158f2beada7d41c493a794946efae23012684c5 100644 (file)
@@ -417,7 +417,7 @@ static short apply_targetless_ik(Object *ob)
                        }
                        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) */
@@ -428,6 +428,8 @@ static short apply_targetless_ik(Object *ob)
                                bone= parchan->bone;
                                bone->flag |= BONE_TRANSFORM;   /* ensures it gets an auto key inserted */
 
+       /* XXX Old code. Will remove it later. */
+#if 0
                                if(parchan->parent) {
                                        Bone *parbone= parchan->parent->bone;
                                        float offs_bone[4][4];
@@ -470,6 +472,8 @@ static short apply_targetless_ik(Object *ob)
                                }
                                /* result matrix */
                                mult_m4_m4m4(rmat, imat, parchan->pose_mat);
+#endif
+                               armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
 
                                /* apply and decompose, doesn't work for constraints or non-uniform scale well */
                                {
index ef2abb20cf3b1a199aae00c6dc3ee082977bb666..0ddaf07c67ee91bc28d9df4e93fbc8f29f40b1b1 100644 (file)
@@ -1071,7 +1071,7 @@ static void do_material_tex(GPUShadeInput *shi)
                                                else
                                                        newnor = tnor;
                                                
-                                               norfac = MIN2(fabsf(mtex->norfac), 1.0f);
+                                               norfac = minf(fabsf(mtex->norfac), 1.0f);
                                                
                                                if(norfac == 1.0f && !GPU_link_changed(stencil)) {
                                                        shi->vn = newnor;
index e1481d2a08feb37fc49c5809b28916a804a733f6..ade63aa1e9c43c217d4e0ff400ff3d7ad0c6bb56 100644 (file)
@@ -459,12 +459,13 @@ static int round_up(int x, int mod)
 static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
        struct anim * anim,
        AVStream * st, int proxy_size, int width, int height,
-       int UNUSED(quality))
+       int quality)
 {
        struct proxy_output_ctx * rv = MEM_callocN(
                sizeof(struct proxy_output_ctx), "alloc_proxy_output");
        
        char fname[FILE_MAX];
+       int ffmpeg_quality;
 
        // JPEG requires this
        width = round_up(width, 8);
@@ -514,6 +515,12 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
        rv->c->time_base.num = 1;
        rv->st->time_base = rv->c->time_base;
 
+       /* there's no  way to set JPEG quality in the same way as in AVI JPEG and image sequence,
+        * but this seems to be giving expected quality result */
+       ffmpeg_quality = (int)(1.0f + 30.0f * (1.0f - (float)quality / 100.0f) + 0.5f);
+       av_set_int(rv->c, "qmin", ffmpeg_quality);
+       av_set_int(rv->c, "qmax", ffmpeg_quality);
+
        if (rv->of->flags & AVFMT_GLOBALHEADER) {
                rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER;
        }
index 24683ec57f77dff8e2e1eedab84877a25c0b841a..9746a6dbd86cd858cf9399a3f687abe4e45744f2 100644 (file)
@@ -161,7 +161,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
                                        copy_v3_v3(lvrot, lv);
                                        mul_m3_v3(lar->imat, lvrot);
                                        
-                                       x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+                                       x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
                                        /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
                                        
                                        inpr= 1.0/(sqrt(1.0f+x*x));
index 2f620bb96d43692286f28f0d1d2bae95f79d6626..78420aa6ca8153f7f221ff31be8bb3121bf0673d 100644 (file)
@@ -1204,7 +1204,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
                                                        copy_v3_v3(lvrot, lv);
                                                        mul_m3_v3(lar->imat, lvrot);
                                                        
-                                                       x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+                                                       x = maxf(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
                                                        /* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
                                                        
                                                        inpr= 1.0f/(sqrt(1.0f+x*x));
index 4fe11044d3065e1f6990b1cbf2e7fe4f616c4ca5..df4ebfd9b9f33db57556cb74b583dfbb7b778b52 100644 (file)
@@ -90,9 +90,16 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
                                        if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
                                                int x = 0, y = 0;
                                                wm_get_cursor_position(win, &x, &y);
-                                               pc->draw(C, x - ar_other->winrct.xmin, y - ar_other->winrct.ymin, pc->customdata);
-                                       } else {
-                                               pc->draw(C, win->eventstate->x - ar_other->winrct.xmin, win->eventstate->y - ar_other->winrct.ymin, pc->customdata);
+                                               pc->draw(C,
+                                                        x - ar_other->winrct.xmin,
+                                                        y - ar_other->winrct.ymin,
+                                                        pc->customdata);
+                                       }
+                                       else {
+                                               pc->draw(C,
+                                                        win->eventstate->x - ar_other->winrct.xmin,
+                                                        win->eventstate->y - ar_other->winrct.ymin,
+                                                        pc->customdata);
                                        }
                                }
                        }
@@ -458,7 +465,8 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
 
                        if(triple->x[x] > maxsize || triple->y[y] > maxsize) {
                                glBindTexture(triple->target, 0);
-                               printf("WM: failed to allocate texture for triple buffer drawing (texture too large for graphics card).\n");
+                               printf("WM: failed to allocate texture for triple buffer drawing "
+                                      "(texture too large for graphics card).\n");
                                return 0;
                        }
 
index f7da70b6c77c1898eb3c9a364d1b77d7944318f0..d78faa76855aacec6ac772b1051c4287c1f5ad9f 100644 (file)
@@ -82,7 +82,8 @@
 #  include "RNA_enum_types.h"
 #endif
 
-static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only);
+static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
+                                     short context, short poll_only);
 
 /* ************ event management ************** */
 
@@ -223,7 +224,9 @@ void wm_event_do_notifiers(bContext *C)
                                }
                        }
 
-                       if(note->window==win || (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C)))) {
+                       if (note->window == win ||
+                               (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C))))
+                       {
                                if(note->category==NC_SCENE) {
                                        if(note->data==ND_FRAME)
                                                do_anim= 1;
@@ -637,7 +640,8 @@ int WM_operator_repeat_check(const bContext *UNUSED(C), wmOperator *op)
 
 static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, PointerRNA *properties, ReportList *reports)
 {
-       wmOperator *op= MEM_callocN(sizeof(wmOperator), ot->idname);    /* XXX operatortype names are static still. for debug */
+       /* XXX operatortype names are static still. for debug */
+       wmOperator *op= MEM_callocN(sizeof(wmOperator), ot->idname);
        
        /* XXX adding new operator could be function, only happens here now */
        op->type= ot;
@@ -818,8 +822,10 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
                        if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
                                wm->op_undo_depth--;
                }
-               else
-                       printf("invalid operator call %s\n", ot->idname); /* debug, important to leave a while, should never happen */
+               else {
+                       /* debug, important to leave a while, should never happen */
+                       printf("invalid operator call '%s'\n", ot->idname);
+               }
                
                /* Note, if the report is given as an argument then assume the caller will deal with displaying them
                 * currently python only uses this */
@@ -842,9 +848,12 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
                                int wrap;
 
                                if (op->opm) {
-                                       wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
-                               } else {
-                                       wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
+                                       wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) &&
+                                              ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
+                               }
+                               else {
+                                       wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) &&
+                                              ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
                                }
 
                                /* exception, cont. grab in header is annoying */
@@ -860,7 +869,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
                                        ARegion *ar= CTX_wm_region(C);
                                        ScrArea *sa= CTX_wm_area(C);
 
-                                       if(ar && ar->regiontype == RGN_TYPE_WINDOW && event && BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+                                       if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
+                                           BLI_in_rcti(&ar->winrct, event->x, event->y))
+                                       {
                                                winrect= &ar->winrct;
                                        }
                                        else if(sa) {
@@ -895,7 +906,8 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
  * this is for python to access since its done the operator lookup
  * 
  * invokes operator in context */
-static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only)
+static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
+                                     short context, short poll_only)
 {
        wmWindow *window= CTX_wm_window(C);
        wmEvent *event;
@@ -1297,7 +1309,8 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
 }
 
 /* Warning: this function removes a modal handler, when finished */
-static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler, wmEvent *event, PointerRNA *properties)
+static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler,
+                                    wmEvent *event, PointerRNA *properties)
 {
        int retval= OPERATOR_PASS_THROUGH;
        
@@ -1615,9 +1628,10 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
                                if(!keymap->poll || keymap->poll(C)) {
                                        for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
                                                if(wm_eventmatch(event, kmi)) {
-                                                       
-                                                       event->keymap_idname= kmi->idname;      /* weak, but allows interactive callback to not use rawkey */
-                                                       
+
+                                                       /* weak, but allows interactive callback to not use rawkey */
+                                                       event->keymap_idname = kmi->idname;
+
                                                        action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
                                                        if(action & WM_HANDLER_BREAK)  /* not always_pass here, it denotes removed handler */
                                                                break;
@@ -1716,7 +1730,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
                        ) {
                                event->val = KM_DBL_CLICK;
                                /* removed this because in cases where we're this is used as a single click
-                                * event, this will give old coords, since the distance is checked above, using new coords should be ok. */
+                                * event, this will give old coords,
+                                * since the distance is checked above, using new coords should be ok. */
                                //   event->x = win->eventstate->prevclickx;
                                //   event->y = win->eventstate->prevclicky;
                                action |= wm_handlers_do(C, event, handlers);
@@ -2233,7 +2248,8 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
        }
 }
 
-wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers, wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata)
+wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
+                                        wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata)
 {
        wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event ui handler");
        handler->ui_handle= func;
@@ -2249,7 +2265,8 @@ wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers, w
 }
 
 /* set "postpone" for win->modalhandlers, this is in a running for() loop in wm_handlers_do() */
-void WM_event_remove_ui_handler(ListBase *handlers, wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
+void WM_event_remove_ui_handler(ListBase *handlers,
+                                wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
 {
        wmEventHandler *handler;
        
@@ -2629,7 +2646,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
                case GHOST_kEventButtonDown:
                case GHOST_kEventButtonUp: {
                        GHOST_TEventButtonData *bd= customdata;
-                       event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE; /* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
+
+                       /* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
+                       event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE;
                        
                        if (bd->button == GHOST_kButtonMaskLeft)
                                event.type= LEFTMOUSE;
@@ -2700,7 +2719,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 
                        if (event.utf8_buf[0]) {
                                if (BLI_str_utf8_size(event.utf8_buf) == -1) {
-                                       printf("%s: ghost detected an invalid unicode character '%d'!\n", __func__, (int)(unsigned char)event.utf8_buf[0]);
+                                       printf("%s: ghost detected an invalid unicode character '%d'!\n",
+                                              __func__, (int)(unsigned char)event.utf8_buf[0]);
                                        event.utf8_buf[0]= '\0';
                                }
                        }
@@ -2709,19 +2729,27 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
                        /* assigning both first and second is strange - campbell */
                        switch(event.type) {
                        case LEFTSHIFTKEY: case RIGHTSHIFTKEY:
-                               event.shift= evt->shift= (event.val==KM_PRESS) ? ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE;
+                               event.shift = evt->shift = (event.val == KM_PRESS) ?
+                                               ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+                                               FALSE;
                                break;
                        case LEFTCTRLKEY: case RIGHTCTRLKEY:
-                               event.ctrl= evt->ctrl= (event.val==KM_PRESS) ? ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE;
+                               event.ctrl = evt->ctrl = (event.val == KM_PRESS) ?
+                                               ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+                                               FALSE;
                                break;
                        case LEFTALTKEY: case RIGHTALTKEY:
-                               event.alt= evt->alt= (event.val==KM_PRESS) ? ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE;
+                               event.alt = evt->alt = (event.val == KM_PRESS) ?
+                                               ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+                                               FALSE;
                                break;
                        case OSKEY:
-                               event.oskey= evt->oskey= (event.val==KM_PRESS) ? ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE;
+                               event.oskey = evt->oskey = (event.val == KM_PRESS) ?
+                                               ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
+                                               FALSE;
                                break;
                        default:
-                               if(event.val==KM_PRESS && event.keymodifier==0)
+                               if(event.val == KM_PRESS && event.keymodifier==0)
                                        evt->keymodifier= event.type; /* only set in eventstate, for next event */
                                else if(event.val==KM_RELEASE && event.keymodifier==event.type)
                                        event.keymodifier= evt->keymodifier= 0;
index a4c90888b7411ab24f6fd980010d3cf7b8b815c4..bae6c7abcdac0da2a12dd9406927bc94d7e10acc 100644 (file)
@@ -391,7 +391,10 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
                
 // XXX         mainwindow_set_filename_to_title(G.main->name);
 
-               if(retval == BKE_READ_FILE_OK_USERPREFS) wm_init_userdef(C);    // in case a userdef is read from regular .blend
+               if(retval == BKE_READ_FILE_OK_USERPREFS) {
+                       /* in case a userdef is read from regular .blend */
+                       wm_init_userdef(C);
+               }
                
                if (retval != BKE_READ_FILE_FAIL) {
                        G.relbase_valid = 1;
@@ -420,13 +423,20 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
 
                CTX_wm_window_set(C, NULL); /* exits queues */
 
-#if 0  /* gives popups on windows but not linux, bug in report API but disable for now to stop users getting annoyed  */
+#if 0
+               /* gives popups on windows but not linux, bug in report API
+                * but disable for now to stop users getting annoyed  */
                /* TODO, make this show in header info window */
                {
                        Scene *sce;
-                       for(sce= G.main->scene.first; sce; sce= sce->id.next) {
-                               if(sce->r.engine[0] && BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL) {
-                                       BKE_reportf(reports, RPT_WARNING, "Engine not available: '%s' for scene: %s, an addon may need to be installed or enabled", sce->r.engine, sce->id.name+2);
+                       for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+                               if (sce->r.engine[0] &&
+                                   BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
+                               {
+                                       BKE_reportf(reports, RPT_WARNING,
+                                                   "Engine not available: '%s' for scene: %s, "
+                                                   "an addon may need to be installed or enabled",
+                                                   sce->r.engine, sce->id.name+2);
                                }
                        }
                }
@@ -659,8 +669,10 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
                return NULL;
 
        /* gets scaled to BLEN_THUMB_SIZE */
-       ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID, err_out);
-       
+       ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera,
+                                                   BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
+                                                   IB_rect, OB_SOLID, err_out);
+
        if(ibuf) {              
                float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
 
index 6940764c6ad51b657e736f7966c2d59ef53db582..c97d2b5859697e9d0637a63b3112b424959d8af1 100644 (file)
@@ -74,7 +74,9 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
        
        wm_subwindow_getorigin(window, gesture->swinid, &sx, &sy);
        
-       if( ELEM5(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK, WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE)) {
+       if (ELEM5(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
+                       WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
+       {
                rcti *rect= MEM_callocN(sizeof(rcti), "gesture rect new");
                
                gesture->customdata= rect;
index 661bd90435ca8efc51d076c674f5c52e17d2288c..d603262227fc742d898f2ba7608b31d56439dfb2 100644 (file)
@@ -767,7 +767,9 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
        return str;
 }
 
-static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
+static wmKeyMapItem *wm_keymap_item_find_handlers(
+        const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext),
+        IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
 {
        wmWindowManager *wm= CTX_wm_manager(C);
        wmEventHandler *handler;
@@ -806,7 +808,9 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *h
        return NULL;
 }
 
-static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
+static wmKeyMapItem *wm_keymap_item_find_props(
+        const bContext *C, const char *opname, int opcontext,
+        IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r)
 {
        wmWindow *win= CTX_wm_window(C);
        ScrArea *sa= CTX_wm_area(C);
@@ -854,7 +858,9 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op
        return found;
 }
 
-static wmKeyMapItem *wm_keymap_item_find(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r)
+static wmKeyMapItem *wm_keymap_item_find(
+        const bContext *C, const char *opname, int opcontext,
+        IDProperty *properties, const short hotkey, const short sloppy, wmKeyMap **keymap_r)
 {
        wmKeyMapItem *found= wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, keymap_r);
 
@@ -864,7 +870,9 @@ static wmKeyMapItem *wm_keymap_item_find(const bContext *C, const char *opname,
        return found;
 }
 
-char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short sloppy, char *str, int len)
+char *WM_key_event_operator_string(
+        const bContext *C, const char *opname, int opcontext,
+        IDProperty *properties, const short sloppy, char *str, int len)
 {
        wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
        
@@ -876,7 +884,9 @@ char *WM_key_event_operator_string(const bContext *C, const char *opname, int op
        return NULL;
 }
 
-int WM_key_event_operator_id(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int hotkey, wmKeyMap **keymap_r)
+int WM_key_event_operator_id(
+        const bContext *C, const char *opname, int opcontext,
+        IDProperty *properties, int hotkey, wmKeyMap **keymap_r)
 {
        wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r);
        
index 19c45164b5307e66eb017719db9e76f19c871a0b..eddd3c4f3abd1e08a27047f39f4b1c8c7904bb59 100644 (file)
@@ -153,7 +153,9 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
                ot->name= IFACE_("Dummy Name");
        }
 
-       RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); // XXX All ops should have a description but for now allow them not to.
+       // XXX All ops should have a description but for now allow them not to.
+       RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)"));
+
        RNA_def_struct_identifier(ot->srna, ot->idname);
 
        BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -1136,7 +1138,8 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
        
        if((op->type->flag & OPTYPE_REGISTER)==0) {
-               BKE_reportf(op->reports, RPT_ERROR, "Operator '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
+               BKE_reportf(op->reports, RPT_ERROR,
+                           "Operator '%s' does not have register enabled, incorrect invoke function.", op->type->idname);
                return OPERATOR_CANCELLED;
        }
        
@@ -1845,7 +1848,10 @@ static void WM_OT_link_append(wmOperatorType *ot)
        
        ot->flag |= OPTYPE_UNDO;
 
-       WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+       WM_operator_properties_filesel(
+               ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
+               WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME|WM_FILESEL_RELPATH|WM_FILESEL_FILES,
+               FILE_DEFAULTDISPLAY);
        
        RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
        RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
@@ -3205,8 +3211,8 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
                return 0;
        
        /* slightly ugly; allow this property to not resolve
-          correctly. needed because 3d texture paint shares the same
-          keymap as 2d image paint */
+        * correctly. needed because 3d texture paint shares the same
+        * keymap as 2d image paint */
        if(!radial_control_get_path(&ctx_ptr, op, "zoom_path",
                                                                &rc->zoom_ptr, &rc->zoom_prop, 2,
                                                                RC_PROP_REQUIRE_FLOAT|RC_PROP_ALLOW_MISSING))
index fe967bbcd1c823ec166ae7e41878adf05f93592d..599de5697f12b096fd2da2b70ef8e871ebe27c09 100644 (file)
@@ -155,7 +155,8 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
                        CTX_wm_window_set(C, NULL);
        }       
 
-       /* always set drawable and active to NULL, prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
+       /* always set drawable and active to NULL,
+        * prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
        wm->windrawable= NULL;
        wm->winactive= NULL;
 
@@ -751,7 +752,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                                        }
                                                        
                                                        if(type!=GHOST_kEventWindowSize) {
-                                                               if(G.f & G_DEBUG) printf("win move event pos %d %d size %d %d\n", win->posx, win->posy, win->sizex, win->sizey);
+                                                               if(G.f & G_DEBUG) {
+                                                                       printf("win move event pos %d %d size %d %d\n",
+                                                                              win->posx, win->posy, win->sizex, win->sizey);
+                                                               }
                                                        }
                                                        
                                                }
index 68a7bc415a8e9fdaaad82044b92593056fd95527..0b67dfabf16fb74eaf48474834a9800c93d8f362 100644 (file)
@@ -727,7 +727,7 @@ static int render_frame(int argc, const char **argv, void *data)
 
                        BKE_reports_init(&reports, RPT_PRINT);
 
-                       frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame));
+                       frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
 
                        RE_SetReports(re, &reports);
                        RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);