Merging r50248 through r50264 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 29 Aug 2012 12:49:10 +0000 (12:49 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 29 Aug 2012 12:49:10 +0000 (12:49 +0000)
35 files changed:
intern/ghost/intern/GHOST_WindowCocoa.mm
release/scripts/modules/bl_i18n_utils/spell_check_utils.py
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_world.h
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/world.c
source/blender/blenlib/BLI_path_util.h
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/path_util.c
source/blender/blenloader/intern/readfile.c
source/blender/compositor/intern/COM_SocketReader.h
source/blender/compositor/nodes/COM_RotateNode.cpp
source/blender/compositor/nodes/COM_Stabilize2dNode.cpp
source/blender/compositor/nodes/COM_TransformNode.cpp
source/blender/editors/render/render_preview.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_image/image_ops.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_pose.c
source/blender/nodes/intern/node_util.c
source/blender/nodes/intern/node_util.h
source/blender/nodes/shader/nodes/node_shader_curves.c
source/blender/nodes/texture/nodes/node_texture_curves.c
source/blender/python/generic/py_capi_utils.c
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c
source/blender/python/mathutils/mathutils_geometry.c

index 31f91802e381e57d1dd940cdb76d08fb26b5d2b2..294766cba2440ccfecd5e5bbd51e9f1ce3c3312c 100644 (file)
@@ -1150,7 +1150,7 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
                        /******* Multithreaded opengl code : uncomment for enabling
                        cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj];
                        if (CGLEnable(cglCtx, kCGLCEMPEngine) == kCGLNoError)
-                               printf("\nSwitched openGL to multithreaded mode");
+                               printf("\nSwitched openGL to multithreaded mode\n");
                         */
                        
                        if (!s_firstOpenGLcontext) s_firstOpenGLcontext = tmpOpenGLContext;
index ef4926c4a982c7fc6c3b50bd24f0efb8a5a12ad8..46b369146b748346602bc61895665eaa4ae553fd 100644 (file)
@@ -329,6 +329,7 @@ dict_uimsgs = {
     "bweight",
     "colorband",
     "datablock", "datablocks",
+    "despeckle",
     "dopesheet",
     "dupliface", "duplifaces",
     "dupliframe", "dupliframes",
index b1ca348be86fb0b774f8c214866bf9e3b134d2f8..6e0dec33453f604b9ba83ab971e1d5575434fd41 100644 (file)
@@ -107,6 +107,12 @@ struct RenderResult;
 #define IMA_TYPE_R_RESULT   4
 #define IMA_TYPE_COMPOSITE  5
 
+enum {
+       IMA_GENTYPE_BLANK = 0,
+       IMA_GENTYPE_GRID = 1,
+       IMA_GENTYPE_GRID_COLOR = 2
+};
+
 /* ima->ok */
 #define IMA_OK              1
 #define IMA_OK_LOADED       2
index 67896fffc4d046623f256a68d58f6ef31368362e..7a23bff0184048d570ddf8f7fe96e9ccaf5d74aa 100644 (file)
@@ -35,7 +35,8 @@
 
 struct World;
 
-void BKE_world_free(struct World *sc); 
+void BKE_world_free(struct World *sc);
+void BKE_world_free_ex(struct World *sc, int do_id_user);
 struct World *add_world(const char *name);
 struct World *BKE_world_copy(struct World *wrld);
 struct World *localize_world(struct World *wrld);
index 5138d68cf790e75e1c646d48f49c1a9e3a724ce7..252add2c4233bbee3db482ec9c96045b9cc3e32b 100644 (file)
@@ -106,9 +106,18 @@ void curvemapping_free_data(CurveMapping *cumap)
        int a;
 
        for (a = 0; a < CM_TOT; a++) {
-               if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
-               if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
-               if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
+               if (cumap->cm[a].curve) {
+                       MEM_freeN(cumap->cm[a].curve);
+                       cumap->cm[a].curve = NULL;
+               }
+               if (cumap->cm[a].table) {
+                       MEM_freeN(cumap->cm[a].table);
+                       cumap->cm[a].table = NULL;
+               }
+               if (cumap->cm[a].premultable) {
+                       MEM_freeN(cumap->cm[a].premultable);
+                       cumap->cm[a].premultable = NULL;
+               }
        }
 }
 
index af1fc1bf8cf3b593130b1c8963752e1649d06128..d74a7f6e374781822350147076fa7d75ee0ca6a7 100644 (file)
@@ -601,7 +601,7 @@ Image *BKE_image_load_exists(const char *filepath)
        return BKE_image_load(filepath);
 }
 
-static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4])
+static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
 {
        ImBuf *ibuf;
        unsigned char *rect = NULL;
@@ -621,11 +621,11 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
        BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
        ibuf->userflags |= IB_BITMAPDIRTY;
 
-       switch (uvtestgrid) {
-               case 1:
+       switch (gen_type) {
+               case IMA_GENTYPE_GRID:
                        BKE_image_buf_fill_checker(rect, rect_float, width, height);
                        break;
-               case 2:
+               case IMA_GENTYPE_GRID_COLOR:
                        BKE_image_buf_fill_checker_color(rect, rect_float, width, height);
                        break;
                default:
@@ -636,7 +636,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
 }
 
 /* adds new image block, creates ImBuf and initializes color */
-Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4])
+Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
 {
        /* on save, type is changed to FILE in editsima.c */
        Image *ima = image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
@@ -647,10 +647,10 @@ Image *BKE_image_add_generated(unsigned int width, unsigned int height, const ch
                /* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
                ima->gen_x = width;
                ima->gen_y = height;
-               ima->gen_type = uvtestgrid;
+               ima->gen_type = gen_type;
                ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
 
-               ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, uvtestgrid, color);
+               ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color);
                image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
 
                ima->ok = IMA_OK_LOADED;
index e073cfdf76df57c675b1c4c78e8c36168dae8fd8..9f770e0a9a70c969d339693ed82a3f451dbd643f 100644 (file)
@@ -1528,7 +1528,7 @@ void BKE_library_filepath_set(Library *lib, const char *filepath)
 
        /* not essential but set filepath is an absolute copy of value which
         * is more useful if its kept in sync */
-       if (strncmp(lib->filepath, "//", 2) == 0) {
+       if (BLI_path_is_rel(lib->filepath)) {
                /* note that the file may be unsaved, in this case, setting the
                 * filepath on an indirectly linked path is not allowed from the
                 * outliner, and its not really supported but allow from here for now
index 039fb2c22f3996fe66fa38f3bd77ab6465ff2fdb..eebcf12a7999ff1b93e771527315ba92d743c026 100644 (file)
@@ -163,11 +163,13 @@ static void converge(const float p1[3], const float p2[3], float v1, float v2,
                      float (*function)(float, float, float), float p[3], MetaBall *mb, int f);
 
 /* Global variables */
+static struct {
+       float thresh;
+       int totelem;
+       MetaElem **mainb;
+       octal_tree *metaball_tree;
+} G_mb = {0};
 
-static float thresh = 0.6f;
-static int totelem = 0;
-static MetaElem **mainb;
-static octal_tree *metaball_tree = NULL;
 /* Functions */
 
 void BKE_mball_unlink(MetaBall *mb)
@@ -523,7 +525,7 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
        char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
 
        BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.');
-       totelem = 0;
+       G_mb.totelem = 0;
 
        /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */
        if (F_ERROR == BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL))
@@ -564,9 +566,10 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
                                }
                        }
                        
-                       while (ml) {
-                               if (!(ml->flag & MB_HIDE)) totelem++;
-                               ml = ml->next;
+                       for ( ; ml; ml = ml->next) {
+                               if (!(ml->flag & MB_HIDE)) {
+                                       G_mb.totelem++;
+                               }
                        }
                }
        }
@@ -633,66 +636,65 @@ static float densfunc(MetaElem *ball, float x, float y, float z)
 
        mul_m4_v3((float (*)[4])ball->imat, dvec);
 
-       if (ball->type == MB_BALL) {
-       }
-       else if (ball->type == MB_TUBEX) {
-               if      (dvec[0] >  ball->len) dvec[0] -= ball->len;
-               else if (dvec[0] < -ball->len) dvec[0] += ball->len;
-               else                           dvec[0] = 0.0;
-       }
-       else if (ball->type == MB_TUBEY) {
-               if      (dvec[1] >  ball->len) dvec[1] -= ball->len;
-               else if (dvec[1] < -ball->len) dvec[1] += ball->len;
-               else                           dvec[1] = 0.0;
-       }
-       else if (ball->type == MB_TUBEZ) {
-               if      (dvec[2] >  ball->len) dvec[2] -= ball->len;
-               else if (dvec[2] < -ball->len) dvec[2] += ball->len;
-               else                           dvec[2] = 0.0;
-       }
-       else if (ball->type == MB_TUBE) {
-               if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
-               else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
-               else                            dvec[0] = 0.0;
-       }
-       else if (ball->type == MB_PLANE) {
-               if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
-               else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
-               else                            dvec[0] = 0.0;
-               if      (dvec[1] >  ball->expy) dvec[1] -= ball->expy;
-               else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
-               else                            dvec[1] = 0.0;
-       }
-       else if (ball->type == MB_ELIPSOID) {
-               dvec[0] *= 1 / ball->expx;
-               dvec[1] *= 1 / ball->expy;
-               dvec[2] *= 1 / ball->expz;
-       }
-       else if (ball->type == MB_CUBE) {
-               if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
-               else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
-               else                            dvec[0] = 0.0;
-               if      (dvec[1] >  ball->expy) dvec[1] -= ball->expy;
-               else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
-               else                            dvec[1] = 0.0;
-               if      (dvec[2] >  ball->expz) dvec[2] -= ball->expz;
-               else if (dvec[2] < -ball->expz) dvec[2] += ball->expz;
-               else                            dvec[2] = 0.0;
-       }
-
-       dist2 = len_v3(dvec);
-
-       if (ball->flag & MB_NEGATIVE) {
-               dist2 = 1.0f - (dist2 / ball->rad2);
-               if (dist2 < 0.0f) return 0.5f;
-
-               return 0.5f - ball->s * dist2 * dist2 * dist2;
+       switch (ball->type) {
+               case MB_BALL:
+                       /* do nothing */
+                       break;
+               case MB_TUBEX:
+                       if      (dvec[0] >  ball->len) dvec[0] -= ball->len;
+                       else if (dvec[0] < -ball->len) dvec[0] += ball->len;
+                       else                           dvec[0] = 0.0;
+                       break;
+               case MB_TUBEY:
+                       if      (dvec[1] >  ball->len) dvec[1] -= ball->len;
+                       else if (dvec[1] < -ball->len) dvec[1] += ball->len;
+                       else                           dvec[1] = 0.0;
+                       break;
+               case MB_TUBEZ:
+                       if      (dvec[2] >  ball->len) dvec[2] -= ball->len;
+                       else if (dvec[2] < -ball->len) dvec[2] += ball->len;
+                       else                           dvec[2] = 0.0;
+                       break;
+               case MB_TUBE:
+                       if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
+                       else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+                       else                            dvec[0] = 0.0;
+                       break;
+               case MB_PLANE:
+                       if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
+                       else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+                       else                            dvec[0] = 0.0;
+                       if      (dvec[1] >  ball->expy) dvec[1] -= ball->expy;
+                       else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
+                       else                            dvec[1] = 0.0;
+                       break;
+               case MB_ELIPSOID:
+                       dvec[0] /= ball->expx;
+                       dvec[1] /= ball->expy;
+                       dvec[2] /= ball->expz;
+                       break;
+               case MB_CUBE:
+                       if      (dvec[0] >  ball->expx) dvec[0] -= ball->expx;
+                       else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+                       else                            dvec[0] = 0.0;
+
+                       if      (dvec[1] >  ball->expy) dvec[1] -= ball->expy;
+                       else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
+                       else                            dvec[1] = 0.0;
+
+                       if      (dvec[2] >  ball->expz) dvec[2] -= ball->expz;
+                       else if (dvec[2] < -ball->expz) dvec[2] += ball->expz;
+                       else                            dvec[2] = 0.0;
+                       break;
        }
-       else {
-               dist2 = 1.0f - (dist2 / ball->rad2);
-               if (dist2 < 0.0f) return -0.5f;
 
-               return ball->s * dist2 * dist2 * dist2 - 0.5f;
+       dist2 = 1.0f - (len_v3(dvec) / ball->rad2);
+
+       if ((ball->flag & MB_NEGATIVE) == 0) {
+               return (dist2 < 0.0f) ? -0.5f : (ball->s * dist2 * dist2 * dist2) - 0.5f;
+       }
+       else {
+               return (dist2 < 0.0f) ? 0.5f : 0.5f - (ball->s * dist2 * dist2 * dist2);
        }
 }
 
@@ -772,30 +774,27 @@ static float metaball(float x, float y, float z)
        float dens = 0;
        int a;
        
-       if (totelem > 1) {
-               node = find_metaball_octal_node(metaball_tree->first, x, y, z, metaball_tree->depth);
+       if (G_mb.totelem > 1) {
+               node = find_metaball_octal_node(G_mb.metaball_tree->first, x, y, z, G_mb.metaball_tree->depth);
                if (node) {
-                       ml_p = node->elems.first;
-
-                       while (ml_p) {
+                       for (ml_p = node->elems.first; ml_p; ml_p = ml_p->next) {
                                dens += densfunc(ml_p->ml, x, y, z);
-                               ml_p = ml_p->next;
                        }
 
-                       dens += -0.5f * (metaball_tree->pos - node->pos);
-                       dens += 0.5f * (metaball_tree->neg - node->neg);
+                       dens += -0.5f * (G_mb.metaball_tree->pos - node->pos);
+                       dens +=  0.5f * (G_mb.metaball_tree->neg - node->neg);
                }
                else {
-                       for (a = 0; a < totelem; a++) {
-                               dens += densfunc(mainb[a], x, y, z);
+                       for (a = 0; a < G_mb.totelem; a++) {
+                               dens += densfunc(G_mb.mainb[a], x, y, z);
                        }
                }
        }
        else {
-               dens += densfunc(mainb[0], x, y, z);
+               dens += densfunc(G_mb.mainb[0], x, y, z);
        }
 
-       return thresh - dens;
+       return G_mb.thresh - dens;
 }
 
 /* ******************************************** */
@@ -1497,7 +1496,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
        MetaElem *ml;
        float f = 0.0f;
 
-       ml = mainb[a];
+       ml = G_mb.mainb[a];
        f = 1.0 - (mb->thresh / ml->s);
 
        /* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
@@ -1591,10 +1590,12 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
                                                                
                                                                /* add CUBE (with indexes c_i, c_j, c_k) to the stack,
                                                                 * this cube includes found point of Implicit Surface */
-                                                               if (ml->flag & MB_NEGATIVE)
-                                                                       add_cube(mbproc, c_i, c_j, c_k, 2);
-                                                               else
+                                                               if ((ml->flag & MB_NEGATIVE) == 0) {
                                                                        add_cube(mbproc, c_i, c_j, c_k, 1);
+                                                               }
+                                                               else {
+                                                                       add_cube(mbproc, c_i, c_j, c_k, 2);
+                                                               }
                                                        }
                                                        len = len_v3v3(workp, in);
                                                        workp_v = tmp_v;
@@ -1621,7 +1622,7 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
        mbproc->edges = MEM_callocN(2 * HASHSIZE * sizeof(EDGELIST *), "mbproc->edges");
        makecubetable();
 
-       for (a = 0; a < totelem; a++) {
+       for (a = 0; a < G_mb.totelem; a++) {
 
                /* try to find 8 points on the surface for each MetaElem */
                find_first_points(mbproc, mb, a);       
@@ -1714,7 +1715,7 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
                                        ml_count++;
                                        ml = ml->next;
                                }
-                               totelem -= ml_count;
+                               G_mb.totelem -= ml_count;
                        }
                        else {
                                while (ml) {
@@ -1743,9 +1744,9 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
                                                mult_m4_m4m4(temp1, temp2, temp3);
 
                                                /* make a copy because of duplicates */
-                                               mainb[a] = new_pgn_element(sizeof(MetaElem));
-                                               *(mainb[a]) = *ml;
-                                               mainb[a]->bb = new_pgn_element(sizeof(BoundBox));
+                                               G_mb.mainb[a] = new_pgn_element(sizeof(MetaElem));
+                                               *(G_mb.mainb[a]) = *ml;
+                                               G_mb.mainb[a]->bb = new_pgn_element(sizeof(BoundBox));
 
                                                mat = new_pgn_element(4 * 4 * sizeof(float));
                                                imat = new_pgn_element(4 * 4 * sizeof(float));
@@ -1758,70 +1759,70 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
 
                                                invert_m4_m4(imat, mat);
 
-                                               mainb[a]->rad2 = ml->rad * ml->rad;
+                                               G_mb.mainb[a]->rad2 = ml->rad * ml->rad;
 
-                                               mainb[a]->mat = (float *) mat;
-                                               mainb[a]->imat = (float *) imat;
+                                               G_mb.mainb[a]->mat = (float *) mat;
+                                               G_mb.mainb[a]->imat = (float *) imat;
 
                                                /* untransformed Bounding Box of MetaElem */
                                                /* 0 */
-                                               mainb[a]->bb->vec[0][0] = -ml->expx;
-                                               mainb[a]->bb->vec[0][1] = -ml->expy;
-                                               mainb[a]->bb->vec[0][2] = -ml->expz;
+                                               G_mb.mainb[a]->bb->vec[0][0] = -ml->expx;
+                                               G_mb.mainb[a]->bb->vec[0][1] = -ml->expy;
+                                               G_mb.mainb[a]->bb->vec[0][2] = -ml->expz;
                                                /* 1 */
-                                               mainb[a]->bb->vec[1][0] =  ml->expx;
-                                               mainb[a]->bb->vec[1][1] = -ml->expy;
-                                               mainb[a]->bb->vec[1][2] = -ml->expz;
+                                               G_mb.mainb[a]->bb->vec[1][0] =  ml->expx;
+                                               G_mb.mainb[a]->bb->vec[1][1] = -ml->expy;
+                                               G_mb.mainb[a]->bb->vec[1][2] = -ml->expz;
                                                /* 2 */
-                                               mainb[a]->bb->vec[2][0] =  ml->expx;
-                                               mainb[a]->bb->vec[2][1] =  ml->expy;
-                                               mainb[a]->bb->vec[2][2] = -ml->expz;
+                                               G_mb.mainb[a]->bb->vec[2][0] =  ml->expx;
+                                               G_mb.mainb[a]->bb->vec[2][1] =  ml->expy;
+                                               G_mb.mainb[a]->bb->vec[2][2] = -ml->expz;
                                                /* 3 */
-                                               mainb[a]->bb->vec[3][0] = -ml->expx;
-                                               mainb[a]->bb->vec[3][1] =  ml->expy;
-                                               mainb[a]->bb->vec[3][2] = -ml->expz;
+                                               G_mb.mainb[a]->bb->vec[3][0] = -ml->expx;
+                                               G_mb.mainb[a]->bb->vec[3][1] =  ml->expy;
+                                               G_mb.mainb[a]->bb->vec[3][2] = -ml->expz;
                                                /* 4 */
-                                               mainb[a]->bb->vec[4][0] = -ml->expx;
-                                               mainb[a]->bb->vec[4][1] = -ml->expy;
-                                               mainb[a]->bb->vec[4][2] =  ml->expz;
+                                               G_mb.mainb[a]->bb->vec[4][0] = -ml->expx;
+                                               G_mb.mainb[a]->bb->vec[4][1] = -ml->expy;
+                                               G_mb.mainb[a]->bb->vec[4][2] =  ml->expz;
                                                /* 5 */
-                                               mainb[a]->bb->vec[5][0] =  ml->expx;
-                                               mainb[a]->bb->vec[5][1] = -ml->expy;
-                                               mainb[a]->bb->vec[5][2] =  ml->expz;
+                                               G_mb.mainb[a]->bb->vec[5][0] =  ml->expx;
+                                               G_mb.mainb[a]->bb->vec[5][1] = -ml->expy;
+                                               G_mb.mainb[a]->bb->vec[5][2] =  ml->expz;
                                                /* 6 */
-                                               mainb[a]->bb->vec[6][0] =  ml->expx;
-                                               mainb[a]->bb->vec[6][1] =  ml->expy;
-                                               mainb[a]->bb->vec[6][2] =  ml->expz;
+                                               G_mb.mainb[a]->bb->vec[6][0] =  ml->expx;
+                                               G_mb.mainb[a]->bb->vec[6][1] =  ml->expy;
+                                               G_mb.mainb[a]->bb->vec[6][2] =  ml->expz;
                                                /* 7 */
-                                               mainb[a]->bb->vec[7][0] = -ml->expx;
-                                               mainb[a]->bb->vec[7][1] =  ml->expy;
-                                               mainb[a]->bb->vec[7][2] =  ml->expz;
+                                               G_mb.mainb[a]->bb->vec[7][0] = -ml->expx;
+                                               G_mb.mainb[a]->bb->vec[7][1] =  ml->expy;
+                                               G_mb.mainb[a]->bb->vec[7][2] =  ml->expz;
 
                                                /* transformation of Metalem bb */
                                                for (i = 0; i < 8; i++)
-                                                       mul_m4_v3((float (*)[4])mat, mainb[a]->bb->vec[i]);
+                                                       mul_m4_v3((float (*)[4])mat, G_mb.mainb[a]->bb->vec[i]);
 
                                                /* find max and min of transformed bb */
                                                for (i = 0; i < 8; i++) {
                                                        /* find maximums */
-                                                       if (mainb[a]->bb->vec[i][0] > max_x) max_x = mainb[a]->bb->vec[i][0];
-                                                       if (mainb[a]->bb->vec[i][1] > max_y) max_y = mainb[a]->bb->vec[i][1];
-                                                       if (mainb[a]->bb->vec[i][2] > max_z) max_z = mainb[a]->bb->vec[i][2];
+                                                       if (G_mb.mainb[a]->bb->vec[i][0] > max_x) max_x = G_mb.mainb[a]->bb->vec[i][0];
+                                                       if (G_mb.mainb[a]->bb->vec[i][1] > max_y) max_y = G_mb.mainb[a]->bb->vec[i][1];
+                                                       if (G_mb.mainb[a]->bb->vec[i][2] > max_z) max_z = G_mb.mainb[a]->bb->vec[i][2];
                                                        /* find  minimums */
-                                                       if (mainb[a]->bb->vec[i][0] < min_x) min_x = mainb[a]->bb->vec[i][0];
-                                                       if (mainb[a]->bb->vec[i][1] < min_y) min_y = mainb[a]->bb->vec[i][1];
-                                                       if (mainb[a]->bb->vec[i][2] < min_z) min_z = mainb[a]->bb->vec[i][2];
+                                                       if (G_mb.mainb[a]->bb->vec[i][0] < min_x) min_x = G_mb.mainb[a]->bb->vec[i][0];
+                                                       if (G_mb.mainb[a]->bb->vec[i][1] < min_y) min_y = G_mb.mainb[a]->bb->vec[i][1];
+                                                       if (G_mb.mainb[a]->bb->vec[i][2] < min_z) min_z = G_mb.mainb[a]->bb->vec[i][2];
                                                }
                                        
                                                /* create "new" bb, only point 0 and 6, which are
                                                 * necessary for octal tree filling */
-                                               mainb[a]->bb->vec[0][0] = min_x - ml->rad;
-                                               mainb[a]->bb->vec[0][1] = min_y - ml->rad;
-                                               mainb[a]->bb->vec[0][2] = min_z - ml->rad;
+                                               G_mb.mainb[a]->bb->vec[0][0] = min_x - ml->rad;
+                                               G_mb.mainb[a]->bb->vec[0][1] = min_y - ml->rad;
+                                               G_mb.mainb[a]->bb->vec[0][2] = min_z - ml->rad;
 
-                                               mainb[a]->bb->vec[6][0] = max_x + ml->rad;
-                                               mainb[a]->bb->vec[6][1] = max_y + ml->rad;
-                                               mainb[a]->bb->vec[6][2] = max_z + ml->rad;
+                                               G_mb.mainb[a]->bb->vec[6][0] = max_x + ml->rad;
+                                               G_mb.mainb[a]->bb->vec[6][1] = max_y + ml->rad;
+                                               G_mb.mainb[a]->bb->vec[6][2] = max_z + ml->rad;
 
                                                a++;
                                        }
@@ -1834,13 +1835,13 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
        
        /* totsize (= 'manhattan' radius) */
        totsize = 0.0;
-       for (a = 0; a < totelem; a++) {
+       for (a = 0; a < G_mb.totelem; a++) {
                
-               vec[0] = mainb[a]->x + mainb[a]->rad + mainb[a]->expx;
-               vec[1] = mainb[a]->y + mainb[a]->rad + mainb[a]->expy;
-               vec[2] = mainb[a]->z + mainb[a]->rad + mainb[a]->expz;
+               vec[0] = G_mb.mainb[a]->x + G_mb.mainb[a]->rad + G_mb.mainb[a]->expx;
+               vec[1] = G_mb.mainb[a]->y + G_mb.mainb[a]->rad + G_mb.mainb[a]->expy;
+               vec[2] = G_mb.mainb[a]->z + G_mb.mainb[a]->rad + G_mb.mainb[a]->expz;
 
-               calc_mballco(mainb[a], vec);
+               calc_mballco(G_mb.mainb[a], vec);
        
                size = fabsf(vec[0]);
                if (size > totsize) totsize = size;
@@ -1849,11 +1850,11 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
                size = fabsf(vec[2]);
                if (size > totsize) totsize = size;
 
-               vec[0] = mainb[a]->x - mainb[a]->rad;
-               vec[1] = mainb[a]->y - mainb[a]->rad;
-               vec[2] = mainb[a]->z - mainb[a]->rad;
+               vec[0] = G_mb.mainb[a]->x - G_mb.mainb[a]->rad;
+               vec[1] = G_mb.mainb[a]->y - G_mb.mainb[a]->rad;
+               vec[2] = G_mb.mainb[a]->z - G_mb.mainb[a]->rad;
                                
-               calc_mballco(mainb[a], vec);
+               calc_mballco(G_mb.mainb[a], vec);
        
                size = fabsf(vec[0]);
                if (size > totsize) totsize = size;
@@ -1863,8 +1864,8 @@ static float init_meta(Scene *scene, Object *ob)    /* return totsize */
                if (size > totsize) totsize = size;
        }
 
-       for (a = 0; a < totelem; a++) {
-               thresh += densfunc(mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
+       for (a = 0; a < G_mb.totelem; a++) {
+               G_mb.thresh += densfunc(G_mb.mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
        }
 
        return totsize;
@@ -1882,11 +1883,11 @@ static void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
        BLI_addtail(&(node->nodes[i]->elems), ml_p);
        node->count++;
        
-       if (ml->flag & MB_NEGATIVE) {
-               node->nodes[i]->neg++;
+       if ((ml->flag & MB_NEGATIVE) == 0) {
+               node->nodes[i]->pos++;
        }
        else {
-               node->nodes[i]->pos++;
+               node->nodes[i]->neg++;
        }
 }
 
@@ -2180,13 +2181,13 @@ static void init_metaball_octal_tree(int depth)
        float size[3];
        int a;
        
-       metaball_tree = MEM_mallocN(sizeof(octal_tree), "metaball_octal_tree");
-       metaball_tree->first = node = MEM_mallocN(sizeof(octal_node), "metaball_octal_node");
+       G_mb.metaball_tree = MEM_mallocN(sizeof(octal_tree), "metaball_octal_tree");
+       G_mb.metaball_tree->first = node = MEM_mallocN(sizeof(octal_node), "metaball_octal_node");
        /* maximal depth of octree */
-       metaball_tree->depth = depth;
+       G_mb.metaball_tree->depth = depth;
 
-       metaball_tree->neg = node->neg = 0;
-       metaball_tree->pos = node->pos = 0;
+       G_mb.metaball_tree->neg = node->neg = 0;
+       G_mb.metaball_tree->pos = node->pos = 0;
        
        node->elems.first = NULL;
        node->elems.last = NULL;
@@ -2199,26 +2200,26 @@ static void init_metaball_octal_tree(int depth)
        node->x_max = node->y_max = node->z_max = -FLT_MAX;
 
        /* size of octal tree scene */
-       for (a = 0; a < totelem; a++) {
-               if (mainb[a]->bb->vec[0][0] < node->x_min) node->x_min = mainb[a]->bb->vec[0][0];
-               if (mainb[a]->bb->vec[0][1] < node->y_min) node->y_min = mainb[a]->bb->vec[0][1];
-               if (mainb[a]->bb->vec[0][2] < node->z_min) node->z_min = mainb[a]->bb->vec[0][2];
+       for (a = 0; a < G_mb.totelem; a++) {
+               if (G_mb.mainb[a]->bb->vec[0][0] < node->x_min) node->x_min = G_mb.mainb[a]->bb->vec[0][0];
+               if (G_mb.mainb[a]->bb->vec[0][1] < node->y_min) node->y_min = G_mb.mainb[a]->bb->vec[0][1];
+               if (G_mb.mainb[a]->bb->vec[0][2] < node->z_min) node->z_min = G_mb.mainb[a]->bb->vec[0][2];
 
-               if (mainb[a]->bb->vec[6][0] > node->x_max) node->x_max = mainb[a]->bb->vec[6][0];
-               if (mainb[a]->bb->vec[6][1] > node->y_max) node->y_max = mainb[a]->bb->vec[6][1];
-               if (mainb[a]->bb->vec[6][2] > node->z_max) node->z_max = mainb[a]->bb->vec[6][2];
+               if (G_mb.mainb[a]->bb->vec[6][0] > node->x_max) node->x_max = G_mb.mainb[a]->bb->vec[6][0];
+               if (G_mb.mainb[a]->bb->vec[6][1] > node->y_max) node->y_max = G_mb.mainb[a]->bb->vec[6][1];
+               if (G_mb.mainb[a]->bb->vec[6][2] > node->z_max) node->z_max = G_mb.mainb[a]->bb->vec[6][2];
 
                ml_p = MEM_mallocN(sizeof(ml_pointer), "ml_pointer");
-               ml_p->ml = mainb[a];
+               ml_p->ml = G_mb.mainb[a];
                BLI_addtail(&node->elems, ml_p);
 
-               if (mainb[a]->flag & MB_NEGATIVE) {
-                       /* number of negative MetaElem in scene */
-                       metaball_tree->neg++;
+               if ((G_mb.mainb[a]->flag & MB_NEGATIVE) == 0) {
+                       /* number of positive MetaElem in scene */
+                       G_mb.metaball_tree->pos++;
                }
                else {
-                       /* number of positive MetaElem in scene */
-                       metaball_tree->pos++;
+                       /* number of negative MetaElem in scene */
+                       G_mb.metaball_tree->neg++;
                }
        }
 
@@ -2228,7 +2229,7 @@ static void init_metaball_octal_tree(int depth)
        size[2] = node->z_max - node->z_min;
 
        /* first node is subdivided recursively */
-       subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth);
+       subdivide_metaball_octal_node(node, size[0], size[1], size[2], G_mb.metaball_tree->depth);
 }
 
 void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
@@ -2241,48 +2242,48 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 
        mb = ob->data;
 
-       if (totelem == 0) return;
+       if (G_mb.totelem == 0) return;
        if ((G.is_rendering == FALSE) && (mb->flag == MB_UPDATE_NEVER)) return;
        if (G.moving && mb->flag == MB_UPDATE_FAST) return;
 
        curindex = totindex = 0;
        indices = NULL;
-       thresh = mb->thresh;
+       G_mb.thresh = mb->thresh;
 
        /* total number of MetaElems (totelem) is precomputed in find_basis_mball() function */
-       mainb = MEM_mallocN(sizeof(void *) * totelem, "mainb");
+       G_mb.mainb = MEM_mallocN(sizeof(void *) * G_mb.totelem, "mainb");
        
        /* initialize all mainb (MetaElems) */
        totsize = init_meta(scene, ob);
 
-       if (metaball_tree) {
-               free_metaball_octal_node(metaball_tree->first);
-               MEM_freeN(metaball_tree);
-               metaball_tree = NULL;
+       if (G_mb.metaball_tree) {
+               free_metaball_octal_node(G_mb.metaball_tree->first);
+               MEM_freeN(G_mb.metaball_tree);
+               G_mb.metaball_tree = NULL;
        }
 
        /* if scene includes more then one MetaElem, then octal tree optimization is used */
-       if ((totelem > 1) && (totelem <= 64)) init_metaball_octal_tree(1);
-       if ((totelem > 64) && (totelem <= 128)) init_metaball_octal_tree(2);
-       if ((totelem > 128) && (totelem <= 512)) init_metaball_octal_tree(3);
-       if ((totelem > 512) && (totelem <= 1024)) init_metaball_octal_tree(4);
-       if (totelem > 1024) init_metaball_octal_tree(5);
+       if ((G_mb.totelem >    1) && (G_mb.totelem <=   64)) init_metaball_octal_tree(1);
+       if ((G_mb.totelem >   64) && (G_mb.totelem <=  128)) init_metaball_octal_tree(2);
+       if ((G_mb.totelem >  128) && (G_mb.totelem <=  512)) init_metaball_octal_tree(3);
+       if ((G_mb.totelem >  512) && (G_mb.totelem <= 1024)) init_metaball_octal_tree(4);
+       if (G_mb.totelem  > 1024)                            init_metaball_octal_tree(5);
 
        /* don't polygonize metaballs with too high resolution (base mball to small)
         * note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
-       if (metaball_tree) {
-               if (ob->size[0] <= 0.00001f * (metaball_tree->first->x_max - metaball_tree->first->x_min) ||
-                   ob->size[1] <= 0.00001f * (metaball_tree->first->y_max - metaball_tree->first->y_min) ||
-                   ob->size[2] <= 0.00001f * (metaball_tree->first->z_max - metaball_tree->first->z_min))
+       if (G_mb.metaball_tree) {
+               if (ob->size[0] <= 0.00001f * (G_mb.metaball_tree->first->x_max - G_mb.metaball_tree->first->x_min) ||
+                   ob->size[1] <= 0.00001f * (G_mb.metaball_tree->first->y_max - G_mb.metaball_tree->first->y_min) ||
+                   ob->size[2] <= 0.00001f * (G_mb.metaball_tree->first->z_max - G_mb.metaball_tree->first->z_min))
                {
                        new_pgn_element(-1); /* free values created by init_meta */
 
-                       MEM_freeN(mainb);
+                       MEM_freeN(G_mb.mainb);
 
                        /* free tree */
-                       free_metaball_octal_node(metaball_tree->first);
-                       MEM_freeN(metaball_tree);
-                       metaball_tree = NULL;
+                       free_metaball_octal_node(G_mb.metaball_tree->first);
+                       MEM_freeN(G_mb.metaball_tree);
+                       G_mb.metaball_tree = NULL;
 
                        return;
                }
@@ -2306,13 +2307,13 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 
        polygonize(&mbproc, mb);
        
-       MEM_freeN(mainb);
+       MEM_freeN(G_mb.mainb);
 
        /* free octal tree */
-       if (totelem > 1) {
-               free_metaball_octal_node(metaball_tree->first);
-               MEM_freeN(metaball_tree);
-               metaball_tree = NULL;
+       if (G_mb.totelem > 1) {
+               free_metaball_octal_node(G_mb.metaball_tree->first);
+               MEM_freeN(G_mb.metaball_tree);
+               G_mb.metaball_tree = NULL;
        }
 
        if (curindex) {
index e990f461d4cff7b46569ccb38395ceaacf7c2d28..1588ec10b55f257716d63b0a398842c762e61d5b 100644 (file)
@@ -1067,8 +1067,9 @@ static int ptcache_path(PTCacheID *pid, char *filename)
        if (pid->cache->flag & PTCACHE_EXTERNAL) {
                strcpy(filename, pid->cache->path);
 
-               if (strncmp(filename, "//", 2)==0)
+               if (BLI_path_is_rel(filename)) {
                        BLI_path_abs(filename, blendfilename);
+               }
 
                return BLI_add_slash(filename); /* new strlen() */
        }
index dd71e43182e9e2a0646f0237d66682bc042ae996..434bfe19c1f83c0b6127a9560a2d369cdda4d0ca 100644 (file)
 #include "BKE_node.h"
 #include "BKE_world.h"
 
-void BKE_world_free(World *wrld)
+void BKE_world_free_ex(World *wrld, int do_id_user)
 {
        MTex *mtex;
        int a;
        
        for (a = 0; a < MAX_MTEX; a++) {
                mtex = wrld->mtex[a];
-               if (mtex && mtex->tex) mtex->tex->id.us--;
+               if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--;
                if (mtex) MEM_freeN(mtex);
        }
        BKE_previewimg_free(&wrld->preview);
@@ -67,7 +67,7 @@ void BKE_world_free(World *wrld)
 
        /* is no lib link block, but world extension */
        if (wrld->nodetree) {
-               ntreeFreeTree(wrld->nodetree);
+               ntreeFreeTree_ex(wrld->nodetree, do_id_user);
                MEM_freeN(wrld->nodetree);
        }
 
@@ -75,6 +75,10 @@ void BKE_world_free(World *wrld)
        wrld->id.icon_id = 0;
 }
 
+void BKE_world_free(World *wrld)
+{
+       BKE_world_free_ex(wrld, TRUE);
+}
 
 World *add_world(const char *name)
 {
index 9b68406cc54b2f1173351461daf45c1f527d8f5a..35d7b8d94442d035eebd4e3d83ad88d2c53156ca 100644 (file)
@@ -154,6 +154,8 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits);
 int BLI_path_cwd(char *path);
 void BLI_path_rel(char *file, const char *relfile);
 
+int BLI_path_is_rel(const char *path);
+
 #ifdef WIN32
 #  define BLI_path_cmp BLI_strcasecmp
 #  define BLI_path_ncmp BLI_strncasecmp
index 6d95b07834007b8ab5e74682f70ec9eb7d88f895..2a750cb1a661e926f6658466d10ec15d8259b2d2 100644 (file)
@@ -113,13 +113,13 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
 
        data->count_tot++;
 
-       if (strncmp(path_src, "//", 2) == 0) {
+       if (BLI_path_is_rel(path_src)) {
                return FALSE; /* already relative */
        }
        else {
                strcpy(path_dst, path_src);
                BLI_path_rel(path_dst, data->basedir);
-               if (strncmp(path_dst, "//", 2) == 0) {
+               if (BLI_path_is_rel(path_dst)) {
                        data->count_changed++;
                }
                else {
@@ -155,13 +155,13 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
 
        data->count_tot++;
 
-       if (strncmp(path_src, "//", 2) != 0) {
+       if (BLI_path_is_rel(path_src) == FALSE) {
                return FALSE; /* already absolute */
        }
        else {
                strcpy(path_dst, path_src);
                BLI_path_abs(path_dst, data->basedir);
-               if (strncmp(path_dst, "//", 2) != 0) {
+               if (BLI_path_is_rel(path_dst) == FALSE) {
                        data->count_changed++;
                }
                else {
@@ -596,7 +596,7 @@ int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat
        const char *base_new = ((char **)pathbase_v)[0];
        const char *base_old = ((char **)pathbase_v)[1];
 
-       if (strncmp(base_old, "//", 2) == 0) {
+       if (BLI_path_is_rel(base_old)) {
                printf("%s: error, old base path '%s' is not absolute.\n",
                       __func__, base_old);
                return FALSE;
index 22b160ad0b471b647b6597cc4d128623508ffd6c..e6ecdeae2e9e5074824501df0e03d6a88a013cbd 100644 (file)
@@ -411,6 +411,11 @@ void BLI_cleanup_file(const char *relabase, char *dir)
        BLI_del_slash(dir);
 }
 
+int BLI_path_is_rel(const char *path)
+{
+       return path[0] == '/' && path[1] == '/';
+}
+
 void BLI_path_rel(char *file, const char *relfile)
 {
        char *lslash;
@@ -418,10 +423,14 @@ void BLI_path_rel(char *file, const char *relfile)
        char res[FILE_MAX];
        
        /* if file is already relative, bail out */
-       if (file[0] == '/' && file[1] == '/') return;
+       if (BLI_path_is_rel(file)) {
+               return;
+       }
        
        /* also bail out if relative path is not set */
-       if (relfile[0] == 0) return;
+       if (relfile[0] == '\0') {
+               return;
+       }
 
 #ifdef WIN32
        if (BLI_strnlen(relfile, 3) > 2 && relfile[1] != ':') {
@@ -630,7 +639,7 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
 
 int BLI_path_abs(char *path, const char *basepath)
 {
-       int wasrelative = (strncmp(path, "//", 2) == 0);
+       int wasrelative = BLI_path_is_rel(path);
        char tmp[FILE_MAX];
        char base[FILE_MAX];
 #ifdef WIN32
index e6b97f1b2ff162845f214fe7b9a7ac01976a4751..ac792a90735a7fe746d141c913e6c2c6ff75f9df 100644 (file)
@@ -6109,7 +6109,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
                         * it absolute. This can happen when appending an object with a relative
                         * link into an unsaved blend file. See [#27405].
                         * The remap relative option will make it relative again on save - campbell */
-                       if (strncmp(lib->name, "//", 2) == 0) {
+                       if (BLI_path_is_rel(lib->name)) {
                                BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name));
                        }
                }
@@ -6118,7 +6118,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
                for (lib = main->library.first; lib; lib = lib->id.next) {
                        /* Libraries store both relative and abs paths, recreate relative paths,
                         * relative to the blend file since indirectly linked libs will be relative to their direct linked library */
-                       if (strncmp(lib->name, "//", 2) == 0) { /* if this is relative to begin with? */
+                       if (BLI_path_is_rel(lib->name)) {  /* if this is relative to begin with? */
                                BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name));
                                BLI_path_rel(lib->name, basepath);
                        }
index 01e1403b021cbff2eb7a76f26cb900ddf04ed863..88b018ef8ba53688c593977e591680886f82f3e5 100644 (file)
@@ -30,9 +30,9 @@
 #endif
 
 typedef enum PixelSampler {
-       COM_PS_NEAREST,
-       COM_PS_BILINEAR,
-       COM_PS_BICUBIC
+       COM_PS_NEAREST = 0,
+       COM_PS_BILINEAR = 1,
+       COM_PS_BICUBIC = 2
 } PixelSampler;
 
 class MemoryBuffer;
index bb058d18b8072d4e6c30ce801aba72366a34a18b..d7712323a27c329715fc0cac0950121f754e40bc 100644 (file)
@@ -39,19 +39,7 @@ void RotateNode::convertToOperations(ExecutionSystem *system, CompositorContext
        RotateOperation *operation = new RotateOperation();
        SetSamplerOperation *sampler = new SetSamplerOperation();
 
-       switch (this->getbNode()->custom1) {
-               case 0:
-                       sampler->setSampler(COM_PS_NEAREST);
-                       break;
-               case 1:
-                       sampler->setSampler(COM_PS_BILINEAR);
-                       break;
-               case 2:
-                       sampler->setSampler(COM_PS_BICUBIC);
-                       break;
-       
-       }
-
+       sampler->setSampler((PixelSampler)this->getbNode()->custom1);
        addLink(system, sampler->getOutputSocket(), operation->getInputSocket(0));
        
        inputSocket->relinkConnections(sampler->getInputSocket(0), 0, system);
index 85b8695263f5523b958cf6576445025d1de3ad73..b28ee3eade193227d244618f249e3fe8ae290fc8 100644 (file)
@@ -26,6 +26,7 @@
 #include "COM_RotateOperation.h"
 #include "COM_ScaleOperation.h"
 #include "COM_MovieClipAttributeOperation.h"
+#include "COM_SetSamplerOperation.h"
 
 extern "C" {
        #include "DNA_movieclip_types.h"
@@ -49,6 +50,7 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
        MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation();
        MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation();
        MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation();
+       SetSamplerOperation *psoperation = new SetSamplerOperation();
 
        scaleAttribute->setAttribute(MCA_SCALE);
        scaleAttribute->setFramenumber(context->getFramenumber());
@@ -77,8 +79,10 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
        addLink(graph, rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
        addLink(graph, xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
        addLink(graph, yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
-
-       this->getOutputSocket()->relinkConnections(translateOperation->getOutputSocket());
+       
+       psoperation->setSampler((PixelSampler)this->getbNode()->custom1);
+       addLink(graph, translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
+       this->getOutputSocket()->relinkConnections(psoperation->getOutputSocket());
        
        graph->addOperation(scaleAttribute);
        graph->addOperation(angleAttribute);
@@ -87,4 +91,5 @@ void Stabilize2dNode::convertToOperations(ExecutionSystem *graph, CompositorCont
        graph->addOperation(scaleOperation);
        graph->addOperation(translateOperation);
        graph->addOperation(rotateOperation);
+       graph->addOperation(psoperation);
 }
index ff6e276d1acd536c53d974ba0c4f71ff9f79fa93..154761665cfef1f1f837b5731c632bcedc718f6c 100644 (file)
@@ -46,17 +46,7 @@ void TransformNode::convertToOperations(ExecutionSystem *graph, CompositorContex
        TranslateOperation *translateOperation = new TranslateOperation();
        SetSamplerOperation *sampler = new SetSamplerOperation();
 
-       switch (this->getbNode()->custom1) {
-               case 0:
-                       sampler->setSampler(COM_PS_NEAREST);
-                       break;
-               case 1:
-                       sampler->setSampler(COM_PS_BILINEAR);
-                       break;
-               case 2:
-                       sampler->setSampler(COM_PS_BICUBIC);
-                       break;
-       }
+       sampler->setSampler((PixelSampler)this->getbNode()->custom1);
        
        imageInput->relinkConnections(sampler->getInputSocket(0), 0, graph);
        addLink(graph, sampler->getOutputSocket(), scaleOperation->getInputSocket(0));
index add2cbd566bf1d7bfaeef7fc03e1f937cf173ca3..068a7aaa50ab73b01b85e42dfb2c06bbb4bdb176 100644 (file)
@@ -788,7 +788,7 @@ static void shader_preview_free(void *customdata)
                
                /* get rid of copied world */
                BLI_remlink(&pr_main->world, sp->worldcopy);
-               BKE_world_free(sp->worldcopy);
+               BKE_world_free_ex(sp->worldcopy, FALSE);
                
                properties = IDP_GetProperties((ID *)sp->worldcopy, FALSE);
                if (properties) {
index ff7a71af8c209cdabf434fb105236c217087a7d6..878858c1acdd957c719d9012ef47ab471570acc5 100644 (file)
@@ -1113,7 +1113,7 @@ static void file_expand_directory(bContext *C)
        
        if (sfile->params) {
                /* TODO, what about // when relbase isn't valid? */
-               if (G.relbase_valid && strncmp(sfile->params->dir, "//", 2) == 0) {
+               if (G.relbase_valid && BLI_path_is_rel(sfile->params->dir)) {
                        BLI_path_abs(sfile->params->dir, G.main->name);
                }
                else if (sfile->params->dir[0] == '~') {
index 0b5216a98932b998d287707082aaa3dabfc06bd9..43e4db16b7d6c4c1fd2e3145f418bdd877ea5623 100644 (file)
@@ -1052,7 +1052,7 @@ static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
                return image_replace_exec(C, op);
 
        if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
-               RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2)) == 0);
+               RNA_boolean_set(op->ptr, "relative_path", BLI_path_is_rel(sima->image->name));
 
        image_filesel(C, op, sima->image->name);
 
@@ -1634,7 +1634,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
        PropertyRNA *prop;
        char name[MAX_ID_NAME - 2];
        float color[4];
-       int width, height, floatbuf, uvtestgrid, alpha;
+       int width, height, floatbuf, gen_type, alpha;
 
        /* retrieve state */
        sima = CTX_wm_space_image(C);
@@ -1645,7 +1645,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
        width = RNA_int_get(op->ptr, "width");
        height = RNA_int_get(op->ptr, "height");
        floatbuf = RNA_boolean_get(op->ptr, "float");
-       uvtestgrid = RNA_boolean_get(op->ptr, "uv_test_grid");
+       gen_type = RNA_enum_get(op->ptr, "generated_type");
        RNA_float_get_array(op->ptr, "color", color);
        alpha = RNA_boolean_get(op->ptr, "alpha");
        
@@ -1655,7 +1655,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
        if (!alpha)
                color[3] = 1.0f;
 
-       ima = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color);
+       ima = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color);
 
        if (!ima)
                return OPERATOR_CANCELLED;
@@ -1712,7 +1712,8 @@ void IMAGE_OT_new(wmOperatorType *ot)
        prop = RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
        RNA_def_property_float_array_default(prop, default_color);
        RNA_def_boolean(ot->srna, "alpha", 1, "Alpha", "Create an image with an alpha channel");
-       RNA_def_boolean(ot->srna, "uv_test_grid", 0, "UV Test Grid", "Fill the image with a grid for UV map testing");
+       RNA_def_enum(ot->srna, "generated_type", image_generated_type_items, IMA_GENTYPE_BLANK,
+                    "Generated Type", "Fill the image with a grid for UV map testing");
        RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth");
 }
 
index a4d9261ad5aa589c1a124287316bea935209680c..fec3aa22e92dd19c429ddd5761a5396865354ed2 100644 (file)
@@ -144,8 +144,8 @@ static int nr_types = 0;
 static int nr_structs = 0;
 static char **names, *namedata;      /* at address names[a] is string a */
 static char **types, *typedata;      /* at address types[a] is string a */
-static short *typelens;              /* at typelens[a] is de length of type a */
-static short *alphalens;             /* contains sizes as they are calculated on the DEC Alpha (64 bits), in fact any 64bit system */
+static short *typelens_native;       /* at typelens[a] is the length of type 'a' on this systems bitness (32 or 64) */
+static short *typelens_64;           /* contains sizes as they are calculated on 64 bit systems */
 static short **structs, *structdata; /* at sp = structs[a] is the first address of a struct definition
                                       * sp[0] is type number
                                       * sp[1] is amount of elements
@@ -242,8 +242,8 @@ static int add_type(const char *str, int len)
        for (nr = 0; nr < nr_types; nr++) {
                if (strcmp(str, types[nr]) == 0) {
                        if (len) {
-                               typelens[nr] = len;
-                               alphalens[nr] = len;
+                               typelens_native[nr] = len;
+                               typelens_64[nr] = len;
                        }
                        return nr;
                }
@@ -256,8 +256,8 @@ static int add_type(const char *str, int len)
        }
        strcpy(cp, str);
        types[nr_types] = cp;
-       typelens[nr_types] = len;
-       alphalens[nr_types] = len;
+       typelens_native[nr_types] = len;
+       typelens_64[nr_types] = len;
        
        if (nr_types >= maxnr) {
                printf("too many types\n");
@@ -712,7 +712,7 @@ static int arraysize(char *astr, int len)
 
 static int calculate_structlens(int firststruct)
 {
-       int a, b, len, alphalen, unknown = nr_structs, lastunknown, structtype, type, mul, namelen;
+       int a, b, len_native, len_64, unknown = nr_structs, lastunknown, structtype, type, mul, namelen;
        short *sp, *structpoin;
        char *cp;
        int has_pointer, dna_error = 0;
@@ -727,11 +727,11 @@ static int calculate_structlens(int firststruct)
                        structtype = structpoin[0];
 
                        /* when length is not known... */
-                       if (typelens[structtype] == 0) {
+                       if (typelens_native[structtype] == 0) {
                                
                                sp = structpoin + 2;
-                               len = 0;
-                               alphalen = 0;
+                               len_native = 0;
+                               len_64 = 0;
                                has_pointer = 0;
                                
                                /* check all elements in struct */
@@ -754,25 +754,25 @@ static int calculate_structlens(int firststruct)
 
                                                /* 4-8 aligned/ */
                                                if (sizeof(void *) == 4) {
-                                                       if (len % 4) {
-                                                               printf("Align pointer error in struct (len4): %s %s\n", types[structtype], cp);
+                                                       if (len_native % 4) {
+                                                               printf("Align pointer error in struct (len_native 4): %s %s\n", types[structtype], cp);
                                                                dna_error = 1;
                                                        }
                                                }
                                                else {
-                                                       if (len % 8) {
-                                                               printf("Align pointer error in struct (len8): %s %s\n", types[structtype], cp);
+                                                       if (len_native % 8) {
+                                                               printf("Align pointer error in struct (len_native 8): %s %s\n", types[structtype], cp);
                                                                dna_error = 1;
                                                        }
                                                }
 
-                                               if (alphalen % 8) {
-                                                       printf("Align pointer error in struct (alphalen8): %s %s\n", types[structtype], cp);
+                                               if (len_64 % 8) {
+                                                       printf("Align pointer error in struct (len_64 8): %s %s\n", types[structtype], cp);
                                                        dna_error = 1;
                                                }
 
-                                               len += sizeof(void *) * mul;
-                                               alphalen += 8 * mul;
+                                               len_native += sizeof(void *) * mul;
+                                               len_64 += 8 * mul;
 
                                        }
                                        else if (cp[0] == '[') {
@@ -780,7 +780,7 @@ static int calculate_structlens(int firststruct)
                                                printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp);
                                                dna_error = 1;
                                        }
-                                       else if (typelens[type]) {
+                                       else if (typelens_native[type]) {
                                                /* has the name an extra length? (array) */
                                                mul = 1;
                                                if (cp[namelen - 1] == ']') mul = arraysize(cp, namelen);
@@ -792,54 +792,54 @@ static int calculate_structlens(int firststruct)
 
                                                /* struct alignment */
                                                if (type >= firststruct) {
-                                                       if (sizeof(void *) == 8 && (len % 8) ) {
+                                                       if (sizeof(void *) == 8 && (len_native % 8) ) {
                                                                printf("Align struct error: %s %s\n", types[structtype], cp);
                                                                dna_error = 1;
                                                        }
                                                }
                                                
                                                /* 2-4-8 aligned/ */
-                                               if (type < firststruct && typelens[type] > 4 && (len % 8)) {
-                                                       printf("Align 8 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 8);
+                                               if (type < firststruct && typelens_native[type] > 4 && (len_native % 8)) {
+                                                       printf("Align 8 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len_native % 8);
                                                        dna_error = 1;
                                                }
-                                               if (typelens[type] > 3 && (len % 4) ) {
-                                                       printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 4);
+                                               if (typelens_native[type] > 3 && (len_native % 4) ) {
+                                                       printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len_native % 4);
                                                        dna_error = 1;
                                                }
-                                               else if (typelens[type] == 2 && (len % 2) ) {
-                                                       printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 2);
+                                               else if (typelens_native[type] == 2 && (len_native % 2) ) {
+                                                       printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len_native % 2);
                                                        dna_error = 1;
                                                }
 
-                                               len += mul * typelens[type];
-                                               alphalen += mul * alphalens[type];
+                                               len_native += mul * typelens_native[type];
+                                               len_64 += mul * typelens_64[type];
                                                
                                        }
                                        else {
-                                               len = 0;
-                                               alphalen = 0;
+                                               len_native = 0;
+                                               len_64 = 0;
                                                break;
                                        }
                                }
                                
-                               if (len == 0) {
+                               if (len_native == 0) {
                                        unknown++;
                                }
                                else {
-                                       typelens[structtype] = len;
-                                       alphalens[structtype] = alphalen;
+                                       typelens_native[structtype] = len_native;
+                                       typelens_64[structtype] = len_64;
                                        /* two ways to detect if a struct contains a pointer:
-                                        * has_pointer is set or alphalen != len */
-                                       if (has_pointer || alphalen != len) {
-                                               if (alphalen % 8) {
-                                                       printf("Sizeerror 8 in struct: %s (add %d bytes)\n", types[structtype], alphalen % 8);
+                                        * has_pointer is set or len_64 != len_native */
+                                       if (has_pointer || len_64 != len_native) {
+                                               if (len_64 % 8) {
+                                                       printf("Sizeerror 8 in struct: %s (add %d bytes)\n", types[structtype], len_64 % 8);
                                                        dna_error = 1;
                                                }
                                        }
                                        
-                                       if (len % 4) {
-                                               printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len % 4);
+                                       if (len_native % 4) {
+                                               printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len_native % 4);
                                                dna_error = 1;
                                        }
                                        
@@ -861,7 +861,7 @@ static int calculate_structlens(int firststruct)
                                structtype = structpoin[0];
                                
                                /* length unknown */
-                               if (typelens[structtype] != 0) {
+                               if (typelens_native[structtype] != 0) {
                                        printf("  %s\n", types[structtype]);
                                }
                        }
@@ -875,7 +875,7 @@ static int calculate_structlens(int firststruct)
                        structtype = structpoin[0];
 
                        /* length unknown yet */
-                       if (typelens[structtype] == 0) {
+                       if (typelens_native[structtype] == 0) {
                                printf("  %s\n", types[structtype]);
                        }
                }
@@ -921,7 +921,7 @@ void printStructLengths(void)
                for (a = 0; a < nr_structs; a++) {
                        structpoin = structs[a];
                        structtype = structpoin[0];
-                       printf("\t%s\t:%d\n", types[structtype], typelens[structtype]);
+                       printf("\t%s\t:%d\n", types[structtype], typelens_native[structtype]);
                }
        }
 
@@ -952,8 +952,8 @@ static int make_structDNA(char *baseDirectory, FILE *file)
        /* a maximum of 5000 variables, must be sufficient? */
        names = MEM_callocN(sizeof(char *) * maxnr, "names");
        types = MEM_callocN(sizeof(char *) * maxnr, "types");
-       typelens = MEM_callocN(sizeof(short) * maxnr, "typelens");
-       alphalens = MEM_callocN(sizeof(short) * maxnr, "alphalens");
+       typelens_native = MEM_callocN(sizeof(short) * maxnr, "typelens_native");
+       typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64");
        structs = MEM_callocN(sizeof(short) * maxnr, "structs");
 
        /* insertion of all known types */
@@ -1006,7 +1006,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                }
                printf("\n");
                
-               sp = typelens;
+               sp = typelens_native;
                for (a = 0; a < nr_types; a++, sp++) {
                        printf(" %s %d\n", types[a], *sp);
                }
@@ -1014,7 +1014,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                
                for (a = 0; a < nr_structs; a++) {
                        sp = structs[a];
-                       printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens[sp[0]]);
+                       printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]);
                        num_types  = sp[1];
                        sp += 2;
                        /* ? num_types was elem? */
@@ -1066,7 +1066,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                
                len = 2 * nr_types;
                if (nr_types & 1) len += 2;
-               dna_write(file, typelens, len);
+               dna_write(file, typelens_native, len);
                
                /* WRITE STRUCTS */
                strcpy(str, "STRC");
@@ -1097,7 +1097,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
                                }
 
                                fprintf(fp, "main() {\n");
-                               sp = typelens;
+                               sp = typelens_native;
                                sp += firststruct;
                                for (a = firststruct; a < nr_types; a++, sp++) {
                                        if (*sp) {
@@ -1119,8 +1119,8 @@ static int make_structDNA(char *baseDirectory, FILE *file)
        MEM_freeN(structdata);
        MEM_freeN(names);
        MEM_freeN(types);
-       MEM_freeN(typelens);
-       MEM_freeN(alphalens);
+       MEM_freeN(typelens_native);
+       MEM_freeN(typelens_64);
        MEM_freeN(structs);
 
        if (debugSDNA > -1) printf("done.\n");
index dd230b7b9f821a9dc27717151a854b91725c9f74..b651d4d5e5c6bc3584b2bb29da877cf1745b266a 100644 (file)
@@ -57,6 +57,7 @@ extern EnumPropertyItem sequence_modifier_type_items[];
 extern EnumPropertyItem image_type_items[];
 extern EnumPropertyItem image_color_mode_items[];
 extern EnumPropertyItem image_depth_mode_items[];
+extern EnumPropertyItem image_generated_type_items[];
 
 extern EnumPropertyItem color_sets_items[];
 
index ed933181a7bbdfc64a9e0ee1d2553b3f0dc8d4c3..0c3814f72d610087ef1387afe7f5a9baa2cecb5c 100644 (file)
 #include "WM_types.h"
 #include "WM_api.h"
 
+EnumPropertyItem image_generated_type_items[] = {
+       {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
+       {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
+       {IMA_GENTYPE_GRID_COLOR, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
+       {0, NULL, 0, NULL, NULL}
+};
+
 static EnumPropertyItem image_source_items[] = {
        {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
        {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
@@ -436,12 +443,6 @@ static void rna_def_image(BlenderRNA *brna)
                {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
                {0, NULL, 0, NULL, NULL}
        };
-       static const EnumPropertyItem prop_generated_type_items[] = {
-               {0, "BLANK", 0, "Blank", "Generate a blank image"},
-               {1, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
-               {2, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
-               {0, NULL, 0, NULL, NULL}
-       };
        static const EnumPropertyItem prop_mapping_items[] = {
                {0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"},
                {IMA_REFLECT, "REFLECTION", 0, "Reflection", "Use reflection mapping for mapping the image"},
@@ -520,7 +521,7 @@ static void rna_def_image(BlenderRNA *brna)
        /* generated image (image_generated_change_cb) */
        prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "gen_type");
-       RNA_def_property_enum_items(prop, prop_generated_type_items);
+       RNA_def_property_enum_items(prop, image_generated_type_items);
        RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
        RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
 
index b66a5e4567a3ed2c82d7b9e6e5ba670f9b4b9056..55dda3fc3150b2a2f59e594b76d77477c1152689 100644 (file)
@@ -133,6 +133,14 @@ EnumPropertyItem node_filter_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem node_sampler_type_items[] = {
+       {0, "NEAREST",   0, "Nearest",   ""},
+       {1, "BILINEAR",   0, "Bilinear",   ""},
+       {2, "BICUBIC", 0, "Bicubic", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+
 EnumPropertyItem prop_noise_basis_items[] = {
        {SHD_NOISE_PERLIN, "PERLIN", 0, "Perlin", ""},
        {SHD_NOISE_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", ""},
@@ -2216,7 +2224,7 @@ static void def_cmp_despeckle(StructRNA *srna)
        prop = RNA_def_property(srna, "threshold_neighbour", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom4");
        RNA_def_property_range(prop, 0.0, 1.0f);
-       RNA_def_property_ui_text(prop, "Neighbour", "Threshold for the number of neighbour pixels that must match");
+       RNA_def_property_ui_text(prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
@@ -2268,16 +2276,9 @@ static void def_cmp_rotate(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem rotate_items[] = {
-               {0, "NEAREST",   0, "Nearest",   ""},
-               {1, "BILINEAR",   0, "Bilinear",   ""},
-               {2, "BICUBIC", 0, "Bicubic", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-       
        prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, rotate_items);
+       RNA_def_property_enum_items(prop, node_sampler_type_items);
        RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
@@ -3205,13 +3206,6 @@ static void def_cmp_stabilize2d(StructRNA *srna)
 {
        PropertyRNA *prop;
 
-       static EnumPropertyItem filter_type_items[] = {
-               {0, "NEAREST",   0, "Nearest",   ""},
-               {1, "BILINEAR",   0, "Bilinear",   ""},
-               {2, "BICUBIC", 0, "Bicubic", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "id");
        RNA_def_property_struct_type(prop, "MovieClip");
@@ -3221,7 +3215,7 @@ static void def_cmp_stabilize2d(StructRNA *srna)
 
        prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, filter_type_items);
+       RNA_def_property_enum_items(prop, node_sampler_type_items);
        RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
@@ -3319,16 +3313,9 @@ static void dev_cmd_transform(StructRNA *srna)
 {
        PropertyRNA *prop;
 
-       static EnumPropertyItem filter_type_items[] = {
-               {0, "NEAREST",   0, "Nearest",   ""},
-               {1, "BILINEAR",   0, "Bilinear",   ""},
-               {2, "BICUBIC", 0, "Bicubic", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "custom1");
-       RNA_def_property_enum_items(prop, filter_type_items);
+       RNA_def_property_enum_items(prop, node_sampler_type_items);
        RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
index 35c85f0f40ebf36833e10463618213c38904396a..739f302fcbe7556de172108611abf80de6bd1570 100644 (file)
@@ -1109,7 +1109,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
                {0, "ANIMATION", 0, "Animation",
                    "Stateless solver computing pose starting from current action and non-IK constraints"},
                {ITASC_SIMULATION, "SIMULATION", 0, "Simulation",
-                                  "Statefull solver running in real-time context and ignoring actions "
+                                  "State-full solver running in real-time context and ignoring actions "
                                   "and non-IK constraints"},
                {0, NULL, 0, NULL, NULL}
        };
index 8f9214fa1b2018da8b04daf9e9f73ab309e69f1c..27258c45fe528ff27cf96936d27a3c2001828a8a 100644 (file)
@@ -73,6 +73,12 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node)
        new_node->storage= MEM_dupallocN(orig_node->storage);
 }
 
+void *node_initexec_curves(bNode *node)
+{
+       curvemapping_initialize(node->storage);
+       return NULL;  /* unused return */
+}
+
 /**** Labels ****/
 
 const char *node_blend_label(bNode *node)
index 6f167e352622d4ef2054ec42f0342b31cf76694d..9f9caef14e2b084ae5b641e7968e01743dcfc3f6 100644 (file)
@@ -53,6 +53,7 @@ extern void node_free_standard_storage(struct bNode *node);
 
 extern void node_copy_curves(struct bNode *orig_node, struct bNode *new_node);
 extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node);
+extern void *node_initexec_curves(struct bNode *node);
 
 /**** Labels ****/
 
index 0c08f1bc215ef110ebfb8b9c114c51ac56e744e1..83cb1d336284f0e52e36813e145959e239e4424b 100644 (file)
@@ -65,7 +65,6 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
        float *array;
        int size;
 
-       curvemapping_initialize(node->storage);
        curvemapping_table_RGBA(node->storage, &array, &size);
        return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
 }
@@ -81,6 +80,7 @@ void register_node_type_sh_curve_vec(bNodeTreeType *ttype)
        node_type_init(&ntype, node_shader_init_curve_vec);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
        node_type_exec(&ntype, node_shader_exec_curve_vec);
+       node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
        node_type_gpu(&ntype, gpu_shader_curve_vec);
 
        nodeRegisterType(ttype, &ntype);
@@ -138,6 +138,7 @@ void register_node_type_sh_curve_rgb(bNodeTreeType *ttype)
        node_type_init(&ntype, node_shader_init_curve_rgb);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
        node_type_exec(&ntype, node_shader_exec_curve_rgb);
+       node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
        node_type_gpu(&ntype, gpu_shader_curve_rgb);
 
        nodeRegisterType(ttype, &ntype);
index 543b39ec75e9c64b7be7d16bd0a7200fd4807c91..6ccb5e1e83fc464c6030bf05ea9f175aeebc2ec6 100644 (file)
@@ -77,6 +77,7 @@ void register_node_type_tex_curve_time(bNodeTreeType *ttype)
        node_type_init(&ntype, time_init);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
        node_type_exec(&ntype, time_exec);
+       node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
        
        nodeRegisterType(ttype, &ntype);
 }
@@ -121,6 +122,7 @@ void register_node_type_tex_curve_rgb(bNodeTreeType *ttype)
        node_type_init(&ntype, rgb_init);
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
        node_type_exec(&ntype, rgb_exec);
+       node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
        
        nodeRegisterType(ttype, &ntype);
 }
index 657844ebfff79b1b77036f331c6b0b8337992bd1..520773c1ddf8fd1936ee6cd5b73a6d851c9a917a 100644 (file)
@@ -523,7 +523,9 @@ void PyC_SetHomePath(const char *py_path_bundle)
        }
 }
 
-/* Would be nice if python had this built in */
+/* Would be nice if python had this built in
+ * See: http://wiki.blender.org/index.php/Dev:Doc/Tools/Debugging/PyFromC
+ */
 void PyC_RunQuicky(const char *filepath, int n, ...)
 {
        FILE *fp = fopen(filepath, "r");
index 8a87938d825bbaba4f053fc2c919a101b1b0eb9a..05fc84eaa87ebb05327eba483d76ebc477a79caa 100644 (file)
@@ -644,8 +644,8 @@ static PyNumberMethods Color_NumMethods = {
        NULL,               /*nb_remainder*/
        NULL,               /*nb_divmod*/
        NULL,               /*nb_power*/
-       (unaryfunc) Color_neg, /*nb_negative*/
-       (unaryfunc) NULL,   /*tp_positive*/
+       (unaryfunc) Color_neg,   /*nb_negative*/
+       (unaryfunc) Color_copy,  /*tp_positive*/
        (unaryfunc) NULL,   /*tp_absolute*/
        (inquiry)   NULL,   /*tp_bool*/
        (unaryfunc) NULL,   /*nb_invert*/
index 40c0215ffd1af646a598b939e025bcaf98fddbc0..b595dab494df67bc5a7a59ac637e07f90c1d2efe 100644 (file)
@@ -903,7 +903,7 @@ static PyNumberMethods Quaternion_NumMethods = {
        NULL,                           /*nb_divmod*/
        NULL,                           /*nb_power*/
        (unaryfunc)     Quaternion_neg, /*nb_negative*/
-       (unaryfunc)     0,  /*tp_positive*/
+       (unaryfunc)     Quaternion_copy,/*tp_positive*/
        (unaryfunc)     0,  /*tp_absolute*/
        (inquiry)   0,      /*tp_bool*/
        (unaryfunc) 0,      /*nb_invert*/
index c7911cb1572f8cbe9209e098bb912a8288a4c699..74a4cd838d080257154e07b57dd31240f9f1347f 100644 (file)
@@ -2046,7 +2046,7 @@ static PyNumberMethods Vector_NumMethods = {
        NULL,                       /*nb_divmod*/
        NULL,                       /*nb_power*/
        (unaryfunc)     Vector_neg, /*nb_negative*/
-       (unaryfunc)     NULL,       /*tp_positive*/
+       (unaryfunc)     Vector_copy,/*tp_positive*/
        (unaryfunc)     NULL,       /*tp_absolute*/
        (inquiry)   NULL,           /*tp_bool*/
        (unaryfunc) NULL,           /*nb_invert*/
index 524515ac4609c29717df32d40194909117e3cc42..19f9aa2dc886b3163bb5d9e16062fb1913e1c941 100644 (file)
@@ -728,6 +728,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
        float pt_in[3], pt_out[3], l1[3], l2[3];
        float lambda;
        PyObject *ret;
+       int size = 2;
        
        if (!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line",
                              &vector_Type, &pt,
@@ -745,20 +746,20 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
        }
 
        /* accept 2d verts */
-       if (pt->size == 3) {     copy_v3_v3(pt_in, pt->vec); }
-       else { pt_in[2] = 0.0f;  copy_v2_v2(pt_in, pt->vec); }
+       if (pt->size >= 3)     { copy_v3_v3(pt_in, pt->vec); size = 3; }
+       else                   { copy_v2_v2(pt_in, pt->vec); pt_in[2] = 0.0f; }
        
-       if (line_1->size == 3) { copy_v3_v3(l1, line_1->vec); }
-       else { l1[2] = 0.0f;     copy_v2_v2(l1, line_1->vec); }
+       if (line_1->size >= 3) { copy_v3_v3(l1, line_1->vec); size = 3; }
+       else                   { copy_v2_v2(l1, line_1->vec); l1[2] = 0.0f; }
        
-       if (line_2->size == 3) { copy_v3_v3(l2, line_2->vec); }
-       else { l2[2] = 0.0f;     copy_v2_v2(l2, line_2->vec); }
+       if (line_2->size >= 3) { copy_v3_v3(l2, line_2->vec); size = 3; }
+       else                   { copy_v2_v2(l2, line_2->vec); l2[2] = 0.0f; }
        
        /* do the calculation */
        lambda = closest_to_line_v3(pt_out, pt_in, l1, l2);
        
        ret = PyTuple_New(2);
-       PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(pt_out, 3, Py_NEW, NULL));
+       PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(pt_out, size, Py_NEW, NULL));
        PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(lambda));
        return ret;
 }