Merge remote-tracking branch 'origin/master' into blender2.8
authorDalai Felinto <dfelinto@gmail.com>
Wed, 9 Nov 2016 13:36:59 +0000 (14:36 +0100)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 9 Nov 2016 13:36:59 +0000 (14:36 +0100)
18 files changed:
intern/atomic/atomic_ops.h
intern/atomic/intern/atomic_ops_msvc.h
intern/atomic/intern/atomic_ops_unix.h
intern/cycles/blender/addon/version_update.py
intern/cycles/blender/blender_sync.cpp
source/blender/blenkernel/BKE_blender_version.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/sound.c
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_core.h
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_structure.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/render/intern/source/shadeoutput.c

index 0bc7905aa074f5510b507c4e36b5488de78e0faa..f78eab7951fe07f635987e595f4ca611514b205d 100644 (file)
@@ -87,6 +87,8 @@ ATOMIC_INLINE uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x);
 ATOMIC_INLINE uint32_t atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new);
 
 ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x);
+ATOMIC_INLINE uint32_t atomic_fetch_and_or_uint32(uint32_t *p, uint32_t x);
+ATOMIC_INLINE uint32_t atomic_fetch_and_and_uint32(uint32_t *p, uint32_t x);
 
 ATOMIC_INLINE uint8_t atomic_fetch_and_or_uint8(uint8_t *p, uint8_t b);
 ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b);
index 15ddda246d90c19be19ebfb3a78dc5863a255b93..3461719a4e7bb183e1f8361384bc086c308c88d7 100644 (file)
@@ -81,6 +81,16 @@ ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x)
        return InterlockedExchangeAdd(p, x);
 }
 
+ATOMIC_INLINE uint32_t atomic_fetch_and_or_uint32(uint32_t *p, uint32_t x)
+{
+       return InterlockedOr((long *)p, x);
+}
+
+ATOMIC_INLINE uint32_t atomic_fetch_and_and_uint32(uint32_t *p, uint32_t x)
+{
+       return InterlockedAnd((long *)p, x);
+}
+
 /******************************************************************************/
 /* 8-bit operations. */
 
index 55c00024244eb6553ecc04d7e96e9cf07e119d42..e63f09c76c503949840baed7477f402cb4a5b854 100644 (file)
@@ -169,6 +169,16 @@ ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x)
        return __sync_fetch_and_add(p, x);
 }
 
+ATOMIC_INLINE uint32_t atomic_fetch_and_or_uint32(uint32_t *p, uint32_t x)
+{
+       return __sync_fetch_and_or(p, x);
+}
+
+ATOMIC_INLINE uint32_t atomic_fetch_and_and_uint32(uint32_t *p, uint32_t x)
+{
+       return __sync_fetch_and_and(p, x);
+}
+
 #else
 #  error "Missing implementation for 32-bit atomic operations"
 #endif
index 830723d61498ce26ae6121b8adcf5a438e212c0f..951afd37a92152fd707eff7cdf0757974dd7818c 100644 (file)
@@ -278,3 +278,9 @@ def do_versions(self):
                     cscene.pixel_filter_type = cscene.filter_type
                 if cscene.filter_type == 'BLACKMAN_HARRIS':
                     cscene.filter_type = 'GAUSSIAN'
+
+    if bpy.data.version <= (2, 78, 2):
+        for scene in bpy.data.scenes:
+            cscene = scene.cycles
+            if not cscene.is_property_set("light_sampling_threshold"):
+                cscene.light_sampling_threshold = 0.0
index 446c4893fc5265c3e2a1b4ccede45ece04d46155..62b9fa3c92b852c8fc947f6116387e767874755a 100644 (file)
@@ -247,8 +247,12 @@ void BlenderSync::sync_integrator()
        integrator->filter_glossy = get_float(cscene, "blur_glossy");
 
        integrator->seed = get_int(cscene, "seed");
