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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_group.h1
-rw-r--r--source/blender/blenkernel/intern/BME_tools.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c16
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c2
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c20
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c2
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h7
-rw-r--r--source/blender/blenlib/BLI_math.h2
-rw-r--r--source/blender/blenlib/BLI_math_geom.h36
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h3
-rw-r--r--source/blender/blenlib/BLI_math_vector.h5
-rw-r--r--source/blender/blenlib/BLI_memarena.h2
-rw-r--r--source/blender/blenlib/BLI_rand.h6
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c2
-rw-r--r--source/blender/blenlib/intern/BLI_memarena.c8
-rw-r--r--source/blender/blenlib/intern/math_geom.c455
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c138
-rw-r--r--source/blender/blenlib/intern/math_matrix.c61
-rw-r--r--source/blender/blenlib/intern/math_vector.c8
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c22
-rw-r--r--source/blender/blenlib/intern/threads.c5
-rw-r--r--source/blender/editors/armature/meshlaplacian.c4
-rw-r--r--source/blender/editors/interface/interface_icons.c14
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c3
-rw-r--r--source/blender/editors/object/object_bake.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c2
-rw-r--r--source/blender/editors/render/render_internal.c21
-rw-r--r--source/blender/editors/render/render_preview.c4
-rw-r--r--source/blender/editors/screen/screendump.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c16
-rw-r--r--source/blender/editors/space_node/node_edit.c2
-rw-r--r--source/blender/editors/space_outliner/outliner.c2
-rw-r--r--source/blender/editors/space_view3d/SConscript2
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c4
-rw-r--r--source/blender/gpu/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c2
-rw-r--r--source/blender/makesrna/RNA_types.h2
-rw-r--r--source/blender/makesrna/intern/makesrna.c10
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c2
-rw-r--r--source/blender/makesrna/intern/rna_scene.c3
-rw-r--r--source/blender/modifiers/SConscript9
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c2
-rw-r--r--source/blender/render/intern/raytrace/Makefile2
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp20
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp4
-rw-r--r--source/blender/render/intern/raytrace/rayobject_svbvh.cpp4
-rw-r--r--source/blender/render/intern/raytrace/rayobject_vbvh.cpp4
-rw-r--r--source/blender/render/intern/source/Makefile2
-rw-r--r--source/blender/render/intern/source/convertblender.c8
-rw-r--r--source/blender/render/intern/source/occlusion.c2
-rw-r--r--source/blender/render/intern/source/shadbuf.c8
-rw-r--r--source/blender/render/intern/source/sss.c2
-rw-r--r--source/blender/render/intern/source/strand.c4
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c12
63 files changed, 873 insertions, 136 deletions
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index d1491cc1616..e63e3c93f1e 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -31,6 +31,7 @@
#ifndef BKE_GROUP_H
#define BKE_GROUP_H
+struct Base;
struct Group;
struct GroupObject;
struct Object;
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c
index 9753ad47488..b4919dd8cf3 100644
--- a/source/blender/blenkernel/intern/BME_tools.c
+++ b/source/blender/blenkernel/intern/BME_tools.c
@@ -50,7 +50,7 @@ BME_TransData_Head *BME_init_transdata(int bufsize) {
td = MEM_callocN(sizeof(BME_TransData_Head), "BMesh transdata header");
td->gh = BLI_ghash_new(BLI_ghashutil_ptrhash,BLI_ghashutil_ptrcmp);
- td->ma = BLI_memarena_new(bufsize);
+ td->ma = BLI_memarena_new(bufsize, "BME_TransData arena");
BLI_memarena_use_calloc(td->ma);
return td;
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 44757a09d42..aa9974a7e20 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2489,7 +2489,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
tangent= DM_get_face_data_layer(dm, CD_TANGENT);
/* allocate some space */
- arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "tangent layer arena");
BLI_memarena_use_calloc(arena);
vtangents= MEM_callocN(sizeof(VertexTangent*)*totvert, "VertexTangent");
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index b687062fe15..77b6f5b481f 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -646,8 +646,18 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
}
dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
- dob->no_draw= (dob->origlay & group->layer)==0;
-
+
+ /* check the group instance and object layers match, also that the object visible flags are ok. */
+ if( (dob->origlay & group->layer)==0 ||
+ (G.rendering==0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
+ (G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER)
+ ) {
+ dob->no_draw= 1;
+ }
+ else {
+ dob->no_draw= 0;
+ }
+
if(go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
object_duplilist_recursive((ID *)group, scene, go->ob, lb, ob->obmat, level+1, animated);
@@ -1003,7 +1013,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
copy_m4_m4(tmat, obmat);
mul_m4_m4m3(obmat, tmat, mat);
- dob= new_dupli_object(lb, ob, obmat, lay, a, OB_DUPLIFACES, animated);
+ dob= new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIFACES, animated);
if(G.rendering) {
w= (mv4)? 0.25f: 1.0f/3.0f;
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 86cafa733ff..f63e28fb464 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2237,6 +2237,8 @@ void DAG_on_load_update(void)
for(go= group->gobject.first; go; go= go->next) {
if(ELEM5(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
go->ob->recalc |= OB_RECALC_DATA;
+ if(go->ob->proxy_from)
+ go->ob->recalc |= OB_RECALC_OB;
}
group->id.flag &= ~LIB_DOIT;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 55dcc38ebcf..7d194461c78 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1,4 +1,4 @@
-/* image.c
+/* image.c
*
* $Id$
*
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 7ad65820bbe..d41ede22006 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -4215,18 +4215,11 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
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];
+ float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3];
sub_v3_v3v3(vec, (cache+cache->steps-1)->co, cache->co);
len= normalize_v3(vec);
- 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,
- (psys->part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
- cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
-
if(psys->part->rotmode) {
if(!pa)
pa= psys->particles+cpa->pa[0];
@@ -4239,6 +4232,17 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
mul_m4_m4m4(mat, obrotmat, qmat);
}
else {
+ 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,
+ (psys->part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
+ 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) {
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 3972355d302..16cb671f2d0 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -117,7 +117,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin
if (useArena) {
CCGAllocatorIFC allocatorIFC;
- CCGAllocatorHDL allocator = BLI_memarena_new((1<<16));
+ CCGAllocatorHDL allocator = BLI_memarena_new((1<<16), "subsurf arena");
allocatorIFC.alloc = arena_alloc;
allocatorIFC.realloc = arena_realloc;
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index fc5469df23a..d9e3d7e42c6 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -32,6 +32,10 @@
#ifndef BLI_KDOPBVH_H
#define BLI_KDOPBVH_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <float.h>
struct BVHTree;
@@ -100,6 +104,9 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl
/* range query */
int BLI_bvhtree_range_query(BVHTree *tree, const float *co, float radius, BVHTree_RangeQuery callback, void *userdata);
+#ifdef __cplusplus
+}
+#endif
#endif // BLI_KDOPBVH_H
diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h
index 341a3a32934..d0fb530e349 100644
--- a/source/blender/blenlib/BLI_math.h
+++ b/source/blender/blenlib/BLI_math.h
@@ -55,10 +55,10 @@
#include "BLI_math_base.h"
#include "BLI_math_color.h"
-#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
+#include "BLI_math_geom.h"
#endif /* BLI_MATH */
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 560a5b1abc9..5d84de7531a 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -32,6 +32,12 @@
extern "C" {
#endif
+#include "BLI_math_inline.h"
+
+#ifdef BLI_MATH_INLINE
+#include "intern/math_geom_inline.c"
+#endif
+
/********************************** Polygons *********************************/
void cent_tri_v3(float r[3], float a[3], float b[3], float c[3]);
@@ -146,6 +152,8 @@ void orthographic_m4(float mat[4][4], float left, float right,
int box_clip_bounds_m4(float boundbox[2][3],
float bounds[4], float winmat[4][4]);
+void box_minmax_bounds_m4(float min[3], float max[3],
+ float boundbox[2][3], float mat[4][4]);
/********************************** Mapping **********************************/
@@ -165,11 +173,33 @@ void sum_or_add_vertex_tangent(void *arena, VertexTangent **vtang,
void tangent_from_uv(float *uv1, float *uv2, float *uv3,
float *co1, float *co2, float *co3, float *n, float *tang);
-/********************************* vector clouds******************************/
+/******************************** Vector Clouds ******************************/
+
+void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,
+ float (*rpos)[3], float *rweight,
+ float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]);
+
+/****************************** Spherical Harmonics *************************/
+
+/* Uses 2nd order SH => 9 coefficients, stored in this order:
+ 0 = (0,0),
+ 1 = (1,-1), 2 = (1,0), 3 = (1,1),
+ 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
+
+MINLINE void zero_sh(float r[9]);
+MINLINE void copy_sh_sh(float r[9], float a[9]);
+MINLINE void mul_sh_fl(float r[9], float f);
+MINLINE void add_sh_shsh(float r[9], float a[9], float b[9]);
+
+MINLINE float eval_shv3(float r[9], float v[3]);
+MINLINE float diffuse_shv3(float r[9], float v[3]);
+MINLINE void vec_fac_to_sh(float r[9], float v[3], float f);
+MINLINE void madd_sh_shfl(float r[9], float sh[3], float f);
+/********************************* Form Factor *******************************/
-void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,float (*rpos)[3], float *rweight,
- float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]);
+float form_factor_hemi_poly(float p[3], float n[3],
+ float v1[3], float v2[3], float v3[3], float v4[3]);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 8f897fdd5d6..31cefb21e7a 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -78,7 +78,8 @@ void mul_serie_m4(float R[4][4],
void mul_m4_v3(float M[4][4], float r[3]);
void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
-void mul_m4_v4(float M[4][4], float r[3]);
+void mul_m4_v4(float M[4][4], float r[4]);
+void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
void mul_project_m4_v4(float M[4][4], float r[3]);
void mul_m3_v3(float M[3][3], float r[3]);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 3ed8169f260..91e743271d2 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -32,6 +32,8 @@
extern "C" {
#endif
+#include "BLI_math_inline.h"
+
#ifdef BLI_MATH_INLINE
#include "intern/math_vector_inline.c"
#endif
@@ -75,6 +77,7 @@ MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]);
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f);
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f);
MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]);
+MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f);
MINLINE void negate_v3(float r[3]);
MINLINE void negate_v3_v3(float r[3], const float a[3]);
@@ -93,6 +96,7 @@ MINLINE float len_v2(const float a[2]);
MINLINE float len_v2v2(const float a[2], const float b[2]);
MINLINE float len_v3(const float a[3]);
MINLINE float len_v3v3(const float a[3], const float b[3]);
+MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
MINLINE float normalize_v2(float r[2]);
MINLINE float normalize_v2_v2(float r[2], const float a[2]);
@@ -107,6 +111,7 @@ void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]);
void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4]);
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t);
+void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]);
void mid_v3_v3v3(float r[3], float a[3], float b[3]);
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index 2383b2ed139..a17c88b70df 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -51,7 +51,7 @@ struct MemArena;
typedef struct MemArena MemArena;
-struct MemArena* BLI_memarena_new (int bufsize);
+struct MemArena* BLI_memarena_new (int bufsize, const char *name);
void BLI_memarena_free (struct MemArena *ma);
void BLI_memarena_use_malloc (struct MemArena *ma);
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index b089d7e052f..eab9f92d7e8 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -83,15 +83,15 @@ void BLI_array_randomize (void *data, int elemSize, int numElems, unsigned int s
/** Better seed for the random number generator, using noise.c hash[] */
- /** Allows up to 16 threads to address */
+ /** Allows up to BLENDER_MAX_THREADS threads to address */
void BLI_thread_srandom (int thread, unsigned int seed);
/** Return a pseudo-random number N where 0<=N<(2^31) */
- /** Allows up to 16 threads to address */
+ /** Allows up to BLENDER_MAX_THREADS threads to address */
int BLI_thread_rand (int thread);
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
- /** Allows up to 16 threads to address */
+ /** Allows up to BLENDER_MAX_THREADS threads to address */
float BLI_thread_frand (int thread);
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index cf21707cd39..a1e44f65200 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -65,6 +65,7 @@ int BLI_system_thread_count(void); /* gets the number of threads the system can
#define LOCK_PREVIEW 1
#define LOCK_VIEWER 2
#define LOCK_CUSTOM1 3
+#define LOCK_RCACHE 2
void BLI_lock_thread(int type);
void BLI_unlock_thread(int type);
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 6c4e568c380..f6616ecb06b 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -69,7 +69,7 @@ Heap *BLI_heap_new()
Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap");
heap->bufsize = 1;
heap->tree = (HeapNode**)MEM_mallocN(sizeof(HeapNode*), "BLIHeapTree");
- heap->arena = BLI_memarena_new(1<<16);
+ heap->arena = BLI_memarena_new(1<<16, "heap arena");
return heap;
}
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 07e22b30fcc..cdb88e91cad 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -41,6 +41,7 @@
struct MemArena {
unsigned char *curbuf;
int bufsize, cursize;
+ const char *name;
int use_calloc;
int align;
@@ -48,10 +49,11 @@ struct MemArena {
LinkNode *bufs;
};
-MemArena *BLI_memarena_new(int bufsize) {
+MemArena *BLI_memarena_new(int bufsize, const char *name) {
MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
ma->bufsize= bufsize;
ma->align = 8;
+ ma->name= name;
return ma;
}
@@ -94,9 +96,9 @@ void *BLI_memarena_alloc(MemArena *ma, int size) {
else ma->cursize = ma->bufsize;
if(ma->use_calloc)
- ma->curbuf= MEM_callocN(ma->cursize, "memarena calloc");
+ ma->curbuf= MEM_callocN(ma->cursize, ma->name);
else
- ma->curbuf= MEM_mallocN(ma->cursize, "memarena malloc");
+ ma->curbuf= MEM_mallocN(ma->cursize, ma->name);
BLI_linklist_prepend(&ma->bufs, ma->curbuf);
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 27f36752f80..af408e6bcc9 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -26,9 +26,12 @@
* */
+#include "MEM_guardedalloc.h"
+
#include "BLI_math.h"
#include "BLI_memarena.h"
-#include "MEM_guardedalloc.h"
+
+#include "BKE_utildefines.h"
/********************************** Polygons *********************************/
@@ -121,10 +124,6 @@ float area_tri_v3(const float v1[3], const float v2[3], const float v3[3]) /* T
return (len/2.0f);
}
-#define MAX2(x,y) ((x)>(y) ? (x) : (y))
-#define MAX3(x,y,z) MAX2(MAX2((x),(y)) , (z))
-
-
float area_poly_v3(int nr, float verts[][3], float *normal)
{
float x, y, z, area, max;
@@ -1763,6 +1762,27 @@ int box_clip_bounds_m4(float boundbox[2][3], float bounds[4], float winmat[4][4]
return flag;
}
+void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], float mat[4][4])
+{
+ float mn[3], mx[3], vec[3];
+ int a;
+
+ copy_v3_v3(mn, min);
+ copy_v3_v3(mx, max);
+
+ for(a=0; a<8; a++) {
+ vec[0]= (a & 1)? boundbox[0][0]: boundbox[1][0];
+ vec[1]= (a & 2)? boundbox[0][1]: boundbox[1][1];
+ vec[2]= (a & 4)? boundbox[0][2]: boundbox[1][2];
+
+ mul_m4_v3(mat, vec);
+ DO_MINMAX(vec, mn, mx);
+ }
+
+ copy_v3_v3(min, mn);
+ copy_v3_v3(max, mx);
+}
+
/********************************** Mapping **********************************/
void map_to_tube(float *u, float *v,float x, float y, float z)
@@ -1794,9 +1814,7 @@ void map_to_sphere(float *u, float *v,float x, float y, float z)
}
}
-/********************************************************/
-
-/* Tangents */
+/********************************* Tangents **********************************/
/* For normal map tangents we need to detect uv boundaries, and only average
* tangents in case the uvs are connected. Alternative would be to store 1
@@ -1875,7 +1893,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2,
}
}
-/********************************************************/
+/****************************** Vector Clouds ********************************/
/* vector clouds */
/* void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,float (*rpos)[3], float *rweight,
@@ -2034,3 +2052,422 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
}
}
+/******************************* Form Factor *********************************/
+
+static void vec_add_dir(float r[3], float v1[3], float v2[3], float fac)
+{
+ r[0]= v1[0] + fac*(v2[0] - v1[0]);
+ r[1]= v1[1] + fac*(v2[1] - v1[1]);
+ r[2]= v1[2] + fac*(v2[2] - v1[2]);
+}
+
+static int ff_visible_quad(float p[3], float n[3], float v0[3], float v1[3], float v2[3], float q0[3], float q1[3], float q2[3], float q3[3])
+{
+ static const float epsilon = 1e-6f;
+ float c, sd[3];
+
+ c= dot_v3v3(n, p);
+
+ /* signed distances from the vertices to the plane. */
+ sd[0]= dot_v3v3(n, v0) - c;
+ sd[1]= dot_v3v3(n, v1) - c;
+ sd[2]= dot_v3v3(n, v2) - c;
+
+ if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
+ if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
+ if(fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
+
+ if(sd[0] > 0) {
+ if(sd[1] > 0) {
+ if(sd[2] > 0) {
+ // +++
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // ++-
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ vec_add_dir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ }
+ else {
+ // ++0
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ }
+ else if(sd[1] < 0) {
+ if(sd[2] > 0) {
+ // +-+
+ copy_v3_v3(q0, v0);
+ vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ copy_v3_v3(q3, v2);
+ }
+ else if(sd[2] < 0) {
+ // +--
+ copy_v3_v3(q0, v0);
+ vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ vec_add_dir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ copy_v3_v3(q3, q2);
+ }
+ else {
+ // +-0
+ copy_v3_v3(q0, v0);
+ vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ }
+ else {
+ if(sd[2] > 0) {
+ // +0+
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // +0-
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ vec_add_dir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ copy_v3_v3(q3, q2);
+ }
+ else {
+ // +00
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ }
+ }
+ else if(sd[0] < 0) {
+ if(sd[1] > 0) {
+ if(sd[2] > 0) {
+ // -++
+ vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ vec_add_dir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ }
+ else if(sd[2] < 0) {
+ // -+-
+ vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ copy_v3_v3(q1, v1);
+ vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ copy_v3_v3(q3, q2);
+ }
+ else {
+ // -+0
+ vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ }
+ else if(sd[1] < 0) {
+ if(sd[2] > 0) {
+ // --+
+ vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // ---
+ return 0;
+ }
+ else {
+ // --0
+ return 0;
+ }
+ }
+ else {
+ if(sd[2] > 0) {
+ // -0+
+ vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // -0-
+ return 0;
+ }
+ else {
+ // -00
+ return 0;
+ }
+ }
+ }
+ else {
+ if(sd[1] > 0) {
+ if(sd[2] > 0) {
+ // 0++
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // 0+-
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ copy_v3_v3(q3, q2);
+ }
+ else {
+ // 0+0
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ }
+ else if(sd[1] < 0) {
+ if(sd[2] > 0) {
+ // 0-+
+ copy_v3_v3(q0, v0);
+ vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // 0--
+ return 0;
+ }
+ else {
+ // 0-0
+ return 0;
+ }
+ }
+ else {
+ if(sd[2] > 0) {
+ // 00+
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
+ }
+ else if(sd[2] < 0) {
+ // 00-
+ return 0;
+ }
+ else {
+ // 000
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+/* altivec optimization, this works, but is unused */
+
+#if 0
+#include <Accelerate/Accelerate.h>
+
+typedef union {
+ vFloat v;
+ float f[4];
+} vFloatResult;
+
+static vFloat vec_splat_float(float val)
+{
+ return (vFloat){val, val, val, val};
+}
+
+static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
+{
+ vFloat vcos, rlen, vrx, vry, vrz, vsrx, vsry, vsrz, gx, gy, gz, vangle;
+ vUInt8 rotate = (vUInt8){4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
+ vFloatResult vresult;
+ float result;
+
+ /* compute r* */
+ vrx = (vFloat){q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
+ vry = (vFloat){q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
+ vrz = (vFloat){q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
+
+ /* normalize r* */
+ rlen = vec_rsqrte(vrx*vrx + vry*vry + vrz*vrz + vec_splat_float(1e-16f));
+ vrx = vrx*rlen;
+ vry = vry*rlen;
+ vrz = vrz*rlen;
+
+ /* rotate r* for cross and dot */
+ vsrx= vec_perm(vrx, vrx, rotate);
+ vsry= vec_perm(vry, vry, rotate);
+ vsrz= vec_perm(vrz, vrz, rotate);
+
+ /* cross product */
+ gx = vsry*vrz - vsrz*vry;
+ gy = vsrz*vrx - vsrx*vrz;
+ gz = vsrx*vry - vsry*vrx;
+
+ /* normalize */
+ rlen = vec_rsqrte(gx*gx + gy*gy + gz*gz + vec_splat_float(1e-16f));
+ gx = gx*rlen;
+ gy = gy*rlen;
+ gz = gz*rlen;
+
+ /* angle */
+ vcos = vrx*vsrx + vry*vsry + vrz*vsrz;
+ vcos= vec_max(vec_min(vcos, vec_splat_float(1.0f)), vec_splat_float(-1.0f));
+ vangle= vacosf(vcos);
+
+ /* dot */
+ vresult.v = (vec_splat_float(n[0])*gx +
+ vec_splat_float(n[1])*gy +
+ vec_splat_float(n[2])*gz)*vangle;
+
+ result= (vresult.f[0] + vresult.f[1] + vresult.f[2] + vresult.f[3])*(0.5f/(float)M_PI);
+ result= MAX2(result, 0.0f);
+
+ return result;
+}
+
+#endif
+
+/* SSE optimization, acos code doesn't work */
+
+#if 0
+
+#include <xmmintrin.h>
+
+static __m128 sse_approx_acos(__m128 x)
+{
+ /* needs a better approximation than taylor expansion of acos, since that
+ * gives big erros for near 1.0 values, sqrt(2*x)*acos(1-x) should work
+ * better, see http://www.tom.womack.net/projects/sse-fast-arctrig.html */
+
+ return _mm_set_ps1(1.0f);
+}
+
+static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
+{
+ float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3];
+ float a1, a2, a3, a4, dot1, dot2, dot3, dot4, result;
+ float fresult[4] __attribute__((aligned(16)));
+ __m128 qx, qy, qz, rx, ry, rz, rlen, srx, sry, srz, gx, gy, gz, glen, rcos, angle, aresult;
+
+ /* compute r */
+ qx = _mm_set_ps(q3[0], q2[0], q1[0], q0[0]);
+ qy = _mm_set_ps(q3[1], q2[1], q1[1], q0[1]);
+ qz = _mm_set_ps(q3[2], q2[2], q1[2], q0[2]);
+
+ rx = qx - _mm_set_ps1(p[0]);
+ ry = qy - _mm_set_ps1(p[1]);
+ rz = qz - _mm_set_ps1(p[2]);
+
+ /* normalize r */
+ rlen = _mm_rsqrt_ps(rx*rx + ry*ry + rz*rz + _mm_set_ps1(1e-16f));
+ rx = rx*rlen;
+ ry = ry*rlen;
+ rz = rz*rlen;
+
+ /* cross product */
+ srx = _mm_shuffle_ps(rx, rx, _MM_SHUFFLE(0,3,2,1));
+ sry = _mm_shuffle_ps(ry, ry, _MM_SHUFFLE(0,3,2,1));
+ srz = _mm_shuffle_ps(rz, rz, _MM_SHUFFLE(0,3,2,1));
+
+ gx = sry*rz - srz*ry;
+ gy = srz*rx - srx*rz;
+ gz = srx*ry - sry*rx;
+
+ /* normalize g */
+ glen = _mm_rsqrt_ps(gx*gx + gy*gy + gz*gz + _mm_set_ps1(1e-16f));
+ gx = gx*glen;
+ gy = gy*glen;
+ gz = gz*glen;
+
+ /* compute angle */
+ rcos = rx*srx + ry*sry + rz*srz;
+ rcos= _mm_max_ps(_mm_min_ps(rcos, _mm_set_ps1(1.0f)), _mm_set_ps1(-1.0f));
+
+ angle = sse_approx_cos(rcos);
+ aresult = (_mm_set_ps1(n[0])*gx + _mm_set_ps1(n[1])*gy + _mm_set_ps1(n[2])*gz)*angle;
+
+ /* sum together */
+ result= (fresult[0] + fresult[1] + fresult[2] + fresult[3])*(0.5f/(float)M_PI);
+ result= MAX2(result, 0.0f);
+
+ return result;
+}
+
+#endif
+
+static void ff_normalize(float n[3])
+{
+ float d;
+
+ d= dot_v3v3(n, n);
+
+ if(d > 1.0e-35F) {
+ d= 1.0f/sqrtf(d);
+
+ n[0] *= d;
+ n[1] *= d;
+ n[2] *= d;
+ }
+}
+
+static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
+{
+ float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3];
+ float a1, a2, a3, a4, dot1, dot2, dot3, dot4, result;
+
+ sub_v3_v3v3(r0, q0, p);
+ sub_v3_v3v3(r1, q1, p);
+ sub_v3_v3v3(r2, q2, p);
+ sub_v3_v3v3(r3, q3, p);
+
+ ff_normalize(r0);
+ ff_normalize(r1);
+ ff_normalize(r2);
+ ff_normalize(r3);
+
+ cross_v3_v3v3(g0, r1, r0); ff_normalize(g0);
+ cross_v3_v3v3(g1, r2, r1); ff_normalize(g1);
+ cross_v3_v3v3(g2, r3, r2); ff_normalize(g2);
+ cross_v3_v3v3(g3, r0, r3); ff_normalize(g3);
+
+ a1= saacosf(dot_v3v3(r0, r1));
+ a2= saacosf(dot_v3v3(r1, r2));
+ a3= saacosf(dot_v3v3(r2, r3));
+ a4= saacosf(dot_v3v3(r3, r0));
+
+ dot1= dot_v3v3(n, g0);
+ dot2= dot_v3v3(n, g1);
+ dot3= dot_v3v3(n, g2);
+ dot4= dot_v3v3(n, g3);
+
+ result= (a1*dot1 + a2*dot2 + a3*dot3 + a4*dot4)*0.5f/(float)M_PI;
+ result= MAX2(result, 0.0f);
+
+ return result;
+}
+
+float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], float v3[3], float v4[3])
+{
+ /* computes how much hemisphere defined by point and normal is
+ covered by a quad or triangle, cosine weighted */
+ float q0[3], q1[3], q2[3], q3[3], contrib= 0.0f;
+
+ if(ff_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
+ contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
+
+ if(v4 && ff_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
+ contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
+
+ return contrib;
+}
+
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
new file mode 100644
index 00000000000..8b04b2a4005
--- /dev/null
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -0,0 +1,138 @@
+/**
+ * $Id: math_base_inline.c 26367 2010-01-28 16:02:26Z blendix $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: some of this file.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ * */
+
+#include "BLI_math.h"
+
+#ifndef BLI_MATH_GEOM_INLINE
+#define BLI_MATH_GEOM_INLINE
+
+/****************************** Spherical Harmonics **************************/
+
+MINLINE void zero_sh(float r[9])
+{
+ memset(r, 0, sizeof(float)*9);
+}
+
+MINLINE void copy_sh_sh(float r[9], float a[9])
+{
+ memcpy(r, a, sizeof(float)*9);
+}
+
+MINLINE void mul_sh_fl(float r[9], float f)
+{
+ int i;
+
+ for(i=0; i<9; i++)
+ r[i] *= f;
+}
+
+MINLINE void add_sh_shsh(float r[9], float a[9], float b[9])
+{
+ int i;
+
+ for(i=0; i<9; i++)
+ r[i]= a[i] + b[i];
+}
+
+MINLINE float dot_shsh(float a[9], float b[9])
+{
+ float r= 0.0f;
+ int i;
+
+ for(i=0; i<9; i++)
+ r += a[i]*b[i];
+
+ return r;
+}
+
+MINLINE float diffuse_shv3(float sh[9], float v[3])
+{
+ /* See formula (13) in:
+ "An Efficient Representation for Irradiance Environment Maps" */
+ static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f;
+ static const float c4 = 0.886227f, c5 = 0.247708f;
+ float x, y, z, sum;
+
+ x= v[0];
+ y= v[1];
+ z= v[2];
+
+ sum= c1*sh[8]*(x*x - y*y);
+ sum += c3*sh[6]*z*z;
+ sum += c4*sh[0];
+ sum += -c5*sh[6];
+ sum += 2.0f*c1*(sh[4]*x*y + sh[7]*x*z + sh[5]*y*z);
+ sum += 2.0f*c2*(sh[3]*x + sh[1]*y + sh[2]*z);
+
+ return sum;
+}
+
+MINLINE void vec_fac_to_sh(float r[9], float v[3], float f)
+{
+ /* See formula (3) in:
+ "An Efficient Representation for Irradiance Environment Maps" */
+ float sh[9], x, y, z;
+
+ x= v[0];
+ y= v[1];
+ z= v[2];
+
+ sh[0]= 0.282095f;
+
+ sh[1]= 0.488603f*y;
+ sh[2]= 0.488603f*z;
+ sh[3]= 0.488603f*x;
+
+ sh[4]= 1.092548f*x*y;
+ sh[5]= 1.092548f*y*z;
+ sh[6]= 0.315392f*(3.0f*z*z - 1.0f);
+ sh[7]= 1.092548f*x*z;
+ sh[8]= 0.546274f*(x*x - y*y);
+
+ mul_sh_fl(sh, f);
+ copy_sh_sh(r, sh);
+}
+
+MINLINE float eval_shv3(float sh[9], float v[3])
+{
+ float tmp[9];
+
+ vec_fac_to_sh(tmp, v, 1.0f);
+ return dot_shsh(tmp, sh);
+}
+
+MINLINE void madd_sh_shfl(float r[9], float sh[3], float f)
+{
+ float tmp[9];
+
+ copy_sh_sh(tmp, sh);
+ mul_sh_fl(tmp, f);
+ add_sh_shsh(r, r, tmp);
+}
+
+#endif /* BLI_MATH_GEOM_INLINE */
+
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index fca8cf445d1..396ae7ca5ee 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -125,10 +125,15 @@ void swap_m4m4(float m1[][4], float m2[][4])
/******************************** Arithmetic *********************************/
-void mul_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
+void mul_m4_m4m4(float m1[][4], float m2_[][4], float m3_[][4])
{
- /* matrix product: m1[j][k] = m2[j][i].m3[i][k] */
+ float m2[4][4], m3[4][4];
+ /* copy so it works when m1 is the same pointer as m2 or m3 */
+ copy_m4_m4(m2, m2_);
+ copy_m4_m4(m3, m3_);
+
+ /* matrix product: m1[j][k] = m2[j][i].m3[i][k] */
m1[0][0] = m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0] + m2[0][3]*m3[3][0];
m1[0][1] = m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1] + m2[0][3]*m3[3][1];
m1[0][2] = m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2] + m2[0][3]*m3[3][2];
@@ -151,20 +156,26 @@ void mul_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
}
-void mul_m3_m3m3(float m1[][3], float m3[][3], float m2[][3])
+void mul_m3_m3m3(float m1[][3], float m3_[][3], float m2_[][3])
{
- /* m1[i][j] = m2[i][k]*m3[k][j], args are flipped! */
- m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0];
- m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1];
- m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2];
+ float m2[3][3], m3[3][3];
+
+ /* copy so it works when m1 is the same pointer as m2 or m3 */
+ copy_m3_m3(m2, m2_);
+ copy_m3_m3(m3, m3_);
- m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0];
- m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1];
- m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2];
+ /* m1[i][j] = m2[i][k]*m3[k][j], args are flipped! */
+ m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0];
+ m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1];
+ m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2];
- m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0];
- m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1];
- m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2];
+ m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0];
+ m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1];
+ m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2];
+
+ m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0];
+ m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1];
+ m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2];
}
void mul_m4_m4m3(float (*m1)[4], float (*m3)[4], float (*m2)[3])
@@ -321,17 +332,23 @@ void mul_project_m4_v4(float mat[][4], float *vec)
vec[2] /= w;
}
-void mul_m4_v4(float mat[][4], float *vec)
+void mul_v4_m4v4(float r[4], float mat[4][4], float v[4])
{
- float x,y,z;
+ float x, y, z;
- x=vec[0];
- y=vec[1];
- z= vec[2];
- vec[0]=x*mat[0][0] + y*mat[1][0] + z*mat[2][0] + mat[3][0]*vec[3];
- vec[1]=x*mat[0][1] + y*mat[1][1] + z*mat[2][1] + mat[3][1]*vec[3];
- vec[2]=x*mat[0][2] + y*mat[1][2] + z*mat[2][2] + mat[3][2]*vec[3];
- vec[3]=x*mat[0][3] + y*mat[1][3] + z*mat[2][3] + mat[3][3]*vec[3];
+ x= v[0];
+ y= v[1];
+ z= v[2];
+
+ r[0]= x*mat[0][0] + y*mat[1][0] + z*mat[2][0] + mat[3][0]*v[3];
+ r[1]= x*mat[0][1] + y*mat[1][1] + z*mat[2][1] + mat[3][1]*v[3];
+ r[2]= x*mat[0][2] + y*mat[1][2] + z*mat[2][2] + mat[3][2]*v[3];
+ r[3]= x*mat[0][3] + y*mat[1][3] + z*mat[2][3] + mat[3][3]*v[3];
+}
+
+void mul_m4_v4(float mat[4][4], float r[4])
+{
+ mul_v4_m4v4(r, mat, r);
}
void mul_v3_m3v3(float r[3], float M[3][3], float a[3])
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 8032cd64de5..9baf897c830 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -83,6 +83,14 @@ void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const
p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
}
+void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
+{
+ p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2];
+ p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2];
+ p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2];
+ p[3] = v1[3]*w[0] + v2[3]*w[1] + v3[3]*w[2];
+}
+
void mid_v3_v3v3(float *v, float *v1, float *v2)
{
v[0]= 0.5f*(v1[0] + v2[0]);
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index f82daaa8af6..974832051af 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -188,6 +188,12 @@ MINLINE void mul_v3_v3(float r[3], const float a[3])
r[2] *= a[2];
}
+MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f)
+{
+ r[0] += a[0]*f;
+ r[1] += a[1]*f;
+}
+
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
{
r[0] += a[0]*f;
@@ -222,6 +228,14 @@ MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], cons
r[2] = a[2] + b[2]*c[2];
}
+MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
+{
+ r[0] += a[0]*f;
+ r[1] += a[1]*f;
+ r[2] += a[2]*f;
+ r[3] += a[3]*f;
+}
+
MINLINE void mul_v3_v3v3(float *v, const float *v1, const float *v2)
{
v[0] = v1[0] * v2[0];
@@ -305,6 +319,14 @@ MINLINE float len_v3v3(const float a[3], const float b[3])
return len_v3(d);
}
+MINLINE float len_squared_v3v3(const float a[3], const float b[3])
+{
+ float d[3];
+
+ sub_v3_v3v3(d, b, a);
+ return dot_v3v3(d, d);
+}
+
MINLINE float normalize_v2_v2(float r[2], const float a[2])
{
float d= dot_v2v2(a, a);
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 6e2eff6f97a..aa87a56a60c 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -106,6 +106,7 @@ static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _preview_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t mainid;
static int thread_levels= 0; /* threads can be invoked inside threads */
@@ -340,6 +341,8 @@ void BLI_lock_thread(int type)
pthread_mutex_lock(&_viewer_lock);
else if (type==LOCK_CUSTOM1)
pthread_mutex_lock(&_custom1_lock);
+ else if (type==LOCK_RCACHE)
+ pthread_mutex_lock(&_rcache_lock);
}
void BLI_unlock_thread(int type)
@@ -352,6 +355,8 @@ void BLI_unlock_thread(int type)
pthread_mutex_unlock(&_viewer_lock);
else if(type==LOCK_CUSTOM1)
pthread_mutex_unlock(&_custom1_lock);
+ else if(type==LOCK_RCACHE)
+ pthread_mutex_unlock(&_rcache_lock);
}
/* Mutex Locks */
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index bc50befa2a9..4f0805cd0d6 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1764,7 +1764,7 @@ static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd,
else
mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
- mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
BLI_memarena_use_calloc(mdb->memarena);
/* make bounding box equal size in all directions, add padding, and compute
@@ -1804,7 +1804,7 @@ static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd,
/* free temporary MDefBoundIsects */
BLI_memarena_free(mdb->memarena);
- mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
/* start with all cells untyped */
for(a=0; a<mdb->size3; a++)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index d08ec2f92c5..1e2b166ca82 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -518,12 +518,14 @@ static void init_internal_icons()
else
icontype= ICON_TYPE_BUFFER;
- for (y=0; y<ICON_GRID_ROWS; y++) {
- for (x=0; x<ICON_GRID_COLS; x++) {
- def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
- x*(ICON_GRID_W+ICON_GRID_MARGIN)+ICON_GRID_MARGIN,
- y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, ICON_GRID_W,
- icontype);
+ if(bbuf) {
+ for (y=0; y<ICON_GRID_ROWS; y++) {
+ for (x=0; x<ICON_GRID_COLS; x++) {
+ def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
+ x*(ICON_GRID_W+ICON_GRID_MARGIN)+ICON_GRID_MARGIN,
+ y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, ICON_GRID_W,
+ icontype);
+ }
}
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 72219df04c9..b66fa6da06c 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -648,8 +648,7 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh
* This shouldn't be necessary, derived queries should be
* automatically building this data if invalid. Or something.
*/
-// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
- object_handle_update(scene, obedit);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
/* individual faces? */
// BIF_TransformSetUndo("Extrude");
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index d3f9847d9b9..9a9461da62e 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -263,7 +263,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY);
WM_jobs_customdata(steve, bkr, bake_freejob);
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
- WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update);
+ WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
G.afbreek= 0;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 6f5b8924a13..1647892fd13 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1005,7 +1005,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
/* setup job */
WM_jobs_customdata(steve, fb, fluidbake_free);
WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
- WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL);
+ WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 187f726519f..47dd95eb17b 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -87,11 +87,11 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
/* xmin here is first subrect x coord, xmax defines subrect width */
xmin = renrect->xmin + rr->crop;
- xmax = renrect->xmax - xmin - rr->crop;
+ xmax = renrect->xmax - xmin + rr->crop;
if (xmax<2) return;
ymin= renrect->ymin + rr->crop;
- ymax= renrect->ymax - ymin - rr->crop;
+ ymax= renrect->ymax - ymin + rr->crop;
if(ymax<2)
return;
renrect->ymin= renrect->ymax;
@@ -544,6 +544,13 @@ static void render_startjob(void *rjv, short *stop, short *do_update)
// free_main(mainp);
}
+static void render_endjob(void *rjv)
+{
+ /* XXX render stability hack */
+ G.rendering = 0;
+ WM_main_add_notifier(NC_WINDOW, NULL);
+}
+
/* called by render, check job 'stop' value or the global */
static int render_breakjob(void *rjv)
{
@@ -560,8 +567,9 @@ static int render_breakjob(void *rjv)
static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event)
{
/* no running blender, remove handler and pass through */
- if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ }
/* running render */
switch (event->type) {
@@ -645,7 +653,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY);
WM_jobs_customdata(steve, rj, render_freejob);
WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0);
- WM_jobs_callbacks(steve, render_startjob, NULL, NULL);
+ WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
/* get a render result image, and make sure it is empty */
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
@@ -669,6 +677,11 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
WM_cursor_wait(0);
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+ /* we set G.rendering here already instead of only in the job, this ensure
+ main loop or other scene updates are disabled in time, since they may
+ have started before the job thread */
+ G.rendering = 1;
+
/* add modal handler for ESC */
WM_event_add_modal_handler(C, op);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index aef652cd116..50d45f0c8e8 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1121,7 +1121,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
- WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL);
+ WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
}
@@ -1147,7 +1147,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
- WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob);
+ WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
}
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index b6cb6978dc1..122424385be 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -323,7 +323,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
/* setup job */
WM_jobs_customdata(steve, sj, screenshot_freejob);
WM_jobs_timer(steve, 0.1, 0, NC_SCREEN|ND_SCREENCAST);
- WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob);
+ WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index df2e4032257..40bc4dc4c87 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -3083,7 +3083,7 @@ static void project_paint_begin(ProjPaintState *ps)
ps->thread_tot = BLI_system_thread_count();
}
for (a=0; a<ps->thread_tot; a++) {
- ps->arena_mt[a] = BLI_memarena_new(1<<16);
+ ps->arena_mt[a] = BLI_memarena_new(1<<16, "project paint arena");
}
arena = ps->arena_mt[0];
@@ -3706,7 +3706,7 @@ static void *do_projectpaint_thread(void *ph_v)
pos_ofs[0] = pos[0] - lastpos[0];
pos_ofs[1] = pos[1] - lastpos[1];
- smearArena = BLI_memarena_new(1<<16);
+ smearArena = BLI_memarena_new(1<<16, "paint smear arena");
}
/* avoid a square root with every dist comparison */
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 06a574d2e83..97cee5c730f 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -262,6 +262,8 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_KEYINGSET:
buttons_area_redraw(sa, BCONTEXT_SCENE);
break;
+ case ND_RENDER_RESULT:
+ break;
case ND_MODE:
case ND_LAYER:
default:
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 9dd16586946..b5754404a0f 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1352,7 +1352,7 @@ void thumbnails_start(struct FileList* filelist, const struct bContext* C)
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, 0);
WM_jobs_customdata(steve, tj, thumbnails_free);
WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
- WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update);
+ WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
/* start the job */
WM_jobs_start(CTX_wm_manager(C), steve);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 5d3c00b113d..7e79b4b822e 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -349,11 +349,21 @@ static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA
static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
+ PointerRNA obptr= CTX_data_pointer_get(C, "active_object");
uiLayout *col;
-
+
col= uiLayoutColumn(layout, 0);
- uiItemR(col, ptr, "uv_layer", 0, "UV", 0);
- uiItemR(col, ptr, "color_layer", 0, "VCol", 0);
+
+ if(obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr= RNA_pointer_get(&obptr, "data");
+
+ uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", 0);
+ uiItemPointerR(col, ptr, "color_layer", &dataptr, "vertex_colors", "", 0);
+ }
+ else {
+ uiItemR(col, ptr, "uv_layer", 0, "UV", 0);
+ uiItemR(col, ptr, "color_layer", 0, "VCol", 0);
+ }
}
static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr)
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index f1aa9f745ee..767dd753766 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -176,7 +176,7 @@ void snode_composite_job(const bContext *C, ScrArea *sa)
/* setup job */
WM_jobs_customdata(steve, cj, compo_freejob);
WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE|ND_COMPO_RESULT);
- WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob);
+ WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 44baea0737f..291c67d22ff 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -4764,11 +4764,9 @@ static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2)
static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
{
- Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
- object_handle_update(scene, ob);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript
index ba521a5fb1a..1d8e01f2b1b 100644
--- a/source/blender/editors/space_view3d/SConscript
+++ b/source/blender/editors/space_view3d/SConscript
@@ -13,5 +13,7 @@ incs += ' #source/kernel/gen_system'
if env['WITH_BF_GAMEENGINE']:
defs.append('GAMEBLENDER=1')
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+ incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( 'bf_editors_space_view3d', sources, Split(incs), defines = defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index e3bf1e83247..335e17b8796 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -839,12 +839,6 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi
show_uvshadow= ED_space_image_show_uvshadow(sima, obedit);
if(show_uvedit || show_uvshadow) {
- /* this is basically the same object_handle_update as in the 3d view,
- * here we have to do it as well for the object we are editing if we
- * are displaying the final result */
- if(obedit && (sima->flag & SI_DRAWSHADOW))
- object_handle_update(scene, obedit);
-
if(show_uvshadow)
draw_uvs_shadow(sima, obedit);
else
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index dbc04f85497..9dfa0934ad2 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4027,7 +4027,7 @@ static void p_smooth(PChart *chart)
MEM_freeN(nodesx);
MEM_freeN(nodesy);
- arena = BLI_memarena_new(1<<16);
+ arena = BLI_memarena_new(1<<16, "param smooth arena");
root = p_node_new(arena, tri, esize*2, minv, maxv, 0);
for (v=chart->verts; v; v=v->nextlink)
@@ -4047,7 +4047,7 @@ ParamHandle *param_construct_begin()
PHandle *handle = MEM_callocN(sizeof*handle, "PHandle");
handle->construction_chart = p_chart_new(handle);
handle->state = PHANDLE_STATE_ALLOCATED;
- handle->arena = BLI_memarena_new((1<<16));
+ handle->arena = BLI_memarena_new((1<<16), "param construct arena");
handle->aspx = 1.0f;
handle->aspy = 1.0f;
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 28dd4911ffd..26566857e03 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -27,7 +27,7 @@
FILE(GLOB SRC intern/*.c)
SET(INC
- . ../blenlib ../blenkernel ../makesdna ../include
+ . ../blenlib ../blenkernel ../makesdna ../makesrna ../include
../../../extern/glew/include ../../../intern/guardedalloc ../../../intern/smoke/extern ../imbuf)
ADD_DEFINITIONS(-DGLEW_STATIC)
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 710dbde21b2..056de9ab708 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -302,7 +302,7 @@ short imb_addrectImBuf(struct ImBuf * ibuf)
imb_freerectImBuf(ibuf);
size = ibuf->x * ibuf->y;
- size = size * sizeof(unsigned int);
+ size = size * sizeof(unsigned int);
if ( (ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf")) ){
ibuf->mall |= IB_rect;
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 6eecd091b7f..92e35326118 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -78,7 +78,7 @@ typedef enum PropertyUnit {
PROP_UNIT_AREA = (2<<16), /* m^2 */
PROP_UNIT_VOLUME = (3<<16), /* m^3 */
PROP_UNIT_MASS = (4<<16), /* kg */
- PROP_UNIT_ROTATION = (5<<16), /* rad */
+ PROP_UNIT_ROTATION = (5<<16), /* radians */
PROP_UNIT_TIME = (6<<16), /* frame */
PROP_UNIT_VELOCITY = (7<<16), /* m/s */
PROP_UNIT_ACCELERATION = (8<<16) /* m/(s^2) */
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index c9db05c30b1..c568fea38d7 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -30,7 +30,9 @@
#include "MEM_guardedalloc.h"
+#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_types.h"
#include "rna_internal.h"
@@ -483,13 +485,13 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if(dp->dnaarraylength == 1) {
if(prop->type == PROP_BOOLEAN && dp->booleanbit)
- fprintf(f, " values[i]= (%s(data->%s & (%d<<i)) != 0);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
+ fprintf(f, " values[i]= %s((data->%s & (%d<<i)) != 0);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
else
fprintf(f, " values[i]= (%s)%s((&data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
}
else {
if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " values[i]= (%s(data->%s[i] & ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ") != 0);\n");
}
@@ -514,7 +516,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else {
rna_print_data_get(f, dp);
if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " return (%s((data->%s) & ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " return %s(((data->%s) & ", (dp->booleannegative)? "!": "", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ") != 0);\n");
}
@@ -1684,7 +1686,7 @@ static const char *rna_property_subtype_unit(PropertyType type)
case PROP_UNIT_TIME: return "PROP_UNIT_TIME";
case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY";
case PROP_UNIT_ACCELERATION:return "PROP_UNIT_ACCELERATION";
- default: return "PROP_UNKNOWN";
+ default: return "PROP_UNIT_UNKNOWN";
}
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 6d1ae6db562..42c9b3d38e7 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1322,7 +1322,7 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
/* add target */
func= RNA_def_function(srna, "new", "rna_Object_modifier_new");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new bone.");
+ RNA_def_function_ui_description(func, "Add a new modifier.");
parm= RNA_def_string(func, "name", "Name", 0, "", "New name for the bone.");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* modifier to add */
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 238098e85e2..4cd092972d1 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -869,8 +869,6 @@ static void rna_def_effector_weight(BlenderRNA *brna)
/* General */
prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_struct_type(prop, "Group");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group");
RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e5c6d970687..7e186f0a587 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2366,6 +2366,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Edge Color", "");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ /* threads */
prop= RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "threads");
RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
@@ -2379,6 +2380,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ /* motion blur */
prop= RNA_def_property(srna, "motion_blur", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
@@ -2390,6 +2392,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Motion Samples", "Number of scene samples to take with motion blur");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ /* border */
prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample");
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index ad7f80f0907..dc1598fa6e9 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -10,8 +10,11 @@ incs += ' ../include ../blenlib ../makesdna ../blenkernel ../blenkernel/intern'
incs += ' ' + env['BF_ZLIB_INC']
-defs = ''
+defs = []
+
+if env['BF_NO_ELBEEM']:
+ defs.append('DISABLE_ELBEEM')
env.BlenderLib ( libname = 'modifiers', sources = sources,
- includes = Split(incs), defines = Split(defs),
- libtype=['core','player'], priority = [180, 20] ) \ No newline at end of file
+ includes = Split(incs), defines=defs,
+ libtype=['core','player'], priority = [180, 20] )
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index bb1ede089e9..6614625a650 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -862,7 +862,7 @@ static void push_propagate_stack(SmoothEdge *edge, SmoothVert *vert, SmoothMesh
}
else {
if(!mesh->arena) {
- mesh->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ mesh->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "edgesplit arena");
BLI_memarena_use_calloc(mesh->arena);
}
diff --git a/source/blender/render/intern/raytrace/Makefile b/source/blender/render/intern/raytrace/Makefile
index 6e40c544c6f..c136f945ca5 100644
--- a/source/blender/render/intern/raytrace/Makefile
+++ b/source/blender/render/intern/raytrace/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index b9e9a46b1a9..84ec56e131a 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -497,12 +497,22 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
else if(RE_rayobject_isVlakPrimitive(r))
{
VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
- VlakRen *vlr = face->face;
+ RayFace nface;
+ RE_rayface_from_vlak(&nface, face->ob, face->face);
+
+ if(face->ob->transform_primitives)
+ {
+ mul_m4_v3(face->ob->mat, nface.v1);
+ mul_m4_v3(face->ob->mat, nface.v2);
+ mul_m4_v3(face->ob->mat, nface.v3);
+ if(RE_rayface_isQuad(&nface))
+ mul_m4_v3(face->ob->mat, nface.v4);
+ }
- DO_MINMAX( vlr->v1->co, min, max );
- DO_MINMAX( vlr->v2->co, min, max );
- DO_MINMAX( vlr->v3->co, min, max );
- if(vlr->v4) DO_MINMAX( vlr->v4->co, min, max );
+ DO_MINMAX( nface.v1, min, max );
+ DO_MINMAX( nface.v2, min, max );
+ DO_MINMAX( nface.v3, min, max );
+ if(RE_rayface_isQuad(&nface)) DO_MINMAX( nface.v4, min, max );
}
else if(RE_rayobject_isRayAPI(r))
{
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index cdc3be4c521..afffdd44f1f 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -52,10 +52,10 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
rtbuild_done(obj->builder, &obj->rayobj.control);
//TODO find a away to exactly calculate the needed memory
- MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "qbvh arena");
BLI_memarena_use_malloc(arena1);
- MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "qbvh arena 2");
BLI_memarena_use_malloc(arena2);
BLI_memarena_use_align(arena2, 16);
diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
index 67af596e301..389512ce469 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -63,10 +63,10 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
rtbuild_done(obj->builder, &obj->rayobj.control);
//TODO find a away to exactly calculate the needed memory
- MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "svbvh arena");
BLI_memarena_use_malloc(arena1);
- MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "svbvh arena2");
BLI_memarena_use_malloc(arena2);
BLI_memarena_use_align(arena2, 16);
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 0190b971d84..de1e6d349be 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -76,7 +76,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
rtbuild_done(obj->builder, &obj->rayobj.control);
//TODO find a away to exactly calculate the needed memory
- MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena1 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena");
BLI_memarena_use_malloc(arena1);
//Build and optimize the tree
@@ -101,7 +101,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
{
/*
TODO
- MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena2");
BLI_memarena_use_malloc(arena2);
//Finds the optimal packing of this tree using a given cost model
diff --git a/source/blender/render/intern/source/Makefile b/source/blender/render/intern/source/Makefile
index c313549f9b9..5aaa66e7712 100644
--- a/source/blender/render/intern/source/Makefile
+++ b/source/blender/render/intern/source/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index db242b0b1d9..189c029d2e2 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -512,7 +512,7 @@ static void calc_vertexnormals(Render *re, ObjectRen *obr, int do_tangent, int d
int a;
if(do_nmap_tangent) {
- arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
BLI_memarena_use_calloc(arena);
vtangents= MEM_callocN(sizeof(VertexTangent*)*obr->totvert, "VertexTangent");
@@ -4949,7 +4949,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c
/* XXX add test if dbase was filled already? */
- re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "render db arena");
re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0;
re->lights.first= re->lights.last= NULL;
re->lampren.first= re->lampren.last= NULL;
@@ -5099,7 +5099,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
/* XXX add test if dbase was filled already? */
- re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vector render db arena");
re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0;
re->i.totface=re->i.totvert=re->i.totstrand=re->i.totlamp=re->i.tothalo= 0;
re->lights.first= re->lights.last= NULL;
@@ -5635,7 +5635,7 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob
}
/* setup render stuff */
- re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "bake db arena");
re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0;
re->lights.first= re->lights.last= NULL;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index ab656ad1c3b..ff718359a3e 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -660,7 +660,7 @@ static OcclusionTree *occ_tree_build(Render *re)
tree->doindirect= (re->wrld.ao_indirect_energy > 0.0f && re->wrld.ao_indirect_bounces > 0);
/* allocation */
- tree->arena= BLI_memarena_new(0x8000 * sizeof(OccNode));
+ tree->arena= BLI_memarena_new(0x8000 * sizeof(OccNode), "occ tree arena");
BLI_memarena_use_calloc(tree->arena);
if(re->wrld.aomode & WO_AOCACHE)
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 35d969f9f21..7101ce5daaf 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -2204,7 +2204,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
isbdata->recty= pa->recty;
/* branches are added using memarena (32k branches) */
- memarena = BLI_memarena_new(0x8000 * sizeof(ISBBranch));
+ memarena = BLI_memarena_new(0x8000 * sizeof(ISBBranch), "isb arena");
BLI_memarena_use_calloc(memarena);
/* samplebuf is in camera view space (pixels) */
@@ -2300,7 +2300,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
if(R.osa) {
ISBShadfacA **isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs");
- isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA));
+ isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
BLI_memarena_use_calloc(isbdata->memarena);
for(rd= pa->rectdaps, x=pa->rectx*pa->recty; x>0; x--, rd++, isbsa++) {
@@ -2412,7 +2412,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
isbdata->recty= pa->recty;
/* branches are added using memarena (32k branches) */
- memarena = BLI_memarena_new(0x8000 * sizeof(ISBBranch));
+ memarena = BLI_memarena_new(0x8000 * sizeof(ISBBranch), "isb arena");
BLI_memarena_use_calloc(memarena);
/* samplebuf is in camera view space (pixels) */
@@ -2503,7 +2503,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
/* copy shadow samples to persistant buffer, reduce memory overhead */
isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs");
- isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA));
+ isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
for(ap= apixbuf, x=pa->rectx*pa->recty; x>0; x--, ap++, isbsa++) {
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 836a60ef4f9..bb5f8e9b8b4 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -779,7 +779,7 @@ void scatter_tree_build(ScatterTree *tree)
tmppoints= MEM_callocN(sizeof(ScatterPoint*)*totpoint, "ScatterTmpPoints");
tree->tmppoints= tmppoints;
- tree->arena= BLI_memarena_new(0x8000 * sizeof(ScatterNode));
+ tree->arena= BLI_memarena_new(0x8000 * sizeof(ScatterNode), "sss tree arena");
BLI_memarena_use_calloc(tree->arena);
/* build tree */
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 1bf1f1fe582..e3428741473 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -320,7 +320,7 @@ StrandShadeCache *strand_shade_cache_create()
cache= MEM_callocN(sizeof(StrandShadeCache), "StrandShadeCache");
cache->resulthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
cache->refcounthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
- cache->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ cache->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand shade cache arena");
return cache;
}
@@ -818,7 +818,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
bounds[2]= (2*pa->disprect.ymin - winy-1)/(float)winy;
bounds[3]= (2*pa->disprect.ymax - winy+1)/(float)winy;
- memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE);
+ memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand sort arena");
firstseg= NULL;
sortseg= sortsegments;
totsegment= 0;
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 889b261dc41..070b03dd195 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -309,7 +309,8 @@ void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned
void WM_jobs_callbacks(struct wmJob *,
void (*startjob)(void *, short *, short *),
void (*initjob)(void *),
- void (*update)(void *));
+ void (*update)(void *),
+ void (*endjob)(void *));
void WM_jobs_start(struct wmWindowManager *wm, struct wmJob *);
void WM_jobs_stop(struct wmWindowManager *wm, void *owner);
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 343b1f68c7f..30c0c9a7aec 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -95,6 +95,8 @@ struct wmJob {
void (*update)(void *);
/* free entire customdata, doesn't run in thread */
void (*free)(void *);
+ /* gets called when job is stopped, not in thread */
+ void (*endjob)(void *);
/* running jobs each have own timer */
double timestep;
@@ -179,11 +181,13 @@ void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned in
void WM_jobs_callbacks(wmJob *steve,
void (*startjob)(void *, short *, short *),
void (*initjob)(void *),
- void (*update)(void *))
+ void (*update)(void *),
+ void (*endjob)(void *))
{
steve->startjob= startjob;
steve->initjob= initjob;
steve->update= update;
+ steve->endjob= endjob;
}
static void *do_job_thread(void *job_v)
@@ -266,6 +270,9 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
/* signal job to end */
steve->stop= 1;
BLI_end_threads(&steve->threads);
+
+ if(steve->endjob)
+ steve->endjob(steve->run_customdata);
}
if(steve->wt)
@@ -351,6 +358,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
}
if(steve->ready) {
+ if(steve->endjob)
+ steve->endjob(steve->run_customdata);
+
/* free own data */
steve->run_free(steve->run_customdata);
steve->run_customdata= NULL;