[Bf-blender-cvs] [f553aba] master: Correct docstring

2015-04-29 Thread Campbell Barton
Commit: f553aba69f02e69ce218dbfbd99da3b998760c16
Author: Campbell Barton
Date:   Thu Apr 30 09:55:54 2015 +1000
Branches: master
https://developer.blender.org/rBf553aba69f02e69ce218dbfbd99da3b998760c16

Correct docstring

===

M   source/blender/python/bmesh/bmesh_py_utils.c

===

diff --git a/source/blender/python/bmesh/bmesh_py_utils.c 
b/source/blender/python/bmesh/bmesh_py_utils.c
index 0dd6ee7..8c9f4c4 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -670,7 +670,7 @@ PyDoc_STRVAR(bpy_bm_utils_face_vert_separate_doc,
 "   :type face: :class:`bmesh.types.BMFace`\n"
 "   :arg vert: A vertex in the face to separate.\n"
 "   :type vert: :class:`bmesh.types.BMVert`\n"
-"   :return vert: The newly created vertex or None of failure.\n"
+"   :return vert: The newly created vertex or None on failure.\n"
 "   :rtype vert: :class:`bmesh.types.BMVert`\n"
 "\n"
 "   .. note::\n"
@@ -749,9 +749,9 @@ PyDoc_STRVAR(bpy_bm_utils_loop_separate_doc,
 "\n"
 "   Rip a vertex in a face away and add a new vertex.\n"
 "\n"
-"   :arg loop: The to separate.\n"
-"   :type loop: :class:`bmesh.types.BMFace`\n"
-"   :return vert: The newly created vertex or None of failure.\n"
+"   :arg loop: The loop to separate.\n"
+"   :type loop: :class:`bmesh.types.BMLoop`\n"
+"   :return vert: The newly created vertex or None on failure.\n"
 "   :rtype vert: :class:`bmesh.types.BMVert`\n"
 );
 static PyObject *bpy_bm_utils_loop_separate(PyObject *UNUSED(self), BPy_BMLoop 
*value)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b640700] master: Cleanup: style

2015-04-29 Thread Campbell Barton
Commit: b640700597e4a331ee45f9a8850953e8e08cfd93
Author: Campbell Barton
Date:   Thu Apr 30 08:07:15 2015 +1000
Branches: master
https://developer.blender.org/rBb640700597e4a331ee45f9a8850953e8e08cfd93

Cleanup: style

===

M   source/blender/blenkernel/BKE_curve.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/editors/sculpt_paint/paint_intern.h
M   source/blender/editors/sculpt_paint/paint_stroke.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/gpu/GPU_debug.h
M   source/blender/imbuf/intern/IMB_filetype.h

===

diff --git a/source/blender/blenkernel/BKE_curve.h 
b/source/blender/blenkernel/BKE_curve.h
index 98c8541..9de13ce 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -90,7 +90,7 @@ void BKE_curve_translate(struct Curve *cu, float offset[3], 
const bool do_keys);
 void BKE_curve_material_index_remove(struct Curve *cu, int index);
 void BKE_curve_material_index_clear(struct Curve *cu);
 int BKE_curve_material_index_validate(struct Curve *cu);
-void BKE_curve_material_remap(struct Curve *cu,const unsigned int *remap, 
unsigned int remap_len);
+void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, 
unsigned int remap_len);
 
 ListBase*BKE_curve_nurbs_get(struct Curve *cu);
 
diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 03ad176..1df633c 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -104,8 +104,9 @@ bool BKE_pbvh_bmesh_node_raycast_detail(
 
 /* for orthographic cameras, project the far away ray segment points to the 
root node so
  * we can have better precision. */
-void BKE_pbvh_raycast_project_ray_root(PBVH *bvh, bool original, float 
ray_start[3],
-   float ray_end[3], float ray_normal[3]);
+void BKE_pbvh_raycast_project_ray_root(
+PBVH *bvh, bool original,
+float ray_start[3], float ray_end[3], float ray_normal[3]);
 
 /* Drawing */
 
diff --git a/source/blender/blenkernel/intern/material.c 
b/source/blender/blenkernel/intern/material.c
index 8932ac1..eaaf131 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -937,7 +937,7 @@ void BKE_material_remap_object(Object *ob, const unsigned 
int *remap)
BLI_array_permute(ob->matbits, ob->totcol, remap);
}
 
-   if(matar) {
+   if (matar) {
BLI_array_permute(*matar, *totcol_p, remap);
}
 
diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index fdda72e..bcbf3b8 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1612,7 +1612,9 @@ bool BKE_pbvh_node_raycast(
return hit;
 }
 
-void BKE_pbvh_raycast_project_ray_root (PBVH *bvh, bool original, float 
ray_start[3], float ray_end[3], float ray_normal[3])
+void BKE_pbvh_raycast_project_ray_root(
+PBVH *bvh, bool original,
+float ray_start[3], float ray_end[3], float ray_normal[3])
 {
if (bvh->nodes) {
float rootmin_start, rootmin_end;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h 
b/source/blender/editors/sculpt_paint/paint_intern.h
index 77059a2..05a5bf9 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -160,7 +160,7 @@ void paint_2d_redraw(const bContext *C, void *ps, bool 
final);
 void paint_2d_stroke_done(void *ps);
 void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], 
const bool eraser, float pressure, float distance, float size);
 void paint_2d_bucket_fill(const struct bContext *C, const float color[3], 
struct Brush *br, const float mouse_init[2], void *ps);
-void paint_2d_gradient_fill (const struct bContext *C, struct Brush *br, const 
float mouse_init[2], const float mouse_final[2], void *ps);
+void paint_2d_gradient_fill(const struct bContext *C, struct Brush *br, const 
float mouse_init[2], const float mouse_final[2], void *ps);
 void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float 
mouse[2], int mode);
 void paint_proj_stroke(const struct bContext *C, void *ps, const float 
prevmval_i[2], const float mval_i[2], const bool eraser, float pressure, float 
distance, float size);
 void paint_proj_redraw(const struct bContext *C, void *pps, bool final);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c 
b/source/blender/editors/sculpt_paint/paint_stroke.c
index f5a65be..f0963ca 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/pai

[Bf-blender-cvs] [0ecce09] master: Correct missing break

2015-04-29 Thread Campbell Barton
Commit: 0ecce09288c4141e1cfb65f81a53f19b6d726049
Author: Campbell Barton
Date:   Thu Apr 30 08:18:32 2015 +1000
Branches: master
https://developer.blender.org/rB0ecce09288c4141e1cfb65f81a53f19b6d726049

Correct missing break

===

M   source/blender/compositor/operations/COM_BlurBaseOperation.cpp

===

diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 
b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index 07669b1..ce42de7 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -135,6 +135,7 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, 
int size, int falloff
break;
case PROP_INVSQUARE:
val = val * (2.0f - val);
+   break;
case PROP_LIN:
/* fall-through */
 #ifndef NDEBUG

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4eab0e7] master: Cleanup: Update some comments and add ToDo.

2015-04-29 Thread Thomas Dinges
Commit: 4eab0e72b380163f1b2e65e4d0efae30c1cdd916
Author: Thomas Dinges
Date:   Wed Apr 29 23:56:46 2015 +0200
Branches: master
https://developer.blender.org/rB4eab0e72b380163f1b2e65e4d0efae30c1cdd916

Cleanup: Update some comments and add ToDo.

===

M   intern/cycles/kernel/geom/geom_bvh.h

===

diff --git a/intern/cycles/kernel/geom/geom_bvh.h 
b/intern/cycles/kernel/geom/geom_bvh.h
index c2610c7..2e8e27c 100644
--- a/intern/cycles/kernel/geom/geom_bvh.h
+++ b/intern/cycles/kernel/geom/geom_bvh.h
@@ -115,39 +115,7 @@ CCL_NAMESPACE_BEGIN
 #include "geom_bvh_subsurface.h"
 #endif
 
-/* Record all BVH intersection for shadows */
-
-#if defined(__SHADOW_RECORD_ALL__)
-#define BVH_FUNCTION_NAME bvh_intersect_shadow_all
-#define BVH_FUNCTION_FEATURES 0
-#include "geom_bvh_shadow.h"
-#endif
-
-#if defined(__SHADOW_RECORD_ALL__) && defined(__INSTANCING__)
-#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing
-#define BVH_FUNCTION_FEATURES BVH_INSTANCING
-#include "geom_bvh_shadow.h"
-#endif
-
-#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__)
-#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair
-#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
-#include "geom_bvh_shadow.h"
-#endif
-
-#if defined(__SHADOW_RECORD_ALL__) && defined(__OBJECT_MOTION__)
-#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion
-#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
-#include "geom_bvh_shadow.h"
-#endif
-
-#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) && 
defined(__OBJECT_MOTION__)
-#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion
-#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION
-#include "geom_bvh_shadow.h"
-#endif
-
-/* Camera inside Volume BVH intersection */
+/* Volume BVH traversal */
 
 #if defined(__VOLUME__)
 #define BVH_FUNCTION_NAME bvh_intersect_volume
@@ -179,7 +147,39 @@ CCL_NAMESPACE_BEGIN
 #include "geom_bvh_volume.h"
 #endif
 
-/* Record all BVH intersection for volumes */
+/* Record all intersections - Shadow BVH traversal */
+
+#if defined(__SHADOW_RECORD_ALL__)
+#define BVH_FUNCTION_NAME bvh_intersect_shadow_all
+#define BVH_FUNCTION_FEATURES 0
+#include "geom_bvh_shadow.h"
+#endif
+
+#if defined(__SHADOW_RECORD_ALL__) && defined(__INSTANCING__)
+#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING
+#include "geom_bvh_shadow.h"
+#endif
+
+#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__)
+#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
+#include "geom_bvh_shadow.h"
+#endif
+
+#if defined(__SHADOW_RECORD_ALL__) && defined(__OBJECT_MOTION__)
+#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
+#include "geom_bvh_shadow.h"
+#endif
+
+#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) && 
defined(__OBJECT_MOTION__)
+#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION
+#include "geom_bvh_shadow.h"
+#endif
+
+/* Record all intersections - Volume BVH traversal  */
 
 #if defined(__VOLUME_RECORD_ALL__)
 #define BVH_FUNCTION_NAME bvh_intersect_volume_all
@@ -447,6 +447,7 @@ ccl_device_inline float3 ray_offset(float3 P, float3 Ng)
 #endif
 }
 
+/* ToDo: Move to another file? */
 ccl_device int intersections_compare(const void *a, const void *b)
 {
const Intersection *isect_a = (const Intersection*)a;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b3def11] master: Cycles: Record all possible volume intersections for SSS and camera checks

2015-04-29 Thread Thomas Dinges
Commit: b3def11f5b751ead0bc8bcf100ff4ab3f2b10981
Author: Thomas Dinges
Date:   Wed Apr 29 23:21:05 2015 +0200
Branches: master
https://developer.blender.org/rBb3def11f5b751ead0bc8bcf100ff4ab3f2b10981

Cycles: Record all possible volume intersections for SSS and camera checks

This replaces sequential ray moving followed with scene intersection with
single BVH traversal, which gives us all possible intersections.

Only implemented for CPU, due to qsort and a bigger memory usage on GPU
which we rather avoid. GPU still uses the regular bvh volume intersection code, 
while CPU now uses the new code.

This improves render performance for scenes with:
a) Camera inside volume mesh
b) SSS mesh intersecting a volume mesh/domain

In simple volume files (not much geometry) performance is roughly the same
(slightly faster). In files with a lot of geometry, the performance
increase is larger. bmps.blend with a volume shader and camera inside the
mesh, it renders ~10% faster here.

Patch by Sergey and myself.

Differential Revision: https://developer.blender.org/D1264

===

M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/geom/geom_bvh.h
A   intern/cycles/kernel/geom/geom_bvh_volume_all.h
A   intern/cycles/kernel/geom/geom_qbvh_volume_all.h
M   intern/cycles/kernel/kernel_shadow.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index fd69023..83b3450 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -119,6 +119,7 @@ set(SRC_GEOM_HEADERS
geom/geom_bvh_subsurface.h
geom/geom_bvh_traversal.h
geom/geom_bvh_volume.h
+   geom/geom_bvh_volume_all.h
geom/geom_curve.h
geom/geom_motion_curve.h
geom/geom_motion_triangle.h
@@ -129,6 +130,7 @@ set(SRC_GEOM_HEADERS
geom/geom_qbvh_subsurface.h
geom/geom_qbvh_traversal.h
geom/geom_qbvh_volume.h
+   geom/geom_qbvh_volume_all.h
geom/geom_triangle.h
geom/geom_triangle_intersect.h
geom/geom_volume.h
diff --git a/intern/cycles/kernel/geom/geom_bvh.h 
b/intern/cycles/kernel/geom/geom_bvh.h
index c0eefcd..c2610c7 100644
--- a/intern/cycles/kernel/geom/geom_bvh.h
+++ b/intern/cycles/kernel/geom/geom_bvh.h
@@ -179,6 +179,38 @@ CCL_NAMESPACE_BEGIN
 #include "geom_bvh_volume.h"
 #endif
 
+/* Record all BVH intersection for volumes */
+
+#if defined(__VOLUME_RECORD_ALL__)
+#define BVH_FUNCTION_NAME bvh_intersect_volume_all
+#define BVH_FUNCTION_FEATURES 0
+#include "geom_bvh_volume_all.h"
+#endif
+
+#if defined(__VOLUME_RECORD_ALL__) && defined(__INSTANCING__)
+#define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING
+#include "geom_bvh_volume_all.h"
+#endif
+
+#if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__)
+#define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH
+#include "geom_bvh_volume_all.h"
+#endif
+
+#if defined(__VOLUME_RECORD_ALL__) && defined(__OBJECT_MOTION__)
+#define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion
+#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
+#include "geom_bvh_volume_all.h"
+#endif
+
+#if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__) && 
defined(__OBJECT_MOTION__)
+#define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair_motion
+#define BVH_FUNCTION_FEATURES 
BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION
+#include "geom_bvh_volume_all.h"
+#endif
+
 #undef BVH_FEATURE
 #undef BVH_NAME_JOIN
 #undef BVH_NAME_EVAL
@@ -330,6 +362,37 @@ ccl_device_intersect bool 
scene_intersect_volume(KernelGlobals *kg,
 }
 #endif
 
+#ifdef __VOLUME_RECORD_ALL__
+ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg,
+ const Ray *ray,
+ Intersection *isect,
+ const uint max_hits)
+{
+#ifdef __OBJECT_MOTION__
+   if(kernel_data.bvh.have_motion) {
+#ifdef __HAIR__
+   if(kernel_data.bvh.have_curves)
+   return bvh_intersect_volume_all_hair_motion(kg, ray, 
isect, max_hits);
+#endif /* __HAIR__ */
+
+   return bvh_intersect_volume_all_motion(kg, ray, isect, 
max_hits);
+   }
+#endif /* __OBJECT_MOTION__ */
+
+#ifdef __HAIR__
+   if(kernel_data.bvh.have_curves)
+   return bvh_intersect_volume_all_hair(kg, ray, isect, max_hits);
+#endif /* __HAIR__ */
+
+#ifdef __INSTANCING__
+   if(kernel_data.bvh.have_instancing)
+   return bvh_intersect_volume_all_instancing(kg, ray, isect, 
max_hits);
+#endif /* __INSTANCING__ */
+
+   return bvh

[Bf-blender-cvs] [e9dcb06] master: Fix T44484: Edge-split corrupts mesh

2015-04-29 Thread Campbell Barton
Commit: e9dcb068c749bc9e73450a4feb491551ede58c07
Author: Campbell Barton
Date:   Thu Apr 30 07:22:18 2015 +1000
Branches: master
https://developer.blender.org/rBe9dcb068c749bc9e73450a4feb491551ede58c07

Fix T44484: Edge-split corrupts mesh

Splitting non-manifold edges could produce duplicate edges.

===

M   source/blender/bmesh/operators/bmo_split_edges.c
M   source/blender/bmesh/tools/bmesh_edgesplit.c
M   source/blender/bmesh/tools/bmesh_edgesplit.h
M   source/blender/bmesh/tools/bmesh_intersect.c
M   source/blender/editors/mesh/editmesh_rip.c
M   source/blender/modifiers/intern/MOD_edgesplit.c

===

diff --git a/source/blender/bmesh/operators/bmo_split_edges.c 
b/source/blender/bmesh/operators/bmo_split_edges.c
index eb7946c..ca20883 100644
--- a/source/blender/bmesh/operators/bmo_split_edges.c
+++ b/source/blender/bmesh/operators/bmo_split_edges.c
@@ -48,7 +48,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
}
 
/* this is where everything happens */
-   BM_mesh_edgesplit(bm, use_verts, true, false);
+   BM_mesh_edgesplit(bm, use_verts, true, true, false);
 
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", 
BM_EDGE, BM_ELEM_INTERNAL_TAG);
 }
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.c 
b/source/blender/bmesh/tools/bmesh_edgesplit.c
index c01b488..30ba07c 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.c
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.c
@@ -42,7 +42,7 @@
  * un-tag edges not connected to other tagged edges,
  * unless they are on a boundary
  */
-static void bm_edgesplit_validate_seams(BMesh *bm)
+static void bm_edgesplit_validate_seams(BMesh *bm, const bool use_non_manifold)
 {
BMIter iter;
BMEdge *e;
@@ -72,6 +72,11 @@ static void bm_edgesplit_validate_seams(BMesh *bm)
 * the edge its self can't be split */
BM_elem_flag_disable(e, BM_ELEM_TAG);
}
+   else if ((use_non_manifold == false) &&
+(BM_edge_is_manifold(e) == false))
+   {
+   BM_elem_flag_disable(e, BM_ELEM_TAG);
+   }
}
 
/* single marked edges unconnected to any other marked edges
@@ -98,7 +103,16 @@ static void bm_edgesplit_validate_seams(BMesh *bm)
MEM_freeN(vtouch);
 }
 
-void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, 
const bool copy_select)
+/**
+ * \param use_verts  Use flagged verts instead of edges.
+ * \param use_non_manifold  Split non-manifold edges (a little slower, must 
check for doubles).
+ * \param tag_only  Only split tagged edges.
+ * \param copy_select  Copy selection history.
+ */
+void BM_mesh_edgesplit(
+BMesh *bm,
+const bool use_verts, const bool use_non_manifold,
+const bool tag_only, const bool copy_select)
 {
BMIter iter;
BMEdge *e;
@@ -142,7 +156,7 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, 
const bool tag_only, con
}
}
 
-   bm_edgesplit_validate_seams(bm);
+   bm_edgesplit_validate_seams(bm, use_non_manifold);
 
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
@@ -204,6 +218,29 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, 
const bool tag_only, con
}
}
 
+   if (use_non_manifold) {
+   /* if we split non-manifold, double edge may remain */
+   BMEdge *e_next;
+   BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
+   if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+   BMEdge *e_other;
+   if ((e_other = BM_edge_find_double(e))) {
+   BM_edge_splice(bm, e, e_other);
+   }
+   }
+   }
+   }
+   else {
+#ifndef NDEBUG
+   /* ensure we don't have any double edges! */
+   BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+   if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+   BLI_assert(BM_edge_find_double(e) == NULL);
+   }
+   }
+#endif
+   }
+
if (use_ese) {
BLI_ghash_free(ese_gh, NULL, NULL);
}
diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.h 
b/source/blender/bmesh/tools/bmesh_edgesplit.h
index bd66f6a..531af96 100644
--- a/source/blender/bmesh/tools/bmesh_edgesplit.h
+++ b/source/blender/bmesh/tools/bmesh_edgesplit.h
@@ -27,6 +27,9 @@
  *  \ingroup bmesh
  */
 
-void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, 
const bool copy_select);
+void BM_mesh_edgesplit(
+BMesh *

[Bf-blender-cvs] [53662bc] master: BMesh: simplify/optimize loop splitting logic

2015-04-29 Thread Campbell Barton
Commit: 53662bcaf1c158a083faf48b1748787a9b2e6909
Author: Campbell Barton
Date:   Thu Apr 30 02:37:21 2015 +1000
Branches: master
https://developer.blender.org/rB53662bcaf1c158a083faf48b1748787a9b2e6909

BMesh: simplify/optimize loop splitting logic

To split off a single loop, was splitting all fans off the vertex, then merging 
back together (except for one).

Now simply splits off one loop.

===

M   source/blender/bmesh/intern/bmesh_core.c

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 76b54a4..abeecf5 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2303,11 +2303,11 @@ void bmesh_edge_separate(
  */
 BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep)
 {
-   BMVert **vtar;
-   int len, i;
BMVert *v_new = NULL;
BMVert *v_sep = l_sep->v;
BMEdge *e_iter;
+   BMEdge *edges[2];
+   int i;
 
/* peel the face from the edge radials on both sides of the
 * loop vert, disconnecting the face from its fan */
@@ -2335,49 +2335,26 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep)
}
}
 
-   /* Update the disk start, so that v->e points to an edge touching the 
split loop.
-* This is so that BM_vert_split will leave the original v_sep on some 
*other* fan
-* (not the one-face fan that holds the unglue face). */
-   v_sep->e = e_iter;
-
-   /* Split all fans connected to the vert, duplicating it for
-* each fans. */
-   bmesh_vert_separate(bm, v_sep, &vtar, &len, false);
+   v_sep->e = l_sep->e;
 
-   /* There should have been at least two fans cut apart here,
-* otherwise the early exit would have kicked in. */
-   BLI_assert(len >= 2);
+   v_new = BM_vert_create(bm, v_sep->co, v_sep, BM_CREATE_NOP);
 
-   v_new = l_sep->v;
+   edges[0] = l_sep->e;
+   edges[1] = l_sep->prev->e;
 