-       if(get_boolean(cscene, "use_animated_seed"))
-               integrator->seed = hash_int_2d(b_scene.frame_current(), get_int(cscene, "seed"));
+       if(get_boolean(cscene, "use_animated_seed")) {
+               integrator->seed = hash_int_2d(b_scene.frame_current(),
+                                              get_int(cscene, "seed")) +
+                                  hash_int_2d((int)(b_scene.frame_subframe() * (float)INT_MAX),
+                                              get_int(cscene, "seed"));
+       }
 
        integrator->sampling_pattern = (SamplingPattern)get_enum(
                cscene,
index 55142510f9ea655c05876428ae6133d1c661ae8f..908e6f214f983ca0ca36a22f2fbb2157ae031c55 100644 (file)
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         278
-#define BLENDER_SUBVERSION      1
+#define BLENDER_SUBVERSION      2
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
index 33c681582624eb3a8dbf51830f84a5960bf47519..5436ac2047228360f47a32c7b8c83277dfaac5c9 100644 (file)
@@ -129,6 +129,8 @@ void BKE_library_make_local(
         struct Main *bmain, const struct Library *lib, struct GHash *old_to_new_ids,
         const bool untagged_only, const bool set_fake);
 
+void BKE_id_tag_set_atomic(struct ID *id, int tag);
+void BKE_id_tag_clear_atomic(struct ID *id, int tag);
 
 /* use when "" is given to new_id() */
 #define ID_FALLBACK_NAME N_("Untitled")
index bfdbb510091924e85727a92e415d1305990276f3..2a1132df425483613056cb4e87a784ee0a233e78 100644 (file)
@@ -1650,7 +1650,7 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
                /* for cases like duplifarmes it's only a temporary so don't
                 * notify anyone of updates */
                if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
-                       id->tag |= LIB_TAG_ID_RECALC;
+                       BKE_id_tag_set_atomic(id, LIB_TAG_ID_RECALC);
                        DAG_id_type_tag(G.main, GS(id->name));
                }
        }
index f747bdb91faf0c24f07dd86ec808122887868405..83549ae687965fc712e1015480846dccef946fee 100644 (file)
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
+#include "atomic_ops.h"
+
 /* GS reads the memory pointed at in a specific ordering. 
  * only use this definition, makes little and big endian systems
  * work fine, in conjunction with MAKE_ID */
@@ -1878,3 +1880,13 @@ void BKE_library_filepath_set(Library *lib, const char *filepath)
                BLI_path_abs(lib->filepath, basepath);
        }
 }
+
+void BKE_id_tag_set_atomic(ID *id, int tag)
+{
+       atomic_fetch_and_or_uint32((uint32_t *)&id->tag, tag);
+}
+
+void BKE_id_tag_clear_atomic(ID *id, int tag)
+{
+       atomic_fetch_and_and_uint32((uint32_t *)&id->tag, ~tag);
+}
index 73678187e800c509205f4ab77a6b24cc440a1399..6923138b4b84ac5a70da93a144c7e05aa47558f8 100644 (file)
 #include "BKE_rigidbody.h"
 #include "BKE_scene.h"
 
-#ifdef WITH_BULLET
-
 /* ************************************** */
 /* Memory Management */
 
 /* Freeing Methods --------------------- */
 
+#ifndef WITH_BULLET
+
+static void RB_dworld_remove_constraint(void *UNUSED(world), void *UNUSED(con)) {}
+static void RB_dworld_remove_body(void *UNUSED(world), void *UNUSED(body)) {}
+static void RB_dworld_delete(void *UNUSED(world)) {}
+static void RB_body_delete(void *UNUSED(body)) {}
+static void RB_shape_delete(void *UNUSED(shape)) {}
+static void RB_constraint_delete(void *UNUSED(con)) {}
+
+#endif
+
 /* Free rigidbody world */
 void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
 {
@@ -160,6 +169,8 @@ void BKE_rigidbody_free_constraint(Object *ob)
        ob->rigidbody_constraint = NULL;
 }
 
