[Bf-blender-cvs] [4db7842a72c] master: BLI_math: use fallback for compatible quaternion calculation

2019-03-18 Thread Campbell Barton
Commit: 4db7842a72cc2f9cdca31c08d45c703ad8519dc0
Author: Campbell Barton
Date:   Tue Mar 19 17:39:14 2019 +1100
Branches: master
https://developer.blender.org/rB4db7842a72cc2f9cdca31c08d45c703ad8519dc0

BLI_math: use fallback for compatible quaternion calculation

Copy the new value when the compatible quaternion isn't usable.

===

M   source/blender/blenlib/intern/math_rotation.c

===

diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index d52c8f54096..5f6bbcce3b3 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -207,14 +207,20 @@ void pow_qt_fl_normalized(float q[4], const float fac)
  */
 void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
 {
+   const float eps = 1e-4f;
BLI_ASSERT_UNIT_QUAT(a);
-   float delta[4];
float old_unit[4];
-   normalize_qt_qt(old_unit, old);
-   rotation_between_quats_to_quat(delta, old_unit, a);
-   mul_qt_qtqt(q, old, delta);
-   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
-   negate_v4(q);
+   /* Skips `!finite_v4(old)` case too. */
+   if (normalize_qt_qt(old_unit, old) > eps) {
+   float delta[4];
+   rotation_between_quats_to_quat(delta, old_unit, a);
+   mul_qt_qtqt(q, old, delta);
+   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
+   negate_v4(q);
+   }
+   }
+   else {
+   copy_qt_qt(q, a);
}
 }

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


[Bf-blender-cvs] [e2ec045cc99] master: BLI_math: add utility to calculate compatible quaternions

2019-03-18 Thread Campbell Barton
Commit: e2ec045cc995bb8767a5f88e8830aa1062921011
Author: Campbell Barton
Date:   Tue Mar 19 16:50:18 2019 +1100
Branches: master
https://developer.blender.org/rBe2ec045cc995bb8767a5f88e8830aa1062921011

BLI_math: add utility to calculate compatible quaternions

===

M   source/blender/blenlib/BLI_math_rotation.h
M   source/blender/blenlib/intern/math_rotation.c

===

diff --git a/source/blender/blenlib/BLI_math_rotation.h 
b/source/blender/blenlib/BLI_math_rotation.h
index 5246d7ad1a9..60adcf8c762 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -77,6 +77,8 @@ void add_qt_qtqt(float q[4], const float a[4], const float 
b[4], const float t);
 void quat_to_mat3(float mat[3][3], const float q[4]);
 void quat_to_mat4(float mat[4][4], const float q[4]);
 
+void quat_to_compatible_quat(float q[4], const float a[4], const float old[4]);
+
 void mat3_normalized_to_quat(float q[4], const float mat[3][3]);
 void mat4_normalized_to_quat(float q[4], const float mat[4][4]);
 void mat3_to_quat(float q[4], const float mat[3][3]);
diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index a348edaece8..d52c8f54096 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -201,6 +201,23 @@ void pow_qt_fl_normalized(float q[4], const float fac)
normalize_v3_length(q + 1, si);
 }
 