-   /* Desired result here is that a new vert should always be
-* created for the unglue face. This is so we can glue any
-* extras back into the original vert. */
-   BLI_assert(v_new != v_sep);
-   BLI_assert(v_sep == vtar[0]);
-
-   /* If there are more than two verts as a result, glue together
-* all the verts except the one this URMV intended to create */
-   if (len > 2) {
-   for (i = 0; i < len; i++) {
-   if (vtar[i] == v_new) {
-   break;
-   }
-   }
-
-   if (i != len) {
-   /* Swap the single vert that was needed for the
-* unglue into the last array slot */
-   SWAP(BMVert *, vtar[i], vtar[len - 1]);
-
-   /* And then glue the rest back together */
-   for (i = 1; i < len - 1; i++) {
-   BM_vert_splice(bm, vtar[i], vtar[0]);
-   }
-   }
+   for (i = 0; i < ARRAY_SIZE(edges); i++) {
+   BMEdge *e = edges[i];
+   bmesh_edge_vert_swap(e, v_new, v_sep);
}
 
-   MEM_freeN(vtar);
+   BLI_assert(v_sep != l_sep->v);
+   BLI_assert(v_sep->e != l_sep->v->e);
+
+   BM_CHECK_ELEMENT(l_sep);
+   BM_CHECK_ELEMENT(v_sep);
+   BM_CHECK_ELEMENT(edges[0]);
+   BM_CHECK_ELEMENT(edges[1]);
+   BM_CHECK_ELEMENT(v_new);
 
return v_new;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [99811c28] master: BMesh: use BM_face_loop_separate_multi for rip

2015-04-29 Thread Campbell Barton
Commit: 99811c283efaa8f5bc13b81bb5cc42761c42a8a0
Author: Campbell Barton
Date:   Thu Apr 30 06:23:01 2015 +1000
Branches: master
https://developer.blender.org/rB99811c283efaa8f5bc13b81bb5cc42761c42a8a0

BMesh: use BM_face_loop_separate_multi for rip

Resolves bug over-splitting non-manifold connected edges.

===

M   source/blender/editors/mesh/editmesh_rip.c

===

diff --git a/source/blender/editors/mesh/editmesh_rip.c 
b/source/blender/editors/mesh/editmesh_rip.c
index 45e16cef..f5d22ea 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -734,20 +734,42 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator 
*op, const wmEvent *eve
/* unlike edge split, for single vertex split we only use the operator 
in one of the cases
 * but both allocate fill */
 
-   /* rip two adjacent edges */
-   if (BM_edge_is_boundary(e2) || BM_vert_face_count_is_equal(v, 2)) {
-   /* Don't run the edge split operator in this case */
+   {
BMVert *v_rip;
+   BMLoop *larr[2];
+   int larr_len = 0;
+
+   /* rip two adjacent edges */
+   if (BM_edge_is_boundary(e2) || BM_vert_face_count_is_equal(v, 
2)) {
+   /* Don't run the edge split operator in this case */
 
-   l = BM_edge_vert_share_loop(e2->l, v);
+   l = BM_edge_vert_share_loop(e2->l, v);
+   larr[larr_len] = l;
+   larr_len++;
 
-   /* only tag for face-fill (we don't call the operator) */
-   if (BM_edge_is_boundary(e2)) {
-   BM_elem_flag_enable(e2, BM_ELEM_TAG);
+   /* only tag for face-fill (we don't call the operator) 
*/
+   if (BM_edge_is_boundary(e2)) {
+   BM_elem_flag_enable(e2, BM_ELEM_TAG);
+   }
+   else {
+   BM_elem_flag_enable(l->e, BM_ELEM_TAG);
+   BM_elem_flag_enable(l->prev->e, BM_ELEM_TAG);
+   }
}
else {
-   BM_elem_flag_enable(l->e, BM_ELEM_TAG);
-   BM_elem_flag_enable(l->prev->e, BM_ELEM_TAG);
+   if (BM_edge_is_manifold(e2)) {
+   BMLoop *l_iter, *l_first;
+
+   l_iter = l_first = e2->l;
+   do {
+   larr[larr_len] = 
BM_edge_vert_share_loop(l_iter, v);
+   BM_elem_flag_enable(larr[larr_len]->e, 
BM_ELEM_TAG);
+   larr_len++;
+   } while ((l_iter = l_iter->radial_next) != 
l_first);
+   }
+   else {
+   /* looks like there are no split edges, we 
could just return/report-error? - Campbell */
+   }
}
 
/* keep directly before edgesplit */
@@ -755,13 +777,12 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator 
*op, const wmEvent *eve
fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
}
 
-#if 0
-   v_rip = BM_face_vert_separate(bm, l->f, v);
-#else
-   v_rip = BM_face_loop_separate(bm, l);
-#endif
-
-   BLI_assert(v_rip);
+   if (larr_len) {
+   v_rip = BM_face_loop_separate_multi(bm, larr, larr_len);
+   }
+   else {
+   v_rip = NULL;
+   }
 
if (v_rip) {
BM_vert_select_set(bm, v_rip, true);
@@ -771,27 +792,6 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator 
*op, const wmEvent *eve
return OPERATOR_CANCELLED;
}
}
-   else {
-   if (BM_edge_is_manifold(e2)) {
-   l = e2->l;
-   e = BM_loop_other_edge_loop(l, v)->e;
-   BM_elem_flag_enable(e, BM_ELEM_TAG);
-
-   l = e2->l->radial_next;
-   e = BM_loop_other_edge_loop(l, v)->e;
-   BM_elem_flag_enable(e, BM_ELEM_TAG);
-   }
-   else {
-   /* looks like there are no split edges, we could just 
return/report-error? - Campbell */
-   }
-
-   /* keep directly before edgesplit */
-   if (do_fill) {
-   fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
-   }
-
-   BM_mesh_edgesplit(em->bm, true, true, true);
-   }
 
{
/

[Bf-blender-cvs] [26541b7] master: BMesh: refactor edge-vert swapping into API call

2015-04-29 Thread Campbell Barton
Commit: 26541b7488be08ce998960e5edbbe0dcee2698c3
Author: Campbell Barton
Date:   Thu Apr 30 02:25:32 2015 +1000
Branches: master
https://developer.blender.org/rB26541b7488be08ce998960e5edbbe0dcee2698c3

BMesh: refactor edge-vert swapping into API call

===

M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_structure.c
M   source/blender/bmesh/intern/bmesh_structure.h

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index c92acfd..76b54a4 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2050,24 +2050,7 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert 
*v_target)
 
/* move all the edges from v's disk to vtarget's disk */
while ((e = v->e)) {
-
-   /* loop  */
-   BMLoop *l_first;
-   if ((l_first = e->l)) {
-   BMLoop *l_iter = l_first;
-   do {
-   if (l_iter->v == v) {
-   l_iter->v = v_target;
-   }
-   /* else if (l_iter->prev->v == v) {...}
-* (this case will be handled by a different 
edge) */
-   } while ((l_iter = l_iter->radial_next) != l_first);
-   }
-
-   /* disk */
-   bmesh_disk_edge_remove(e, v);
-   bmesh_disk_vert_swap(e, v_target, v);
-   bmesh_disk_edge_append(e, v_target);
+   bmesh_edge_vert_swap(e, v_target, v);
BLI_assert(e->v1 != e->v2);
}
 
@@ -2173,23 +2156,7 @@ void bmesh_vert_separate(
}
 
while ((e = BLI_SMALLSTACK_POP(edges))) {
-
-   /* swap out loops */
-   if (e->l) {
-   BMLoop *l_iter, *l_first;
-   l_iter = l_first = e->l;
-   do {
-   if (l_iter->v == v) {
-   l_iter->v = v_new;
-   }
-   } while ((l_iter = l_iter->radial_next) 
!= l_first);
-   }
-
-   /* swap out edges */
-   BLI_assert(e->v1 == v || e->v2 == v);
-   bmesh_disk_edge_remove(e, v);
-   bmesh_disk_vert_swap(e, v_new, v);
-   bmesh_disk_edge_append(e, v_new);
+   bmesh_edge_vert_swap(e, v_new, v);
}
 
if (r_vout) {
diff --git a/source/blender/bmesh/intern/bmesh_structure.c 
b/source/blender/bmesh/intern/bmesh_structure.c
index 3b1dd7e..30ab693 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -56,6 +56,32 @@ void bmesh_disk_vert_swap(BMEdge *e, BMVert *v_dst, BMVert 
*v_src)
 }
 
 /**
+ * Handles all connected data, use with care.
+ *
+ * Assumes caller has setup correct state before the swap is done.
+ */
+void bmesh_edge_vert_swap(BMEdge *e, BMVert *v_dst, BMVert *v_src)
+{
+   /* swap out loops */
+   if (e->l) {
+   BMLoop *l_iter, *l_first;
+   l_iter = l_first = e->l;
+   do {
+   if (l_iter->v == v_src) {
+   l_iter->v = v_dst;
+   }
+   } while ((l_iter = l_iter->radial_next) != l_first);
+   }
+
+   /* swap out edges */
+   BLI_assert(e->v1 == v_src || e->v2 == v_src);
+   bmesh_disk_edge_remove(e, v_src);
+   bmesh_disk_vert_swap(e, v_dst, v_src);
+   bmesh_disk_edge_append(e, v_dst);
+   BLI_assert(e->v1 != e->v2);
+}
+
+/**
  * \section bm_cycles BMesh Cycles
  * (this is somewhat outdate, though bits of its API are still used) - joeedh
  *
diff --git a/source/blender/bmesh/intern/bmesh_structure.h 
b/source/blender/bmesh/intern/bmesh_structure.h
index b5ffd9e..9d9fb7f 100644
--- a/source/blender/bmesh/intern/bmesh_structure.h
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -71,6 +71,7 @@ boolbmesh_radial_validate(int radlen, BMLoop *l) 
ATTR_WARN_UNUSED_RESULT ATT
 
 /* EDGE UTILITIES */
 voidbmesh_disk_vert_swap(BMEdge *e, BMVert *v_dst, BMVert *v_src) 
ATTR_NONNULL();
+voidbmesh_edge_vert_swap(BMEdge *e, BMVert *v_dst, BMVert *v_src) 
ATTR_NONNULL();
 BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) 
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 boolbmesh_disk_validate(int len, BMEdge *e, BM

[Bf-blender-cvs] [3ef27ec] master: BMesh: add BM_face_loop_separate_multi

2015-04-29 Thread Campbell Barton
Commit: 3ef27ec807bc89eed5b3a10ae9041c607ff4eacb
Author: Campbell Barton
Date:   Thu Apr 30 05:52:48 2015 +1000
Branches: master
https://developer.blender.org/rB3ef27ec807bc89eed5b3a10ae9041c607ff4eacb

BMesh: add BM_face_loop_separate_multi

New utility function to handle splitting off multiple loops from a face at once.

===

M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_core.h
M   source/blender/bmesh/intern/bmesh_mods.c
M   source/blender/bmesh/intern/bmesh_mods.h

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index abeecf5..81cc972 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2360,6 +2360,151 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep)
 }
 
 /**
+ * A version of #bmesh_urmv_loop that disconnects multiple loops at once.
+ *
+ * Handles the task of finding fans boundaris.
+ */
+BMVert *bmesh_urmv_loop_multi(
+BMesh *bm, BMLoop **larr, int larr_len)
+{
+   BMVert *v_sep = larr[0]->v;
+   BMVert *v_new;
+   int i;
+   bool is_mixed_any = false;
+
+   BLI_SMALLSTACK_DECLARE(edges, BMEdge *);
+
+#define LOOP_VISIT _FLAG_WALK
+#define EDGE_VISIT _FLAG_WALK
+
+   for (i = 0; i < larr_len; i++) {
+   BMLoop *l_sep = larr[i];
+
+   /* all must be from the same vert! */
+   BLI_assert(v_sep == l_sep->v);
+
+   BLI_assert(!BM_ELEM_API_FLAG_TEST(l_sep, LOOP_VISIT));
+   BM_ELEM_API_FLAG_ENABLE(l_sep, LOOP_VISIT);
+
+   /* weak! but it makes it simpler to check for edges to split
+* while doing a radial loop (where loops may be adjacent) */
+   BM_ELEM_API_FLAG_ENABLE(l_sep->next, LOOP_VISIT);
+   BM_ELEM_API_FLAG_ENABLE(l_sep->prev, LOOP_VISIT);
+   }
+
+   for (i = 0; i < larr_len; i++) {
+   BMLoop *l_sep = larr[i];
+
+   BMLoop *loop_pair[2] = {l_sep, l_sep->prev};
+   int j;
+   for (j = 0; j < ARRAY_SIZE(loop_pair); j++) {
+   BMEdge *e = loop_pair[j]->e;
+   if (!BM_ELEM_API_FLAG_TEST(e, EDGE_VISIT)) {
+   BMLoop *l_iter, *l_first;
+   bool is_mixed = false;
+
+   BM_ELEM_API_FLAG_ENABLE(e, EDGE_VISIT);
+
+   l_iter = l_first = e->l;
+   do {
+   if (!BM_ELEM_API_FLAG_TEST(l_iter, 
LOOP_VISIT)) {
+   is_mixed = true;
+   is_mixed_any = true;
+   break;
+   }
+   } while ((l_iter = l_iter->radial_next) != 
l_first);
+
+   if (is_mixed) {
+   /* ensure the first loop is one we 
don't own so we can do a quick check below
+* on the edge's loop-flag to see if 
the edge is mixed or not. */
+   e->l = l_iter;
+   }
+   BLI_SMALLSTACK_PUSH(edges, e);
+   }
+   }
+   }
+
+   if (is_mixed_any == false) {
+   /* all loops in 'larr' are the soul owners of their edges.
+* nothing to split away from, this is a no-op */
+   v_new = v_sep;
+   }
+   else {
+   BMEdge *e;
+
+   BLI_assert(!BLI_SMALLSTACK_IS_EMPTY(edges));
+
+   v_new = BM_vert_create(bm, v_sep->co, v_sep, BM_CREATE_NOP);
+   while ((e = BLI_SMALLSTACK_POP(edges))) {
+   BMLoop *l_iter, *l_first, *l_next;
+   BMEdge *e_new;
+
+   /* disable so copied edge isn't left dirty (loop edges 
are cleared last too) */
+   BM_ELEM_API_FLAG_DISABLE(e, EDGE_VISIT);
+
+   if (!BM_ELEM_API_FLAG_TEST(e->l, LOOP_VISIT)) {
+   /* edge has some loops owned by us, some owned 
by other loops */
+   BMVert *e_new_v_pair[2];
+
+   if (e->v1 == v_sep) {
+   e_new_v_pair[0] = v_new;
+   e_new_v_pair[1] = e->v2;
+   }
+   else {
+   BLI_assert(v_sep == e->v2);
+   e_new_v_pair[0] = e->v1;
+   e_new_v_pair[1] = v_new;
+   

[Bf-blender-cvs] [67fcb04] master: BMesh: minor change to swap-vert api

2015-04-29 Thread Campbell Barton
Commit: 67fcb04bbfbaccbcae73846613862f3a9d63e3d6
Author: Campbell Barton
Date:   Thu Apr 30 01:45:20 2015 +1000
Branches: master
https://developer.blender.org/rB67fcb04bbfbaccbcae73846613862f3a9d63e3d6

BMesh: minor change to swap-vert api

- assert if the verts not in the edge (all callers assume success)
- rename to bmesh_disk_vert_swap
- swap src/dst arg order.

===

M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_structure.c
M   source/blender/bmesh/intern/bmesh_structure.h

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 3266ee0..c92acfd 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -1512,7 +1512,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, 
BMEdge **r_e)
bmesh_disk_edge_remove(e, tv);
 
/* swap out tv for v_new in e */
-   bmesh_edge_swapverts(e, tv, v_new);
+   bmesh_disk_vert_swap(e, v_new, tv);
 
/* add e to v_new's disk cycle */
bmesh_disk_edge_append(e, v_new);
@@ -1729,7 +1729,7 @@ BMEdge *bmesh_jekv(
/* remove e_old from v_kill's disk cycle */
bmesh_disk_edge_remove(e_old, v_kill);
/* relink e_old->v_kill to be e_old->tv */
-   bmesh_edge_swapverts(e_old, v_kill, tv);
+   bmesh_disk_vert_swap(e_old, tv, v_kill);
/* append e_old to tv's disk cycle */
bmesh_disk_edge_append(e_old, tv);
/* remove e_kill from tv's disk cycle */
@@ -2066,7 +2066,7 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert 
*v_target)
 
/* disk */
bmesh_disk_edge_remove(e, v);
-   bmesh_edge_swapverts(e, v, v_target);
+   bmesh_disk_vert_swap(e, v_target, v);
bmesh_disk_edge_append(e, v_target);
BLI_assert(e->v1 != e->v2);
}
@@ -2188,7 +2188,7 @@ void bmesh_vert_separate(
/* swap out edges */
BLI_assert(e->v1 == v || e->v2 == v);
bmesh_disk_edge_remove(e, v);
-   bmesh_edge_swapverts(e, v, v_new);
+   bmesh_disk_vert_swap(e, v_new, v);
bmesh_disk_edge_append(e, v_new);
}
 
diff --git a/source/blender/bmesh/intern/bmesh_structure.c 
b/source/blender/bmesh/intern/bmesh_structure.c
index 5d2eed8..3b1dd7e 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -40,19 +40,19 @@
  * MISC utility functions.
  */
 
-bool bmesh_edge_swapverts(BMEdge *e, BMVert *v_orig, BMVert *v_new)
+void bmesh_disk_vert_swap(BMEdge *e, BMVert *v_dst, BMVert *v_src)
 {
-   if (e->v1 == v_orig) {
-   e->v1 = v_new;
+   if (e->v1 == v_src) {
+   e->v1 = v_dst;
e->v1_disk_link.next = e->v1_disk_link.prev = NULL;
-   return true;
}
-   else if (e->v2 == v_orig) {
-   e->v2 = v_new;
+   else if (e->v2 == v_src) {
+   e->v2 = v_dst;
e->v2_disk_link.next = e->v2_disk_link.prev = NULL;
-   return true;
}
-   return false;
+   else {
+   BLI_assert(0);
+   }
 }
 
 /**
diff --git a/source/blender/bmesh/intern/bmesh_structure.h 
b/source/blender/bmesh/intern/bmesh_structure.h
index 4a6247d..b5ffd9e 100644
--- a/source/blender/bmesh/intern/bmesh_structure.h
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -70,7 +70,7 @@ BMLoop *bmesh_radial_faceloop_find_vert(const BMFace *f, 
const BMVert *v) ATTR_W
 boolbmesh_radial_validate(int radlen, BMLoop *l) ATTR_WARN_UNUSED_RESULT 
ATTR_NONNULL();
 
 /* EDGE UTILITIES */
-boolbmesh_edge_swapverts(BMEdge *e, BMVert *v_orig, BMVert *v_new) 
ATTR_NONNULL();
+voidbmesh_disk_vert_swap(BMEdge *e, BMVert *v_dst, BMVert *v_src) 
ATTR_NONNULL();
 BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2) 
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 boolbmesh_disk_validate(int len, BMEdge *e, BMVert *v) 
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [61515] trunk/lib/tests/cycles/ ctests: Cycles tests: Add regression tests related on SSS volume stack update

2015-04-29 Thread Sergey Sharybin
Revision: 61515
  https://developer.blender.org/rBL61515
Author:   sergey
Date: 2015-04-29 20:24:31 + (Wed, 29 Apr 2015)
Log Message:
---
Cycles tests: Add regression tests related on SSS volume stack update

Modified Paths:
--
trunk/lib/tests/cycles/ctests/render_all.py

Added Paths:
---
trunk/lib/tests/cycles/ctests/reports/T39823.blend
trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png

Modified: trunk/lib/tests/cycles/ctests/render_all.py
===
--- trunk/lib/tests/cycles/ctests/render_all.py 2015-04-10 10:52:05 UTC (rev 
61514)
+++ trunk/lib/tests/cycles/ctests/render_all.py 2015-04-29 20:24:31 UTC (rev 
61515)
@@ -6,7 +6,7 @@
 
 num_args = len(sys.argv)
 if num_args < 2 or num_args > 3:
-print("usage: %s /path/to/blender.bin [/path/to/files/to/render]",
+print("usage: %s /path/to/blender.bin [/path/to/files/to/render]" %
   sys.argv[0])
 sys.exit(1)
 

Added: trunk/lib/tests/cycles/ctests/reports/T39823.blend
===
(Binary files differ)

Index: trunk/lib/tests/cycles/ctests/reports/T39823.blend
===
--- trunk/lib/tests/cycles/ctests/reports/T39823.blend  2015-04-10 10:52:05 UTC 
(rev 61514)
+++ trunk/lib/tests/cycles/ctests/reports/T39823.blend  2015-04-29 20:24:31 UTC 
(rev 61515)

Property changes on: trunk/lib/tests/cycles/ctests/reports/T39823.blend
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png
===
(Binary files differ)

Index: trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png
===
--- trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png  
2015-04-10 10:52:05 UTC (rev 61514)
+++ trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png  
2015-04-29 20:24:31 UTC (rev 61515)

Property changes on: 
trunk/lib/tests/cycles/ctests/reports/reference_renders/T39823.png
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7aab5c6] master: Cycles: Fix wrong termination criteria in SSS volume stack update

2015-04-29 Thread Sergey Sharybin
Commit: 7aab5c6ca99c04447dc57645d781e9e445be8616
Author: Sergey Sharybin
Date:   Thu Apr 30 01:20:17 2015 +0500
Branches: master
https://developer.blender.org/rB7aab5c6ca99c04447dc57645d781e9e445be8616

Cycles: Fix wrong termination criteria in SSS volume stack update

Another issue spotted with Thomas.

===

M   intern/cycles/kernel/kernel_volume.h

===

diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index 3d3d871..32c7e4e 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -1107,8 +1107,8 @@ ccl_device void 
kernel_volume_stack_update_for_subsurface(KernelGlobals *kg,
Ray volume_ray = *ray;
Intersection isect;
int step = 0;
-   while(step < VOLUME_STACK_SIZE &&
- scene_intersect_volume(kg, &volume_ray, &isect))
+   while(step < 2 * VOLUME_STACK_SIZE &&
+ scene_intersect_volume(kg, &volume_ray, &isect))
{
ShaderData sd;
shader_setup_from_ray(kg, &sd, &isect, &volume_ray, 0, 0);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e5f3193] master: Cycles: Fix wrong order in object flags calculations

2015-04-29 Thread Sergey Sharybin
Commit: e5f3193df30edbdcbc7111c1e3b9ccf7aa6ddfe2
Author: Sergey Sharybin
Date:   Thu Apr 30 01:07:38 2015 +0500
Branches: master
https://developer.blender.org/rBe5f3193df30edbdcbc7111c1e3b9ccf7aa6ddfe2

Cycles: Fix wrong order in object flags calculations

Object flags are depending on bounding box which is only available after
mesh synchronization.

This was broken since 7fd4c44 which happened quite close to the release
and oddly enough was not sopped by anyone. Render test is coming for this.

Was spotted by Thomas Dinges while working on another patch.

===

M   intern/cycles/render/scene.cpp

===

diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index 71741c0..19d715d 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -180,13 +180,13 @@ void Scene::device_update(Device *device_, Progress& 
progress)
 
if(progress.get_cancel() || device->have_error()) return;
 
-   progress.set_status("Updating Objects Flags");
-   object_manager->device_update_flags(device, &dscene, this, progress);
+   progress.set_status("Updating Meshes");
+   mesh_manager->device_update(device, &dscene, this, progress);
 
if(progress.get_cancel() || device->have_error()) return;
 
-   progress.set_status("Updating Meshes");
-   mesh_manager->device_update(device, &dscene, this, progress);
+   progress.set_status("Updating Objects Flags");
+   object_manager->device_update_flags(device, &dscene, this, progress);
 
if(progress.get_cancel() || device->have_error()) return;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [55174ae] ui-preview-buttons: Merge branch 'master' into ui-preview-buttons

2015-04-29 Thread Bastien Montagne
Commit: 55174aec8bd5af291e860398d1524ea0a265d7a7
Author: Bastien Montagne
Date:   Wed Apr 29 21:39:45 2015 +0200
Branches: ui-preview-buttons
https://developer.blender.org/rB55174aec8bd5af291e860398d1524ea0a265d7a7

Merge branch 'master' into ui-preview-buttons

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a8cdd9d] gooseberry: Merge branch 'master' into gooseberry

2015-04-29 Thread Lukas Tönne
Commit: a8cdd9dda72e20bcac7c16d236abd4d98e65147f
Author: Lukas Tönne
Date:   Wed Apr 29 21:41:02 2015 +0200
Branches: gooseberry
https://developer.blender.org/rBa8cdd9dda72e20bcac7c16d236abd4d98e65147f

Merge branch 'master' into gooseberry

Conflicts:
source/blender/blenloader/intern/versioning_270.c

===



===

diff --cc source/blender/blenloader/intern/versioning_270.c
index f2f4b65,2343ba0..44cc6b1
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@@ -972,34 -800,27 +972,58 @@@ void blo_do_versions_270(FileData *fd, 
}
}
  
 +  if (!DNA_struct_elem_find(fd->filesdna, "SmokeDomainSettings", "float", 
"display_thickness")) {
 +  Object *ob;
 +  ModifierData *md;
 +  for (ob = main->object.first; ob; ob = ob->id.next) {
 +  for (md = ob->modifiers.first; md; md = md->next) {
 +  if (md->type == eModifierType_Smoke) {
 +  SmokeModifierData *smd = 
(SmokeModifierData *)md;
 +  if (smd->domain) {
 +  smd->domain->display_thickness 
= 1.0f;
 +  }
 +  }
 +  }
 +  }
 +  }
 +  if (!DNA_struct_elem_find(fd->filesdna, "SpaceIpo", "float", 
"backdrop_zoom")) {
 +  bScreen *sc;
 +  for (sc = main->screen.first; sc; sc = sc->id.next) {
 +  ScrArea *sa;
 +  for (sa = sc->areabase.first; sa; sa = sa->next) {
 +  SpaceLink *sl;
 +  for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
 +  if (sl->spacetype == SPACE_IPO) {
 +  SpaceIpo *sipo = (SpaceIpo *)sl;
 +  sipo->backdrop_zoom = 1.0f;
 +  sipo->backdrop_opacity = 0.7f;
 +  }
 +  }
 +  }
 +  }
 +  }
++
+   if (!MAIN_VERSION_ATLEAST(main, 274, 6)) {
+   bScreen *screen;
+ 
+   if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", 
"int", "thumbnails_size")) {
+   for (screen = main->screen.first; screen; screen = 
screen->id.next) {
+   ScrArea *sa;
+ 
+   for (sa = screen->areabase.first; sa; sa = 
sa->next) {
+   SpaceLink *sl;
+ 
+   for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
+   if (sl->spacetype == 
SPACE_FILE) {
+   SpaceFile *sfile = 
(SpaceFile *)sl;
+ 
+   if (sfile->params) {
+   
sfile->params->thumbnails_size = 128;
+   }
+   }
+   }
+   }
+   }
+   }
+   }
  }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3856d43] master: Fix filename has "new render view" suffix reported by Jason van Gumster (Fweeb)