+#ifdef WITH_BULLET
+
 /* Copying Methods --------------------- */
 
 /* These just copy the data, clearing out references to physics objects.
@@ -1548,9 +1559,6 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
 #  pragma GCC diagnostic ignored "-Wunused-parameter"
 #endif
 
-void BKE_rigidbody_free_world(RigidBodyWorld *rbw) {}
-void BKE_rigidbody_free_object(Object *ob) {}
-void BKE_rigidbody_free_constraint(Object *ob) {}
 struct RigidBodyOb *BKE_rigidbody_copy_object(Object *ob) { return NULL; }
 struct RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob) { return NULL; }
 void BKE_rigidbody_relink_constraint(RigidBodyCon *rbc) {}
index 3132a8e27e7eaa0d0842e4622c57a3ee79eda96d..f20885b1e8fcb3d9dd650276cbb3ae01579eef35 100644 (file)
@@ -251,7 +251,8 @@ void BKE_sound_init(struct Main *bmain)
 void BKE_sound_init_main(struct Main *bmain)
 {
 #ifdef WITH_JACK
-       AUD_setSynchronizerCallback(sound_sync_callback, bmain);
+       if (sound_device)
+               AUD_setSynchronizerCallback(sound_sync_callback, bmain);
 #else
        (void)bmain; /* unused */
 #endif
index d2f638fa8f8617cbf51c7446c2aef2dddb319555..ac4eb2c33fd64e416dc85e549b8b41e64c4dfa92 100644 (file)
@@ -1019,18 +1019,12 @@ static int UNUSED_FUNCTION(bm_loop_length)(BMLoop *l)
  * \brief Loop Reverse
  *
  * Changes the winding order of a face from CW to CCW or vice versa.
- * This euler is a bit peculiar in comparison to others as it is its
- * own inverse.
- *
- * BMESH_TODO: reinsert validation code.
  *
  * \param cd_loop_mdisp_offset: Cached result of `CustomData_get_offset(&bm->ldata, CD_MDISPS)`.
  * \param use_loop_mdisp_flip: When set, flip the Z-depth of the mdisp,
  * (use when flipping normals, disable when mirroring, eg: symmetrize).
- *
- * \return Success
  */
-static bool bm_loop_reverse_loop(
+static void bm_loop_reverse_loop(
         BMesh *bm, BMFace *f,
 #ifdef USE_BMESH_HOLES
         BMLoopList *lst,
@@ -1044,53 +1038,62 @@ static bool bm_loop_reverse_loop(
        BMLoop *l_first = f->l_first;
 #endif
 
-       const int len = f->len;
-       BMLoop *l_iter, *oldprev, *oldnext;
-       BMEdge **edar = BLI_array_alloca(edar, len);
-       int i, j, edok;
+       /* track previous cycles radial state */
+       BMEdge *e_prev = l_first->prev->e;
+       BMLoop *l_prev_radial_next = l_first->prev->radial_next;
+       BMLoop *l_prev_radial_prev = l_first->prev->radial_prev;
+       bool is_prev_boundary = l_prev_radial_next == l_prev_radial_next->radial_next;
 
-       for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
-               bmesh_radial_loop_remove((edar[i] = l_iter->e), l_iter);
-       }
+       BMLoop *l_iter = l_first;
+       do {
+               BMEdge *e_iter = l_iter->e;
+               BMLoop *l_iter_radial_next = l_iter->radial_next;
+               BMLoop *l_iter_radial_prev = l_iter->radial_prev;
+               bool is_iter_boundary = l_iter_radial_next == l_iter_radial_next->radial_next;
+
+#if 0
+               bmesh_radial_loop_remove(e_curr, l_iter);
+               bmesh_radial_loop_append(e_prev, l_iter);
+#else
+               /* inline loop reversal */
+               if (is_prev_boundary) {
+                       /* boundary */
+                       l_iter->radial_next = l_iter;
+                       l_iter->radial_prev = l_iter;
+               }
+               else {
+                       /* non-boundary, replace radial links */
+                       l_iter->radial_next = l_prev_radial_next;
+                       l_iter->radial_prev = l_prev_radial_prev;
+                       l_prev_radial_next->radial_prev = l_iter;
+                       l_prev_radial_prev->radial_next = l_iter;
+               }
+
+               if (e_iter->l == l_iter) {
+                       e_iter->l = l_iter->next;
+               }
+               l_iter->e = e_prev;
+#endif
+
+               SWAP(BMLoop *, l_iter->next, l_iter->prev);
 
-       /* actually reverse the loop */
-       for (i = 0, l_iter = l_first; i < len; i++) {
-               oldnext = l_iter->next;
-               oldprev = l_iter->prev;
-               l_iter->next = oldprev;
-               l_iter->prev = oldnext;
-               l_iter = oldnext;
-               
                if (cd_loop_mdisp_offset != -1) {
                        MDisps *md = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_mdisp_offset);
                        BKE_mesh_mdisp_flip(md, use_loop_mdisp_flip);
                }
-       }
 
-       if (len == 2) { /* two edged face */
-               /* do some verification here! */
-               l_first->e = edar[1];
-               l_first->next->e = edar[0];
-       }
-       else {
-               for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
-                       edok = 0;
-                       for (j = 0; j < len; j++) {
-                               edok = BM_verts_in_edge(l_iter->v, l_iter->next->v, edar[j]);
-                               if (edok) {
-                                       l_iter->e = edar[j];
-                                       break;
-                               }
-                       }
-               }
-       }
-       /* rebuild radial */
-       for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next)
-               bmesh_radial_loop_append(l_iter->e, l_iter);
+               e_prev = e_iter;
+               l_prev_radial_next = l_iter_radial_next;
+               l_prev_radial_prev = l_iter_radial_prev;
+               is_prev_boundary = is_iter_boundary;
+
+               /* step to next (now swapped) */
+       } while ((l_iter = l_iter->prev) != l_first);
 
 #ifndef NDEBUG
        /* validate radial */
