Merging r50576 through r50587 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Sep 2012 14:05:05 +0000 (14:05 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Sep 2012 14:05:05 +0000 (14:05 +0000)
37 files changed:
GNUmakefile
build_files/cmake/cmake_static_check_smatch.py [new file with mode: 0644]
intern/cycles/app/cycles_test.cpp
source/blender/avi/intern/avi.c
source/blender/blenkernel/BKE_mask.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/fmodifier.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/sequencer.c
source/blender/compositor/operations/COM_MaskOperation.cpp
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/poseobject.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/resources.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/physics/particle_object.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_group.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/util/ed_util.c
source/blender/imbuf/intern/filetype.c
source/blender/imbuf/intern/imbuf_cocoa.m [deleted file]
source/blender/imbuf/intern/iris.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/nodes/composite/node_composite_tree.c
source/blender/render/intern/source/convertblender.c
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

index f48ac5c..1f1de3f 100644 (file)
@@ -251,6 +251,10 @@ check_sparse:
        $(CMAKE_CONFIG)
        cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
 
+check_smatch:
+       $(CMAKE_CONFIG)
+       cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
+
 check_spelling_py:
        cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3.2 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
 
diff --git a/build_files/cmake/cmake_static_check_smatch.py b/build_files/cmake/cmake_static_check_smatch.py
new file mode 100644 (file)
index 0000000..779945b
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/env python3.2
+
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Campbell Barton
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# <pep8 compliant>
+
+CHECKER_IGNORE_PREFIX = [
+    "extern",
+    "intern/moto",
+    ]
+
+CHECKER_BIN = "smatch"
+CHECKER_ARGS = [
+    "--full-path",
+    "--two-passes",
+    ]
+
+import project_source_info
+import subprocess
+import sys
+
+
+def main():
+    source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
+
+    check_commands = []
+    for c, inc_dirs, defs in source_info:
+
+        cmd = ([CHECKER_BIN] +
+                CHECKER_ARGS +
+               [c] +
+               [("-I%s" % i) for i in inc_dirs] +
+               [("-D%s" % d) for d in defs]
+              )
+
+        check_commands.append((c, cmd))
+
+    def my_process(i, c, cmd):
+        percent = 100.0 * (i / (len(check_commands) - 1))
+        percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
+
+        sys.stdout.flush()
+        sys.stdout.write("%s %s\n" % (percent_str, c))
+
+        return subprocess.Popen(cmd)
+
+    process_functions = []
+    for i, (c, cmd) in enumerate(check_commands):
+        process_functions.append((my_process, (i, c, cmd)))
+
+    project_source_info.queue_processes(process_functions)
+
+
+if __name__ == "__main__":
+    main()
index 5ee3512..e921cc4 100644 (file)
@@ -272,6 +272,9 @@ static void options_parse(int argc, const char **argv)
                options.scene_params.shadingsystem = SceneParams::OSL;
        else if(ssname == "svm")
                options.scene_params.shadingsystem = SceneParams::SVM;
+               
+       /* Progressive rendering */
+       options.session_params.progressive = true;
 
        /* find matching device */
        DeviceType device_type = Device::type_from_string(devicename.c_str());
index 3942405..cda2cf3 100644 (file)
@@ -734,9 +734,10 @@ AviError AVI_close(AviMovie *movie)
 
        fclose(movie->fp);
 
-       for (i = 0; i < movie->header->Streams; i++) {
-               if (movie->streams[i].sf != NULL)
+       for (i = 0; movie->header && (i < movie->header->Streams); i++) {
+               if (movie->streams && (movie->streams[i].sf != NULL)) {
                        MEM_freeN(movie->streams[i].sf);
+               }
        }
 
        if (movie->header != NULL)
@@ -1081,9 +1082,10 @@ AviError AVI_close_compress(AviMovie *movie)
 
        fclose(movie->fp);
 
-       for (i = 0; i < movie->header->Streams; i++) {
-               if (movie->streams[i].sf != NULL)
+       for (i = 0; movie->header && (i < movie->header->Streams); i++) {
+               if (movie->streams && (movie->streams[i].sf != NULL)) {
                        MEM_freeN(movie->streams[i].sf);
+               }
        }
        if (movie->header != NULL)
                MEM_freeN(movie->header);
index 9ce678d..51e301f 100644 (file)
@@ -102,8 +102,8 @@ struct Mask *BKE_mask_new(const char *name);
 struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
 struct Mask *BKE_mask_copy(struct Mask *mask);
 
-void BKE_mask_free(struct Mask *mask);
-void BKE_mask_unlink(struct Main *bmain, struct Mask *mask);
+void BKE_mask_free_nolib(struct Mask *mask);
+void BKE_mask_free(struct Main *bmain, struct Mask *mask);
 
 void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
 void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2]);
index a7f8e1b..8c0aea5 100644 (file)
@@ -2081,7 +2081,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
        if ((*final_r)->type != DM_TYPE_EDITBMESH) {
                DM_ensure_tessface(*final_r);
        }
-       if (cage_r) {
+       if (cage_r && *cage_r) {
                if ((*cage_r)->type != DM_TYPE_EDITBMESH) {
                        if (*cage_r != *final_r) {
                                DM_ensure_tessface(*cage_r);
index 438188b..538d246 100644 (file)
@@ -965,8 +965,8 @@ FModifierTypeInfo *get_fmodifier_typeinfo(int type)
        }
        
        /* only return for valid types */
-       if ( (type >= FMODIFIER_TYPE_NULL) && 
-            (type <= FMODIFIER_NUM_TYPES) )
+       if ((type >= FMODIFIER_TYPE_NULL) &&
+           (type <  FMODIFIER_NUM_TYPES))
        {
                /* there shouldn't be any segfaults here... */
                return fmodifiersTypeInfo[type];
index 0e73d10..17e4103 100644 (file)
@@ -488,7 +488,7 @@ static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir
        /* test for cyclic */
        bl = cu->bev.first;
        if (!bl->nr) return 0;
-       if (bl && bl->poly > -1) cycl = 1;
+       if (bl->poly > -1) cycl = 1;
 
        if (cycl == 0) {
                ctime1 = CLAMPIS(ctime, 0.0f, 1.0f);
index f8c1a35..45364f5 100644 (file)
@@ -800,6 +800,7 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata
 /* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */
 void BKE_libblock_free(ListBase *lb, void *idv)
 {
+       Main *bmain = G.main;  /* should eventually be an arg */
        ID *id = idv;
 
 #ifdef WITH_PYTHON
@@ -899,7 +900,7 @@ void BKE_libblock_free(ListBase *lb, void *idv)
                        BKE_movieclip_free((MovieClip *)id);
                        break;
                case ID_MSK:
-                       BKE_mask_free((Mask *)id);
+                       BKE_mask_free(bmain, (Mask *)id);
                        break;
        }
 
@@ -911,7 +912,7 @@ void BKE_libblock_free(ListBase *lb, void *idv)
        BLI_remlink(lb, id);
 
        /* this ID may be a driver target! */
-       BKE_animdata_main_cb(G.main, animdata_dtar_clear_cb, (void *)id);
+       BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
 
        MEM_freeN(id);
 }
@@ -946,9 +947,52 @@ void free_main(Main *mainvar)
                ID *id;
                
                while ( (id = lb->first) ) {
+#if 1
                        BKE_libblock_free(lb, id);
+#else
+                       /* errors freeing ID's can be hard to track down,
+                        * enable this so valgrind will give the line number in its error log */
+                       switch (a) {
+                               case   0: BKE_libblock_free(lb, id); break;
+                               case   1: BKE_libblock_free(lb, id); break;
+                               case   2: BKE_libblock_free(lb, id); break;
+                               case   3: BKE_libblock_free(lb, id); break;
+                               case   4: BKE_libblock_free(lb, id); break;
+                               case   5: BKE_libblock_free(lb, id); break;
+                               case   6: BKE_libblock_free(lb, id); break;
+                               case   7: BKE_libblock_free(lb, id); break;
+                               case   8: BKE_libblock_free(lb, id); break;
+                               case   9: BKE_libblock_free(lb, id); break;
+                               case  10: BKE_libblock_free(lb, id); break;
+                               case  11: BKE_libblock_free(lb, id); break;
+                               case  12: BKE_libblock_free(lb, id); break;
+                               case  13: BKE_libblock_free(lb, id); break;
+                               case  14: BKE_libblock_free(lb, id); break;
+                               case  15: BKE_libblock_free(lb, id); break;
+                               case  16: BKE_libblock_free(lb, id); break;
+                               case  17: BKE_libblock_free(lb, id); break;
+                               case  18: BKE_libblock_free(lb, id); break;
+                               case  19: BKE_libblock_free(lb, id); break;
+                               case  20: BKE_libblock_free(lb, id); break;
+                               case  21: BKE_libblock_free(lb, id); break;
+                               case  22: BKE_libblock_free(lb, id); break;
+                               case  23: BKE_libblock_free(lb, id); break;
+                               case  24: BKE_libblock_free(lb, id); break;
+                               case  25: BKE_libblock_free(lb, id); break;
+                               case  26: BKE_libblock_free(lb, id); break;
+                               case  27: BKE_libblock_free(lb, id); break;
+                               case  28: BKE_libblock_free(lb, id); break;
+                               case  29: BKE_libblock_free(lb, id); break;
+                               case  30: BKE_libblock_free(lb, id); break;
+                               case  31: BKE_libblock_free(lb, id); break;
+                               case  32: BKE_libblock_free(lb, id); break;
+                               default:
+                                       BLI_assert(0);
+                       }
+#endif
                }
        }
+       a = set_listbasepointers(mainvar, lbarray);
 
        MEM_freeN(mainvar);
 }
index 06d0635..97b46d4 100644 (file)
@@ -910,7 +910,8 @@ void BKE_mask_layer_free_list(ListBase *masklayers)
        }
 }
 
-void BKE_mask_free(Mask *mask)
+/** free for temp copy, but don't manage unlinking from other pointers */
+void BKE_mask_free_nolib(Mask *mask)
 {
        BKE_mask_layer_free_list(&mask->masklayers);
 }
@@ -928,7 +929,7 @@ static void ntree_unlink_mask_cb(void *calldata, struct ID *UNUSED(owner_id), st
        }
 }
 
