[Bf-blender-cvs] [6667273] soc-2016-pbvh-painting: Fixed paint_intern.h header.

2016-08-23 Thread Nathan Vollmer
Commit: 6667273bb18ba7725b0d625e714579c330e6d938
Author: Nathan Vollmer
Date:   Tue Aug 23 18:18:08 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB6667273bb18ba7725b0d625e714579c330e6d938

Fixed paint_intern.h header.

===

M   source/blender/editors/sculpt_paint/paint_intern.h
M   source/blender/editors/sculpt_paint/paint_vertex.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_intern.h 
b/source/blender/editors/sculpt_paint/paint_intern.h
index 7d0271d..00f7fb4 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -27,11 +27,7 @@
 /** \file blender/editors/sculpt_paint/paint_intern.h
  *  \ingroup edsculpt
  */
-
 #include "ED_view3d.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_mesh_mapping.h"
-#include "BLI_stack.h"
 
 #ifndef __PAINT_INTERN_H__
 #define __PAINT_INTERN_H__
@@ -58,6 +54,8 @@ struct wmOperator;
 struct wmOperatorType;
 struct wmWindowManager;
 struct DMCoNo;
+struct BLI_Stack;
+struct MeshElemMap;
 enum PaintMode;
 
 /* paint_stroke.c */
@@ -113,37 +111,6 @@ struct WeightPaintGroupData {
const bool *lock;
 };
 
-typedef struct WPaintData {
-   ViewContext vc;
-   int *indexar;
-
-   struct WeightPaintGroupData active, mirror;
-
-   void *vp_handle;
-   DMCoNo *vertexcosnos;
-
-   float wpimat[3][3];
-
-   /* variables for auto normalize */
-   const bool *vgroup_validmap; /* stores if vgroups tie to deforming 
bones or not */
-   const bool *lock_flags;
-
-   /* variables for multipaint */
-   const bool *defbase_sel;  /* set of selected groups */
-   int defbase_tot_sel;  /* number of selected groups */
-   bool do_multipaint;   /* true if multipaint enabled and 
multiple groups selected */
-
-   /* variables for blur */
-   struct {
-   MeshElemMap *vmap;
-   int *vmap_mem;
-   } blur_data;
-
-   BLI_Stack *accumulate_stack;  /* for reuse (WPaintDefer) */
-
-   int defbase_tot;
-} WPaintData;
-
 /* struct to avoid passing many args each call to do_weight_paint_vertex()
  * this _could_ be made a part of the operators 'WPaintData' struct, or at
  * least a member, but for now keep its own struct, initialized on every
@@ -175,12 +142,12 @@ typedef struct WeightPaintInfo {
 
 /* paint_vertex.c */
 typedef struct VPaintData {
-   ViewContext vc;
+   struct ViewContext vc;
unsigned int paintcol;
int *indexar;
 
struct VertProjHandle *vp_handle;
-   DMCoNo *vertexcosnos;
+   struct DMCoNo *vertexcosnos;
 
float vpimat[3][3];
 
@@ -195,6 +162,38 @@ typedef struct VPaintData {
bool is_texbrush;
 } VPaintData;
 
+typedef struct WPaintData {
+  struct ViewContext vc;
+  int *indexar;
+
+  struct WeightPaintGroupData active, mirror;
+
+  void *vp_handle;
+  struct DMCoNo *vertexcosnos;
+
+  float wpimat[3][3];
+
+  /* variables for auto normalize */
+  const bool *vgroup_validmap; /* stores if vgroups tie to deforming bones or 
not */
+  const bool *lock_flags;
+
+  /* variables for multipaint */
+  const bool *defbase_sel;  /* set of selected groups */
+  int defbase_tot_sel;  /* number of selected groups */
+  bool do_multipaint;   /* true if multipaint enabled and multiple 
groups selected */
+
+  /* variables for blur */
+  struct {
+struct MeshElemMap *vmap;
+int *vmap_mem;
+  } blur_data;
+
+  struct BLI_Stack *accumulate_stack;  /* for reuse (WPaintDefer) */
+
+  int defbase_tot;
+} WPaintData;
+
+
 int weight_paint_poll(struct bContext *C);
 int weight_paint_mode_poll(struct bContext *C);
 int vertex_paint_poll(struct bContext *C);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index b7c84bb..e7ce986 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2409,12 +2409,12 @@ static void do_wpaint_brush_blur_task_cb_ex(
   }
   if (totalHitLoops != 0) {
 const float fade = BKE_brush_curve_strength(brush, test.dist, 
cache->radius);
-   const float dot = dot_vf3vs3(cache->sculpt_normal_symm, vd.no);
+const float dot = dot_vf3vs3(cache->sculpt_normal_symm, vd.no);
 
-   finalColor /= totalHitLoops;
-   if (dot > 0.0) {
+finalColor /= totalHitLoops;
+if (dot > 0.0) {
   do_weight_paint_vertex(data->vp, data->ob, data->wpi, vertexIndex, 
dot * fade * bstrength, (float)finalColor);
-   }
+}
   }
 }
 BKE_pbvh_vertex_iter_end;