2015-04-29 Thread Dalai Felinto
Commit: 3856d439db2d4c4f39ed5a06f185ff3d27e126a9
Author: Dalai Felinto
Date:   Wed Apr 29 16:35:19 2015 -0300
Branches: master
https://developer.blender.org/rB3856d439db2d4c4f39ed5a06f185ff3d27e126a9

Fix filename has "new render view" suffix reported by Jason van Gumster (Fweeb)

Bug introduced in f8540d7fd5a47bc9d1d676d50de379c71637

===

M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/render/intern/source/render_result.c 
b/source/blender/render/intern/source/render_result.c
index 2baf445..4b5c6e5 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -936,7 +936,7 @@ void render_result_views_new(RenderResult *rr, RenderData 
*rd)
 
/* we always need at least one view */
if (BLI_listbase_count_ex(&rr->views, 1) == 0) {
-   render_result_view_new(rr, "new render view");
+   render_result_view_new(rr, "");
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [054aa61] master: File browser - change thumbnails size with a slider

2015-04-29 Thread Bastien Montagne
Commit: 054aa61f3c9af0997cbb0ecf89f73227723a24cd
Author: Bastien Montagne
Date:   Wed Apr 29 21:25:34 2015 +0200
Branches: master
https://developer.blender.org/rB054aa61f3c9af0997cbb0ecf89f73227723a24cd

File browser - change thumbnails size with a slider

We can now scale from 32px up to 256px (default has been upgraded to 128px).
Thumbnails are now generated as 'large', i.e. 256px.

Previews are scaled up if necessary, unlike icons (for folders or files without 
preview images).

Note that .blend thumbnails themselves remain in 128px for now (they are 
embeded in .blend files,
not quite sure we want to make them four times bigger...).

Patch by DMS (Yaron Dames), with final edits by myself.

Reviewers: mont29

Subscribers: Severin, mont29

Differential Revision: https://developer.blender.org/D1260

===

M   release/scripts/startup/bl_ui/space_filebrowser.py
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/space_file/file_draw.c
M   source/blender/editors/space_file/filelist.c
M   source/blender/editors/space_file/filesel.c
M   source/blender/imbuf/intern/thumbs.c
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py 
b/release/scripts/startup/bl_ui/space_filebrowser.py
index 8acf8cf..5da660f 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -53,6 +53,10 @@ class FILEBROWSER_HT_header(Header):
 # can be None when save/reload with a file selector open
 if params:
 layout.prop(params, "display_type", expand=True, text="")
+
+if params.display_type == 'FILE_IMGDISPLAY':
+layout.prop(params, "thumbnails_size")
+
 layout.prop(params, "sort_method", expand=True, text="")
 
 layout.prop(params, "show_hidden", text="", icon='FILE_HIDDEN')
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index c886287..2343ba0 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -799,4 +799,28 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
}
}
}
+
+   if (!MAIN_VERSION_ATLEAST(main, 274, 6)) {
+   bScreen *screen;
+
+   if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", 
"int", "thumbnails_size")) {
+   for (screen = main->screen.first; screen; screen = 
screen->id.next) {
+   ScrArea *sa;
+
+   for (sa = screen->areabase.first; sa; sa = 
sa->next) {
+   SpaceLink *sl;
+
+   for (sl = sa->spacedata.first; sl; sl = 
sl->next) {
+   if (sl->spacetype == 
SPACE_FILE) {
+   SpaceFile *sfile = 
(SpaceFile *)sl;
+
+   if (sfile->params) {
+   
sfile->params->thumbnails_size = 128;
+   }
+   }
+   }
+   }
+   }
+   }
+   }
 }
diff --git a/source/blender/editors/space_file/file_draw.c 
b/source/blender/editors/space_file/file_draw.c
index 9763efb..d5b9c16 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -329,6 +329,7 @@ static void file_draw_preview(uiBlock *block, struct 
direntry *file, int sx, int
float fx, fy;
float dx, dy;
int xco, yco;
+   float ui_imbx, ui_imby;
float scaledx, scaledy;
float scale;
int ex, ey;
@@ -336,23 +337,26 @@ static void file_draw_preview(uiBlock *block, struct 
direntry *file, int sx, int
 
BLI_assert(imb != NULL);
 
-   if ((imb->x * UI_DPI_FAC > layout->prv_w) ||
-   (imb->y * UI_DPI_FAC > layout->prv_h))
+   ui_imbx = imb->x * UI_DPI_FAC;
+   ui_imby = imb->y * UI_DPI_FAC;
+   /* Unlike thumbnails, icons are not scaled up. */
+   if (((ui_imbx > layout->prv_w) || (ui_imby > layout->prv_h)) ||
+   (!is_icon && ((ui_imbx < layout->prv_w) || (ui_imby < 
layout->prv_h
{
if (imb->x > imb->y) {
scaledx = (float)layout->prv_w;
-   scaledy =  ( (float)imb->y / (float)imb->x) * 
layout->prv_w;
+   scaledy = ((float)imb->y / (float)i

[Bf-blender-cvs] [3de45ee] master: Fix T44132: Crash after open EXR format

2015-04-29 Thread Sergey Sharybin
Commit: 3de45ee7fe451ab4267b824a569a2173660d2575
Author: Sergey Sharybin
Date:   Wed Apr 29 23:44:57 2015 +0500
Branches: master
https://developer.blender.org/rB3de45ee7fe451ab4267b824a569a2173660d2575

Fix T44132: Crash after open EXR format

Was own mistake on adding Alpha socket for Combined pass.

===

M   source/blender/compositor/nodes/COM_ImageNode.cpp
M   source/blender/nodes/composite/nodes/node_composite_image.c

===

diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp 
b/source/blender/compositor/nodes/COM_ImageNode.cpp
index fdd7503..572e63a 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -79,7 +79,6 @@ void ImageNode::convertToOperations(NodeConverter &converter, 
const CompositorCo
int numberOfOutputs = this->getNumberOfOutputSockets();
bool outputStraightAlpha = (editorNode->custom1 & 
CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0;
BKE_image_user_frame_calc(imageuser, context.getFramenumber(), 0);
-   NodeOperation *combined_operation = NULL;
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
@@ -124,44 +123,40 @@ void ImageNode::convertToOperations(NodeConverter 
&converter, const CompositorCo
}
}
 
-   if (STREQ(bnodeSocket->identifier, 
"Alpha")) {
-   BLI_assert(combined_operation 
!= NULL);
-   NodeOutput *outputSocket = 
this->getOutputSocket(index);
-   SeparateChannelOperation 
*separate_operation;
-   separate_operation = new 
SeparateChannelOperation();
-   
separate_operation->setChannel(3);
-   
converter.addOperation(separate_operation);
-   
converter.addLink(combined_operation->getOutputSocket(), 
separate_operation->getInputSocket(0));
-   
converter.mapOutputSocket(outputSocket, separate_operation->getOutputSocket());
-   operation = separate_operation;
-   }
-   else {
-   if (rpass) {
-   switch 
(rpass->channels) {
-   case 1:
-   
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-   
  rpass->passtype, view, COM_DT_VALUE);
-   break;
-   /* 
using image operations for both 3 and 4 channels (RGB and RGBA respectively) */
-   /* XXX 
any way to detect actual vector images? */
-   case 3:
-   
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-   
  rpass->passtype, view, COM_DT_VECTOR);
-   break;
-   case 4:
-   
operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, 
index,
-   
  rpass->passtype, view, COM_DT_COLOR);
-   break;
-   default:
-   /* 
dummy operation is added below */
-   break;
-   }
-   if (index == 0 && 
operation) {
-   
converter.addPreview(operation->getOutputSocket());
-   

[Bf-blender-cvs] [ce32aae] master: OSX: fix T44533, system_bookmarks not showing utf standard ( umlauts etc. )

2015-04-29 Thread Jens Verwiebe
Commit: ce32aae80c5c00ec33a86528a93809c66f819c5c
Author: Jens Verwiebe
Date:   Wed Apr 29 20:07:38 2015 +0200
Branches: master
https://developer.blender.org/rBce32aae80c5c00ec33a86528a93809c66f819c5c

OSX: fix T44533, system_bookmarks not showing utf standard ( umlauts etc. )

===

M   source/blender/editors/space_file/fsmenu.c

===

diff --git a/source/blender/editors/space_file/fsmenu.c 
b/source/blender/editors/space_file/fsmenu.c
index c6ee687..fdf7b45 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -565,7 +565,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int 
read_bookmarks)

pathString = CFURLCopyFileSystemPath(cfURL, 
kCFURLPOSIXPathStyle);

-   if (pathString == NULL || 
!CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingASCII))
+   if (pathString == NULL || 
!CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8))
continue;
 
/* Exclude "all my files" as it makes no sense 
in blender fileselector */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3878180] master: Fix typo using interp_v3_v3v3 over float[2] variables...

2015-04-29 Thread Bastien Montagne
Commit: 3878180a6fa3db7aaec7bb6efb4fbfdff04306f6
Author: Bastien Montagne
Date:   Wed Apr 29 19:38:19 2015 +0200
Branches: master
https://developer.blender.org/rB3878180a6fa3db7aaec7bb6efb4fbfdff04306f6

Fix typo using interp_v3_v3v3 over float[2] variables...

Found by asan! ;)

===

M   source/blender/editors/mesh/editmesh_select.c

===

diff --git a/source/blender/editors/mesh/editmesh_select.c 
b/source/blender/editors/mesh/editmesh_select.c
index be3cb1c..4ce493d 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -559,7 +559,7 @@ static void find_nearest_edge__doClosest(
copy_v2_v2(screen_co, screen_co_b);
}
else {
-   interp_v3_v3v3(screen_co, screen_co_a, screen_co_b, fac);
+   interp_v2_v2v2(screen_co, screen_co_a, screen_co_b, fac);
}
 
dist_test = dist_test_bias = len_manhattan_v2v2(data->mval_fl, 
screen_co);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5782126] master: Make sure integer calculation uses large precision

2015-04-29 Thread Antony Riakiotakis
Commit: 5782126d41a9ea7c12896752996fc21fd5be8e7b
Author: Antony Riakiotakis
Date:   Wed Apr 29 18:49:38 2015 +0200
Branches: master
https://developer.blender.org/rB5782126d41a9ea7c12896752996fc21fd5be8e7b

Make sure integer calculation uses large precision

===

M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/render/intern/source/render_result.c 
b/source/blender/render/intern/source/render_result.c
index c8ca110..2baf445 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -486,7 +486,7 @@ static RenderPass *render_layer_add_pass(RenderResult *rr, 
RenderLayer *rl, int
const size_t view_id = BLI_findstringindex(&rr->views, viewname, 
offsetof(RenderView, name));
const char *typestr = name_from_passtype(passtype, -1);
RenderPass *rpass = MEM_callocN(sizeof(RenderPass), typestr);
-   size_t rectsize = rr->rectx * rr->recty * channels;
+   size_t rectsize = ((size_t)rr->rectx) * ((size_t)rr->recty) * 
((size_t)channels);

BLI_addtail(&rl->passes, rpass);
rpass->passtype = passtype;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [20c4b0d] gooseberry: Merge branch 'master' into gooseberry

2015-04-29 Thread Antony Riakiotakis
Commit: 20c4b0d4a259ac465fb108a8c2028a23ee2c39a0
Author: Antony Riakiotakis
Date:   Wed Apr 29 18:50:19 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB20c4b0d4a259ac465fb108a8c2028a23ee2c39a0

Merge branch 'master' into gooseberry

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d04ba6d] master: Remove unused stubs

2015-04-29 Thread Sergey Sharybin
Commit: d04ba6d56245e28c70b56c5458dc9f16b6c0e278
Author: Sergey Sharybin
Date:   Wed Apr 29 21:47:30 2015 +0500
Branches: master
https://developer.blender.org/rBd04ba6d56245e28c70b56c5458dc9f16b6c0e278

Remove unused stubs

Noticed by TristanPorteries in IRC.

===

M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c 
b/source/blenderplayer/bad_level_call_stubs/stubs.c
index f8a4215..08d01a9 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -227,8 +227,6 @@ struct RenderLayer *RE_GetRenderLayer(struct RenderResult 
*rr, const char *name)
 void RE_init_texture_rng() RET_NONE
 void RE_exit_texture_rng() RET_NONE
 
-float *RE_RenderViewGetRectf(struct RenderResult *rr, int view_id) 
{STUB_ASSERT(0); return (float *) NULL;}
-float *RE_RenderViewGetRectz(struct RenderResult *rr, int view_id) 
{STUB_ASSERT(0); return (float *) NULL;}
 bool RE_layers_have_name(struct RenderResult *result) {STUB_ASSERT(0); return 
0;}
 void RE_engine_active_view_set(struct RenderEngine *engine, const char 
*viewname) {STUB_ASSERT(0);}
 void RE_engine_get_camera_model_matrix(struct RenderEngine *engine, struct 
Object *camera, float *r_modelmat) {STUB_ASSERT(0);}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0dbc906] master: Cleanup: make grumpy asan happy and do not use `new []` to allocate data freed by `free()`.

2015-04-29 Thread Bastien Montagne
Commit: 0dbc9060a69e4d64a01a6fefdabb78acc32fab95
Author: Bastien Montagne
Date:   Wed Apr 29 17:46:03 2015 +0200
Branches: master
https://developer.blender.org/rB0dbc9060a69e4d64a01a6fefdabb78acc32fab95

Cleanup: make grumpy asan happy and do not use `new []` to allocate data freed 
by `free()`.

Probably nothing crucial, but asan build would crash on that stupid glitch... 
Annoying.

===

M   source/blender/imbuf/intern/dds/DirectDrawSurface.cpp

===

diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp 
b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 15c8d86..6bf8277 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -60,6 +60,7 @@
 #include 
 
 #include  // printf
+#include   // malloc
 #include   // sqrt
 #include 
 
@@ -1147,7 +1148,7 @@ void* DirectDrawSurface::readData(uint &rsize)
uint size = stream.size - header_size;
rsize = size;
 
-   unsigned char *data = new unsigned char[size];
+   unsigned char *data = (unsigned char *)malloc(sizeof(*data) * size);
 
stream.seek(header_size);
mem_read(stream, data, size);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b6760b6] ui-preview-buttons: Merge branch 'master' into ui-preview-buttons

2015-04-29 Thread Ines Almeida
Commit: b6760b6ac5d0bbcb18dbea19a0b7afa778883cd3
Author: Ines Almeida
Date:   Wed Apr 29 16:30:48 2015 +0100
Branches: ui-preview-buttons
https://developer.blender.org/rBb6760b6ac5d0bbcb18dbea19a0b7afa778883cd3

Merge branch 'master' into ui-preview-buttons

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [091832c] master: fix for double call to update callback in uiTemplateIconView

2015-04-29 Thread Ines Almeida
Commit: 091832c955992ecd8fff6d88028075775e4b4e8e
Author: Ines Almeida
Date:   Wed Apr 29 16:25:54 2015 +0100
Branches: master
https://developer.blender.org/rB091832c955992ecd8fff6d88028075775e4b4e8e

fix for double call to update callback in uiTemplateIconView

===

M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 66de859..8d2ee04 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1697,14 +1697,11 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA 
*ptr, const char *propname)
cb->ptr = *ptr;
cb->prop = prop;
 
-   but = uiDefBlockButN(block, ui_icon_view_menu_cb, MEM_dupallocN(cb), 
"", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
+   but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb, "", 0, 0, 
UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
 
but->icon = icon;
UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
-   
-   UI_but_funcN_set(but, rna_update_cb, MEM_dupallocN(cb), NULL);
-   
-   MEM_freeN(cb);
+
if (free_items) {
MEM_freeN(items);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [611bbc6] master: cleanup for uiTemplateIconView

2015-04-29 Thread Ines Almeida
Commit: 611bbc696afe58d2ab1b92c2a7578233606aefab
Author: Ines Almeida
Date:   Wed Apr 29 16:22:04 2015 +0100
Branches: master
https://developer.blender.org/rB611bbc696afe58d2ab1b92c2a7578233606aefab

cleanup for uiTemplateIconView

===

M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index d333ab9..66de859 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1641,10 +1641,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, 
ARegion *ar, void *arg_litem)
 
/* arg_litem is malloced, can be freed by parent button */
cb = *((RNAUpdateCb *)arg_litem);
-   
-   /* unused */
-   // icon = RNA_property_enum_get(&cb.ptr, cb.prop);
-   
+
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP);

@@ -1682,12 +1679,13 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA 
*ptr, const char *propname)
EnumPropertyItem *items;
uiBlock *block;
uiBut *but;
-// rctf rect;  /* UNUSED */
int value, icon = ICON_NONE, tot_items;
bool free_items;
-   
-   if (!prop || RNA_property_type(prop) != PROP_ENUM)
+
+   if (!prop || RNA_property_type(prop) != PROP_ENUM) {
+   RNA_warning("property of type Enum not found: %s.%s", 
RNA_struct_identifier(ptr->type), propname);
return;
+   }
 
