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:
-rw-r--r--release/scripts/ui/properties_particle.py27
-rw-r--r--source/blender/blenkernel/BKE_particle.h1
-rw-r--r--source/blender/makesdna/DNA_particle_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_particle.c5
-rw-r--r--source/blender/render/intern/source/convertblender.c41
5 files changed, 40 insertions, 39 deletions
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index 3a6a98ad2b1..ec7428d2860 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -821,6 +821,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
row.prop(weight, "count")
elif part.render_type == 'BILLBOARD':
+ ob = context.object
+
sub.label(text="Align:")
row = layout.row()
@@ -833,21 +835,22 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
col = row.column(align=True)
col.label(text="Tilt:")
col.prop(part, "billboard_tilt", text="Angle", slider=True)
- col.prop(part, "billboard_tilt_random", slider=True)
+ col.prop(part, "billboard_tilt_random", text="Random", slider=True)
col = row.column()
col.prop(part, "billboard_offset")
- row = layout.row()
- row.prop(psys, "billboard_normal_uv")
- row = layout.row()
- row.prop(psys, "billboard_time_index_uv")
-
- row = layout.row()
- row.label(text="Split uv's:")
- row.prop(part, "billboard_uv_split", text="Number of splits")
- row = layout.row()
- row.prop(psys, "billboard_split_uv")
- row = layout.row()
+ col = layout.column()
+ col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures")
+ col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures")
+
+ split = layout.split(percentage=0.33)
+ split.label(text="Split uv's:")
+ split.prop(part, "billboard_uv_split", text="Number of splits")
+ col = layout.column()
+ col.active = part.billboard_uv_split > 1
+ col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures")
+
+ row = col.row()
row.label(text="Animate:")
row.prop(part, "billboard_animation", text="")
row.label(text="Offset:")
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 5c72973a0da..bb325420bbe 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -149,6 +149,7 @@ typedef struct ParticleBillboardData
int uv[3];
int lock, num;
int totnum;
+ int lifetime;
short align, uv_split, anim, split_offset;
} ParticleBillboardData;
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index a56c7146c3f..a94d70d16b9 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -390,10 +390,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
/* part->bb_anim */
#define PART_BB_ANIM_NONE 0
-#define PART_BB_ANIM_TIME 1
+#define PART_BB_ANIM_AGE 1
#define PART_BB_ANIM_ANGLE 2
-#define PART_BB_ANIM_OFF_TIME 3
-#define PART_BB_ANIM_OFF_ANGLE 4
+#define PART_BB_ANIM_FRAME 3
/* part->bb_split_offset */
#define PART_BB_OFF_NONE 0
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index b9b45f61688..ec0ba5c4785 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1450,10 +1450,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
static EnumPropertyItem bb_anim_items[] = {
{PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
- {PART_BB_ANIM_TIME, "TIME", 0, "Time", ""},
+ {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
+ {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
{PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
- //{PART_BB_ANIM_OFF_TIME, "OFF_TIME", 0, "off_time", ""},
- //{PART_BB_ANIM_OFF_ANGLE, "OFF_ANGLE", 0, "off_angle", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index b5cfc123c15..1dc709d27df 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1269,6 +1269,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
VlakRen *vlr;
MTFace *mtf;
float xvec[3], yvec[3], zvec[3], bb_center[3];
+ int totsplit = bb->uv_split * bb->uv_split;
float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f;
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
@@ -1306,49 +1307,46 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
if(bb->uv_split > 1){
uvdx = uvdy = 1.0f / (float)bb->uv_split;
- if(bb->anim == PART_BB_ANIM_TIME) {
- if(bb->split_offset == PART_BB_OFF_NONE)
- time = bb->time;
- else if(bb->split_offset == PART_BB_OFF_LINEAR)
- time = (float)fmod(bb->time + (float)bb->num / (float)(bb->uv_split * bb->uv_split), 1.0f);
- else /* split_offset==PART_BB_OFF_RANDOM */
- time = (float)fmod(bb->time + bb->random, 1.0f);
+ if(ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) {
+ if(bb->anim == PART_BB_ANIM_FRAME)
+ time = ((int)(bb->time * bb->lifetime) % totsplit)/(float)totsplit;
+ else
+ time = bb->time;
}
else if(bb->anim == PART_BB_ANIM_ANGLE) {
if(bb->align == PART_BB_VIEW) {
time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0);
}
- else{
+ else {
float axis1[3] = {0.0f,0.0f,0.0f};
float axis2[3] = {0.0f,0.0f,0.0f};
+
axis1[(bb->align + 1) % 3] = 1.0f;
axis2[(bb->align + 2) % 3] = 1.0f;
+
if(bb->lock == 0) {
zvec[bb->align] = 0.0f;
normalize_v3(zvec);
}
+
time = saacos(dot_v3v3(zvec, axis1)) / (float)M_PI;
+
if(dot_v3v3(zvec, axis2) < 0.0f)
time = 1.0f - time / 2.0f;
else
- time = time / 2.0f;
+ time /= 2.0f;
}
- if(bb->split_offset == PART_BB_OFF_LINEAR)
- time = (float)fmod(bb->time + (float)bb->num / (float)(bb->uv_split * bb->uv_split), 1.0f);
- else if(bb->split_offset == PART_BB_OFF_RANDOM)
- time = (float)fmod(bb->time + bb->random, 1.0f);
- }
- else{
- if(bb->split_offset == PART_BB_OFF_NONE)
- time = 0.0f;
- else if(bb->split_offset == PART_BB_OFF_LINEAR)
- time = (float)fmod((float)bb->num /(float)(bb->uv_split * bb->uv_split) , 1.0f);
- else /* split_offset==PART_BB_OFF_RANDOM */
- time = bb->random;
}
+
+ if(bb->split_offset == PART_BB_OFF_LINEAR)
+ time = (float)fmod(time + (float)bb->num / (float)totsplit, 1.0f);
+ else if(bb->split_offset==PART_BB_OFF_RANDOM)
+ time = (float)fmod(time + bb->random, 1.0f);
+
uvx = uvdx * floor((float)(bb->uv_split * bb->uv_split) * (float)fmod((double)time, (double)uvdx));
uvy = uvdy * floor((1.0f - time) * (float)bb->uv_split);
+
if(fmod(time, 1.0f / bb->uv_split) == 0.0f)
uvy -= uvdy;
}
@@ -1989,6 +1987,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
bb.time = pa_time;
bb.num = a;
+ bb.lifetime = pa_dietime-pa_birthtime;
}
particle_normal_ren(part->ren_as, part, re, obr, psmd->dm, ma, &sd, &bb, &state, seed, hasize, pa_co);