-       for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
+       int i;
+       for (i = 0, l_iter = l_first; i < f->len; i++, l_iter = l_iter->next) {
                BM_CHECK_ELEMENT(l_iter);
                BM_CHECK_ELEMENT(l_iter->e);
                BM_CHECK_ELEMENT(l_iter->v);
@@ -1102,21 +1105,19 @@ static bool bm_loop_reverse_loop(
 
        /* Loop indices are no more valid! */
        bm->elem_index_dirty |= BM_LOOP;
-
-       return true;
 }
 
 /**
  * \brief Flip the faces direction
  */
-bool bmesh_loop_reverse(
+void bmesh_loop_reverse(
         BMesh *bm, BMFace *f,
         const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip)
 {
 #ifdef USE_BMESH_HOLES
-       return bm_loop_reverse_loop(bm, f, f->loops.first, cd_loop_mdisp_offset, use_loop_mdisp_flip);
+       bm_loop_reverse_loop(bm, f, f->loops.first, cd_loop_mdisp_offset, use_loop_mdisp_flip);
 #else
-       return bm_loop_reverse_loop(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip);
+       bm_loop_reverse_loop(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip);
 #endif
 }
 
@@ -1166,7 +1167,11 @@ static int UNUSED_FUNCTION(bm_vert_systag_count_disk)(BMVert *v, const char api_
        return i;
 }
 
-static bool disk_is_flagged(BMVert *v, const char api_flag)
+/**
+ * Return true when the vertex is manifold,
+ * attached to faces which are all flagged.
+ */
+static bool bm_vert_is_manifold_flagged(BMVert *v, const char api_flag)
 {
        BMEdge *e = v->e;
 
@@ -1225,7 +1230,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
        BLI_array_staticdeclare(deledges, BM_DEFAULT_NGON_STACK_SIZE);
        BLI_array_staticdeclare(delverts, BM_DEFAULT_NGON_STACK_SIZE);
        BMVert *v1 = NULL, *v2 = NULL;
-       int i, tote = 0;
+       int i;
        const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
 
        if (UNLIKELY(!totface)) {
@@ -1255,13 +1260,10 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
                                        v1 = l_iter->v;
                                        v2 = BM_edge_other_vert(l_iter->e, l_iter->v);
                                }
-                               tote++;
                        }
                        else if (rlen == 2) {
-                               int d1, d2;
-
-                               d1 = disk_is_flagged(l_iter->e->v1, _FLAG_JF);
-                               d2 = disk_is_flagged(l_iter->e->v2, _FLAG_JF);
+                               const bool d1 = bm_vert_is_manifold_flagged(l_iter->e->v1, _FLAG_JF);
+                               const bool d2 = bm_vert_is_manifold_flagged(l_iter->e->v2, _FLAG_JF);
 
                                if (!d1 && !d2 && !BM_ELEM_API_FLAG_TEST(l_iter->e, _FLAG_JF)) {
                                        /* don't remove an edge it makes up the side of another face
@@ -1305,7 +1307,8 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
        }
 
        /* create region face */
-       f_new = tote ? BM_face_create_ngon(bm, v1, v2, edges, tote, faces[0], BM_CREATE_NOP) : NULL;
+       f_new = BLI_array_count(edges) ?
+               BM_face_create_ngon(bm, v1, v2, edges, BLI_array_count(edges), faces[0], BM_CREATE_NOP) : NULL;
        if (UNLIKELY(f_new == NULL)) {
                /* Invalid boundary region to join faces */
                goto error;
@@ -1323,10 +1326,11 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
                } while (l2 != l_iter);
 
                if (l2 != l_iter) {
-                       /* I think this is correct? */
+                       /* loops share an edge, shared vert depends on winding */
                        if (l2->v != l_iter->v) {
                                l2 = l2->next;
                        }
+                       BLI_assert(l_iter->v == l2->v);
 
                        BM_elem_attrs_copy(bm, bm, l2, l_iter);
                }
@@ -1666,7 +1670,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 #ifndef NDEBUG
                int radlen = bmesh_radial_length(l_next);
 #endif
-               int first1 = 0, first2 = 0;
+               bool is_first = true;
 
                /* Take the next loop. Remove it from radial. Split it. Append to appropriate radials */
                while (l_next) {
@@ -1677,7 +1681,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 
                        l_new = bm_loop_create(bm, NULL, NULL, l->f, l, 0);
                        l_new->prev = l;
-                       l_new->next = (l->next);
+                       l_new->next = l->next;
                        l_new->prev->next = l_new;
                        l_new->next->prev = l_new;
                        l_new->v = v_new;
@@ -1688,13 +1692,8 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
                                l->e = e_new;
 
                                /* append l into e_new's rad cycle */
-                               if (!first1) {
-                                       first1 = 1;
-                                       l->radial_next = l->radial_prev = NULL;
-                               }
-
-                               if (!first2) {
-                                       first2 = 1;
+                               if (is_first) {
+                                       is_first = false;
                                        l->radial_next = l->radial_prev = NULL;
                                }
                                
@@ -1706,13 +1705,8 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
                                l->e = e;
 
                                /* append l into e_new's rad cycle */
-                               if (!first1) {
-                                       first1 = 1;
-                                       l->radial_next = l->radial_prev = NULL;
-                               }
-
-                               if (!first2) {
-                                       first2 = 1;
+                               if (is_first) {
+                                       is_first = false;
                                        l->radial_next = l->radial_prev = NULL;
                                }
 
@@ -1812,7 +1806,6 @@ BMEdge *bmesh_jekv(
        BMEdge *e_old;
        BMVert *v_old, *v_target;
        BMLoop *l_kill;
-       bool halt = false;
 #ifndef NDEBUG
        int radlen, i;
        bool edok;
@@ -1833,9 +1826,9 @@ BMEdge *bmesh_jekv(
                e_old = bmesh_disk_edge_next(e_kill, v_kill);
                v_target = BM_edge_other_vert(e_kill, v_kill);
                v_old = BM_edge_other_vert(e_old, v_kill);
-               halt = BM_verts_in_edge(v_kill, v_target, e_old); /* check for double edges */
-               
-               if (halt) {
+
+               /* check for double edges */
+               if (BM_verts_in_edge(v_kill, v_target, e_old)) {
                        return NULL;
                }
                else {
index fb5702bc57422f28251daf39c58ab7645030f7b8..f72e9d7b198cfec1215f29d6bb8317ae72b3581b 100644 (file)
@@ -75,7 +75,7 @@ void    bmesh_vert_separate(
         BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
         const bool copy_select);
 
-bool    bmesh_loop_reverse(
+void    bmesh_loop_reverse(
         BMesh *bm, BMFace *f,
         const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip);
 
index d3c847de64e43e53beef38321eb888d220a42159..3979374d8da12cb082e97b91b3a390aab19f2dd0 100644 (file)
@@ -598,18 +598,13 @@ BMVert *BM_edge_collapse(
 BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
 {
        BMVert *v_new, *v_other;
+       BMEdge *e_new;
        BMFace **oldfaces = NULL;
-       BMEdge *e_dummy;
        BLI_array_staticdeclare(oldfaces, 32);
        const int cd_loop_mdisp_offset = BM_edge_is_wire(e) ? -1 : CustomData_get_offset(&bm->ldata, CD_MDISPS);
 
        BLI_assert(BM_vert_in_edge(e, v) == true);
 
-       /* we need this for handling multi-res */
-       if (!r_e) {
-               r_e = &e_dummy;
-       }
-
        /* do we have a multi-res layer? */
        if (cd_loop_mdisp_offset != -1) {
                BMLoop *l;
@@ -630,17 +625,20 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
        }
 
        v_other = BM_edge_other_vert(e, v);
-       v_new = bmesh_semv(bm, v, e, r_e);
+       v_new = bmesh_semv(bm, v, e, &e_new);
+       if (r_e != NULL) {
+               *r_e = e_new;
+       }
 
        BLI_assert(v_new != NULL);
-       BLI_assert(BM_vert_in_edge(*r_e, v) && BM_vert_in_edge(*r_e, v_new));
+       BLI_assert(BM_vert_in_edge(e_new, v) && BM_vert_in_edge(e_new, v_new));
        BLI_assert(BM_vert_in_edge(e, v_new) && BM_vert_in_edge(e, v_other));
 
        sub_v3_v3v3(v_new->co, v_other->co, v->co);
        madd_v3_v3v3fl(v_new->co, v->co, v_new->co, fac);
 
-       (*r_e)->head.hflag = e->head.hflag;
-       BM_elem_attrs_copy(bm, bm, e, *r_e);
+       e_new->head.hflag = e->head.hflag;
+       BM_elem_attrs_copy(bm, bm, e, e_new);
 
        /* v->v_new->v2 */
        BM_data_interp_face_vert_edge(bm, v_other, v, v_new, e, fac);
@@ -656,7 +654,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
                        BM_face_calc_center_mean(oldfaces[i], f_center_old);
 
                        for (j = 0; j < 2; j++) {
-                               BMEdge *e1 = j ? *r_e : e;
+                               BMEdge *e1 = j ? e_new : e;
                                BMLoop *l;
                                
                                l = e1->l;
@@ -689,7 +687,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
                /* fix boundaries a bit, doesn't work too well quite yet */
 #if 0
                for (j = 0; j < 2; j++) {
-                       BMEdge *e1 = j ? *r_e : e;
+                       BMEdge *e1 = j ? e_new : e;
                        BMLoop *l, *l2;
                        
                        l = e1->l;
index b5f9575aff5ae5349b7fa7c8ab52a9a9b4b19d6f..22095214133e0b51af91e5bda07796f5bb96adce 100644 (file)
@@ -910,7 +910,7 @@ bool BM_vert_is_wire(const BMVert *v)
  * A vertex is non-manifold if it meets the following conditions:
  * 1: Loose - (has no edges/faces incident upon it).
  * 2: Joins two distinct regions - (two pyramids joined at the tip).
- * 3: Is part of a an edge with more than 2 faces.
+ * 3: Is part of an edge with more than 2 faces.
  * 4: Is part of a wire edge.
  */
 bool BM_vert_is_manifold(const BMVert *v)
index edde8cb5d31919e8ee106807068603097ab387c9..6052de421dda4de66615ed8164847716d6a04605 100644 (file)
@@ -264,10 +264,12 @@ bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
 {
        BMEdge *e_iter;
 
-       if (!BM_vert_in_edge(e, v))
+       if (!BM_vert_in_edge(e, v)) {
                return false;
-       if (bmesh_disk_count_ex(v, len + 1) != len || len == 0)
+       }
+       if (len == 0 || bmesh_disk_count_ex(v, len + 1) != len) {
                return false;
+       }
 
        e_iter = e;
        do {
index 67da8201f66348cd1b7f9345d1a7b14ed9d2f795..4416b6494f93cda2e4a0fabac113fb638de7b2b4 100644 (file)
@@ -2822,7 +2822,7 @@ void node_tex_checker(vec3 co, vec4 color1, vec4 color2, float scale, out vec4 c
 }
 
 #ifdef BIT_OPERATIONS
-vec2 calc_brick_texture(vec3 p, float mortar_size, float bias,
+vec2 calc_brick_texture(vec3 p, float mortar_size, float mortar_smooth, float bias,
                         float brick_width, float row_height,
                         float offset_amount, int offset_frequency,
                         float squash_amount, int squash_frequency)
@@ -2843,17 +2843,26 @@ vec2 calc_brick_texture(vec3 p, float mortar_size, float bias,
        x = (p.x + offset) - brick_width * bricknum;
        y = p.y - row_height * rownum;
 
-       return vec2(clamp((integer_noise((rownum << 16) + (bricknum & 0xFFFF)) + bias), 0.0, 1.0),
-                   (x < mortar_size || y < mortar_size ||
-                    x > (brick_width - mortar_size) ||
-                    y > (row_height - mortar_size)) ? 1.0 : 0.0);
+       float tint = clamp((integer_noise((rownum << 16) + (bricknum & 0xFFFF)) + bias), 0.0, 1.0);
+
+       float min_dist = min(min(x, y), min(brick_width - x, row_height - y));
+       if(min_dist >= mortar_size) {
+               return vec2(tint, 0.0);
+       }
+       else if(mortar_smooth == 0.0) {
+               return vec2(tint, 1.0);
+       }
+       else {
+               min_dist = 1.0 - min_dist/mortar_size;
+               return vec2(tint, smoothstep(0.0, mortar_smooth, min_dist));
+       }
 }
 #endif
 
 void node_tex_brick(vec3 co,
                     vec4 color1, vec4 color2,
                     vec4 mortar, float scale,
-                    float mortar_size, float bias,
+                    float mortar_size, float mortar_smooth, float bias,
                     float brick_width, float row_height,
                     float offset_amount, float offset_frequency,
                     float squash_amount, float squash_frequency,
@@ -2861,7 +2870,7 @@ void node_tex_brick(vec3 co,
 {
 #ifdef BIT_OPERATIONS
        vec2 f2 = calc_brick_texture(co * scale,
-                                    mortar_size, bias,
+                                    mortar_size, mortar_smooth, bias,
                                     brick_width, row_height,
                                     offset_amount, int(offset_frequency),
                                     squash_amount, int(squash_frequency));
@@ -2871,7 +2880,7 @@ void node_tex_brick(vec3 co,
                float facm = 1.0 - tint;
                color1 = facm * color1 + tint * color2;
        }
-       color = (f == 1.0) ? mortar : color1;
+       color = mix(color1, mortar, f);
        fac = f;
 #else
        color = vec4(1.0);
index 9dec269872082da5bb0c218e86cddedf2ed5b6a5..3d6462e09a0d8ada5faa579a0b29b383cc52c3c8 100644 (file)
@@ -2064,11 +2064,13 @@ static float lamp_get_data_internal(ShadeInput *shi, GroupObject *go, float col[
                if (lar->mode & LA_SHAD_TEX)
                        do_lamp_tex(lar, lv, shi, shadow, LA_SHAD_TEX);
 
-               lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
+               if (R.r.mode & R_SHADOW) {
+                       lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
 
-               shadow[0] = 1.0f - ((1.0f - shadfac[0] * shadfac[3]) * (1.0f - shadow[0]));
-               shadow[1] = 1.0f - ((1.0f - shadfac[1] * shadfac[3]) * (1.0f - shadow[1]));
-               shadow[2] = 1.0f - ((1.0f - shadfac[2] * shadfac[3]) * (1.0f - shadow[2]));
+                       shadow[0] = 1.0f - ((1.0f - shadfac[0] * shadfac[3]) * (1.0f - shadow[0]));
+                       shadow[1] = 1.0f - ((1.0f - shadfac[1] * shadfac[3]) * (1.0f - shadow[1]));
+                       shadow[2] = 1.0f - ((1.0f - shadfac[2] * shadfac[3]) * (1.0f - shadow[2]));
+               }
        }
 
        return visifac;