+/**
+ * Apply the rotation of \a a to \a q keeping the values compatible with \a 
old.
+ * Avoid axis flipping for animated f-curves for eg.
+ */
+void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
+{
+   BLI_ASSERT_UNIT_QUAT(a);
+   float delta[4];
+   float old_unit[4];
+   normalize_qt_qt(old_unit, old);
+   rotation_between_quats_to_quat(delta, old_unit, a);
+   mul_qt_qtqt(q, old, delta);
+   if ((q[0] < 0.0f) != (old[0] < 0.0f)) {
+   negate_v4(q);
+   }
+}
+
 /* skip error check, currently only needed by mat3_to_quat_is_ok */
 static void quat_to_mat3_no_error(float m[3][3], const float q[4])
 {

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


[Bf-blender-cvs] [40e85a603c9] master: Fix pose slide interpolation

2019-03-18 Thread Campbell Barton
Commit: 40e85a603c982b96fef51212deb086f6ddb73407
Author: Campbell Barton
Date:   Tue Mar 19 17:17:34 2019 +1100
Branches: master
https://developer.blender.org/rB40e85a603c982b96fef51212deb086f6ddb73407

Fix pose slide interpolation

- Quaternions weren't normalized before interpolating
  causing incorrect results & assert.

- Make the newly calculated quaternion compatible with the previous
  to avoid axis-flipping & setting values with large changes compared
  to existing key-frames.

===

M   source/blender/editors/armature/pose_slide.c

===

diff --git a/source/blender/editors/armature/pose_slide.c 
b/source/blender/editors/armature/pose_slide.c
index 1545576e208..8b0bfadcbe7 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -558,54 +558,67 @@ static void pose_slide_apply_quat(tPoseSlideOp *pso, 
tPChanFCurveLink *pfl)
 
/* only if all channels exist, proceed */
if (fcu_w && fcu_x && fcu_y && fcu_z) {
-   float quat_prev[4], quat_next[4];
+   float quat_prev[4], quat_prev_orig[4];
+   float quat_next[4], quat_next_orig[4];
+   float quat_curr[4], quat_curr_orig[4];
+   float quat_final[4];
+
+   copy_qt_qt(quat_curr_orig, pchan->quat);
 
/* get 2 quats */
-   quat_prev[0] = evaluate_fcurve(fcu_w, prevFrameF);
-   quat_prev[1] = evaluate_fcurve(fcu_x, prevFrameF);
-   quat_prev[2] = evaluate_fcurve(fcu_y, prevFrameF);
-   quat_prev[3] = evaluate_fcurve(fcu_z, prevFrameF);
+   quat_prev_orig[0] = evaluate_fcurve(fcu_w, prevFrameF);
+   quat_prev_orig[1] = evaluate_fcurve(fcu_x, prevFrameF);
+   quat_prev_orig[2] = evaluate_fcurve(fcu_y, prevFrameF);
+   quat_prev_orig[3] = evaluate_fcurve(fcu_z, prevFrameF);
+
+   quat_next_orig[0] = evaluate_fcurve(fcu_w, nextFrameF);
+   quat_next_orig[1] = evaluate_fcurve(fcu_x, nextFrameF);
+   quat_next_orig[2] = evaluate_fcurve(fcu_y, nextFrameF);
+   quat_next_orig[3] = evaluate_fcurve(fcu_z, nextFrameF);
 
-   quat_next[0] = evaluate_fcurve(fcu_w, nextFrameF);
-   quat_next[1] = evaluate_fcurve(fcu_x, nextFrameF);
-   quat_next[2] = evaluate_fcurve(fcu_y, nextFrameF);
-   quat_next[3] = evaluate_fcurve(fcu_z, nextFrameF);
+   normalize_qt_qt(quat_prev, quat_prev_orig);
+   normalize_qt_qt(quat_next, quat_next_orig);
+   normalize_qt_qt(quat_curr, quat_curr_orig);
 
/* perform blending */
if (pso->mode == POSESLIDE_BREAKDOWN) {
/* just perform the interpol between quat_prev and 
quat_next using pso->percentage as a guide */
-   interp_qt_qtqt(pchan->quat, quat_prev, quat_next, 
pso->percentage);
+   interp_qt_qtqt(quat_final, quat_prev, quat_next, 
pso->percentage);
}
else if (pso->mode == POSESLIDE_PUSH) {
-   float quat_diff[4], quat_orig[4];
+   float quat_diff[4];
 
/* calculate the delta transform from the previous to 
the current */
/* TODO: investigate ways to favour one transform more? 
*/
-   sub_qt_qtqt(quat_diff, pchan->quat, quat_prev);
-
-   /* make a copy of the original rotation */
-   copy_qt_qt(quat_orig, pchan->quat);
+   sub_qt_qtqt(quat_diff, quat_curr, quat_prev);
 
/* increase the original by the delta transform, by an 
amount determined by percentage */
-   add_qt_qtqt(pchan->quat, quat_orig, quat_diff, 
pso->percentage);
+   add_qt_qtqt(quat_final, quat_curr, quat_diff, 
pso->percentage);
+
+   normalize_qt(quat_final);
}
else {
-   float quat_interp[4], quat_orig[4];
+   BLI_assert(pso->mode == POSESLIDE_RELAX);
+   float quat_interp[4], quat_final_prev[4];
/* TODO: maybe a sensitivity ctrl on top of this is 
needed */
int iters = (int)ceil(10.0f * pso->percentage);
 
+   copy_qt_qt(quat_final, quat_curr);
+
/* perform this blending several times until a 
satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the 
endpoints */
interp_qt_qtqt(quat_interp, quat_prev, 
quat_next, (cframe - pso->prevFrame) / (pso->nextFrame - pso->prevFrame));
 
-   

[Bf-blender-cvs] [5ef4b0438cf] master: Cleanup: trailing space

2019-03-18 Thread Campbell Barton
Commit: 5ef4b0438cf4773e7dd8c661388bb2c3079869bf
Author: Campbell Barton
Date:   Tue Mar 19 15:03:21 2019 +1100
Branches: master
https://developer.blender.org/rB5ef4b0438cf4773e7dd8c661388bb2c3079869bf

Cleanup: trailing space

===

M   intern/cycles/device/opencl/opencl.h
M   intern/cycles/device/opencl/opencl_split.cpp
M   intern/ghost/intern/GHOST_ContextCGL.mm
M   intern/ghost/intern/GHOST_DisplayManagerCocoa.mm
M   intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
M   intern/ghost/intern/GHOST_SystemCocoa.mm
M   intern/ghost/intern/GHOST_SystemPathsCocoa.mm
M   intern/ghost/intern/GHOST_WindowCocoa.mm
M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
M   source/blender/editors/gpencil/drawgpencil.c
M   source/blender/editors/gpencil/gpencil_brush.c

===

diff --git a/intern/cycles/device/opencl/opencl.h 
b/intern/cycles/device/opencl/opencl.h
index a8ad4a935f7..89761293638 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -296,9 +296,9 @@ public:
const string& get_log() const { return log; }
void report_error();
 
-   /* Wait until this kernel is available to be used 
+   /* Wait until this kernel is available to be used
 * It will return true when the kernel is available.
-* It will return false when the kernel is not available 
+* It will return false when the kernel is not available
 * or could not be loaded. */
bool wait_for_availability();
 
diff --git a/intern/cycles/device/opencl/opencl_split.cpp 
b/intern/cycles/device/opencl/opencl_split.cpp
index fd7eebf0221..489d10b7087 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -396,8 +396,8 @@ public:
OpenCLDevice::OpenCLProgram(device,
program_name,

device->get_opencl_program_filename(kernel_name),
-   
device->get_build_options(requested_features, 
- 
program_name, 
+   
device->get_build_options(requested_features,
+ 
program_name,
  
device->use_preview_kernels));
 
kernel->program.add_kernel(ustring("path_trace_" + 
kernel_name));
@@ -770,7 +770,7 @@ bool OpenCLDevice::load_kernels(const 
DeviceRequestedFeatures& requested_feature
/* Verify we have right opencl version. */
if(!opencl_version_check())
return false;
-   
+
load_required_kernels(requested_features);
 
vector programs;
@@ -880,7 +880,7 @@ DeviceKernelStatus 
OpenCLDevice::get_active_kernel_switch_state()
 {
/* Do not switch kernels for background renderings
 * We do foreground rendering but use the preview kernels
-* Check for the optimized kernels 
+* Check for the optimized kernels
 *
 * This works also the other way around, where we are using
 * optimized kernels but new ones are being compiled due
@@ -891,7 +891,7 @@ DeviceKernelStatus 
OpenCLDevice::get_active_kernel_switch_state()
 * this as an early exit */
return DEVICE_KERNEL_USING_FEATURE_KERNEL;
}
-   
+
bool other_kernels_finished = load_kernel_task_pool.finished();
if (use_preview_kernels) {
if (other_kernels_finished) {
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm 
b/intern/ghost/intern/GHOST_ContextCGL.mm
index dc0a5089d74..913ba459e9a 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -191,7 +191,7 @@ GHOST_TSuccess GHOST_ContextCGL::updateDrawingContext()
 
 static void makeAttribList(
 std::vector& attribs,
-bool coreProfile, 
+bool coreProfile,
 bool stereoVisual,
 int numOfAASamples,
 bool needAlpha,
@@ -202,7 +202,7 @@ static void makeAttribList(
 
attribs.push_back(NSOpenGLPFAOpenGLProfile);
attribs.push_back(coreProfile ? NSOpenGLProfileVersion3_2Core : 
NSOpenGLProfileVersionLegacy);
-   
+
// Pixel Format Attributes for the windowed NSOpenGLContext
attribs.push_back(NSOpenGLPFADoubleBuffer);
 
@@ -375,7 +375,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 
if (s_sharedCount == 0)
s_sharedOpenGLContext = m

[Bf-blender-cvs] [e7fd6c8f30c] master: Cleanup: comment blocks

2019-03-18 Thread Campbell Barton
Commit: e7fd6c8f30cd1161496831859da403eaa34fdf89
Author: Campbell Barton
Date:   Tue Mar 19 15:17:46 2019 +1100
Branches: master
https://developer.blender.org/rBe7fd6c8f30cd1161496831859da403eaa34fdf89

Cleanup: comment blocks

===

M   doc/doxygen/doxygen.intern.h
M   intern/ghost/intern/GHOST_Context.h
M   intern/ghost/intern/GHOST_SystemCocoa.mm
M   intern/ghost/intern/GHOST_SystemWin32.h
M   intern/iksolver/extern/IK_solver.h
M   intern/string/STR_String.h
M   source/blender/blenfont/intern/blf_font.c
M   source/blender/blenkernel/intern/appdir.c
M   source/blender/blenkernel/intern/cdderivedmesh.c
M   source/blender/blenkernel/intern/cloth.c
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/blenkernel/intern/multires.c
M   source/blender/blenkernel/intern/object_update.c
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenkernel/intern/softbody.c
M   source/blender/blenlib/BLI_math_matrix.h
M   source/blender/blenlib/BLI_mempool.h
M   source/blender/blenlib/BLI_rand.h
M   source/blender/blenlib/intern/math_rotation.c
M   source/blender/blenlib/intern/string_utf8.c
M   source/blender/bmesh/tools/bmesh_bevel.c
M   source/blender/collada/ArmatureImporter.cpp
M   source/blender/collada/MeshImporter.cpp
M   source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/draw/engines/eevee/eevee_bloom.c
M   source/blender/draw/engines/eevee/eevee_depth_of_field.c
M   source/blender/draw/engines/eevee/eevee_effects.c
M   source/blender/draw/engines/eevee/eevee_lights.c
M   source/blender/draw/engines/eevee/eevee_materials.c
M   source/blender/draw/engines/eevee/eevee_occlusion.c
M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/engines/eevee/shaders/effect_bloom_frag.glsl
M   source/blender/draw/engines/eevee/shaders/effect_dof_vert.glsl
M   
source/blender/draw/engines/eevee/shaders/effect_downsample_cube_frag.glsl
M   source/blender/draw/engines/eevee/shaders/effect_downsample_frag.glsl
M   source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl
M   source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl
M   
source/blender/draw/engines/eevee/shaders/lightprobe_planar_downsample_frag.glsl
M   source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
M   source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_effect_dof_frag.glsl
M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/engines/workbench/workbench_effect_dof.c
M   source/blender/draw/intern/draw_cache.c
M   source/blender/draw/intern/draw_cache_impl_mesh.c
M   source/blender/draw/intern/draw_hair.c
M   source/blender/draw/intern/draw_instance_data.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/draw/intern/draw_manager_exec.c
M   source/blender/draw/modes/shaders/common_hair_lib.glsl
M   source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl
M   source/blender/draw/modes/shaders/object_grid_frag.glsl
M   source/blender/editors/armature/pose_slide.c
M   source/blender/editors/armature/pose_utils.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/object/object_select.c
M   source/blender/editors/space_view3d/view3d_snap.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
M   source/blender/gpu/GPU_framebuffer.h
M   source/blender/gpu/GPU_vertex_format.h
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_framebuffer.c
M   source/blender/gpu/intern/gpu_texture.c
M   source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl
M   source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl
M   source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
M   source/blender/makesdna/DNA_ID.h
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesrna/intern/rna_ID.c
M   source/blender/makesrna/intern/rna_access.c
M   source/blender/makesrna/intern/rna_key.c
M   source/blender/python/gpu/gpu_py_offscreen.c
M   source/blender/windowmanager/intern/wm_init_exit.c

===

diff --git a/doc/doxygen/doxygen.intern.h b/doc/doxygen/doxygen.inter

[Bf-blender-cvs] [7e6263095de] master: Docs: group debug/disable args in --help output

2019-03-18 Thread Campbell Barton
Commit: 7e6263095de1ded7b17ed9c4d030d1b9dac6d9ed
Author: Campbell Barton
Date:   Tue Mar 19 14:32:15 2019 +1100
Branches: master
https://developer.blender.org/rB7e6263095de1ded7b17ed9c4d030d1b9dac6d9ed

Docs: group debug/disable args in --help output

===

M   source/creator/creator_args.c

===

diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index f96677d5132..659a2a91175 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -566,9 +566,12 @@ static int arg_handle_print_help(int UNUSED(argc), const 
char **UNUSED(argv), vo
BLI_argsPrintArgDoc(ba, "--debug-depsgraph-build");
BLI_argsPrintArgDoc(ba, "--debug-depsgraph-tag");
BLI_argsPrintArgDoc(ba, "--debug-depsgraph-no-threads");
-
+   BLI_argsPrintArgDoc(ba, "--debug-depsgraph-time");
+   BLI_argsPrintArgDoc(ba, "--debug-depsgraph-pretty");
+   BLI_argsPrintArgDoc(ba, "--debug-gpu");
BLI_argsPrintArgDoc(ba, "--debug-gpumem");
BLI_argsPrintArgDoc(ba, "--debug-gpu-shaders");
+   BLI_argsPrintArgDoc(ba, "--debug-gpu-force-workarounds");
BLI_argsPrintArgDoc(ba, "--debug-wm");
BLI_argsPrintArgDoc(ba, "--debug-all");
BLI_argsPrintArgDoc(ba, "--debug-io");
@@ -576,6 +579,7 @@ static int arg_handle_print_help(int UNUSED(argc), const 
char **UNUSED(argv), vo
printf("\n");
BLI_argsPrintArgDoc(ba, "--debug-fpe");
BLI_argsPrintArgDoc(ba, "--disable-crash-handler");
+   BLI_argsPrintArgDoc(ba, "--disable-abort-handler");
 
printf("\n");
printf("Misc Options:\n");
@@ -595,10 +599,10 @@ static int arg_handle_print_help(int UNUSED(argc), const 
char **UNUSED(argv), vo
 
BLI_argsPrintArgDoc(ba, "--help");
 
-#ifdef WIN32
+   /* WIN32 only (ignored for non-win32) */
BLI_argsPrintArgDoc(ba, "-R");
BLI_argsPrintArgDoc(ba, "-r");
-#endif
+
BLI_argsPrintArgDoc(ba, "--version");
 
BLI_argsPrintArgDoc(ba, "--");

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


[Bf-blender-cvs] [ce066f9da7e] master: Fix assigning keys to paint operators

2019-03-18 Thread Campbell Barton
Commit: ce066f9da7ef7efb8a0ec12b2dfd2b1852b57281
Author: Campbell Barton
Date:   Tue Mar 19 13:48:33 2019 +1100
Branches: master
https://developer.blender.org/rBce066f9da7ef7efb8a0ec12b2dfd2b1852b57281

Fix assigning keys to paint operators

Comparing context mode with object flag (decade old bug from 2.5x).

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c 
b/source/blender/windowmanager/intern/wm_keymap_utils.c
index 35bd3a78142..6d311f148b9 100644
--- a/source/blender/windowmanager/intern/wm_keymap_utils.c
+++ b/source/blender/windowmanager/intern/wm_keymap_utils.c
@@ -252,10 +252,10 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const 
char *opname)
}
else if (STRPREFIX(opname, "SCULPT_OT")) {
switch (CTX_data_mode_enum(C)) {
-   case OB_MODE_SCULPT:
+   case CTX_MODE_SCULPT:
km = WM_keymap_find_all(C, "Sculpt", 0, 0);
break;
-   case OB_MODE_EDIT:
+   case CTX_MODE_EDIT_MESH:
km = WM_keymap_find_all(C, "UV Sculpt", 0, 0);
break;
default:
@@ -286,13 +286,13 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const 
char *opname)
else if (STRPREFIX(opname, "PAINT_OT")) {
/* check for relevant mode */
switch (CTX_data_mode_enum(C)) {
-   case OB_MODE_WEIGHT_PAINT:
+   case CTX_MODE_PAINT_WEIGHT:
km = WM_keymap_find_all(C, "Weight Paint", 0, 
0);
break;
-   case OB_MODE_VERTEX_PAINT:
+   case CTX_MODE_PAINT_VERTEX:
km = WM_keymap_find_all(C, "Vertex Paint", 0, 
0);
break;
-   case OB_MODE_TEXTURE_PAINT:
+   case CTX_MODE_PAINT_TEXTURE:
km = WM_keymap_find_all(C, "Image Paint", 0, 0);
break;
default:

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


[Bf-blender-cvs] [e2abb1bf5cb] master: Fix T61872: Sculpt key shortcut assignment fails

2019-03-18 Thread Campbell Barton
Commit: e2abb1bf5cbcdb7931c5f841625d7e715426b717
Author: Campbell Barton
Date:   Tue Mar 19 13:50:32 2019 +1100
Branches: master
https://developer.blender.org/rBe2abb1bf5cbcdb7931c5f841625d7e715426b717

Fix T61872: Sculpt key shortcut assignment fails

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c 
b/source/blender/windowmanager/intern/wm_keymap_utils.c
index 6d311f148b9..1c3e09dac29 100644
--- a/source/blender/windowmanager/intern/wm_keymap_utils.c
+++ b/source/blender/windowmanager/intern/wm_keymap_utils.c
@@ -295,6 +295,9 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const 
char *opname)
case CTX_MODE_PAINT_TEXTURE:
km = WM_keymap_find_all(C, "Image Paint", 0, 0);
break;
+   case CTX_MODE_SCULPT:
+   km = WM_keymap_find_all(C, "Sculpt", 0, 0);
+   break;
default:
break;
}

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


[Bf-blender-cvs] [48ad55a03d6] master: Cleanup: use enum for CTX_data_mode_enum

2019-03-18 Thread Campbell Barton
Commit: 48ad55a03d658e73ae90166e752f5cf81292c8c1
Author: Campbell Barton
Date:   Tue Mar 19 13:42:54 2019 +1100
Branches: master
https://developer.blender.org/rB48ad55a03d658e73ae90166e752f5cf81292c8c1

Cleanup: use enum for CTX_data_mode_enum

Exposes errors in some cases when compared against incompatible values.

===

M   source/blender/blenkernel/BKE_context.h
M   source/blender/blenkernel/intern/context.c
M   source/blender/draw/intern/draw_cache.c
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/space_buttons/space_buttons.c
M   source/blender/windowmanager/intern/wm_keymap_utils.c

===

diff --git a/source/blender/blenkernel/BKE_context.h 
b/source/blender/blenkernel/BKE_context.h
index cf573232bac..e9ca3c51a5f 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -254,10 +254,10 @@ struct RenderEngineType *CTX_data_engine_type(const 
bContext *C);
 struct ToolSettings *CTX_data_tool_settings(const bContext *C);
 
 const char *CTX_data_mode_string(const bContext *C);
-int CTX_data_mode_enum_ex(
+enum eContextObjectMode CTX_data_mode_enum_ex(
 const struct Object *obedit, const struct Object *ob,
 const eObjectMode object_mode);
-int CTX_data_mode_enum(const bContext *C);
+enum eContextObjectMode CTX_data_mode_enum(const bContext *C);
 
 void CTX_data_main_set(bContext *C, struct Main *bmain);
 void CTX_data_scene_set(bContext *C, struct Scene *bmain);
diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index a8e0cbed707..a16656253d3 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -975,7 +975,7 @@ Collection *CTX_data_collection(const bContext *C)
return BKE_collection_master(scene);
 }
 
-int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const 
eObjectMode object_mode)
+enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit, const 
Object *ob, const eObjectMode object_mode)
 {
// Object *obedit = CTX_data_edit_object(C);
if (obedit) {
@@ -1015,7 +1015,7 @@ int CTX_data_mode_enum_ex(const Object *obedit, const 
Object *ob, const eObjectM
return CTX_MODE_OBJECT;
 }
 
-int CTX_data_mode_enum(const bContext *C)
+enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
 {
Object *obedit = CTX_data_edit_object(C);
Object *obact = obedit ? NULL : CTX_data_active_object(C);
diff --git a/source/blender/draw/intern/draw_cache.c 
b/source/blender/draw/intern/draw_cache.c
index 28a897a4c35..0f79affe44a 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3750,7 +3750,8 @@ void drw_batch_cache_generate_requested(Object *ob)
 {
const DRWContextState *draw_ctx = DRW_context_state_get();
const ToolSettings *ts = draw_ctx->scene->toolsettings;
-   const int mode = CTX_data_mode_enum_ex(draw_ctx->object_edit, 
draw_ctx->obact, draw_ctx->object_mode);
+   const enum eContextObjectMode mode = CTX_data_mode_enum_ex(
+   draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
const bool is_paint_mode = ELEM(mode, CTX_MODE_PAINT_TEXTURE, 
CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
const bool use_hide = (
(ob->type == OB_MESH) &&
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index d53d5710eb1..e991c69fdc1 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1307,7 +1307,8 @@ static void drw_engines_enable_basic(void)
 static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType 
*engine_type)
 {
Object *obact = OBACT(view_layer);
-   const int mode = CTX_data_mode_enum_ex(DST.draw_ctx.object_edit, obact, 
DST.draw_ctx.object_mode);
+   const enum eContextObjectMode mode = CTX_data_mode_enum_ex(
+   DST.draw_ctx.object_edit, obact, DST.draw_ctx.object_mode);
View3D *v3d = DST.draw_ctx.v3d;
const int drawtype = v3d->shading.type;
const bool use_xray = XRAY_ENABLED(v3d);
diff --git a/source/blender/editors/space_buttons/space_buttons.c 
b/source/blender/editors/space_buttons/space_buttons.c
index acba11ddec7..609ef86b003 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -201,7 +201,7 @@ static void buttons_main_region_layout_properties(const 
bContext *C, SpaceProper
 static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
 {
const WorkSpace *workspace = CTX_wm_workspace(C);
-   const int mode = CTX_data_mode_enum(C);
+   const enum eContextObjectMode mode = CTX_data_mode_enum(C);
 
const 

[Bf-blender-cvs] [d731ee4960c] master: Fix T61368: Brush texture preview ignores rotation

2019-03-18 Thread Campbell Barton
Commit: d731ee4960cf78f7b461be0c8f5ef27c098da265
Author: Campbell Barton
Date:   Tue Mar 19 13:07:48 2019 +1100
Branches: master
https://developer.blender.org/rBd731ee4960cf78f7b461be0c8f5ef27c098da265

Fix T61368: Brush texture preview ignores rotation

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index ff3d1601dde..ac7d496ea35 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2062,11 +2062,6 @@ static void radial_control_paint_tex(RadialControl *rc, 
float radius, float alph
GLint swizzleMask[] = {GL_ZERO, GL_ZERO, GL_ZERO, GL_RED};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, 
swizzleMask);
 
-   immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR);
-
-   immUniformColor3fvAlpha(col, alpha);
-   immUniform1i("image", 0);
-
/* set up rotation if available */
if (rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, 
rc->rot_prop);
@@ -2074,6 +2069,11 @@ static void radial_control_paint_tex(RadialControl *rc, 
float radius, float alph
GPU_matrix_rotate_2d(RAD2DEGF(rot));
}
 
+   immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR);
+
+   immUniformColor3fvAlpha(col, alpha);
+   immUniform1i("image", 0);
+
/* draw textured quad */
immBegin(GPU_PRIM_TRI_FAN, 4);

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


[Bf-blender-cvs] [75b1f625dd6] sculpt-mode-features: Mask tools: Option to mask only front faces with lasso mask

2019-03-18 Thread Pablo Dobarro
Commit: 75b1f625dd684c2a04d0b647a6e866f052b3fb90
Author: Pablo Dobarro
Date:   Tue Mar 19 02:13:59 2019 +0100
Branches: sculpt-mode-features
https://developer.blender.org/rB75b1f625dd684c2a04d0b647a6e866f052b3fb90

Mask tools: Option to mask only front faces with lasso mask

It still needs to be added to the keymap or as a tool setting.

===

M   source/blender/editors/sculpt_paint/paint_mask.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index 2f9706db636..c08ae425395 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -93,6 +93,9 @@ typedef struct MaskTaskData {
PaintMaskFloodMode mode;
float value;
float (*clip_planes_final)[4];
+   bool front_faces_only;
+   float trueViewDir[3];
+   float viewDir[3];
 } MaskTaskData;
 
 static void mask_flood_fill_task_cb(
@@ -391,10 +394,14 @@ static void mask_gesture_lasso_task_cb(
const float value = data->value;
 
PBVHVertexIter vi;
+   float vertex_normal[3];
bool any_masked = false;
 
BKE_pbvh_vertex_iter_begin(data->pbvh, node, vi, PBVH_ITER_UNIQUE) {
-   if (is_effected_lasso(lasso_data, vi.co)) {
+   normal_short_to_float_v3(vertex_normal, vi.no);
+   float dp = dot_v3v3(lasso_data->task_data.viewDir, 
vertex_normal);
+   if (!lasso_data->task_data.front_faces_only) dp = 1;
+   if (is_effected_lasso(lasso_data, vi.co) && dp > 0) {
if (!any_masked) {
any_masked = true;
 
@@ -460,6 +467,20 @@ static int paint_mask_gesture_lasso_exec(bContext *C, 
wmOperator *op)
 
sculpt_undo_push_begin("Mask lasso fill");
 
+   data.task_data.front_faces_only = RNA_boolean_get(op->ptr, 
"front_faces_only");
+   float imat[4][4];
+   float mat[4][4];
+   float viewDir[3] = {0.0f, 0.0f, 1.0f};
+   if (data.task_data.front_faces_only) {
+   invert_m4_m4(imat, ob->obmat);
+   copy_m3_m4(mat, vc.rv3d->viewinv);
+   mul_m3_v3(mat, viewDir);
+   copy_m3_m4(mat, ob->imat);
+   mul_m3_v3(mat, viewDir);
+   normalize_v3_v3(data.task_data.viewDir, viewDir);
+   copy_v3_v3(data.task_data.trueViewDir, 
data.task_data.viewDir);
+   }
+
for (symmpass = 0; symmpass <= symm; ++symmpass) {
if ((symmpass == 0) ||
(symm & symmpass &&
@@ -471,6 +492,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, 
wmOperator *op)
/* flip the planes symmetrically as needed */
for (; j < 4; j++) {
flip_plane(clip_planes_final[j], 
clip_planes[j], symmpass);
+   flip_v3_v3(data.task_data.viewDir, 
data.task_data.trueViewDir, symmpass);
}
 
data.symmpass = symmpass;
@@ -534,4 +556,5 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
RNA_def_enum(ot->srna, "mode", mode_items, PAINT_MASK_FLOOD_VALUE, 
"Mode", NULL);
RNA_def_float(ot->srna, "value", 1.0, 0, 1.0, "Value",
  "Mask level to use when mode is 'Value'; zero means no 
masking and one is fully masked", 0, 1);
+   RNA_def_boolean(ot->srna, "front_faces_only", true, "Front faces only", 
"Affect only faces facing towards the view");
 }

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


[Bf-blender-cvs] [d47f827019f] master: Cleanup: unused warning

2019-03-18 Thread Campbell Barton
Commit: d47f827019f2ac3e2b495fab887023660fdae031
Author: Campbell Barton
Date:   Tue Mar 19 08:39:48 2019 +1100
Branches: master
https://developer.blender.org/rBd47f827019f2ac3e2b495fab887023660fdae031

Cleanup: unused warning

===

M   source/blender/draw/intern/draw_manager.c
M   source/blender/makesdna/intern/dna_rename_defs.h

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 4810598c358..d53d5710eb1 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1826,7 +1826,6 @@ void DRW_render_to_image(RenderEngine *engine, struct 
Depsgraph *depsgraph)
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
RenderEngineType *engine_type = engine->type;
DrawEngineType *draw_engine_type = engine_type->draw_engine;
-   RenderData *r = &scene->r;
Render *render = engine->re;
 
if (G.background && DST.gl_context == NULL) {
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h 
b/source/blender/makesdna/intern/dna_rename_defs.h
index e1fa1e29f96..3ae572f40cf 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -87,7 +87,3 @@ DNA_STRUCT_RENAME_ELEM(bTheme, tstatusbar, space_statusbar)
 DNA_STRUCT_RENAME_ELEM(bTheme, ttopbar, space_topbar)
 DNA_STRUCT_RENAME_ELEM(bTheme, tuserpref, space_preferences)
 DNA_STRUCT_RENAME_ELEM(bTheme, tv3d, space_view3d)
-
-#if 0
-DNA_STRUCT_RENAME(Light, Light)
-#endif

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


[Bf-blender-cvs] [ce09b93955d] master: Fix T61104 Compositing two scenes with different output scales crashes

2019-03-18 Thread Clément Foucault
Commit: ce09b93955de6dd80f46af33f4329392b0752f74
Author: Clément Foucault
Date:   Mon Mar 18 21:39:54 2019 +0100
Branches: master
https://developer.blender.org/rBce09b93955de6dd80f46af33f4329392b0752f74

Fix T61104 Compositing two scenes with different output scales crashes

Was due to incorrect output size. Use engine->resolution_x/y instead of
computing the size on the fly from the scene specific settings (which are
not overwritten by the rendering scene).

===

M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 34217b83241..4810598c358 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1865,7 +1865,7 @@ void DRW_render_to_image(RenderEngine *engine, struct 
Depsgraph *depsgraph)
drw_context_state_init();
 
DST.viewport = GPU_viewport_create();
-   const int size[2] = {(r->size * r->xsch) / 100, (r->size * r->ysch) / 
100};
+   const int size[2] = {engine->resolution_x, engine->resolution_y};
GPU_viewport_size_set(DST.viewport, size);
 
drw_viewport_var_init();

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


[Bf-blender-cvs] [fd63be06109] master: UI: Use 'Display' instead of 'Draw' for show_particles

2019-03-18 Thread William Reynish
Commit: fd63be0610990ff9e388dca6513d87b986643bed
Author: William Reynish
Date:   Mon Mar 18 21:33:01 2019 +0100
Branches: master
https://developer.blender.org/rBfd63be0610990ff9e388dca6513d87b986643bed

UI: Use 'Display' instead of 'Draw' for show_particles

===

M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 395daa76db3..921c6753575 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1082,7 +1082,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, 
PROP_NONE);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
-   RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual 
particles");
+   RNA_def_property_ui_text(prop, "Display Particles", "Display actual 
particles");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, 
"rna_ParticleEdit_redo");
 
prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, 
PROP_NONE);

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


[Bf-blender-cvs] [a764a3cd1c1] master: Units: Use PROP_DISTANCE for emitter_distance

2019-03-18 Thread William Reynish
Commit: a764a3cd1c1d01f782213ceb42d57a3bbfe70150
Author: William Reynish
Date:   Mon Mar 18 21:32:02 2019 +0100
Branches: master
https://developer.blender.org/rBa764a3cd1c1d01f782213ceb42d57a3bbfe70150

Units: Use PROP_DISTANCE for emitter_distance

===

M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index b66363f45ae..395daa76db3 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1064,7 +1064,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from 
intersecting the emitter");
 
-   prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, 
PROP_UNSIGNED);
+   prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, 
PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "emitterdist");
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep 
particles away from the emitter");

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


[Bf-blender-cvs] [52e38fae428] master: UI: Particle Edit Mode Tool Properties

2019-03-18 Thread William Reynish
Commit: 52e38fae4285edce6398e1507eb5c29ed894dc1f
Author: William Reynish
Date:   Mon Mar 18 21:30:56 2019 +0100
Branches: master
https://developer.blender.org/rB52e38fae4285edce6398e1507eb5c29ed894dc1f

UI: Particle Edit Mode Tool Properties

-Use property split
-Use sub-panels for Options panel
-Slightly re-organize Options panel
-Remove redundant Deflect Emitter from Options panel (it was already in the 
tool settings for the Comb tool)

===

M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 73aa59a2693..1377dc14781 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -424,8 +424,6 @@ class _draw_left_context_mode:
 layout.row().prop(brush, "puff_mode", expand=True)
 layout.prop(brush, "use_puff_volume")
 elif tool == 'COMB':
-# Note: actually in 'Options' panel,
-# disabled when used in popover.
 row = layout.row()
 row.active = settings.is_editable
 row.prop(settings, "use_emitter_deflect", 
text="Deflect Emitter")
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index a37e54d40a8..3c90872e3c4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -209,15 +209,15 @@ class View3DPaintPanel(UnifiedPaintPanel):
 bl_space_type = 'PROPERTIES'
 bl_region_type = 'WINDOW'
 
-
-# TODO, move to space_view3d.py
-class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
+class VIEW3D_PT_tools_particlemode(Panel, View3DPaintPanel):
 bl_context = ".paint_common"  # dot on purpose (access from topbar)
-bl_label = "Brush"
+bl_label = "Particle tools"
+bl_options = {'HIDE_HEADER'}
 
 @classmethod
 def poll(cls, context):
-return cls.paint_settings(context)
+settings = cls.paint_settings(context)
+return (settings and settings.brush and context.particle_edit_object)
 
 def draw(self, context):
 layout = self.layout
@@ -225,38 +225,63 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 tool_settings = context.tool_settings
 settings = self.paint_settings(context)
 brush = settings.brush
+tool = settings.tool
 
-if not context.particle_edit_object:
-col = layout.split().column()
-col.template_ID_preview(settings, "brush", new="brush.add", 
rows=3, cols=8)
+layout.use_property_split = True
+layout.use_property_decorate = False  # No animation.
 
-# Particle Mode #
-if context.particle_edit_object:
-tool = settings.tool
+if tool != None:
+col = layout.column()
+col.prop(brush, "size", slider=True)
+if tool == 'ADD':
+col.prop(brush, "count")
 
-if tool != 'NONE':
-layout.column().prop(settings, "tool")
 col = layout.column()
-col.prop(brush, "size", slider=True)
-if tool == 'ADD':
-col.prop(brush, "count")
-
+col.prop(settings, "use_default_interpolate")
+col.prop(brush, "steps", slider=True)
+col.prop(settings, "default_key_count", slider=True)
+else:
+col.prop(brush, "strength", slider=True)
+
+if tool == 'LENGTH':
+layout.row().prop(brush, "length_mode", expand=True)
+elif tool == 'PUFF':
+layout.row().prop(brush, "puff_mode", expand=True)
+layout.prop(brush, "use_puff_volume")
+elif tool == 'COMB':
+layout.prop(settings, "use_emitter_deflect", text="Deflect 
Emitter")
 col = layout.column()
-col.prop(settings, "use_default_interpolate")
-col.prop(brush, "steps", slider=True)
-col.prop(settings, "default_key_count", slider=True)
-else:
-col.prop(brush, "strength", slider=True)
+col.active = settings.use_emitter_deflect
+col.prop(settings, "emitter_distance", text="Distance")
 
-if tool == 'LENGTH':
-layout.row().prop(brush, "length_mode", expand=True)
-elif tool == 'PUFF':
-layout.row().prop(brush, "puff_mode", expand=True)
-layout

[Bf-blender-cvs] [3d1138840c9] master: Fix strip text hiding behind scrollers

2019-03-18 Thread Richard Antalik
Commit: 3d1138840c9e44384d773a1786c4c8893571f20b
Author: Richard Antalik
Date:   Mon Mar 18 12:09:22 2019 -0700
Branches: master
https://developer.blender.org/rB3d1138840c9e44384d773a1786c4c8893571f20b

Fix strip text hiding behind scrollers

Reviewers: brecht

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

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 3b6ca4934fe..0f935031ecc 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -82,6 +82,8 @@
 #define SEQ_HANDLE_SIZE_MIN  7.0f
 #define SEQ_HANDLE_SIZE_MAX 40.0f
 
+#define SEQ_SCROLLER_TEXT_OFFSET 8
+
 
 /* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
  * it messes up transform, - Campbell */
@@ -860,8 +862,10 @@ static void draw_seq_strip(
x1 = seq->startdisp + handsize_clamped;
x2 = seq->enddisp   - handsize_clamped;
 
+   float scroller_vert_xoffs = (V2D_SCROLL_WIDTH_TEXT + 
SEQ_SCROLLER_TEXT_OFFSET) * pixelx;
+
/* info text on the strip */
-   if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
+   if (x1 < v2d->cur.xmin + scroller_vert_xoffs) x1 = v2d->cur.xmin + 
scroller_vert_xoffs;
else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;

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


[Bf-blender-cvs] [9249e53f921] master: Scale waveforms & show clipping

2019-03-18 Thread Richard Antalik
Commit: 9249e53f921f41a477ee325835071e0c7905364e
Author: Richard Antalik
Date:   Mon Mar 18 12:10:33 2019 -0700
Branches: master
https://developer.blender.org/rB9249e53f921f41a477ee325835071e0c7905364e

Scale waveforms & show clipping

Scale waveforms in sound strips by volume.
If any drawn line exceeds value 1 or -1 it is drawn by red color so user can 
see point, where clipping occurs.

Reviewers: brecht

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

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0f935031ecc..8a64b6f39db 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -191,7 +191,7 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, 
unsigned char col[3])
 }
 
 static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene 
*scene, Sequence *seq,
-float x1, float y1, float x2, float y2, float 
stepsize, unsigned int pos)
+float x1, float y1, float x2, float y2, float stepsize)
 {
/*
 * x1 is the starting x value to draw the wave,
@@ -257,10 +257,11 @@ static void drawseqwave(View2D *v2d, const bContext *C, 
SpaceSeq *sseq, Scene *s
return;
}
 
-   immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
-
GPU_blend(true);
-
+   GPUVertFormat *format = immVertexFormat();
+   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 
2, GPU_FETCH_FLOAT);
+   uint col = GPU_vertformat_attr_add(format, "color", 
GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+   immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
immBegin(GPU_PRIM_TRI_STRIP, length * 2);
 
for (i = 0; i < length; i++) {
@@ -286,12 +287,25 @@ static void drawseqwave(View2D *v2d, const bContext *C, 
SpaceSeq *sseq, Scene *s
value2 = (1.0f - f) * value2 + f * 
waveform->data[p * 3 + 4];
}
 
+   value1 *= seq->volume;
+   value2 *= seq->volume;
+
+   if (value2 > 1 || value1 < -1) {
+   immAttr4f(col, 1.0f, 0.0f, 0.0f, 0.5f);
+
+   CLAMP_MAX(value2, 1.0f);
+   CLAMP_MIN(value1, -1.0f);
+   }
+   else {
+   immAttr4f(col, 1.0f, 1.0f, 1.0f, 0.5f);
+   }
+
immVertex2f(pos, x1_offset + i * stepsize, ymid + 
value1 * yscale);
immVertex2f(pos, x1_offset + i * stepsize, ymid + 
value2 * yscale);
}
 
immEnd();
-
+   immUnbindProgram();
GPU_blend(false);
}
 }
@@ -771,15 +785,15 @@ static void draw_seq_strip(
x1 = seq->startdisp;
x2 = seq->enddisp;
 
+   immUnbindProgram();
+
/* draw sound wave */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
if (!(sseq->flag & SEQ_NO_WAVEFORMS)) {
-   drawseqwave(v2d, C, sseq, scene, seq, x1, y1, x2, y2, 
BLI_rctf_size_x(&ar->v2d.cur) / ar->winx, pos);
+   drawseqwave(v2d, C, sseq, scene, seq, x1, y1, x2, y2, 
BLI_rctf_size_x(&ar->v2d.cur) / ar->winx);
}
}
 
-   immUnbindProgram();
-
/* draw lock */
if (seq->flag & SEQ_LOCK) {
GPU_blend(true);

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


[Bf-blender-cvs] [a761a93d411] master: Fix VSE color picker

2019-03-18 Thread Richard Antalik
Commit: a761a93d411da3798ff52f8c48381c5f46690818
Author: Richard Antalik
Date:   Mon Mar 18 12:04:11 2019 -0700
Branches: master
https://developer.blender.org/rBa761a93d411da3798ff52f8c48381c5f46690818

Fix VSE color picker

Fix VSE color picker mouse coords calculation

Reviewers: brecht

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

===

M   source/blender/editors/space_sequencer/sequencer_view.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_view.c 
b/source/blender/editors/space_sequencer/sequencer_view.c
index d500a9a081d..d0e31dbbe79 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -100,8 +100,10 @@ static void sample_apply(bContext *C, wmOperator *op, 
const wmEvent *event)
 
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, 
&fy);
 
-   fx += (float) ibuf->x / 2.0f;
-   fy += (float) ibuf->y / 2.0f;
+   fx += (float)scene->r.xsch / 2.0f;
+   fy += (float)scene->r.ysch / 2.0f;
+   fx *= (float)ibuf->x / (float)scene->r.xsch;
+   fy *= (float)ibuf->y / (float)scene->r.ysch;
 
if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
const float *fp;

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


[Bf-blender-cvs] [9c99292a16d] master: Fix T54117 Movie clip undistorted - proxy not working Add movieclip fallback render option, for case, when proxies are not enabled or built

2019-03-18 Thread Richard Antalik
Commit: 9c99292a16df35a5d244606cc49e06949a4ef535
Author: Richard Antalik
Date:   Mon Mar 18 12:01:40 2019 -0700
Branches: master
https://developer.blender.org/rB9c99292a16df35a5d244606cc49e06949a4ef535

Fix T54117 Movie clip undistorted - proxy not working
Add movieclip fallback render option, for case, when proxies are not enabled or 
built

Reviewers: sergey

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

===

M   source/blender/blenkernel/intern/movieclip.c
M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/makesdna/DNA_movieclip_types.h

===

diff --git a/source/blender/blenkernel/intern/movieclip.c 
b/source/blender/blenkernel/intern/movieclip.c
index e4d7af555ed..d4d5a696128 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -832,24 +832,24 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip,
return undistibuf;
 }
 
-static int need_undistortion_postprocess(const MovieClipUser *user)
-{
-   int result = 0;
-
-   /* only full undistorted render can be used as on-fly undistorting 
image */
-   result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
+static bool need_undistortion_postprocess(const MovieClipUser *user, int 
clip_flag)
+{
+   bool result = 0;
+   const bool uses_full_frame =
+   ((clip_flag & MCLIP_USE_PROXY) == 0) ||
+   (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL);
+   /* Only full undistorted render can be used as on-fly undistorting 
image. */
+   result |= uses_full_frame &&
  (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
-
return result;
 }
 
-static int need_postprocessed_frame(const MovieClipUser *user,
-int postprocess_flag)
+static bool need_postprocessed_frame(const MovieClipUser *user,
+ int clip_flag,
+ int postprocess_flag)
 {
-   int result = postprocess_flag;
-
-   result |= need_undistortion_postprocess(user);
-
+   bool result = (postprocess_flag != 0);
+   result |= need_undistortion_postprocess(user, clip_flag);
return result;
 }
 
@@ -908,7 +908,7 @@ static ImBuf *get_postprocessed_cached_frame(const 
MovieClip *clip,
if (cache->postprocessed.flag != postprocess_flag)
return NULL;
 
-   if (need_undistortion_postprocess(user)) {
+   if (need_undistortion_postprocess(user, flag)) {
if (!check_undistortion_cache_flags(clip))
return NULL;
}
@@ -923,11 +923,12 @@ static ImBuf *get_postprocessed_cached_frame(const 
MovieClip *clip,
 static ImBuf *postprocess_frame(MovieClip *clip,
 const MovieClipUser *user,
 ImBuf *ibuf,
+int flag,
 int postprocess_flag)
 {
ImBuf *postproc_ibuf = NULL;
 
-   if (need_undistortion_postprocess(user)) {
+   if (need_undistortion_postprocess(user, flag)) {
postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);
}
else {
@@ -968,7 +969,7 @@ static void put_postprocessed_frame_to_cache(MovieClip 
*clip,
cache->postprocessed.render_flag = 0;
}
 
-   if (need_undistortion_postprocess(user)) {
+   if (need_undistortion_postprocess(user, flag)) {
cache->postprocessed.distortion_model = 
camera->distortion_model;
copy_v2_v2(cache->postprocessed.principal, camera->principal);
copy_v3_v3(&cache->postprocessed.polynomial_k1, &camera->k1);
@@ -1002,7 +1003,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip 
*clip,
BLI_thread_lock(LOCK_MOVIECLIP);
 
/* try to obtain cached postprocessed frame first */
-   if (need_postprocessed_frame(user, postprocess_flag)) {
+   if (need_postprocessed_frame(user, flag, postprocess_flag)) {
ibuf = get_postprocessed_cached_frame(clip, user, flag, 
postprocess_flag);
 
if (!ibuf)
@@ -1038,7 +1039,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip 
*clip,
/* postprocess frame and put to cache if needed*/
if (need_postprocess) {
ImBuf *tmpibuf = ibuf;
-   ibuf = postprocess_frame(clip, user, tmpibuf, 
postprocess_flag);
+   ibuf = postprocess_frame(clip, user, tmpibuf, flag, 
postprocess_flag);
IMB_freeImBuf(tmpibuf);
if (ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0) {
put_postprocessed_frame_to_cache(clip, user, 
ibuf, flag, postprocess_flag);
@@ -1048,6 +1049,17 @@ static 

[Bf-blender-cvs] [b0752cd7a05] master: Fix T57590: assert with zero length array buttons.

2019-03-18 Thread Brecht Van Lommel
Commit: b0752cd7a05187923fcbdfba974899a6039cfd2c
Author: Brecht Van Lommel
Date:   Mon Mar 18 19:56:14 2019 +0100
Branches: master
https://developer.blender.org/rBb0752cd7a05187923fcbdfba974899a6039cfd2c

Fix T57590: assert with zero length array buttons.

===

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

===

diff --git a/source/blender/editors/interface/interface_utils.c 
b/source/blender/editors/interface/interface_utils.c
index 7400e922b30..85eae9a253d 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -61,9 +61,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, 
PropertyRNA *prop, int ind
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
{
-   int arraylen = RNA_property_array_length(ptr, prop);
-
-   if (arraylen && index == -1)
+   if (RNA_property_array_check(prop) && index == -1)
return NULL;
 
if (icon && name && name[0] == '\0')
@@ -77,9 +75,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, 
PropertyRNA *prop, int ind
case PROP_INT:
case PROP_FLOAT:
{
-   int arraylen = RNA_property_array_length(ptr, prop);
-
-   if (arraylen && index == -1) {
+   if (RNA_property_array_check(prop) && index == -1) {
if (ELEM(RNA_property_subtype(prop), 
PROP_COLOR, PROP_COLOR_GAMMA)) {
but = uiDefButR_prop(block, 
UI_BTYPE_COLOR, 0, name, x1, y1, x2, y2, ptr, prop, -1, 0, 0, -1, -1, NULL);
}

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


[Bf-blender-cvs] [e782910b187] asset-engine: Merge branch 'master' into asset-engine

2019-03-18 Thread Bastien Montagne
Commit: e782910b187dae5c573f44ec98ce25e8274a6d89
Author: Bastien Montagne
Date:   Mon Mar 18 20:27:32 2019 +0100
Branches: asset-engine
https://developer.blender.org/rBe782910b187dae5c573f44ec98ce25e8274a6d89

Merge branch 'master' into asset-engine

Kinda painful merge thanks to extensive changes to things like Main
listbases names, linking code, etc.

Conflicts:
source/blender/blenkernel/BKE_library.h
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/makesdna/DNA_space_types.h
source/blender/windowmanager/intern/wm_files_link.c

===



===

diff --cc source/blender/blenkernel/BKE_library.h
index 9c87ba8a7ed,45a60453d2e..aef226c74ff
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@@ -229,24 -227,6 +229,21 @@@ bool BKE_id_is_in_global_main(struct I
  void BKE_id_ordered_list(struct ListBase *ordered_lb, const struct ListBase 
*lb);
  void BKE_id_reorder(const struct ListBase *lb, struct ID *id, struct ID 
*relative, bool after);
  
 +void BKE_library_asset_repository_init(struct Library *lib, const struct 
AssetEngineType *aet, const char *repo_root);
 +void BKE_library_asset_repository_clear(struct Library *lib);
 +void BKE_library_asset_repository_free(struct Library *lib);
 +struct AssetRef *BKE_library_asset_repository_asset_add(struct Library *lib, 
const void *idv);
 +void BKE_library_asset_repository_asset_remove(struct Library *lib, const 
void *idv);
 +struct AssetRef *BKE_library_asset_repository_asset_find(struct Library *lib, 
const void *idv);
 +void BKE_library_asset_repository_subdata_add(struct AssetRef *aref, const 
void *idv);
 +void BKE_library_asset_repository_subdata_remove(struct AssetRef *aref, const 
void *idv);
 +
 +void BKE_libraries_asset_subdata_remove(struct Main *bmain, const void *idv);
 +void BKE_libraries_asset_repositories_clear(struct Main *bmain);
 +void BKE_libraries_asset_repositories_rebuild(struct Main *bmain);
 +struct AssetRef *BKE_libraries_asset_repository_uuid_find(struct Main *bmain, 
const struct AssetUUID *uuid);
 +struct Library *BKE_library_asset_virtual_ensure(struct Main *bmain, const 
struct AssetEngineType *aet);
 +
- /* use when "" is given to new_id() */
- #define ID_FALLBACK_NAME N_("Untitled")
- 
  #define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT))
  
  #ifdef __cplusplus
diff --cc source/blender/blenkernel/intern/library.c
index 20f866c6513,a66030a11b4..197b04dade2
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@@ -1642,10 -1634,9 +1642,10 @@@ void id_clear_lib_data_ex(Main *bmain, 
id_fake_user_clear(id);
  
id->lib = NULL;
 +  MEM_SAFE_FREE(id->uuid);
id->tag &= ~(LIB_TAG_INDIRECT | LIB_TAG_EXTERN);
if (id_in_mainlist) {
-   if (new_id(which_libbase(bmain, GS(id->name)), id, NULL)) {
+   if (BKE_id_new_name_validate(which_libbase(bmain, 
GS(id->name)), id, NULL)) {
bmain->is_memfile_undo_written = false;
}
}
diff --cc source/blender/blenkernel/intern/library_asset.c
index 91e01e6193a,000..7b1b352fda4
mode 100644,00..100644
--- a/source/blender/blenkernel/intern/library_asset.c
+++ b/source/blender/blenkernel/intern/library_asset.c
@@@ -1,270 -1,0 +1,270 @@@
 +/*
 + * * BEGIN GPL LICENSE BLOCK *
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * The Original Code is Copyright (C) 2015,2016 by Blender Foundation.
 + * All rights reserved.
 + *
 + * The Original Code is: all of this file.
 + *
 + * Contributor(s): Bastien Montagne.
 + *
 + * * END GPL LICENSE BLOCK *
 + */
 +
 +/** \file blender/blenkernel/intern/library_asset.c
 + *  \ingroup bke
 + *
 + * Contains asset-related management of ID's and libraries.
 + */
 +
 +#include 
 +
 +#include "MEM_guardedalloc.h"
 +
 +#include "BLI_blenlib.h"
 +#include "BLI_utildefines.h"
 +
 +#include "RNA_types.h"
 +
 +#include "BKE_asset_engine.h"
 +#include "BKE_library.h"
 +#include "BKE_library_quer

[Bf-blender-cvs] [10d1edbffbf] master: Fix T56183: flip matcap not working for workbench as render engine.

2019-03-18 Thread Brecht Van Lommel
Commit: 10d1edbffbf91094015950555495e01914e09dd9
Author: Brecht Van Lommel
Date:   Mon Mar 18 19:26:01 2019 +0100
Branches: master
https://developer.blender.org/rB10d1edbffbf91094015950555495e01914e09dd9

Fix T56183: flip matcap not working for workbench as render engine.

===

M   source/blender/editors/space_view3d/view3d_header.c

===

diff --git a/source/blender/editors/space_view3d/view3d_header.c 
b/source/blender/editors/space_view3d/view3d_header.c
index 78bda66b8ff..aa97c151df5 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -68,9 +68,18 @@ static void do_view3d_header_buttons(bContext *C, void *arg, 
int event);
 static int toggle_matcap_flip(bContext *C, wmOperator *UNUSED(op))
 {
View3D *v3d = CTX_wm_view3d(C);
-   v3d->shading.flag ^= V3D_SHADING_MATCAP_FLIP_X;
-   ED_view3d_shade_update(CTX_data_main(C), v3d, CTX_wm_area(C));
-   WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+
+   if (v3d) {
+   v3d->shading.flag ^= V3D_SHADING_MATCAP_FLIP_X;
+   ED_view3d_shade_update(CTX_data_main(C), v3d, CTX_wm_area(C));
+   WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+   }
+   else {
+   Scene *scene = CTX_data_scene(C);
+   scene->display.shading.flag ^= V3D_SHADING_MATCAP_FLIP_X;
+   WM_event_add_notifier(C, NC_SCENE | NA_EDITED, v3d);
+   }
+
return OPERATOR_FINISHED;
 }
 
@@ -83,7 +92,6 @@ void VIEW3D_OT_toggle_matcap_flip(wmOperatorType *ot)
 
/* api callbacks */
ot->exec = toggle_matcap_flip;
-   ot->poll = ED_operator_view3d_active;
 }
 
 /** \} */

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


[Bf-blender-cvs] [d76fb8ec67b] blender2.7: Fix T62712: Cycles world light path node not working.

2019-03-18 Thread Brecht Van Lommel
Commit: d76fb8ec67bbc46c2c93e74a28ad24c431d82504
Author: Brecht Van Lommel
Date:   Mon Mar 18 18:45:17 2019 +0100
Branches: blender2.7
https://developer.blender.org/rBd76fb8ec67bbc46c2c93e74a28ad24c431d82504

Fix T62712: Cycles world light path node not working.

===

M   intern/cycles/kernel/kernel_emission.h

===

diff --git a/intern/cycles/kernel/kernel_emission.h 
b/intern/cycles/kernel/kernel_emission.h
index 9c47d1ca7be..80bb8d48caf 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -318,7 +318,7 @@ ccl_device_noinline float3 
indirect_background(KernelGlobals *kg,
 #  endif
 
path_state_modify_bounce(state, true);
-   shader_eval_surface(kg, emission_sd, state, PATH_RAY_EMISSION);
+   shader_eval_surface(kg, emission_sd, state, state->flag | 
PATH_RAY_EMISSION);
path_state_modify_bounce(state, false);
 
L = shader_background_eval(emission_sd);

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


[Bf-blender-cvs] [01df4818a6e] blender2.7: Fix Cycles curve UVs wrong after recent changes.

2019-03-18 Thread Brecht Van Lommel
Commit: 01df4818a6e1d3b93517e48a617310481abd9339
Author: Brecht Van Lommel
Date:   Mon Mar 18 18:51:24 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB01df4818a6e1d3b93517e48a617310481abd9339

Fix Cycles curve UVs wrong after recent changes.

===

M   intern/cycles/blender/blender_curves.cpp
M   intern/cycles/render/curves.h

===

diff --git a/intern/cycles/blender/blender_curves.cpp 
b/intern/cycles/blender/blender_curves.cpp
index b5e49bbeeef..35f5db16497 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -254,7 +254,7 @@ static bool ObtainCacheParticleUV(Mesh *mesh,
BL::Mesh::tessface_uv_textures_iterator 
l;
b_mesh->tessface_uv_textures.begin(l);
 
-   float3 uv = make_float3(0.0f, 0.0f, 
0.0f);
+   float2 uv = make_float2(0.0f, 0.0f);

if(b_mesh->tessface_uv_textures.length())
b_psys.uv_on_emitter(psmd, 
*b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back_slow(uv);
@@ -776,14 +776,10 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, 
ParticleCurveData *CData, int
 static void ExportCurveTriangleUV(ParticleCurveData *CData,
   int vert_offset,
   int resol,
-  float3 *uvdata)
+  float2 *uvdata)
 {
if(uvdata == NULL)
return;
-
-   float time = 0.0f;
-   float prevtime = 0.0f;
-
int vertexindex = vert_offset;
 
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
@@ -792,30 +788,20 @@ static void ExportCurveTriangleUV(ParticleCurveData 
*CData,
continue;
 
for(int curvekey = CData->curve_firstkey[curve]; 
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; 
curvekey++) {
-   time = 
CData->curvekey_time[curvekey]/CData->curve_length[curve];
-
for(int section = 0; section < resol; 
section++) {
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
}
-
-   prevtime = time;
}
}
}
@@ -1094,9 +1080,9 @@ void BlenderSync::sync_curves(Mesh *mesh,
if(active_render)
attr_uv = 
mesh->attributes.add(std, name);
else
-   attr_uv = 
mesh->attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
+   attr_uv = 
mesh->attributes.add(name, TypeFloat2, ATTR_ELEMENT_CORNER);
 
-   float3 *uv = attr_uv->data_float3();
+   float2 *uv = attr_uv->data_float2();
 
ExportCurveTriangleUV(&CData, tri_num * 
3, used_res, uv);
}
@@ -1104,9 +1090,9 @@ void BlenderSync::sync_curves(Mesh *mesh,
if(active_render)
attr_uv = 
mesh->curve_attributes.add(std, name);
else
-   attr_uv = 
mesh->curve_at

[Bf-blender-cvs] [a29186efb41] master: Merge branch 'blender2.7'

2019-03-18 Thread Brecht Van Lommel
Commit: a29186efb414cec130dbfe4f81173b64d37ad10a
Author: Brecht Van Lommel
Date:   Mon Mar 18 19:06:21 2019 +0100
Branches: master
https://developer.blender.org/rBa29186efb414cec130dbfe4f81173b64d37ad10a

Merge branch 'blender2.7'

===



===

diff --cc intern/cycles/blender/blender_curves.cpp
index 183376db4c1,35f5db16497..602e63a3e47
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@@ -247,11 -251,11 +247,11 @@@ static bool ObtainCacheParticleUV(Mesh 
b_psys.particles.begin(b_pa);
for(; pa_no < totparts+totchild; pa_no++) {
/* Add UVs */
 -  BL::Mesh::tessface_uv_textures_iterator 
l;
 -  b_mesh->tessface_uv_textures.begin(l);
 +  BL::Mesh::uv_layers_iterator l;
 +  b_mesh->uv_layers.begin(l);
  
-   float3 uv = make_float3(0.0f, 0.0f, 
0.0f);
+   float2 uv = make_float2(0.0f, 0.0f);
 -  
if(b_mesh->tessface_uv_textures.length())
 +  if(b_mesh->uv_layers.length())
b_psys.uv_on_emitter(psmd, 
*b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back_slow(uv);
  
@@@ -764,33 -784,24 +760,21 @@@ static void ExportCurveTriangleUV(Parti
  
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < 
CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
 -  if(CData->curve_keynum[curve] <= 1 || 
CData->curve_length[curve] == 0.0f)
 -  continue;
 -
for(int curvekey = CData->curve_firstkey[curve]; 
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; 
curvekey++) {
-   const float curve_time = 
CData->curvekey_time[curvekey];
-   const float curve_length = 
CData->curve_length[curve];
-   time = (curve_length > 0.0f) ? curve_time / 
curve_length : 0.0f;
- 
for(int section = 0; section < resol; 
section++) {
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = 
CData->curve_uv[curve];
-   uvdata[vertexindex].z = time;
vertexindex++;
}
- 
-   prevtime = time;
}
}
}

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


[Bf-blender-cvs] [b29790a953f] master: Fix T62587: Particle instances Use Count not saved correctly

2019-03-18 Thread Jacques Lucke
Commit: b29790a953ff0f31c431d2864e48bd38e94c
Author: Jacques Lucke
Date:   Mon Mar 18 17:53:03 2019 +0100
Branches: master
https://developer.blender.org/rBb29790a953ff0f31c431d2864e48bd38e94c

Fix T62587: Particle instances Use Count not saved correctly

Reviewers: brecht

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

===

M   source/blender/blenloader/intern/writefile.c

===

diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index c2cd6f282e8..ebc46d7573b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1422,9 +1422,10 @@ static void write_particlesettings(WriteData *wd, 
ParticleSettings *part)
if (part->instance_collection) { /* can be NULL 
if lining fails or set to None */

FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->instance_collection, object)
{
-   if (object != dw->ob) {
-   dw->index++;
+   if (object == dw->ob) {
+   break;
}
+   dw->index++;
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}

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


[Bf-blender-cvs] [8e54ef69c66] master: Fix T62700: Disconnect hair bug

2019-03-18 Thread Sergey Sharybin
Commit: 8e54ef69c66ff2458a508e5119a52fb17ad81515
Author: Sergey Sharybin
Date:   Mon Mar 18 17:49:53 2019 +0100
Branches: master
https://developer.blender.org/rB8e54ef69c66ff2458a508e5119a52fb17ad81515

Fix T62700: Disconnect hair bug

Need to use evaluated mesh from evaluated modifier data.

===

M   source/blender/editors/physics/particle_object.c

===

diff --git a/source/blender/editors/physics/particle_object.c 
b/source/blender/editors/physics/particle_object.c
index ac304f1aeec..2287659ef03 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -52,6 +52,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -580,7 +581,10 @@ static void disconnect_hair(
 Depsgraph *depsgraph, Scene *scene,
 Object *ob, ParticleSystem *psys)
 {
-   ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
+   Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+   ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
+   ParticleSystemModifierData *psmd_eval =
+   psys_get_modifier(object_eval, psys_eval);
ParticleEditSettings *pset = PE_settings(scene);
ParticleData *pa;
PTCacheEdit *edit;
@@ -605,7 +609,8 @@ static void disconnect_hair(
point++;
}
 
-   psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, 
pa, hairmat);
+   psys_mat_hair_to_global(
+   ob, psmd_eval->mesh_final, psys->part->from, pa, 
hairmat);
 
for (k = 0, key = pa->hair; k < pa->totkey; k++, key++) {
mul_m4_v3(hairmat, key->co);
@@ -678,7 +683,10 @@ static bool remap_hair_emitter(
 Object *target_ob, ParticleSystem *target_psys, PTCacheEdit 
*target_edit,
 float from_mat[4][4], float to_mat[4][4], bool from_global, bool 
to_global)
 {
-   ParticleSystemModifierData *target_psmd = psys_get_modifier(target_ob, 
target_psys);
+   Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+   ParticleSystem *psys_eval = psys_eval_get(depsgraph, ob, psys);
+   ParticleSystemModifierData *target_psmd =
+   psys_get_modifier(object_eval, psys_eval);
ParticleData *pa, *tpa;
PTCacheEditPoint *edit_point;
PTCacheEditKey *ekey;

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


[Bf-blender-cvs] [00f2700b751] sculpt-mode-features: Merge branch 'master' into sculpt-mode-features

2019-03-18 Thread Pablo Dobarro
Commit: 00f2700b75128bee352572d6f34e096b5c26ddab
Author: Pablo Dobarro
Date:   Mon Mar 18 17:30:19 2019 +0100
Branches: sculpt-mode-features
https://developer.blender.org/rB00f2700b75128bee352572d6f34e096b5c26ddab

Merge branch 'master' into sculpt-mode-features

===



===

diff --cc source/blender/blenloader/intern/versioning_280.c
index c46b8fa2518,986f35008bd..47a69ff7f63
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -2892,16 -2897,28 +2897,35 @@@ void blo_do_versions_280(FileData *fd, 

"Filmic");
}
}
 +
 +  Brush *br;
 +  for (br = bmain->brushes.first; br; br = br->id.next) {
 +  if (br->ob_mode & OB_MODE_SCULPT) {
 +  br->normal_radius_factor = 0.2f;
 +  }
 +  }
}
  
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 49)) {
+   /* All tool names changed, reset to defaults. */
+   for (WorkSpace *workspace = bmain->workspaces.first; workspace; 
workspace = workspace->id.next) {
+   while (!BLI_listbase_is_empty(&workspace->tools)) {
+   BKE_workspace_tool_remove(workspace, 
workspace->tools.first);
+   }
+   }
+   }
+ 
{
/* Versioning code until next subversion bump goes here. */
+ 
+   LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
+   /* Replace deprecated PART_DRAW_BB by PART_DRAW_NOT */
+   if (part->ren_as == PART_DRAW_BB) {
+   part->ren_as = PART_DRAW_NOT;
+   }
+   if (part->draw_as == PART_DRAW_BB) {
+   part->draw_as = PART_DRAW_NOT;
+   }
+   }
}
  }
diff --cc source/blender/editors/object/object_edit.c
index aacd694f530,1964cd53cc7..7a807206bda
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@@ -78,9 -77,8 +78,10 @@@
  #include "BKE_softbody.h"
  #include "BKE_editmesh.h"
  #include "BKE_report.h"
+ #include "BKE_scene.h"
  #include "BKE_workspace.h"
 +#include "BKE_mesh_runtime.h"
 +#include "BKE_library.h"
  
  #include "DEG_depsgraph.h"
  #include "DEG_depsgraph_build.h"
diff --cc source/blender/makesdna/DNA_userdef_types.h
index 5950ceac41b,1da28b4aa2d..6d4a4158f87
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@@ -894,15 -897,21 +897,22 @@@ typedef enum eUserpref_UI_Flag 
USER_HIDE_SYSTEM_BOOKMARKS  = (1u << 31),
  } eUserpref_UI_Flag;
  
- /** #UserDef.uiflag2 */
+ /** #UserDef.uiflag2
+  *
+  * \note don't add new flags here, use 'uiflag' which has flags free. */
  typedef enum eUserpref_UI_Flag2 {
-   USER_UIFLAG2_DEPRECATED_0   = (1 << 0),
-   USER_REGION_OVERLAP = (1 << 1),
-   USER_TRACKPAD_NATURAL   = (1 << 2),
-   USER_EDIT_MODE_SMOOTH_WIRE  = (1 << 3),
-   USER_2D_VIEWPORT_PANNING= (1 << 4),
 -  USER_UIFLAG2_UNUSED_0   = (1 << 0),  /* cleared */
++  USER_UIFLAG2_UNUSED_0   = (1 << 0),
+   USER_REGION_OVERLAP = (1 << 1),
+   USER_TRACKPAD_NATURAL   = (1 << 2),
 -  USER_UIFLAG2_UNUSED_3   = (1 << 3),  /* dirty */
++  USER_UIFLAG2_UNUSED_3   = (1 << 3),
++  USER_2D_VIEWPORT_PANNING= (1 << 4),
  } eUserpref_UI_Flag2;
  
+ typedef enum eUserpref_GPU_Flag {
+   USER_GPU_FLAG_NO_DEPT_PICK  = (1 << 0),
+   USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE  = (1 << 1),
+ } eUserpref_GPU_Flag;
+ 
  /** #UserDef.tablet_api */
  typedef enum eUserpref_TableAPI {
USER_TABLET_AUTOMATIC = 0,

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


[Bf-blender-cvs] [ad3d9256821] master: Fix T62636: Overlapping scrollbar in driver editor

2019-03-18 Thread Jacques Lucke
Commit: ad3d9256821c197c44c6565ef2797cf361f12ec9
Author: Jacques Lucke
Date:   Mon Mar 18 17:28:36 2019 +0100
Branches: master
https://developer.blender.org/rBad3d9256821c197c44c6565ef2797cf361f12ec9

Fix T62636: Overlapping scrollbar in driver editor

Instead of only `ymin` and `ymax`, `ANIM_channel_draw_widgets`
has a rectangle as input now.
This allows the caller to set a custom width for the channel.

Some space types need the extra space for the scrollbar
(drivers, graph), but the other don't have a scrollbar.

Reviewers: brecht

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

===

M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/editors/include/ED_anim_api.h
M   source/blender/editors/space_action/action_draw.c
M   source/blender/editors/space_graph/graph_draw.c
M   source/blender/editors/space_nla/nla_draw.c

===

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index e3138dee1a7..12d14d70602 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4427,12 +4427,18 @@ static void draw_setting_widget(bAnimContext *ac, 
bAnimListElem *ale, const bAni
 }
 
 /* Draw UI widgets the given channel */
-void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, 
bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t 
channel_index)
+void ANIM_channel_draw_widgets(
+const bContext *C,
+bAnimContext *ac,
+bAnimListElem *ale,
+uiBlock *block,
+rctf *rect,
+size_t channel_index)
 {
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
View2D *v2d = &ac->ar->v2d;
-   float y, ymid /*, ytext*/;
-   short offset;
+   float ymid;
+   const short channel_height = round_fl_to_int(BLI_rctf_size_y(rect));
const bool is_being_renamed = achannel_is_being_renamed(ac, acf, 
channel_index);
 
/* sanity checks - don't draw anything */
@@ -4440,15 +4446,13 @@ void ANIM_channel_draw_widgets(const bContext *C, 
bAnimContext *ac, bAnimListEle
return;
 
/* get initial offset */
-   if (acf->get_offset)
-   offset = acf->get_offset(ac, ale);
-   else
-   offset = 0;
+   short offset = rect->xmin;
+   if (acf->get_offset) {
+   offset += acf->get_offset(ac, ale);
+   }
 
-   /* calculate appropriate y-coordinates for icon buttons
-*/
-   y = (ymaxc - yminc) / 2 + yminc;
-   ymid = y - 0.5f * ICON_WIDTH;
+   /* calculate appropriate y-coordinates for icon buttons */
+   ymid = BLI_rctf_cent_y(rect) - 0.5f * ICON_WIDTH;
 
/* no button backdrop behind icons */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -4530,13 +4534,12 @@ void ANIM_channel_draw_widgets(const bContext *C, 
bAnimContext *ac, bAnimListEle
 */
if (acf->name_prop(ale, &ptr, &prop)) {
const short margin_x = 3 * round_fl_to_int(UI_DPI_FAC);
-   const short channel_height = round_fl_to_int(ymaxc - 
yminc);
const short width = ac->ar->winx - offset - (margin_x * 
2);
uiBut *but;
 
UI_block_emboss_set(block, UI_EMBOSS);
 
-   but = uiDefButR(block, UI_BTYPE_TEXT, 1, "", offset + 
margin_x, yminc,
+   but = uiDefButR(block, UI_BTYPE_TEXT, 1, "", offset + 
margin_x, rect->ymin,
MAX2(width, RENAME_TEXT_MIN_WIDTH), 
channel_height,
&ptr, RNA_property_identifier(prop), 
-1, 0, 0, -1, -1, NULL);
 
@@ -4561,7 +4564,7 @@ void ANIM_channel_draw_widgets(const bContext *C, 
bAnimContext *ac, bAnimListEle
 
/* step 5) draw mute+protection toggles + (sliders) 
... */
/* reset offset - now goes from RHS of panel */
-   offset = 0;
+   offset = (int)rect->xmax;
 
// TODO: when drawing sliders, make those draw instead of these toggles 
if not enough space
if (v2d && !is_being_renamed) {
@@ -4589,33 +4592,33 @@ void ANIM_channel_draw_widgets(const bContext *C, 
bAnimContext *ac, bAnimListEle
if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > 
ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, 
ACHANNEL_SETTING_PROTECT)) {
-   offset += ICON_WIDTH;
-   draw_setting_widget(ac, ale, acf, block, 
(int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_PROTECT);
+   offset -= ICON_WIDTH;
+   

[Bf-blender-cvs] [8fb0b9aebbd] master: Subdiv: Enable topology cache in edit mode

2019-03-18 Thread Sergey Sharybin
Commit: 8fb0b9aebbd409216dec77c4b1bf2a2fbba80698
Author: Sergey Sharybin
Date:   Mon Mar 18 15:56:16 2019 +0100
Branches: master
https://developer.blender.org/rB8fb0b9aebbd409216dec77c4b1bf2a2fbba80698

Subdiv: Enable topology cache in edit mode

The general idea of this change is to have a runtime data pointer
in the ModifierData, so it can be preserved through copy-on-write
updates by the dependency graph.

This is where subdivision surface modifier can store its topology
cache, so it is not getting trashed on every copy-on-write which
is happening when moving a vertex.

Similar mechanism should be used by multiresolution, dynamic paint
and some other modifiers which cache evaluated data.

This fixes T61746.

Thing to keep in mind, that there are more reports about slow
subdivision surface in the tracker, but that boils down to the
fact that those have a lot of extraordinary vertices, and hence
a lot slower to evaluated topology.
Other thing is, this speeds up oeprations which doesn't change
topology (i.e. moving vertices).

Reviewers: brecht

Reviewed By: brecht

Maniphest Tasks: T61746

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

===

M   source/blender/blenkernel/BKE_modifier.h
M   source/blender/blenloader/intern/readfile.c
M   source/blender/depsgraph/intern/depsgraph_type.h
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/modifiers/intern/MOD_armature.c
M   source/blender/modifiers/intern/MOD_array.c
M   source/blender/modifiers/intern/MOD_bevel.c
M   source/blender/modifiers/intern/MOD_boolean.c
M   source/blender/modifiers/intern/MOD_build.c
M   source/blender/modifiers/intern/MOD_cast.c
M   source/blender/modifiers/intern/MOD_cloth.c
M   source/blender/modifiers/intern/MOD_collision.c
M   source/blender/modifiers/intern/MOD_correctivesmooth.c
M   source/blender/modifiers/intern/MOD_curve.c
M   source/blender/modifiers/intern/MOD_datatransfer.c
M   source/blender/modifiers/intern/MOD_decimate.c
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_dynamicpaint.c
M   source/blender/modifiers/intern/MOD_edgesplit.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_fluidsim.c
M   source/blender/modifiers/intern/MOD_hook.c
M   source/blender/modifiers/intern/MOD_laplaciandeform.c
M   source/blender/modifiers/intern/MOD_laplaciansmooth.c
M   source/blender/modifiers/intern/MOD_lattice.c
M   source/blender/modifiers/intern/MOD_mask.c
M   source/blender/modifiers/intern/MOD_meshcache.c
M   source/blender/modifiers/intern/MOD_meshdeform.c
M   source/blender/modifiers/intern/MOD_meshsequencecache.c
M   source/blender/modifiers/intern/MOD_mirror.c
M   source/blender/modifiers/intern/MOD_multires.c
M   source/blender/modifiers/intern/MOD_none.c
M   source/blender/modifiers/intern/MOD_normal_edit.c
M   source/blender/modifiers/intern/MOD_ocean.c
M   source/blender/modifiers/intern/MOD_particleinstance.c
M   source/blender/modifiers/intern/MOD_particlesystem.c
M   source/blender/modifiers/intern/MOD_remesh.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_shapekey.c
M   source/blender/modifiers/intern/MOD_shrinkwrap.c
M   source/blender/modifiers/intern/MOD_simpledeform.c
M   source/blender/modifiers/intern/MOD_skin.c
M   source/blender/modifiers/intern/MOD_smoke.c
M   source/blender/modifiers/intern/MOD_smooth.c
M   source/blender/modifiers/intern/MOD_softbody.c
M   source/blender/modifiers/intern/MOD_solidify.c
M   source/blender/modifiers/intern/MOD_subsurf.c
M   source/blender/modifiers/intern/MOD_surface.c
M   source/blender/modifiers/intern/MOD_surfacedeform.c
M   source/blender/modifiers/intern/MOD_triangulate.c
M   source/blender/modifiers/intern/MOD_uvproject.c
M   source/blender/modifiers/intern/MOD_uvwarp.c
M   source/blender/modifiers/intern/MOD_warp.c
M   source/blender/modifiers/intern/MOD_wave.c
M   source/blender/modifiers/intern/MOD_weighted_normal.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c
M   source/blender/modifiers/intern/MOD_weightvgmix.c
M   source/blender/modifiers/intern/MOD_weightvgproximity.c
M   source/blender/modifiers/intern/MOD_wireframe.c

===

diff --git a/source/blender/blenkernel/BKE_modifier.h 
b/source/blender/blenkernel/BKE_modifier.h
index 1a1e510b9e1..22782b675f5 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -233,6 +233,8 @@ typedef struct ModifierTypeInfo {
/* Free internal modifier data variables, this function sh

[Bf-blender-cvs] [91ffd39e774] master: Fix T62706: Orphan Data : I have now to save a file, close and reopen it, only then I can purge previous deleted meshes.

2019-03-18 Thread Bastien Montagne
Commit: 91ffd39e77498b81634750527aa5069c950a4d59
Author: Bastien Montagne
Date:   Mon Mar 18 16:48:31 2019 +0100
Branches: master
https://developer.blender.org/rB91ffd39e77498b81634750527aa5069c950a4d59

Fix T62706: Orphan Data : I have now to save a file, close and reopen it, only 
then I can purge previous deleted meshes.

libquery code has some specific handling for IDs tagged as 'no_main',
among which to never consider them as refcounted/refcounting other IDs.

This is fine, but it also means we have to be careful when moving an ID
from main to out-of-main status, to do all id remapping we need
//before// we tag it as no_main.

That was a bit tedious to track down, we'll have to be careful that all
the corner cases we have to take care of, do not end up in a giant soup
of expections to exceptions, where nobody can find its way anymore...

===

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

===

diff --git a/source/blender/blenkernel/intern/library_remap.c 
b/source/blender/blenkernel/intern/library_remap.c
index 04ccdc729da..d4e30bc07e9 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -1001,7 +1001,9 @@ static void id_delete(Main *bmain, const bool 
do_tagged_deletion)
if ((id->tag & tag) || (id->lib != NULL 
&& (id->lib->id.tag & tag))) {
BLI_remlink(lb, id);

BLI_addtail(&tagged_deleted_ids, id);
-   id->tag |= tag | 
LIB_TAG_NO_MAIN;
+   /* Do not tag as no_main now, 
we want to unlink it first (lower-level ID management code
+* has some specific handling 
of 'nom main' IDs that would be a problem in that case). */
+   id->tag |= tag;
keep_looping = true;
}
}
@@ -1021,6 +1023,8 @@ static void id_delete(Main *bmain, const bool 
do_tagged_deletion)
ID_REMAP_FLAG_NEVER_NULL_USAGE | 
ID_REMAP_FORCE_NEVER_NULL_USAGE);
/* Since we removed ID from Main, we also need 
to unlink its own other IDs usages ourself. */
BKE_libblock_relink_ex(bmain, id, NULL, NULL, 
true);
+   /* Now we can safely mark that ID as not being 
in Main database anymore. */
+   id->tag |= LIB_TAG_NO_MAIN;
/* This is needed because we may not have 
remapped usages of that ID by other deleted ones. */
 // id->us = 0;  /* Is it actually? */
}

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


[Bf-blender-cvs] [8162a6c51d2] blender2.7: Cleanup: fix compiler warnings.

2019-03-18 Thread Brecht Van Lommel
Commit: 8162a6c51d28b09791977c9009f79b9a204bb346
Author: Brecht Van Lommel
Date:   Mon Mar 18 14:56:08 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB8162a6c51d28b09791977c9009f79b9a204bb346

Cleanup: fix compiler warnings.

===

M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/render/light.cpp
M   intern/cycles/render/light.h

===

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index 27541800804..923fdf9be4b 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -433,7 +433,7 @@ void BlenderSession::render()
BL::RenderLayer b_rlay = *b_single_rlay;
 
/* add passes */
-   vector passes = sync->sync_render_passes(b_rlay, 
*b_layer_iter, session_params);
+   vector passes = sync->sync_render_passes(b_rlay, 
*b_layer_iter);
buffer_params.passes = passes;
 
PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index c595e0364c6..841af87000f 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -553,8 +553,7 @@ int BlenderSync::get_denoising_pass(BL::RenderPass& b_pass)
 }
 
 vector BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
- BL::SceneRenderLayer& b_srlay,
- const SessionParams 
&session_params)
+ BL::SceneRenderLayer& b_srlay)
 {
vector passes;
Pass::add(PASS_COMBINED, passes);
diff --git a/intern/cycles/blender/blender_sync.h 
b/intern/cycles/blender/blender_sync.h
index 6d78f62c7d0..4541fa17738 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -67,8 +67,7 @@ public:
   const char *layer = 0);
void sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer);
vector sync_render_passes(BL::RenderLayer& b_rlay,
-   BL::SceneRenderLayer& b_srlay,
-   const SessionParams &session_params);
+   BL::SceneRenderLayer& b_srlay);
void sync_integrator();
void sync_camera(BL::RenderSettings& b_render,
 BL::Object& b_override,
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 7101d2ab60c..7439f82790d 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -191,7 +191,7 @@ bool LightManager::has_background_light(Scene *scene)
return false;
 }
 
-void LightManager::disable_ineffective_light(Device * /*device*/, Scene *scene)
+void LightManager::disable_ineffective_light(Scene *scene)
 {
/* Make all lights enabled by default, and perform some preliminary 
checks
 * needed for finer-tuning of settings (for example, check whether we've
@@ -873,7 +873,7 @@ void LightManager::device_update(Device *device, 
DeviceScene *dscene, Scene *sce
 
use_light_visibility = false;
 
-   disable_ineffective_light(device, scene);
+   disable_ineffective_light(scene);
 
device_update_points(device, dscene, scene);
if(progress.get_cancel()) return;
diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h
index f4dfe0cadbf..e7c06604fc4 100644
--- a/intern/cycles/render/light.h
+++ b/intern/cycles/render/light.h
@@ -109,7 +109,7 @@ protected:
 * which doesn't contribute to the scene or which is only used for MIS
 * and scene doesn't need MIS.
 */
-   void disable_ineffective_light(Device *device, Scene *scene);
+   void disable_ineffective_light(Scene *scene);
 
void device_update_points(Device *device,
  DeviceScene *dscene,

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


[Bf-blender-cvs] [dff88a92a47] blender2.7: Fix AMD OpenCL build error after recent changes.

2019-03-18 Thread Brecht Van Lommel
Commit: dff88a92a470181c8ae82d1266eb610fca4521e0
Author: Brecht Van Lommel
Date:   Mon Mar 18 16:36:55 2019 +0100
Branches: blender2.7
https://developer.blender.org/rBdff88a92a470181c8ae82d1266eb610fca4521e0

Fix AMD OpenCL build error after recent changes.

Always use native function since this was already the case due to
__CL_USE_NATIVE__ not being defined in time, and seems to have caused no
known issues.

===

M   intern/cycles/kernel/kernel_compat_opencl.h

===

diff --git a/intern/cycles/kernel/kernel_compat_opencl.h 
b/intern/cycles/kernel/kernel_compat_opencl.h
index 3bf8cdebf4a..d3d0934a626 100644
--- a/intern/cycles/kernel/kernel_compat_opencl.h
+++ b/intern/cycles/kernel/kernel_compat_opencl.h
@@ -125,7 +125,9 @@
 #define fmodf(x, y) fmod((float)(x), (float)(y))
 #define sinhf(x) sinh(((float)(x)))
 
-#if !(defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__))
+/* Use native functions with possibly lower precision for performance,
+ * no issues found so far. */
+#if 1
 #  define sinf(x) native_sin(((float)(x)))
 #  define cosf(x) native_cos(((float)(x)))
 #  define tanf(x) native_tan(((float)(x)))
@@ -140,7 +142,7 @@
 #  define expf(x) exp(((float)(x)))
 #  define sqrtf(x) sqrt(((float)(x)))
 #  define logf(x) log(((float)(x)))
-#  define rcp(x)  recip(x))
+#  define rcp(x)  recip(x)
 #endif
 
 /* data lookup defines */

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


[Bf-blender-cvs] [c7e2b271994] functions: Merge branch 'master' into functions

2019-03-18 Thread Jacques Lucke
Commit: c7e2b27199459f5c7d96269ee708f85b41217f21
Author: Jacques Lucke
Date:   Mon Mar 18 16:08:50 2019 +0100
Branches: functions
https://developer.blender.org/rBc7e2b27199459f5c7d96269ee708f85b41217f21

Merge branch 'master' into functions

===



===

diff --cc source/blender/makesdna/DNA_anim_types.h
index ead43a1,ccc0b2e4fcb..f17b93fed62
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@@ -401,22 -406,21 +406,23 @@@ typedef struct DriverVar 
float curval;
  } DriverVar;
  
- /* Driver Variable Types */
+ /** Driver Variable Types.* */
  typedef enum eDriverVar_Types {
-   /* single RNA property */
+   /** single RNA property */
DVAR_TYPE_SINGLE_PROP   = 0,
-   /* rotation difference (between 2 bones) */
+   /** rotation difference (between 2 bones) */
DVAR_TYPE_ROT_DIFF,
-   /* distance between objects/bones */
+   /** distance between objects/bones */
DVAR_TYPE_LOC_DIFF,
-   /* 'final' transform for object/bones */
+   /** 'final' transform for object/bones */
DVAR_TYPE_TRANSFORM_CHAN,
 +  /* evaluate function */
 +  DVAR_TYPE_FUNCTION,
  
-   /* maximum number of variable types
-* NOTE: this must always be th last item in this list,
-*   so add new types above this line.
+   /** Maximum number of variable types.
+*
+* \note This must always be th last item in this list,
+* so add new types above this line.
 */
MAX_DVAR_TYPES
  } eDriverVar_Types;

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


[Bf-blender-cvs] [af2f924b119] functions: Unified socket declaration system

2019-03-18 Thread Jacques Lucke
Commit: af2f924b119c8be7a27176a63afcc6256d19b73b
Author: Jacques Lucke
Date:   Mon Mar 18 16:05:21 2019 +0100
Branches: functions
https://developer.blender.org/rBaf2f924b119c8be7a27176a63afcc6256d19b73b

Unified socket declaration system

Function input/output use the same structure to declare
sockets as other nodes now.

The type inferencer can be invoked in the panel on the
right in the node editor.

The list nodes work with floats, vectors and ints.

===

M   release/scripts/startup/function_nodes/base.py
M   release/scripts/startup/function_nodes/inferencer.py
M   release/scripts/startup/function_nodes/nodes/append_to_list.py
M   release/scripts/startup/function_nodes/nodes/clamp.py
M   release/scripts/startup/function_nodes/nodes/combine_lists.py
M   release/scripts/startup/function_nodes/nodes/combine_vector.py
M   release/scripts/startup/function_nodes/nodes/float_math.py
M   release/scripts/startup/function_nodes/nodes/function_input.py
M   release/scripts/startup/function_nodes/nodes/function_output.py
M   release/scripts/startup/function_nodes/nodes/get_list_element.py
M   release/scripts/startup/function_nodes/nodes/map_range.py
M   release/scripts/startup/function_nodes/nodes/object_transforms.py
M   release/scripts/startup/function_nodes/nodes/random_number.py
M   release/scripts/startup/function_nodes/nodes/separate_vector.py
M   release/scripts/startup/function_nodes/nodes/vector_distance.py
M   release/scripts/startup/function_nodes/search.py
M   release/scripts/startup/function_nodes/socket_decl.py
M   release/scripts/startup/function_nodes/sockets.py
A   release/scripts/startup/function_nodes/tree_panel.py
M   release/scripts/startup/function_nodes/update_sockets.py
M   release/scripts/startup/function_nodes/utils/generic.py
M   source/blender/functions/frontends/data_flow_nodes/builder.cpp
M   source/blender/functions/frontends/data_flow_nodes/builder.hpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
M   source/blender/functions/frontends/data_flow_nodes/test_nodes.cpp
M   source/blender/functions/frontends/data_flow_nodes/test_sockets.cpp
M   source/blender/functions/functions/lists.cpp
M   source/blender/functions/functions/lists.hpp
M   source/blender/functions/types/numeric_lists.cpp
M   source/blender/functions/types/numeric_lists.hpp

===

diff --git a/release/scripts/startup/function_nodes/base.py 
b/release/scripts/startup/function_nodes/base.py
index 8af190b9903..cbd4c87dadc 100644
--- a/release/scripts/startup/function_nodes/base.py
+++ b/release/scripts/startup/function_nodes/base.py
@@ -1,14 +1,108 @@
 import bpy
 from bpy.props import *
 from . utils.generic import iter_subclasses_recursive
+import itertools
+from collections import defaultdict
 
-class FunctionNodeTree(bpy.types.NodeTree):
+class BaseTree:
+def new_link(self, a, b):
+if a.is_output:
+self.links.new(a, b)
+else:
+self.links.new(b, a)
+
+class FunctionNodeTree(bpy.types.NodeTree, BaseTree):
 bl_idname = "FunctionNodeTree"
 bl_icon = "MOD_DATA_TRANSFER"
 bl_label = "Function Nodes"
 
 
+class NodeStorage:
+def __init__(self, node):
+self.node = node
+self.set_current_declaration(*node.get_sockets())
+
+def set_current_declaration(self, inputs, outputs):
+self.inputs_decl = inputs
+self.outputs_decl = outputs
+
+self.inputs_per_decl = {}
+sockets = iter(self.node.inputs)
+for decl in self.inputs_decl:
+group = tuple(itertools.islice(sockets, decl.amount(self.node)))
+self.inputs_per_decl[decl] = group
+
+self.outputs_per_decl = {}
+sockets = iter(self.node.outputs)
+for decl in self.outputs_decl:
+group = tuple(itertools.islice(sockets, decl.amount(self.node)))
+self.outputs_per_decl[decl] = group
+
+self.sockets_per_decl = {}
+self.sockets_per_decl.update(self.inputs_per_decl)
+self.sockets_per_decl.update(self.outputs_per_decl)
+
+self.decl_per_socket = {}
+self.decl_index_per_socket = {}
+for decl, sockets in self.sockets_per_decl.items():
+for i, socket in enumerate(sockets):
+self.decl_per_socket[socket] = decl
+self.decl_index_per_socket[socket] = i
+
+_storage_per_node = {}
+
 class BaseNode:
+def init(self, context):
+inputs, outputs = self.get_sockets()
+for decl in inputs:
+decl.build(self, self.inputs)
+for decl in outputs:
+decl.build(self, self.outputs)
+
+def rebuild_and_try_keep_state(self):
+state = self._get_state()
+self.rebuild()
+self._try_set_state(state)
+
+  

[Bf-blender-cvs] [d1f04658d85] master: Fix: Cycles Subdivisions panel was showing, even when using Eevee

2019-03-18 Thread William Reynish
Commit: d1f04658d855a6fdf038aa80ad656228077b0d46
Author: William Reynish
Date:   Mon Mar 18 15:56:54 2019 +0100
Branches: master
https://developer.blender.org/rBd1f04658d855a6fdf038aa80ad656228077b0d46

Fix: Cycles Subdivisions panel was showing, even when using Eevee

===

M   intern/cycles/blender/addon/ui.py

===

diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index a3ee5533fe7..4b0e179a388 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -313,7 +313,7 @@ class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, 
Panel):
 
 @classmethod
 def poll(self, context):
-return context.scene.cycles.feature_set == 'EXPERIMENTAL'
+return (context.scene.render.engine == 'CYCLES') and 
(context.scene.cycles.feature_set == 'EXPERIMENTAL')
 
 def draw(self, context):
 layout = self.layout

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


[Bf-blender-cvs] [64906260771] master: Depsgraph: Store original modifier pointer

2019-03-18 Thread Sergey Sharybin
Commit: 64906260771589ca6192547631b0c961c03af2bc
Author: Sergey Sharybin
Date:   Mon Mar 18 14:21:35 2019 +0100
Branches: master
https://developer.blender.org/rB64906260771589ca6192547631b0c961c03af2bc

Depsgraph: Store original modifier pointer

Currently not needed that much, but will ease some further
development which is related on preserving runtime modifier
data.

===

M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/makesdna/DNA_modifier_types.h

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index c161d32a1f0..cae84c3e535 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -612,18 +612,26 @@ void update_edit_mode_pointers(const Depsgraph *depsgraph,
}
 }
 
+template 
+void update_list_orig_pointers(const ListBase* listbase_orig,
+   ListBase* listbase,
+   T *T::*orig_field)
+{
+   T *element_orig = reinterpret_cast(listbase_orig->first);
+   T *element_cow = reinterpret_cast(listbase->first);
+   while (element_orig != NULL) {
+   element_cow->*orig_field = element_orig;
+   element_cow = element_cow->next;
+   element_orig = element_orig->next;
+   }
+}
+
 void update_particle_system_orig_pointers(const Object *object_orig,
   Object *object_cow)
 {
-   ParticleSystem *psys_cow =
-   (ParticleSystem *) object_cow->particlesystem.first;
-   ParticleSystem *psys_orig =
-   (ParticleSystem *) object_orig->particlesystem.first;
-   while (psys_orig != NULL) {
-   psys_cow->orig_psys = psys_orig;
-   psys_cow = psys_cow->next;
-   psys_orig = psys_orig->next;
-   }
+   update_list_orig_pointers(&object_orig->particlesystem,
+ &object_cow->particlesystem,
+ &ParticleSystem::orig_psys);
 }
 
 void set_particle_system_modifiers_loaded(Object *object_cow)
@@ -638,15 +646,25 @@ void set_particle_system_modifiers_loaded(Object 
*object_cow)
}
 }
 
+void update_particles_after_copy(const Object *object_orig, Object *object_cow)
+{
+   update_particle_system_orig_pointers(object_orig, object_cow);
+   set_particle_system_modifiers_loaded(object_cow);
+}
+
 void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow)
 {
-   bPoseChannel *pchan_cow = (bPoseChannel *) pose_cow->chanbase.first;
-   bPoseChannel *pchan_orig = (bPoseChannel *) pose_orig->chanbase.first;
-   while (pchan_orig != NULL) {
-   pchan_cow->orig_pchan = pchan_orig;
-   pchan_cow = pchan_cow->next;
-   pchan_orig = pchan_orig->next;
-   }
+   update_list_orig_pointers(&pose_orig->chanbase,
+ &pose_cow->chanbase,
+ &bPoseChannel::orig_pchan);
+}
+
+void update_modifiers_orig_pointers(const Object *object_orig,
+Object *object_cow)
+{
+   update_list_orig_pointers(&object_orig->modifiers,
+ &object_cow->modifiers,
+ &ModifierData::orig_modifier_data);
 }
 
 /* Do some special treatment of data transfer from original ID to it's
@@ -679,8 +697,8 @@ void update_id_after_copy(const Depsgraph *depsgraph,
  
object_cow->pose);
}
}
-   update_particle_system_orig_pointers(object_orig, 
object_cow);
-   set_particle_system_modifiers_loaded(object_cow);
+   update_particles_after_copy(object_orig, object_cow);
+   update_modifiers_orig_pointers(object_orig, object_cow);
break;
}
case ID_SCE:
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 5aec9b95797..2719e324bda 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -113,6 +113,10 @@ typedef struct ModifierData {
char name[64];
 
char *error;
+
+   /* Pointer to a ModifierData in the original domain. */
+   struct ModifierData *orig_modifier_data;
+   void *_pad2;
 } ModifierData;
 
 typedef enum {

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


[Bf-blender-cvs] [01c5335422a] master: Cleanup: Comments

2019-03-18 Thread Sergey Sharybin
Commit: 01c5335422a741b6847f082dad14389d3cb62201
Author: Sergey Sharybin
Date:   Mon Mar 18 12:51:01 2019 +0100
Branches: master
https://developer.blender.org/rB01c5335422a741b6847f082dad14389d3cb62201

Cleanup: Comments

===

M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index c545099c97b..c161d32a1f0 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -26,8 +26,7 @@
  * material) to be handled in same way as "real" datablocks, even tho some
  * internal BKE routines doesn't treat them like that.
  *
- * TODO(sergey): Re-evaluate that after new ID handling is in place.
- */
+ * TODO(sergey): Re-evaluate that after new ID handling is in place. */
 #define NESTED_ID_NASTY_WORKAROUND
 
 /* Silence warnings from copying deprecated fields. */
@@ -162,8 +161,7 @@ void nested_id_hack_discard_pointers(ID *id_cow)
 
 /* Set ID pointer of nested owned IDs (nodetree, key) to NULL.
  *
- * Return pointer to a new ID to be used.
- */
+ * Return pointer to a new ID to be used. */
 const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage 
*storage,
 const ID *id)
 {
@@ -278,8 +276,7 @@ struct ValidateData {
 };
 
 /* Similar to generic BKE_id_copy() but does not require main and assumes 
pointer
- * is already allocated,
- */
+ * is already allocated. */
 bool id_copy_inplace_no_main(const ID *id, ID *newid)
 {
const ID *id_for_copy = id;
@@ -305,8 +302,7 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid)
 }
 
 /* Similar to BKE_scene_copy() but does not require main and assumes pointer
- * is already allocated.
- */
+ * is already allocated. */
 bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene)
 {
const ID *id_for_copy = &scene->id;
@@ -461,8 +457,7 @@ BLI_INLINE bool check_datablock_expanded(const ID *id_cow)
  * does not need any remapping or anything.
  *
  * TODO(sergey): How to make it more robust for the future, so we don't have
- * to maintain exception lists all over the code?
- */
+ * to maintain exception lists all over the code? */
 bool check_datablocks_copy_on_writable(const ID *id_orig)
 {
const ID_Type id_type = GS(id_orig->name);
@@ -476,8 +471,7 @@ bool check_datablocks_copy_on_writable(const ID *id_orig)
 }
 
 /* Callback for BKE_library_foreach_ID_link which remaps original ID pointer
- * with the one created by CoW system.
- */
+ * with the one created by CoW system. */
 
 struct RemapCallbackUserData {
/* Dependency graph for which remapping is happening. */
@@ -592,8 +586,7 @@ void update_mesh_edit_mode_pointers(const Depsgraph 
*depsgraph,
 }
 
 /* Edit data is stored and owned by original datablocks, copied ones
- * are simply referencing to them.
- */
+ * are simply referencing to them. */
 void update_edit_mode_pointers(const Depsgraph *depsgraph,
const ID *id_orig, ID *id_cow)
 {
@@ -659,8 +652,7 @@ void update_pose_orig_pointers(const bPose *pose_orig, 
bPose *pose_cow)
 /* Do some special treatment of data transfer from original ID to it's
  * CoW complementary part.
  *
- * Only use for the newly created CoW datablocks.
- */
+ * Only use for the newly created CoW datablocks. */
 void update_id_after_copy(const Depsgraph *depsgraph,
   const IDNode *id_node,
   const ID *id_orig, ID *id_cow)
@@ -709,8 +701,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
 }
 
 /* This callback is used to validate that all nested ID datablocks are
- * properly expanded.
- */
+ * properly expanded. */
 int foreach_libblock_validate_callback(void *user_data,
ID * /*id_self*/,
ID **id_p,
@@ -731,8 +722,7 @@ int foreach_libblock_validate_callback(void *user_data,
 /* Actual implementation of logic which "expands" all the data which was not
  * yet copied-on-write.
  *
- * NOTE: Expects that CoW datablock is empty.
- */
+ * NOTE: Expects that CoW datablock is empty. */
 ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
const IDNode *id_node,
DepsgraphNodeBuilder *node_builder,
@@ -846,8 +836,7 @@ struct ObjectRuntimeBackup {
 
 /* Make a backup of object's evaluation runtime data, additionally
  * make object to be safe for free without invalidating backed up
- * pointers.
- */
+ * pointers. */
 static void deg_backup_object_runtime(
 Object *object,
 ObjectRuntimeBackup *object_runtime_backup)
@@ -1014,8 +1003,7 @@ void discar

[Bf-blender-cvs] [c5fe6ed96bd] master: Fix T62633: Model normals not updating in a modifier stack after a deform modifier.

2019-03-18 Thread Bastien Montagne
Commit: c5fe6ed96bd1e6a20253bbeb2a20e4944781787a
Author: Bastien Montagne
Date:   Mon Mar 18 15:37:46 2019 +0100
Branches: master
https://developer.blender.org/rBc5fe6ed96bd1e6a20253bbeb2a20e4944781787a

Fix T62633: Model normals not updating in a modifier stack after a deform 
modifier.

A deform-only modifier that needs access to normals need a copy of
evaluated mesh with those normals updated, when it is not the first one
in the stack.

That issue had been partially fixed in Object mode a long time ago
(see T23673), but it was still broken for deform-only stacks cases.

And it was also completely missing from the Edit mode code
(`editbmesh_calc_modifiers()` function).

===

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

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index cdcb64fb094..86ec491b43e 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1221,6 +1221,10 @@ static void mesh_calc_modifiers(
}
*r_final = NULL;
 
+   /* We need mesh even for deform-only part of the stack, in cases where 
some modifier needs
+* e.g. access to updated normals. See T62633 for an example. */
+   Mesh *me = NULL;
+
if (useDeform) {
if (inputVertexCos)
deformedVerts = inputVertexCos;
@@ -1238,10 +1242,21 @@ static void mesh_calc_modifiers(
}
 
if (mti->type == eModifierTypeType_OnlyDeform && 
!sculpt_dyntopo) {
-   if (!deformedVerts)
+   if (!deformedVerts) {
deformedVerts = 
BKE_mesh_vertexCos_get(ob->data, &numVerts);
+   }
+
+   if (isPrevDeform && mti->dependsOnNormals && 
mti->dependsOnNormals(md)) {
+   if (me == NULL) {
+   me = 
BKE_mesh_copy_for_eval(ob->data, true);
+   ASSERT_IS_VALID_MESH(me);
+   }
+   BKE_mesh_apply_vert_coords(me, 
deformedVerts);
+   }
+
+   modwrap_deformVerts(md, &mectx_deform, me, 
deformedVerts, numVerts);
 
-   modwrap_deformVerts(md, &mectx_deform, NULL, 
deformedVerts, numVerts);
+   isPrevDeform = true;
}
else {
break;
@@ -1282,7 +1297,6 @@ static void mesh_calc_modifiers(
/* Now apply all remaining modifiers. If useDeform is off then skip
 * OnlyDeform ones.
 */
-   Mesh *me = NULL;
Mesh *me_orco = NULL;
Mesh *me_orco_cloth = NULL;
 
@@ -1715,6 +1729,7 @@ static void editbmesh_calc_modifiers(
const int required_mode = eModifierMode_Realtime | 
eModifierMode_Editmode;
const bool do_init_statvis = false;  /* FIXME: use 
V3D_OVERLAY_EDIT_STATVIS. */
VirtualModifierData virtualModifierData;
+   bool isPrevDeform = false;
 
/* TODO(sybren): do we really need multiple objects, or shall we change 
the flags where needed? */
const ModifierEvalContext mectx = {depsgraph, ob, 0};
@@ -1779,6 +1794,16 @@ static void editbmesh_calc_modifiers(
}
}
 
+   if (isPrevDeform && mti->dependsOnNormals && 
mti->dependsOnNormals(md)) {
+   if (me == NULL) {
+   me = 
BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL);
+   ASSERT_IS_VALID_MESH(me);
+   mesh_copy_autosmooth(me, ob->data);
+   }
+   BLI_assert(deformedVerts != NULL);
+   BKE_mesh_apply_vert_coords(me, deformedVerts);
+   }
+
if (mti->deformVertsEM)
modwrap_deformVertsEM(md, &mectx, em, me, 
deformedVerts, numVerts);
else
@@ -1895,6 +1920,8 @@ static void editbmesh_calc_modifiers(
mesh_copy_autosmooth(*r_cage, ob->data);
}
}
+
+   isPrevDeform = (mti->type == eModifierTypeType_OnlyDeform);
}
 
BLI_linklist_free((LinkNode *)datamasks, NULL);

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


[Bf-blender-cvs] [b7255d33dac] master: Silence sorted function declaration/const warnings

2019-03-18 Thread Dalai Felinto
Commit: b7255d33dacabf93e0ed79425a5b54ad835d7ff5
Author: Dalai Felinto
Date:   Mon Mar 18 14:40:29 2019 +
Branches: master
https://developer.blender.org/rBb7255d33dacabf93e0ed79425a5b54ad835d7ff5

Silence sorted function declaration/const warnings

===

M   source/blender/editors/include/ED_screen.h
M   source/blender/makesrna/intern/rna_internal.h

===

diff --git a/source/blender/editors/include/ED_screen.h 
b/source/blender/editors/include/ED_screen.h
index 363cea0c1c6..f44f951123a 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -196,7 +196,7 @@ voidED_screens_navigation_bar_tools_menu_create(struct 
bContext *C, struct u
 boolED_screen_stereo3d_required(const struct bScreen *screen, const struct 
Scene *scene);
 Scene   *ED_screen_scene_find(const struct bScreen *screen, const struct 
wmWindowManager *wm);
 Scene   *ED_screen_scene_find_with_window(const struct bScreen *screen, const 
struct wmWindowManager *wm, struct wmWindow **r_window);
-ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const 
struct SpaceLink *sl, bool only_visible);
+ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const 
struct SpaceLink *sl, const bool only_visible);
 struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const 
struct wmWindowManager *wm);
 voidED_screen_preview_render(const struct bScreen *screen, int size_x, int 
size_y, unsigned int *r_rect) ATTR_NONNULL();
 
diff --git a/source/blender/makesrna/intern/rna_internal.h 
b/source/blender/makesrna/intern/rna_internal.h
index 0b00b9b60b8..c5e677f3626 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -216,7 +216,7 @@ void rna_def_mtex_common(struct BlenderRNA *brna, struct 
StructRNA *srna, const
  const char *activeset, const char *activeeditable, 
const char *structname,
  const char *structname_slots, const char *update, 
const char *update_index);
 void rna_def_texpaint_slots(struct BlenderRNA *brna, struct StructRNA *srna);
-void rna_def_view_layer_common(struct StructRNA *srna, bool scene);
+void rna_def_view_layer_common(struct StructRNA *srna, const bool scene);
 
 void rna_def_actionbone_group_common(struct StructRNA *srna, int update_flag, 
const char *update_cb);
 void rna_ActionGroup_colorset_set(struct PointerRNA *ptr, int value);

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


[Bf-blender-cvs] [94f55d14c34] master: Fix (unreported) broken Py API doc after adding gpencil to buttons_context...

2019-03-18 Thread Bastien Montagne
Commit: 94f55d14c34bb398c9137e40d7d2e966c9fd64e7
Author: Bastien Montagne
Date:   Mon Mar 18 14:42:07 2019 +0100
Branches: master
https://developer.blender.org/rB94f55d14c34bb398c9137e40d7d2e966c9fd64e7

Fix (unreported) broken Py API doc after adding gpencil to buttons_context...

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index b78c366498f..0d34392ff32 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1009,7 +1009,8 @@ context_type_map = {
 "editable_gpencil_strokes": ("GPencilStroke", True),
 "editable_objects": ("Object", True),
 "fluid": ("FluidSimulationModifier", False),
-"gpencil_data": ("GreasePencel", False),
+"gpencil": ("GreasePencil", False),
+"gpencil_data": ("GreasePencil", False),
 "gpencil_data_owner": ("ID", False),
 "image_paint_object": ("Object", False),
 "lattice": ("Lattice", False),

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


[Bf-blender-cvs] [29039e5c745] master: Cleanup: remove compare_len_squared utility

2019-03-18 Thread Campbell Barton
Commit: 29039e5c7457c2061787d3f22dce27afcae25c71
Author: Campbell Barton
Date:   Tue Mar 19 00:35:24 2019 +1100
Branches: master
https://developer.blender.org/rB29039e5c7457c2061787d3f22dce27afcae25c71

Cleanup: remove compare_len_squared utility

There isn't any advantage to this over comparing the squared length.

===

M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/intern/BLI_kdtree.c
M   source/blender/blenlib/intern/math_vector_inline.c
M   source/blender/editors/sculpt_paint/paint_image_2d.c

===

diff --git a/source/blender/blenlib/BLI_math_vector.h 
b/source/blender/blenlib/BLI_math_vector.h
index f3908cf7462..c9285466259 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -204,6 +204,7 @@ MINLINE float len_v2v2(const float a[2], const float b[2]) 
ATTR_WARN_UNUSED_RESU
 MINLINE float len_v2v2_int(const int v1[2], const int v2[2]);
 MINLINE float len_squared_v2v2(const float a[2], const float b[2]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE float len_squared_v3v3(const float a[3], const float b[3]) 
ATTR_WARN_UNUSED_RESULT;
+MINLINE float len_squared_v4v4(const float a[4], const float b[4]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE int   len_manhattan_v2v2_int(const int a[2], const int b[2]) 
ATTR_WARN_UNUSED_RESULT;
 MINLINE float len_manhattan_v3v3(const float a[3], const float b[3]) 
ATTR_WARN_UNUSED_RESULT;
@@ -288,8 +289,6 @@ MINLINE bool compare_v3v3_relative(const float a[3], const 
float b[3], const flo
 MINLINE bool compare_v4v4_relative(const float a[4], const float b[4], const 
float limit, const int max_ulps)  ATTR_WARN_UNUSED_RESULT;
 
 MINLINE bool compare_len_v3v3(const float a[3], const float b[3], const float 
limit)  ATTR_WARN_UNUSED_RESULT;
-MINLINE bool compare_len_squared_v3v3(const float a[3], const float b[3], 
const float limit)  ATTR_WARN_UNUSED_RESULT;
-MINLINE bool compare_len_squared_v4v4(const float a[4], const float b[4], 
const float limit)  ATTR_WARN_UNUSED_RESULT;
 
 MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const 
float pt[2]) ATTR_WARN_UNUSED_RESULT;
 
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c 
b/source/blender/blenlib/intern/BLI_kdtree.c
index e9b8d173eb1..29e6446528a 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -782,7 +782,7 @@ static void deduplicate_recursive(const struct 
DeDuplicateParams *p, uint i)
}
else {
if ((p->search != node->index) && (p->duplicates[node->index] 
== -1)) {
-   if (compare_len_squared_v3v3(node->co, p->search_co, 
p->range_sq)) {
+   if (len_squared_v3v3(node->co, p->search_co) <= 
p->range_sq) {
p->duplicates[node->index] = (int)p->search;
*p->duplicates_found += 1;
}
diff --git a/source/blender/blenlib/intern/math_vector_inline.c 
b/source/blender/blenlib/intern/math_vector_inline.c
index 80bdeec5949..f22b2a7a457 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -952,6 +952,14 @@ MINLINE float len_squared_v3v3(const float a[3], const 
float b[3])
return dot_v3v3(d, d);
 }
 
+MINLINE float len_squared_v4v4(const float a[4], const float b[4])
+{
+   float d[4];
+
+   sub_v4_v4v4(d, b, a);
+   return dot_v4v4(d, d);
+}
+
 MINLINE float len_manhattan_v2v2(const float a[2], const float b[2])
 {
float d[2];
@@ -1197,20 +1205,6 @@ MINLINE bool compare_len_v3v3(const float v1[3], const 
float v2[3], const float
return (dot_v3v3(d, d) <= (limit * limit));
 }
 
-MINLINE bool compare_len_squared_v3v3(const float v1[3], const float v2[3], 
const float limit_sq)
-{
-   float d[3];
-   sub_v3_v3v3(d, v1, v2);
-   return (dot_v3v3(d, d) <= limit_sq);
-}
-
-MINLINE bool compare_len_squared_v4v4(const float v1[4], const float v2[4], 
const float limit_sq)
-{
-   float d[4];
-   sub_v4_v4v4(d, v1, v2);
-   return (dot_v4v4(d, d) <= limit_sq);
-}
-
 /**
  * 
  *+ l1
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c 
b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 990017d3a20..cad75efbf56 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1415,7 +1415,7 @@ static void paint_2d_fill_add_pixel_byte(
rgba_uchar_to_float(color_f, color_b);
straight_to_premul_v4(color_f);
 
-   if (compare_len_squared_v4v4(color_f, color, threshold_sq)) {
+   if (len_squared_v4v4(color_f, color) <= threshold_sq) {

[Bf-blender-cvs] [606f3c74d36] master: Fix T62643: ID user decrement error, likely related to custom material PointerProperty.

2019-03-18 Thread Bastien Montagne
Commit: 606f3c74d36bbbe6b7e3aeae962176a89355a552
Author: Bastien Montagne
Date:   Mon Mar 18 13:55:26 2019 +0100
Branches: master
https://developer.blender.org/rB606f3c74d36bbbe6b7e3aeae962176a89355a552

Fix T62643: ID user decrement error, likely related to custom material 
PointerProperty.

We are in a totally out-of-main context here, so no refcounting of any ID...

Note that this whole 'render preview' area could use some refactor with
modern ID management API, but that would go way beyond a mere bugfix,
and it is not the time to do such things.

===

M   source/blender/editors/render/render_preview.c

===

diff --git a/source/blender/editors/render/render_preview.c 
b/source/blender/editors/render/render_preview.c
index 9599a7bdbee..0b0acbffec9 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -61,6 +61,7 @@
 #include "BKE_idprop.h"
 #include "BKE_image.h"
 #include "BKE_icons.h"
+#include "BKE_library.h"
 #include "BKE_light.h"
 #include "BKE_layer.h"
 #include "BKE_main.h"
@@ -923,7 +924,7 @@ static void shader_preview_free(void *customdata)
/* get rid of copied ID */
properties = IDP_GetProperties(sp->id_copy, false);
if (properties) {
-   IDP_FreeProperty(properties);
+   IDP_FreeProperty_ex(properties, false);
MEM_freeN(properties);
}
switch (GS(sp->id_copy->name)) {

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


[Bf-blender-cvs] [2b79f274e38] master: Fix T61226: Make hair editing (more?) thread safe

2019-03-18 Thread Jacques Lucke
Commit: 2b79f274e38b10bd28bae34e98990ae95a0eafc0
Author: Jacques Lucke
Date:   Mon Mar 18 13:31:54 2019 +0100
Branches: master
https://developer.blender.org/rB2b79f274e38b10bd28bae34e98990ae95a0eafc0

Fix T61226: Make hair editing (more?) thread safe

This replaces the global `PEData->dist` with a thread local variable
that is passed into the callback functions separately.

There are two new function types which have `Hit` in the name.
Those take the distance to the mouse as an additional parameter.

Reviewers: sergey

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

===

M   source/blender/editors/physics/particle_edit.c

===

diff --git a/source/blender/editors/physics/particle_edit.c 
b/source/blender/editors/physics/particle_edit.c
index 97f191a217a..78b677677bc 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -405,7 +405,6 @@ typedef struct PEData {
const int *mval;
const rcti *rect;
float rad;
-   float dist;
float dval;
int select;
eSelectOp sel_op;
@@ -601,9 +600,35 @@ static bool point_is_selected(PTCacheEditPoint *point)
 
 /*** iterators ***/
 
-typedef void (*ForPointFunc)(PEData *data, int point_index);
-typedef void (*ForKeyFunc)(PEData *data, int point_index, int key_index, bool 
is_inside);
-typedef void (*ForKeyMatFunc)(PEData *data, float mat[4][4], float imat[4][4], 
int point_index, int key_index, PTCacheEditKey *key);
+typedef void (*ForPointFunc)(
+PEData *data,
+int point_index);
+typedef void (*ForHitPointFunc)(
+PEData *data,
+int point_index,
+float mouse_distance);
+
+typedef void (*ForKeyFunc)(
+PEData *data,
+int point_index,
+int key_index,
+bool is_inside);
+
+typedef void (*ForKeyMatFunc)(
+PEData *data,
+float mat[4][4],
+float imat[4][4],
+int point_index,
+int key_index,
+PTCacheEditKey *key);
+typedef void (*ForHitKeyMatFunc)(
+PEData *data,
+float mat[4][4],
+float imat[4][4],
+int point_index,
+int key_index,
+PTCacheEditKey *key,
+float mouse_distance);
 
 enum eParticleSelectFlag {
PSEL_NEAREST = (1 << 0),
@@ -672,7 +697,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc 
func, const enum ePartic
}
 }
 
-static void foreach_mouse_hit_point(PEData *data, ForPointFunc func, int 
selected)
+static void foreach_mouse_hit_point(PEData *data, ForHitPointFunc func, int 
selected)
 {
ParticleEditSettings *pset = PE_settings(data->scene);
PTCacheEdit *edit = data->edit;
@@ -688,17 +713,21 @@ static void foreach_mouse_hit_point(PEData *data, 
ForPointFunc func, int selecte
/* only do end keys */
key = point->keys + point->totkey - 1;
 
-   if (selected == 0 || key->flag & PEK_SELECT)
-   if (key_inside_circle(data, data->rad, 
KEY_WCO, &data->dist))
-   func(data, p);
+   if (selected == 0 || key->flag & PEK_SELECT) {
+   float mouse_distance;
+   if (key_inside_circle(data, data->rad, 
KEY_WCO, &mouse_distance)) {
+   func(data, p, mouse_distance);
+   }
+   }
}
}
else {
/* do all keys */
LOOP_VISIBLE_KEYS {
if (selected == 0 || key->flag & PEK_SELECT) {
-   if (key_inside_circle(data, data->rad, 
KEY_WCO, &data->dist)) {
-   func(data, p);
+   float mouse_distance;
+   if (key_inside_circle(data, data->rad, 
KEY_WCO, &mouse_distance)) {
+   func(data, p, mouse_distance);
break;
}
}
@@ -711,7 +740,7 @@ typedef struct KeyIterData {
PEData *data;
PTCacheEdit *edit;
int selected;
-   ForKeyMatFunc func;
+   ForHitKeyMatFunc func;
 } KeyIterData;
 
 static void foreach_mouse_hit_key_iter(
@@ -739,12 +768,13 @@ static void foreach_mouse_hit_key_iter(
PTCacheEditKey *key = point->keys + point->totkey - 1;
 
if (selected == 0 || key->flag & PEK_SELECT) {
-   if (key_inside_circle(data, data->rad, KEY_WCO, 
&data->dist)) {
+  

[Bf-blender-cvs] [4d2672ca7fd] master: Cleanup: C++ style of structure definition

2019-03-18 Thread Sergey Sharybin
Commit: 4d2672ca7fd1dc11a50c29f271032f43af164f22
Author: Sergey Sharybin
Date:   Mon Mar 18 12:47:18 2019 +0100
Branches: master
https://developer.blender.org/rB4d2672ca7fd1dc11a50c29f271032f43af164f22

Cleanup: C++ style of structure definition

===

M   source/blender/depsgraph/intern/eval/deg_eval.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc 
b/source/blender/depsgraph/intern/eval/deg_eval.cc
index d3e52ecdf09..eaafcffac97 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -93,9 +93,9 @@ static void deg_task_run_func(TaskPool *pool,
BLI_task_pool_delayed_push_end(pool, thread_id);
 }
 
-typedef struct CalculatePendingData {
+struct CalculatePendingData {
Depsgraph *graph;
-} CalculatePendingData;
+};
 
 static bool check_operation_node_visible(OperationNode *op_node)
 {
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index cf36892d9e6..c545099c97b 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -838,11 +838,11 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph 
*depsgraph,
  create_placeholders);
 }
 
-typedef struct ObjectRuntimeBackup {
+struct ObjectRuntimeBackup {
Object_Runtime runtime;
short base_flag;
unsigned short base_local_view_bits;
-} ObjectRuntimeBackup;
+};
 
 /* Make a backup of object's evaluation runtime data, additionally
  * make object to be safe for free without invalidating backed up

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


[Bf-blender-cvs] [4070bb242df] master: Merge branch 'blender2.7'

2019-03-18 Thread Sergey Sharybin
Commit: 4070bb242df92f753ed59f94799420e077e7270c
Author: Sergey Sharybin
Date:   Mon Mar 18 12:03:22 2019 +0100
Branches: master
https://developer.blender.org/rB4070bb242df92f753ed59f94799420e077e7270c

Merge branch 'blender2.7'

===



===



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


[Bf-blender-cvs] [7c5be750a3c] blender2.7: Cycles: Cleanup strict compiler warnings

2019-03-18 Thread Sergey Sharybin
Commit: 7c5be750a3c825e63194f79a26ab82dd805611d0
Author: Sergey Sharybin
Date:   Mon Mar 18 12:02:41 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB7c5be750a3c825e63194f79a26ab82dd805611d0

Cycles: Cleanup strict compiler warnings

===

M   intern/cycles/device/device_multi.cpp
M   intern/cycles/render/light.cpp

===

diff --git a/intern/cycles/device/device_multi.cpp 
b/intern/cycles/device/device_multi.cpp
index 516b86654aa..3bab419ed05 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -145,6 +145,7 @@ public:
return subresult;
 
case DEVICE_KERNEL_USING_FEATURE_KERNEL:
+   case DEVICE_KERNEL_UNKNOWN:
break;
}
}
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 8073c622040..7101d2ab60c 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -191,7 +191,7 @@ bool LightManager::has_background_light(Scene *scene)
return false;
 }
 
-void LightManager::disable_ineffective_light(Device *device, Scene *scene)
+void LightManager::disable_ineffective_light(Device * /*device*/, Scene *scene)
 {
/* Make all lights enabled by default, and perform some preliminary 
checks
 * needed for finer-tuning of settings (for example, check whether we've

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


[Bf-blender-cvs] [6d99b2c0218] master: Cleanup: we now have a way to tag 'from' ID pointers in libquery code.

2019-03-18 Thread Bastien Montagne
Commit: 6d99b2c021847c1015a3945530d4d32049e0d659
Author: Bastien Montagne
Date:   Mon Mar 18 11:47:54 2019 +0100
Branches: master
https://developer.blender.org/rB6d99b2c021847c1015a3945530d4d32049e0d659

Cleanup: we now have a way to tag 'from' ID pointers in libquery code.

So no need to have custom verbose own detection cases for those guys...

===

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

===

diff --git a/source/blender/blenkernel/intern/library_query.c 
b/source/blender/blenkernel/intern/library_query.c
index 9861b232dd9..453cbe16de0 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -1331,20 +1331,14 @@ void BKE_library_ID_test_usages(Main *bmain, void *idv, 
bool *is_used_local, boo
 
 /* * IDs usages.checking/tagging. * */
 static int foreach_libblock_used_linked_data_tag_clear_cb(
-void *user_data, ID *self_id, ID **id_p, int UNUSED(cb_flag))
+void *user_data, ID *self_id, ID **id_p, int cb_flag)
 {
bool *is_changed = user_data;
 
if (*id_p) {
-   /* XXX This is actually some kind of hack...
-* Issue is, shapekeys' 'from' ID pointer is not actually ID 
usage.
-* Maybe we should even nuke it from 
BKE_library_foreach_ID_link, not 100% sure yet...
-*/
-   if ((GS(self_id->name) == ID_KE) && (((Key *)self_id)->from == 
*id_p)) {
-   return IDWALK_RET_NOP;
-   }
-   /* XXX another hack, for similar reasons as above one. */
-   if ((GS(self_id->name) == ID_OB) && (((Object 
*)self_id)->proxy_from == (Object *)*id_p)) {
+   /* The infamous 'from' pointers (Key.from, Object.proxy_from, 
...).
+* those are not actually ID usage, so we ignore them here. */
+   if (cb_flag & IDWALK_CB_LOOPBACK) {
return IDWALK_RET_NOP;
}

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


[Bf-blender-cvs] [07355ff74ba] master: Fix mistake in previous commit.

2019-03-18 Thread Bastien Montagne
Commit: 07355ff74baf08f4470748ff189e4367493d8758
Author: Bastien Montagne
Date:   Mon Mar 18 11:40:03 2019 +0100
Branches: master
https://developer.blender.org/rB07355ff74baf08f4470748ff189e4367493d8758

Fix mistake in previous commit.

===

M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenloader/intern/blend_validate.c

===

diff --git a/source/blender/blenkernel/BKE_main.h 
b/source/blender/blenkernel/BKE_main.h
index 6b9c35d90d3..12aec58d2a5 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -169,7 +169,7 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, 
struct GSet *gset);
{ \
ListBase *_lb;  
  \
FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb) {  
  \
-   FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id)
+   FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id)
 
 #define FOREACH_MAIN_ID_END   \
FOREACH_MAIN_LISTBASE_ID_END;   
  \
diff --git a/source/blender/blenloader/intern/blend_validate.c 
b/source/blender/blenloader/intern/blend_validate.c
index f36438417ba..cc0ce61ec15 100644
--- a/source/blender/blenloader/intern/blend_validate.c
+++ b/source/blender/blenloader/intern/blend_validate.c
@@ -149,29 +149,34 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList 
*reports)
 /** Check (and fix if needed) that shape key's 'from' pointer is valid. */
 bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports)
 {
+   ListBase *lb;
ID *id;
bool is_valid = true;
 
BKE_main_lock(bmain);
 
-   FOREACH_MAIN_ID_BEGIN(bmain, id)
+   FOREACH_MAIN_LISTBASE_BEGIN(bmain, lb)
{
-   if (!BKE_key_idtype_support(GS(id->name))) {
-   break;
-   }
-   if (id->lib == NULL) {
-   /* We assume lib data is valid... */
-   Key *shapekey = BKE_key_from_id(id);
-   if (shapekey != NULL && shapekey->from != id) {
-   is_valid = false;
-   BKE_reportf(reports, RPT_ERROR,
-   "ID %s uses shapekey %s, but its 
'from' pointer is invalid (%p), fixing...",
-   id->name, shapekey->id.name, 
shapekey->from);
-   shapekey->from = id;
+   FOREACH_MAIN_LISTBASE_ID_BEGIN(lb, id)
+   {
+   if (!BKE_key_idtype_support(GS(id->name))) {
+   break;
+   }
+   if (id->lib == NULL) {
+   /* We assume lib data is valid... */
+   Key *shapekey = BKE_key_from_id(id);
+   if (shapekey != NULL && shapekey->from != id) {
+   is_valid = false;
+   BKE_reportf(reports, RPT_ERROR,
+   "ID %s uses shapekey %s, 
but its 'from' pointer is invalid (%p), fixing...",
+   id->name, 
shapekey->id.name, shapekey->from);
+   shapekey->from = id;
+   }
}
}
+   FOREACH_MAIN_LISTBASE_ID_END;
}
-   FOREACH_MAIN_ID_END;
+   FOREACH_MAIN_LISTBASE_END;
 
BKE_main_unlock(bmain);

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


[Bf-blender-cvs] [1b06e3378a7] master: Fix T62670: insert_link() method not working for ShaderNodeCustomGroup.

2019-03-18 Thread Miguel Porces
Commit: 1b06e3378a750774cd7da76ab61f86476f7087cc
Author: Miguel Porces
Date:   Mon Mar 18 11:16:34 2019 +0100
Branches: master
https://developer.blender.org/rB1b06e3378a750774cd7da76ab61f86476f7087cc

Fix T62670: insert_link() method not working for ShaderNodeCustomGroup.

Allow Python to override this method.

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

===

M   source/blender/nodes/composite/nodes/node_composite_common.c
M   source/blender/nodes/shader/nodes/node_shader_common.c

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c 
b/source/blender/nodes/composite/nodes/node_composite_common.c
index f9a6961c47b..480b9f1e989 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -59,6 +59,14 @@ void register_node_type_cmp_group(void)
 
 void register_node_type_cmp_custom_group(bNodeType *ntype)
 {
-   ntype->insert_link = node_insert_link_default;
-   ntype->update_internal_links = node_update_internal_links_default;
+   /* These methods can be overriden but need a default implementation 
otherwise. */
+   if (ntype->poll == NULL) {
+   ntype->poll = cmp_node_poll_default;
+   }
+   if (ntype->insert_link == NULL) {
+   ntype->insert_link = node_insert_link_default;
+   }
+   if (ntype->update_internal_links == NULL) {
+   ntype->update_internal_links = 
node_update_internal_links_default;
+   }
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c 
b/source/blender/nodes/shader/nodes/node_shader_common.c
index 0c2b8d939f5..8596c770c62 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -242,8 +242,17 @@ void register_node_type_sh_group(void)
 
 void register_node_type_sh_custom_group(bNodeType *ntype)
 {
-   ntype->insert_link = node_insert_link_default;
-   ntype->update_internal_links = node_update_internal_links_default;
+   /* These methods can be overriden but need a default implementation 
otherwise. */
+   if (ntype->poll == NULL) {
+   ntype->poll = sh_node_poll_default;
+   }
+   if (ntype->insert_link == NULL) {
+   ntype->insert_link = node_insert_link_default;
+   }
+   if (ntype->update_internal_links == NULL) {
+   ntype->update_internal_links = 
node_update_internal_links_default;
+   }
+
node_type_exec(ntype, group_initexec, group_freeexec, group_execute);
node_type_gpu(ntype, gpu_group_execute);
 }

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


[Bf-blender-cvs] [d0e28721b04] master: Cleanup: Main id looping: add FOREACH_MAIN_LISTBASE macro.

2019-03-18 Thread Bastien Montagne
Commit: d0e28721b04a0235d4f6bfbe42f43672ff923444
Author: Bastien Montagne
Date:   Mon Mar 18 11:32:06 2019 +0100
Branches: master
https://developer.blender.org/rBd0e28721b04a0235d4f6bfbe42f43672ff923444

Cleanup: Main id looping: add FOREACH_MAIN_LISTBASE macro.

We don't want to use flow control like `break` statement into the basic
`FOREACH_MAIN_ID` macro, as this is a nested loop.

When refined behavior is needed (like breaking whole iteration, or just
skipping to next ID type), FOREACH_MAIN_LISTBASE and
FOREACH_MAIN_LISTBASE_ID macros should be used instead.

Based on D4382 by @campbellbarton
(Other potential solution, using flow control macros: D4384).

===

M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenkernel/intern/blendfile.c
M   source/blender/blenkernel/intern/library_query.c
M   source/blender/python/intern/bpy_rna_id_collection.c

===

diff --git a/source/blender/blenkernel/BKE_main.h 
b/source/blender/blenkernel/BKE_main.h
index 03f9f9a21ea..6b9c35d90d3 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -152,31 +152,29 @@ struct GSet *BKE_main_gset_create(struct Main *bmain, 
struct GSet *gset);
}   
  \
} ((void)0)
 
-
-#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)\
+#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)  \
{ \
ListBase *_lbarray[MAX_LIBARRAY];   
  \
int _i = set_listbasepointers(_bmain, _lbarray);
  \
while (_i--) {  
  \
-   FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id)
+   _lb = _lbarray[_i];
 
-#define FOREACH_MAIN_ID_END   \
-   FOREACH_MAIN_LISTBASE_ID_END;   
  \
+#define FOREACH_MAIN_LISTBASE_END \
}   
  \
} ((void)0)
 
-/** \param _do_break A boolean, to allow breaking iteration (only used to 
break by type,
- *   you must also use an explicit `break;` operation if you 
want to
- *   immediately break from inner by-ID loop).
- */
-#define FOREACH_MAIN_ID_BREAKABLE_BEGIN(_bmain, _id, _do_break)   \
+/* DO NOT use break statement with that macro, use FOREACH_MAIN_LISTBASE and 
FOREACH_MAIN_LISTBASE_ID instead
+ * if you need that kind of control flow. */
+#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)\
{ \
-   ListBase *_lbarray[MAX_LIBARRAY];   
  \
-   int i = set_listbasepointers(_bmain, _lbarray); 
  \
-   while (i-- && !_do_break) { 
  \
-   FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[i], _id)
  \
+   ListBase *_lb;  
  \
+   FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb) {  
  \
+   FOREACH_MAIN_LISTBASE_ID_BEGIN(_lbarray[_i], _id)
 
-#define FOREACH_MAIN_ID_BREAKABLE_END FOREACH_MAIN_ID_END
+#define FOREACH_MAIN_ID_END   \
+   FOREACH_MAIN_LISTBASE_ID_END;   
  \
+   } FOREACH_MAIN_LISTBASE_END;
  \
+   } ((void)0)
 
 
 struct BlendThumbnail *BKE_main_thumbnail_from_imbuf(struct Main *bmain, 
struct ImBuf *img);
diff --git a/source/blender/blenkernel/intern/blendfile.c 
b/source/blender/blenkernel/intern/blendfile.c
index 455f73c65c0..cd17911d65d 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -460,16 +460,21 @@ bool BKE_blendfile_read_from_memfile(
 void BKE_blendfile_read_make_empty(bContext *C)
 {
Main *bmain = CTX_data_main(C);
+   ListBase *lb;
ID *id;
 
-   FOREACH_MAIN_ID_BEGIN(bmain, id)
+   FOREACH_MAIN_LISTBASE_BEGIN(bmain, lb)
{
-   if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
-   break;  /* Only breaks iter on that ID type, and 
continues with IDs of next type. */
+   FOREACH_MAIN_LISTBASE_ID_BEGIN(lb, id)
+   {
+   if (ELEM(GS(id->name), ID_SCE, ID_SCR, ID_WM, ID_WS)) {
+   break;
+   }
+   

[Bf-blender-cvs] [76277e74023] master: Cleanup: fix compiler warning.

2019-03-18 Thread Brecht Van Lommel
Commit: 76277e74023c0ab6926681c7bca4774fe2d130cb
Author: Brecht Van Lommel
Date:   Mon Mar 18 10:42:40 2019 +0100
Branches: master
https://developer.blender.org/rB76277e74023c0ab6926681c7bca4774fe2d130cb

Cleanup: fix compiler warning.

===

M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/blender/blender_sync.cpp
M   intern/cycles/blender/blender_sync.h

===

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index f1cdda5cb13..a06135b5362 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -470,7 +470,7 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
b_rlay_name = b_view_layer.name();
 
/* add passes */
-   vector passes = sync->sync_render_passes(b_rlay, b_view_layer, 
session_params);
+   vector passes = sync->sync_render_passes(b_rlay, b_view_layer);
buffer_params.passes = passes;
 
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index 4074d7c99e2..de41258ca51 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -504,8 +504,7 @@ int BlenderSync::get_denoising_pass(BL::RenderPass& b_pass)
 }
 
 vector BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
- BL::ViewLayer& b_view_layer,
- const SessionParams 
&session_params)
+ BL::ViewLayer& b_view_layer)
 {
vector passes;
Pass::add(PASS_COMBINED, passes);
diff --git a/intern/cycles/blender/blender_sync.h 
b/intern/cycles/blender/blender_sync.h
index bf16de4a9c9..8af3fde3323 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -68,8 +68,7 @@ public:
   void **python_thread_state);
void sync_view_layer(BL::SpaceView3D& b_v3d, BL::ViewLayer& 
b_view_layer);
vector sync_render_passes(BL::RenderLayer& b_render_layer,
-   BL::ViewLayer& b_view_layer,
-   const SessionParams &session_params);
+   BL::ViewLayer& b_view_layer);
void sync_integrator();
void sync_camera(BL::RenderSettings& b_render,
 BL::Object& b_override,

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


[Bf-blender-cvs] [66932a2c814] master: Add-ons: disable 3ds add-on in all existing preferences.

2019-03-18 Thread Brecht Van Lommel
Commit: 66932a2c814037f897af56693efb68b6993406fb
Author: Brecht Van Lommel
Date:   Mon Mar 18 11:00:15 2019 +0100
Branches: master
https://developer.blender.org/rB66932a2c814037f897af56693efb68b6993406fb

Add-ons: disable 3ds add-on in all existing preferences.

Silences warning when running with --debug. If/when this add-on is ported,
users that need it can enable it again.

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/blenloader/intern/versioning_userdef.c

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 031e4deb1a8..cad733f774d 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -24,7 +24,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION  49
+#define BLENDER_SUBVERSION  50
 /* Several breakages with 280, e.g. collections vs layers */
 #define BLENDER_MINVERSION  280
 #define BLENDER_MINSUBVERSION   0
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 59697427d5d..973057fa362 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -80,11 +80,6 @@ void BLO_update_defaults_userpref_blend(void)
MEM_freeN(addon->prop);
addon->prop = NULL;
}
-
-   if (STREQ(addon->module, "io_scene_3ds")) {
-   BLI_remlink(&U.addons, addon);
-   MEM_freeN(addon);
-   }
}
 
/* Transform tweak with single click and drag. */
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index e7b5c0e0bba..14d10bbf85e 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -476,6 +476,11 @@ void BLO_version_defaults_userpref_blend(Main *bmain, 
UserDef *userdef)
GP_PAINT_UNUSED_0);
}
 
+   if (!USER_VERSION_ATLEAST(280, 50)) {
+   /* 3ds is no longer enabled by default and not ported yet. */
+   BKE_addon_remove_safe(&userdef->addons, "io_scene_3ds");
+   }
+
/**
 * Include next version bump.
 */

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


[Bf-blender-cvs] [8ecc4d4f160] master: Fix noisy console messages about unported add-ons by default.

2019-03-18 Thread Bastien Montagne
Commit: 8ecc4d4f160440bb287c06b457bfc147feaa6ee6
Author: Bastien Montagne
Date:   Mon Mar 18 10:36:50 2019 +0100
Branches: master
https://developer.blender.org/rB8ecc4d4f160440bb287c06b457bfc147feaa6ee6

Fix noisy console messages about unported add-ons by default.

* Make those single-line warning, there is really no reason to raise
exception (i.e. error) for that.
* Only show them when `--debug` option is set.

===

M   release/scripts/modules/addon_utils.py

===

diff --git a/release/scripts/modules/addon_utils.py 
b/release/scripts/modules/addon_utils.py
index f2e799f1760..6ee8e9aa227 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -365,11 +365,9 @@ def enable(module_name, *, default_set=False, 
persistent=False, handle_error=Non
 # 1.1) fail when add-on is too old
 # This is a temporary 2.8x migration check, so we can manage addons 
that are supported.
 
-try:
-if mod.bl_info.get("blender", (0, 0, 0)) < (2, 80, 0):
-raise Exception(f"Add-on '{module_name:s}' has not been 
upgraded to 2.8, ignoring")
-except Exception as ex:
-handle_error(ex)
+if mod.bl_info.get("blender", (0, 0, 0)) < (2, 80, 0):
+if _bpy.app.debug:
+print(f"Warning: Add-on '{module_name:s}' has not been 
upgraded to 2.8, ignoring")
 return None
 
 # 2) try register collected modules

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


[Bf-blender-cvs] [3a8099c45c4] master: Cleanup: unused vars in last commit

2019-03-18 Thread Campbell Barton
Commit: 3a8099c45c49bd125d3ff34b6b937aab367a9731
Author: Campbell Barton
Date:   Mon Mar 18 20:30:05 2019 +1100
Branches: master
https://developer.blender.org/rB3a8099c45c49bd125d3ff34b6b937aab367a9731

Cleanup: unused vars in last commit

===

M   source/blender/editors/sculpt_paint/paint_utils.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_utils.c 
b/source/blender/editors/sculpt_paint/paint_utils.c
index b1088e3a957..2f7cd3fceba 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -463,7 +463,6 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, 
int y, bool texpaint_pr
CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
cddata_masks.pmask |= CD_MASK_ORIGINDEX;
Mesh *me = (Mesh *)ob->data;
-   CustomData_MeshMasks mask, nextmask, previewmask = {0}, 
append_mask = CD_MASK_BAREMESH_ORIGINDEX;
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, 
ob_eval, &cddata_masks);
 
ViewContext vc;

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


[Bf-blender-cvs] [794aef3f259] master: Fix T58763: Sample color fails with mirror modifier

2019-03-18 Thread Campbell Barton
Commit: 794aef3f259ef0833e45d9cfd40ba6fe2b08b376
Author: Campbell Barton
Date:   Mon Mar 18 20:01:59 2019 +1100
Branches: master
https://developer.blender.org/rB794aef3f259ef0833e45d9cfd40ba6fe2b08b376

Fix T58763: Sample color fails with mirror modifier

===

M   source/blender/editors/sculpt_paint/paint_utils.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_utils.c 
b/source/blender/editors/sculpt_paint/paint_utils.c
index 7de8e6bb07f..b1088e3a957 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -460,8 +460,11 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, 
int y, bool texpaint_pr
bool use_material = (imapaint->mode == 
IMAGEPAINT_MODE_MATERIAL);
 
if (ob) {
+   CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+   cddata_masks.pmask |= CD_MASK_ORIGINDEX;
Mesh *me = (Mesh *)ob->data;
-   Mesh *me_eval = ob_eval->runtime.mesh_eval;
+   CustomData_MeshMasks mask, nextmask, previewmask = {0}, 
append_mask = CD_MASK_BAREMESH_ORIGINDEX;
+   Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, 
ob_eval, &cddata_masks);
 
ViewContext vc;
const int mval[2] = {x, y};

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


[Bf-blender-cvs] [1d1e06b376e] master: Cleanup: rename color band to color ramp

2019-03-18 Thread Campbell Barton
Commit: 1d1e06b376eef66923b5e3a6e134a0bbbeb6c754
Author: Campbell Barton
Date:   Mon Mar 18 18:20:44 2019 +1100
Branches: master
https://developer.blender.org/rB1d1e06b376eef66923b5e3a6e134a0bbbeb6c754

Cleanup: rename color band to color ramp

===

M   release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/interface/interface_eyedropper.c
M   source/blender/editors/interface/interface_eyedropper_colorband.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_ops.c
M   source/blender/editors/interface/interface_templates.c

===

diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py 
b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
index 05404ef203c..e64c78f7661 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
@@ -203,5 +203,5 @@ _km_hierarchy = [
 ('Standard Modal Map', 'EMPTY', 'WINDOW', []),
 ('Transform Modal Map', 'EMPTY', 'WINDOW', []),
 ('Eyedropper Modal Map', 'EMPTY', 'WINDOW', []),
-('Eyedropper ColorBand PointSampling Map', 'EMPTY', 'WINDOW', []),
+('Eyedropper ColorRamp PointSampling Map', 'EMPTY', 'WINDOW', []),
 ]
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index f9455639b86..136637f95f8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -599,8 +599,8 @@ def km_user_interface(_params):
 # Eyedroppers all have the same event, and pass it through until
 # a suitable eyedropper handles it.
 ("ui.eyedropper_color", {"type": 'E', "value": 'PRESS'}, None),
-("ui.eyedropper_colorband", {"type": 'E', "value": 'PRESS'}, None),
-("ui.eyedropper_colorband_point", {"type": 'E', "value": 'PRESS', 
"alt": True}, None),
+("ui.eyedropper_colorramp", {"type": 'E', "value": 'PRESS'}, None),
+("ui.eyedropper_colorramp_point", {"type": 'E', "value": 'PRESS', 
"alt": True}, None),
 ("ui.eyedropper_id", {"type": 'E', "value": 'PRESS'}, None),
 ("ui.eyedropper_depth", {"type": 'E', "value": 'PRESS'}, None),
 # Copy data path
@@ -4249,10 +4249,10 @@ def km_eyedropper_modal_map(_params):
 return keymap
 
 
-def km_eyedropper_colorband_pointsampling_map(_params):
+def km_eyedropper_colorramp_pointsampling_map(_params):
 items = []
 keymap = (
-"Eyedropper ColorBand PointSampling Map",
+"Eyedropper ColorRamp PointSampling Map",
 {"space_type": 'EMPTY', "region_type": 'WINDOW', "modal": True},
 {"items": items},
 )
@@ -6059,7 +6059,7 @@ def generate_keymaps(params=None):
 
 # Modal maps.
 km_eyedropper_modal_map(params),
-km_eyedropper_colorband_pointsampling_map(params),
+km_eyedropper_colorramp_pointsampling_map(params),
 km_transform_modal_map(params),
 km_view3d_navigate(params),
 km_view3d_navigate_tweak_modal_map(params),
diff --git a/source/blender/editors/interface/interface_eyedropper.c 
b/source/blender/editors/interface/interface_eyedropper.c
index 112fde4a15c..f47e0bc4b54 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -64,7 +64,7 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
keymap = WM_modalkeymap_add(keyconf, "Eyedropper Modal Map", 
modal_items);
 
/* assign to operators */
-   WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_colorband");
+   WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_colorramp");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_color");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_id");
WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_depth");
@@ -83,14 +83,14 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig 
*keyconf)
{0, NULL, 0, NULL, NULL},
};
 
-   wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper ColorBand 
PointSampling Map");
+   wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper ColorRamp 
PointSampling Map");
if (keymap && keymap->modal_items)
return keymap;
 
-   keymap = WM_modalkeymap_add(keyconf, "Eyedropper ColorBand 
PointSampling Map", modal_items_point);
+   keymap = WM_modalkeymap_add(keyconf, "Eyedropper ColorRamp 
PointSampling Map", modal_items_point);
 
/* assign to operators */
-   WM_modalkeymap_assign(keymap, "UI_OT_eyedropper_colorband_point");
+   WM_modalkeymap_assign(keymap, "UI_OT_e