@@ -2453,7 +2453,7 @@ static void do_wpaint_brush_smudge_task_cb_ex(
 //Minimum dot product between brush direction and current to neighbor 
direction is 0.0, 

[Bf-blender-cvs] [c246652] soc-2016-pbvh-painting: Made average color arrays cleaner.

2016-08-23 Thread Nathan Vollmer
Commit: c24665258da22e484964186ac6ec700acf06ddb2
Author: Nathan Vollmer
Date:   Tue Aug 23 11:30:54 2016 -0600
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBc24665258da22e484964186ac6ec700acf06ddb2

Made average color arrays cleaner.

===

M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/intern/paint.c
M   source/blender/editors/sculpt_paint/paint_vertex.c

===

diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index 2e65c72..a75edc6 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -209,10 +209,7 @@ typedef struct SculptSession {
int *poly_map_mem;
MeshElemMap* vert_to_poly;
 
-   unsigned long* totalRed;
-   unsigned long* totalGreen;
-   unsigned long* totalBlue;
-   unsigned long* totalAlpha;
+   unsigned long* totalColor;
double* totalWeight;
unsigned int *totloopsHit;
float *maxWeight;
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index bcb4ad9..7ac98fa 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -760,15 +760,10 @@ void BKE_sculptsession_free(Object *ob)
/* Free average brush arrays */
if (ob->sculpt->totloopsHit)
MEM_freeN(ob->sculpt->totloopsHit);
-   if (ob->sculpt->totalRed)
-   MEM_freeN(ob->sculpt->totalRed);
-   if (ob->sculpt->totalGreen)
-   MEM_freeN(ob->sculpt->totalGreen);
-   if (ob->sculpt->totalBlue)
-   MEM_freeN(ob->sculpt->totalBlue);
-   if (ob->sculpt->totalAlpha)
-   MEM_freeN(ob->sculpt->totalAlpha);
-   if (ob->sculpt->totalWeight)
+
+   if (ob->sculpt->totalColor)
+   MEM_freeN(ob->sculpt->totalColor);
+
MEM_freeN(ob->sculpt->totalWeight);
if (ob->sculpt->maxWeight)
MEM_freeN(ob->sculpt->maxWeight);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index ed93947..b7c84bb 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1742,10 +1742,9 @@ static void 
vertex_paint_init_session_average_arrays(Object *ob){
//I think the totNodes might include internal nodes, and we really only 
need the tot leaves.
BKE_pbvh_node_num_nodes(ob->sculpt->pbvh, );
Mesh *me = BKE_mesh_from_object(ob);
-   ob->sculpt->totalRed = MEM_callocN(totNode*sizeof(unsigned long), 
"totalRed");
-   ob->sculpt->totalGreen = MEM_callocN(totNode * sizeof(unsigned long), 
"totalGreen");
-   ob->sculpt->totalBlue = MEM_callocN(totNode * sizeof(unsigned long), 
"totalBlue");
-   ob->sculpt->totalAlpha = MEM_callocN(totNode * sizeof(unsigned long), 
"totalAlpha");
+
+   //Need unsigned long to prevent overflow when averaging multiple 
whites, which take up an entire unsigned int each.
+   ob->sculpt->totalColor = MEM_callocN(totNode * 3 * sizeof(unsigned 
long), "totalColor");
ob->sculpt->totalWeight = MEM_callocN(totNode * sizeof(double), 
"totalWeight");
ob->sculpt->totloopsHit = MEM_callocN(totNode * sizeof(unsigned int), 
"totloopsHit");
   ob->sculpt->maxWeight = MEM_callocN(me->totvert * sizeof(float), 
"maxWeight");
@@ -3015,9 +3014,13 @@ static int vpaint_mode_toggle_exec(bContext *C, 
wmOperator *op)
BKE_paint_init(scene, ePaintVertex, PAINT_CURSOR_VERTEX_PAINT);
 
/* Create vertex/weight paint mode session data */
-   if (ob->sculpt)
+   if (ob->sculpt) {
+   if (ob->sculpt->cache){
+   sculpt_cache_free(ob->sculpt->cache);
+   ob->sculpt->cache = NULL;
+   }
BKE_sculptsession_free(ob);
-
+   }
vertex_paint_init_session(scene, ob);
 
/* Cache needs to be initialized before mesh_build_data is 
called. */
@@ -3227,7 +3230,7 @@ static void do_vpaint_brush_calc_ave_color_cb_ex(
SculptSession *ss = data->ob->sculpt;
StrokeCache *cache = ss->cache;
unsigned int *lcol = data->lcol;
-   unsigned long blend[4] = { 0 };
+   unsigned long blend[3] = { 0 };
char *col;
data->ob->sculpt->totloopsHit[n] = 0;
 
@@ -3252,16 +3255,14 @@ static void do_vpaint_brush_calc_ave_color_cb_ex(
blend[0] += (long)col[0] * (long)col[0];
blend[1] += (long)col[1] * 

[Bf-blender-cvs] [d99c513] master: Cycles OpenCL: use AoS rather than SoA storage for ShaderData.

2016-08-23 Thread Brecht Van Lommel
Commit: d99c513afaf76324406c582304a2d7bf85fbc3a0
Author: Brecht Van Lommel
Date:   Wed Aug 24 01:44:48 2016 +0200
Branches: master
https://developer.blender.org/rBd99c513afaf76324406c582304a2d7bf85fbc3a0

Cycles OpenCL: use AoS rather than SoA storage for ShaderData.

Fixes part of the performance regressions compared to 2.76b, see T49046, T48876.

===

M   intern/cycles/kernel/kernel_types.h

===

diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index e299406..3152ec6 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -745,7 +745,7 @@ enum ShaderDataFlag {
 
 #ifdef __SPLIT_KERNEL__
 #  define SD_THREAD (get_global_id(1) * get_global_size(0) + get_global_id(0))
-#  if defined(__SPLIT_KERNEL_AOS__)
+#  if !defined(__SPLIT_KERNEL_SOA__)
  /* ShaderData is stored as an Array-of-Structures */
 #define ccl_soa_member(type, name) type soa_##name
 #define ccl_fetch(s, t) (s[SD_THREAD].soa_##t)

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


[Bf-blender-cvs] [8f4818c] experimental-build: Revert "Squashed soc-2016-cycles_denoising branch, second version (state da59443ed985)"

2016-08-23 Thread Lukas Stockner
Commit: 8f4818c6f7676dbe856282593a24ade1f9c5c05a
Author: Lukas Stockner
Date:   Tue Aug 23 23:03:45 2016 +0200
Branches: experimental-build
https://developer.blender.org/rB8f4818c6f7676dbe856282593a24ade1f9c5c05a

Revert "Squashed soc-2016-cycles_denoising branch, second version (state 
da59443ed985)"

This reverts commit ec96ba5c39e57aecbaf9f554cc43b01cf405ac9d.

===

M   CMakeLists.txt
M   intern/cycles/CMakeLists.txt
M   intern/cycles/app/CMakeLists.txt
D   intern/cycles/app/cycles_denoising.cpp
D   intern/cycles/app/cycles_denoising.h
M   intern/cycles/app/cycles_standalone.cpp
D   intern/cycles/app/cycles_standalone.h
M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_session.h
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h
M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/device/device_opencl.cpp
M   intern/cycles/device/device_task.cpp
M   intern/cycles/device/device_task.h
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/bvh/bvh.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/geom/geom_triangle.h
M   intern/cycles/kernel/kernel_accumulate.h
M   intern/cycles/kernel/kernel_bake.h
M   intern/cycles/kernel/kernel_compat_cpu.h
M   intern/cycles/kernel/kernel_compat_cuda.h
D   intern/cycles/kernel/kernel_filter.h
D   intern/cycles/kernel/kernel_filter_pre.h
D   intern/cycles/kernel/kernel_filter_util.h
M   intern/cycles/kernel/kernel_light.h
M   intern/cycles/kernel/kernel_passes.h
M   intern/cycles/kernel/kernel_path.h
M   intern/cycles/kernel/kernel_path_branched.h
M   intern/cycles/kernel/kernel_path_state.h
M   intern/cycles/kernel/kernel_path_surface.h
M   intern/cycles/kernel/kernel_projection.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel.cu
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_displace.h
M   intern/cycles/kernel/svm/svm_image.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h
M   intern/cycles/render/film.cpp
M   intern/cycles/render/film.h
M   intern/cycles/render/integrator.cpp
M   intern/cycles/render/integrator.h
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/session.cpp
M   intern/cycles/render/session.h
M   intern/cycles/render/tile.cpp
M   intern/cycles/render/tile.h
M   intern/cycles/util/util_debug.cpp
M   intern/cycles/util/util_debug.h
D   intern/cycles/util/util_math_matrix.h
M   intern/cycles/util/util_simd.h
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   intern/cycles/util/util_types.h
M   release/scripts/startup/bl_ui/space_image.py
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_image/image_intern.h
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/render/extern/include/RE_engine.h
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/include/render_result.h
M   source/blender/render/intern/source/external_engine.c
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c
M   source/blender/windowmanager/WM_api.h
M   source/blenderplayer/bad_level_call_stubs/stubs.c


[Bf-blender-cvs] [ec96ba5] experimental-build: Squashed soc-2016-cycles_denoising branch, second version (state da59443ed985)

2016-08-23 Thread Lukas Stockner
Commit: ec96ba5c39e57aecbaf9f554cc43b01cf405ac9d
Author: Lukas Stockner
Date:   Tue Aug 23 23:03:11 2016 +0200
Branches: experimental-build
https://developer.blender.org/rBec96ba5c39e57aecbaf9f554cc43b01cf405ac9d

Squashed soc-2016-cycles_denoising branch, second version (state da59443ed985)

===

M   CMakeLists.txt
M   intern/cycles/CMakeLists.txt
M   intern/cycles/app/CMakeLists.txt
A   intern/cycles/app/cycles_denoising.cpp
A   intern/cycles/app/cycles_denoising.h
M   intern/cycles/app/cycles_standalone.cpp
A   intern/cycles/app/cycles_standalone.h
M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_session.h
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h
M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/device/device_opencl.cpp
M   intern/cycles/device/device_task.cpp
M   intern/cycles/device/device_task.h
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/bvh/bvh.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/geom/geom_triangle.h
M   intern/cycles/kernel/kernel_accumulate.h
M   intern/cycles/kernel/kernel_bake.h
M   intern/cycles/kernel/kernel_compat_cpu.h
M   intern/cycles/kernel/kernel_compat_cuda.h
A   intern/cycles/kernel/kernel_filter.h
A   intern/cycles/kernel/kernel_filter_pre.h
A   intern/cycles/kernel/kernel_filter_util.h
M   intern/cycles/kernel/kernel_light.h
M   intern/cycles/kernel/kernel_passes.h
M   intern/cycles/kernel/kernel_path.h
M   intern/cycles/kernel/kernel_path_branched.h
M   intern/cycles/kernel/kernel_path_state.h
M   intern/cycles/kernel/kernel_path_surface.h
M   intern/cycles/kernel/kernel_projection.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel.cu
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_displace.h
M   intern/cycles/kernel/svm/svm_image.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h
M   intern/cycles/render/film.cpp
M   intern/cycles/render/film.h
M   intern/cycles/render/integrator.cpp
M   intern/cycles/render/integrator.h
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/session.cpp
M   intern/cycles/render/session.h
M   intern/cycles/render/tile.cpp
M   intern/cycles/render/tile.h
M   intern/cycles/util/util_debug.cpp
M   intern/cycles/util/util_debug.h
A   intern/cycles/util/util_math_matrix.h
M   intern/cycles/util/util_simd.h
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   intern/cycles/util/util_types.h
M   release/scripts/startup/bl_ui/space_image.py
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_image/image_intern.h
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/render/extern/include/RE_engine.h
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/include/render_result.h
M   source/blender/render/intern/source/external_engine.c
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c
M   source/blender/windowmanager/WM_api.h
M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git 

[Bf-blender-cvs] [da59443] soc-2016-cycles_denoising: Fix two compilation issues

2016-08-23 Thread Lukas Stockner
Commit: da59443ed9854c346f8a45f0023a805288d3ce0a
Author: Lukas Stockner
Date:   Tue Aug 23 23:01:11 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rBda59443ed9854c346f8a45f0023a805288d3ce0a

Fix two compilation issues

===

M   CMakeLists.txt
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f264d05..7426afb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -724,6 +724,9 @@ if(WITH_CYCLES)
if(WITH_CYCLES_OSL)
set(WITH_LLVM ON CACHE BOOL "" FORCE)
endif()
+   if(WITH_CYCLES_DEBUG_FPE AND APPLE)
+   message(FATAL_ERROR "WITH_CYCLES_DEBUG_FPE is not supported on 
OSX!")
+   endif()
 else()
set(WITH_CYCLES_OSL OFF)
 endif()
diff --git a/intern/cycles/util/util_system.cpp 
b/intern/cycles/util/util_system.cpp
index 9e51f24..1001c28 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -282,6 +282,7 @@ bool system_cpu_support_avx2()
 
 #endif
 
+#ifdef WITH_CYCLES_DEBUG_FPE
 static void system_enable_fpe()
 {
 #ifdef __GNUC__
@@ -330,5 +331,7 @@ scoped_fpe::~scoped_fpe()
}
 }
 
+#endif
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h
index 83cee1b..c627c9e 100644
--- a/intern/cycles/util/util_system.h
+++ b/intern/cycles/util/util_system.h
@@ -38,6 +38,7 @@ bool system_cpu_support_sse41();
 bool system_cpu_support_avx();
 bool system_cpu_support_avx2();
 
+#ifdef WITH_CYCLES_DEBUG_FPE
 typedef enum FPEState
 {
FPE_ENABLED,
@@ -52,6 +53,7 @@ public:
 private:
bool was_enabled;
 };
+#endif
 
 CCL_NAMESPACE_END
 
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c 
b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 0451d66..d51c78f 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -651,7 +651,7 @@ struct RenderData *RE_engine_get_render_data(struct Render 
*re) RET_NULL
 void RE_engine_update_result(struct RenderEngine *engine, struct RenderResult 
*result) RET_NONE
 void RE_engine_update_progress(struct RenderEngine *engine, float progress) 
RET_NONE
 void RE_engine_set_error_message(RenderEngine *engine, const char *msg) 
RET_NONE
-void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, 
int cancel, int merge_results) RET_NONE
+void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, 
int cancel, int highlight, int merge_results) RET_NONE
 void RE_engine_update_stats(RenderEngine *engine, const char *stats, const 
char *info) RET_NONE
 void RE_layer_load_from_file(struct RenderLayer *layer, struct ReportList 
*reports, const char *filename, int x, int y) RET_NONE
 void RE_result_load_from_file(struct RenderResult *result, struct ReportList 
*reports, const char *filename) RET_NONE

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


[Bf-blender-cvs] [e484fe8] master: Usual i18n/UI messages fixes.

2016-08-23 Thread Bastien Montagne
Commit: e484fe84cdc6a00bebc4bf4afd69785f00e9547a
Author: Bastien Montagne
Date:   Tue Aug 23 22:03:18 2016 +0200
Branches: master
https://developer.blender.org/rBe484fe84cdc6a00bebc4bf4afd69785f00e9547a

Usual i18n/UI messages fixes.

===

M   release/scripts/modules/bl_i18n_utils/utils_spell_check.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py 
b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index d2049ea..c3b72b7 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -477,6 +477,12 @@ class SpellChecker:
 "wpaint",
 "uvwarp",
 
+# UOC (Ugly Operator Categories)
+"cachefile",
+"paintcurve",
+"ptcache",
+"dpaint",
+
 # Algorithm/library names
 "ashikhmin",  # Ashikhmin-Shirley
 "beckmann",

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


[Bf-blender-cvs] [fe8b197] master: Fix T49150: make new 'operator categories' in search menu i18n-aware.

2016-08-23 Thread Bastien Montagne
Commit: fe8b197269fda1b6747c022eb93b2781353008d5
Author: Bastien Montagne
Date:   Tue Aug 23 21:48:16 2016 +0200
Branches: master
https://developer.blender.org/rBfe8b197269fda1b6747c022eb93b2781353008d5

Fix T49150: make new 'operator categories' in search menu i18n-aware.

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   source/blender/editors/interface/interface_regions.c

===

diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 
b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 5a3eda5..dc1ddbf 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -375,6 +375,7 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 walk_keymap_hierarchy(lvl[3], msgsrc)
 
 # Dump Messages
+operator_categories = {}
 def process_cls_list(cls_list):
 if not cls_list:
 return
@@ -391,6 +392,16 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 cls_id = bl_rna.identifier + "." + cls_id
 bl_rna = bl_rna.base
 return cls_id
+
+def operator_category(cls):
+"""Extract operators' categories, as displayed in 'search' space 
menu."""
+# NOTE: keep in sync with C code in 
ui_searchbox_region_draw_cb__operator().
+if issubclass(cls, bpy.types.OperatorProperties) and "_OT_" in 
cls.__name__:
+cat_id = cls.__name__.split("_OT_")[0]
+if cat_id not in operator_categories:
+cat_str = cat_id.capitalize() + ":"
+operator_categories[cat_id] = cat_str
+
 if verbose:
 print(cls_list)
 cls_list.sort(key=full_class_id)
@@ -402,6 +413,7 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 if (cls in blacklist_rna_class) or issubclass(cls, 
bpy.types.Operator):
 reports["rna_structs_skipped"].append(cls)
 else:
+operator_category(cls)
 walk_class(cls)
 # Recursively process subclasses.
 process_cls_list(cls.__subclasses__())
@@ -409,6 +421,11 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 # Parse everything (recursively parsing from bpy_struct "class"...).
 process_cls_list(bpy.types.ID.__base__.__subclasses__())
 
+# Finalize generated 'operator categories' messages.
+for cat_str in operator_categories.values():
+process_msg(msgs, bpy.app.translations.contexts.operator_default, 
cat_str, "Generated operator category",
+reports, check_ctxt_rna, settings)
+
 # And parse keymaps!
 from bpy_extras.keyconfig_utils import KM_HIERARCHY
 walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY")
diff --git a/source/blender/editors/interface/interface_regions.c 
b/source/blender/editors/interface/interface_regions.c
index c621fcf..c507401 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1380,6 +1380,7 @@ static void ui_searchbox_region_draw_cb__operator(const 
bContext *UNUSED(C), ARe
rect_pre.xmax = rect_post.xmin = rect.xmin + 
((rect.xmax - rect.xmin) / 4);
 
/* widget itself */
+   /* NOTE: i18n messages extracting tool does the same, 
please keep it in sync. */
{
wmOperatorType *ot = data->items.pointers[a];
 
@@ -1400,7 +1401,8 @@ static void ui_searchbox_region_draw_cb__operator(const 
bContext *UNUSED(C), ARe
}
 
rect_pre.xmax += 4;  /* sneaky, avoid showing 
ugly margin */
-   ui_draw_menu_item(>fstyle, _pre, 
text_pre, data->items.icons[a], state, false);
+   ui_draw_menu_item(>fstyle, _pre, 
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
+ data->items.icons[a], state, 
false);
ui_draw_menu_item(>fstyle, _post, 
data->items.names[a], 0, state, data->use_sep);
}

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


[Bf-blender-cvs] [7dd23af] soc-2016-cycles_denoising: Cycles: Get rid of tile border artifacts when denoising after rendering or standalone denoising

2016-08-23 Thread Lukas Stockner
Commit: 7dd23af0f07b6a3d2b9651a550ff6526f6b776c9
Author: Lukas Stockner
Date:   Tue Aug 23 20:56:35 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB7dd23af0f07b6a3d2b9651a550ff6526f6b776c9

Cycles: Get rid of tile border artifacts when denoising after rendering or 
standalone denoising

The issue was that although all of the image is available, the prefiltering 
system didn't use the area outside of the
current tile, which caused visible seams.

===

M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/kernel/kernels/cuda/kernel.cu

===

diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index 06a083c..e72cecc 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -89,6 +89,7 @@ public:
int cuDevId;
int cuDevArchitecture;
bool first_error;
+   KernelData kernel_globals;
 
struct PixelMem {
GLuint cuPBO;
@@ -523,6 +524,9 @@ public:
 
cuda_push_context();
cuda_assert(cuModuleGetGlobal(, , cuModule, name));
+   if(strcmp(name, "__data") == 0) {
+   kernel_globals = *(KernelData*) host;
+   }
//assert(bytes == size);
cuda_assert(cuMemcpyHtoD(mem, host, size));
cuda_pop_context();
@@ -856,24 +860,31 @@ public:
 
int overscan = rtile.buffers->params.overscan;
 
-   int4 rect = make_int4(rtile.x, rtile.y, rtile.x + rtile.w, 
rtile.y + rtile.h);
+   int hw = kernel_globals.integrator.half_window;
+   int4 filter_area = make_int4(rtile.x + overscan, rtile.y + 
overscan, rtile.w - 2*overscan, rtile.h - 2*overscan);
+   int4 buffer_area = make_int4(rtile.buffers->params.full_x, 
rtile.buffers->params.full_y, rtile.buffers->params.width, 
rtile.buffers->params.height);
+   int4 rect = make_int4(max(filter_area.x - hw, buffer_area.x),
+ max(filter_area.y - hw, buffer_area.y),
+ min(filter_area.x + filter_area.z + hw, 
buffer_area.x + buffer_area.z),
+ min(filter_area.y + filter_area.w + hw, 
buffer_area.y + buffer_area.w));
 
int threads_per_block;
cuda_assert(cuFuncGetAttribute(_per_block, 
CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuFilterFinalPass));
 
int xthreads = (int)sqrt((float)threads_per_block);
int ythreads = (int)sqrt((float)threads_per_block);
-   int xblocks = (rtile.w + xthreads - 1)/xthreads;
-   int yblocks = (rtile.h + ythreads - 1)/ythreads;
+   int xblocks = (buffer_area.z + xthreads - 1)/xthreads;
+   int yblocks = (buffer_area.w + ythreads - 1)/ythreads;
 
CUdeviceptr d_denoise_buffers;
-   int w = align_up(rtile.w, 4);
-   int pass_stride = w*rtile.h*rtile.buffers->params.frames;
+   int w = align_up(rect.z - rect.x, 4);
+   int frame_stride = w*(rect.w - rect.y);
+   int pass_stride = frame_stride*rtile.buffers->params.frames;
cuda_assert(cuMemAlloc(_denoise_buffers, 
22*pass_stride*sizeof(float)));
 #define CUDA_PTR_ADD(ptr, x) ((CUdeviceptr) (((float*) (ptr)) + (x)))
 
for(int frame = 0; frame < rtile.buffers->params.frames; 
frame++) {
-   CUdeviceptr d_denoise_buffer = 
CUDA_PTR_ADD(d_denoise_buffers, w*rtile.h*frame);
+   CUdeviceptr d_denoise_buffer = 
CUDA_PTR_ADD(d_denoise_buffers, frame_stride*frame);
CUdeviceptr d_buffer = CUDA_PTR_ADD(d_buffers, 
frame*rtile.buffers->params.width*rtile.buffers->params.height*rtile.buffers->params.get_passes_size());
/*  Step 1: Prefilter general features.  */
{
@@ -886,7 +897,7 @@ public:
CUdeviceptr d_unfiltered = 
CUDA_PTR_ADD(d_denoise_buffer, 16*pass_stride);
 
void *get_feature_args[] = {, 
_buffer, _from[i], _from[i],
-   , 
, , ,
+   
_area,

, ,

_unfiltered, _variance,
};
@@ -923,7 +934,7 @@ public:
CUdeviceptr d_null = (CUdeviceptr) 0;
/* Get the A/B unfiltered passes, the combined 
sample variance, the estimated variance of the sample 

[Bf-blender-cvs] [b8da056] experimental-build: Cycles: Squashed soc-2016-cycles_denoising branch (state d9251d92)

2016-08-23 Thread Lukas Stockner
Commit: b8da0565d27647b2bab3d347a4978e096df6a672
Author: Lukas Stockner
Date:   Tue Aug 23 17:49:27 2016 +0200
Branches: experimental-build
https://developer.blender.org/rBb8da0565d27647b2bab3d347a4978e096df6a672

Cycles: Squashed soc-2016-cycles_denoising branch (state d9251d92)

===

M   CMakeLists.txt
M   intern/cycles/CMakeLists.txt
M   intern/cycles/app/CMakeLists.txt
A   intern/cycles/app/cycles_denoising.cpp
A   intern/cycles/app/cycles_denoising.h
M   intern/cycles/app/cycles_standalone.cpp
A   intern/cycles/app/cycles_standalone.h
M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_session.h
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h
M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/device/device_opencl.cpp
M   intern/cycles/device/device_task.cpp
M   intern/cycles/device/device_task.h
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/bvh/bvh.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/geom/geom_triangle.h
M   intern/cycles/kernel/kernel_accumulate.h
M   intern/cycles/kernel/kernel_bake.h
M   intern/cycles/kernel/kernel_compat_cpu.h
M   intern/cycles/kernel/kernel_compat_cuda.h
A   intern/cycles/kernel/kernel_filter.h
A   intern/cycles/kernel/kernel_filter_pre.h
A   intern/cycles/kernel/kernel_filter_util.h
M   intern/cycles/kernel/kernel_light.h
M   intern/cycles/kernel/kernel_passes.h
M   intern/cycles/kernel/kernel_path.h
M   intern/cycles/kernel/kernel_path_branched.h
M   intern/cycles/kernel/kernel_path_state.h
M   intern/cycles/kernel/kernel_path_surface.h
M   intern/cycles/kernel/kernel_projection.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel.cu
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_displace.h
M   intern/cycles/kernel/svm/svm_image.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h
M   intern/cycles/render/film.cpp
M   intern/cycles/render/film.h
M   intern/cycles/render/integrator.cpp
M   intern/cycles/render/integrator.h
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/session.cpp
M   intern/cycles/render/session.h
M   intern/cycles/render/tile.cpp
M   intern/cycles/render/tile.h
M   intern/cycles/util/util_debug.cpp
M   intern/cycles/util/util_debug.h
A   intern/cycles/util/util_math_matrix.h
M   intern/cycles/util/util_simd.h
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   intern/cycles/util/util_types.h
M   release/scripts/startup/bl_ui/space_image.py
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_image/image_intern.h
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/render/extern/include/RE_engine.h
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/include/render_result.h
M   source/blender/render/intern/source/external_engine.c
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c
M   source/blender/windowmanager/WM_api.h
M   source/blenderplayer/bad_level_call_stubs/stubs.c

===

diff --git a/CMakeLists.txt 

[Bf-blender-cvs] [7c9b6c5] experimental-build: Revert "Cycles: Squashed soc-2016-cycles_denoising branch (state d9251d92)"

2016-08-23 Thread Lukas Stockner
Commit: 7c9b6c528945fabccc3e133148500b9fdd9ef888
Author: Lukas Stockner
Date:   Tue Aug 23 17:50:51 2016 +0200
Branches: experimental-build
https://developer.blender.org/rB7c9b6c528945fabccc3e133148500b9fdd9ef888

Revert "Cycles: Squashed soc-2016-cycles_denoising branch (state d9251d92)"

This reverts commit b8da0565d27647b2bab3d347a4978e096df6a672.

===

M   CMakeLists.txt
M   intern/cycles/CMakeLists.txt
M   intern/cycles/app/CMakeLists.txt
D   intern/cycles/app/cycles_denoising.cpp
D   intern/cycles/app/cycles_denoising.h
M   intern/cycles/app/cycles_standalone.cpp
D   intern/cycles/app/cycles_standalone.h
M   intern/cycles/blender/addon/__init__.py
M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/blender_python.cpp
M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_session.h
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/blender/blender_util.h
M   intern/cycles/device/device_cpu.cpp
M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/device/device_opencl.cpp
M   intern/cycles/device/device_task.cpp
M   intern/cycles/device/device_task.h
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/bvh/bvh.h
M   intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h
M   intern/cycles/kernel/closure/bsdf_diffuse.h
M   intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
M   intern/cycles/kernel/closure/bsdf_microfacet.h
M   intern/cycles/kernel/closure/bsdf_microfacet_multi.h
M   intern/cycles/kernel/closure/bsdf_oren_nayar.h
M   intern/cycles/kernel/closure/bsdf_phong_ramp.h
M   intern/cycles/kernel/closure/bsdf_toon.h
M   intern/cycles/kernel/closure/bssrdf.h
M   intern/cycles/kernel/geom/geom_triangle.h
M   intern/cycles/kernel/kernel_accumulate.h
M   intern/cycles/kernel/kernel_bake.h
M   intern/cycles/kernel/kernel_compat_cpu.h
M   intern/cycles/kernel/kernel_compat_cuda.h
D   intern/cycles/kernel/kernel_filter.h
D   intern/cycles/kernel/kernel_filter_pre.h
D   intern/cycles/kernel/kernel_filter_util.h
M   intern/cycles/kernel/kernel_light.h
M   intern/cycles/kernel/kernel_passes.h
M   intern/cycles/kernel/kernel_path.h
M   intern/cycles/kernel/kernel_path_branched.h
M   intern/cycles/kernel/kernel_path_state.h
M   intern/cycles/kernel/kernel_path_surface.h
M   intern/cycles/kernel/kernel_projection.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel.cu
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_displace.h
M   intern/cycles/kernel/svm/svm_image.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h
M   intern/cycles/render/film.cpp
M   intern/cycles/render/film.h
M   intern/cycles/render/integrator.cpp
M   intern/cycles/render/integrator.h
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/session.cpp
M   intern/cycles/render/session.h
M   intern/cycles/render/tile.cpp
M   intern/cycles/render/tile.h
M   intern/cycles/util/util_debug.cpp
M   intern/cycles/util/util_debug.h
D   intern/cycles/util/util_math_matrix.h
M   intern/cycles/util/util_simd.h
M   intern/cycles/util/util_system.cpp
M   intern/cycles/util/util_system.h
M   intern/cycles/util/util_types.h
M   release/scripts/startup/bl_ui/space_image.py
M   source/blender/blenkernel/BKE_scene.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_image/image_intern.h
M   source/blender/editors/space_image/image_ops.c
M   source/blender/editors/space_image/space_image.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_render.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/render/extern/include/RE_engine.h
M   source/blender/render/extern/include/RE_pipeline.h
M   source/blender/render/intern/include/render_result.h
M   source/blender/render/intern/source/external_engine.c
M   source/blender/render/intern/source/pipeline.c
M   source/blender/render/intern/source/render_result.c
M   source/blender/windowmanager/WM_api.h
M   source/blenderplayer/bad_level_call_stubs/stubs.c


[Bf-blender-cvs] [880003f] experimental-build: Merge remote-tracking branch 'origin/master' into experimental-build

2016-08-23 Thread Lukas Stockner
Commit: 880003fe12690395505a2ad6acec4d9fafd2d64d
Author: Lukas Stockner
Date:   Tue Aug 23 17:38:03 2016 +0200
Branches: experimental-build
https://developer.blender.org/rB880003fe12690395505a2ad6acec4d9fafd2d64d

Merge remote-tracking branch 'origin/master' into experimental-build

===



===



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


[Bf-blender-cvs] [ac75f26] soc-2016-cycles_denoising: Cycles: Fix a memory leak in the CUDA denoising code

2016-08-23 Thread Lukas Stockner
Commit: ac75f262b2097b84b3ad4d3f96660913183cdebc
Author: Lukas Stockner
Date:   Tue Aug 23 17:34:36 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rBac75f262b2097b84b3ad4d3f96660913183cdebc

Cycles: Fix a memory leak in the CUDA denoising code

===

M   intern/cycles/device/device_cuda.cpp

===

diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index d2e5ed3..06a083c 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -1159,6 +1159,7 @@ public:
 #undef WRITE_DEBUG
 #endif
cuda_assert(cuMemFree(d_storage));
+   cuda_assert(cuMemFree(d_transforms));
cuda_assert(cuMemFree(d_denoise_buffers));
 
cuda_pop_context();

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


[Bf-blender-cvs] [930ab20] soc-2016-cycles_denoising: Cycles: Fix Shadow prefiltering for cross-frame filtering

2016-08-23 Thread Lukas Stockner
Commit: 930ab2055421afa4bcb411b29f85f5d79bbab368
Author: Lukas Stockner
Date:   Tue Aug 23 17:32:29 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB930ab2055421afa4bcb411b29f85f5d79bbab368

Cycles: Fix Shadow prefiltering for cross-frame filtering

===

M   intern/cycles/kernel/kernel_filter_pre.h

===

diff --git a/intern/cycles/kernel/kernel_filter_pre.h 
b/intern/cycles/kernel/kernel_filter_pre.h
index 4eb9b90..04f5c03 100644
--- a/intern/cycles/kernel/kernel_filter_pre.h
+++ b/intern/cycles/kernel/kernel_filter_pre.h
@@ -34,7 +34,7 @@ ccl_device void kernel_filter_divide_shadow(KernelGlobals 
*kg, int sample, float
 
int buffer_w = align_up(rect.z - rect.x, 4);
int idx = (y-rect.y)*buffer_w + (x - rect.x);
-   int Bofs = (rect.w - rect.y)*buffer_w;
+   int Bofs = (rect.w - rect.y)*buffer_w*kernel_data.film.num_frames;
unfiltered[idx] = center_buffer[15] / max(center_buffer[14], 1e-7f);
unfiltered[idx+Bofs] = center_buffer[18] / max(center_buffer[17], 
1e-7f);
float varFac = 1.0f / (sample * (sample-1));

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


[Bf-blender-cvs] [5c9a6bb] soc-2016-cycles_denoising: Cycles: Fix building on Windows

2016-08-23 Thread Lukas Stockner
Commit: 5c9a6bbcceae29bf70595e6ed80978bfed446390
Author: Lukas Stockner
Date:   Tue Aug 23 17:31:56 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB5c9a6bbcceae29bf70595e6ed80978bfed446390

Cycles: Fix building on Windows

===

M   intern/cycles/kernel/kernel_compat_cpu.h
M   intern/cycles/kernel/kernel_compat_cuda.h
M   intern/cycles/kernel/kernel_filter.h
M   intern/cycles/kernel/kernel_filter_pre.h
M   intern/cycles/kernel/kernel_filter_util.h

===

diff --git a/intern/cycles/kernel/kernel_compat_cpu.h 
b/intern/cycles/kernel/kernel_compat_cpu.h
index 5ad1077..d900c2a 100644
--- a/intern/cycles/kernel/kernel_compat_cpu.h
+++ b/intern/cycles/kernel/kernel_compat_cpu.h
@@ -45,6 +45,8 @@
 
 #define ccl_addr_space
 
+#define ccl_readonly_ptr const * __restrict
+
 /* On x86_64, versions of glibc < 2.16 have an issue where expf is
  * much slower than the double version.  This was fixed in glibc 2.16.
  */
diff --git a/intern/cycles/kernel/kernel_compat_cuda.h 
b/intern/cycles/kernel/kernel_compat_cuda.h
index 9a96cb9..5352b0f 100644
--- a/intern/cycles/kernel/kernel_compat_cuda.h
+++ b/intern/cycles/kernel/kernel_compat_cuda.h
@@ -49,6 +49,7 @@
 #define ccl_addr_space
 #define ccl_restrict __restrict__
 #define ccl_align(n) __align__(n)
+#define ccl_readonly_ptr const * __restrict__
 
 /* No assert supported for CUDA */
 
diff --git a/intern/cycles/kernel/kernel_filter.h 
b/intern/cycles/kernel/kernel_filter.h
index 10fafcd..b9f865f 100644
--- a/intern/cycles/kernel/kernel_filter.h
+++ b/intern/cycles/kernel/kernel_filter.h
@@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN
 #define NORM_FEATURE_NUM 8
 
 #ifdef __KERNEL_CUDA__
-ccl_device void kernel_filter_construct_transform(KernelGlobals *kg, int 
sample, float const* __restrict__ buffer, int x, int y, float *transform, 
FilterStorage *storage, int4 rect, int transform_stride, int localIdx)
+ccl_device void kernel_filter_construct_transform(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float *transform, 
FilterStorage *storage, int4 rect, int transform_stride, int localIdx)
 {
__shared__ float 
shared_features[DENOISE_FEATURES*CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH];
float *features = shared_features + localIdx*DENOISE_FEATURES;
@@ -39,7 +39,7 @@ ccl_device void 
kernel_filter_construct_transform(KernelGlobals *kg, int sample,
  max(rect.y, y - 
kernel_data.integrator.half_window));
int2 high = make_int2(min(rect.z, x + 
kernel_data.integrator.half_window + 1),
  min(rect.w, y + 
kernel_data.integrator.half_window + 1));
-   float const* __restrict__ pixel_buffer;
+   float ccl_readonly_ptr pixel_buffer;
 
 
 
@@ -115,7 +115,7 @@ ccl_device void 
kernel_filter_construct_transform(KernelGlobals *kg, int sample,
 #endif
 }
 
-ccl_device void kernel_filter_estimate_bandwidths(KernelGlobals *kg, int 
sample, float const* __restrict__ buffer, int x, int y, float const* 
__restrict__ transform, FilterStorage *storage, int4 rect, int 
transform_stride, int localIdx)
+ccl_device void kernel_filter_estimate_bandwidths(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float ccl_readonly_ptr 
transform, FilterStorage *storage, int4 rect, int transform_stride, int 
localIdx)
 {
__shared__ float 
shared_features[DENOISE_FEATURES*CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH];
float *features = shared_features + localIdx*DENOISE_FEATURES;
@@ -130,8 +130,8 @@ ccl_device void 
kernel_filter_estimate_bandwidths(KernelGlobals *kg, int sample,
  max(rect.y, y - 
kernel_data.integrator.half_window));
int2 high = make_int2(min(rect.z, x + 
kernel_data.integrator.half_window + 1),
  min(rect.w, y + 
kernel_data.integrator.half_window + 1));
-   float const* __restrict__ pixel_buffer;
-   float const* __restrict__ center_buffer = buffer + (y - rect.y) * 
buffer_w + (x - rect.x);
+   float ccl_readonly_ptr pixel_buffer;
+   float ccl_readonly_ptr center_buffer = buffer + (y - rect.y) * buffer_w 
+ (x - rect.x);
 
int rank = storage->rank;
 
@@ -176,7 +176,7 @@ ccl_device void 
kernel_filter_estimate_bandwidths(KernelGlobals *kg, int sample,
storage->bandwidth[i] = 0.0f;
 }
 
-ccl_device void kernel_filter_estimate_bias_variance(KernelGlobals *kg, int 
sample, float const* __restrict__ buffer, int x, int y, float const* 
__restrict__ transform, FilterStorage *storage, int4 rect, int candidate, int 
transform_stride, int localIdx)
+ccl_device void kernel_filter_estimate_bias_variance(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float ccl_readonly_ptr 
transform, FilterStorage *storage, int4 rect, int 

[Bf-blender-cvs] [8780802] soc-2016-cycles_denoising: Merge remote-tracking branch 'origin/master' into soc-2016-cycles_denoising

2016-08-23 Thread Lukas Stockner
Commit: 87808023bbf3e78f6e83bcb8f85fabda02dcb4d2
Author: Lukas Stockner
Date:   Tue Aug 23 17:37:27 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB87808023bbf3e78f6e83bcb8f85fabda02dcb4d2

Merge remote-tracking branch 'origin/master' into soc-2016-cycles_denoising

===



===



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


[Bf-blender-cvs] [29105ad] soc-2016-cycles_denoising: Cycles: Use separate struct for CUDA denoising storage to avoid allocating the transform memory twice

2016-08-23 Thread Lukas Stockner
Commit: 29105adbab70bc25d9624bdab52523b409ee3570
Author: Lukas Stockner
Date:   Tue Aug 23 17:34:04 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB29105adbab70bc25d9624bdab52523b409ee3570

Cycles: Use separate struct for CUDA denoising storage to avoid allocating the 
transform memory twice

===

M   intern/cycles/device/device_cuda.cpp
M   intern/cycles/kernel/kernel_filter.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cuda/kernel.cu

===

diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index f98fd76..d2e5ed3 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -1078,7 +1078,7 @@ public:
/* Use the prefiltered feature to denoise the image. */
int4 filter_area = make_int4(rtile.x + overscan, rtile.y + 
overscan, rtile.w - 2*overscan, rtile.h - 2*overscan);
CUdeviceptr d_storage, d_transforms;
-   cuda_assert(cuMemAlloc(_storage, 
filter_area.z*filter_area.w*sizeof(FilterStorage)));
+   cuda_assert(cuMemAlloc(_storage, 
filter_area.z*filter_area.w*sizeof(CUDAFilterStorage)));
cuda_assert(cuMemAlloc(_transforms, 
filter_area.z*filter_area.w*sizeof(float)*DENOISE_FEATURES*DENOISE_FEATURES));
 
xthreads = (int)sqrt((float)threads_per_block);
@@ -1140,9 +1140,9 @@ public:
cuda_assert(cuCtxSynchronize());
 
 #ifdef WITH_CYCLES_DEBUG_FILTER
-   FilterStorage *host_storage = new 
FilterStorage[filter_area.z*filter_area.w];
-   cuda_assert(cuMemcpyDtoH(host_storage, d_storage, 
sizeof(FilterStorage)*filter_area.z*filter_area.w));
-#define WRITE_DEBUG(name, var) 
debug_write_pfm(string_printf("debug_%dx%d_cuda_%s.pfm", 
rtile.x+rtile.buffers->params.overscan, rtile.y+rtile.buffers->params.overscan, 
name).c_str(), _storage[0].var, filter_area.z, filter_area.w, 
sizeof(FilterStorage)/sizeof(float), filter_area.z);
+   CUDAFilterStorage *host_storage = new 
CUDAFilterStorage[filter_area.z*filter_area.w];
+   cuda_assert(cuMemcpyDtoH(host_storage, d_storage, 
sizeof(CUDAFilterStorage)*filter_area.z*filter_area.w));
+#define WRITE_DEBUG(name, var) 
debug_write_pfm(string_printf("debug_%dx%d_cuda_%s.pfm", 
rtile.x+rtile.buffers->params.overscan, rtile.y+rtile.buffers->params.overscan, 
name).c_str(), _storage[0].var, filter_area.z, filter_area.w, 
sizeof(CUDAFilterStorage)/sizeof(float), filter_area.z);
for(int i = 0; i < DENOISE_FEATURES; i++) {
WRITE_DEBUG(string_printf("mean_%d", i).c_str(), 
means[i]);
WRITE_DEBUG(string_printf("scale_%d", i).c_str(), 
scales[i]);
diff --git a/intern/cycles/kernel/kernel_filter.h 
b/intern/cycles/kernel/kernel_filter.h
index b9f865f..e842ab2 100644
--- a/intern/cycles/kernel/kernel_filter.h
+++ b/intern/cycles/kernel/kernel_filter.h
@@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN
 #define NORM_FEATURE_NUM 8
 
 #ifdef __KERNEL_CUDA__
-ccl_device void kernel_filter_construct_transform(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float *transform, 
FilterStorage *storage, int4 rect, int transform_stride, int localIdx)
+ccl_device void kernel_filter_construct_transform(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float *transform, 
CUDAFilterStorage *storage, int4 rect, int transform_stride, int localIdx)
 {
__shared__ float 
shared_features[DENOISE_FEATURES*CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH];
float *features = shared_features + localIdx*DENOISE_FEATURES;
@@ -115,7 +115,7 @@ ccl_device void 
kernel_filter_construct_transform(KernelGlobals *kg, int sample,
 #endif
 }
 
-ccl_device void kernel_filter_estimate_bandwidths(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float ccl_readonly_ptr 
transform, FilterStorage *storage, int4 rect, int transform_stride, int 
localIdx)
+ccl_device void kernel_filter_estimate_bandwidths(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float ccl_readonly_ptr 
transform, CUDAFilterStorage *storage, int4 rect, int transform_stride, int 
localIdx)
 {
__shared__ float 
shared_features[DENOISE_FEATURES*CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH];
float *features = shared_features + localIdx*DENOISE_FEATURES;
@@ -176,7 +176,7 @@ ccl_device void 
kernel_filter_estimate_bandwidths(KernelGlobals *kg, int sample,
storage->bandwidth[i] = 0.0f;
 }
 
-ccl_device void kernel_filter_estimate_bias_variance(KernelGlobals *kg, int 
sample, float ccl_readonly_ptr buffer, int x, int y, float ccl_readonly_ptr 
transform, FilterStorage *storage, int4 rect, int candidate, int 

[Bf-blender-cvs] [d9251d9] soc-2016-cycles_denoising: Cycles: Remove another two useless files

2016-08-23 Thread Lukas Stockner
Commit: d9251d92d86bb377d34f77ce3fe6252b261b1582
Author: Lukas Stockner
Date:   Tue Aug 23 17:47:44 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rBd9251d92d86bb377d34f77ce3fe6252b261b1582

Cycles: Remove another two useless files

===

D   intern/cycles/render/denoising.cpp
D   intern/cycles/render/denoising.h

===

diff --git a/intern/cycles/render/denoising.cpp 
b/intern/cycles/render/denoising.cpp
deleted file mode 100644
index f5e5a5d..000
--- a/intern/cycles/render/denoising.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "denoising.h"
-
-CCL_NAMESPACE_BEGIN
-
-DenoisingSession::DenoisingSession(DenoisingSessionParams _)
-: params(params_),
-  tile_manager(false, 1, params.tile_size, 1, false, true, params.tile_order,
-   max(params.device.multi_devices.size(), 1)),
-  stats()
-{
-   TaskScheduler::init(params.threads);
-
-device = Device::create(params.device, stats, params.background);
-
-   session_thread = NULL;
-   start_time = 0.0;
-}
diff --git a/intern/cycles/render/denoising.h b/intern/cycles/render/denoising.h
deleted file mode 100644
index 7a23fec..000
--- a/intern/cycles/render/denoising.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2011-2013 Blender Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DENOISING_H__
-#define __DENOISING_H__
-
-#include "buffers.h"
-#include "device.h"
-#include "tile.h"
-
-#include "util_progress.h"
-#include "util_stats.h"
-#include "util_thread.h"
-#include "util_vector.h"
-
-CCL_NAMESPACE_BEGIN
-
-class BufferParams;
-class Device;
-class Progress;
-class RenderBuffers;
-
-/* DenoisingSession Parameters */
-
-class DenoisingSessionParams {
-public:
-   DeviceInfo device;
-
-   int2 tile_size;
-   TileOrder tile_order;
-   int threads;
-
-   SessionParams()
-   {
-   tile_size = make_int2(64, 64);
-   threads = 0;
-
-   tile_order = TILE_CENTER;
-   }
-
-   bool modified(const SessionParams& params)
-   { return !(device.type == params.device.type
-   && device.id == params.device.id
-   && tile_size == params.tile_size
-   && threads == params.threads
-   && tile_order == params.tile_order); }
-
-};
-
-/* DenoisingSession
- *
- * This is the class that contains the session thread, running the denoising
- * control loop and dispatching tasks. */
-
-class DenoisingSession {
-public:
-   Device *device;
-   RenderBuffers *buffers;
-   Progress progress;
-   DenoisingSessionParams params;
-   TileManager tile_manager;
-   Stats stats;
-
-   function write_render_tile_cb;
-   function update_render_tile_cb;
-
-   explicit DenoisingSession(const SessionParams& params);
-   ~DenoisingSession();
-
-   void start();
-   void wait();
-
-   void load_kernels();
-
-   void device_free();
-
-protected:
-   void run();
-
-   void update_status_time(bool show_pause = false, bool show_done = 
false);
-
-   void tonemap(int sample);
-   void render();
-
-   bool acquire_tile(Device *tile_device, RenderTile& tile);
-   void update_tile_sample(RenderTile& tile);
-   void release_tile(RenderTile& tile);
-   void get_neighbor_tiles(RenderTile *tiles);
-
-   void update_progress_sample();
-
-   thread *session_thread;
-
-   thread_mutex tile_mutex;
-   thread_mutex buffers_mutex;
-
-   bool kernels_loaded;
-
-   double start_time;
-
-   /* progressive refine */
-   double last_update_time;
-   bool update_progressive_refine(bool cancel);
-};
-
-CCL_NAMESPACE_END
-
-#endif /* __SESSION_H__ */
-

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


[Bf-blender-cvs] [7fb1b6a] gsoc2016-improved_extrusion: Curves: GSoC 2016 - Bezier curve improvements

2016-08-23 Thread João Araújo
Commit: 7fb1b6a10faf418c67f405eb63d2994d01eb9e34
Author: João Araújo
Date:   Fri Aug 19 23:54:28 2016 +0100
Branches: gsoc2016-improved_extrusion
https://developer.blender.org/rB7fb1b6a10faf418c67f405eb63d2994d01eb9e34

Curves: GSoC 2016 - Bezier curve improvements

Added docstrings to all functions.

===

M   source/blender/editors/curve/editcurve.c

===

diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index db64c56..6757a89 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6811,6 +6811,8 @@ static int get_selected_spline_id(ListBase *nubase)
 
 static int sel_point_id(Nurb *nu)
 {
+   /* receives a spline
+* returns the number of the first selected handle */
BezTriple *bezt = nu->bezt;
for (int i = 0; i < nu->pntsu; i++) {
if (BEZT_ISSEL_ANY(bezt))
@@ -6831,12 +6833,15 @@ typedef struct XShape {
 
 static int XShape_cmp(const void *xs1, const void *xs2)
 {
+   /* function to compare two XShape instances based on distance */
XShape *x1 = (XShape *)xs1, *x2 = (XShape *)xs2;
return x1->distance > x2->distance ? 1 : 0;
 }
 
 static ListBase *spline_X_shape(Object *obedit, int selected_spline)
 {
+   /* return all intersections with selected spline, along with information
+* regarding the distance and the order relative to the currently 
selected point */
ListBase shape_list = {NULL};
ListBase *nubase, *all_segments;
Nurb *nu;
@@ -6954,6 +6959,7 @@ static ListBase *spline_X_shape(Object *obedit, int 
selected_spline)
sub_v3_v3(helper, _coord_array[i * 3]);
sl_length += len_v3(helper);
}
+   /* sort intersection list based on distance */
BLI_listbase_sort(intersections, XShape_cmp);
 
MEM_freeN(full_coord_array);
@@ -6981,6 +6987,7 @@ static ListBase *spline_X_shape(Object *obedit, int 
selected_spline)
 
 static bool is_between(float *x, float *a, float *b)
 {
+   /* return whether a point is between two points a and b */
const float PRECISION = 1e-05;
 
float cross = (x[1] - a[1]) * (b[0] - a[0]) - (x[0] - a[0]) * (b[1] - 
a[1]);
@@ -6995,6 +7002,8 @@ static bool is_between(float *x, float *a, float *b)
 
 static float ratio_to_segment(float *x, float *p1, float *p2, float *p3, float 
*p4, int res)
 {
+   /* given four points (which define a cubic bezier spline) return 
+* the ratio (distance from x to p1)/(length of bezier spline) */
float seg_length, length, ratio, *seg;
seg_length = length = ratio = 0;
 
@@ -7025,6 +7034,9 @@ static float ratio_to_segment(float *x, float *p1, float 
*p2, float *p3, float *
 static void split_segment(float t, float *p1, float *p2, float *p3, float *p4,
   float *r_s1, float 
*r_s2)
 {
+   /* split bezier spline at ratio t 
+* this implementation is very obscure. Check the original python addon 
for a much
+* cleaner code */
float *q1, *q2, *q3, *r1, *r2, *r3;
 
q1 = (float *)MEM_callocN(3 * sizeof(float), "split_segment1");
@@ -7084,12 +7096,14 @@ static void split_segment(float t, float *p1, float 
*p2, float *p3, float *p4,
 static void chop(float *x, float *p1, float *p2, float *p3, float *p4, int res,
 float *r_s1, float *r_s2)
 {
+   /* split a bezier segment at a given point */
float ratio = ratio_to_segment(x, p1, p2, p3, p4, res);
split_segment(ratio, p1, p2, p3, p4, r_s1, r_s2);
 }
 
 static int trim_curve_exec(bContext *C, wmOperator *op)
 {
+   /* main function of the trim operator */
Object *obedit = CTX_data_edit_object(C);
Curve *cu = obedit->data;
EditNurb *editnurb = cu->editnurb;
@@ -7507,7 +7521,6 @@ static int trim_curve_exec(bContext *C, wmOperator *op)
 
 void CURVE_OT_trim_curve(wmOperatorType *ot)
 {
-
/* identifiers */
ot->name = "Trim";
ot->description = "Trim selected point of the curve";
@@ -7527,6 +7540,9 @@ void CURVE_OT_trim_curve(wmOperatorType *ot)
 
 static int get_offset_vecs(BezTriple *bezt1, BezTriple *bezt2, float *r_v1, 
float *r_v2)
 {
+   /* calculate the offset vectors for the given BezTriple's
+* on r_v1 is the offset vector for the first triple
+* on r_v2 is the offset vector for the second triple */
int dims = 3, ret = 1;
float *coord_array, *vx, *vy, *helper;
coord_array = MEM_callocN(dims * (12 + 1) * sizeof(float), 
"get_offset_vecs1");
@@ -7597,6 +7613,7 @@ static int get_offset_vecs(BezTriple *bezt1, BezTriple 
*bezt2, float *r_v1, floa
 
 static int get_handles_offset_vec(float *p1, float *p2, float *p3, float *r_v1)
 {
+   /* get the vector along 

[Bf-blender-cvs] [7dc328e] master: D2078 Windows : add option to prevent find_package from picking up the wrong libraries and use hardcoded paths instead.

2016-08-23 Thread lazydodo
Commit: 7dc328e8a1cea0f1ea0b8848a38ce7521401ca8b
Author: lazydodo
Date:   Tue Aug 23 08:47:23 2016 -0600
Branches: master
https://developer.blender.org/rB7dc328e8a1cea0f1ea0b8848a38ce7521401ca8b

D2078 Windows : add option to prevent find_package from picking up the wrong 
libraries and use hardcoded paths instead.

===

M   CMakeLists.txt
M   build_files/cmake/platform/platform_win32_msvc.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 170537b..d7276f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -508,6 +508,10 @@ mark_as_advanced(WITH_CXX11)
 option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
 mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
 
+# Use hardcoded paths or find_package to find externals
+option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
+mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
+
 # avoid using again
 option_defaults_clear()
 
diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake 
b/build_files/cmake/platform/platform_win32_msvc.cmake
index 696a371..eaa6e41 100644
--- a/build_files/cmake/platform/platform_win32_msvc.cmake
+++ b/build_files/cmake/platform/platform_win32_msvc.cmake
@@ -23,6 +23,20 @@
 
 # Libraries configuration for Windows when compiling with MSVC.
 
+macro(warn_hardcoded_paths package_name
+   )
+   if(WITH_WINDOWS_FIND_MODULES)
+   message(WARNING "Using HARDCODED ${package_name} locations")
+   endif(WITH_WINDOWS_FIND_MODULES)
+endmacro()
+
+macro(windows_find_package package_name
+   )
+   if(WITH_WINDOWS_FIND_MODULES)
+   find_package( ${package_name})
+   endif(WITH_WINDOWS_FIND_MODULES)
+endmacro()
+
 add_definitions(-DWIN32)
 # Minimum MSVC Version
 if(MSVC_VERSION EQUAL 1800)
@@ -141,12 +155,12 @@ set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
 set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
 set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
 set(ZLIB_DIR ${LIBDIR}/zlib)
-#find_package(zlib) # we want to find before finding things that depend on it 
like png
 
+windows_find_package(zlib) # we want to find before finding things that depend 
on it like png
+windows_find_package(png)
 
-find_package(png)
 if(NOT PNG_FOUND)
-   message(WARNING "Using HARDCODED libpng locations")
+   warn_hardcoded_paths(libpng)
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
set(PNG_LIBRARIES libpng)
set(PNG "${LIBDIR}/png")
@@ -155,7 +169,12 @@ if(NOT PNG_FOUND)
 endif()
 
 set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
-find_package(jpeg REQUIRED)
+windows_find_package(jpeg REQUIRED)
+if(NOT JPEG_FOUND)
+   warn_hardcoded_paths(jpeg)
+   set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
+   set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
+endif()
 
 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
@@ -166,7 +185,7 @@ set(FREETYPE_INCLUDE_DIRS
${LIBDIR}/freetype/include/freetype2
 )
 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
-find_package(freetype REQUIRED)
+windows_find_package(freetype REQUIRED)
 
 if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
@@ -212,9 +231,9 @@ if(WITH_CODEC_FFMPEG)
${LIBDIR}/ffmpeg/include
${LIBDIR}/ffmpeg/include/msvc
)
-   find_package(FFMPEG)
+   windows_find_package(FFMPEG)
if(NOT FFMPEG_FOUND)
-   message(WARNING "Using HARDCODED ffmpeg locations")
+   warn_hardcoded_paths(ffmpeg)
set(FFMPEG_LIBRARY_VERSION 55)
set(FFMPEG_LIBRARY_VERSION_AVU 52)
set(FFMPEG_LIBRARIES
@@ -230,9 +249,9 @@ endif()
 if(WITH_IMAGE_OPENEXR)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(OPENEXR_VERSION "2.1")
-   find_package(OPENEXR REQUIRED)
+   windows_find_package(OPENEXR REQUIRED)
if(NOT OPENEXR_FOUND)
-   message(WARNING "Using HARDCODED OpenEXR locations")
+   warn_hardcoded_paths(OpenEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} 
${OPENEXR}/include/OpenEXR)
@@ -254,9 +273,9 @@ endif()
 
 if(WITH_IMAGE_TIFF)
# Try to find tiff first then complain and set static and maybe wrong 
paths
-   find_package(TIFF)
+   windows_find_package(TIFF)
if(NOT TIFF_FOUND)
-   message(WARNING "Using HARDCODED libtiff locations")
+   warn_hardcoded_paths(libtiff)
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
endif()
@@ -299,9 +318,11 @@ if(WITH_BOOST)
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
set(Boost_USE_MULTITHREADED ON) # suffix -mt

[Bf-blender-cvs] [36b80b1] master: Cycles: Fix/workaround for missing AA on Pascal (GTX10x0) cards

2016-08-23 Thread Sergey Sharybin
Commit: 36b80b185f2c01e72ba251b852b517b02c806c73
Author: Sergey Sharybin
Date:   Tue Aug 23 16:32:09 2016 +0200
Branches: master
https://developer.blender.org/rB36b80b185f2c01e72ba251b852b517b02c806c73

Cycles: Fix/workaround for missing AA on Pascal (GTX10x0) cards

===

M   intern/cycles/kernel/kernel_random.h

===

diff --git a/intern/cycles/kernel/kernel_random.h 
b/intern/cycles/kernel/kernel_random.h
index 731dc04..b534d99 100644
--- a/intern/cycles/kernel/kernel_random.h
+++ b/intern/cycles/kernel/kernel_random.h
@@ -132,7 +132,13 @@ ccl_device_inline float path_rng_1D(KernelGlobals *kg, 
ccl_addr_space RNG *rng,
 #endif
 }
 
-ccl_device_inline void path_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, 
int sample, int num_samples, int dimension, float *fx, float *fy)
+/* Temporary workaround for Pascal cards, otherwise AA does not work properly. 
*/
+#if defined(__KERNEL_GPU__) && __CUDA_ARCH__ >= 600
+__device__ __forceinline__
+#else
+ccl_device_inline
+#endif
+void path_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, int sample, int 
num_samples, int dimension, float *fx, float *fy)
 {
 #ifdef __CMJ__
if(kernel_data.integrator.sampling_pattern == SAMPLING_PATTERN_CMJ) {

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


[Bf-blender-cvs] [1899762] soc-2016-uv_tools: Fix warnings for unused functions and discarding 'const'

2016-08-23 Thread Phil Gosch
Commit: 1899762962510c2aefe62f864e52ad75401ba44e
Author: Phil Gosch
Date:   Tue Aug 23 16:11:19 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB1899762962510c2aefe62f864e52ad75401ba44e

Fix warnings for unused functions and discarding 'const'

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 63aa8d1..5904e0c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -592,7 +592,7 @@ static void p_chart_uv_scale_origin(PChart *chart, float 
scale)
p_chart_uv_translate(chart, trans);
 }
 
-static void p_scale_charts(PHandle *handle, float scale)
+static void UNUSED_FUNCTION(p_scale_charts)(PHandle *handle, float scale)
 {
PChart *chart;
int i;
@@ -631,7 +631,7 @@ static PBool p_intersect_line_2d_dir(float *v1, float 
*dir1, float *v2, float *d
return P_TRUE;
 }
 
-static PBool p_intersect_line_2d(float *v1, float *v2, float *v3, float *v4, 
float *isect)
+static PBool UNUSED_FUNCTION(p_intersect_line_2d)(float *v1, float *v2, float 
*v3, float *v4, float *isect)
 {
float dir1[2], dir2[2];
 
@@ -4859,9 +4859,9 @@ void param_pack(ParamHandle *handle, float margin, bool 
do_rotate)
 }
 
 /* qsort function - sort largest to smallest */
-static int vert_anglesort(const void *p1, const void *p2)
+static int UNUSED_FUNCTION(vert_anglesort)(const void *p1, const void *p2)
 {
-   PVert **v1 = p1, **v2 = p2;
+   PVert *const* v1 = p1, *const* v2 = p2;
const float a1 = (*v1)->edge->u.horizontal_angle;
const float a2 = (*v2)->edge->u.horizontal_angle;
 
@@ -4873,7 +4873,7 @@ static int vert_anglesort(const void *p1, const void *p2)
 /* qsort function - sort largest to smallest */
 static int point_anglesort(const void *p1, const void *p2)
 {
-   PPointUV **v1 = p1, **v2 = p2;
+   PPointUV *const* v1 = p1, *const* v2 = p2;
const float a1 = (*v1)->angle;
const float a2 = (*v2)->angle;
 
@@ -4885,7 +4885,7 @@ static int point_anglesort(const void *p1, const void *p2)
 /* qsort function - sort largest to smallest */
 static int chart_areasort(const void *p1, const void *p2)
 {
-   PChart **c1 = p1, **c2 = p2;
+   PChart *const* c1 = p1, *const* c2 = p2;
const float a1 = (*c1)->u.ipack.area;
const float a2 = (*c2)->u.ipack.area;
 
@@ -4895,7 +4895,7 @@ static int chart_areasort(const void *p1, const void *p2)
 }
 
 /* ToDo SaphireS: Make this function part of math_vector.c */
-static float p_edge_horizontal_angle(PVert *a, PVert *b)
+static float UNUSED_FUNCTION(p_edge_horizontal_angle)(PVert *a, PVert *b)
 {
float angle = 0.0f;
float hori[2];
@@ -5990,6 +5990,7 @@ void param_irregular_pack_begin(ParamHandle *handle, 
float *w_area, float margin
if (!outer) {
/* ToDo Saphires: BKE_report(..) */
printf("Warning: p_chart_boundaries: No boundary edge 
found for chart %i!\n", i);
+   chart->u.ipack.convex_hull = p_convex_hull_new(chart);
chart->u.ipack.convex_hull->placed = true;
chart->u.ipack.decomposed = false;
break;

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


[Bf-blender-cvs] [a853367] master: Fix T49140: Noise and jitter present at some areas when using ambient oclusion in Blender internal renderer

2016-08-23 Thread Sergey Sharybin
Commit: a853367fbf2981458bfbae2f2df8ce7dc7499746
Author: Sergey Sharybin
Date:   Tue Aug 23 15:54:36 2016 +0200
Branches: master
https://developer.blender.org/rBa853367fbf2981458bfbae2f2df8ce7dc7499746

Fix T49140: Noise and jitter present at some areas when using ambient oclusion 
in Blender internal renderer

===

M   source/blender/render/intern/raytrace/rayobject.cpp

===

diff --git a/source/blender/render/intern/raytrace/rayobject.cpp 
b/source/blender/render/intern/raytrace/rayobject.cpp
index 2104315..3415e52 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -138,6 +138,68 @@ MALWAYS_INLINE int vlr_check_bake(Isect *is, 
ObjectInstanceRen *obi, VlakRen *UN
 
 /* Ray Triangle/Quad Intersection */
 
+static bool isect_ray_tri_watertight_no_sign_check_v3(
+const float ray_origin[3], const struct IsectRayPrecalc *isect_precalc,
+const float v0[3], const float v1[3], const float v2[3],
+float *r_lambda, float r_uv[2])
+{
+   const int kx = isect_precalc->kx;
+   const int ky = isect_precalc->ky;
+   const int kz = isect_precalc->kz;
+   const float sx = isect_precalc->sx;
+   const float sy = isect_precalc->sy;
+   const float sz = isect_precalc->sz;
+
+   /* Calculate vertices relative to ray origin. */
+   const float a[3] = {v0[0] - ray_origin[0], v0[1] - ray_origin[1], v0[2] 
- ray_origin[2]};
+   const float b[3] = {v1[0] - ray_origin[0], v1[1] - ray_origin[1], v1[2] 
- ray_origin[2]};
+   const float c[3] = {v2[0] - ray_origin[0], v2[1] - ray_origin[1], v2[2] 
- ray_origin[2]};
+
+   const float a_kx = a[kx], a_ky = a[ky], a_kz = a[kz];
+   const float b_kx = b[kx], b_ky = b[ky], b_kz = b[kz];
+   const float c_kx = c[kx], c_ky = c[ky], c_kz = c[kz];
+
+   /* Perform shear and scale of vertices. */
+   const float ax = a_kx - sx * a_kz;
+   const float ay = a_ky - sy * a_kz;
+   const float bx = b_kx - sx * b_kz;
+   const float by = b_ky - sy * b_kz;
+   const float cx = c_kx - sx * c_kz;
+   const float cy = c_ky - sy * c_kz;
+
+   /* Calculate scaled barycentric coordinates. */
+   const float u = cx * by - cy * bx;
+   const float v = ax * cy - ay * cx;
+   const float w = bx * ay - by * ax;
+   float det;
+
+   if ((u < 0.0f || v < 0.0f || w < 0.0f) &&
+   (u > 0.0f || v > 0.0f || w > 0.0f))
+   {
+   return false;
+   }
+
+   /* Calculate determinant. */
+   det = u + v + w;
+   if (UNLIKELY(det == 0.0f)) {
+   return false;
+   }
+   else {
+   /* Calculate scaled z-coordinates of vertices and use them to 
calculate
+* the hit distance.
+*/
+   const float t = (u * a_kz + v * b_kz + w * c_kz) * sz;
+   /* Normalize u, v and t. */
+   const float inv_det = 1.0f / det;
+   if (r_uv) {
+   r_uv[0] = u * inv_det;
+   r_uv[1] = v * inv_det;
+   }
+   *r_lambda = t * inv_det;
+   return true;
+   }
+}
+
 MALWAYS_INLINE int isec_tri_quad(float start[3], const struct IsectRayPrecalc 
*isect_precalc, RayFace *face, float r_uv[2], float *lambda)
 {
float uv[2], l;
@@ -181,13 +243,13 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float 
start[3], float dir[3], RayFace
 
isect_ray_tri_watertight_v3_precalc(_precalc, r);
 
-   if (isect_ray_tri_watertight_v3(start, _precalc, face->v1, 
face->v2, face->v3, , uv)) {
+   if (isect_ray_tri_watertight_no_sign_check_v3(start, _precalc, 
face->v1, face->v2, face->v3, , uv)) {
return 1;
}
 
/* intersect second triangle in quad */
if (RE_rayface_isQuad(face)) {
-   if (isect_ray_tri_watertight_v3(start, _precalc, 
face->v1, face->v3, face->v4, , uv)) {
+   if (isect_ray_tri_watertight_no_sign_check_v3(start, 
_precalc, face->v1, face->v3, face->v4, , uv)) {
return 2;
}
}

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


[Bf-blender-cvs] [eb5cd57] master: Cleanup: Output argument name and const qualifier

2016-08-23 Thread Sergey Sharybin
Commit: eb5cd578b8cb9839b4b1fb8b6e9f56bbaad7bfae
Author: Sergey Sharybin
Date:   Tue Aug 23 15:56:10 2016 +0200
Branches: master
https://developer.blender.org/rBeb5cd578b8cb9839b4b1fb8b6e9f56bbaad7bfae

Cleanup: Output argument name and const qualifier

===

M   source/blender/render/intern/raytrace/rayobject.cpp

===

diff --git a/source/blender/render/intern/raytrace/rayobject.cpp 
b/source/blender/render/intern/raytrace/rayobject.cpp
index 3415e52..c16ef55 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -200,16 +200,19 @@ static bool isect_ray_tri_watertight_no_sign_check_v3(
}
 }
 
-MALWAYS_INLINE int isec_tri_quad(float start[3], const struct IsectRayPrecalc 
*isect_precalc, RayFace *face, float r_uv[2], float *lambda)
+MALWAYS_INLINE int isec_tri_quad(const float start[3],
+ const struct IsectRayPrecalc *isect_precalc,
+ const RayFace *face,
+ float r_uv[2], float *r_lambda)
 {
float uv[2], l;
 
if (isect_ray_tri_watertight_v3(start, isect_precalc, face->v1, 
face->v2, face->v3, , uv)) {
/* check if intersection is within ray length */
-   if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
+   if (l > -RE_RAYTRACE_EPSILON && l < *r_lambda) {
r_uv[0] = -uv[0];
r_uv[1] = -uv[1];
-   *lambda = l;
+   *r_lambda = l;
return 1;
}
}
@@ -218,10 +221,10 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], const 
struct IsectRayPrecalc *i
if (RE_rayface_isQuad(face)) {
if (isect_ray_tri_watertight_v3(start, isect_precalc, face->v1, 
face->v3, face->v4, , uv)) {
/* check if intersection is within ray length */
-   if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
+   if (l > -RE_RAYTRACE_EPSILON && l < *r_lambda) {
r_uv[0] = -uv[0];
r_uv[1] = -uv[1];
-   *lambda = l;
+   *r_lambda = l;
return 2;
}
}
@@ -232,13 +235,14 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], const 
struct IsectRayPrecalc *i
 
 /* Simpler yes/no Ray Triangle/Quad Intersection */
 
-MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], 
RayFace *face)
+MALWAYS_INLINE int isec_tri_quad_neighbour(const float start[3],
+   const float dir[3],
+   const RayFace *face)
 {
float r[3];
struct IsectRayPrecalc isect_precalc;
float uv[2], l;
 
-
negate_v3_v3(r, dir); /* note, different than above function */
 
isect_ray_tri_watertight_v3_precalc(_precalc, r);

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


[Bf-blender-cvs] [3d3e5ae] soc-2016-uv_tools: Lots of fixes for warnings

2016-08-23 Thread Phil Gosch
Commit: 3d3e5ae3fd42f5ec437c8d55c0983a4b4332257b
Author: Phil Gosch
Date:   Tue Aug 23 15:33:54 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB3d3e5ae3fd42f5ec437c8d55c0983a4b4332257b

Lots of fixes for warnings

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index d7ec3ab..63aa8d1 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -674,7 +674,7 @@ static PBool p_intersect_line_segments_2d(float *a, float 
*b, float *c, float *d
return P_FALSE;
 }
 
-bool p_rect_intersect(float min1[2], float max1[2], float min2[2], float 
max2[2])
+static bool p_rect_intersect(float min1[2], float max1[2], float min2[2], 
float max2[2])
 {
if (min1[0] > max2[0] ||
max1[0] < min2[0] ||
@@ -687,14 +687,14 @@ bool p_rect_intersect(float min1[2], float max1[2], float 
min2[2], float max2[2]
 }
 
 /* Returns the interval of range in which f falls in */
-int p_float_to_int_range(float f, int range)
+static int p_float_to_int_range(float f, int range)
 {
return (int)(f * (float)(range));
 }
 
 /* Returns the interval of range in which f falls in */
 /* re contains the remainder of f, linearized to 0-1 range */
-int p_float_to_int_range_remainder(float f, int range, float *re)
+static int p_float_to_int_range_remainder(float f, int range, float *re)
 {
int val = p_float_to_int_range(f, range);
*re = f * range - val;
@@ -4861,7 +4861,7 @@ void param_pack(ParamHandle *handle, float margin, bool 
do_rotate)
 /* qsort function - sort largest to smallest */
 static int vert_anglesort(const void *p1, const void *p2)
 {
-   const PVert **v1 = p1, **v2 = p2;
+   PVert **v1 = p1, **v2 = p2;
const float a1 = (*v1)->edge->u.horizontal_angle;
const float a2 = (*v2)->edge->u.horizontal_angle;
 
@@ -4873,7 +4873,7 @@ static int vert_anglesort(const void *p1, const void *p2)
 /* qsort function - sort largest to smallest */
 static int point_anglesort(const void *p1, const void *p2)
 {
-   const PPointUV **v1 = p1, **v2 = p2;
+   PPointUV **v1 = p1, **v2 = p2;
const float a1 = (*v1)->angle;
const float a2 = (*v2)->angle;
 
@@ -4885,7 +4885,7 @@ static int point_anglesort(const void *p1, const void *p2)
 /* qsort function - sort largest to smallest */
 static int chart_areasort(const void *p1, const void *p2)
 {
-   const PChart **c1 = p1, **c2 = p2;
+   PChart **c1 = p1, **c2 = p2;
const float a1 = (*c1)->u.ipack.area;
const float a2 = (*c2)->u.ipack.area;
 
@@ -4937,7 +4937,7 @@ static float p_edge_horizontal_angle_ppointuv(PPointUV 
*a, PPointUV *b)
 }
 
 /* ToDo SaphireS: Put ConvexHull/NFP stuff in own file*/
-PConvexHull *p_convex_hull_new(PChart *chart)
+static PConvexHull *p_convex_hull_new(PChart *chart)
 {
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), 
"PConvexHull");
PVert **points;
@@ -4982,7 +4982,7 @@ PConvexHull *p_convex_hull_new(PChart *chart)
return conv_hull;
 }
 
-PConvexHull *p_convex_hull_new_tri(PChart *chart, const float (*coords)[2])
+static PConvexHull *p_convex_hull_new_tri(PChart *chart, const 
float(*coords)[2])
 {
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), 
"PConvexHull");
PVert *v;
@@ -5056,7 +5056,7 @@ PConvexHull *p_convex_hull_new_tri(PChart *chart, const 
float (*coords)[2])
 }
 
 /* Update bounds and recalculate ref vertex (highest y value) */
-void p_convex_hull_update(PConvexHull *conv_hull, bool update_points)
+static void p_convex_hull_update(PConvexHull *conv_hull, bool update_points)
 {
int i;
float maxy = -1.0e30f, p[2];
@@ -5092,7 +5092,7 @@ void p_convex_hull_update(PConvexHull *conv_hull, bool 
update_points)
}
 }
 
-void p_convex_hull_delete(PConvexHull *c_hull, bool decomposed)
+static void p_convex_hull_delete(PConvexHull *c_hull)
 {
int i;
for (i = 0; i < c_hull->nverts; i++) {
@@ -5100,14 +5100,6 @@ void p_convex_hull_delete(PConvexHull *c_hull, bool 
decomposed)
MEM_freeN(c_hull->verts[i]);
}   
}
-   
-   /*if (decomposed) {
-   for (j = 0; j < 3; j++) {
-   if (c_hull->h_verts[j]) {
-   MEM_freeN(c_hull->h_verts[j]);
-   }
-   }
-   }*/
 
MEM_freeN(c_hull->verts);
MEM_freeN(c_hull->h_verts);
@@ -5115,7 +5107,7 @@ void p_convex_hull_delete(PConvexHull *c_hull, bool 
decomposed)
c_hull = NULL;
 }
 
-bool p_convex_hull_intersect(PConvexHull 

[Bf-blender-cvs] [7783ab1] soc-2016-uv_tools: Compile fix. Also fixed a few "unused variable" warnings

2016-08-23 Thread Phil Gosch
Commit: 7783ab10b96c4ea8e135278a34486ffcc93f0b8a
Author: Phil Gosch
Date:   Tue Aug 23 14:09:27 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB7783ab10b96c4ea8e135278a34486ffcc93f0b8a

Compile fix. Also fixed a few "unused variable" warnings

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 6c5fd26..d7ec3ab 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -480,7 +480,6 @@ static float p_chart_uv_area_signed(PChart *chart)
 static float p_face_uv_area_combined(ParamHandle *handle)
 {
PHandle *phandle = (PHandle *)handle;
-   PFace *f;
float used_area = 0.0f;
int i;
 
@@ -4942,7 +4941,7 @@ PConvexHull *p_convex_hull_new(PChart *chart)
 {
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), 
"PConvexHull");
PVert **points;
-   float minv[2], maxv[2], maxy = -1.0e30f;
+   float maxy = -1.0e30f;
int npoint, right, i;
 
if (!p_chart_convex_hull(chart, , , ))
@@ -4987,8 +4986,8 @@ PConvexHull *p_convex_hull_new_tri(PChart *chart, const 
float (*coords)[2])
 {
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), 
"PConvexHull");
PVert *v;
-   float minv[2], maxv[2], pos[2], maxy = -1.0e30f;
-   int npoint = 3, right = 0, i, j;
+   float pos[2], maxy = -1.0e30f;
+   int npoint = 3, right = 0, i;
 
printf("p_convex_hull_new_tri!\n");
 
@@ -5095,7 +5094,7 @@ void p_convex_hull_update(PConvexHull *conv_hull, bool 
update_points)
 
 void p_convex_hull_delete(PConvexHull *c_hull, bool decomposed)
 {
-   int i, j;
+   int i;
for (i = 0; i < c_hull->nverts; i++) {
if (c_hull->verts[i]) {
MEM_freeN(c_hull->verts[i]);
@@ -5123,7 +5122,6 @@ bool p_convex_hull_intersect(PConvexHull *chull_a, 
PConvexHull *chull_b)
return false;
}

-   PEdge *e1, *e2;
int i, j;
 
/* Check edges for intersctions */
@@ -5261,7 +5259,7 @@ void p_convex_hull_grow(PConvexHull *chull, float margin)
PVert *v1, *v2, *v3;
//PPointUV *p1, *p2, *p3;
float vec1[2], vec2[2], vec3[2];
-   float angle, dist_fac;
+   float dist_fac;
float a[2], b[2], dir[2], end_pos[2], a_n[2], b_n[2];
int i;

@@ -5355,7 +5353,6 @@ PNoFitPolygon *p_inner_fit_polygon_create(PConvexHull 
*item)
nfp->nverts = 4;
PVert **points = (PVert **)MEM_mallocN(sizeof(PVert *) * nfp->nverts, 
"PNFPPoints");
nfp->final_pos = (PPointUV **)MEM_callocN(sizeof(*nfp->final_pos) * 
nfp->nverts, "PNFPFinalPos");
-   int i, j, offset;
 
PPointUV *p1 = (PPointUV *)MEM_callocN(sizeof(*p1), "PPointUV");
PPointUV *p2 = (PPointUV *)MEM_callocN(sizeof(*p2), "PPointUV");
@@ -5544,7 +5541,6 @@ PNoFitPolygon *p_no_fit_polygon_create(PConvexHull *item, 
PConvexHull *fixed)
PPointUV **fpoints = (PPointUV **)MEM_mallocN(sizeof(PPointUV *) * 
nfp->nverts, "PNFPFPoints");
nfp->final_pos = (PPointUV **)MEM_callocN(sizeof(*nfp->final_pos) * 
nfp->nverts, "PNFPFinalPos");
int i, j;
-   float trans[2];
 
/* Assign verts of hulls to NFP */
for (i = 0; i < nfp->nverts; i++) {
@@ -5934,11 +5930,9 @@ void param_irregular_pack_begin(ParamHandle *handle, 
float *w_area, float margin
 {
PHandle *phandle = (PHandle *)handle;
PChart *chart;
-   PVert **points;
PEdge *outer, *e;
PFace *f;
-   PConvexHull **tris;
-   int npoint, right, i, j, nboundaries = 0;
+   int i, j, nboundaries = 0;
unsigned int seed = 31415925;
float used_area, init_scale, init_value = 0.6f, randf1, rot;
 
@@ -6555,24 +6549,27 @@ void param_flush_restore(ParamHandle *handle)
}
 }
 
-void param_accept_placement(ParamHandle *handle, PChart *chart)
+void param_accept_placement(ParamHandle *handle)
 {
PHandle *phandle = (PHandle *)handle;
PConvexHull *chull;
int i;
printf("param_store_packing_solution\n");
 
-   chart = phandle->charts[i];
-   chull = chart->u.ipack.convex_hull;
-   chart->u.ipack.best_pos->x = 
chull->h_verts[chull->ref_vert_index]->uv[0];
-   chart->u.ipack.best_pos->y = 
chull->h_verts[chull->ref_vert_index]->uv[1];
+   for (i = 0; i < phandle->ncharts; i++) {
+   PChart *chart = phandle->charts[i];
+   chart = phandle->charts[i];
+   chull = chart->u.ipack.convex_hull;
+   chart->u.ipack.best_pos->x = 
chull->h_verts[chull->ref_vert_index]->uv[0];
+   chart->u.ipack.best_pos->y = 

[Bf-blender-cvs] [f732293] master: OpenCL: Support multiple ABI libraries on Linux

2016-08-23 Thread Sergey Sharybin
Commit: f7322931471a3161ca32dc0ca47fe013d56cf566
Author: Sergey Sharybin
Date:   Tue Aug 23 12:23:37 2016 +0200
Branches: master
https://developer.blender.org/rBf7322931471a3161ca32dc0ca47fe013d56cf566

OpenCL: Support multiple ABI libraries on Linux

Solves issue reported in T49144.

===

M   extern/clew/README.blender
M   extern/clew/src/clew.c

===

diff --git a/extern/clew/README.blender b/extern/clew/README.blender
index e500a1b..8355a96 100644
--- a/extern/clew/README.blender
+++ b/extern/clew/README.blender
@@ -1,5 +1,5 @@
 Project: OpenCL Wrangler
 URL: https://github.com/OpenCLWrangler/clew
 License: Apache 2.0
-Upstream version: 277db43
+Upstream version: 309a653
 Local modifications: None
diff --git a/extern/clew/src/clew.c b/extern/clew/src/clew.c
index e3adabd..3717c74 100644
--- a/extern/clew/src/clew.c
+++ b/extern/clew/src/clew.c
@@ -137,6 +137,17 @@ PFNCLCREATEFROMGLTEXTURE3D  
__clewCreateFromGLTexture3D = NULL;
 #endif
 PFNCLGETGLCONTEXTINFOKHR__clewGetGLContextInfoKHR   = NULL;
 
+static CLEW_DYNLIB_HANDLE dynamic_library_open_find(const char **paths) {
+  int i = 0;
+  while (paths[i] != NULL) {
+  CLEW_DYNLIB_HANDLE lib = CLEW_DYNLIB_OPEN(paths[i]);
+  if (lib != NULL) {
+return lib;
+  }
+  ++i;
+  }
+  return NULL;
+}
 
 static void clewExit(void)
 {
@@ -151,11 +162,15 @@ static void clewExit(void)
 int clewInit()
 {
 #ifdef _WIN32
-const char *path = "OpenCL.dll";
+const char *paths[] = {"OpenCL.dll", NULL};
 #elif defined(__APPLE__)
-const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
+const char *paths[] = {"/Library/Frameworks/OpenCL.framework/OpenCL", 
NULL};
 #else
-const char *path = "libOpenCL.so";
+const char *paths[] = {"libOpenCL.so",
+   "libOpenCL.so.0",
+   "libOpenCL.so.1",
+   "libOpenCL.so.2",
+   NULL};
 #endif
 
 int error = 0;
@@ -167,7 +182,7 @@ int clewInit()
 }
 
 //  Load library
-module = CLEW_DYNLIB_OPEN(path);
+module = dynamic_library_open_find(paths);
 
 //  Check for errors
 if (module == NULL)

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


[Bf-blender-cvs] [e2f323c] master: attempt to fix compilation error on windows

2016-08-23 Thread Sergey Sharybin
Commit: e2f323c3ec2352c11d16a4fb2920184491300166
Author: Sergey Sharybin
Date:   Tue Aug 23 12:01:55 2016 +0200
Branches: master
https://developer.blender.org/rBe2f323c3ec2352c11d16a4fb2920184491300166

attempt to fix compilation error on windows

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index cc552d8..df42f25 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1158,7 +1158,7 @@ static void stabilization_calculate_data(StabContext *ctx,
  bool do_compensate,
  float scale_step,
  float r_translation[2],
- float r_pivot[0],
+ float r_pivot[2],
  float *r_scale,
  float *r_angle)
 {
@@ -1184,7 +1184,7 @@ static void stabilization_calculate_data(StabContext *ctx,
target_scale = get_animated_target_scale(ctx,framenr);
if (target_scale != 0.0f) {
*r_scale /= target_scale;
-   /* target_scale is an expected/intended reference zoom value*/
+   /* target_scale is an expected/intended reference zoom value */
}
 
/* Convert from relative to absolute coordinates, square pixels. */

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


[Bf-blender-cvs] [baaa2d6] master: Change Request: use weight centre of location tracks as pivot

2016-08-23 Thread Ichthyostega
Commit: baaa2d6d396ef8003cf2241ae0a6304d6aebb496
Author: Ichthyostega
Date:   Mon Aug 22 07:02:22 2016 +0200
Branches: master
https://developer.blender.org/rBbaaa2d6d396ef8003cf2241ae0a6304d6aebb496

Change Request: use weight centre of location tracks as pivot

Previously, this extension used the translation compensated image centre
as reference point for rotation measurement and compensation. During
user tests, it turned out that this setup tends to give poor results
with very simple track configurations.

This can be improved by useiing the weighted average of the location
tracks for each frame as pivot point. But there is a technical problem:
the existing public API functions do not allow to pass the pivot point
for each frame alongside with the stabilisation data. Thus this
change implements a trick to package a compensation shift into
the translation offset, so the rotation can be performed around
a fixed point (center of frame). The compensation shift will then shift
the image as if it had been rotated around the desired pivot point.

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index 93addc4..758e1c4 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -452,6 +452,29 @@ static MovieTrackingMarker *get_tracking_data_point(
}
 }
 
+
+/* Define the reference point for rotation/scale measurement and compensation.
+ * The stabilizator works by assuming the image was distorted by a affine 
linear
+ * transform, i.e. it was rotated and stretched around this reference point
+ * (pivot point) and then shifted laterally. Any scale and orientation changes
+ * will be picked up relative to this point. And later the image will be
+ * stabilized by rotating around this point. The result can only be as
+ * accurate as this pivot point actually matches the real rotation center
+ * of the actual movements. Thus any scheme to define a pivot point is
+ * always guesswork.
+ *
+ * As a simple default, we use the weighted average of the location markers
+ * of the current frame as pivot point. TODO It is planned to add further
+ * options,  like e.g. anchoring the pivot point at the canvas. Moreover,
+ * it is planned to allow for a user controllable offset.
+ */
+static void setup_pivot(const float ref_pos[2], float r_pivot[2])
+{
+   zero_v2(r_pivot);  /* TODO: add an animated offset position here. */
+   add_v2_v2(r_pivot, ref_pos);
+}
+
+
 /* Calculate the contribution of a single track at the time position (frame) of
  * the given marker. Each track has a local reference frame, which is as close
  * as possible to the global anchor_frame. Thus the translation contribution is
@@ -508,22 +531,21 @@ static void 
translation_contribution(TrackStabilizationBase *track_ref,
  *   in the same framework, we average the scales as logarithms.
  *
  * aspect is a total aspect ratio of the undistorted image (includes fame and
- * pixel aspect).
+ * pixel aspect). The function returns a quality factor, which can be used
+ * to damp the contributions of points in close proximity to the pivot point,
+ * since such contributions might be dominated by rounding errors and thus
+ * poison the calculated average. When the quality factor goes towards zero,
+ * the weight of this contribution should be reduced accordingly.
  */
-static void rotation_contribution(TrackStabilizationBase *track_ref,
-  MovieTrackingMarker *marker,
-  float aspect,
-  float target_pos[2],
-  float averaged_translation_contribution[2],
-  float *result_angle,
-  float *result_scale)
+static float rotation_contribution(TrackStabilizationBase *track_ref,
+   MovieTrackingMarker *marker,
+   const float aspect,
+   const float pivot[2],
+   float *result_angle,
+   float *result_scale)
 {
-   float len;
+   float len, quality;
float pos[2];
-   float pivot[2];
-   copy_v2_fl(pivot, 0.5f);  /* Use center of frame as hard wired pivot. */
-   add_v2_v2(pivot, averaged_translation_contribution);
-   sub_v2_v2(pivot, target_pos);
sub_v2_v2v2(pos, marker->pos, pivot);
 
pos[0] *= aspect;
@@ -531,9 +553,47 @@ static void rotation_contribution(TrackStabilizationBase 
*track_ref,
 
*result_angle = atan2f(pos[1],pos[0]);
 
-   len = len_v2(pos) + SCALE_ERROR_LIMIT_BIAS;
+   len = len_v2(pos);
+

[Bf-blender-cvs] [9c3b9f6] master: 2D stabilization: Fix broken auto-scale all the recent work

2016-08-23 Thread Sergey Sharybin
Commit: 9c3b9f6a836ace08baf04cf4e716a73f9797f88d
Author: Sergey Sharybin
Date:   Tue Aug 23 11:48:29 2016 +0200
Branches: master
https://developer.blender.org/rB9c3b9f6a836ace08baf04cf4e716a73f9797f88d

2D stabilization: Fix broken auto-scale all the recent work

Auto-scale is expected to work just fine now.

Only thing changed now is the pivot point for the scale: it is now
the same as rotation pivot, so scaling happens around weighted median
of the translation tracks. This seems to be what is actually required
for the VFX workflow.

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index 758e1c4..cc552d8 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -768,15 +768,15 @@ static void average_marker_positions(StabContext *ctx, 
int framenr, float r_ref_
if (track->flag & TRACK_USE_2D_STAB) {
int startpoint = 
search_closest_marker_index(track, framenr);
retrieve_next_higher_usable_frame(ctx,
-  track,
-  startpoint,
-  framenr,
-  _higher);
+ track,
+ startpoint,
+ framenr,
+ _higher);
retrieve_next_lower_usable_frame(ctx,
-  track,
-  startpoint,
-  framenr,
-  _lower);
+track,
+startpoint,
+framenr,
+_lower);
}
}
if (next_lower >= MINFRAME) {
@@ -1205,6 +1205,41 @@ static void stabilization_calculate_data(StabContext 
*ctx,
}
 }
 
+static void stabilization_data_to_mat4(float pixel_aspect,
+   const float pivot[2],
+   const float translation[2],
+   float scale,
+   float angle,
+   float r_mat[4][4])
+{
+   float translation_mat[4][4], rotation_mat[4][4], scale_mat[4][4],
+ pivot_mat[4][4], inv_pivot_mat[4][4],
+ aspect_mat[4][4], inv_aspect_mat[4][4];
+   float scale_vector[3] = {scale, scale, 1.0f};
+
+   unit_m4(translation_mat);
+   unit_m4(rotation_mat);
+   unit_m4(scale_mat);
+   unit_m4(aspect_mat);
+   unit_m4(pivot_mat);
+   unit_m4(inv_pivot_mat);
+
+   /* aspect ratio correction matrix */
+   aspect_mat[0][0] /= pixel_aspect;
+   invert_m4_m4(inv_aspect_mat, aspect_mat);
+
+   add_v2_v2(pivot_mat[3], pivot);
+   sub_v2_v2(inv_pivot_mat[3], pivot);
+
+   size_to_mat4(scale_mat, scale_vector);   /* scale matrix */
+   add_v2_v2(translation_mat[3], translation);  /* translation matrix */
+   rotate_m4(rotation_mat, 'Z', angle); /* rotation matrix */
+
+   /* Compose transformation matrix. */
+   mul_m4_series(r_mat, aspect_mat, translation_mat,
+pivot_mat, scale_mat, rotation_mat, inv_pivot_mat,
+inv_aspect_mat);
+}
 
 /* Calculate scale factor necessary to eliminate black image areas
  * caused by the compensating movements of the stabilizator.
@@ -1215,7 +1250,8 @@ static void stabilization_calculate_data(StabContext *ctx,
  * NOTE: all tracks need to be initialized before calling this function.
  */
 static float calculate_autoscale_factor(StabContext *ctx,
-int size, float aspect)
+int size,
+float aspect)
 {
MovieTrackingStabilization *stab = ctx->stab;
float pixel_aspect = ctx->tracking->camera.pixel_aspect;
@@ -1241,15 +1277,13 @@ static float calculate_autoscale_factor(StabContext 
*ctx,
use_values_from_fcurves(ctx, true);
for (cfra = sfra; cfra <= efra; cfra++) {
float 

[Bf-blender-cvs] [498ba75] master: 2D stabilization: by default init anchor_frame to frame 1

2016-08-23 Thread Ichthyostega
Commit: 498ba756abeec746322b883d98ba6a192f37e7ea
Author: Ichthyostega
Date:   Mon Aug 22 17:29:19 2016 +0200
Branches: master
https://developer.blender.org/rB498ba756abeec746322b883d98ba6a192f37e7ea

2D stabilization: by default init anchor_frame to frame 1

It is common in blender to use 1-based counting for
frame sequences (while 0-based is allowed). Thus
initializing to use frame 1 as reference for stabilization
is likely to produce smooth start values in most cases

===

M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenloader/intern/versioning_270.c

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index d5d3384..a86606f 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -330,7 +330,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
tracking->settings.object_distance = 1;
 
tracking->stabilization.scaleinf = 1.0f;
-   tracking->stabilization.anchor_frame = MINFRAME;
+   tracking->stabilization.anchor_frame = 1;
zero_v2(tracking->stabilization.target_pos);
tracking->stabilization.target_rot = 0.0f;
tracking->stabilization.scale = 1.0f;
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index 1ef32d6..49ef8ba 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1373,6 +1373,9 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
 * now used always (as "target scale") 
*/
clip->tracking.stabilization.scale = 
1.0f;
}
+   /* blender prefers 1-based frame counting;
+* thus using frame 1 as reference typically 
works best */
+   clip->tracking.stabilization.anchor_frame = 1;
/* by default show the track lists expanded, to 
improve "discoverability" */
clip->tracking.stabilization.flag |= 
TRACKING_SHOW_STAB_TRACKS;
/* deprecated, not used anymore */

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


[Bf-blender-cvs] [3dbe174] master: 2D stabilization: flip orientation of the scale parameter

2016-08-23 Thread Ichthyostega
Commit: 3dbe1744402c2790d7854f09cf977bb275436479
Author: Ichthyostega
Date:   Mon Aug 22 17:22:06 2016 +0200
Branches: master
https://developer.blender.org/rB3dbe1744402c2790d7854f09cf977bb275436479

2D stabilization: flip orientation of the scale parameter

values > 1 will zoom in and values < 1 zoom out

Rationale: the changed orientation is more natural
from a user POV and doing it this way is also more
consistent with the calculation of the other
target_* parameters.

Compatibility: This will break *.blend files saved
with the previous version of this patch from the
last days (test period). It will *not* break any
old/migrated files: Previously, the DNA field "scale"
was only used to cache autoscale. Only with the
Stabilisator rework, "scale" becomes a first class
persistent DNA field. There is migration code to
init this field to 1.0

===

M   source/blender/blenkernel/intern/tracking_stabilize.c
M   source/blender/blenloader/intern/versioning_270.c
M   source/blender/makesrna/intern/rna_tracking.c

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index 0f04724..93addc4 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1020,13 +1020,13 @@ static void stabilization_calculate_data(StabContext 
*ctx,
  float *r_scale,
  float *r_angle)
 {
-   float target_pos[2];
+   float target_pos[2], target_scale;
float scaleinf = get_animated_scaleinf(ctx, framenr);
 
-   *r_scale = get_animated_target_scale(ctx,framenr);
-
if (ctx->stab->flag & TRACKING_STABILIZE_SCALE) {
-   *r_scale *= expf(scale_step * scaleinf);  /* Averaged in log 
scale */
+   *r_scale = expf(scale_step * scaleinf);  /* Averaged in log 
scale */
+   } else {
+   *r_scale = 1.0f;
}
 
mul_v2_fl(r_translation, get_animated_locinf(ctx, framenr));
@@ -1039,6 +1039,11 @@ static void stabilization_calculate_data(StabContext 
*ctx,
get_animated_target_pos(ctx, framenr, target_pos);
sub_v2_v2(r_translation, target_pos);
*r_angle -= get_animated_target_rot(ctx,framenr);
+   target_scale = get_animated_target_scale(ctx,framenr);
+   if (target_scale != 0.0f) {
+   *r_scale /= target_scale;
+   /* target_scale is an expected/intended reference zoom value*/
+   }
 
/* Convert from relative to absolute coordinates, square pixels. */
r_translation[0] *= (float)size * aspect;
@@ -1194,9 +1199,9 @@ static void 
stabilization_determine_safe_image_area(StabContext *ctx,
J = G - E;
K = G * F - E * H;
 
-   S = (dx * I + dy * J + K) / (-w * I - h 
* J);
+   S = (-w * I - h * J) / (dx * I + dy * J 
+ K);
 
-   scale = min_ff(scale, S);
+   scale = max_ff(scale, S);
}
}
}
@@ -1205,7 +1210,7 @@ static void 
stabilization_determine_safe_image_area(StabContext *ctx,
stab->scale = scale;
 
if (stab->maxscale > 0.0f) {
-   stab->scale = max_ff(stab->scale, 1.0f / stab->maxscale);
+   stab->scale = min_ff(stab->scale, stab->maxscale);
}
 }
 
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index f6ac42c..1ef32d6 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -91,9 +91,6 @@ static void 
migrate_single_rot_stabilization_track_settings(MovieTrackingStabili
}
}
stab->rot_track = NULL; /* this field is now ignored */
-
-   /* by default show the track lists expanded, to improve 
"discoverability" */
-   stab->flag |= TRACKING_SHOW_STAB_TRACKS;
 }
 
 static void do_version_constraints_radians_degrees_270_1(ListBase *lb)
@@ -1369,13 +1366,17 @@ void blo_do_versions_270(FileData *fd, Library 
*UNUSED(lib), Main *main)
for (clip = main->movieclip.first; clip != NULL; clip = 
clip->id.next) {
if (clip->tracking.stabilization.rot_track) {

migrate_single_rot_stabilization_track_settings(>tracking.stabilization);
-   if 
(!clip->tracking.stabilization.scale) {
-   /* ensure init.
-* Was previously used for 

[Bf-blender-cvs] [fd65a64] master: 2D stabilization: change presentation of target_scale in UI

2016-08-23 Thread Ichthyostega
Commit: fd65a649303cee33266c6fab5f86df47545e
Author: Ichthyostega
Date:   Fri Aug 19 14:33:49 2016 +0200
Branches: master
https://developer.blender.org/rBfd65a649303cee33266c6fab5f86df47545e

2D stabilization: change presentation of target_scale in UI

Alongside with this change, we fix disabling of Autoscale,
because this feature works even when rotation/scale is disabled.

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/makesrna/intern/rna_tracking.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 8d581e8..5cc1353 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -960,7 +960,6 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, 
Panel):
  icon='DOWNARROW_HLT')
 
 row = layout.row()
-row.active = stab.use_stabilize_rotation
 row.prop(stab, "use_autoscale")
 sub = row.row()
 sub.active = stab.use_autoscale
@@ -971,10 +970,9 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, 
Panel):
 # Hrm, how to make it more obvious label?
 row.prop(stab, "target_position", text="")
 col.prop(stab, "target_rotation")
-if stab.use_autoscale:
-col.label(text="Auto Scale Factor: %5.3f" % (1.0 / 
stab.target_zoom))
-else:
-col.prop(stab, "target_zoom")
+row = col.row(align=True)
+row.prop(stab, "target_scale")
+row.active = not stab.use_autoscale
 
 col = layout.column(align=True)
 col.prop(stab, "influence_location")
diff --git a/source/blender/makesrna/intern/rna_tracking.c 
b/source/blender/makesrna/intern/rna_tracking.c
index 2d068bb..6e41a7a 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -1774,7 +1774,7 @@ static void rna_def_trackingStabilization(BlenderRNA 
*brna)
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
/* target scale */
-   prop = RNA_def_property(srna, "target_zoom", PROP_FLOAT, PROP_FACTOR);
+   prop = RNA_def_property(srna, "target_scale", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "scale");
RNA_def_property_range(prop, FLT_EPSILON, FLT_MAX);
RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.001f, 3); /* increment 
in steps of 0.001. Show 3 digit after point */

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


[Bf-blender-cvs] [95d3ca8] master: Fix inconsistency: expected scale not be subject to scale influence

2016-08-23 Thread Ichthyostega
Commit: 95d3ca8bc68c85643b9ce6b7340e2e1f48224fc2
Author: Ichthyostega
Date:   Fri Aug 19 15:12:52 2016 +0200
Branches: master
https://developer.blender.org/rB95d3ca8bc68c85643b9ce6b7340e2e1f48224fc2

Fix inconsistency: expected scale not be subject to scale influence

We should treat all three "target" ("expected") parameters in a similar way:
The "influence" control should only work on the measurement part of 
stabilisation,
i.e. it should only control the automatic part of stabilisation, while
the target parameters are deliberately set by the user and thus should
even be in effect when the automatic stabilsation is turned down.

It used to be so for location and rotation, but for the scale part,
I re-used the existing code for autoscale, which also had the scale influence
work on the autoscale factor. This was sensible in the old version,
since scale_influence was the only way to control the result. But now,
the user has always total control trough the "target_*" parameters
and thus we should prefer to treat all similar.

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index 4d72d85..0f04724 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -1023,7 +1023,7 @@ static void stabilization_calculate_data(StabContext *ctx,
float target_pos[2];
float scaleinf = get_animated_scaleinf(ctx, framenr);
 
-   *r_scale = (get_animated_target_scale(ctx,framenr) - 1.0f) * scaleinf + 
1.0f;
+   *r_scale = get_animated_target_scale(ctx,framenr);
 
if (ctx->stab->flag & TRACKING_STABILIZE_SCALE) {
*r_scale *= expf(scale_step * scaleinf);  /* Averaged in log 
scale */

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


[Bf-blender-cvs] [9694480] soc-2016-uv_tools: Make convex packing default setting for irregular packing operator for now

2016-08-23 Thread Phil Gosch
Commit: 969448019e24b145dabedf8d959995d40d103e47
Author: Phil Gosch
Date:   Tue Aug 23 11:32:31 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB969448019e24b145dabedf8d959995d40d103e47

Make convex packing default setting for irregular packing operator for now

===

M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 4320d35..c32c6ba 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1096,7 +1096,7 @@ void UV_OT_irregular_pack_islands(wmOperatorType *ot)
ot->poll = ED_operator_uvedit;
 
/* properties */
-   RNA_def_boolean(ot->srna, "concave", true, "Use concave boundaries", 
"Use concave boundaries (slower but better results)");
+   RNA_def_boolean(ot->srna, "concave", false, "Use concave boundaries", 
"Use concave boundaries (slower but better results)");
RNA_def_float(ot->srna, "margin", 0.0f, 0.0f, 1.0f, "Margin", "Border 
Margin/Padding to apply per UV island", 0.0f, 1.0f);
RNA_def_int(ot->srna, "rotation_steps", 4, 0, 360, "Rotation Steps", 
"Allowed rotations to try during packing. (2=180�, 4=90�, etc.)", 0, 360);
RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations", 
"Number of iterations to run, 0 is unlimited when run interactively", 0, 1);

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