block = uiLayoutAbsoluteBlock(layout);
 
@@ -1698,15 +1696,9 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA 
*ptr, const char *propname)
cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr = *ptr;
cb->prop = prop;
-   
-// rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
-// rect.ymin = 0; rect.ymax = 10.0f * UI_UNIT_X;
-   
+
but = uiDefBlockButN(block, ui_icon_view_menu_cb, MEM_dupallocN(cb), 
"", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, "");
 
-   
-// but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, 
BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect), ptr, prop, -1, 0, icon, -1, -1, 
NULL);
-   
but->icon = icon;
UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [78956b6] master: Fix T44542: 'extend selection' editmode tool would select hidden elements.

2015-04-29 Thread Bastien Montagne
Commit: 78956b6a83f2b5b3011fcfee7715b563c4c8b1bd
Author: Bastien Montagne
Date:   Wed Apr 29 17:14:40 2015 +0200
Branches: master
https://developer.blender.org/rB78956b6a83f2b5b3011fcfee7715b563c4c8b1bd

Fix T44542: 'extend selection' editmode tool would select hidden elements.

===

M   source/blender/bmesh/operators/bmo_utils.c

===

diff --git a/source/blender/bmesh/operators/bmo_utils.c 
b/source/blender/bmesh/operators/bmo_utils.c
index da1991a..964d0b1 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -208,7 +208,7 @@ static void bmo_region_extend_expand(
BMEdge *e;
 
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-   if (!BMO_elem_flag_test(bm, e, 
SEL_ORIG)) {
+   if (!BMO_elem_flag_test(bm, e, 
SEL_ORIG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
found = true;
break;
}
@@ -221,7 +221,7 @@ static void bmo_region_extend_expand(
BMEdge *e;
 
BM_ITER_ELEM (e, &eiter, v, 
BM_EDGES_OF_VERT) {
-   if (!BMO_elem_flag_test(bm, e, 
SEL_FLAG)) {
+   if (!BMO_elem_flag_test(bm, e, 
SEL_FLAG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {

BMO_elem_flag_enable(bm, e, SEL_FLAG);

BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
}
@@ -232,7 +232,7 @@ static void bmo_region_extend_expand(
BMFace *f;
 
BM_ITER_ELEM (f, &fiter, v, 
BM_FACES_OF_VERT) {
-   if (!BMO_elem_flag_test(bm, f, 
SEL_FLAG)) {
+   if (!BMO_elem_flag_test(bm, f, 
SEL_FLAG) && !BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {

bmo_face_flag_set_flush(bm, f, SEL_FLAG, true);
}
}
@@ -243,7 +243,7 @@ static void bmo_region_extend_expand(
BMEdge *e;
BM_ITER_ELEM (e, &eiter, v, 
BM_EDGES_OF_VERT) {
if (BM_edge_is_wire(e)) 
{
-   if 
(!BMO_elem_flag_test(bm, e, SEL_FLAG)) {
+   if 
(!BMO_elem_flag_test(bm, e, SEL_FLAG) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) 
{

BMO_elem_flag_enable(bm, e, SEL_FLAG);

BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
}
@@ -267,7 +267,9 @@ static void bmo_region_extend_expand(
BMFace *f_other;
 
BM_ITER_ELEM (f_other, &fiter, l->e, 
BM_FACES_OF_EDGE) {
-   if (!BMO_elem_flag_test(bm, 
f_other, SEL_ORIG | SEL_FLAG)) {
+   if (!BMO_elem_flag_test(bm, 
f_other, SEL_ORIG | SEL_FLAG) &&
+   !BM_elem_flag_test(f_other, 
BM_ELEM_HIDDEN))
+   {

BMO_elem_flag_enable(bm, f_other, SEL_FLAG);
}
}
@@ -277,7 +279,9 @@ static void bmo_region_extend_expand(
BMFace *f_other;
 
BM_ITER_ELEM (f_other, &fiter, l->v, 
BM_FACES_OF_VERT) {
-   if (!BMO_elem_flag_test(bm, 
f_other, SEL_ORIG | SEL_FLAG)) {
+   if (!BMO_elem_flag_test(bm, 
f_other, SEL_ORIG | SEL_FLAG) &&
+   !BM_elem_flag_test(f_other, 
BM_ELEM_HIDDEN))
+   {

BMO_elem_flag_enable(bm, f_other, SEL_FLAG);
}
}

_

[Bf-blender-cvs] [3e6a66b] master: Multi-View cleanup: using RenderResult->rect* only for temporary RenderResults

2015-04-29 Thread Dalai Felinto
Commit: 3e6a66b9dee4e0b034a1de83fbd242191858a7df
Author: Dalai Felinto
Date:   Wed Apr 29 11:26:30 2015 -0300
Branches: master
https://developer.blender.org/rB3e6a66b9dee4e0b034a1de83fbd242191858a7df

Multi-View cleanup: using RenderResult->rect* only for temporary RenderResults

Originally I wanted to get rid of RenderResult->rect* entirely, but it's
convenient to have for temporary structs.

This patch makes sure they are used only when really needed, which
should help clearing the code out.

(they are needed when using RE_AcquireResultImage() - which produces a
RenderResult with no RenderView)

Reviewers: sergey

Differential Revision: https://developer.blender.org/D1270

===

M   source/blender/blenkernel/intern/image.c
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/render/render_opengl.c
M   source/blender/editors/render/render_preview.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 162f453..eceb5c4 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -3554,7 +3554,7 @@ static ImBuf *image_get_render_result(Image *ima, 
ImageUser *iuser, void **lock_
}
else if (ima->renders[ima->render_slot]) {
rres = *(ima->renders[ima->render_slot]);
-   rres.have_combined = RE_RenderViewGetRectf(&rres, actview) != 
NULL;
+   rres.have_combined = ((RenderView *)rres.views.first)->rectf != 
NULL;
}
else
memset(&rres, 0, sizeof(RenderResult));
diff --git a/source/blender/editors/render/render_internal.c 
b/source/blender/editors/render/render_internal.c
index 2f27912..2ba1e61 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -189,11 +189,15 @@ static void image_buffer_rect_update(RenderJob *rj, 
RenderResult *rr, ImBuf *ibu
 */
/* TODO(sergey): Need to check has_combined here? */
if (iuser->passtype == SCE_PASS_COMBINED) {
+   RenderView *rv;
size_t view_id = BKE_scene_multiview_view_id_get(&scene->r, 
viewname);
+   rv = RE_RenderViewGetById(rr, view_id);
+
/* find current float rect for display, first case is after 
composite... still weak */
-   rectf = RE_RenderViewGetRectf(rr, view_id);
-   if (rectf == NULL) {
-   if (RE_RenderViewGetRect32(rr, view_id)) {
+   if (rv->rectf)
+   rectf = rv->rectf;
+   else {
+   if (rv->rect32) {
/* special case, currently only happens with 
sequencer rendering,
 * which updates the whole frame, so we can 
only mark display buffer
 * as invalid here (sergey)
diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index 164f5f4..7fbdf9d 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -248,7 +248,7 @@ static void screen_opengl_render_doit(OGLRender *oglrender, 
RenderResult *rr)
Object *camera = NULL;
ImBuf *ibuf;
float winmat[4][4];
-   float *rectf = RE_RenderViewGetRectf(rr, oglrender->view_id);
+   float *rectf = RE_RenderViewGetById(rr, oglrender->view_id)->rectf;
int sizex = oglrender->sizex;
int sizey = oglrender->sizey;
const short view_context = (v3d != NULL);
@@ -446,8 +446,8 @@ static void screen_opengl_render_doit(OGLRender *oglrender, 
RenderResult *rr)
 
if (rect) {
int profile_to;
-   float *rectf = RE_RenderViewGetRectf(rr, oglrender->view_id);
-   
+   float *rectf = RE_RenderViewGetById(rr, 
oglrender->view_id)->rectf;
+
if (BKE_scene_check_color_management_enabled(scene))
profile_to = IB_PROFILE_LINEAR_RGB;
else
diff --git a/source/blender/editors/render/render_preview.c 
b/source/blender/editors/render/render_preview.c
index e6fbfda..2c353c1 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -525,6 +525,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, 
int id_type, ShaderPre
 static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti 
*rect, rcti *newrect)
 {
Render *re;
+   RenderView *rv;
RenderResult rres;
cha

[Bf-blender-cvs] [1c9985e] gooseberry: Gooseberry: Fix crash of backdrop widget in graph space

2015-04-29 Thread Sergey Sharybin
Commit: 1c9985e01516d0b0057313795d9646f7223524e0
Author: Sergey Sharybin
Date:   Wed Apr 29 19:30:26 2015 +0500
Branches: gooseberry
https://developer.blender.org/rB1c9985e01516d0b0057313795d9646f7223524e0

Gooseberry: Fix crash of backdrop widget in graph space

This fix should actually happen in wiggly-widgets branch but it's now
has some commits which are not in gooseberry and merging them night
be not really safe.

===

M   source/blender/editors/space_graph/graph_edit.c

===

diff --git a/source/blender/editors/space_graph/graph_edit.c 
b/source/blender/editors/space_graph/graph_edit.c
index f5b130e..74466a7 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2500,7 +2500,8 @@ static int graph_widget_backdrop_transform_poll(bContext 
*C)
SpaceIpo *sipo = CTX_wm_space_graph(C);
ARegion *ar = CTX_wm_region(C);
 
-   return ((ar->type->regionid == RGN_TYPE_WINDOW) &&
+   return ((sipo != NULL) &&
+   (ar->type->regionid == RGN_TYPE_WINDOW) &&
(sipo->flag & SIPO_DRAW_BACKDROP) &&
(sipo->backdrop_camera));
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [18ba32d] master: Don't check against scene notifier twice

2015-04-29 Thread Antony Riakiotakis
Commit: 18ba32df37aa84d0a7c884bd1945772df0d9c59f
Author: Antony Riakiotakis
Date:   Wed Apr 29 16:28:20 2015 +0200
Branches: master
https://developer.blender.org/rB18ba32df37aa84d0a7c884bd1945772df0d9c59f

Don't check against scene notifier twice

===

M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 830feed..e2b8598 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -293,7 +293,7 @@ void wm_event_do_notifiers(bContext *C)
do_anim = true;
}
}
-   if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, 
NC_SCENE, NC_WM)) {
+   if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, 
NC_WM)) {
ED_info_stats_clear(win->screen->scene);
WM_event_add_notifier(C, NC_SPACE | 
ND_SPACE_INFO, NULL);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [303e9b4] gooseberry: Fix really stupid own mistake that caused leakage of timers.

2015-04-29 Thread Antony Riakiotakis
Commit: 303e9b4032fcd4f7d1ebf6decdb906189e4b7bcc
Author: Antony Riakiotakis
Date:   Wed Apr 29 16:20:38 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB303e9b4032fcd4f7d1ebf6decdb906189e4b7bcc

Fix really stupid own mistake that caused leakage of timers.

===

M   source/blender/editors/animation/anim_ops.c

===

diff --git a/source/blender/editors/animation/anim_ops.c 
b/source/blender/editors/animation/anim_ops.c
index 82dff14..efcc707 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -215,7 +215,7 @@ static void change_frame_seq_preview_end(bContext *C, 
wmOperator *op)
 
if (op->customdata) {
ChangeFrameData *data = op->customdata;
-   WM_event_remove_timer(wm, win, op->customdata);
+   WM_event_remove_timer(wm, win, data->timer);
MEM_freeN(data);
op->customdata = NULL;
}
@@ -234,7 +234,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, 
const wmEvent *event
Scene *scene = CTX_data_scene(C);
ChangeFrameData *data = MEM_callocN(sizeof(ChangeFrameData), 
"changeframedata");
 
-   data->timer = WM_event_add_timer(wm, win, TIMER, (1.0 / FPS));
+   data->timer = WM_event_add_timer(wm, win, TIMER, FRA2TIME(1.0));
 
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b033736] master: Multi-View: new util functions RE_RenderViewGetById() and RE_RenderViewGetByName()

2015-04-29 Thread Dalai Felinto
Commit: b033736eb7ea65d47bc3cb13605df176c490efe1
Author: Dalai Felinto
Date:   Wed Apr 29 11:18:18 2015 -0300
Branches: master
https://developer.blender.org/rBb033736eb7ea65d47bc3cb13605df176c490efe1

Multi-View: new util functions RE_RenderViewGetById() and 
RE_RenderViewGetByName()

Both functions try to find a valid RenderView and if they can't they
fallback to the first RenderView of the RenderResult

===

M   source/blender/compositor/operations/COM_CompositorOperation.cpp
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp 
b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index eacbdf9..76f74c1 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -82,7 +82,7 @@ void CompositorOperation::deinitExecution()
RenderResult *rr = RE_AcquireResultWrite(re);
 
if (rr) {
-   RenderView *rv = (RenderView 
*)BLI_findstring(&rr->views, this->m_viewName, offsetof(RenderView, name));
+   RenderView *rv = RE_RenderViewGetByName(rr, 
this->m_viewName);
 
if (rv->rectf != NULL) {
MEM_freeN(rv->rectf);
diff --git a/source/blender/render/extern/include/RE_pipeline.h 
b/source/blender/render/extern/include/RE_pipeline.h
index 39e17c2..2c3ad74 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -354,6 +354,8 @@ bool RE_allow_render_generic_object(struct Object *ob);
 bool RE_HasFakeLayer(RenderResult *res);
 bool RE_RenderResult_is_stereo(RenderResult *res);
 
+struct RenderView *RE_RenderViewGetById(struct RenderResult *res, const int 
view_id);
+struct RenderView *RE_RenderViewGetByName(struct RenderResult *res, const char 
*viewname);
 float *RE_RenderViewGetRectf(struct RenderResult *rr, const int view_id);
 float *RE_RenderViewGetRectz(struct RenderResult *rr, const int view_id);
 int   *RE_RenderViewGetRect32(struct RenderResult *rr, const int view_id);
diff --git a/source/blender/render/intern/source/pipeline.c 
b/source/blender/render/intern/source/pipeline.c
index 7206c21..c26a74f 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -395,9 +395,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr, 
const int view_id)
rr->recty = re->result->recty;

/* actview view */
-   rv = BLI_findlink(&re->result->views, view_id);
-   if (rv == NULL)
-   rv = (RenderView *)re->result->views.first;
+   rv = RE_RenderViewGetById(re->result, view_id);
 
rr->rectf =  rv ? rv->rectf  : NULL;
rr->rectz =  rv ? rv->rectz  : NULL;
@@ -2287,7 +2285,7 @@ static void do_merge_fullsample(Render *re, bNodeTree 
*ntree)
 
/* store the final result */
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
-   rv = BLI_findlink(&re->result->views, nr);
+   rv = RE_RenderViewGetById(re->result, nr);
if (rv->rectf)
MEM_freeN(rv->rectf);
rv->rectf = rectf;
@@ -2571,7 +2569,7 @@ static void do_render_seq(Render *re)
BLI_rw_mutex_unlock(&re->resultmutex);
 
for (view_id = 0; view_id < tot_views; view_id++) {
-   RenderView *rv = BLI_findlink(&rr->views, view_id);
+   RenderView *rv = RE_RenderViewGetById(rr, view_id);
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 
if (ibuf_arr[view_id]) {
diff --git a/source/blender/render/intern/source/render_result.c 
b/source/blender/render/intern/source/render_result.c
index f3a8dfd..1668b11 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1507,7 +1507,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, 
RenderData *rd, const int vi
 
 void render_result_rect_from_ibuf(RenderResult *rr, RenderData *UNUSED(rd), 
ImBuf *ibuf, const int view_id)
 {
-   RenderView *rv = BLI_findlink(&rr->views, view_id);
+   RenderView *rv = RE_RenderViewGetById(rr, view_id);
 
if (ibuf->rect_float) {
if (!rv->rectf)
@@ -1536,7 +1536,7 @@ void render_result_rect_from_ibuf(RenderResult *rr, 
RenderData *UNUSED(rd), ImBu
 
 void render_result_rect_fill_zero(RenderResult *rr, const int view_id)
 {
-   Render

[Bf-blender-cvs] [3acc1ba] master: Add macro BLI_SMALLSTACK_AS_TABLE

2015-04-29 Thread Campbell Barton
Commit: 3acc1ba49c95786841608c0b516a7fd0879bad76
Author: Campbell Barton
Date:   Wed Apr 29 23:54:32 2015 +1000
Branches: master
https://developer.blender.org/rB3acc1ba49c95786841608c0b516a7fd0879bad76

Add macro BLI_SMALLSTACK_AS_TABLE

Use for edge-split (a little less overhead compare to popping each item).

===

M   source/blender/blenlib/BLI_linklist_stack.h
M   source/blender/bmesh/intern/bmesh_core.c

===

diff --git a/source/blender/blenlib/BLI_linklist_stack.h 
b/source/blender/blenlib/BLI_linklist_stack.h
index 9ac233a..a4b8f77 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -168,6 +168,16 @@
 #define BLI_SMALLSTACK_IS_EMPTY(var) \
((_BLI_SMALLSTACK_CAST(var) _##var##_stack) == NULL)
 
+/* fill in a lookup table */
+#define BLI_SMALLSTACK_AS_TABLE(var, data) \
+{ \
+   LinkNode *_##var##_iter; \
+   unsigned int i; \
+   for (_##var##_iter = _##var##_stack, i = 0; _##var##_iter; 
_##var##_iter = _##var##_iter->next, i++) { \
+   (data)[i] = _BLI_SMALLSTACK_CAST(var) (_##var##_iter->link); \
+   } \
+} ((void)0)
+
 /* loop over stack members last-added-first */
 #define BLI_SMALLSTACK_ITER_BEGIN(var, item) \
{ \
diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 558d41c..3266ee0 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2209,18 +2209,12 @@ void bmesh_vert_separate(
 
if (r_vout != NULL) {
BMVert **verts;
-   int i;
 
verts = MEM_mallocN(sizeof(BMVert *) * verts_num, __func__);
-   verts[0] = v;
-
-   for (i = 1; i < verts_num; i++) {
-   verts[i] = BLI_SMALLSTACK_POP(verts_new);
-   BLI_assert(verts[i] != NULL);
-   }
-   BLI_assert(BLI_SMALLSTACK_POP(verts_new) == NULL);
-
*r_vout = verts;
+
+   verts[0] = v;
+   BLI_SMALLSTACK_AS_TABLE(verts_new, &verts[1]);
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8fdfca6] gooseberry: Merge branch 'master' into gooseberry

2015-04-29 Thread Sergey Sharybin
Commit: 8fdfca67a5748d4cfa1a2f9482ffb826eb7fcda7
Author: Sergey Sharybin
Date:   Wed Apr 29 18:55:16 2015 +0500
Branches: gooseberry
https://developer.blender.org/rB8fdfca67a5748d4cfa1a2f9482ffb826eb7fcda7

Merge branch 'master' into gooseberry

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7e3e624] gooseberry: Tentative fix for flickering particle duplis, when using "pick random" with a dupligroup and distributed rendering.

2015-04-29 Thread Lukas Tönne
Commit: 7e3e6242985df6b1f1cba4534ccc4668ef659680
Author: Lukas Tönne
Date:   Wed Apr 29 15:16:33 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB7e3e6242985df6b1f1cba4534ccc4668ef659680

Tentative fix for flickering particle duplis, when using "pick random"
with a dupligroup and distributed rendering.

The particle duplis were generated using the global RNG (BLI_rand). This
is unstable once scenes become a bit more complex and objects are
evaluated in multiple threads.

This patch is not in master, because it changes the look of existing
particle setups.

===

M   source/blender/blenkernel/intern/object_dupli.c

===

diff --git a/source/blender/blenkernel/intern/object_dupli.c 
b/source/blender/blenkernel/intern/object_dupli.c
index 1574c4a..24a5f7e 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1024,7 +1024,7 @@ static void make_duplis_particle_system(const 
DupliContext *ctx, ParticleSystem
 
/* for groups, pick the object based on 
settings */
if (part->draw & PART_DRAW_RAND_GR)
-   b = BLI_rand() % totgroup;
+   b = (int)(psys_frand(psys, (unsigned 
int)(a + 974)) * (float)totgroup) % totgroup;
else
b = a % totgroup;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9b4912b] alembic: New shrinkwrap modifier for cached hair data.

2015-04-29 Thread Lukas Tönne
Commit: 9b4912ba9eac21db6e3c91b567ac2127829342d9
Author: Lukas Tönne
Date:   Wed Apr 29 14:12:41 2015 +0200
Branches: alembic
https://developer.blender.org/rB9b4912ba9eac21db6e3c91b567ac2127829342d9

New shrinkwrap modifier for cached hair data.

This is experimental. It might work for simple collision-like features,
by keeping goal positions for hair above the mesh surface. However, the
nature of nearest-point lookup on meshes means that the goal position
can flip to the other side of a mesh rapidly, which would lead to
strong forces and unstable behavior.

This code should be seen as an experiment.

===

M   release/scripts/startup/bl_ui/properties_object.py
M   source/blender/blenkernel/BKE_cache_library.h
M   source/blender/blenkernel/intern/cache_library.c
M   source/blender/makesdna/DNA_cache_library_types.h
M   source/blender/makesrna/intern/rna_cache_library.c

===

diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index c3d25f7..64c5c08 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -457,7 +457,7 @@ class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel):
 def HAIR_SIMULATION(self, context, layout, cachelib, md):
 params = md.parameters
 
-col = layout.column()
+col = layout.column(align=True)
 col.prop_search(md, "object", context.blend_data, "objects", 
icon='OBJECT_DATA')
 sub = col.column()
 if (md.object):
@@ -507,6 +507,21 @@ class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel):
 
 layout.prop(md, "use_double_sided")
 
+def SHRINK_WRAP(self, context, layout, cachelib, md):
+col = layout.column(align=True)
+col.prop_search(md, "object", context.blend_data, "objects", 
icon='OBJECT_DATA')
+sub = col.column()
+if (md.object):
+sub.prop_search(md, "hair_system", md.object, "particle_systems")
+else:
+sub.enabled = False
+sub.prop(md, "hair_system")
+
+layout.prop_search(md, "target", context.blend_data, "objects", 
icon='OBJECT_DATA')
+
+layout = layout.column()
+layout.active = md.hair_system is not None
+
 
 
 # Simple human-readable size (based on http://stackoverflow.com/a/1094933)
diff --git a/source/blender/blenkernel/BKE_cache_library.h 
b/source/blender/blenkernel/BKE_cache_library.h
index eb334f3..bc48b60 100644
--- a/source/blender/blenkernel/BKE_cache_library.h
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -49,6 +49,7 @@ struct CacheModifier;
 struct ID;
 struct CacheProcessData;
 struct BVHTreeFromMesh;
+struct Strands;
 
 struct ClothModifierData;
 
@@ -170,6 +171,9 @@ struct CacheModifier *BKE_cache_modifier_copy(struct 
CacheLibrary *cachelib, str
 
 void BKE_cache_modifier_foreachIDLink(struct CacheLibrary *cachelib, struct 
CacheModifier *md, CacheModifier_IDWalkFunc walk, void *userdata);
 
+bool BKE_cache_modifier_find_object(struct DupliCache *dupcache, struct Object 
*ob, struct DupliObjectData **r_data);
+bool BKE_cache_modifier_find_strands(struct DupliCache *dupcache, struct 
Object *ob, int hair_system, struct DupliObjectData **r_data, struct Strands 
**r_strands);
+
 /* = */
 
 typedef struct CacheEffectorInstance {
diff --git a/source/blender/blenkernel/intern/cache_library.c 
b/source/blender/blenkernel/intern/cache_library.c
index b3530ce..fd21635 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -825,7 +825,53 @@ int BKE_cache_effectors_eval(CacheEffector *effectors, int 
tot, CacheEffectorPoi
return applied;
 }
 
-/* - */
+/* = */
+
+bool BKE_cache_modifier_find_object(DupliCache *dupcache, Object *ob, 
DupliObjectData **r_data)
+{
+   DupliObjectData *dobdata;
+   
+   if (!ob)
+   return false;
+   dobdata = BKE_dupli_cache_find_data(dupcache, ob);
+   if (!dobdata)
+   return false;
+   
+   if (r_data) *r_data = dobdata;
+   return true;
+}
+
+bool BKE_cache_modifier_find_strands(DupliCache *dupcache, Object *ob, int 
hair_system, DupliObjectData **r_data, Strands **r_strands)
+{
+   DupliObjectData *dobdata;
+   ParticleSystem *psys;
+   DupliObjectDataStrands *link;
+   Strands *strands;
+   
+   if (!ob)
+   return false;
+   dobdata = BKE_dupli_cache_find_data(dupcache, ob);
+   if (!dobdata)
+   return false;
+   
+   psys = BLI_findlink(&ob->particlesystem, hair_system);
+   

[Bf-blender-cvs] [d6b28bb] master: Cycles: Fix crashes when loading cache created with pre-leaf split builds

2015-04-29 Thread Sergey Sharybin
Commit: d6b28bbb1d61f059ec28156fb275393ee3389d57
Author: Sergey Sharybin
Date:   Wed Apr 29 15:48:49 2015 +0500
Branches: master
https://developer.blender.org/rBd6b28bbb1d61f059ec28156fb275393ee3389d57

Cycles: Fix crashes when loading cache created with pre-leaf split builds

===

M   intern/cycles/util/util_cache.h

===

diff --git a/intern/cycles/util/util_cache.h b/intern/cycles/util/util_cache.h
index 9d001a6..343fa36 100644
--- a/intern/cycles/util/util_cache.h
+++ b/intern/cycles/util/util_cache.h
@@ -105,7 +105,7 @@ public:
return false;
}
 
-   if(!size)
+   if((size == 0) || (size % sizeof(T)) != 0)
return false;
 
data.resize(size/sizeof(T));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b6aaa73] gooseberry: Merge branch 'master' into gooseberry

2015-04-29 Thread Antony Riakiotakis
Commit: b6aaa7395304e62e67099fefff831ae5cb1749b7
Author: Antony Riakiotakis
Date:   Wed Apr 29 12:38:26 2015 +0200
Branches: gooseberry
https://developer.blender.org/rBb6aaa7395304e62e67099fefff831ae5cb1749b7

Merge branch 'master' into gooseberry

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2e91bcf] master: Fix T44544: Cached BVH is broken since BVH leaf split

2015-04-29 Thread Sergey Sharybin
Commit: 2e91bcfb9d5384bf14c5f405998aa8637b0fc918
Author: Sergey Sharybin
Date:   Wed Apr 29 15:29:42 2015 +0500
Branches: master
https://developer.blender.org/rB2e91bcfb9d5384bf14c5f405998aa8637b0fc918

Fix T44544: Cached BVH is broken since BVH leaf split

Still need to solve issues with reading old cache with new builds.

===

M   intern/cycles/bvh/bvh.cpp

===

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index d1c3fee..0d9412a 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -107,6 +107,7 @@ bool BVH::cache_read(CacheData& key)
if(!(value.read(pack.root_index) &&
 value.read(pack.SAH) &&
 value.read(pack.nodes) &&
+value.read(pack.leaf_nodes) &&
 value.read(pack.object_node) &&
 value.read(pack.tri_woop) &&
 value.read(pack.prim_type) &&
@@ -118,6 +119,7 @@ bool BVH::cache_read(CacheData& key)
pack.root_index = 0;
pack.SAH = 0.0f;
pack.nodes.clear();
+   pack.leaf_nodes.clear();
pack.object_node.clear();
pack.tri_woop.clear();
pack.prim_type.clear();
@@ -140,6 +142,7 @@ void BVH::cache_write(CacheData& key)
value.add(pack.SAH);
 
value.add(pack.nodes);
+   value.add(pack.leaf_nodes);
value.add(pack.object_node);
value.add(pack.tri_woop);
value.add(pack.prim_type);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [734fb30] master: Use size_t to calculate size of tiles for rendering

2015-04-29 Thread Antony Riakiotakis
Commit: 734fb30bda1d3b0b444b1f627f156598961ca8ca
Author: Antony Riakiotakis
Date:   Wed Apr 29 12:30:25 2015 +0200
Branches: master
https://developer.blender.org/rB734fb30bda1d3b0b444b1f627f156598961ca8ca

Use size_t to calculate size of tiles for rendering

===

M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/render/intern/source/render_result.c 
b/source/blender/render/intern/source/render_result.c
index 0bd4284..f3a8dfd 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -486,7 +486,7 @@ static RenderPass *render_layer_add_pass(RenderResult *rr, 
RenderLayer *rl, int
const size_t view_id = BLI_findstringindex(&rr->views, viewname, 
offsetof(RenderView, name));
const char *typestr = name_from_passtype(passtype, -1);
RenderPass *rpass = MEM_callocN(sizeof(RenderPass), typestr);
-   int rectsize = rr->rectx * rr->recty * channels;
+   size_t rectsize = rr->rectx * rr->recty * channels;

BLI_addtail(&rl->passes, rpass);
rpass->passtype = passtype;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7232157] master: Correct comment

2015-04-29 Thread Campbell Barton
Commit: 7232157357a9905ed611fbcfbe6990b1275311b6
Author: Campbell Barton
Date:   Wed Apr 29 20:16:40 2015 +1000
Branches: master
https://developer.blender.org/rB7232157357a9905ed611fbcfbe6990b1275311b6

Correct comment

===

M   source/blender/bmesh/intern/bmesh_core.c

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index ee34a74..558d41c 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2130,7 +2130,7 @@ void bmesh_vert_separate(
 
while (true) {
/* Considering only edges and faces incident on vertex v, walk
-* the edges & faces and assign an index to each connected set 
*/
+* the edges & collect in the 'edges' list for splitting */
 
BMEdge *e = v->e;
BM_ELEM_API_FLAG_DISABLE(e, EDGE_VISIT);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [620cc76] master: Buildbot: Attempt to fix cudakernels target screwing up autotest cache

2015-04-29 Thread Sergey Sharybin
Commit: 620cc762dbcab37afba5ac069035649290f6182a
Author: Sergey Sharybin
Date:   Wed Apr 29 14:51:50 2015 +0500
Branches: master
https://developer.blender.org/rB620cc762dbcab37afba5ac069035649290f6182a

Buildbot: Attempt to fix cudakernels target screwing up autotest cache

===

M   build_files/buildbot/slave_compile.py

===

diff --git a/build_files/buildbot/slave_compile.py 
b/build_files/buildbot/slave_compile.py
index 8353bb8..7b3f848 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -116,6 +116,8 @@ else:
 
 if config.find('player') != -1:
 scons_options.append('BF_BUILDDIR=%s_player' % (build_dir))
+elif config.find('cuda') != -1:
+scons_options.append('BF_BUILDDIR=%s_cuda' % (build_dir))
 else:
 scons_options.append('BF_BUILDDIR=%s' % (build_dir))

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [90b3832] gooseberry: Merge branch 'alembic' into gooseberry

2015-04-29 Thread Sergey Sharybin
Commit: 90b3832c4dcc561b1995e3d2a9772af1960eaf54
Author: Sergey Sharybin
Date:   Wed Apr 29 14:48:37 2015 +0500
Branches: gooseberry
https://developer.blender.org/rB90b3832c4dcc561b1995e3d2a9772af1960eaf54

Merge branch 'alembic' into gooseberry

Conflicts:
intern/cycles/blender/blender_sync.h

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [65a9592] master: BMesh: optimize edge split

2015-04-29 Thread Campbell Barton
Commit: 65a95926600027814ef01ce5beaf711d3f41be55
Author: Campbell Barton
Date:   Wed Apr 29 12:48:06 2015 +1000
Branches: master
https://developer.blender.org/rB65a95926600027814ef01ce5beaf711d3f41be55

BMesh: optimize edge split

Avoid hashing edges when splitting into fans,
Instead, walk & split fans until they're all done, gives approx 40% speedup.

===

M   source/blender/bmesh/intern/bmesh_core.c

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index a370f2b..ee34a74 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -31,7 +31,7 @@
 #include "BLI_math_vector.h"
 #include "BLI_array.h"
 #include "BLI_alloca.h"
-#include "BLI_smallhash.h"
+#include "BLI_linklist_stack.h"
 #include "BLI_stackdefines.h"
 
 #include "BLF_translation.h"
@@ -2095,126 +2095,131 @@ void bmesh_vert_separate(
 BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
 const bool copy_select)
 {
-   const int v_edgetot = BM_vert_face_count(v);
-   BMEdge **stack = BLI_array_alloca(stack, v_edgetot);
-   STACK_DECLARE(stack);
+   int v_edges_num = 0;
 
-   SmallHash visithash;
-   BMVert **verts = NULL;
-   BMIter eiter, liter;
-   BMLoop *l;
-   BMEdge *e;
-   int i, maxindex;
-   BMLoop *l_new;
+   /* Detailed notes on array use since this is stack memory, we have to 
be careful */
 
-   BLI_smallhash_init_ex(&visithash, v_edgetot);
+   /* newly created vertices, only use when 'r_vout' is set
+* (total size will be number of fans) */
+   BLI_SMALLSTACK_DECLARE(verts_new, BMVert *);
+   /* fill with edges from the face-fan, clearing on completion
+* (total size will be max fan edge count) */
+   BLI_SMALLSTACK_DECLARE(edges, BMEdge *);
+   /* temp store edges to walk over when filling 'edges',
+* (total size will be max radial edges of any edge) */
+   BLI_SMALLSTACK_DECLARE(edges_search, BMEdge *);
 
-   STACK_INIT(stack, v_edgetot);
+   /* number of resulting verts, include self */
+   int verts_num = 1;
+   /* track the total number of edges handled, so we know when we've found 
the last fan */
+   int edges_found = 0;
 
-   maxindex = 0;
-   BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-   if (BLI_smallhash_haskey(&visithash, (uintptr_t)e)) {
-   continue;
-   }
+#define EDGE_VISIT _FLAG_WALK
+
+   /* count and flag at once */
+   if (v->e) {
+   BMEdge *e_first, *e_iter;
+   e_iter = e_first = v->e;
+   do {
+   v_edges_num += 1;
 
+   BLI_assert(!BM_ELEM_API_FLAG_TEST(e_iter, EDGE_VISIT));
+   BM_ELEM_API_FLAG_ENABLE(e_iter, EDGE_VISIT);
+   } while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
+   }
+
+   while (true) {
/* Considering only edges and faces incident on vertex v, walk
 * the edges & faces and assign an index to each connected set 
*/
-   BLI_smallhash_insert(&visithash, (uintptr_t)e, 
SET_INT_IN_POINTER(maxindex));
+
+   BMEdge *e = v->e;
+   BM_ELEM_API_FLAG_DISABLE(e, EDGE_VISIT);
+
do {
+   BLI_assert(!BM_ELEM_API_FLAG_TEST(e, EDGE_VISIT));
+   BLI_SMALLSTACK_PUSH(edges, e);
+   edges_found += 1;
+
if (e->l) {
BMLoop *l_iter, *l_first;
l_iter = l_first = e->l;
do {
-   l_new = (l_iter->v == v) ? l_iter->prev 
: l_iter->next;
-   BLI_assert(BM_vert_in_edge(l_new->e, 
v));
-   if (!BLI_smallhash_haskey(&visithash, 
(uintptr_t)l_new->e)) {
-   
BLI_smallhash_insert(&visithash, (uintptr_t)l_new->e, 
SET_INT_IN_POINTER(maxindex));
-   STACK_PUSH(stack, l_new->e);
+   BMLoop *l_adjacent = (l_iter->v == v) ? 
l_iter->prev : l_iter->next;
+   
BLI_assert(BM_vert_in_edge(l_adjacent->e, v));
+   if 
(BM_ELEM_API_FLAG_TEST(l_adjacent->e, EDGE_VISIT)) {
+   
BM_ELEM_API_FLAG_DISABLE(l_adjacent->e, EDGE_VISIT);
+   
BLI_SMALLSTACK_PUSH(edges_search, l_adjacent->e);
}
} while ((l_iter = l_iter->radial_next) != 
l_first);
}
-

[Bf-blender-cvs] [179ffef] master: BMesh: replace smallhash flag for checking doubles

2015-04-29 Thread Campbell Barton
Commit: 179ffefce5abd786531b8825634d6179d5634322
Author: Campbell Barton
Date:   Wed Apr 29 12:25:20 2015 +1000
Branches: master
https://developer.blender.org/rB179ffefce5abd786531b8825634d6179d5634322

BMesh: replace smallhash flag for checking doubles

===

M   source/blender/bmesh/intern/bmesh_core.c

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 16a9ecb..a370f2b 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -1989,27 +1989,38 @@ bool BM_vert_splice_check_double(BMVert *v_a, BMVert 
*v_b)
BLI_assert(BM_edge_exists(v_a, v_b) == false);
 
if (v_a->e && v_b->e) {
-   SmallHash visit;
BMEdge *e, *e_first;
 
-   BLI_smallhash_init(&visit);
+#define VERT_VISIT _FLAG_WALK
 
+   /* tag 'v_a' */
e = e_first = v_a->e;
do {
BMVert *v_other = BM_edge_other_vert(e, v_a);
-   BLI_smallhash_insert(&visit, (uintptr_t)v_other, NULL);
+   BLI_assert(!BM_ELEM_API_FLAG_TEST(v_other, VERT_VISIT));
+   BM_ELEM_API_FLAG_ENABLE(v_other, VERT_VISIT);
} while ((e = BM_DISK_EDGE_NEXT(e, v_a)) != e_first);
 
+   /* check 'v_b' connects to 'v_a' edges */
e = e_first = v_b->e;
do {
BMVert *v_other = BM_edge_other_vert(e, v_b);
-   if (BLI_smallhash_haskey(&visit, (uintptr_t)v_other)) {
+   if (BM_ELEM_API_FLAG_TEST(v_other, VERT_VISIT)) {
is_double = true;
break;
}
} while ((e = BM_DISK_EDGE_NEXT(e, v_b)) != e_first);
 
-   BLI_smallhash_release(&visit);
+   /* cleanup */
+   e = e_first = v_a->e;
+   do {
+   BMVert *v_other = BM_edge_other_vert(e, v_a);
+   BLI_assert(BM_ELEM_API_FLAG_TEST(v_other, VERT_VISIT));
+   BM_ELEM_API_FLAG_DISABLE(v_other, VERT_VISIT);
+   } while ((e = BM_DISK_EDGE_NEXT(e, v_a)) != e_first);
+
+#undef VERT_VISIT
+
}
 
return is_double;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [728d4f2] master: Cleanup: headers

2015-04-29 Thread Campbell Barton
Commit: 728d4f296f79674accf2284543bd408fc4682df7
Author: Campbell Barton
Date:   Wed Apr 29 19:39:58 2015 +1000
Branches: master
https://developer.blender.org/rB728d4f296f79674accf2284543bd408fc4682df7

Cleanup: headers

===

M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_ops.c

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index a7b984f..3cf0c53 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -54,6 +54,7 @@
 #include "BLI_memarena.h"
 
 #include "BKE_nla.h"
+#include "BKE_editmesh.h"
 #include "BKE_editmesh_bvh.h"
 #include "BKE_context.h"
 #include "BKE_constraint.h"
diff --git a/source/blender/editors/transform/transform.h 
b/source/blender/editors/transform/transform.h
index 1971c88..f5a9b3d 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -39,9 +39,6 @@
 
 #include "DNA_listBase.h"
 
-#include "BLI_smallhash.h"
-#include "BKE_editmesh.h"
-
 /* ** Types * */
 
 struct TransInfo;
@@ -261,7 +258,7 @@ typedef struct EdgeSlideData {
 
 typedef struct TransDataVertSlideVert {
/* TransDataGenericSlideVert */
-   BMVert *v;
+   struct BMVert *v;
struct LinkNode **cd_loop_groups;
float   co_orig_3d[3];
/* end generic */
diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index 291c70b..8e0b3d7 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -38,6 +38,7 @@
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_report.h"
+#include "BKE_editmesh.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e1ecd39] master: BMesh: avoid over-counting vert-edges

2015-04-29 Thread Campbell Barton
Commit: e1ecd39f0ee2ce1139045c83b8f5e415c346570f
Author: Campbell Barton
Date:   Wed Apr 29 10:25:59 2015 +1000
Branches: master
https://developer.blender.org/rBe1ecd39f0ee2ce1139045c83b8f5e415c346570f

BMesh: avoid over-counting vert-edges

===

M   source/blender/bmesh/intern/bmesh_core.c
M   source/blender/bmesh/intern/bmesh_structure.c

===

diff --git a/source/blender/bmesh/intern/bmesh_core.c 
b/source/blender/bmesh/intern/bmesh_core.c
index 7d6743e..16a9ecb 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -1687,7 +1687,7 @@ BMEdge *bmesh_jekv(
BMEdge *e_old;
BMVert *v_old, *tv;
BMLoop *l_kill;
-   int len, radlen = 0, i;
+   int radlen = 0, i;
bool halt = false;
 #ifndef NDEBUG
bool edok;
@@ -1698,10 +1698,8 @@ BMEdge *bmesh_jekv(
if (BM_vert_in_edge(e_kill, v_kill) == 0) {
return NULL;
}
-
-   len = bmesh_disk_count(v_kill);

-   if (len == 2) {
+   if (bmesh_disk_count_ex(v_kill, 3) == 2) {
 #ifndef NDEBUG
int valence1, valence2;
BMLoop *l;
diff --git a/source/blender/bmesh/intern/bmesh_structure.c 
b/source/blender/bmesh/intern/bmesh_structure.c
index cf56c3b..5d2eed8 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -228,7 +228,7 @@ bool bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
 
if (!BM_vert_in_edge(e, v))
return false;
-   if (bmesh_disk_count(v) != len || len == 0)
+   if (bmesh_disk_count_ex(v, len + 1) != len || len == 0)
return false;
 
e_iter = e;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2b833c7] alembic: Alembic: Fix compilation error after recent task/threads changes

2015-04-29 Thread Sergey Sharybin
Commit: 2b833c7ae85ceccf852b0273e08747980ecaa574
Author: Sergey Sharybin
Date:   Wed Apr 29 14:40:56 2015 +0500
Branches: alembic
https://developer.blender.org/rB2b833c7ae85ceccf852b0273e08747980ecaa574

Alembic: Fix compilation error after recent task/threads changes

For some reason CMake worked just fine, but SCons was giving issues.

===

M   source/blender/pointcache/CMakeLists.txt
M   source/blender/pointcache/SConscript
M   source/blender/pointcache/alembic/CMakeLists.txt
M   source/blender/pointcache/alembic/SConscript

===

diff --git a/source/blender/pointcache/CMakeLists.txt 
b/source/blender/pointcache/CMakeLists.txt
index e89ccc9..2898785 100644
--- a/source/blender/pointcache/CMakeLists.txt
+++ b/source/blender/pointcache/CMakeLists.txt
@@ -54,6 +54,10 @@ set(SRC
PTC_api.cpp
 )
 
+if(NOT WITH_CPP11)
+   list(APPEND INC_SYS ${BOOST_INCLUDE_DIR})
+endif()
+
 if(WITH_ALEMBIC)
add_definitions(-DWITH_PTC_ALEMBIC)
add_subdirectory(alembic)
diff --git a/source/blender/pointcache/SConscript 
b/source/blender/pointcache/SConscript
index 4b18b6f..f94bbd4 100644
--- a/source/blender/pointcache/SConscript
+++ b/source/blender/pointcache/SConscript
@@ -42,6 +42,9 @@ incs = [
 
 defs = []
 
+if not env['WITH_BF_CPP11']:
+incs.append(env['BF_BOOST_INC'])
+
 if env['WITH_BF_INTERNATIONAL']:
 defs.append('WITH_INTERNATIONAL')
 
diff --git a/source/blender/pointcache/alembic/CMakeLists.txt 
b/source/blender/pointcache/alembic/CMakeLists.txt
index 31dbff3..7bfa524 100644
--- a/source/blender/pointcache/alembic/CMakeLists.txt
+++ b/source/blender/pointcache/alembic/CMakeLists.txt
@@ -34,7 +34,6 @@ set(INC
 )
 
 set(INC_SYS
-   ${BOOST_INCLUDE_DIR}
${ALEMBIC_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIR}/OpenEXR
 )
diff --git a/source/blender/pointcache/alembic/SConscript 
b/source/blender/pointcache/alembic/SConscript
index 47fbafe..b9da2df 100644
--- a/source/blender/pointcache/alembic/SConscript
+++ b/source/blender/pointcache/alembic/SConscript
@@ -54,6 +54,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 
'linuxcross', 'win64-vc', '
 incs.append(env['BF_OPENEXR_INC'])
 incs.append(env['BF_ALEMBIC_INC'])
 
+if not env['WITH_BF_CPP11']:
+incs.append(env['BF_BOOST_INC'])
+
 defs.append('WITH_ALEMBIC')
 
 env.BlenderLib('bf_pointcache_alembic', sources, incs, defines=defs, 
libtype=['core','player'], priority=[901, 901])

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [29a9cbc] mathutils_bvhtree: mathutils_bvhtree: Changed parameters for the ray_cast function from point+ray to point+direction+distance.

2015-04-29 Thread Lukas Tönne
Commit: 29a9cbc310b47810d6251975a8a22834cf14965e
Author: Lukas Tönne
Date:   Wed Apr 29 11:26:51 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rB29a9cbc310b47810d6251975a8a22834cf14965e

mathutils_bvhtree: Changed parameters for the ray_cast function from
point+ray to point+direction+distance.

This is more convenient to use in general, and more consistent with
the BKE code.

===

M   source/blender/python/mathutils/mathutils_bvhtree.c

===

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 5221282..7d4d4ef 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -316,10 +316,12 @@ PyDoc_STRVAR(py_BVHTreeDerivedMesh_ray_cast_doc,
 "\n"
 "   Cast a ray onto the mesh.\n"
 "\n"
-"   :arg ray_start: Start location of the ray in object space.\n"
-"   :type ray_start: :class:`Vector`\n"
-"   :arg ray_end: End location of the ray in object space.\n"
-"   :type ray_end: :class:`Vector`\n"
+"   :arg ray_point: Start location of the ray in object space.\n"
+"   :type ray_point: :class:`Vector`\n"
+"   :arg ray_direction: Direction of the ray in object space.\n"
+"   :type ray_direction: :class:`Vector`\n"
+"   :arg ray_maxdist: Maximum distance of intersection.\n"
+"   :type ray_maxdist: :float\n"
 "   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance), index==-1 if no hit was found.\n"
 "   :rtype: :class:`tuple`\n"
 );
@@ -330,34 +332,33 @@ static PyObject 
*py_BVHTreeDerivedMesh_ray_cast(PyBVHTree_DerivedMesh *self, PyO
BVHTreeFromMesh *meshdata = &self->meshdata;
Object *ob = self->ob;

-   PyObject *py_ray_start, *py_ray_end;
-   float ray_start[3], ray_end[3];
-   float ray_nor[3], ray_len;
+   PyObject *py_point, *py_direction;
+   float ray_point[3], ray_direction[3];
+   float ray_maxdist = FLT_MAX;

-   if (!PyArg_ParseTuple(args, (char *)"OO:ray_cast", &py_ray_start, 
&py_ray_end))
+   if (!PyArg_ParseTuple(args, (char *)"OO|f:ray_cast", &py_point, 
&py_direction, &ray_maxdist))
{
return NULL;
}

-   if (mathutils_array_parse(ray_start, 2, 3, py_ray_start, error_prefix) 
== -1 ||
-   mathutils_array_parse(ray_end, 2, 3, py_ray_end, error_prefix) == 
-1)
+   if (mathutils_array_parse(ray_point, 2, 3, py_point, error_prefix) == 
-1 ||
+   mathutils_array_parse(ray_direction, 2, 3, py_direction, 
error_prefix) == -1)
{
return NULL;
}

-   sub_v3_v3v3(ray_nor, ray_end, ray_start);
-   ray_len = normalize_v3(ray_nor);
+   normalize_v3(ray_direction);

/* may fail if the mesh has no faces, in that case the ray-cast misses 
*/
if (meshdata->tree && meshdata->raycast_callback && ob->derivedFinal) {
BVHTreeRayHit hit;
-   hit.dist = ray_len;
+   hit.dist = ray_maxdist;
hit.index = -1;

-   if (BLI_bvhtree_ray_cast(meshdata->tree, ray_start, ray_nor, 
0.0f, &hit,
+   if (BLI_bvhtree_ray_cast(meshdata->tree, ray_point, 
ray_direction, 0.0f, &hit,
 meshdata->raycast_callback, meshdata) 
!= -1)
{
-   if (hit.dist <= ray_len) {
+   if (hit.dist <= ray_maxdist) {
int ret_index = self->use_poly_index ? 
dm_tessface_to_poly_index(ob->derivedFinal, hit.index) : hit.index;
return bvhtree_ray_hit_to_py(hit.co, hit.no, 
ret_index, hit.dist);
}
@@ -533,10 +534,12 @@ PyDoc_STRVAR(py_BVHTreeBMesh_ray_cast_doc,
 "\n"
 "   Cast a ray onto the mesh.\n"
 "\n"
-"   :arg ray_start: Start location of the ray in object space.\n"
-"   :type ray_start: :class:`Vector`\n"
-"   :arg ray_end: End location of the ray in object space.\n"
-"   :type ray_end: :class:`Vector`\n"
+"   :arg ray_point: Start location of the ray in object space.\n"
+"   :type ray_point: :class:`Vector`\n"
+"   :arg ray_direction: Direction of the ray in object space.\n"
+"   :type ray_direction: :class:`Vector`\n"
+"   :arg ray_maxdist: Maximum distance of intersection.\n"
+"   :type ray_maxdist: :float\n"
 "   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance), index==-1 if no hit was found.\n"
 "   :rtype: :class:`tuple`\n"
 );
@@ -546,33 +549,32 @@ static PyObject *py_BVHTreeBMesh_ray_cast(PyBVHTree_BMesh 
*self, PyObject *args)

BMBVHTree *bmdata = self->bmdata;

-   PyObject *py_ray_start, *py_ray_end;
-   float ray_start[3], ray_end[3];
-   float ray_no

[Bf-blender-cvs] [4478808] mathutils_bvhtree: mathutils_bvhtree: Support various types of DerivedMesh data, based on requested settings.

2015-04-29 Thread Lukas Tönne
Commit: 44788083c11f6a264f73fc6d10a3b9e9dfdad607
Author: Lukas Tönne
Date:   Wed Apr 29 10:12:35 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rB44788083c11f6a264f73fc6d10a3b9e9dfdad607

mathutils_bvhtree: Support various types of DerivedMesh data, based on
requested settings.

===

M   source/blender/python/mathutils/mathutils_bvhtree.c

===

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 656bc9b..7ac3e85 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -76,6 +76,58 @@ typedef struct {
 /*  */
 /* Utility helper functions */
 
+/* return various derived meshes based on requested settings */
+static DerivedMesh *bvh_get_derived_mesh(const char *funcname, struct Scene 
*scene, Object *ob, bool use_deform, bool use_render, bool use_cage)
+{
+   /* we only need minimum mesh data for topology and vertex locations */
+   CustomDataMask mask = CD_MASK_BAREMESH;
+   
+   /* Write the display mesh into the dummy mesh */
+   if (use_deform) {
+   if (use_render) {
+   if (use_cage) {
+   PyErr_Format(PyExc_ValueError,
+"%s(...): cage arg is unsupported 
when (render=True)", funcname);
+   return NULL;
+   }
+   else {
+   return mesh_create_derived_render(scene, ob, 
mask);
+   }
+   }
+   else {
+   if (use_cage) {
+   return mesh_get_derived_deform(scene, ob, 
mask);  /* ob->derivedDeform */
+   }
+   else {
+   return mesh_get_derived_final(scene, ob, mask); 
 /* ob->derivedFinal */
+   }
+   }
+   }
+   else {
+   /* !use_deform */
+   if (use_render) {
+   if (use_cage) {
+   PyErr_Format(PyExc_ValueError,
+"%s(...): cage arg is unsupported 
when (render=True)", funcname);
+   return NULL;
+   }
+   else {
+   return 
mesh_create_derived_no_deform_render(scene, ob, NULL, mask);
+   }
+   }
+   else {
+   if (use_cage) {
+   PyErr_Format(PyExc_ValueError,
+"%s(...): cage arg is unsupported 
when (deform=False, render=False)", funcname);
+   return NULL;
+   }
+   else {
+   return mesh_create_derived_no_deform(scene, ob, 
NULL, mask);
+   }
+   }
+   }
+}
+
 static int dm_tessface_to_poly_index(DerivedMesh *dm, int tessface_index)
 {
if (tessface_index != ORIGINDEX_NONE && tessface_index < 
dm->getNumTessFaces(dm)) {
@@ -183,55 +235,70 @@ PyTypeObject PyBVHTree_Type = {
 static int PyBVHTreeDerivedMesh__tp_init(PyBVHTree_DerivedMesh *self, PyObject 
*args, PyObject *kwargs)
 {
BVHTreeFromMesh *meshdata = &self->meshdata;
-   const char *keywords[] = {"object", "type", NULL};
+   const char *keywords[] = {"object", "scene", "type", "deform", 
"render", "cage", NULL};

-   PyObject *py_ob;
+   PyObject *py_ob, *py_scene;
Object *ob;
+   struct Scene *scene;
+   DerivedMesh *dm;
const char *type = "POLYS";
+   int use_deform = true;
+   int use_render = false;
+   int use_cage = false;
+   bool success;

if (PyBVHTree_Type.tp_init((PyObject *)self, args, kwargs) < 0)
return -1;

-   if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char 
*)"O|s:BVHTreeDerivedMesh", (char **)keywords,
-&py_ob, &type))
+   if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char 
*)"OO|siii:BVHTreeDerivedMesh", (char **)keywords,
+&py_ob, &py_scene, &type, &use_deform, 
&use_render, &use_cage))
{
return -1;
}

ob = PyC_RNA_AsPointer(py_ob, "Object");
-   if (!ob) {
+   scene = PyC_RNA_AsPointer(py_scene, "Scene");
+   if (!ob || !scene) {
return -1;
}
+   self->ob = ob;

-   if (ob->derivedFinal == NULL) {
-   PyErr_Format(PyExc_ValueError, "Object '%.200s' has no mesh 

[Bf-blender-cvs] [e84b6c3] mathutils_bvhtree: mathutils_bvhtree: Changed return values of find-nearest functions to plain distance instead of squared distance.

2015-04-29 Thread Lukas Tönne
Commit: e84b6c3c1e254850ea55d2d1f919e133fda6de2a
Author: Lukas Tönne
Date:   Wed Apr 29 09:34:45 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rBe84b6c3c1e254850ea55d2d1f919e133fda6de2a

mathutils_bvhtree: Changed return values of find-nearest functions to
plain distance instead of squared distance.

For bpy API a consistent use of plain distance is less confusing and
the overhead is not very relevant.

===

M   source/blender/python/mathutils/mathutils_bvhtree.c

===

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index f3cc4a5..6ee49e8 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -101,14 +101,14 @@ static PyObject *bvhtree_ray_hit_to_py(const float co[3], 
const float no[3], int
return py_retval;
 }
 
-static PyObject *bvhtree_nearest_to_py(const float co[3], const float no[3], 
int index, float dist_sq)
+static PyObject *bvhtree_nearest_to_py(const float co[3], const float no[3], 
int index, float dist)
 {
PyObject *py_retval = PyTuple_New(4);
PyTuple_SET_ITEMS(py_retval,
Vector_CreatePyObject(co, 3, NULL),
Vector_CreatePyObject(no, 3, NULL),
PyLong_FromLong(index),
-   PyFloat_FromDouble(dist_sq));
+   PyFloat_FromDouble(dist));
return py_retval;
 }
 
@@ -314,7 +314,7 @@ PyDoc_STRVAR(py_BVHTreeDerivedMesh_find_nearest_doc,
 "   :type ray_start: :class:`Vector`\n"
 "   :art max_dist: Maximum search distance\n"
 "   :type max_dist: :float\n"
-"   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance_squared), index==-1 if no hit was found.\n"
+"   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance), index==-1 if no hit was found.\n"
 "   :rtype: :class:`tuple`\n"
 );
 static PyObject *py_BVHTreeDerivedMesh_find_nearest(PyBVHTree_DerivedMesh 
*self, PyObject *args)
@@ -347,11 +347,11 @@ static PyObject 
*py_BVHTreeDerivedMesh_find_nearest(PyBVHTree_DerivedMesh *self,
 meshdata->nearest_callback, 
meshdata) != -1)
{
int ret_index = self->use_poly_index ? 
dm_tessface_to_poly_index(ob->derivedFinal, nearest.index) : nearest.index;
-   return bvhtree_nearest_to_py(nearest.co, nearest.no, 
ret_index, nearest.dist_sq);
+   return bvhtree_nearest_to_py(nearest.co, nearest.no, 
ret_index, sqrtf(nearest.dist_sq));
}
}

-   return bvhtree_ray_hit_to_py(NULL, NULL, -1, 0.0f);
+   return bvhtree_nearest_to_py(NULL, NULL, -1, 0.0f);
 }
 
 static PyMethodDef PyBVHTreeDerivedMesh_methods[] = {
@@ -529,7 +529,7 @@ PyDoc_STRVAR(py_BVHTreeBMesh_find_nearest_doc,
 "   :type ray_start: :class:`Vector`\n"
 "   :art max_dist: Maximum search distance\n"
 "   :type max_dist: :float\n"
-"   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance_squared), index==-1 if no hit was found.\n"
+"   :return: Returns a tuple (:class:`Vector` location, :class:`Vector` 
normal, int index, float distance), index==-1 if no hit was found.\n"
 "   :rtype: :class:`tuple`\n"
 );
 static PyObject *py_BVHTreeBMesh_find_nearest(PyBVHTree_BMesh *self, PyObject 
*args)
@@ -556,11 +556,11 @@ static PyObject 
*py_BVHTreeBMesh_find_nearest(PyBVHTree_BMesh *self, PyObject *a

nearest_vert = BKE_bmbvh_find_vert_closest(bmdata, point, 
max_dist);
if (nearest_vert) {
-   return bvhtree_ray_hit_to_py(nearest_vert->co, 
nearest_vert->no, BM_elem_index_get(nearest_vert), len_squared_v3v3(point, 
nearest_vert->co));
+   return bvhtree_nearest_to_py(nearest_vert->co, 
nearest_vert->no, BM_elem_index_get(nearest_vert), len_v3v3(point, 
nearest_vert->co));
}
}

-   return bvhtree_ray_hit_to_py(NULL, NULL, -1, 0.0f);
+   return bvhtree_nearest_to_py(NULL, NULL, -1, 0.0f);
 }
 
 static PyMethodDef PyBVHTreeBMesh_methods[] = {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [42c4a9c] mathutils_bvhtree: mathutils_bvhtree: Changed type names for bvhtree elements to make them more consistent with other API parts.

2015-04-29 Thread Lukas Tönne
Commit: 42c4a9cdc4ef8b0f634c1dba38d49a5e83dd890d
Author: Lukas Tönne
Date:   Wed Apr 29 10:41:02 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rB42c4a9cdc4ef8b0f634c1dba38d49a5e83dd890d

mathutils_bvhtree: Changed type names for bvhtree elements to make them
more consistent with other API parts.

In particular using TESSFACE instead of FACE for clarity.

===

M   source/blender/python/mathutils/mathutils_bvhtree.c

===

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 7ac3e85..5221282 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -241,7 +241,7 @@ static int 
PyBVHTreeDerivedMesh__tp_init(PyBVHTree_DerivedMesh *self, PyObject *
Object *ob;
struct Scene *scene;
DerivedMesh *dm;
-   const char *type = "POLYS";
+   const char *type = "POLY";
int use_deform = true;
int use_render = false;
int use_cage = false;
@@ -268,28 +268,28 @@ static int 
PyBVHTreeDerivedMesh__tp_init(PyBVHTree_DerivedMesh *self, PyObject *
return -1;
}

-   if (STREQ(type, "FACES")) {
+   if (STREQ(type, "TESSFACE")) {
bvhtree_from_mesh_faces(meshdata, dm, 0.0f, 4, 6);
self->use_poly_index = false;
success = true;
}
-   else if (STREQ(type, "POLYS")) {
+   else if (STREQ(type, "POLY")) {
bvhtree_from_mesh_faces(meshdata, dm, 0.0f, 4, 6);
self->use_poly_index = true;
success = true;
}
-   else if (STREQ(type, "VERTS")) {
+   else if (STREQ(type, "VERT")) {
bvhtree_from_mesh_verts(meshdata, dm, 0.0f, 4, 6);
self->use_poly_index = false;
success = true;
}
-   else if (STREQ(type, "EDGES")) {
+   else if (STREQ(type, "EDGE")) {
bvhtree_from_mesh_edges(meshdata, dm, 0.0f, 4, 6);
self->use_poly_index = false;
success = true;
}
else {
-   PyErr_Format(PyExc_ValueError, "'type' must be 'FACES', 
'POLYS', 'VERTS' or 'EDGES', not '%.200s'", type);
+   PyErr_Format(PyExc_ValueError, "'type' must be 'TESSFACE', 
'POLY', 'VERT' or 'EDGE', not '%.200s'", type);
success = false;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [615414f] master: SCons: Ignore .svn folder when installing site-packages

2015-04-29 Thread Sergey Sharybin
Commit: 615414fa364f8772b1a1bee04ec9372ef73baee1
Author: Sergey Sharybin
Date:   Wed Apr 29 14:29:42 2015 +0500
Branches: master
https://developer.blender.org/rB615414fa364f8772b1a1bee04ec9372ef73baee1

SCons: Ignore .svn folder when installing site-packages

===

M   build_files/scons/tools/Blender.py

===

diff --git a/build_files/scons/tools/Blender.py 
b/build_files/scons/tools/Blender.py
index e751be3..6e7417c 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -670,6 +670,8 @@ def WinPyBundle(target=None, source=None, env=None):
 py_dir += '/release/site-packages'
 # grr, we have to do one by one because the dir exists
 for f in os.listdir(py_dir):
+if f == '.svn':
+continue
 fn_src = os.path.join(py_dir, f)
 fn_dst = os.path.join(py_target, f)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3224d32] mathutils_bvhtree: mathutils_bvhtree: Removed unnecessary dealloc function for bpy types.

2015-04-29 Thread Lukas Tönne
Commit: 3224d32c71b4d6a795f2a26ad146ed038a4d8d3b
Author: Lukas Tönne
Date:   Wed Apr 29 09:37:46 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rB3224d32c71b4d6a795f2a26ad146ed038a4d8d3b

mathutils_bvhtree: Removed unnecessary dealloc function for bpy types.

===

M   source/blender/python/mathutils/mathutils_bvhtree.c

===

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 6ee49e8..656bc9b 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -120,11 +120,6 @@ static int PyBVHTree__tp_init(PyBVHTree *UNUSED(self), 
PyObject *UNUSED(args), P
return 0;
 }
 
-static void PyBVHTree__tp_dealloc(PyBVHTree *self)
-{
-   Py_TYPE(self)->tp_free((PyObject *)self);
-}
-
 static PyMethodDef PyBVHTree_methods[] = {
{NULL, NULL, 0, NULL}
 };
@@ -138,7 +133,7 @@ PyTypeObject PyBVHTree_Type = {
sizeof(PyBVHTree),   /* tp_basicsize */
0,   /* tp_itemsize */
/* methods */
-   (destructor)PyBVHTree__tp_dealloc,   /* tp_dealloc */
+   NULL,/* tp_dealloc */
NULL,/* tp_print */
NULL,/* tp_getattr */
NULL,/* tp_setattr */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e37373d] master: Revert commit with perspective depth offset, makes simple cases such as loopcuts on cube have zfighting.

2015-04-29 Thread Antony Riakiotakis
Commit: e37373d96e6784d08e3f6091733cff06923f5aae
Author: Antony Riakiotakis
Date:   Wed Apr 29 11:19:23 2015 +0200
Branches: master
https://developer.blender.org/rBe37373d96e6784d08e3f6091733cff06923f5aae

Revert commit with perspective depth offset, makes simple cases such as
loopcuts on cube have zfighting.

===

M   source/blender/editors/screen/glutil.c

===

diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index a478a1f..c7421aa 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -1024,7 +1024,7 @@ void bglPolygonOffset(float viewdist, float dist)
}
else {
/* should be clipping value or so... */
-   offs = 0.0001f * dist;
+   offs = 0.0005f * dist;
}

winmat[14] -= offs;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fe052ca] gooseberry: Merge branch 'master' into gooseberry

2015-04-29 Thread Sergey Sharybin
Commit: fe052ca1ff4569d2bef9f2f37a6a537cdef7016a
Author: Sergey Sharybin
Date:   Wed Apr 29 14:19:15 2015 +0500
Branches: gooseberry
https://developer.blender.org/rBfe052ca1ff4569d2bef9f2f37a6a537cdef7016a

Merge branch 'master' into gooseberry

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [adf4d0e] alembic: Merge branch 'master' into alembic

2015-04-29 Thread Sergey Sharybin
Commit: adf4d0e3e307bef203104d49a92d7b0833be2856
Author: Sergey Sharybin
Date:   Wed Apr 29 14:00:07 2015 +0500
Branches: alembic
https://developer.blender.org/rBadf4d0e3e307bef203104d49a92d7b0833be2856

Merge branch 'master' into alembic

Conflicts:
intern/cycles/blender/blender_sync.h

===



===

diff --cc intern/cycles/blender/blender_sync.h
index 8d2f324,89d93e1..6c4da1a
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@@ -83,13 -83,13 +83,13 @@@ private
void sync_curve_settings();
  
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
 -  Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
 -  void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool 
motion, int time_index = 0);
 +  Mesh *sync_mesh(BL::Object b_parent, bool object_updated, bool 
hide_tris, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
 +  void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_parent, bool 
motion, int time_index = 0, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
Object *sync_object(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
-Transform& tfm, uint layer_flag, float 
motion_time, bool hide_tris);
-   void sync_light(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
-   void sync_background_light();
+Transform& tfm, uint layer_flag, float 
motion_time, bool hide_tris, bool *use_portal);
+   void sync_light(BL::Object b_parent, int 
persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool 
*use_portal);
+   void sync_background_light(bool use_portal);
 -  void sync_mesh_motion(BL::Object b_ob, Object *object, float 
motion_time);
 +  void sync_mesh_motion(BL::Object b_parent, Object *object, float 
motion_time, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
void sync_camera_motion(BL::Object b_ob, float motion_time);
  
/* particles */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [029bd44] master: SCons: Fix wrong flags usage after recent stdc89 changes

2015-04-29 Thread Sergey Sharybin
Commit: 029bd44bbd0fc6c1c59c6cb37f9e70c4dd23f91d
Author: Sergey Sharybin
Date:   Wed Apr 29 13:57:02 2015 +0500
Branches: master
https://developer.blender.org/rB029bd44bbd0fc6c1c59c6cb37f9e70c4dd23f91d

SCons: Fix wrong flags usage after recent stdc89 changes

CCFLAGS are used for both C and C++ compilers and one is better not to pass
C-related flags to C++ compiler. C-compiler flags are to be passed via CFLAGS
variable.

===

M   build_files/scons/config/linux-config.py

===

diff --git a/build_files/scons/config/linux-config.py 
b/build_files/scons/config/linux-config.py
index c3f0c43..6353120 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -230,7 +230,8 @@ WITH_BF_FREESTYLE = True
 CC = 'gcc'
 CXX = 'g++'
 
-CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', 
'-std=gnu89', '-D_LARGEFILE_SOURCE', 
'-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
+CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', 
'-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
+CFLAGS = ['-std=gnu89']
 CXXFLAGS = []
 
 CPPFLAGS = []

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f4d7f52] master: Buildbot: Fix typo in error message

2015-04-29 Thread Sergey Sharybin
Commit: f4d7f5216fe45a171bb92add0446dc7409c7b542
Author: Sergey Sharybin
Date:   Wed Apr 29 13:47:47 2015 +0500
Branches: master
https://developer.blender.org/rBf4d7f5216fe45a171bb92add0446dc7409c7b542

Buildbot: Fix typo in error message

===

M   build_files/buildbot/slave_compile.py

===

diff --git a/build_files/buildbot/slave_compile.py 
b/build_files/buildbot/slave_compile.py
index cbe345e..8353bb8 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -140,7 +140,7 @@ else:
 
 retcode = subprocess.call(cur_scons_cmd + scons_options)
 if retcode != 0:
-print('Error building rules wuth config ' + config)
+print('Error building rules with config ' + config)
 sys.exit(retcode)
 
 sys.exit(0)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [95d95ed] mathutils_bvhtree: Merge branch 'master' into mathutils_bvhtree

2015-04-29 Thread Lukas Tönne
Commit: 95d95edfa0bbada67a974546f0fd1544d6b3cd12
Author: Lukas Tönne
Date:   Wed Apr 29 09:11:36 2015 +0200
Branches: mathutils_bvhtree
https://developer.blender.org/rB95d95edfa0bbada67a974546f0fd1544d6b3cd12

Merge branch 'master' into mathutils_bvhtree

===



===

diff --cc source/blender/python/mathutils/CMakeLists.txt
index c744673,ef6b090..f70f893
--- a/source/blender/python/mathutils/CMakeLists.txt
+++ b/source/blender/python/mathutils/CMakeLists.txt
@@@ -38,8 -37,8 +38,9 @@@ set(SR
mathutils_Matrix.c
mathutils_Quaternion.c
mathutils_Vector.c
 +  mathutils_bvhtree.c
mathutils_geometry.c
+   mathutils_interpolate.c
mathutils_kdtree.c
mathutils_noise.c
  
@@@ -49,8 -48,8 +50,9 @@@
mathutils_Matrix.h
mathutils_Quaternion.h
mathutils_Vector.h
 +  mathutils_bvhtree.h
mathutils_geometry.h
+   mathutils_interpolate.h
mathutils_kdtree.h
mathutils_noise.h
  )
diff --cc source/blender/python/mathutils/mathutils.c
index 89f47ed,7b51b08..5e0def8
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@@ -502,8 -585,8 +585,9 @@@ static struct PyModuleDef M_Mathutils_m
  
  /* submodules only */
  #include "mathutils_geometry.h"
+ #include "mathutils_interpolate.h"
  #ifndef MATH_STANDALONE
 +#  include "mathutils_bvhtree.h"
  #  include "mathutils_kdtree.h"
  #  include "mathutils_noise.h"
  #endif

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d1b934d] temp_bullet_ghosts: Extension of the C-API for Bullet in Blender, to enable customized collision detection outside of rigid body dynamics.

2015-04-29 Thread Lukas Tönne
Commit: d1b934d81b9f827dcb67c3d8107f6e143c91a3ca
Author: Lukas Tönne
Date:   Sat Feb 28 14:44:51 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rBd1b934d81b9f827dcb67c3d8107f6e143c91a3ca

Extension of the C-API for Bullet in Blender, to enable customized
collision detection outside of rigid body dynamics.

These extensions consist of a few major changes:
* Support for "btGhost" objects.

  These are Bullet collision objects, but not rigid bodies. They can be
  added to a btCollisionWorld, or they can be used for immediate
  individual collision detection. Ghost objects don't have any effect on
  rigid bodies or other collision objects.

  Ghost objects are "one-way" colliders: they register contacts with
  actual collision objects, but don't themselves generate contacts in
  other bodies. This makes them useful for accessing Bullet's advanced
  contact generation algorithms in simulation systems that don't
  actually interact with rigid bodies (e.g. hair or cloth).

* Better low-level access to collision shapes.

  Collision shapes can now be allocated outside of the API using static
  size variables. This allows more efficient allocation schemes, such
  as bulk array allocation and mempools/memarenas. The Bullet engine
  itself expects callers to allocate and manage class instances in fact,
  but due to the optional linking with Bullet and the differences
  between C/C++ the allocation was left to single collision shape
  instances so far.

* Compound shapes can now be constructed explicitly as well. Previously
  only the primitive shapes were supported, with compounds limited to
  special cases.

* Contact callback functions (contact and proximity tests) can now do
  complete reports of all manifold contact points.

Taken together, these API improvements will open up Bullet to a wider
range of features inside Blender, for rigid body simulations as well as
other uses.

Differential Revision: https://developer.blender.org/D1268

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp
M   source/blender/blenkernel/intern/rigidbody.c

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 7ab63c4..c4311d1 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -220,7 +220,7 @@ void RB_body_set_linear_factor(rbRigidBody *object, float 
x, float y, float z);
 void RB_body_set_angular_factor(rbRigidBody *object, float x, float y, float 
z);
 
 /* Kinematic State */
-void RB_body_set_kinematic_state(rbRigidBody *body, int kinematic);
+void RB_body_set_kinematic_state(rbRigidBody *body, bool kinematic);
 
 /* RigidBody Interface - Rigid Body Activation States */
 int RB_body_get_activation_state(rbRigidBody *body);
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index 806e912..7b7946a 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -766,7 +766,7 @@ void RB_body_set_angular_factor(rbRigidBody *object, float 
x, float y, float z)
 
 /*  */
 
-void RB_body_set_kinematic_state(rbRigidBody *object, int kinematic)
+void RB_body_set_kinematic_state(rbRigidBody *object, bool kinematic)
 {
btRigidBody *body = object->body;
if (kinematic)
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 191f718..9d7cea8 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1302,8 +1302,9 @@ static void rigidbody_update_sim_ob(Scene *scene, 
RigidBodyWorld *rbw, Object *o
  * Updates and validates rigid body objects.
  *
  * \param rebuild Rebuild entire simulation
+ * \param all_kinematic If true all bodies will be kinematic and not collide 
or react
  */
-static int rigidbody_update_objects(Scene *scene, RigidBodyWorld *rbw, bool 
rebuild)
+static int rigidbody_update_objects(Scene *scene, RigidBodyWorld *rbw, bool 
rebuild, bool all_kinematic)
 {
int result = 0;
GroupObject *go;
@@ -1372,10 +1373,15 @@ static int rigidbody_update_objects(Scene *scene, 
RigidBodyWorld *rbw, bool rebu
/* update simulation object... */
rigidbody_update_sim_ob(scene, rbw, ob, rbo);
 
-   /* XXX could avoid some unnecessary updates with 
lower-level testing,
-* but this is safer for now.
-*/
-   result |= RB_STEP_DYNAMICS;
+   if (all_kinematic) {
+   
RB_body_set_kinematic_state(rbo->physics_object, true);
+   }
+   else {
+   /* XXX could avoid some unnecessary updates 
with lower-level testing,
+* but this is sa

[Bf-blender-cvs] [0a693d7] temp_bullet_ghosts: Added API representation of manifold contact points and the direct contact test function from btCollisionWorld.

2015-04-29 Thread Lukas Tönne
Commit: 0a693d7716d955666471afc1ee67b49dfb7ffd8e
Author: Lukas Tönne
Date:   Fri Jan 2 17:25:39 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB0a693d7716d955666471afc1ee67b49dfb7ffd8e

Added API representation of manifold contact points and the direct
contact test function from btCollisionWorld.

This function can be used for testing individual collision objects
(rigid bodies or ghosts) against objects in the world. It is only
useful for one-way interaction (rigid bodies don't react to the tested
object), but allows collision detection without adding objects into the
world. The current build process for the scene dynamics world is very
much centered on Blender Objects and extending it is difficult.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp
M   source/blender/makesrna/intern/rna_rigidbody.c

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index c6fbc23..7ab63c4 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -51,6 +51,11 @@ extern "C" {
 
 // --
 
+typedef enum rbObjectType {
+   RB_OBJECT_RIGIDBODY,
+   RB_OBJECT_GHOST,
+} rbObjectType;
+
 /* Dynamics World */
 typedef struct rbDynamicsWorld rbDynamicsWorld;
 
@@ -69,6 +74,9 @@ typedef struct rbMeshData rbMeshData;
 /* Constraint */
 typedef struct rbConstraint rbConstraint;
 
+/* Manifold Contact Point */
+typedef struct rbManifoldPoint rbManifoldPoint;
+
 /* ** */
 /* Dynamics World Methods */
 
@@ -105,6 +113,26 @@ void RB_dworld_test_collision(rbDynamicsWorld *world);
 void RB_dworld_export(rbDynamicsWorld *world, const char *filename);
 
 /* ** */
+/* Manifold Point Methods */
+
+void RB_manifold_point_local_A(const rbManifoldPoint *pt, float vec[3]);
+void RB_manifold_point_local_B(const rbManifoldPoint *pt, float vec[3]);
+void RB_manifold_point_world_A(const rbManifoldPoint *pt, float vec[3]);
+void RB_manifold_point_world_B(const rbManifoldPoint *pt, float vec[3]);
+void RB_manifold_point_normal_world_B(const rbManifoldPoint *pt, float vec[3]);
+float RB_manifold_point_distance(const rbManifoldPoint *pt);
+float RB_manifold_point_combined_friction(const rbManifoldPoint *pt);
+float RB_manifold_point_combined_rolling_friction(const rbManifoldPoint *pt);
+float RB_manifold_point_combined_restitution(const rbManifoldPoint *pt);
+int RB_manifold_point_part_id0(const rbManifoldPoint *pt);
+int RB_manifold_point_index0(const rbManifoldPoint *pt);
+int RB_manifold_point_part_id1(const rbManifoldPoint *pt);
+int RB_manifold_point_index1(const rbManifoldPoint *pt);
+void *RB_manifold_point_get_user_persistent_data(const rbManifoldPoint *pt);
+void RB_manifold_point_set_user_persistent_data(const rbManifoldPoint *pt, 
void *data);
+float RB_manifold_point_lifetime(const rbManifoldPoint *pt);
+
+/* ** */
 /* Rigid Body Methods */
 
 /* Setup  */
@@ -117,11 +145,18 @@ void RB_dworld_remove_body(rbDynamicsWorld *world, 
rbRigidBody *body);
 
 /* Collision detection */
 
-void RB_dworld_convex_sweep_test_body(
+typedef void (*rbContactCallback)(void *userdata, rbManifoldPoint *cp,
+  const void *collob0, rbObjectType type0, int 
part0, int index0,
+  const void *collob1, rbObjectType type1, int 
part1, int index1);
+
+void RB_dworld_convex_sweep_closest_body(
 rbDynamicsWorld *world, rbRigidBody *object,
 const float loc_start[3], const float loc_end[3],
 float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit);
 
+void RB_dworld_contact_test_body(rbDynamicsWorld *world, rbRigidBody *object, 
rbContactCallback cb, void *userdata, int col_groups);
+void RB_dworld_contact_test_ghost(rbDynamicsWorld *world, rbGhostObject 
*object, rbContactCallback cb, void *userdata, int col_groups);
+
 /*  */
 
 /* Create new RigidBody instance */
@@ -236,7 +271,7 @@ void RB_ghost_set_loc_rot(rbGhostObject *object, const 
float loc[3], const float
 void RB_ghost_set_scale(rbGhostObject *object, const float scale[3]);
 
 /* Collision detection */
-void RB_dworld_convex_sweep_test_ghost(
+void RB_dworld_convex_sweep_closest_ghost(
 rbDynamicsWorld *world, rbGhostObject *object,
 const float loc_start[3], const float loc_end[3],
 float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit);
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index fabbbad..806e912 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -74,6 +74,19 @@ subject to the following restrictions:
 #include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
 #include "BulletCollision/Collisio

[Bf-blender-cvs] [e8ccc18] temp_bullet_ghosts: "Free" function for shapes which only deconstructs the object, but does not handle deallocation.

2015-04-29 Thread Lukas Tönne
Commit: e8ccc18131d7eecd34e858b9ed993916e0740ebe
Author: Lukas Tönne
Date:   Fri Jan 2 10:37:35 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rBe8ccc18131d7eecd34e858b9ed993916e0740ebe

"Free" function for shapes which only deconstructs the object, but does
not handle deallocation.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 6b5b670..4f0f638 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -291,6 +291,9 @@ void RB_shape_compound_update_local_aabb(rbCollisionShape 
*shape);
 
 /* Cleanup --- */
 
+/* only free internal data (no dealloc) */
+void RB_shape_free(rbCollisionShape *shape);
+/* free and dealloc */
 void RB_shape_delete(rbCollisionShape *shape);
 
 /* Settings --- */
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index d4d4950..2dc7e8b 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -1073,6 +1073,11 @@ void 
RB_shape_compound_update_local_aabb(rbCollisionShape *shape)
 
 /* Cleanup --- */
 
+void RB_shape_free(rbCollisionShape *shape)
+{
+   shape->~rbCollisionShape();
+}
+
 void RB_shape_delete(rbCollisionShape *shape)
 {
delete shape;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [27c2db4] temp_bullet_ghosts: Generalized the convex-sweep test API function to also support ghost objects.

2015-04-29 Thread Lukas Tönne
Commit: 27c2db4a7cb0060ba2fd9365ebc611ee2efdc08b
Author: Lukas Tönne
Date:   Fri Jan 2 11:14:58 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB27c2db4a7cb0060ba2fd9365ebc611ee2efdc08b

Generalized the convex-sweep test API function to also support ghost
objects.

All collision test functions work with btCollisionObject, but for the
C API they need explicit variants for rbRigidBody and rbGhostObject.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp
M   source/blender/makesrna/intern/rna_rigidbody.c

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 4f0f638..c6fbc23 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -117,7 +117,7 @@ void RB_dworld_remove_body(rbDynamicsWorld *world, 
rbRigidBody *body);
 
 /* Collision detection */
 
-void RB_world_convex_sweep_test(
+void RB_dworld_convex_sweep_test_body(
 rbDynamicsWorld *world, rbRigidBody *object,
 const float loc_start[3], const float loc_end[3],
 float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit);
@@ -235,6 +235,12 @@ void RB_ghost_get_transform_matrix(rbGhostObject *object, 
float m_out[4][4]);
 void RB_ghost_set_loc_rot(rbGhostObject *object, const float loc[3], const 
float rot[4]);
 void RB_ghost_set_scale(rbGhostObject *object, const float scale[3]);
 
+/* Collision detection */
+void RB_dworld_convex_sweep_test_ghost(
+rbDynamicsWorld *world, rbGhostObject *object,
+const float loc_start[3], const float loc_end[3],
+float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit);
+
 /* ** */
 /* Collision Shape Methods */
 
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index 2dc7e8b..fabbbad 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -396,18 +396,20 @@ void RB_dworld_remove_body(rbDynamicsWorld *world, 
rbRigidBody *object)
 
 /* Collision detection */
 
-void RB_world_convex_sweep_test(
-rbDynamicsWorld *world, rbRigidBody *object,
+/* generic implementation for btCollisionObject, also used for ghost objects */
+static void dworld_convex_sweep_test(
+rbDynamicsWorld *world, btCollisionObject *bt_object,
 const float loc_start[3], const float loc_end[3],
 float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit)
 {
-   btRigidBody *body = object->body;
-   btCollisionShape *collisionShape = body->getCollisionShape();
+   btCollisionShape *collisionShape = bt_object->getCollisionShape();
/* only convex shapes are supported, but user can specify a non convex 
shape */
if (collisionShape->isConvex()) {
-   btCollisionWorld::ClosestConvexResultCallback 
result(btVector3(loc_start[0], loc_start[1], loc_start[2]), 
btVector3(loc_end[0], loc_end[1], loc_end[2]));
+   btCollisionWorld::ClosestConvexResultCallback result(
+   btVector3(loc_start[0], loc_start[1], loc_start[2]),
+   btVector3(loc_end[0], loc_end[1], loc_end[2]));
 
-   btQuaternion obRot = body->getWorldTransform().getRotation();
+   btQuaternion obRot = 
bt_object->getWorldTransform().getRotation();

btTransform rayFromTrans;
rayFromTrans.setIdentity();
@@ -447,6 +449,14 @@ void RB_world_convex_sweep_test(
}
 }
 
+void RB_dworld_convex_sweep_test_body(
+rbDynamicsWorld *world, rbRigidBody *object,
+const float loc_start[3], const float loc_end[3],
+float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit)
+{
+   dworld_convex_sweep_test(world, object->body, loc_start, loc_end, 
v_location, v_hitpoint, v_normal, r_hit);
+}
+
 /*  */
 
 rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const 
float rot[4])
@@ -850,6 +860,14 @@ void RB_ghost_set_scale(rbGhostObject *object, const float 
scale[3])
}
 }
 
+void RB_dworld_convex_sweep_test_ghost(
+rbDynamicsWorld *world, rbGhostObject *object,
+const float loc_start[3], const float loc_end[3],
+float v_location[3],  float v_hitpoint[3],  float v_normal[3], int 
*r_hit)
+{
+   dworld_convex_sweep_test(world, object->ghost, loc_start, loc_end, 
v_location, v_hitpoint, v_normal, r_hit);
+}
+
 /* ** */
 /* Collision Shape Methods */
 
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c 
b/source/blender/makesrna/intern/rna_rigidbody.c
index 58a12f6..aa93d0c 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -632,8 +632,8 @@ static void rna_RigidBodyWorld_convex_sweep_test(
  

[Bf-blender-cvs] [48668d8] temp_bullet_ghosts: Support for btGhostObjects in the Bullet API.

2015-04-29 Thread Lukas Tönne
Commit: 48668d821c3bae4638edac2b2072f190016923d1
Author: Lukas Tönne
Date:   Tue Dec 30 11:35:35 2014 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB48668d821c3bae4638edac2b2072f190016923d1

Support for btGhostObjects in the Bullet API.

Ghost objects are pure collision objects that have no effect on rigid
bodies, but can be used to hook into the collision detection of Bullet.

This way Blender can utilize the optimized collision detection in Bullet
as well as its contact caching, which is necessary for stable collision
response in many softbody-type algorithms that implement Coulomb
friction cones.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index d464154..607617c 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -57,6 +57,9 @@ typedef struct rbDynamicsWorld rbDynamicsWorld;
 /* Rigid Body */
 typedef struct rbRigidBody rbRigidBody;
 
+/* Ghost Collision Object */
+typedef struct rbGhostObject rbGhostObject;
+
 /* Collision Shape */
 typedef struct rbCollisionShape rbCollisionShape;
 
@@ -190,7 +193,6 @@ void RB_body_set_activation_state(rbRigidBody *body, int 
use_deactivation);
 void RB_body_activate(rbRigidBody *body);
 void RB_body_deactivate(rbRigidBody *body);
 
-
 /* Simulation --- */
 
 /* Get current transform matrix of RigidBody to use in Blender (OpenGL format) 
*/
@@ -213,6 +215,27 @@ void RB_body_get_orientation(rbRigidBody *body, float 
v_out[4]);
 void RB_body_apply_central_force(rbRigidBody *body, const float v_in[3]);
 
 /* ** */
+/* Ghost Collision Object Methods */
+
+/* Add ghost to dynamics world */
+void RB_dworld_add_ghost(rbDynamicsWorld *world, rbGhostObject *ghost, int 
col_groups);
+/* Remove ghost from dynamics world */
+void RB_dworld_remove_ghost(rbDynamicsWorld *world, rbGhostObject *ghost);
+
+/* Create new ghost instance */
+rbGhostObject *RB_ghost_new(rbCollisionShape *shape, const float loc[3], const 
float rot[4]);
+/* Delete the given ghost instance */
+void RB_ghost_delete(rbGhostObject *ghost);
+
+/* Collision Shape */
+void RB_ghost_set_collision_shape(rbGhostObject *body, rbCollisionShape 
*shape);
+
+/* Transform */
+void RB_ghost_get_transform_matrix(rbGhostObject *object, float m_out[4][4]);
+void RB_ghost_set_loc_rot(rbGhostObject *object, const float loc[3], const 
float rot[4]);
+void RB_ghost_set_scale(rbGhostObject *object, const float scale[3]);
+
+/* ** */
 /* Collision Shape Methods */
 
 /* Setup (Standard Shapes) --- */
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index 3cc39e6..fc264f6 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -69,6 +69,7 @@ subject to the following restrictions:
 #include "LinearMath/btTransform.h"
 #include "LinearMath/btConvexHullComputer.h"
 
+#include "BulletCollision/CollisionDispatch/btGhostObject.h"
 #include "BulletCollision/Gimpact/btGImpactShape.h"
 #include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
 #include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
@@ -81,9 +82,20 @@ struct rbDynamicsWorld {
btConstraintSolver *constraintSolver;
btOverlapFilterCallback *filterCallback;
 };
+
+/* common base for safe casting of user pointers in btCollisionObjects */
+struct rbCollisionObject {
+   int col_groups;
+};
+
 struct rbRigidBody {
+   rbCollisionObject base;
btRigidBody *body;
-   int col_groups;
+};
+
+struct rbGhostObject {
+   rbCollisionObject base;
+   btGhostObject *ghost;
 };
 
 struct rbVert {
@@ -110,8 +122,8 @@ struct rbFilterCallback : public btOverlapFilterCallback
 {
virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, 
btBroadphaseProxy *proxy1) const
{
-   rbRigidBody *rb0 = (rbRigidBody *)((btRigidBody 
*)proxy0->m_clientObject)->getUserPointer();
-   rbRigidBody *rb1 = (rbRigidBody *)((btRigidBody 
*)proxy1->m_clientObject)->getUserPointer();
+   rbCollisionObject *rb0 = (rbCollisionObject 
*)((btCollisionObject *)proxy0->m_clientObject)->getUserPointer();
+   rbCollisionObject *rb1 = (rbCollisionObject 
*)((btCollisionObject *)proxy1->m_clientObject)->getUserPointer();

bool collides;
collides = (proxy0->m_collisionFilterGroup & 
proxy1->m_collisionFilterMask) != 0;
@@ -258,7 +270,7 @@ void RB_dworld_export(rbDynamicsWorld *world, const char 
*filename)
 void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *object, int 
col_groups)
 {
btRigidBody *body = object->body;
-   object->col_groups = col_groups;
+   object->base.col_g

[Bf-blender-cvs] [2d34158] temp_bullet_ghosts: Reorganizing Bullet world rebuilding in scene updates to allow pure collision-only time steps and (uncached) ghost objects.

2015-04-29 Thread Lukas Tönne
Commit: 2d341589e4b262febc74d0414b9af8bc9b126a53
Author: Lukas Tönne
Date:   Mon Dec 29 13:34:10 2014 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB2d341589e4b262febc74d0414b9af8bc9b126a53

Reorganizing Bullet world rebuilding in scene updates to allow pure
collision-only time steps and (uncached) ghost objects.

This will allow non-rigidbody sims (e.g. hair, softbody) to hook into
bullet collision detection via "ghost objects". These are Bullet objects
without rigid body dynamics (btCollisionObject). The contacts are
generated just like for rigid bodies, but their internal solvers can
then work like before without having to use Bullet stepping.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp
M   source/blender/blenkernel/intern/rigidbody.c

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 688ca91..d464154 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -93,6 +93,8 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int 
split_impulse);
 
 /* Step the simulation by the desired amount (in seconds) with extra controls 
on substep sizes and maximum substeps */
 void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int 
maxSubSteps, float timeSubStep);
+/* Perform collision detection step only */
+void RB_dworld_test_collision(rbDynamicsWorld *world);
 
 /* Export -- */
 
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index 17bb381..3cc39e6 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -218,6 +218,11 @@ void RB_dworld_step_simulation(rbDynamicsWorld *world, 
float timeStep, int maxSu
world->dynamicsWorld->stepSimulation(timeStep, maxSubSteps, 
timeSubStep);
 }
 
+void RB_dworld_test_collision(rbDynamicsWorld *world)
+{
+   world->dynamicsWorld->performDiscreteCollisionDetection();
+}
+
 /* Export -- */
 
 /**
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index aaf54b8..191f718 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1149,6 +1149,12 @@ void BKE_rigidbody_remove_constraint(Scene *scene, 
Object *ob)
 /* ** */
 /* Simulation Interface - Bullet */
 
+/* Update mode flags for simulation stepping to indicate needed updates */
+enum eRigidBodyStepMode {
+   RB_STEP_COLLISION = 1,
+   RB_STEP_DYNAMICS = 2 | RB_STEP_COLLISION, /* dynamics time step 
includes collision detection */
+};
+
 /* Update object array and rigid body count so they're in sync with the rigid 
body group */
 static void rigidbody_update_ob_array(RigidBodyWorld *rbw)
 {
@@ -1168,6 +1174,8 @@ static void rigidbody_update_ob_array(RigidBodyWorld *rbw)
}
 }
 
+/* -- */
+
 static void rigidbody_update_sim_world(Scene *scene, RigidBodyWorld *rbw)
 {
float adj_gravity[3];
@@ -1188,6 +1196,24 @@ static void rigidbody_update_sim_world(Scene *scene, 
RigidBodyWorld *rbw)
rigidbody_update_ob_array(rbw);
 }
 
+/**
+ * Updates and validates the collision world.
+ *
+ * \param rebuild Rebuild entire simulation
+ */
+static int rigidbody_update_scene(Scene *scene, RigidBodyWorld *rbw, bool 
rebuild)
+{
+   /* update world */
+   if (rebuild)
+   BKE_rigidbody_validate_sim_world(scene, rbw, true);
+   
+   rigidbody_update_sim_world(scene, rbw);
+   
+   return 0;
+}
+
+/* -- */
+
 static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object 
*ob, RigidBodyOb *rbo)
 {
float loc[3];
@@ -1273,19 +1299,15 @@ static void rigidbody_update_sim_ob(Scene *scene, 
RigidBodyWorld *rbw, Object *o
 }
 
 /**
- * Updates and validates world, bodies and shapes.
+ * Updates and validates rigid body objects.
  *
  * \param rebuild Rebuild entire simulation
  */
-static void rigidbody_update_simulation(Scene *scene, RigidBodyWorld *rbw, 
bool rebuild)
+static int rigidbody_update_objects(Scene *scene, RigidBodyWorld *rbw, bool 
rebuild)
 {
+   int result = 0;
GroupObject *go;
 
-   /* update world */
-   if (rebuild)
-   BKE_rigidbody_validate_sim_world(scene, rbw, true);
-   rigidbody_update_sim_world(scene, rbw);
-
/* XXX TODO For rebuild: remove all constraints first.
 * Otherwise we can end up deleting objects that are still
 * referenced by constraints, corrupting bullet's internal list.
@@ -1323,7 +1345,7 @@ static void rigidbody_update_simulation(Scene *scene, 
RigidBodyWorld *rbw, bool
 */
ob->rigidbody_object = 

[Bf-blender-cvs] [c8bf0aa] temp_bullet_ghosts: Refactoring internal btCollisionShape storage in the rbCollisionShape wrapper class.

2015-04-29 Thread Lukas Tönne
Commit: c8bf0aa5c4146d2b01a19510df9ed3329ad96826
Author: Lukas Tönne
Date:   Thu Jan 1 15:05:35 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rBc8bf0aa5c4146d2b01a19510df9ed3329ad96826

Refactoring internal btCollisionShape storage in the rbCollisionShape
wrapper class.

Now there are a matching subclasses of `rbCollisionShape` for each of
the used `btCollisionShape` equivalents. They store a bt shapes as
direct members, which means the internal memory allocation can be
largely avoided later, which is useful for efficient creation of many
shapes in mempools etc.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 1928230..b407e01 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -254,6 +254,7 @@ rbCollisionShape *RB_shape_new_convex_hull(float *verts, 
int stride, int count,
 
 /* 1 */
 rbMeshData *RB_trimesh_data_new(int num_tris, int num_verts);
+void RB_trimesh_data_delete(rbMeshData *mesh);
 void RB_trimesh_add_vertices(rbMeshData *mesh, float *vertices, int num_verts, 
int vert_stride);
 void RB_trimesh_add_triangle_indices(rbMeshData *mesh, int num, int index0, 
int index1, int index2);
 void RB_trimesh_finish(rbMeshData *mesh);
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index de9f7bb..c1d170d 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -114,10 +114,122 @@ struct rbMeshData {
 };
 
 struct rbCollisionShape {
-   btCollisionShape *cshape;
+   virtual ~rbCollisionShape()
+   {}
+   
+   virtual btCollisionShape *get_cshape() = 0;
+};
+
+struct rbBoxShape : public rbCollisionShape {
+   rbBoxShape(float x, float y, float z) :
+   cshape(btVector3(x, y, z))
+   {}
+   
+   btBoxShape cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbSphereShape : public rbCollisionShape {
+   rbSphereShape(float radius) :
+   cshape(radius)
+   {}
+   
+   btSphereShape cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbCapsuleShape : public rbCollisionShape {
+   rbCapsuleShape(float radius, float height) :
+   cshape(radius, height)
+   {}
+   
+   btCapsuleShape cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbConeShape : public rbCollisionShape {
+   rbConeShape(float radius, float height) :
+   cshape(radius, height)
+   {}
+   
+   btConeShapeZ cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbCylinderShape : public rbCollisionShape {
+   rbCylinderShape(float radius, float height) :
+   cshape(btVector3(radius, radius, height))
+   {}
+   
+   btCylinderShapeZ cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbConvexHullShape : public rbCollisionShape {
+   rbConvexHullShape(float *verts, int stride, int count, float margin, 
bool *can_embed) {
+   btConvexHullComputer hull_computer = btConvexHullComputer();
+   
+   // try to embed the margin, if that fails don't shrink the hull
+   if (hull_computer.compute(verts, stride, count, margin, 0.0f) < 
0.0f) {
+   hull_computer.compute(verts, stride, count, 0.0f, 0.0f);
+   *can_embed = false;
+   }
+   
+   cshape = btConvexHullShape(&(hull_computer.vertices[0].getX()), 
hull_computer.vertices.size());
+   }
+   
+   btConvexHullShape cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+};
+
+struct rbTriangleMeshShape : public rbCollisionShape {
+   rbTriangleMeshShape(rbMeshData *mesh) :
+   cshape_unscaled(mesh->index_array, true, true),
+   cshape(&cshape_unscaled, btVector3(1.0f, 1.0f, 1.0f)),
+   mesh(mesh)
+   {}
+   
+   ~rbTriangleMeshShape()
+   {
+   if (mesh)
+   RB_trimesh_data_delete(mesh);
+   }
+   
+   btBvhTriangleMeshShape cshape_unscaled;
+   btScaledBvhTriangleMeshShape cshape;
+   btCollisionShape *get_cshape() { return &cshape; }
+   rbMeshData *mesh;
+};
+
+struct rbGImpactMeshShape : public rbCollisionShape {
+   rbGImpactMeshShape(rbMeshData *mesh) :
+   cshape(mesh->index_array),
+   mesh(mesh)
+   {
+   // TODO: add this to the update collision margin call?
+   cshape.updateBound();
+   }
+   
+   ~rbGImpactMeshShape()
+   {
+   if (mesh)
+   RB_trimesh_data_delete(mesh);
+   }
+ 

[Bf-blender-cvs] [9d8dcff] temp_bullet_ghosts: API for compound collision shapes in the Blender RigidBody module.

2015-04-29 Thread Lukas Tönne
Commit: 9d8dcff46cd6cb35a9f3cfdca4190d5d0d1c1a0e
Author: Lukas Tönne
Date:   Wed Dec 31 14:32:30 2014 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB9d8dcff46cd6cb35a9f3cfdca4190d5d0d1c1a0e

API for compound collision shapes in the Blender RigidBody module.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index 607617c..1928230 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -262,6 +262,17 @@ rbCollisionShape *RB_shape_new_trimesh(rbMeshData *mesh);
 /* 2b - GImpact Meshes */
 rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh);
 
+/* Setup (Compound) -- */
+
+rbCollisionShape *RB_shape_new_compound(bool enable_dynamic_aabb_tree);
+void RB_shape_compound_add_child_shape(rbCollisionShape *shape, const float 
loc[3], const float rot[4], rbCollisionShape *child);
+int RB_shape_compound_get_num_child_shapes(rbCollisionShape *shape);
+rbCollisionShape *RB_shape_compound_get_child_shape(rbCollisionShape *shape, 
int index);
+void RB_shape_compound_get_child_transform(rbCollisionShape *shape, int index, 
float mat[4][4]);
+/* Note: after updating transforms, RB_shape_compound_update_local_aabb should 
be called! */
+void RB_shape_compound_set_child_transform(rbCollisionShape *shape, int index, 
const float loc[3], const float rot[4]);
+void RB_shape_compound_update_local_aabb(rbCollisionShape *shape);
+
 
 /* Cleanup --- */
 
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index fc264f6..de9f7bb 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -896,6 +896,70 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData 
*mesh)
return shape;
 }
 
+/* Setup (Compound) -- */
+
+rbCollisionShape *RB_shape_new_compound(bool enable_dynamic_aabb_tree)
+{
+   rbCollisionShape *shape = new rbCollisionShape;
+   shape->cshape = new btCompoundShape(enable_dynamic_aabb_tree);
+   shape->mesh = NULL;
+   return shape;
+}
+
+void RB_shape_compound_add_child_shape(rbCollisionShape *shape, const float 
loc[3], const float rot[4], rbCollisionShape *child)
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   btTransform trans(btQuaternion(rot[1], rot[2], rot[3], rot[0]), 
btVector3(loc[0], loc[1], loc[2]));
+   cshape->addChildShape(trans, child->cshape);
+}
+
+int RB_shape_compound_get_num_child_shapes(rbCollisionShape *shape)
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   return cshape->getNumChildShapes();
+}
+
+rbCollisionShape *RB_shape_compound_get_child_shape(rbCollisionShape *shape, 
int index)
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   /* rbCollisionShape is just a typedef */
+   return reinterpret_cast(cshape->getChildShape(index));
+}
+
+void RB_shape_compound_get_child_transform(rbCollisionShape *shape, int index, 
float mat[4][4])
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   const btTransform &trans = cshape->getChildTransform(index);
+   trans.getOpenGLMatrix((btScalar *)mat);
+}
+
+void RB_shape_compound_set_child_transform(rbCollisionShape *shape, int index, 
const float loc[3], const float rot[4])
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   btTransform trans(btQuaternion(rot[1], rot[2], rot[3], rot[0]), 
btVector3(loc[0], loc[1], loc[2]));
+   /* no AABB update at this point, callers must do this explicitly after 
updating transforms */
+   cshape->updateChildTransform(index, trans, false);
+}
+
+void RB_shape_compound_update_local_aabb(rbCollisionShape *shape)
+{
+   assert(shape->cshape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE);
+   btCompoundShape *cshape = static_cast(shape->cshape);
+   
+   cshape->recalculateLocalAabb();
+}
+
+
 /* Cleanup --- */
 
 void RB_shape_delete(rbCollisionShape *shape)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2e55359] temp_bullet_ghosts: "Init" variants of shape constructor functions for simple implicit shapes.

2015-04-29 Thread Lukas Tönne
Commit: 2e553592ac8989c7eb8a025343a286009cacfec3
Author: Lukas Tönne
Date:   Thu Jan 1 15:26:59 2015 +0100
Branches: temp_bullet_ghosts
https://developer.blender.org/rB2e553592ac8989c7eb8a025343a286009cacfec3

"Init" variants of shape constructor functions for simple implicit
shapes.

These functions allow external memory allocation (using the associated
***_size values) for efficiency. An array or memory pool can then be
used to create lots of shapes and initialize them with the internal
Bullet data using the API.

Note that doing this for mesh-based shapes (triangle mesh, GImpact and
convex hull shapes) is not very useful, because they allocate data
internally and should not be created in massive numbers. The init
variants are supposed to be used for small fixed-size shapes (boxes,
spheres, etc.) which can then be combined into compound shapes.

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index b407e01..6b5b670 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -241,10 +241,24 @@ void RB_ghost_set_scale(rbGhostObject *object, const 
float scale[3]);
 /* Setup (Standard Shapes) --- */
 
 rbCollisionShape *RB_shape_new_box(float x, float y, float z);
+rbCollisionShape *RB_shape_init_box(void *mem, float x, float y, float z);
+extern const size_t RB_shape_size_box;
+
 rbCollisionShape *RB_shape_new_sphere(float radius);
+rbCollisionShape *RB_shape_init_sphere(void *mem, float radius);
+extern const size_t RB_shape_size_sphere;
+
 rbCollisionShape *RB_shape_new_capsule(float radius, float height);
+rbCollisionShape *RB_shape_init_capsule(void *mem, float radius, float height);
+extern const size_t RB_shape_size_capsule;
+
 rbCollisionShape *RB_shape_new_cone(float radius, float height);
+rbCollisionShape *RB_shape_init_cone(void *mem, float radius, float height);
+extern const size_t RB_shape_size_cone;
+
 rbCollisionShape *RB_shape_new_cylinder(float radius, float height);
+rbCollisionShape *RB_shape_init_cylinder(void *mem, float radius, float 
height);
+extern const size_t RB_shape_size_cylinder;
 
 /* Setup (Convex Hull)  */
 
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index c1d170d..d4d4950 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -860,26 +860,61 @@ rbCollisionShape *RB_shape_new_box(float x, float y, 
float z)
return new rbBoxShape(x, y, z);
 }
 
+rbCollisionShape *RB_shape_init_box(void *mem, float x, float y, float z)
+{
+   return new (mem) rbBoxShape(x, y, z);
+}
+
+const size_t RB_shape_size_box = sizeof(rbBoxShape);
+
 rbCollisionShape *RB_shape_new_sphere(float radius)
 {
return new rbSphereShape(radius);
 }
 
+rbCollisionShape *RB_shape_init_sphere(void *mem, float radius)
+{
+   return new (mem) rbSphereShape(radius);
+}
+
+const size_t RB_shape_size_sphere = sizeof(rbSphereShape);
+
 rbCollisionShape *RB_shape_new_capsule(float radius, float height)
 {
return new rbCapsuleShape(radius, height);
 }
 
+rbCollisionShape *RB_shape_init_capsule(void *mem, float radius, float height)
+{
+   return new (mem) rbCapsuleShape(radius, height);
+}
+
+const size_t RB_shape_size_capsule = sizeof(rbCapsuleShape);
+
 rbCollisionShape *RB_shape_new_cone(float radius, float height)
 {
return new rbConeShape(radius, height);
 }
 
+rbCollisionShape *RB_shape_init_cone(void *mem, float radius, float height)
+{
+   return new (mem) rbConeShape(radius, height);
+}
+
+const size_t RB_shape_size_cone = sizeof(rbConeShape);
+
 rbCollisionShape *RB_shape_new_cylinder(float radius, float height)
 {
return new rbCylinderShape(radius, height);
 }
 
+rbCollisionShape *RB_shape_init_cylinder(void *mem, float radius, float height)
+{
+   return new (mem) rbCylinderShape(radius, height);
+}
+
+const size_t RB_shape_size_cylinder = sizeof(rbCylinderShape);
+
 /* Setup (Convex Hull)  */
 
 rbCollisionShape *RB_shape_new_convex_hull(float *verts, int stride, int 
count, float margin, bool *can_embed)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs