Revision: 41933
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41933
Author:   campbellbarton
Date:     2011-11-16 19:57:20 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
svn merge -r41926:41932 ^/trunk/blender

Revision Links:
--------------
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41926

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/BKE_dynamicpaint.h
    branches/bmesh/blender/source/blender/blenkernel/intern/BME_Customdata.c
    branches/bmesh/blender/source/blender/blenkernel/intern/BME_mesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
    branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c
    branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c
    branches/bmesh/blender/source/blender/blenlib/intern/BLI_ghash.c
    branches/bmesh/blender/source/blender/blenlib/intern/edgehash.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_walkers.c
    branches/bmesh/blender/source/blender/bmesh/operators/createops.c
    branches/bmesh/blender/source/blender/editors/animation/anim_channels_edit.c
    branches/bmesh/blender/source/blender/editors/animation/anim_markers.c
    branches/bmesh/blender/source/blender/editors/mesh/knifetool.c
    branches/bmesh/blender/source/blender/editors/space_action/action_select.c
    branches/bmesh/blender/source/blender/editors/space_clip/tracking_ops.c
    branches/bmesh/blender/source/blender/editors/space_file/file_ops.c
    branches/bmesh/blender/source/blender/editors/space_graph/graph_select.c
    branches/bmesh/blender/source/blender/editors/space_info/info_report.c
    branches/bmesh/blender/source/blender/editors/space_nla/nla_select.c
    branches/bmesh/blender/source/blender/editors/space_node/node_select.c
    
branches/bmesh/blender/source/blender/editors/space_sequencer/sequencer_select.c
    branches/bmesh/blender/source/blender/editors/uvedit/uvedit_ops.c
    branches/bmesh/blender/source/blender/imbuf/intern/moviecache.c
    branches/bmesh/blender/source/blender/makesdna/DNA_dynamicpaint_types.h
    branches/bmesh/blender/source/blender/makesrna/intern/rna_dynamicpaint.c

Property Changed:
----------------
    branches/bmesh/blender/
    branches/bmesh/blender/release/
    branches/bmesh/blender/source/blender/editors/space_outliner/


Property changes on: branches/bmesh/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/blender:39992-41926
   + /trunk/blender:39992-41932


Property changes on: branches/bmesh/blender/release
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/blender/release:31524-41926
   + /trunk/blender/release:31524-41932

Modified: branches/bmesh/blender/source/blender/blenkernel/BKE_dynamicpaint.h
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/BKE_dynamicpaint.h 
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenkernel/BKE_dynamicpaint.h 
2011-11-16 19:57:20 UTC (rev 41933)
@@ -46,6 +46,7 @@
 
        float height;
        float velocity;
+       float brush_isect;
        short state;
 } PaintWavePoint;
 
@@ -82,6 +83,7 @@
 #define DPAINT_PAINT_NEW 2
 
 /* PaintWavePoint state */
+#define DPAINT_WAVE_ISECT_CHANGED -1
 #define DPAINT_WAVE_NONE 0
 #define DPAINT_WAVE_OBSTACLE 1
 #define DPAINT_WAVE_REFLECT_ONLY 2

Modified: 
branches/bmesh/blender/source/blender/blenkernel/intern/BME_Customdata.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/BME_Customdata.c    
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/BME_Customdata.c    
2011-11-16 19:57:20 UTC (rev 41933)
@@ -87,7 +87,7 @@
        if(data->totlayer){
                /*alloc memory*/
                data->layers = 
MEM_callocN(sizeof(BME_CustomDataLayer)*data->totlayer, "BMesh Custom Data 
Layers");
-               data->pool = BLI_mempool_create(data->totsize, initalloc, 
initalloc, 1);
+               data->pool = BLI_mempool_create(data->totsize, initalloc, 
initalloc, TRUE);
                /*initialize layer data*/
                for(i=0; i < BME_CD_NUMTYPES; i++){
                        if(init->layout[i]){

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/BME_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/BME_mesh.c  
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/BME_mesh.c  
2011-11-16 19:57:20 UTC (rev 41933)
@@ -56,10 +56,10 @@
        /*allocate the structure*/
        BME_Mesh *bm = MEM_callocN(sizeof(BME_Mesh),"BMesh");
        /*allocate the memory pools for the mesh elements*/
-       bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], 
allocsize[0], 1, 0);
-       bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], 
allocsize[1], 1, 0);
-       bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], 
allocsize[2], 1, 0);
-       bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], 
allocsize[3], 1, 0);
+       bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], 
allocsize[0], TRUE, FALSE);
+       bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], 
allocsize[1], TRUE, FALSE);
+       bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], 
allocsize[2], TRUE, FALSE);
+       bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], 
allocsize[3], TRUE, FALSE);
        return bm;
 }
 /*     

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c        
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c        
2011-11-16 19:57:20 UTC (rev 41933)
@@ -2360,7 +2360,7 @@
 
        /* If there are no layers, no pool is needed just yet */
        if (data->totlayer) {
-               data->pool = BLI_mempool_create(data->totsize, allocsize, 
allocsize, 1, 0);
+               data->pool = BLI_mempool_create(data->totsize, allocsize, 
allocsize, TRUE, FALSE);
        }
 }
 

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c      
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/dynamicpaint.c      
2011-11-16 19:57:20 UTC (rev 41933)
@@ -98,7 +98,8 @@
 /* paint effect default movement per frame in global units */
 #define EFF_MOVEMENT_PER_FRAME 0.05f
 /* initial wave time factor */
-#define WAVE_TIME_FAC 0.1
+#define WAVE_TIME_FAC (1.0f/24.f)
+#define WAVE_INIT_SIZE 5.0f
 /* drying limits */
 #define MIN_WETNESS 0.001f
 /* dissolve macro */
@@ -149,6 +150,7 @@
        int *s_num;     /* num of realCoord samples */
        Vec3f *realCoord;  /* current pixel center world-space coordinates for 
each sample
                                           *  ordered as (s_pos+s_num)*/
+       Bounds3D mesh_bounds;
 
        /* adjacency info */
        BakeNeighPoint *bNeighs; /* current global neighbour distances and 
directions, if required */
@@ -969,7 +971,7 @@
        surface->color_spread_speed = 1.0f;
        surface->shrink_speed = 1.0f;
 
-       surface->wave_damping = 0.05f;
+       surface->wave_damping = 0.04f;
        surface->wave_speed = 1.0f;
        surface->wave_timescale = 1.0f;
        surface->wave_spring = 0.20f;
@@ -1037,6 +1039,7 @@
                        brush->particle_radius = 0.2f;
                        brush->particle_smooth = 0.05f;
 
+                       brush->wave_type = MOD_DPAINT_WAVEB_CHANGE;
                        brush->wave_factor = 1.0f;
                        brush->wave_clamp = 0.0f;
                        brush->smudge_strength = 0.3f;
@@ -2070,7 +2073,6 @@
 
        PaintUVPoint *tempPoints = NULL;
        Vec3f *tempWeights = NULL;
-       /* MVert *mvert = NULL; */ /* UNUSED */
        MFace *mface = NULL;
        MTFace *tface = NULL;
        Bounds2D *faceBB = NULL;
@@ -2081,7 +2083,6 @@
        if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return 
setError(canvas, "Can't bake non-\"image sequence\" formats.");
 
        numOfFaces = dm->getNumFaces(dm);
-       /* mvert = dm->getVertArray(dm); */ /* UNUSED */
        mface = dm->getTessFaceArray(dm);
 
        /* get uv layer */
@@ -2859,7 +2860,12 @@
 /* applies given brush intersection value for wave surface */
 static void dynamicPaint_mixWaveHeight(PaintWavePoint *wPoint, 
DynamicPaintBrushSettings *brush, float isect_height)
 {
+       float isect_change = isect_height - wPoint->brush_isect;
        int hit = 0;
+       /* intersection marked regardless of brush type or hit */
+       wPoint->brush_isect = isect_height;
+       wPoint->state = DPAINT_WAVE_ISECT_CHANGED;
+
        isect_height *= brush->wave_factor;
 
        /* determine hit depending on wave_factor */
@@ -2878,6 +2884,10 @@
                        wPoint->velocity = isect_height;
                else if (brush->wave_type == MOD_DPAINT_WAVEB_REFLECT)
                        wPoint->state = DPAINT_WAVE_REFLECT_ONLY;
+               else if (brush->wave_type == MOD_DPAINT_WAVEB_CHANGE) {
+                       if (isect_change < 0.0f)
+                               wPoint->height += 
isect_change*brush->wave_factor;
+               }
        }
 }
 