-void BKE_mask_unlink(Main *bmain, Mask *mask)
+void BKE_mask_free(Main *bmain, Mask *mask)
 {
        bScreen *scr;
        ScrArea *area;
@@ -991,7 +992,8 @@ void BKE_mask_unlink(Main *bmain, Mask *mask)
                treetype->foreach_nodetree(bmain, (void *)mask, &ntree_unlink_mask_cb);
        }
 
-       BKE_libblock_free(&bmain->mask, mask);
+       /* free mask data */
+       BKE_mask_layer_free_list(&mask->masklayers);
 }
 
 void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
index 84881af..0d8b220 100644 (file)
@@ -2254,7 +2254,7 @@ static ImBuf *seq_render_mask(SeqRenderData context, Mask *mask, float nr, short
 
                BKE_maskrasterize_handle_init(mr_handle, mask_temp, context.rectx, context.recty, TRUE, TRUE, TRUE);
 
-               BKE_mask_free(mask_temp);
+               BKE_mask_free_nolib(mask_temp);
                MEM_freeN(mask_temp);
 
                BKE_maskrasterize_buffer(mr_handle, context.rectx, context.recty, maskbuf);
index a156dfc..36b3f20 100644 (file)
@@ -93,7 +93,7 @@ void MaskOperation::initExecution()
                                frame_iter += frame_step;
                        }
 
-                       BKE_mask_free(mask_temp);
+                       BKE_mask_free_nolib(mask_temp);
                        MEM_freeN(mask_temp);
                }
        }
index 4653767..6c9105d 100644 (file)
@@ -412,7 +412,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
         *      -> firstly, handles must have same central value as each other
         *      -> secondly, handles which control that section of the curve must be constant
         */
-       if ((!prev) || (!beztn)) return;
+       if (prev == NULL) return;
        if (IS_EQF(beztn->vec[1][1], prev->vec[1][1]) == 0) return;
        if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) == 0) return;
        if (IS_EQF(prev->vec[1][1], prev->vec[2][1]) == 0) return;
index 23c987c..eea7424 100644 (file)
@@ -1006,7 +1006,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
                        /* get search-string */
                        index = pld->search_cursor;
                        
-                       if (index >= 0 && index <= sizeof(tempstr) - 1) {
+                       if (index >= 0 && index < sizeof(tempstr) - 1) {
                                memcpy(&tempstr[0], &pld->searchstr[0], index);
                                tempstr[index] = '|';
                                memcpy(&tempstr[index + 1], &pld->searchstr[index], (sizeof(tempstr) - 1) - index);
index e4f1e6d..e9424a0 100644 (file)
@@ -2350,20 +2350,18 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op)
                for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
                        pose_bone_do_paste(ob, pchan, only_select, 0);
                }
-               
+
                /* free temp data - free manually as was copied without constraints */
-               if (dummyPose) {
-                       for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
-                               if (pchan->prop) {
-                                       IDP_FreeProperty(pchan->prop);
-                                       MEM_freeN(pchan->prop);
-                               }
+               for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) {
+                       if (pchan->prop) {
+                               IDP_FreeProperty(pchan->prop);
+                               MEM_freeN(pchan->prop);
                        }
-                       
-                       /* was copied without constraints */
-                       BLI_freelistN(&dummyPose->chanbase);
-                       MEM_freeN(dummyPose);
                }
+
+               /* was copied without constraints */
+               BLI_freelistN(&dummyPose->chanbase);
+               MEM_freeN(dummyPose);
        }
        else {
                /* no animation, so just reset whole pose to rest pose 
index cf440cd..917153c 100644 (file)
@@ -196,7 +196,7 @@ typedef enum {
        UI_BUT_POIN_BIT = 256  /* OR'd with a bit index*/
 } eButPointerType;
 
-/* button requires a pointer */
+/* requires (but->poin != NULL) */
 #define UI_BUT_POIN_TYPES (UI_BUT_POIN_FLOAT | UI_BUT_POIN_SHORT | UI_BUT_POIN_CHAR)
 
 /* assigned to but->type, OR'd with the flags above when passing args */
index c3f1080..7524e88 100644 (file)
@@ -2620,10 +2620,17 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
 {
        uiBut *but;
        int slen;
-       
-       if (type & UI_BUT_POIN_TYPES) {       /* a pointer is required */
-               if (poin == NULL)
+
+       /* we could do some more error checks here */
+       if ((type & BUTTYPE) == LABEL) {
+               BLI_assert((poin != NULL || a1 != 0.0f || a2 != 0.0f || min != 0.0f || max != 0.0f) == FALSE);
+       }
+
+       if (type & UI_BUT_POIN_TYPES) {  /* a pointer is required */
+               if (poin == NULL) {
+                       BLI_assert(0);
                        return NULL;
+               }
        }
 
        but = MEM_callocN(sizeof(uiBut), "uiBut");
index e825ff7..f6f12f9 100644 (file)
@@ -835,7 +835,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
                if (G.debug & G_DEBUG)
                        printf("%s, error: requested preview image does not exist", __func__);
        }
-       if (!prv_img->rect[size]) {
+       else if (!prv_img->rect[size]) {
                prv_img->w[size] = render_size;
                prv_img->h[size] = render_size;
                prv_img->changed[size] = 1;
index ed6b2e0..b379a2e 100644 (file)
@@ -944,7 +944,7 @@ void UI_SetTheme(int spacetype, int regionid)
        }
 }
 
-bTheme *UI_GetTheme()
+bTheme *UI_GetTheme(void)
 {
        return U.themes.first;
 }
index dc5d1ce..81776ff 100644 (file)
@@ -2324,25 +2324,19 @@ static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op)
        BMIter iter;
        BMEdge *e;
        BMLoop *l1, *l2;
-       float sharp = RNA_float_get(op->ptr, "sharpness"), angle;
+       const float sharp = RNA_float_get(op->ptr, "sharpness");
 
        BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
-               if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) || !e->l)
-                       continue;
-
-               l1 = e->l;
-               l2 = l1->radial_next;
-
-               if (l1 == l2)
-                       continue;
-
-               /* edge has exactly two neighboring faces, check angle */
-               angle = angle_normalized_v3v3(l1->f->no, l2->f->no);
+               if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE &&
+                   BM_edge_loop_pair(e, &l1, &l2))
+               {
+                       /* edge has exactly two neighboring faces, check angle */
+                       const float angle = angle_normalized_v3v3(l1->f->no, l2->f->no);
 
-               if (fabsf(angle) < sharp) {
-                       BM_edge_select_set(em->bm, e, TRUE);
+                       if (fabsf(angle) > sharp) {
+                               BM_edge_select_set(em->bm, e, TRUE);
+                       }
                }
-
        }
 
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@@ -2369,7 +2363,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot)
        /* props */
        prop = RNA_def_float_rotation(ot->srna, "sharpness", 0, NULL, DEG2RADF(0.01f), DEG2RADF(180.0f),
                                      "Sharpness", "", DEG2RADF(1.0f), DEG2RADF(180.0f));
-       RNA_def_property_float_default(prop, DEG2RADF(1.0f));
+       RNA_def_property_float_default(prop, DEG2RADF(30.0f));
 }
 
 static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
