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:
authorMiika Hamalainen <blender@miikah.org>2011-07-22 22:51:53 +0400
committerMiika Hamalainen <blender@miikah.org>2011-07-22 22:51:53 +0400
commit2a97e5a772d69c0963c7757033e240abef8d56b5 (patch)
treea8737d358a27bbee8b996d31806a87069c094e23 /source/blender/blenkernel/intern
parentcbe1613c0123d7705b9bba3806c03fe09151e729 (diff)
parentffc490cbf1d93c7e0a9b97953f6f52e69b9bc8ec (diff)
Merge with trunk r38619
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/boids.c6
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c2
-rw-r--r--source/blender/blenkernel/intern/image.c3
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c77
-rw-r--r--source/blender/blenkernel/intern/particle_system.c13
-rw-r--r--source/blender/blenkernel/intern/pointcache.c6
-rw-r--r--source/blender/blenkernel/intern/sequencer.c3
-rw-r--r--source/blender/blenkernel/intern/smoke.c17
-rw-r--r--source/blender/blenkernel/intern/sound.c7
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c10
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenkernel/intern/writeavi.c7
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c2
14 files changed, 91 insertions, 68 deletions
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 9f808704eee..a0f38e675f9 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -937,6 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
BoidValues val;
BoidState *state = get_boid_state(boids, pa);
BoidParticle *bpa = pa->boid;
+ ParticleSystem *psys = bbd->sim->psys;
int rand;
//BoidCondition *cond;
@@ -959,9 +960,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f;
/* create random seed for every particle & frame */
- BLI_srandom(bbd->sim->psys->seed + p);
- rand = BLI_rand();
- BLI_srandom((int)bbd->cfra + rand);
+ rand = (int)(PSYS_FRAND(psys->seed + p) * 1000);
+ rand = (int)(PSYS_FRAND((int)bbd->cfra + rand) * 1000);
set_boid_values(&val, bbd->part->boids, pa);
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index c2800410657..d39be9d683c 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -599,7 +599,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if(part->ren_as == PART_DRAW_GR && part->dup_group) {
for(go=part->dup_group->gobject.first; go; go=go->next) {
node2 = dag_get_node(dag, go->ob);
- dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Group Visualisation");
+ dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c48497c45a1..ab67d7e3f25 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -432,6 +432,7 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
ima->gen_x= width;
ima->gen_y= height;
ima->gen_type= uvtestgrid;
+ ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
ibuf= add_ibuf_size(width, height, name, depth, floatbuf, uvtestgrid, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
@@ -2172,7 +2173,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
/* UV testgrid or black or solid etc */
if(ima->gen_x==0) ima->gen_x= 1024;
if(ima->gen_y==0) ima->gen_y= 1024;
- ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, 0, ima->gen_type, color);
+ ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok= IMA_OK_LOADED;
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 2f29074834b..962c7fd5e86 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -550,7 +550,7 @@ Material *material_pop_id(ID *id, int index)
Material **mat;
if(index + 1 != (*totcol))
- memmove((*matar), (*matar) + 1, (*totcol) - (index + 1));
+ memmove((*matar), (*matar) + 1, sizeof(void *) * ((*totcol) - (index + 1)));
(*totcol)--;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 2983923f5a9..51971f8d72d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2890,8 +2890,6 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
if(psys_in_edit_mode(sim->scene, psys))
if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
return;
-
- BLI_srandom(psys->seed);
keyed = psys->flag & PSYS_KEYED;
baked = psys->pointcache->mem_cache.first && psys->part->type != PART_HAIR;
@@ -4383,58 +4381,45 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
Object *ob = sim->ob;
ParticleSystem *psys = sim->psys;
ParticleSystemModifierData *psmd = sim->psmd;
- float loc[3], nor[3], vec[3], side[3], len, obrotmat[4][4], qmat[4][4];
- float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3];
+ float loc[3], nor[3], vec[3], side[3], len;
+ float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
len= normalize_v3(vec);
- if(psys->part->rotmode) {
- if(pa == NULL)
- pa= psys->particles+cpa->pa[0];
-
- vec_to_quat( q,xvec, ob->trackflag, ob->upflag);
- quat_to_mat4( obrotmat,q);
- obrotmat[3][3]= 1.0f;
+ if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
+ pa = psys->particles + cpa->pa[0];
- quat_to_mat4( qmat,pa->state.rot);
- mul_m4_m4m4(mat, obrotmat, qmat);
- }
- else {
- if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
- pa = psys->particles + cpa->pa[0];
-
- if(pa)
- psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
- else
- psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
+ if(pa)
+ psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
+ else
+ psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
- copy_m3_m4(nmat, ob->imat);
- transpose_m3(nmat);
- mul_m3_v3(nmat, nor);
-
- /* make sure that we get a proper side vector */
- if(fabs(dot_v3v3(nor,vec))>0.999999) {
- if(fabs(dot_v3v3(nor,xvec))>0.999999) {
- nor[0] = 0.0f;
- nor[1] = 1.0f;
- nor[2] = 0.0f;
- }
- else {
- nor[0] = 1.0f;
- nor[1] = 0.0f;
- nor[2] = 0.0f;
- }
- }
- cross_v3_v3v3(side, nor, vec);
- normalize_v3(side);
- cross_v3_v3v3(nor, vec, side);
+ copy_m3_m4(nmat, ob->imat);
+ transpose_m3(nmat);
+ mul_m3_v3(nmat, nor);
- unit_m4(mat);
- VECCOPY(mat[0], vec);
- VECCOPY(mat[1], side);
- VECCOPY(mat[2], nor);
+ /* make sure that we get a proper side vector */
+ if(fabs(dot_v3v3(nor,vec))>0.999999) {
+ if(fabs(dot_v3v3(nor,xvec))>0.999999) {
+ nor[0] = 0.0f;
+ nor[1] = 1.0f;
+ nor[2] = 0.0f;
+ }
+ else {
+ nor[0] = 1.0f;
+ nor[1] = 0.0f;
+ nor[2] = 0.0f;
+ }
}
+ cross_v3_v3v3(side, nor, vec);
+ normalize_v3(side);
+ cross_v3_v3v3(nor, vec, side);
+
+ unit_m4(mat);
+ VECCOPY(mat[0], vec);
+ VECCOPY(mat[1], side);
+ VECCOPY(mat[2], nor);
*scale= len;
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index b2e5c059edf..1423f520b95 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3510,13 +3510,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
static void hair_step(ParticleSimulationData *sim, float cfra)
{
ParticleSystem *psys = sim->psys;
-/* ParticleSettings *part = psys->part; */
+ ParticleSettings *part = psys->part;
PARTICLE_P;
float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
- BLI_srandom(psys->seed);
-
LOOP_PARTICLES {
+ pa->size = part->size;
+ if(part->randsize > 0.0f)
+ pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
+
if(PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
else
@@ -3801,8 +3803,6 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
PARTICLE_P;
float disp, dietime;
- BLI_srandom(psys->seed);
-
psys_update_effectors(sim);
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
@@ -3987,7 +3987,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
/* clear everythin on start frame */
- if((int)cfra == startframe) {
+ if(cfra == startframe) {
BKE_ptcache_id_reset(sim->scene, pid, PTCACHE_RESET_OUTDATED);
BKE_ptcache_validate(cache, startframe);
cache->flag &= ~PTCACHE_REDO_NEEDED;
@@ -4054,7 +4054,6 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* set particles to be not calculated TODO: can't work with pointcache */
disp= (float)psys_get_current_display_percentage(psys)/100.0f;
- BLI_srandom(psys->seed);
LOOP_PARTICLES {
if(PSYS_FRAND(p) > disp)
pa->flag |= PARS_NO_DISP;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 32bb01110e9..e347e3896b0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -518,6 +518,7 @@ static int ptcache_cloth_totpoint(void *cloth_v, int UNUSED(cfra))
return clmd->clothObject ? clmd->clothObject->numverts : 0;
}
+#ifdef WITH_SMOKE
/* Smoke functions */
static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra))
{
@@ -656,6 +657,11 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
return 1;
}
+#else // WITH_SMOKE
+static int ptcache_smoke_totpoint(void *UNUSED(smoke_v), int UNUSED(cfra)) { return 0; };
+static void ptcache_smoke_read(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) {}
+static int ptcache_smoke_write(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) { return 0; }
+#endif // WITH_SMOKE
static int ptcache_dynamicpaint_totpoint(void *sd, int cfra)
{
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 265cc3eeb79..d6a152a5280 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3232,9 +3232,10 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
{
char name[sizeof(seq_a->name)];
- if(seq_a->len != seq_b->len)
+ if(seq_a->len != seq_b->len) {
*error_str= "Strips must be the same length";
return 0;
+ }
/* type checking, could be more advanced but disalow sound vs non-sound copy */
if(seq_a->type != seq_b->type) {
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 4405bce3d51..6ab1574ca80 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -140,6 +140,19 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
#define TRI_UVOFFSET (1./4.)
+/* Stubs to use when smoke is disabled */
+#ifndef WITH_SMOKE
+struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; }
+struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; }
+void smoke_free(struct FLUID_3D *UNUSED(fluid)) {}
+void smoke_turbulence_free(struct WTURBULENCE *UNUSED(wt)) {}
+void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(strength)) {}
+void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {}
+long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; }
+void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {}
+#endif // WITH_SMOKE
+
+
static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
{
if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
@@ -805,6 +818,9 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
// forward decleration
static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct);
static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
+
+#ifdef WITH_SMOKE
+
static int get_lamp(Scene *scene, float *light)
{
Base *base_tmp = NULL;
@@ -1646,3 +1662,4 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
}
}
+#endif // WITH_SMOKE
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index f2e3537762f..1c61646a3d8 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -36,9 +36,6 @@
#include "BKE_animsys.h"
-static int force_device = -1;
-
-
struct bSound* sound_new_file(struct Main *bmain, const char *filename)
{
bSound* sound = NULL;
@@ -94,6 +91,8 @@ void sound_free(struct bSound* sound)
#ifdef WITH_AUDASPACE
+static int force_device = -1;
+
#ifdef WITH_JACK
static void sound_sync_callback(void* data, int mode, float time)
{
@@ -537,7 +536,7 @@ void sound_play_scene(struct Scene *UNUSED(scene)) {}
void sound_stop_scene(struct Scene *UNUSED(scene)) {}
void sound_seek_scene(struct bContext *UNUSED(C)) {}
float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
-int sound_scene_playing(struct Scene *UNUSED(scene)) { return 0; }
+int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; }
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index d1a12464d26..f66f7ca023e 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1176,7 +1176,8 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
CCGSubSurf *ss = ccgdm->ss;
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
- int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
+ int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
+ int totedge = ccgSubSurf_getNumEdges(ss);
int gridSize = ccgSubSurf_getGridSize(ss);
int useAging;
@@ -1184,13 +1185,16 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL);
- for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
- CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
+ for (j=0; j< totedge; j++) {
+ CCGEdge *e = ccgdm->edgeMap[j].edge;
DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
continue;
+ if(ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
+ continue;
+
if (useAging && !(G.f&G_BACKBUFSEL)) {
int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
glColor3ub(0, ageCol>0?ageCol:0, 0);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 64f3c111434..036ba34d0c8 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1486,6 +1486,10 @@ int BKE_texture_dependsOnTime(const struct Tex *texture)
// assume anything in adt means the texture is animated
return 1;
}
+ else if(texture->type == TEX_NOISE) {
+ // noise always varies with time
+ return 1;
+ }
return 0;
}
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index ba7f9bdd415..769a3f9b11e 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -105,13 +105,18 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
mh.get_movie_path = filepath_ffmpeg;
}
#endif
+#ifdef WITH_FRAMESERVER
if (imtype == R_FRAMESERVER) {
mh.start_movie = start_frameserver;
mh.append_movie = append_frameserver;
mh.end_movie = end_frameserver;
mh.get_next_frame = frameserver_loop;
}
-
+#endif
+
+ /* incase all above are disabled */
+ (void)imtype;
+
return &mh;
}
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index 2239f6d3147..d13d15d1269 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -22,6 +22,7 @@
*
*/
+#ifdef WITH_FRAMESERVER
#include <string.h>
#include <stdio.h>
@@ -381,3 +382,4 @@ void end_frameserver(void)
shutdown_socket_system();
}
+#endif /* WITH_FRAMESERVER */