@@ -4292,6 +4302,9 @@
        float dt, min_dist, damp_factor;
        float wave_speed = surface->wave_speed;
        double average_dist = 0.0f;
+       Bounds3D *mb = &sData->bData->mesh_bounds;
+       float canvas_size = MAX3((mb->max[0]-mb->min[0]), 
(mb->max[1]-mb->min[1]), (mb->max[2]-mb->min[2]));
+       float wave_scale = WAVE_INIT_SIZE/canvas_size;
 
        /* allocate memory */
        PaintWavePoint *prevPoint = 
MEM_mallocN(sData->total_points*sizeof(PaintWavePoint), "Temp previous points 
for wave simulation");
@@ -4307,11 +4320,11 @@
                        average_dist += 
bNeighs[sData->adj_data->n_index[index]+i].dist;
                }
        }
-       average_dist  /= sData->adj_data->total_targets;
+       average_dist  *= wave_scale/sData->adj_data->total_targets;
 
        /* determine number of required steps */
        steps = (int)ceil((WAVE_TIME_FAC*timescale*surface->wave_timescale) / 
(average_dist/wave_speed/3));
-       CLAMP(steps, 1, 15);
+       CLAMP(steps, 1, 20);
        timescale /= steps;
 
        /* apply simulation values for final timescale */
@@ -4332,12 +4345,12 @@
                        int numOfN = 0, numOfRN = 0;
                        int i;
 
-                       if (wPoint->state) continue;
+                       if (wPoint->state > 0) continue;
 
                        /* calculate force from surrounding points */
                        for (i=0; i<numOfNeighs; i++) {
                                int n_index = sData->adj_data->n_index[index]+i;
-                               float dist = bNeighs[n_index].dist;
+                               float dist = bNeighs[n_index].dist*wave_scale;
                                PaintWavePoint *tPoint = 
&prevPoint[sData->adj_data->n_target[n_index]];
 
                                if (!dist || tPoint->state>0) continue;
@@ -4381,6 +4394,10 @@
        #pragma omp parallel for schedule(static)
        for (index = 0; index < sData->total_points; index++) {
                PaintWavePoint *wPoint = 
&((PaintWavePoint*)sData->type_data)[index];
+               /* if there wasnt any brush intersection, clear isect height */
+               if (wPoint->state == DPAINT_WAVE_NONE) {
+                       wPoint->brush_isect = 0.0f;
+               }
                wPoint->state = DPAINT_WAVE_NONE;
        }
 
@@ -4594,10 +4611,11 @@
        /*
        *       Make a transformed copy of canvas derived mesh vertices to 
avoid recalculation.
        */
-       #pragma omp parallel for schedule(static)
+       bData->mesh_bounds.valid = 0;
        for (index=0; index<canvasNumOfVerts; index++) {
                copy_v3_v3(canvas_verts[index].v, mvert[index].co);
                mul_m4_v3(ob->obmat, canvas_verts[index].v);
+               boundInsert(&bData->mesh_bounds, canvas_verts[index].v);
        }
 
        /*

Modified: branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c        
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c        
2011-11-16 19:57:20 UTC (rev 41933)
@@ -99,7 +99,7 @@
        }
 
        if (!pools[slot]) {
-               pools[slot] = BLI_mempool_create(slot, 1, 128, 1, 0);
+               pools[slot] = BLI_mempool_create(slot, 1, 128, TRUE, FALSE);
        }
 
        memh = BLI_mempool_alloc(pools[slot]);

Modified: branches/bmesh/blender/source/blender/blenlib/intern/BLI_ghash.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/BLI_ghash.c    
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenlib/intern/BLI_ghash.c    
2011-11-16 19:57:20 UTC (rev 41933)
@@ -60,7 +60,7 @@
        GHash *gh= MEM_mallocN(sizeof(*gh), info);
        gh->hashfp= hashfp;
        gh->cmpfp= cmpfp;
-       gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 1, 0);
+       gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, TRUE, FALSE);
 
        gh->cursize= 0;
        gh->nentries= 0;

Modified: branches/bmesh/blender/source/blender/blenlib/intern/edgehash.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/edgehash.c     
2011-11-16 19:31:42 UTC (rev 41932)
+++ branches/bmesh/blender/source/blender/blenlib/intern/edgehash.c     
2011-11-16 19:57:20 UTC (rev 41933)

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to