index 06dcac0..a7467ee 100644 (file)
@@ -442,18 +442,20 @@ int join_mesh_exec(bContext *C, wmOperator *op)
                        }
                        
                        if (me->totpoly) {
-                               /* make mapping for materials */
-                               for (a = 1; a <= base->object->totcol; a++) {
-                                       ma = give_current_material(base->object, a);
+                               if (totmat) {
+                                       /* make mapping for materials */
+                                       for (a = 1; a <= base->object->totcol; a++) {
+                                               ma = give_current_material(base->object, a);
 
-                                       for (b = 0; b < totcol; b++) {
-                                               if (ma == matar[b]) {
-                                                       matmap[a - 1] = b;
-                                                       break;
+                                               for (b = 0; b < totcol; b++) {
+                                                       if (ma == matar[b]) {
+                                                               matmap[a - 1] = b;
+                                                               break;
+                                                       }
                                                }
                                        }
                                }
-                               
+
                                CustomData_merge(&me->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
                                CustomData_copy_data(&me->pdata, &pdata, 0, polyofs, me->totpoly);
                                
index b57500d..a17d84a 100644 (file)
@@ -98,12 +98,14 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
 
 static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       Object *ob= ED_object_context(C);
+       Object *ob = ED_object_context(C);
        Scene *scene = CTX_data_scene(C);
-       int mode_orig = ob->mode;
+       int mode_orig;
+
        if (!scene || !ob)
                return OPERATOR_CANCELLED;
 
+       mode_orig = ob->mode;
        object_remove_particle_system(scene, ob);
 
        /* possible this isn't the active object
index 9f9d0ba..50a210e 100644 (file)
@@ -1370,12 +1370,12 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if (event->type == EVT_ACTIONZONE_AREA) {
                sActionzoneData *sad = event->customdata;
                
-               if (sad->modifier > 0) {
+               if (sad == NULL || sad->modifier > 0) {
                        return OPERATOR_PASS_THROUGH;
                }
                
                /* verify *sad itself */
-               if (sad == NULL || sad->sa1 == NULL || sad->az == NULL)
+               if (sad->sa1 == NULL || sad->az == NULL)
                        return OPERATOR_PASS_THROUGH;
                
                /* is this our *sad? if areas not equal it should be passed on */
@@ -2284,12 +2284,12 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if (event->type == EVT_ACTIONZONE_AREA) {
                sActionzoneData *sad = event->customdata;
                
-               if (sad->modifier > 0) {
+               if (sad == NULL || sad->modifier > 0) {
                        return OPERATOR_PASS_THROUGH;
                }
                
                /* verify *sad itself */
-               if (sad == NULL || sad->sa1 == NULL || sad->sa2 == NULL)
+               if (sad->sa1 == NULL || sad->sa2 == NULL)
                        return OPERATOR_PASS_THROUGH;
                
                /* is this our *sad? if areas equal it should be passed on */
index 29571a6..386342d 100644 (file)
@@ -5381,8 +5381,8 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
 
                if (!imapaint->paintcursor) {
                        imapaint->paintcursor =
-                               WM_paint_cursor_activate(wm, image_paint_poll,
-                                                                                brush_drawcursor, NULL);
+                               WM_paint_cursor_activate(wm, image_paint_poll,
+                                                        brush_drawcursor, NULL);
                }
        }
 }
index cdecda6..0e82d86 100644 (file)
@@ -341,7 +341,7 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
 {
        /* callback when opening texture user selection menu, to create buttons. */
        SpaceButs *sbuts = CTX_wm_space_buts(C);
-       ButsContextTexture *ct = (sbuts) ? sbuts->texuser : NULL;
+       ButsContextTexture *ct = sbuts->texuser;
        ButsTextureUser *user;
        uiBlock *block = uiLayoutGetBlock(layout);
        const char *last_category = NULL;
index 91c91f5..4fae060 100644 (file)
@@ -648,23 +648,22 @@ static void update_group_output_cb(bContext *UNUSED(C), void *UNUSED(snode_v), v
 static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock,
                                    int in_out, float xoffset, float yoffset)
 {
-       bNodeTree *ngroup = (bNodeTree *)gnode->id;
-       uiBut *bt;
-       const char *ui_name = IFACE_(sock->name);
-       
        if (sock->flag & SOCK_DYNAMIC) {
-               bt = uiDefBut(gnode->block, TEX, 0, "", 
-                             sock->locx + xoffset, sock->locy + 1 + yoffset, 72, NODE_DY,
-                             sock->name, 0, sizeof(sock->name), 0, 0, "");
+               bNodeTree *ngroup = (bNodeTree *)gnode->id;
+               uiBut *but;
+               but = uiDefBut(gnode->block, TEX, 0, "",
+                              sock->locx + xoffset, sock->locy + 1 + yoffset, 72, NODE_DY,
+                              sock->name, 0, sizeof(sock->name), 0, 0, "");
                if (in_out == SOCK_IN)
-                       uiButSetFunc(bt, update_group_input_cb, snode, ngroup);
+                       uiButSetFunc(but, update_group_input_cb, snode, ngroup);
                else
-                       uiButSetFunc(bt, update_group_output_cb, snode, ngroup);
+                       uiButSetFunc(but, update_group_output_cb, snode, ngroup);
        }
        else {
+               const char *ui_name = IFACE_(sock->name);
                uiDefBut(gnode->block, LABEL, 0, ui_name,
                         sock->locx + xoffset, sock->locy + 1 + yoffset, 72, NODE_DY,
-                        NULL, 0, sizeof(ui_name), 0, 0, "");
+                        NULL, 0, 0, 0, 0, "");
        }
 }
 
index 77583ae..b76cc05 100644 (file)
@@ -950,7 +950,7 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
                int toselect = (link->tonode && (link->tonode->flag & NODE_SELECT) && link->tonode != gnode);
                linkn = link->next;
 
-               if (gnode && ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode))) {
+               if ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode)) {
                        /* remove all links to/from the gnode.
                         * this can remove link information, but there's no general way to preserve it.
                         */
index 90da382..d1f0d8f 100644 (file)
@@ -7232,7 +7232,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
                                                setlinestyle(0);
                                        }
                                }
-                               else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti) && (cti->get_constraint_targets)) {
+                               else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti->get_constraint_targets)) {
                                        cti->get_constraint_targets(curcon, &targets);
                                        
                                        for (ct = targets.first; ct; ct = ct->next) {
index e7a2c1d..181f9fe 100644 (file)
@@ -5609,6 +5609,9 @@ static void createTransNodeData(bContext *UNUSED(C), TransInfo *t)
                return;
        }
 
+       /* nodes dont support PET and probably never will */
+       t->flag &= ~(T_PROP_EDIT | T_PROP_CONNECTED);
+
        /* set transform flags on nodes */
        for (node = snode->edittree->nodes.first; node; node = node->next) {
                if (node->flag & NODE_SELECT && is_node_parent_select(node) == FALSE) {
index b0a2a24..23d6b0a 100644 (file)
@@ -89,7 +89,9 @@ void ED_editors_init(bContext *C)
        }
 
        /* image editor paint mode */
-       ED_space_image_paint_update(wm, sce->toolsettings);
+       if (sce) {
+               ED_space_image_paint_update(wm, sce->toolsettings);
+       }
 }
 
 /* frees all editmode stuff */
index 900bc77..d67de3b 100644 (file)
@@ -48,12 +48,6 @@ static int imb_ftype_default(ImFileType *type, ImBuf *ibuf)
 {
        return (ibuf->ftype & type->filetype);
 }
-#if defined(__APPLE__) && defined(IMBUF_COCOA)
-static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf)
-{
-       return (ibuf->ftype & TIF);
-}
-#endif
 static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf)
 {
        (void)type;
@@ -83,8 +77,6 @@ ImFileType IMB_FILE_TYPES[] = {
 #endif
 #ifdef WITH_TIFF
        {imb_inittiff, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF},
-#elif defined(__APPLE__) && defined(IMBUF_COCOA)
-       {NULL, NULL, imb_is_a_cocoa, imb_ftype_cocoa, imb_imb_cocoaLoadImage, imb_savecocoa, NULL, 0, TIF},
 #endif
 #ifdef WITH_HDR
        {NULL, NULL, imb_is_a_hdr, imb_ftype_default, imb_loadhdr, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR},
diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m
deleted file mode 100644 (file)
index d099c8a..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Damien Plisson 10/2009
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/imbuf/intern/imbuf_cocoa.m
- *  \ingroup imbuf
- *
- * Provides image file loading and saving for Blender, via Cocoa.
- */
-
-#include <stdint.h>
-#include <string.h>
-#import <Cocoa/Cocoa.h>
-
-#include "imbuf.h"
-
-#include "IMB_cocoa.h"
-
-#include "BKE_global.h"
-#include "BKE_colortools.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "IMB_allocimbuf.h"
-
-
-
-#pragma mark load/save functions
-
-/**
- * Loads an image from the supplied buffer
- *
- * Loads any Core Graphics supported type
- * Currently is : TIFF, BMP, JPEG, GIF, PNG, DIB, ICO, and various RAW formats
- *
- * \param mem:   Memory containing the bitmap image
- * \param size:  Size of the mem buffer.
- * \param flags: If flags has IB_test set then the file is not actually loaded,
- *                but all other operations take place.
- *
- * \return: A newly allocated ImBuf structure if successful, otherwise NULL.
- */
-struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags)
-{
-       struct ImBuf *ibuf = NULL;
-       NSSize bitmapSize;
-       uchar *rasterRGB = NULL;
-       uchar *rasterRGBA = NULL;
-       uchar *toIBuf = NULL;
-       int x, y, to_i, from_i;
-       NSData *data;
-       NSBitmapImageRep *bitmapImage;
-       NSBitmapImageRep *blBitmapFormatImageRGB,*blBitmapFormatImageRGBA;
-       NSAutoreleasePool *pool;
-       
-       pool = [[NSAutoreleasePool alloc] init];
-       
-       data = [NSData dataWithBytes:mem length:size];
-       bitmapImage = [[NSBitmapImageRep alloc] initWithData:data];
-
-       if (!bitmapImage) {
-               fprintf(stderr, "imb_cocoaLoadImage: error loading image\n");
-               [pool drain];
-               return NULL;
-       }
-       
-       bitmapSize.width = [bitmapImage pixelsWide];
-       bitmapSize.height = [bitmapImage pixelsHigh];
-       
-       /* Tell cocoa image resolution is same as current system one */
-       [bitmapImage setSize:bitmapSize];
-       
-       /* allocate the image buffer */
-       ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0);
-       if (!ibuf) {
-               fprintf(stderr,
-                       "imb_cocoaLoadImage: could not allocate memory for the image.\n");
-               [bitmapImage release];
-               [pool drain];
-               return NULL;
-       }
-
-       /* read in the image data */
-       if (!(flags & IB_test)) {
-
-               /* allocate memory for the ibuf->rect */
-               imb_addrectImBuf(ibuf);
-
-               /* Convert the image in a RGBA 32bit format */
-               /* As Core Graphics does not support contextes with non premutliplied alpha,
-                we need to get alpha key values in a separate batch */
-               
-               /* First get RGB values w/o Alpha to avoid pre-multiplication, 32bit but last byte is unused */
-               blBitmapFormatImageRGB = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                                                                                                         pixelsWide:bitmapSize.width 
-                                                                                                                                         pixelsHigh:bitmapSize.height
-                                                                                                                                  bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO
-                                                                                                                                 colorSpaceName:NSCalibratedRGBColorSpace 
-                                                                                                                                       bitmapFormat:0
-                                                                                                                                        bytesPerRow:4*bitmapSize.width
-                                                                                                                                       bitsPerPixel:32/*RGB format padded to 32bits*/];
-                               
-               [NSGraphicsContext saveGraphicsState];
-               [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:blBitmapFormatImageRGB]];
-               [bitmapImage draw];
-               [NSGraphicsContext restoreGraphicsState];
-               
-               rasterRGB = (uchar*)[blBitmapFormatImageRGB bitmapData];
-               if (rasterRGB == NULL) {
-                       [bitmapImage release];
-                       [blBitmapFormatImageRGB release];
-                       [pool drain];
-                       return NULL;
-               }
-
-               /* Then get Alpha values by getting the RGBA image (that is premultiplied btw) */
-               blBitmapFormatImageRGBA = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                                                                                                                 pixelsWide:bitmapSize.width
-                                                                                                                                                 pixelsHigh:bitmapSize.height
-                                                                                                                                          bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO
-                                                                                                                                         colorSpaceName:NSCalibratedRGBColorSpace
-                                                                                                                                               bitmapFormat:0
-                                                                                                                                                bytesPerRow:4*bitmapSize.width
-                                                                                                                                               bitsPerPixel:32/* RGBA */];
-               
-               [NSGraphicsContext saveGraphicsState];
-               [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:blBitmapFormatImageRGBA]];
-               [bitmapImage draw];
-               [NSGraphicsContext restoreGraphicsState];
-               
-               rasterRGBA = (uchar*)[blBitmapFormatImageRGBA bitmapData];
-               if (rasterRGBA == NULL) {
-                       [bitmapImage release];
-                       [blBitmapFormatImageRGB release];
-                       [blBitmapFormatImageRGBA release];
-                       [pool drain];
-                       return NULL;
-               }
-               
-               /*Copy the image to ibuf, flipping it vertically*/
-               toIBuf = (uchar*)ibuf->rect;
-               for (x = 0; x < bitmapSize.width; x++) {
-                       for (y = 0; y < bitmapSize.height; y++) {
-                               to_i = (bitmapSize.height-y-1)*bitmapSize.width + x;
-                               from_i = y*bitmapSize.width + x;
-
-                               toIBuf[4*to_i] = rasterRGB[4*from_i]; /* R */
-                               toIBuf[4*to_i+1] = rasterRGB[4*from_i+1]; /* G */
-                               toIBuf[4*to_i+2] = rasterRGB[4*from_i+2]; /* B */
-                               toIBuf[4*to_i+3] = rasterRGBA[4*from_i+3]; /* A */
-                       }
-               }
-
-               [blBitmapFormatImageRGB release];
-               [blBitmapFormatImageRGBA release];
-       }
-
-       /* release the cocoa objects */
-       [bitmapImage release];
-       [pool drain];
-
-       if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
-
-       ibuf->ftype = TIF;
-       ibuf->profile = IB_PROFILE_SRGB;
-
-       /* return successfully */
-       return (ibuf);
-}
-
-/**
- * Saves an image to a file.
- *
- * ImBuf structures with 1, 3 or 4 bytes per pixel (GRAY, RGB, RGBA 
- * respectively) are accepted, and interpreted correctly. 
- *
- * Accepted formats: TIFF, GIF, BMP, PNG, JPEG, JPEG2000
- *
- * \param ibuf:  Image buffer.
- * \param name:  Name of the image file to create.
- * \param flags: Currently largely ignored.
- *
- * \return: 1 if the function is successful, 0 on failure.
- */
-
-#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
-
-short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags)
-{
-       uint16_t samplesperpixel, bitspersample;
-       unsigned char *from = NULL, *to = NULL;
-       unsigned short *to16 = NULL;
-       float *fromf = NULL;
-       int x, y, from_i, to_i, i;
-       int success;
-       BOOL hasAlpha;
-       NSString* colorSpace;
-       NSBitmapImageRep *blBitmapFormatImage;
-       NSData *dataToWrite;
-       NSDictionary *imageProperties;
-       
-       NSAutoreleasePool *pool;
-       
-       if (!ibuf) return FALSE;
-       if (!name) return FALSE;
-       
-       /* check for a valid number of bytes per pixel.  Like the PNG writer,
-        * the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
-        * to gray, RGB, RGBA respectively. */
-       samplesperpixel = (uint16_t)((ibuf->planes + 7) >> 3);
-       switch (samplesperpixel) {
-               case 4: /*RGBA type*/
-                       hasAlpha = YES;
-                       colorSpace = NSCalibratedRGBColorSpace;
-                       break;
-               case 3: /*RGB type*/
-                       hasAlpha = NO;
-                       colorSpace = NSCalibratedRGBColorSpace;
-                       break;
-               case 1:
-                       hasAlpha = NO;
-                       colorSpace = NSCalibratedWhiteColorSpace;
-                       break;
-               default:
-                       fprintf(stderr,
-                               "imb_cocoaSaveImage: unsupported number of bytes per "
-                               "pixel: %d\n", samplesperpixel);
-                       return (0);
-       }
-
-       if((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
-               bitspersample = 16;
-       else
-               bitspersample = 8;
-
-       pool = [[NSAutoreleasePool alloc] init];
-       
-       /* Create bitmap image rep in blender format */
-       blBitmapFormatImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                                     pixelsWide:ibuf->x
-                                                                     pixelsHigh:ibuf->y
-                                                                  bitsPerSample:bitspersample samplesPerPixel:samplesperpixel hasAlpha:hasAlpha isPlanar:NO
-                                                                 colorSpaceName:colorSpace
-                                                                   bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
-                                                                    bytesPerRow:(ibuf->x*bitspersample*samplesperpixel/8)
-                                                                   bitsPerPixel:(bitspersample*samplesperpixel)];
-       if (!blBitmapFormatImage) {
-           [pool drain];
-           return FALSE;
-       }
-       
-       /* setup pointers */
-       if(bitspersample == 16) {
-               fromf = ibuf->rect_float;
-               to16   = (unsigned short*)[blBitmapFormatImage bitmapData];
-       }
-       else {
-               from = (unsigned char*)ibuf->rect;
-               to   = (unsigned char*)[blBitmapFormatImage bitmapData];
-       }
-
-       /* copy pixel data.  While copying, we flip the image vertically. */
-       for (x = 0; x < ibuf->x; x++) {
-               for (y = 0; y < ibuf->y; y++) {
-                       from_i = 4*(y*ibuf->x+x);
-                       to_i   = samplesperpixel*((ibuf->y-y-1)*ibuf->x+x);
-                       
-                       if(bitspersample == 16) {
-                               if (ibuf->profile == IB_PROFILE_SRGB) {
-                                       switch (samplesperpixel) {
-                                               case 4 /*RGBA*/:
-                                                       to16[to_i] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i]));
-                                                       to16[to_i+1] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i+1]));
-                                                       to16[to_i+2] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i+2]));
-                                                       to16[to_i+3] = FTOUSHORT(fromf[from_i+3]);
-                                                       break;
-                                               case 3 /*RGB*/:
-                                                       to16[to_i] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i]));
-                                                       to16[to_i+1] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i+1]));
-                                                       to16[to_i+2] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i+2]));
-                                                       break;
-                                               case 1 /*BW*/:
-                                                       to16[to_i] = FTOUSHORT(linearrgb_to_srgb(fromf[from_i]));
-                                                       break;
-                                       }
-                               } 
-                               else {
-                                       for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
-                                                       to16[to_i] = FTOUSHORT(fromf[from_i]);
-                               }
-                       }
-                       else {
-                               /* 8bits per sample*/
-                               for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
-                                       to[to_i] = from[from_i];
-                       }
-               }
-       }
-       
-       /* generate file data */
-       if (IS_tiff(ibuf)) {
-               dataToWrite = [blBitmapFormatImage TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0];
-       }
-       else if (IS_png(ibuf)) {
-               imageProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:false], NSImageInterlaced,
-                                                  nil];
-               dataToWrite = [blBitmapFormatImage representationUsingType:NSPNGFileType properties:imageProperties];
-       }
-       else if (IS_bmp(ibuf)) {
-               dataToWrite = [blBitmapFormatImage representationUsingType:NSBMPFileType properties:nil];
-       }
-       else {/* JPEG by default */
-               int quality;
-               
-               quality = ibuf->ftype & 0xff;
-               if (quality <= 0) quality = 90; /* Standard quality if wrong supplied*/
-               if (quality > 100) quality = 100;
-               
-               imageProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:quality], NSImageCompressionFactor,
-                                                  [NSNumber numberWithBool:true], NSImageProgressive, 
-                                                  nil];
-               dataToWrite = [blBitmapFormatImage representationUsingType:NSJPEGFileType properties:imageProperties];
-       }
-
-       /* Write the file */
-       success = [dataToWrite writeToFile:[NSString stringWithCString:name encoding:NSISOLatin1StringEncoding]
-                                 atomically:YES];
-
-       [blBitmapFormatImage release];
-       [pool drain];
-       
-       return success;
-}
-
-#pragma mark format checking functions
-
-/* Currently, only tiff format is handled, so need to include here function that was previously in tiff.c */
-
-/**
- * Checks whether a given memory buffer contains a TIFF file.
- *
- * FIXME: Possible memory leak if mem is less than IMB_TIFF_NCB bytes long.
- *        However, changing this will require up-stream modifications.
- *
- * This method uses the format identifiers from:
- *     http://www.faqs.org/faqs/graphics/fileformats-faq/part4/section-9.html
- * The first four bytes of big-endian and little-endian TIFF files
- * respectively are (hex):
- *     4d 4d 00 2a
- *     49 49 2a 00
- * Note that TIFF files on *any* platform can be either big- or little-endian;
- * it's not platform-specific.
- *
- * AFAICT, libtiff doesn't provide a method to do this automatically, and
- * hence my manual comparison. - Jonathan Merritt (lancelet) 4th Sept 2005.
- */
-#define IMB_TIFF_NCB 4         /* number of comparison bytes used */
-int imb_is_a_tiff(void *mem)
-{
-       char big_endian[IMB_TIFF_NCB] = { 0x4d, 0x4d, 0x00, 0x2a };
-       char lil_endian[IMB_TIFF_NCB] = { 0x49, 0x49, 0x2a, 0x00 };
-       
-       return ( (memcmp(big_endian, mem, IMB_TIFF_NCB) == 0) ||
-                       (memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) );
-}
index e76a599..13b0fc1 100644 (file)
@@ -522,15 +522,13 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
                
        }
 
