Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2008-11-10 03:14:35 +0300
committerMatt Ebb <matt@mke3.net>2008-11-10 03:14:35 +0300
commit3b2f996c25e911fb6497fd45b3b4a5ab5e5609ac (patch)
tree3a2850a619343a94f0017f5aa0ed80ad2213ed86 /source/blender
parenta972107b03a3b8b00e1548d99e790612dc9f0ccc (diff)
Point Density
* Fixed a stupid crash caused by last commit that worked fine on the mac (but never should have...) * Fix for using child particles with the new particle age color options
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/render/intern/source/pointdensity.c14
-rw-r--r--source/blender/src/buttons_shading.c162
3 files changed, 94 insertions, 84 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 76ef6bdb4e8..1bb4ef3eeff 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -873,6 +873,7 @@ PointDensity *BKE_add_pointdensity(void)
PointDensity *pd;
pd= MEM_callocN(sizeof(PointDensity), "pointdensity");
+ pd->flag = 0;
pd->radius = 0.3f;
pd->falloff_type = TEX_PD_FALLOFF_STD;
pd->falloff_softness = 2.0;
@@ -886,6 +887,7 @@ PointDensity *BKE_add_pointdensity(void)
pd->coba = add_colorband(1);
pd->speed_scale = 1.0f;
pd->totpoints = 0;
+ pd->coba = add_colorband(1);
return pd;
}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index db3e57e0b79..af2a7edae06 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -71,7 +71,7 @@ static int point_data_used(PointDensity *pd)
/* additional data stored alongside the point density BVH,
* accessible by point index number to retrieve other information
* such as particle velocity or lifetime */
-static void make_point_data(PointDensity *pd, int total_particles, int point_data_used)
+static void alloc_point_data(PointDensity *pd, int total_particles, int point_data_used)
{
int data_size = 0;
@@ -123,7 +123,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
psys->lattice=psys_get_lattice(ob,psys);
pd->point_tree = BLI_bvhtree_new(total_particles, 0.0, 4, 6);
- make_point_data(pd, total_particles, data_used);
+ alloc_point_data(pd, total_particles, data_used);
pd->totpoints = total_particles;
if (data_used & POINT_DATA_VEL) offset = pd->totpoints*3;
@@ -155,7 +155,15 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
pd->point_data[i*3 + 2] = state.vel[2];
}
if (data_used & POINT_DATA_LIFE) {
- float pa_time = (cfra - pa->time)/pa->lifetime;
+ float pa_time;
+
+ if (i < psys->totpart) {
+ pa_time = (cfra - pa->time)/pa->lifetime;
+ } else {
+ ChildParticle *cpa= (psys->child + i) - psys->totpart;
+ pa_time = psys_get_child_time(psys, cpa, cfra);
+ }
+
pd->point_data[offset + i] = pa_time;
}
}
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index b9ea4ebe9d6..5ed39764af0 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -840,87 +840,6 @@ static void texture_panel_voronoi(Tex *tex)
uiDefButF(block, NUMSLI, B_TEXPRV, "W4: ", 10, 10, 150, 19, &tex->vn_w4, -2.0, 2.0, 10, 0, "Sets feature weight 4");
}
-static void texture_panel_pointdensity_modify(Tex *tex)
-{
- uiBlock *block;
- PointDensity *pd;
- short yco=PANEL_YMAX, ymid;
-
- block= uiNewBlock(&curarea->uiblocks, "texture_panel_pointdensity_modify", UI_EMBOSS, UI_HELV, curarea->win);
- if(uiNewPanel(curarea, block, "Modifiers", "Texture", PANELX, PANELY, PANELW, PANELH+20)==0) return;
- uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
-
- if(tex->pd==NULL) {
- tex->pd= BKE_add_pointdensity();
- }
- if(!tex->pd) return;
-
- if (pd->source == TEX_PD_PSYS) {
- uiDefBut(block, LABEL, B_NOP, "Color & Intensity By:",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
-
- uiBlockBeginAlign(block);
- uiDefButS(block, MENU, B_TEXREDR_PRV, "Constant %x0|Particle Age %x1|Particle Speed %x2|Velocity -> RGB %x3|",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &pd->color_source, 0.0, 0.0, 0, 0, "Particle Life: Lifetime mapped as 0.0 - 1.0 intensity, Velocity: XYZ velocity mapped as RGB colours");
- if (ELEM(pd->color_source, TEX_PD_COLOR_PARTSPEED, TEX_PD_COLOR_PARTVEL)) {
- uiDefButF(block, NUM, B_REDR, "Scale: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->speed_scale), 0.001, 100.0, 10, 2, "Multipler to bring particle speed within an acceptable range");
- }
- uiBlockEndAlign(block);
-
- yco-= 2*BUTH;
-
- if (ELEM(pd->color_source, TEX_PD_COLOR_PARTAGE, TEX_PD_COLOR_PARTSPEED)) {
- rctf rect = {X2CLM1, X2CLM1+BUTW1, yco, yco};
- if (tex->pd->coba == NULL) tex->pd->coba = add_colorband(1);
- draw_colorband_buts_small(block, tex->pd->coba, &rect, B_TEXREDR_PRV);
- } else {
- /* spacer */
- uiDefBut(block, LABEL, B_NOP, "",
- X2CLM2, yco, BUTW2, BUTH*2, 0, 0, 0, 0, 0, "");
- }
-
- if (!ELEM(pd->color_source, TEX_PD_COLOR_PARTSPEED, TEX_PD_COLOR_PARTVEL)) yco -= BUTH;
- }
-
- ymid = yco -= YSPACE;
-
- uiDefButBitS(block, TOG, TEX_PD_TURBULENCE, B_REDR, "Turbulence",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->flag), 0, 0, 0, 0, "Add directed turbulence to the density estimation");
-
- yco -= YSPACE;
-
- uiBlockBeginAlign(block);
- if (pd->flag & TEX_PD_TURBULENCE) {
-
- uiDefButF(block, NUM, B_REDR, "Size: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_size), 0.001, 100.0, 10, 2, "Turbulence size");
- uiDefButS(block, NUM, B_REDR, "Depth: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_depth), 0.0, 100.0, 10, 2, "Turbulence depth");
- uiDefButF(block, NUM, B_REDR, "Strength: ",
- X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_fac), 0.001, 100.0, 10, 2, "");
-
- uiBlockEndAlign(block);
-
- yco = ymid - BUTH - YSPACE;
-
- uiDefBut(block, LABEL, B_NOP, "Noise Influence:",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
-
- if (pd->source == TEX_PD_PSYS) {
- uiDefButS(block, MENU, B_REDR, "Noise Influence %t|Static %x0|Velocity %x1|Particle Age %x2|Time %x3",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(pd->noise_influence), 0.0, 0.0, 0, 0, "Noise Influence");
- } else if (pd->source == TEX_PD_OBJECT) {
- uiDefButS(block, MENU, B_REDR, "Noise Influence %t|Static %x0|Time %x3",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(pd->noise_influence), 0.0, 0.0, 0, 0, "Noise Influence");
- }
- } else {
- uiDefBut(block, LABEL, B_NOP, "",
- X2CLM2, yco-=2*BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
- }
-
-}
-
static void texture_panel_pointdensity(Tex *tex)
{
uiBlock *block;
@@ -999,6 +918,87 @@ static void texture_panel_pointdensity(Tex *tex)
}
+static void texture_panel_pointdensity_modify(Tex *tex)
+{
+ uiBlock *block;
+ PointDensity *pd;
+ short yco=PANEL_YMAX, ymid;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_pointdensity_modify", UI_EMBOSS, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Modifiers", "Texture", PANELX, PANELY, PANELW, PANELH+20)==0) return;
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
+
+ if(tex->pd==NULL) {
+ tex->pd= BKE_add_pointdensity();
+ }
+ if(!tex->pd) return;
+ pd= tex->pd;
+
+ if (pd->source == TEX_PD_PSYS) {
+ uiDefBut(block, LABEL, B_NOP, "Color & Intensity By:",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButS(block, MENU, B_TEXREDR_PRV, "Constant %x0|Particle Age %x1|Particle Speed %x2|Velocity -> RGB %x3|",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &pd->color_source, 0.0, 0.0, 0, 0, "Particle Life: Lifetime mapped as 0.0 - 1.0 intensity, Velocity: XYZ velocity mapped as RGB colours");
+ if (ELEM(pd->color_source, TEX_PD_COLOR_PARTSPEED, TEX_PD_COLOR_PARTVEL)) {
+ uiDefButF(block, NUM, B_REDR, "Scale: ",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->speed_scale), 0.001, 100.0, 10, 2, "Multipler to bring particle speed within an acceptable range");
+ }
+ uiBlockEndAlign(block);
+
+ yco-= 2*BUTH;
+
+
+ if (ELEM(pd->color_source, TEX_PD_COLOR_PARTAGE, TEX_PD_COLOR_PARTSPEED)) {
+ rctf rect = {X2CLM1, X2CLM1+BUTW1, yco, yco};
+ if (pd->coba == NULL) pd->coba = add_colorband(1);
+ draw_colorband_buts_small(block, pd->coba, &rect, B_TEXREDR_PRV);
+ } else {
+ uiDefBut(block, LABEL, B_NOP, "",
+ X2CLM2, yco, BUTW2, BUTH*2, 0, 0, 0, 0, 0, "");
+ }
+
+ if (!ELEM(pd->color_source, TEX_PD_COLOR_PARTSPEED, TEX_PD_COLOR_PARTVEL)) yco -= BUTH;
+ }
+
+ ymid = yco -= YSPACE;
+
+ uiDefButBitS(block, TOG, TEX_PD_TURBULENCE, B_REDR, "Turbulence",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->flag), 0, 0, 0, 0, "Add directed turbulence to the density estimation");
+
+ yco -= YSPACE;
+
+ uiBlockBeginAlign(block);
+ if (pd->flag & TEX_PD_TURBULENCE) {
+
+ uiDefButF(block, NUM, B_REDR, "Size: ",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_size), 0.001, 100.0, 10, 2, "Turbulence size");
+ uiDefButS(block, NUM, B_REDR, "Depth: ",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_depth), 0.0, 100.0, 10, 2, "Turbulence depth");
+ uiDefButF(block, NUM, B_REDR, "Strength: ",
+ X2CLM1, yco-=BUTH, BUTW2, BUTH, &(pd->noise_fac), 0.001, 100.0, 10, 2, "");
+
+ uiBlockEndAlign(block);
+
+ yco = ymid - BUTH - YSPACE;
+
+ uiDefBut(block, LABEL, B_NOP, "Noise Influence:",
+ X2CLM2, yco-=BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
+
+ if (pd->source == TEX_PD_PSYS) {
+ uiDefButS(block, MENU, B_REDR, "Noise Influence %t|Static %x0|Velocity %x1|Particle Age %x2|Time %x3",
+ X2CLM2, yco-=BUTH, BUTW2, BUTH, &(pd->noise_influence), 0.0, 0.0, 0, 0, "Noise Influence");
+ } else if (pd->source == TEX_PD_OBJECT) {
+ uiDefButS(block, MENU, B_REDR, "Noise Influence %t|Static %x0|Time %x3",
+ X2CLM2, yco-=BUTH, BUTW2, BUTH, &(pd->noise_influence), 0.0, 0.0, 0, 0, "Noise Influence");
+ }
+ } else {
+ uiDefBut(block, LABEL, B_NOP, "",
+ X2CLM2, yco-=2*BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");
+ }
+
+}
static char *layer_menu(RenderResult *rr, short *curlay)
{