-       if (ibuf) {
-               ibuf->ftype = IMAGIC;
-               ibuf->profile = IB_PROFILE_SRGB;
+       ibuf->ftype = IMAGIC;
+       ibuf->profile = IB_PROFILE_SRGB;
 
-               test_endian_zbuf(ibuf);
+       test_endian_zbuf(ibuf);
 
-               if (ibuf->rect) {
-                       IMB_convert_rgba_to_abgr(ibuf);
-               }
+       if (ibuf->rect) {
+               IMB_convert_rgba_to_abgr(ibuf);
        }
 
        return(ibuf);
index 8a23740..307982e 100644 (file)
@@ -556,7 +556,7 @@ Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
 
 void rna_Main_masks_remove(Main *bmain, Mask *mask)
 {
-       BKE_mask_unlink(bmain, mask);
+       BKE_mask_free(bmain, mask);
        BKE_libblock_free(&bmain->mask, mask);
        /* XXX python now has invalid pointer? */
 }
index f8626d3..c9960df 100644 (file)
@@ -789,7 +789,6 @@ static void force_hidden_passes(bNode *node, int passflag)
        if (!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
        sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
        if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
 }
 
 /* based on rules, force sockets hidden always */
index ebacdee..2d694a3 100644 (file)
@@ -246,32 +246,24 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
                                        done++;
                                }
                                else {
-                                       mul_m4_v3(re->viewmat, vec);
+                                       if (re)
+                                               mul_m4_v3(re->viewmat, vec);
                                        
                                        /* in vec are global coordinates
                                         * calculate distance to camera
                                         * and using that, define the alpha
                                         */
-                                       
-                                       {
-                                               float tx, ty, tz;
-                                               
-                                               tx = vec[0];
-                                               ty = vec[1];
-                                               tz = vec[2];
-                                               
-                                               alpha = sqrt(tx * tx + ty * ty + tz * tz);
-                                               
-                                               if (alpha >= clipend) alpha = 0.0;
-                                               else if (alpha <= starmindist) alpha = 0.0;
-                                               else if (alpha <= 2.0f * starmindist) {
-                                                       alpha = (alpha - starmindist) / starmindist;
-                                               }
-                                               else {
-                                                       alpha -= 2.0f * starmindist;
-                                                       alpha /= (clipend - 2.0f * starmindist);
-                                                       alpha = 1.0f - alpha;
-                                               }
+                                       alpha = len_v3(vec);
+
+                                       if (alpha >= clipend) alpha = 0.0;
+                                       else if (alpha <= starmindist) alpha = 0.0;
+                                       else if (alpha <= 2.0f * starmindist) {
+                                               alpha = (alpha - starmindist) / starmindist;
+                                       }
+                                       else {
+                                               alpha -= 2.0f * starmindist;
+                                               alpha /= (clipend - 2.0f * starmindist);
+                                               alpha = 1.0f - alpha;
                                        }
                                        
                                        
index 92c390e..06251cd 100644 (file)
@@ -431,7 +431,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
        // reverting to texunit 0, without this we get bug [#28462]
        glActiveTextureARB(GL_TEXTURE0);
 
-       glViewport(rect.GetLeft(), rect.GetBottom(), rect_width, rect.GetHeight()+1);
+       glViewport(rect.GetLeft(), rect.GetBottom(), rect_width, rect_height);
 
        glDisable(GL_DEPTH_TEST);
        // in case the previous material was wire